/* Call sheet modern design system with Light/Dark mode and glassmorphism */
:root {
  --paper: #f4f1ea;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.85);
  --ink: #18231f;
  --muted: #65706b;
  --forest: #153c34;
  --forest-soft: #e3ece7;
  --rust: #9f4926;
  --rust-soft: #f5e7df;
  --amber-soft: #f8efd7;
  --amber-ink: #8a5d16;
  --danger: #9a362f;
  --danger-soft: #fbeeed;
  --line: #deddd5;
  --card-shadow: 0 4px 20px -2px rgba(21, 60, 52, 0.05);
  --topbar-bg: #153c34;
  --topbar-ink: #ffffff;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --paper: #0f1715;
  --surface: #172421;
  --surface-glass: rgba(23, 36, 33, 0.85);
  --ink: #e8f0ec;
  --muted: #8fa399;
  --forest: #225e52;
  --forest-soft: #1a3832;
  --rust: #d9734e;
  --rust-soft: #382017;
  --amber-soft: #3a2e16;
  --amber-ink: #f0c068;
  --danger: #e5655a;
  --danger-soft: #3a1c1a;
  --line: #2a3d37;
  --card-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.4);
  --topbar-bg: #0b1412;
  --topbar-ink: #e8f0ec;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.topbar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .75rem 1.25rem; background: var(--topbar-bg); color: var(--topbar-ink);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700; letter-spacing: .01em; color: inherit; text-decoration: none;
  display: flex; align-items: center; gap: .4rem;
}
.brand-badge {
  background: rgba(255,255,255,0.2); font-size: 0.7rem; font-weight: 800;
  padding: 0.15rem 0.4rem; border-radius: 4px; letter-spacing: 0.05em;
}
.tab { font-size: .85rem; background: rgba(255,255,255,.16); padding: .15rem .55rem; border-radius: 4px; }
.tab-link { font-size: .85rem; color: rgba(255,255,255,.82); text-decoration: none; transition: color 0.15s; }
.tab-link:hover { color: #fff; text-decoration: underline; }
.spacer { flex: 1; }
.toggle { font-size: .8rem; color: var(--topbar-ink); display: flex; align-items: center; gap: .3rem; cursor: pointer; }
.who { font-size: .8rem; opacity: 0.85; }

.icon-btn {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  color: inherit; border-radius: 6px; padding: 0.25rem 0.5rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.25); }

main { max-width: 68rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

/* Stat Summary Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-value { font-size: 1.4rem; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-card.hot .stat-value { color: var(--rust); }
.stat-card.ok .stat-value { color: var(--forest); }

/* Search & Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.search-box {
  flex: 1;
  min-width: 260px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.5;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 0.55rem 2.2rem 0.55rem 2.2rem;
  font: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(21, 60, 52, 0.15);
}
.hotkey-kbd {
  position: absolute;
  right: 0.75rem;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
}
.filters select {
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.count { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.boot { min-height: 55vh; display: grid; place-items: center; align-content: center; text-align: center; }
.boot-mark { width: 1.25rem; height: 1.25rem; border: 2px solid var(--line); border-top-color: var(--forest); border-radius: 50%; animation: spin .8s linear infinite; }
.boot h1 { margin: .85rem 0 .2rem; font-size: 1.15rem; }
.boot p { margin: 0; color: var(--muted); font-size: .82rem; }
.boot.is-error .boot-mark { border: 0; border-radius: 0; animation: none; }
.boot.is-error .boot-mark::before { content: "!"; color: var(--danger); font-weight: 800; }
.boot.is-error p { color: var(--danger); }

.auth { max-width: 24rem; margin: 3rem auto; background: var(--surface);
        border: 1px solid var(--line); border-radius: 12px; padding: 1.75rem; box-shadow: var(--card-shadow); }
.auth h1 { font-size: 1.2rem; margin: 0 0 .3rem; }
.intro { color: var(--muted); font-size: .88rem; margin: 0 0 1.1rem; }
.auth label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.auth input { width: 100%; padding: .55rem .7rem; margin-bottom: .9rem; font: inherit;
              border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }

/* Row Cards */
.rows-container { display: flex; flex-direction: column; gap: 0.65rem; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: .6rem 1rem;
  background: var(--surface-glass); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.95rem 1.1rem;
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.row:hover { border-color: var(--forest); transform: translateX(2px); }
.row.dim { opacity: .65; }
.row-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.name { font-weight: 650; font-size: 1rem; }
.num { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.summary { margin-top: .2rem; font-size: 0.92rem; }
.summary.none { color: var(--muted); font-style: italic; }
.note-line { margin-top: .35rem; font-size: .85rem; color: var(--muted); background: var(--paper); padding: 0.3rem 0.5rem; border-radius: 4px; }

.chips { margin-top: .5rem; display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { font-size: .73rem; padding: .15rem .5rem; border-radius: 4px;
        border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-weight: 500; }
.chip.hot { border-color: var(--amber-ink); background: var(--amber-soft); color: var(--amber-ink); }
.chip.ok  { border-color: var(--forest); background: var(--forest-soft); color: var(--forest); }
.chip.no  { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

.row-side { text-align: right; display: flex; flex-direction: column; justify-content: space-between; }
.when { font-size: .78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.acts { margin-top: .4rem; display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }

.btn { font: inherit; font-size: .82rem; font-weight: 500; padding: .35rem .7rem; border-radius: 7px; cursor: pointer;
       border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
       display: inline-flex; align-items: center; gap: 0.3rem; transition: background 0.15s, border-color 0.15s; }
.btn:hover { border-color: var(--forest); background: var(--paper); }
.btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn.primary:hover { opacity: 0.9; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }

.empty { color: var(--muted); text-align: center; padding: 3rem 1rem; background: var(--surface); border-radius: 10px; border: 1px dashed var(--line); }
.error { background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger);
         padding: .65rem .85rem; border-radius: 8px; font-size: .85rem; margin-bottom: 1rem; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem; max-width: 25rem;
         background: var(--surface); color: var(--ink); box-shadow: var(--card-shadow); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
dialog h2 { font-size: 1.05rem; margin: 0 0 .9rem; }
dialog label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .8rem; }
dialog select, dialog input, dialog textarea {
  width: 100%; margin-top: .3rem; padding: .5rem .65rem; font: inherit;
  border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink);
}
dialog .btn { margin-right: .4rem; }
.dial { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0 0 .4rem; color: var(--forest); }
dialog .hint { display: block; margin: 0 0 .95rem; font-size: 0.82rem; color: var(--muted); }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  .row-side { text-align: left; }
  .acts { justify-content: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
