/* Layout: a dark side rail on the start edge + a calm work surface; on phones the rail becomes a bottom tab bar.
   Identity: a team "dispatch board". Status lights (queued / in progress / done) carry the color; everything else stays quiet. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --raised: #f6f8fa;
  --ink: #13202a;
  --muted: #5d6b77;
  --faint: #8b98a3;
  --line: #dce2e7;
  --accent: #0a7a62;
  --accent-ink: #ffffff;
  --accent-soft: #dcf0e8;
  --st-new: #3d5a80;
  --st-new-soft: #e4eaf3;
  --st-doing: #a86200;
  --st-doing-soft: #fbecd5;
  --st-done: #0a7a62;
  --st-done-soft: #dcf0e8;
  --danger: #c13b31;
  --danger-soft: #f8e2df;
  --rail: #13202a;
  --rail-ink: #a9b6c1;
  --rail-active: #ffffff;
  --rail-hover: #1d2c38;
  --av-l-bg: 88%;
  --av-l-fg: 28%;
  --av-s: 45%;
  --shadow: 0 1px 2px rgb(19 32 42 / 0.06), 0 6px 20px rgb(19 32 42 / 0.05);
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r-sm: 7px;
  --r: 11px;
  --r-lg: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1318; --surface: #151d24; --raised: #1a232b; --ink: #e5ecf1; --muted: #93a2ae; --faint: #6b7a86; --line: #25313b;
    --accent: #3cc8a0; --accent-ink: #062018; --accent-soft: #123a2f;
    --st-new: #8fb0dc; --st-new-soft: #1b2738; --st-doing: #f0aa45; --st-doing-soft: #3a2a12; --st-done: #3cc8a0; --st-done-soft: #123a2f;
    --danger: #ff8277; --danger-soft: #3d1c19;
    --rail: #090e12; --rail-ink: #8494a0; --rail-active: #ffffff; --rail-hover: #141c23;
    --av-l-bg: 24%; --av-l-fg: 82%; --av-s: 30%;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1318; --surface: #151d24; --raised: #1a232b; --ink: #e5ecf1; --muted: #93a2ae; --faint: #6b7a86; --line: #25313b;
  --accent: #3cc8a0; --accent-ink: #062018; --accent-soft: #123a2f;
  --st-new: #8fb0dc; --st-new-soft: #1b2738; --st-doing: #f0aa45; --st-doing-soft: #3a2a12; --st-done: #3cc8a0; --st-done-soft: #123a2f;
  --danger: #ff8277; --danger-soft: #3d1c19;
  --rail: #090e12; --rail-ink: #8494a0; --rail-active: #ffffff; --rail-hover: #141c23;
  --av-l-bg: 24%; --av-l-fg: 82%; --av-s: 30%;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.3; margin: 0; text-wrap: balance; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.08rem; }
h3 { font-size: 0.98rem; }
p { margin: 0; }
.num, time, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.card-meta .icon { width: 14px; height: 14px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { font-size: 0.74rem; letter-spacing: 0.04em; color: var(--muted); font-weight: 500; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--rail);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--rail-active); font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; padding: 0 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-mark .icon { width: 17px; height: 17px; stroke-width: 2.4; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 11px;
  color: var(--rail-ink); padding: 9px 10px; border-radius: 9px;
  font: 500 0.94rem var(--font-body); background: none; border: 0; cursor: pointer; text-align: start; width: 100%;
}
.nav a:hover, .nav button:hover { background: var(--rail-hover); color: var(--rail-active); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--rail-hover); color: var(--rail-active); }
.nav a[aria-current="page"] .icon { color: var(--accent); }
.count { margin-inline-start: auto; background: var(--danger); color: #fff; border-radius: 99px; padding: 0 7px; font: 600 0.72rem/1.5 var(--font-mono); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: var(--rail-active); }
.me:hover { background: var(--rail-hover); text-decoration: none; }
.me small { display: block; color: var(--rail-ink); font-size: 0.76rem; }
.main { min-width: 0; padding-block: 28px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.topbar, .tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .main { padding-block: 0 96px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
    margin-bottom: 18px;
    padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
    background: var(--rail); color: var(--rail-active);
  }
  .topbar .brand { padding: 0; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; inset: auto 0 0 0; z-index: 20;
    background: var(--rail);
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--rail-ink); font-size: 0.7rem; padding: 6px 2px; border-radius: 9px; position: relative; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--rail-active); }
  .tabbar a[aria-current="page"] .icon { color: var(--accent); }
  .tabbar .dot { position: absolute; top: 4px; inset-inline-end: 26%; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
  h1 { font-size: 1.35rem; }
}

/* ---------- Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.section-title h2 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 18px; align-items: start; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: 500 0.92rem var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s, filter .15s;
}
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.6; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.07); }
.btn-done { background: var(--st-done); border-color: var(--st-done); color: var(--accent-ink); font-weight: 600; }
.btn-done:hover { border-color: var(--st-done); filter: brightness(1.07); }
.btn-start { background: var(--st-doing-soft); border-color: transparent; color: var(--st-doing); font-weight: 600; }
.btn-start:hover { border-color: var(--st-doing); }
.btn-danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.btn-danger:hover { border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--raised); border-color: transparent; color: var(--ink); }
.btn-sm { padding: 5px 11px; font-size: 0.84rem; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 22px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 0.84rem; font-weight: 500; color: var(--muted); }
.field small { color: var(--faint); font-size: 0.8rem; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font: inherit; color: var(--ink); background: var(--raised);
  border: 1px solid var(--line); border-radius: var(--r); padding: 9px 12px; width: 100%; min-width: 0;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 84px; }
input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.check-line { display: flex; align-items: center; gap: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.chip-check span { display: inline-block; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--raised); font-size: 0.86rem; color: var(--muted); }
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.segmented { display: flex; flex-wrap: wrap; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; gap: 3px; }
.segmented label { position: relative; flex: 1; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.segmented span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: 8px; font-size: 0.88rem; color: var(--muted); white-space: nowrap; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.filter { display: flex; flex-wrap: wrap; gap: 6px; }
.filter a { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 5px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 0.88rem; }
.filter a.all { padding: 5px 14px; }
.filter a:hover { text-decoration: none; border-color: var(--faint); }
.filter a[aria-current="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- Pills, avatars, lights ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 600; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.pill .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.pill-new { background: var(--st-new-soft); color: var(--st-new); }
.pill-doing { background: var(--st-doing-soft); color: var(--st-doing); }
.pill-done { background: var(--st-done-soft); color: var(--st-done); }
.pill-team { background: var(--danger-soft); color: var(--danger); }
.pill-initiative { background: var(--accent-soft); color: var(--accent); }
.pill-admin { background: var(--raised); color: var(--muted); border: 1px solid var(--line); }
.pill-late { background: var(--danger-soft); color: var(--danger); }
.pill-quiet { background: var(--raised); color: var(--muted); }
.avatar {
  --h: 200;
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: hsl(var(--h) var(--av-s) var(--av-l-bg)); color: hsl(var(--h) 55% var(--av-l-fg));
  font: 600 0.9rem var(--font-display);
}
.avatar-lg { width: 44px; height: 44px; font-size: 1.1rem; }
.avatar-sm { width: 24px; height: 24px; font-size: 0.72rem; }
.light { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); }
.light-working { background: var(--st-done); box-shadow: 0 0 0 4px var(--st-done-soft); }
.light-idle { background: var(--st-doing); box-shadow: 0 0 0 4px var(--st-doing-soft); animation: blink 1.6s ease-in-out infinite; }
.light-alert { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* ---------- Flash & alerts ---------- */
.flash {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent);
  border-radius: var(--r); padding: 11px 14px; box-shadow: var(--shadow);
  animation: drop .35s ease-out;
}
.flash .icon { color: var(--accent); }
.alert { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r-lg); padding: 14px 16px; }
.alert > div { min-width: 0; }
.alert-warn { background: var(--st-doing-soft); }
.alert-warn .icon { color: var(--st-doing); margin-top: 3px; }
.alert-info { background: var(--st-new-soft); }
.alert-info .icon { color: var(--st-new); margin-top: 3px; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Team status strip (admin) ---------- */
.team-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 14px; }
.member {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); min-width: 0;
  color: var(--ink);
}
a.member:hover { text-decoration: none; border-color: var(--faint); }
.member.is-idle { border-color: var(--st-doing); }
.member-top { display: flex; align-items: center; gap: 11px; }
.member-top .who { min-width: 0; flex: 1; }
.member-top .who strong { display: block; font-family: var(--font-display); font-weight: 600; }
.member-state { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--muted); }
.member-state.is-idle { color: var(--st-doing); font-weight: 600; }
.member-now { background: var(--raised); border-radius: var(--r); padding: 10px 12px; min-height: 64px; overflow-wrap: anywhere; font-size: 0.92rem; }
.member-now .eyebrow { display: block; margin-bottom: 2px; }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px dashed var(--line); padding-top: 10px; }
.stat { display: flex; flex-direction: column; }
.stat b { font: 600 1.15rem/1.2 var(--font-mono); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.74rem; color: var(--muted); }
.stat.bad b { color: var(--danger); }

