/* ==========================================================================
   Fixoria Ops — instrument-panel visual system
   Ground: cool blueprint paper. Accent: one indigo, spent sparingly.
   Semantic colour (ok / warn / crit) is separate from the accent and only
   ever encodes task state.
   ========================================================================== */

:root {
  color-scheme: light;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  --ground: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --sunken: #e6eaf2;
  --line: #d8dee9;
  --line-soft: #e6eaf2;

  --text: #0b1220;
  --text-2: #4d5768;
  --text-3: #7c8698;

  --accent: #4a3aff;
  --accent-ink: #ffffff;
  --accent-wash: #ecebff;
  --accent-line: #c7c2ff;

  --ok: #0f7a52;
  --ok-wash: #e2f4ec;
  --warn: #a76406;
  --warn-wash: #fbeed6;
  --crit: #bf2f27;
  --crit-wash: #fbe5e3;

  --grid-line: rgba(11, 18, 32, 0.045);
  --shadow-1: 0 1px 2px rgba(11, 18, 32, 0.06);
  --shadow-2: 0 12px 34px -12px rgba(11, 18, 32, 0.28);
  --shadow-3: 0 30px 70px -20px rgba(11, 18, 32, 0.42);

  --r-sm: 4px;
  --r-md: 7px;
  --r-lg: 11px;

  --rail-w: 216px;

  /* teammate lane hues */
  --u-indigo: #4a3aff;
  --u-cyan: #0d7f96;
  --u-amber: #a05c00;
  --u-rose: #b12f5e;
  --u-green: #17714a;
  --u-violet: #6f34c0;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #080b12;
    --surface: #10161f;
    --surface-2: #151c28;
    --sunken: #0c1119;
    --line: #232c3b;
    --line-soft: #1a212d;

    --text: #e6ebf3;
    --text-2: #9ba6b8;
    --text-3: #6d7789;

    --accent: #8878ff;
    --accent-ink: #0a0d14;
    --accent-wash: #1d1b3a;
    --accent-line: #362f6b;

    --ok: #3fc38c;
    --ok-wash: #10281f;
    --warn: #e0a444;
    --warn-wash: #2a2010;
    --crit: #f0736a;
    --crit-wash: #2c1512;

    --grid-line: rgba(255, 255, 255, 0.035);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 12px 34px -12px rgba(0, 0, 0, 0.7);
    --shadow-3: 0 30px 70px -20px rgba(0, 0, 0, 0.85);

    --u-indigo: #8878ff;
    --u-cyan: #3bbcd6;
    --u-amber: #e0a444;
    --u-rose: #f2769f;
    --u-green: #4dc78d;
    --u-violet: #b184ff;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --ground: #eef1f6; --surface: #ffffff; --surface-2: #f7f9fc; --sunken: #e6eaf2;
  --line: #d8dee9; --line-soft: #e6eaf2;
  --text: #0b1220; --text-2: #4d5768; --text-3: #7c8698;
  --accent: #4a3aff; --accent-ink: #ffffff; --accent-wash: #ecebff; --accent-line: #c7c2ff;
  --ok: #0f7a52; --ok-wash: #e2f4ec; --warn: #a76406; --warn-wash: #fbeed6;
  --crit: #bf2f27; --crit-wash: #fbe5e3;
  --grid-line: rgba(11, 18, 32, 0.045);
  --shadow-1: 0 1px 2px rgba(11, 18, 32, 0.06);
  --shadow-2: 0 12px 34px -12px rgba(11, 18, 32, 0.28);
  --shadow-3: 0 30px 70px -20px rgba(11, 18, 32, 0.42);
  --u-indigo: #4a3aff; --u-cyan: #0d7f96; --u-amber: #a05c00;
  --u-rose: #b12f5e; --u-green: #17714a; --u-violet: #6f34c0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #080b12; --surface: #10161f; --surface-2: #151c28; --sunken: #0c1119;
  --line: #232c3b; --line-soft: #1a212d;
  --text: #e6ebf3; --text-2: #9ba6b8; --text-3: #6d7789;
  --accent: #8878ff; --accent-ink: #0a0d14; --accent-wash: #1d1b3a; --accent-line: #362f6b;
  --ok: #3fc38c; --ok-wash: #10281f; --warn: #e0a444; --warn-wash: #2a2010;
  --crit: #f0736a; --crit-wash: #2c1512;
  --grid-line: rgba(255, 255, 255, 0.035);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 12px 34px -12px rgba(0, 0, 0, 0.7);
  --shadow-3: 0 30px 70px -20px rgba(0, 0, 0, 0.85);
  --u-indigo: #8878ff; --u-cyan: #3bbcd6; --u-amber: #e0a444;
  --u-rose: #f2769f; --u-green: #4dc78d; --u-violet: #b184ff;
}

