/* N Brain FIRST Mini — スタイル
   日本語表示・大きなボタン・ダークモード対応（prefers-color-scheme） */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6b7c;
  --border: #d5dce3;
  --accent: #1668b4;
  --accent-text: #ffffff;
  --chip-not-loaded: #b3540e;
  --chip-loaded: #1668b4;
  --chip-delivered: #1e7d32;
  --danger-bg: #fdecea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --surface: #1f262e;
    --text: #e8edf2;
    --muted: #9fb0c0;
    --border: #39434e;
    --accent: #4da3e8;
    --accent-text: #0d141b;
    --chip-not-loaded: #e89b5a;
    --chip-loaded: #6db3ec;
    --chip-delivered: #6fce7e;
    --danger-bg: #3a2320;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app-header {
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.app-header h1 { margin: 0; font-size: 22px; }
.subtitle { margin: 2px 0 12px; color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 8px; }
.tab {
  flex: 1;
  min-height: 52px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.tab.is-active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

main { padding: 16px; max-width: 960px; margin: 0 auto; }
.view { display: none; }
.view.is-active { display: block; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="date"] { min-height: 52px; font-size: 16px; padding: 0 10px; }

.btn {
  min-height: 52px;
  padding: 0 18px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-wide { width: 100%; margin-top: 16px; }
.btn-small { min-height: 44px; font-size: 14px; padding: 0 12px; }

.run-section { margin-bottom: 20px; }
.run-section h2 { font-size: 18px; margin: 0 0 8px; }
.run-counts { color: var(--muted); font-size: 14px; margin-left: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.card .row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card .item { font-weight: 700; font-size: 17px; }
.card .meta { color: var(--muted); font-size: 14px; }
.card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid currentColor;
}
.chip-not-loaded { color: var(--chip-not-loaded); }
.chip-loaded { color: var(--chip-loaded); }
.chip-delivered { color: var(--chip-delivered); }

.empty { color: var(--muted); padding: 8px 2px; }
.hint { color: var(--muted); font-size: 14px; }

.cal-title { font-size: 18px; margin: 0; flex: 1; text-align: center; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-week span { text-align: center; color: var(--muted); font-size: 13px; padding: 4px 0; }
.cal-day {
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}
.cal-day.is-today { border-color: var(--accent); border-width: 2px; }
.cal-day .cal-counts { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.cal-day.is-empty { background: transparent; border: none; cursor: default; }

form.card label, .modal-box label { display: block; margin-bottom: 12px; font-size: 14px; }
form.card input, form.card select,
.modal-box input, .modal-box select {
  display: block;
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  padding: 0 10px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
  overflow-y: auto;
  z-index: 10;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 520px;
}
.modal-box h2 { margin-top: 0; font-size: 19px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.confirm-list { margin: 0; }
.confirm-list div { display: flex; gap: 12px; padding: 4px 0; }
.confirm-list dt { width: 72px; color: var(--muted); flex-shrink: 0; }
.confirm-list dd { margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
}
.toast.is-error { background: var(--danger-bg); color: var(--text); border: 1px solid var(--chip-not-loaded); }

details.history { margin-top: 8px; }
details.history summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details.history ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