/* ---------- Focus card (member) ---------- */
.focus {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px 28px; box-shadow: var(--shadow);
  display: grid; gap: 14px;
}
.focus::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: var(--st-doing); }
.focus.is-idle::before { background: var(--danger); }
.focus.is-off::before { background: var(--faint); }
.focus h2 { font-size: clamp(1.3rem, 1rem + 1.4vw, 1.9rem); line-height: 1.35; overflow-wrap: anywhere; }
.focus h2 a { color: inherit; }
.focus .timer { font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--st-doing); display: inline-flex; align-items: center; gap: 6px; }
.focus .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.focus .details { color: var(--muted); max-width: 70ch; overflow-wrap: anywhere; }
.focus-more { color: var(--muted); font-size: 0.88rem; }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 980px) { .board { grid-template-columns: minmax(0, 1fr); } }
.lane { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; }
.lane-head h2 { font-size: 0.95rem; }
.lane-head .n { margin-inline-start: auto; font: 600 0.8rem var(--font-mono); color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 0 9px; }
.lane-dot { width: 10px; height: 10px; border-radius: 3px; }
.lane-new .lane-dot { background: var(--st-new); }
.lane-doing .lane-dot { background: var(--st-doing); }
.lane-done .lane-dot { background: var(--st-done); }
.empty { color: var(--faint); font-size: 0.88rem; text-align: center; padding: 18px 8px; border: 1.5px dashed var(--line); border-radius: var(--r); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 13px; display: flex; flex-direction: column; gap: 9px; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--faint); box-shadow: var(--shadow); }
.card .title { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; line-height: 1.5; }
.card .title:hover { color: var(--accent); text-decoration: none; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.8rem; color: var(--muted); }
.card-meta .who { display: inline-flex; align-items: center; gap: 6px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lane-done .card { opacity: 0.85; }
.lane-done .card .title { text-decoration: line-through; text-decoration-color: var(--faint); text-decoration-thickness: 1px; }

/* ---------- Task page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.9rem; }
.task-head { display: flex; flex-direction: column; gap: 12px; }
.task-head h1 { overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.fact { background: var(--raised); border-radius: var(--r); padding: 10px 12px; min-width: 0; }
.fact span { display: block; font-size: 0.76rem; color: var(--muted); }
.fact b { font-weight: 600; overflow-wrap: anywhere; }
.prose { overflow-wrap: anywhere; max-width: 72ch; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; position: relative; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: 16px; top: 38px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-body { background: var(--raised); border-radius: var(--r); padding: 10px 13px; overflow-wrap: anywhere; }
.tl-body header { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 3px; }

/* ---------- Warnings ---------- */
.warn-list { display: flex; flex-direction: column; gap: 10px; }
.warn {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px;
}
.warn .reason { overflow-wrap: anywhere; }
.warn .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 0.82rem; color: var(--muted); margin-top: 3px; }
.warn.is-dismissed { opacity: 0.55; }
.warn-actions { display: flex; gap: 6px; }
@media (max-width: 560px) {
  .warn { grid-template-columns: auto minmax(0, 1fr); }
  .warn-actions { grid-column: 1 / -1; }
}
.meter { display: flex; gap: 6px; }
.meter i { width: 28px; height: 8px; border-radius: 4px; background: var(--line); }
.meter i.on { background: var(--st-doing); }
.meter i.on.hot { background: var(--danger); }
.scoreline { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
.bignum { font: 600 3rem/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.scale { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.scale div { border-radius: var(--r); padding: 10px; background: var(--raised); font-size: 0.82rem; border: 1px solid transparent; color: var(--muted); }
.scale div b { display: block; font: 600 0.95rem var(--font-mono); color: var(--ink); }
.scale div.is-here { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
@media (max-width: 560px) { .scale { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-size: 0.78rem; font-weight: 500; color: var(--muted); padding: 0 12px 10px; white-space: nowrap; }
td { padding: 13px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
td.num, th.c { text-align: center; }
td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
td.num a { font-family: var(--font-body); }
.person { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.result { display: inline-flex; flex-direction: column; gap: 2px; }
.result b { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.result.good b { color: var(--st-done); }
.result.bad b { color: var(--danger); }
.result small { color: var(--muted); font-size: 0.76rem; }
tr.is-off { opacity: 0.55; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-side {
  background: var(--rail); color: var(--rail-active);
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.auth-side h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.7rem); max-width: 15ch; line-height: 1.3; }
.auth-side p { color: var(--rail-ink); max-width: 42ch; margin-top: 12px; }
.auth-rules { display: flex; flex-direction: column; gap: 10px; max-width: 430px; }
.auth-rule { display: flex; gap: 14px; align-items: center; background: var(--rail-hover); border-radius: 12px; padding: 13px 15px; }
.auth-rule small { display: block; color: var(--rail-ink); }
.auth-main { display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-card { width: min(100%, 380px); display: flex; flex-direction: column; gap: 22px; }
.error { color: var(--danger); background: var(--danger-soft); border-radius: var(--r); padding: 10px 13px; font-size: 0.9rem; }
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-side { padding: 28px max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px)); }
  .auth-rules { display: none; }
}

/* ---------- Dialog ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / 0.25);
}
dialog::backdrop { background: rgb(9 14 18 / 0.5); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .2s ease-out; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; gap: 10px; }
.dialog-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

details.more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 14px; }
.danger-zone { border-top: 1px dashed var(--line); padding-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