/* ------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

#tpl-icons { display: none; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
}

.num { font-variant-numeric: tabular-nums; }

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

/* ------------------------------------------------------------------- boot */

.boot {
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--ground);
}

.boot__mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 0.25; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1); } }

/* ------------------------------------------------------------------- brand */

.mark {
  width: 30px; height: 30px; flex: none;
  border-radius: 8px;
  background: var(--accent);
  display: grid; place-items: center;
  box-shadow: var(--shadow-1);
}

.mark svg { width: 18px; height: 18px; fill: var(--accent-ink); stroke: none; }

.wordmark {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------- login */

.gate {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1fr;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 28px 100%,
    var(--ground);
}

.gate__inner {
  width: min(420px, calc(100% - 40px));
  margin: auto;
  padding: 40px 0 64px;
}

.gate__brand { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; }
.gate__brand .sub { font-size: 11.5px; color: var(--text-3); letter-spacing: 0.02em; }

.gate__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.gate__head { padding: 20px 22px 4px; }
.gate__head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.gate__head p { margin: 5px 0 0; color: var(--text-2); font-size: 13px; }

.gate__who { display: grid; gap: 7px; padding: 18px 22px 6px; }

.who {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.12s, background 0.12s;
}
.who:hover { border-color: var(--accent-line); background: var(--surface-2); }
.who[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); }
.who__name { font-weight: 600; font-size: 13.5px; }
.who__role { font-size: 11.5px; color: var(--text-3); }

.gate__pin { padding: 12px 22px 22px; display: grid; gap: 10px; }

.pin-input {
  width: 100%;
  padding: 11px 13px;
  font-family: var(--font-mono);
  font-size: 17px;
  letter-spacing: 0.34em;
  text-align: center;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.gate__hint {
  margin: 16px 2px 0;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
}

/* --------------------------------------------------------------- app shell */

.app { display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100%; }

.rail {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 12px 12px;
  gap: 20px;
  min-height: 0;
}

.rail__brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.rail__brand .sub { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }

.rail__nav { display: grid; gap: 2px; }

.navitem {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  width: 100%;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.navitem:hover { background: var(--surface-2); color: var(--text); }
.navitem[aria-current="page"] { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.navitem[aria-current="page"] .i { color: var(--accent); }

.navitem__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--text-2);
}
.navitem__count[data-tone="warn"] { background: var(--warn-wash); color: var(--warn); }
.navitem__count[data-tone="crit"] { background: var(--crit-wash); color: var(--crit); }

.rail__spacer { flex: 1 1 auto; min-height: 8px; }

.rail__foot { display: grid; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 12px; }

.mecard { display: flex; align-items: center; gap: 9px; padding: 4px 6px; }
.mecard__name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.mecard__role { font-size: 10.5px; color: var(--text-3); }

.rail__actions { display: flex; gap: 6px; }

.ghostbtn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 8px;
  font-size: 11.5px;
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color 0.12s, color 0.12s;
}
.ghostbtn:hover { border-color: var(--accent-line); color: var(--text); }
.ghostbtn .i { width: 14px; height: 14px; }

/* ------------------------------------------------------------------- stage */

.stage {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 30px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 30px 100%,
    var(--ground);
}

.bar {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: none;
  flex-wrap: wrap;
}

.bar__title { display: grid; gap: 1px; margin-right: auto; }
.bar__title h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.bar__title .eyebrow { font-size: 10px; }

.stepper { display: flex; align-items: center; gap: 2px; }

.stepbtn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-2);
}
.stepbtn:hover { border-color: var(--accent-line); color: var(--text); }
.stepbtn + .stepbtn { margin-left: -1px; }

.todaybtn {
  padding: 0 11px; height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  margin-left: 6px;
}
.todaybtn:hover { border-color: var(--accent-line); color: var(--text); }

.primary {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-1);
  transition: filter 0.12s;
}
.primary:hover { filter: brightness(1.08); }
.primary .i { width: 15px; height: 15px; stroke-width: 2.2; }

