/* Shared shell for the QC control centre pages. */
  :root {
    color-scheme: dark;
    --plane:        #0d0d0d;
    --surface:      #1a1a19;
    --surface-2:    #131312;
    --ink:          #ffffff;
    --ink-2:        #c3c2b7;
    --muted:        #898781;
    --grid:         #2c2c2a;
    --axis:         #383835;
    --border:       rgba(255,255,255,0.10);

    --good:     #0ca30c;
    --warning:  #fab219;
    --serious:  #ec835a;
    --critical: #d03b3b;

    --seq-100: #cde2fb; --seq-250: #86b6ef; --seq-400: #3987e5;
    --seq-500: #256abf; --seq-600: #184f95;
    --accent:  #3987e5;

    --r: 10px;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  :root[data-theme="light"] {
    color-scheme: light;
    --plane: #f9f9f7; --surface: #fcfcfb; --surface-2: #f2f2ef;
    --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
    --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,0.10);
    --good: #006300; --accent: #2a78d6;
    --seq-400: #2a78d6; --seq-500: #256abf;
  }

  * { box-sizing: border-box; }
  body {
    margin: 0; background: var(--plane); color: var(--ink);
    font: 15px/1.5 var(--sans);
    -webkit-font-smoothing: antialiased;
  }
  .wrap { max-width: 1400px; margin: 0 auto; padding: 28px 16px 80px; }

  h1 { font-size: 21px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
  h2 {
    font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--muted);
    margin: 42px 0 14px; font-family: var(--mono);
  }
  .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

  /* ---------- header ---------- */
  header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; flex-wrap: wrap; padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
  }
  .controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  button, select, input[type=search] {
    font: inherit; font-size: 13px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 7px 12px; cursor: pointer;
  }
  button:hover, select:hover { border-color: var(--muted); }
  button.primary {
    background: var(--accent); border-color: var(--accent); color: #fff;
    font-weight: 600; padding: 8px 18px;
  }
  button.primary:hover { filter: brightness(1.1); }
  button.primary[disabled] { opacity: .55; cursor: default; filter: none; }
  input[type=search] { cursor: text; min-width: 200px; }

  /* ---------- uploader ---------- */
  .uploader { margin-top: 18px; }
  .drop {
    border: 1px dashed var(--axis); border-radius: var(--r);
    padding: 22px; text-align: center; background: var(--surface-2);
    transition: border-color .15s, background .15s;
  }
  .drop.over { border-color: var(--accent); background: var(--surface); }
  .drop b { display: block; font-size: 15px; margin-bottom: 3px; }
  .drop span { font-size: 13px; color: var(--muted); }
  .link { color: var(--accent); cursor: pointer; text-decoration: underline; }
  .uprow {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    margin-top: 12px; font-size: 13px; color: var(--ink-2);
  }
  .uprow label { display: flex; gap: 6px; align-items: center; }
  .uprow input {
    font: inherit; color: var(--ink); background: var(--surface);
    border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px;
  }
  .upfile {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 9px 13px; margin-top: 9px; font-size: 13px;
  }
  .upfile .x { margin-left: auto; color: var(--critical); cursor: pointer;
               font-size: 12px; }
  .upfile .warn { color: var(--warning); }

  /* ---------- tiles ---------- */
  .tiles {
    display: grid; gap: 12px; margin-top: 18px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
  .tile {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 16px 18px;
  }
  .tile .k {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--muted);
  }
  .tile .v { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 6px 0 2px; }
  .tile .v small { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
  .tile .n { font-size: 12px; color: var(--muted); }

  /* ---------- hero goal ---------- */
  .hero {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 22px 24px; margin-top: 18px;
  }
  .hero-top { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
  .hero-fig { font-size: 52px; font-weight: 650; letter-spacing: -0.03em; line-height: 1; }
  .hero-of { font-size: 17px; color: var(--ink-2); }
  .meter {
    position: relative; height: 16px; background: var(--surface-2);
    border-radius: 8px; margin: 18px 0 10px; overflow: hidden;
  }
  .meter .fill {
    height: 100%; background: var(--seq-400);
    border-radius: 0 4px 4px 0; transition: width .5s ease;
  }
  .meter .pace {
    position: absolute; top: 0; bottom: 0; width: 2px;
    background: var(--ink-2); opacity: .75;
  }
  .meter-legend {
    display: flex; justify-content: space-between; font-size: 12px;
    color: var(--muted); font-variant-numeric: tabular-nums;
  }
  .verdict {
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
    display: flex; gap: 28px; flex-wrap: wrap;
  }
  .verdict div { font-size: 13px; color: var(--ink-2); }
  .verdict b { display: block; font-size: 19px; color: var(--ink); font-weight: 600;
               font-variant-numeric: tabular-nums; margin-bottom: 1px; }

  /* ---------- status ---------- */
  .chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600; padding: 2px 8px 2px 6px;
    border-radius: 999px; white-space: nowrap;
    border: 1px solid currentColor;
  }
  .chip i { font-style: normal; font-size: 10px; }
  .st-good     { color: var(--good); }
  .st-warning  { color: var(--warning); }
  .st-serious  { color: var(--serious); }
  .st-critical { color: var(--critical); }
  .st-none     { color: var(--muted); }

  /* ---------- day chart ---------- */
  .chart {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 22px 24px 16px;
  }
  .bars { display: flex; align-items: flex-end; gap: 10px; height: 200px;
          position: relative; padding-top: 8px; }
  .bars .goal {
    position: absolute; left: 0; right: 0; border-top: 1px dashed var(--muted);
    pointer-events: none; opacity: .6;
  }
  .bars .goal span {
    position: absolute; right: 0; top: -17px; font-size: 10.5px;
    color: var(--muted); font-family: var(--mono); background: var(--surface);
    padding-left: 6px;
  }
  .daycol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
            height: 100%; cursor: default; position: relative; min-width: 0; }
  .daycol .bar {
    background: var(--seq-400); border-radius: 4px 4px 0 0; min-height: 2px;
    transition: background .15s;
  }
  .daycol.future .bar { background: var(--grid); }
  .daycol.settling .bar { background: var(--seq-500); }
  /* the day in progress reads as unfinished rather than as a short day */
  .daycol.live .bar {
    background: repeating-linear-gradient(135deg, var(--seq-400) 0 6px,
      var(--seq-600) 6px 12px);
  }
  .daycol:hover .bar { background: var(--seq-250); }
  .daycol .target {
    position: absolute; left: 4px; right: 4px; border-top: 1px dashed var(--muted);
    opacity: .45; pointer-events: none;
  }
  .daycol .val {
    font-size: 12px; font-variant-numeric: tabular-nums; text-align: center;
    margin-bottom: 5px; color: var(--ink-2); font-weight: 600;
  }
  .daylabels { display: flex; gap: 10px; margin-top: 8px; }
  .daylabels div {
    flex: 1; text-align: center; font-family: var(--mono); font-size: 10.5px;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
    min-width: 0;
  }

  /* ---------- tables ---------- */
  table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  thead th {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--muted); font-weight: 600;
    text-align: right; padding: 0 10px 10px; white-space: nowrap;
    border-bottom: 1px solid var(--border); cursor: pointer; user-select: none;
  }
  thead th:first-child, thead th.l { text-align: left; }
  thead th:hover { color: var(--ink-2); }
  thead th[aria-sort]:after { content: " \25BC"; font-size: 8px; }
  thead th[aria-sort="ascending"]:after { content: " \25B2"; }
  tbody td {
    padding: 8px 8px; text-align: right; border-bottom: 1px solid var(--grid);
    font-variant-numeric: tabular-nums; white-space: nowrap;
  }
  tbody td:first-child, tbody td.l { text-align: left; }
  tbody tr:hover { background: var(--surface-2); }
  .tbl { background: var(--surface); border: 1px solid var(--border);
         border-radius: var(--r); padding: 6px 18px 4px; overflow-x: auto; }
  .name { font-weight: 550; }
  .code { color: var(--muted); font-size: 11.5px; font-family: var(--mono); margin-left: 6px; }
  .dim { color: var(--muted); }

  /* footage micro-bar inside a cell */
  .mb { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
  .mb .track { width: 58px; height: 7px; background: var(--surface-2);
               border-radius: 4px; overflow: hidden; flex: none; }
  .mb .track i { display: block; height: 100%; background: var(--seq-400);
                 border-radius: 0 4px 4px 0; }
  .mb b { font-weight: 600; min-width: 38px; }

  /* per-person daily sparkline */
  .spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; }
  .spark i { width: 5px; background: var(--seq-500); border-radius: 2px 2px 0 0;
             min-height: 1px; display: block; }
  .spark i.zero { background: var(--grid); }

  /* ---------- bands ---------- */
  .bandrow { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); }
  .band { background: var(--surface); border: 1px solid var(--border);
          border-radius: var(--r); padding: 15px 17px; }
  .band .amt { font-size: 23px; font-weight: 650; letter-spacing: -0.02em; }
  .band .rng { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
               text-transform: uppercase; color: var(--muted); margin-top: 3px; }
  .band .cnt { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
  .band .cnt b { color: var(--ink); font-size: 17px; font-weight: 600; }

  /* ---------- the three levers ---------- */
  .levers { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); }
  .lever {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 16px 18px;
  }
  .lever .k {
    font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--muted);
  }
  .lever .pair { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 4px; }
  .lever .now { font-size: 27px; font-weight: 600; letter-spacing: -0.02em; }
  .lever .arrow { color: var(--muted); font-size: 15px; }
  .lever .need { font-size: 27px; font-weight: 600; color: var(--seq-250);
                 letter-spacing: -0.02em; }
  :root[data-theme="light"] .lever .need { color: var(--seq-500); }
  .lever .n { font-size: 12px; color: var(--muted); }
  .lever .gapbar { height: 6px; background: var(--surface-2); border-radius: 4px;
                   margin: 12px 0 8px; overflow: hidden; }
  .lever .gapbar i { display: block; height: 100%; border-radius: 0 4px 4px 0; }

  .note {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 2px solid var(--warning);
    border-radius: var(--r); padding: 14px 18px; font-size: 13px; color: var(--ink-2);
  }
  .note b { color: var(--ink); }
  ul.caveats { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
  ul.caveats li { margin: 5px 0; }

  .filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
  .empty { padding: 40px; text-align: center; color: var(--muted); font-size: 14px; }

  /* tooltip */
  #tip {
    position: fixed; z-index: 50; pointer-events: none; opacity: 0;
    transition: opacity .1s; background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
    font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
    box-shadow: 0 8px 28px rgba(0,0,0,.45); max-width: 260px;
  }
  #tip b { color: var(--ink); }
  @media (max-width: 720px) {
    .hero-fig { font-size: 38px; }
    .wrap { padding: 20px 12px 60px; }
  }

  /* ---------- page nav ---------- */
  .nav { display: flex; gap: 8px; }
  .nav a {
    font-size: 13px; color: var(--ink-2); text-decoration: none;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 7px 12px;
  }
  .nav a:hover { border-color: var(--muted); color: var(--ink); }
  .nav a.on { background: var(--accent); border-color: var(--accent); color: #fff;
              font-weight: 600; }