.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
}
.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}
.live[data-state="poll"]::before { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.live[data-state="off"]::before { background: var(--crit); box-shadow: none; }

.view { flex: 1 1 auto; min-height: 0; overflow: auto; }
.view--pad { padding: 20px; }

.wrap { max-width: 1100px; margin: 0 auto; }

/* -------------------------------------------------------------- week board */

.board { padding: 14px 20px 40px; min-width: 0; overflow-x: auto; }

.grid {
  display: grid;
  grid-template-columns: 152px repeat(var(--cols, 7), minmax(126px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  min-width: 700px;
}

.grid__corner {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 10px 12px;
}

.dayhead {
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line-soft);
  display: grid; gap: 1px;
}
.dayhead:last-child { border-right: 0; }
.dayhead__dow { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.dayhead__date { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.dayhead[data-today="1"] { background: var(--accent-wash); }
.dayhead[data-today="1"] .dayhead__date { color: var(--accent); }
.dayhead[data-today="1"] .dayhead__dow { color: var(--accent); }
.dayhead[data-weekend="1"] .dayhead__date { color: var(--text-3); }

.lane {
  background: var(--surface);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
  padding: 12px;
  display: flex; gap: 10px; align-items: flex-start;
}
.lane__stripe { width: 3px; align-self: stretch; border-radius: 2px; background: var(--u); flex: none; }
.lane__name { font-size: 13px; font-weight: 650; letter-spacing: -0.01em; }
.lane__role { display: block; font-size: 10.5px; color: var(--text-3); line-height: 1.35; margin-top: 1px; }
.lane__load { margin-top: 7px; display: flex; align-items: center; gap: 6px; }

.loadbar { height: 4px; flex: 1; background: var(--sunken); border-radius: 2px; overflow: hidden; }
.loadbar span { display: block; height: 100%; background: var(--u); border-radius: 2px; }
.loadnum { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }

.cell {
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 7px;
  min-height: 96px;
  display: flex; flex-direction: column; gap: 5px;
  position: relative;
}
.cell:last-child { border-right: 0; }
.cell[data-today="1"] { background: color-mix(in srgb, var(--accent) 3.5%, transparent); }
.cell[data-weekend="1"] { background: color-mix(in srgb, var(--text) 2.5%, transparent); }
.cell[data-past="1"] { background: color-mix(in srgb, var(--text) 1.5%, transparent); }

.cell__add {
  position: absolute; inset: auto 6px 6px auto;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
  background: var(--surface);
  border: 1px dashed var(--line);
  opacity: 0;
  transition: opacity 0.12s;
}
.cell:hover .cell__add, .cell__add:focus-visible { opacity: 1; }
.cell__add:hover { color: var(--accent); border-color: var(--accent); border-style: solid; }
.cell__add .i { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- task chip */

.chip {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  padding: 6px 8px 6px 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--u, var(--line));
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform 0.1s, border-color 0.12s, box-shadow 0.12s;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--accent-line); }
.chip__top { display: flex; align-items: center; gap: 5px; }
.chip__time { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }
.chip__title { font-size: 12.5px; font-weight: 550; line-height: 1.3; letter-spacing: -0.005em; }
.chip__meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.chip[data-status="done"] { opacity: 0.62; }
.chip[data-status="done"] .chip__title { text-decoration: line-through; text-decoration-thickness: 1px; }
.chip[data-status="review"] { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.chip[data-status="rework"] { border-color: color-mix(in srgb, var(--crit) 50%, var(--line)); }
.chip[data-overdue="1"] { background: var(--crit-wash); }

/* ------------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 1.5px 5px;
  border-radius: 3px;
  background: var(--sunken);
  color: var(--text-2);
  white-space: nowrap;
}
.pill[data-tone="accent"] { background: var(--accent-wash); color: var(--accent); }
.pill[data-tone="ok"] { background: var(--ok-wash); color: var(--ok); }
.pill[data-tone="warn"] { background: var(--warn-wash); color: var(--warn); }
.pill[data-tone="crit"] { background: var(--crit-wash); color: var(--crit); }
.pill[data-tone="quiet"] { background: transparent; color: var(--text-3); border: 1px solid var(--line); }

.flag { width: 5px; height: 5px; border-radius: 50%; flex: none; background: var(--text-3); }
.flag[data-p="high"] { background: var(--crit); }
.flag[data-p="normal"] { background: var(--accent); }
.flag[data-p="low"] { background: var(--text-3); opacity: 0.5; }

.avatar {
  width: 26px; height: 26px; flex: none;
  border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--u);
  background: color-mix(in srgb, var(--u) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--u) 30%, transparent);
}
.avatar[data-size="sm"] { width: 20px; height: 20px; border-radius: 5px; font-size: 9px; }
.avatar[data-size="lg"] { width: 36px; height: 36px; border-radius: 9px; font-size: 13px; }

/* -------------------------------------------------------------- card blocks */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.card__head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.card__head h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.card__head .eyebrow { margin-left: auto; }

.card__body { padding: 14px 16px; }
.card__body--flush { padding: 0; }

.stack { display: grid; gap: 14px; }
.cols { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.empty strong { display: block; color: var(--text-2); font-size: 14px; font-weight: 600; margin-bottom: 3px; }

/* --------------------------------------------------------------- task rows */

.rows { display: grid; }

.row {
  display: flex; align-items: flex-start; gap: 11px;
  width: 100%;
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
  transition: background 0.12s, border-left-color 0.12s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); border-left-color: var(--accent); }
.row__main { min-width: 0; flex: 1; display: grid; gap: 3px; }
.row__title { font-size: 13.5px; font-weight: 550; letter-spacing: -0.005em; }
.row__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row__side { display: flex; align-items: center; gap: 7px; flex: none; padding-top: 1px; }
.row__date { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.row[data-status="done"] .row__title { text-decoration: line-through; color: var(--text-3); }

.snip {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------- scorecard */

.scoregrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); }

.scorecard { position: relative; }
.scorecard__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.scorecard__id { min-width: 0; }
.scorecard__name { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.scorecard__role { font-size: 11px; color: var(--text-3); }

.gradebox { margin-left: auto; text-align: right; flex: none; }
.gradebox__n { display: block; font-family: var(--font-mono); font-size: 25px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.gradebox__l { display: block; margin-top: 3px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; }

.meter { height: 5px; background: var(--sunken); margin: 0 16px; border-radius: 3px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; transition: width 0.4s ease; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line-soft); margin-top: 14px; border-top: 1px solid var(--line-soft); }
.stat { background: var(--surface); padding: 10px 16px; display: grid; gap: 2px; }
.stat__n { font-family: var(--font-mono); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.stat__l { font-size: 10.5px; color: var(--text-3); }
.stat[data-tone="crit"] .stat__n { color: var(--crit); }
.stat[data-tone="warn"] .stat__n { color: var(--warn); }
.stat[data-tone="ok"] .stat__n { color: var(--ok); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 30px; padding: 0 16px; margin-top: 12px; }
.spark i {
  flex: 1; border-radius: 1.5px;
  background: color-mix(in srgb, var(--u) 30%, transparent);
  min-height: 2px;
}
.spark i[data-full="1"] { background: var(--u); }

/* ------------------------------------------------------------------ drawer */

.scrim {
  position: fixed; inset: 0;
  background: color-mix(in srgb, #06080d 42%, transparent);
  backdrop-filter: blur(2px);
  z-index: 40;
  animation: fade 0.14s ease;
}
@keyframes fade { from { opacity: 0; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  z-index: 41;
  display: flex; flex-direction: column;
  animation: slide 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}
@keyframes slide { from { transform: translateX(22px); opacity: 0.4; } }

.drawer__head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 16px 16px 13px;
  border-bottom: 1px solid var(--line-soft);
}
.drawer__title { font-size: 16px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.3; }
.drawer__body { flex: 1; overflow: auto; padding: 16px; display: grid; gap: 16px; align-content: start; }
.drawer__foot { border-top: 1px solid var(--line-soft); padding: 12px 16px; display: grid; gap: 9px; }

.iconbtn {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
}
.iconbtn:hover { background: var(--sunken); color: var(--text); }

.kv { display: grid; grid-template-columns: 86px 1fr; gap: 8px 12px; align-items: center; font-size: 13px; }
.kv dt { color: var(--text-3); font-size: 11.5px; }
.kv dd { margin: 0; }

.block { display: grid; gap: 7px; }
.block__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }

.note {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.note[data-tone="ok"] { background: var(--ok-wash); border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.note[data-tone="crit"] { background: var(--crit-wash); border-color: color-mix(in srgb, var(--crit) 26%, transparent); }
.note[data-tone="warn"] { background: var(--warn-wash); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }

.feed { display: grid; gap: 9px; }
.feeditem { display: flex; gap: 9px; align-items: flex-start; }
.feeditem__body { min-width: 0; flex: 1; }
.feeditem__who { font-size: 12px; font-weight: 600; }
.feeditem__at { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-left: 5px; }
.feeditem__text { font-size: 12.5px; color: var(--text-2); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.trail { display: grid; gap: 5px; }
.trailrow { display: flex; align-items: baseline; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.trailrow__at { font-family: var(--font-mono); font-size: 10px; flex: none; }

/* ------------------------------------------------------------------ inputs */

.field { display: grid; gap: 5px; }
.field > label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }

.input, .select, .textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  transition: border-color 0.12s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-wash); }
.textarea { resize: vertical; min-height: 68px; line-height: 1.5; font-family: inherit; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.segment { display: flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.segment button {
  flex: 1; padding: 7px 6px;
  font-size: 12px; font-weight: 550;
  color: var(--text-2);
  border-right: 1px solid var(--line);
  transition: background 0.1s, color 0.1s;
}
.segment button:last-child { border-right: 0; }
.segment button:hover { background: var(--surface-2); }
.segment button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
}
.btn:hover { border-color: var(--text-3); background: var(--surface-2); }
.btn .i { width: 15px; height: 15px; }
.btn[data-variant="accent"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn[data-variant="accent"]:hover { filter: brightness(1.08); background: var(--accent); }
.btn[data-variant="ok"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn[data-variant="ok"]:hover { filter: brightness(1.08); background: var(--ok); }
.btn[data-variant="crit"] { border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); color: var(--crit); }
.btn[data-variant="crit"]:hover { background: var(--crit-wash); }
.btn[data-variant="quiet"] { border-color: transparent; color: var(--text-3); font-weight: 500; }
.btn[data-variant="quiet"]:hover { color: var(--text); background: var(--sunken); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn--grow { flex: 1; }

/* ------------------------------------------------------------------- modal */

.modal {
  position: fixed; z-index: 41;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 28px));
  max-height: min(86vh, 780px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: pop 0.15s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes pop { from { transform: translate(-50%, calc(-50% + 10px)); opacity: 0; } }

.modal__head { display: flex; align-items: center; gap: 10px; padding: 15px 16px 12px; border-bottom: 1px solid var(--line-soft); }
.modal__head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.modal__body { padding: 16px; display: grid; gap: 13px; overflow: auto; }
.modal__foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; }

.assignpick { display: flex; gap: 6px; flex-wrap: wrap; }
.assignpick button {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 550;
  transition: border-color 0.12s, background 0.12s;
}
.assignpick button:hover { border-color: var(--u); }
.assignpick button[aria-pressed="true"] { border-color: var(--u); background: color-mix(in srgb, var(--u) 11%, transparent); color: var(--u); }

.errbar {
  padding: 9px 12px;
  background: var(--crit-wash);
  border: 1px solid color-mix(in srgb, var(--crit) 30%, transparent);
  border-radius: var(--r-sm);
  color: var(--crit);
  font-size: 12.5px;
}

/* ------------------------------------------------------------------ toasts */

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }

.toast {
  padding: 9px 15px;
  background: var(--text);
  color: var(--ground);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 550;
  box-shadow: var(--shadow-2);
  animation: rise 0.2s ease;
}
.toast[data-tone="crit"] { background: var(--crit); color: #fff; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* -------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail {
    grid-row: 2;
    flex-direction: row; align-items: center;
    border-right: 0; border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    gap: 4px; overflow-x: auto;
  }
  .rail__brand, .rail__spacer, .rail__foot { display: none; }
  .rail__nav { display: flex; gap: 2px; }
  .navitem { flex-direction: column; gap: 3px; padding: 6px 11px; font-size: 10px; }
  .navitem__count { position: absolute; top: 1px; right: 3px; margin: 0; font-size: 9px; padding: 0 4px; }
  .bar { padding: 10px 13px; gap: 9px; }
  .bar__title h1 { font-size: 15px; }
  .bar__title .eyebrow { display: none; }
  .bar .primary { height: 30px; padding: 0 11px; font-size: 12.5px; }
  .todaybtn { padding: 0 9px; font-size: 11.5px; }
  .board { padding: 10px 12px 28px; }
  .grid { min-width: 0; grid-template-columns: 96px repeat(var(--cols, 7), minmax(150px, 1fr)); }
  .lane { padding: 9px; flex-direction: column; gap: 5px; }
  .lane__stripe { width: 100%; height: 3px; align-self: stretch; }
  .lane__role, .lane__load { display: none; }
  .view--pad { padding: 13px; }
  .scoregrid, .cols { grid-template-columns: 1fr; }
  .drawer { width: 100%; top: auto; height: 88vh; border-left: 0; border-top: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; }
}
