/* ═══════════════════════════════════════════════════════════════
   FileCode Portal — design system
   Typeface: Plus Jakarta Sans throughout, with tabular figures
   wherever numbers or codes sit in a column.
   Motion tokens and the polish layer are at the end of this file.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ground + ink */
  --bg:         #F4F5F8;
  --surface:    #FFFFFF;
  --surface-2:  #FAFBFC;
  --surface-3:  #F0F2F6;
  --ink:        #171A1F;
  --ink-2:      #40464F;
  --muted:      #6E7480;
  --faint:      #9AA1AC;
  --line:       #E3E6EC;
  --line-soft:  #EDEFF4;

  /* accent + semantics */
  --accent:     #0A63D6;
  --accent-ink: #FFFFFF;
  --accent-soft:#E7F0FD;
  --accent-line:#BDD6F8;
  --good:       #0F7B54;
  --good-soft:  #E3F3EC;
  --warn:       #A96A0C;
  --warn-soft:  #FBF0DC;
  --bad:        #BC2E48;
  --bad-soft:   #FBE6EA;
  --info:       #4B5563;

  /* shape + depth */
  --r-sm: 7px;
  --r:    11px;
  --r-lg: 15px;
  --sh-1: 0 1px 2px rgba(20,26,38,.05);
  --sh-2: 0 1px 3px rgba(20,26,38,.07), 0 8px 22px -14px rgba(20,26,38,.28);
  --sh-3: 0 10px 40px -12px rgba(20,26,38,.28), 0 2px 6px rgba(20,26,38,.06);
  --sidebar-w: 254px;

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* One typeface throughout. Figures and codes keep tabular numerals so columns
     still line up — the alignment came from the numerals, not from a mono face. */
  --mono: var(--font);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0B0D11;
    --surface:   #14171D;
    --surface-2: #191D24;
    --surface-3: #1F242C;
    --ink:       #E9ECF2;
    --ink-2:     #BEC5D0;
    --muted:     #8A93A1;
    --faint:     #6B7482;
    --line:      #262B34;
    --line-soft: #1E232B;
    --accent:    #4C9AFF;
    --accent-ink:#06121F;
    --accent-soft:#16263B;
    --accent-line:#294466;
    --good:      #45BE8E;
    --good-soft: #12291F;
    --warn:      #D6A03F;
    --warn-soft: #2C2312;
    --bad:       #EE6982;
    --bad-soft:  #30161D;
    --info:      #97A1AF;
    --sh-1: 0 1px 2px rgba(0,0,0,.5);
    --sh-2: 0 1px 3px rgba(0,0,0,.5), 0 10px 26px -16px rgba(0,0,0,.9);
    --sh-3: 0 14px 44px -14px rgba(0,0,0,.85), 0 2px 8px rgba(0,0,0,.5);
  }
}
[data-theme="dark"] {
  --bg:        #0B0D11;
  --surface:   #14171D;
  --surface-2: #191D24;
  --surface-3: #1F242C;
  --ink:       #E9ECF2;
  --ink-2:     #BEC5D0;
  --muted:     #8A93A1;
  --faint:     #6B7482;
  --line:      #262B34;
  --line-soft: #1E232B;
  --accent:    #4C9AFF;
  --accent-ink:#06121F;
  --accent-soft:#16263B;
  --accent-line:#294466;
  --good:      #45BE8E;
  --good-soft: #12291F;
  --warn:      #D6A03F;
  --warn-soft: #2C2312;
  --bad:       #EE6982;
  --bad-soft:  #30161D;
  --info:      #97A1AF;
  --sh-1: 0 1px 2px rgba(0,0,0,.5);
  --sh-2: 0 1px 3px rgba(0,0,0,.5), 0 10px 26px -16px rgba(0,0,0,.9);
  --sh-3: 0 14px 44px -14px rgba(0,0,0,.85), 0 2px 8px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.55;
  letter-spacing: -0.002em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 5px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.022em; text-wrap: balance; }
h1 { font-size: 25px; }
h2 { font-size: 18px; }
h3 { font-size: 15.5px; letter-spacing: -0.014em; }
p  { margin: 0 0 12px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num  { font-variant-numeric: tabular-nums; }
/* Figures that stay where they are. Inside a table `.num` also right-aligns,
   which is wrong for a date sitting under a left-aligned header. */
.figs { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny  { font-size: 11.5px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }
.stack   { display: flex; flex-direction: column; gap: 14px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row  { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; stroke-width: 1.7; }
.icon-sm { width: 15px; height: 15px; stroke-width: 1.9; }
.icon-lg { width: 26px; height: 26px; stroke-width: 1.5; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── app frame ───────────────────────────────────────────── */
#app { min-height: 100%; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(160deg, var(--accent), color-mix(in oklab, var(--accent) 62%, #16233A));
  color: #fff; display: grid; place-items: center; box-shadow: var(--sh-1);
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.brand-role { font-size: 11.5px; color: var(--muted); }

.nav { padding: 6px 11px 14px; display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 11px; font-weight: 600; color: var(--faint);
  padding: 15px 9px 6px; letter-spacing: .01em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 450;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  font-family: inherit; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.nav-item .icon { opacity: .85; }
.nav-item.on .icon { opacity: 1; }
.nav-count {
  margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 1px 7px;
  border-radius: 20px; background: var(--surface-3); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.on .nav-count { background: color-mix(in oklab, var(--accent) 18%, transparent); color: var(--accent); }
.nav-count.alert { background: var(--bad); color: #fff; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding: 11px; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); }
.userchip:hover { background: var(--surface-3); }
.avatar {
  width: 31px; height: 31px; border-radius: 50%; flex: 0 0 auto;
  background: var(--surface-3); color: var(--ink-2);
  display: grid; place-items: center; font-size: 12px; font-weight: 650;
  border: 1px solid var(--line);
}

/* ── main ────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
  padding: 13px 26px; display: flex; align-items: center; gap: 14px;
}
.topbar h1 { font-size: 19px; }
.topbar-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.content { padding: 24px 26px 64px; max-width: 1280px; width: 100%; }

/* ── buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s, opacity .12s;
  white-space: nowrap; box-shadow: var(--sh-1);
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .48; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, #000); }
.btn-danger { background: var(--bad); border-color: transparent; color: #fff; }
.btn-danger:hover { background: color-mix(in oklab, var(--bad) 88%, #000); }
.btn-good { background: var(--good); border-color: transparent; color: #fff; }
.btn-good:hover { background: color-mix(in oklab, var(--good) 88%, #000); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 11px 20px; font-size: 15px; border-radius: 10px; }
.btn-icon { padding: 7px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ── cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-1); overflow: hidden;
}
.card-pad { padding: 18px 20px; }
.card-head {
  padding: 14px 20px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2);
}
.card-head h3 { font-size: 14.5px; }
.card-body { padding: 18px 20px; }
.card-foot { padding: 13px 20px; border-top: 1px solid var(--line-soft); background: var(--surface-2); }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0,1fr); gap: 18px; }
@media (min-width: 1080px) { .split { grid-template-columns: minmax(0,1fr) 336px; align-items: start; } }

/* ── stat tiles ──────────────────────────────────────────── */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 17px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 2px;
}
.stat-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-top .icon { width: 16px; height: 16px; }
.stat-v { font-size: 27px; font-weight: 620; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-n { font-size: 12px; color: var(--muted); }
.stat.accent .stat-v { color: var(--accent); }
.stat.good   .stat-v { color: var(--good); }
.stat.warn   .stat-v { color: var(--warn); }
.stat.bad    .stat-v { color: var(--bad); }

/* ── pills ───────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 560; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.pill .icon { width: 13px; height: 13px; stroke-width: 2.1; }
.pill.queue { background: var(--surface-3); color: var(--muted); }
.pill.run   { background: var(--warn-soft); color: var(--warn); }
.pill.good  { background: var(--good-soft); color: var(--good); }
.pill.bad   { background: var(--bad-soft); color: var(--bad); }
.pill.info  { background: var(--accent-soft); color: var(--accent); }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1 } 50% { opacity: .28 } }

/* ── tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  white-space: nowrap;
}
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t tbody tr:last-child td { border-bottom: none; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: var(--surface-2); }
.code-cell { font-family: var(--mono); font-size: 12.5px; font-weight: 550; }

/* ── forms ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 13px; font-weight: 550; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: 8.5px 11px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in oklab, var(--line) 55%, var(--muted)); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3.5px color-mix(in oklab, var(--accent) 16%, transparent);
}
textarea { resize: vertical; min-height: 88px; line-height: 1.55; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E7480' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 30px; }
.form-grid { display: grid; gap: 15px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.radio-card {
  border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px;
  cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s;
  display: flex; gap: 11px; align-items: flex-start;
}
.radio-card:hover { border-color: var(--accent-line); }
.radio-card.on { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { display: none; }
.radio-card .rc-title { font-weight: 600; font-size: 14px; }
.radio-card .rc-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ── drop zone ───────────────────────────────────────────── */
.drop {
  border: 1.5px dashed var(--line); border-radius: var(--r); padding: 22px 18px;
  text-align: center; background: var(--surface-2); cursor: pointer;
  transition: border-color .14s, background .14s; color: var(--muted);
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop input { display: none; }
.filelist { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.filerow {
  display: flex; align-items: center; gap: 9px; padding: 7px 11px;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 8px; font-size: 13px;
}
.filerow .icon { color: var(--muted); }

/* ── pipeline rail ───────────────────────────────────────── */
.rail { display: flex; flex-direction: column; gap: 0; }
.rail-step { display: flex; gap: 13px; position: relative; padding-bottom: 16px; }
.rail-step:last-child { padding-bottom: 0; }
.rail-step::before {
  content: ''; position: absolute; left: 12px; top: 26px; bottom: 0; width: 1.5px; background: var(--line);
}
.rail-step:last-child::before { display: none; }
.rail-dot {
  width: 25px; height: 25px; border-radius: 50%; flex: 0 0 auto; z-index: 1;
  display: grid; place-items: center; background: var(--surface-3); color: var(--faint);
  border: 1.5px solid var(--line);
}
.rail-step.done .rail-dot { background: var(--good); border-color: var(--good); color: #fff; }
.rail-step.now  .rail-dot { background: var(--warn); border-color: var(--warn); color: #fff; }
.rail-step.done::before { background: var(--good); opacity: .35; }
.rail-title { font-weight: 550; font-size: 13.8px; }
.rail-note { font-size: 12.3px; color: var(--muted); margin-top: 1px; }

/* ── progress ────────────────────────────────────────────── */
.bar { height: 7px; border-radius: 20px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: var(--accent); transition: width .5s cubic-bezier(.4,0,.2,1); }
.bar.good > i { background: var(--good); }
.bar.warn > i { background: var(--warn); }
.bar.bad  > i { background: var(--bad); }

/* ── notices ─────────────────────────────────────────────── */
.notice {
  display: flex; gap: 11px; padding: 13px 15px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px; line-height: 1.5;
}
.notice .icon { flex: 0 0 auto; margin-top: 1px; }
.notice.info { background: var(--accent-soft); border-color: var(--accent-line); color: color-mix(in oklab, var(--accent) 78%, var(--ink)); }
.notice.good { background: var(--good-soft); border-color: color-mix(in oklab, var(--good) 30%, transparent); color: color-mix(in oklab, var(--good) 82%, var(--ink)); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in oklab, var(--warn) 32%, transparent); color: color-mix(in oklab, var(--warn) 82%, var(--ink)); }
.notice.bad  { background: var(--bad-soft);  border-color: color-mix(in oklab, var(--bad) 30%, transparent);  color: color-mix(in oklab, var(--bad) 82%, var(--ink)); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li { margin-bottom: 3px; }

/* ── empty state ─────────────────────────────────────────── */
.empty { padding: 52px 24px; text-align: center; color: var(--muted); }
.empty .icon-lg { color: var(--faint); margin-bottom: 10px; }
.empty h3 { color: var(--ink-2); margin-bottom: 5px; }

/* ── toast ───────────────────────────────────────────────── */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 268px; max-width: 400px;
  padding: 12px 15px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--sh-3); font-size: 13.5px;
}
.toast.good .icon { color: var(--good); }
.toast.bad  .icon { color: var(--bad); }
.toast.info .icon { color: var(--accent); }

/* ── modal ───────────────────────────────────────────────── */
.backdrop {
  position: fixed; inset: 0; z-index: 150; background: rgba(11,14,20,.45);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 22px;
}
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); width: min(620px, 100%); max-height: 88vh; overflow: auto;
}
.modal.wide { width: min(940px, 100%); }
.modal-head { padding: 17px 21px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-body { padding: 20px 21px; }
.modal-foot { padding: 14px 21px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 9px; background: var(--surface-2); }


/* ── draft editor ────────────────────────────────────────── */
.editor { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
@media (min-width: 1100px) { .editor { grid-template-columns: minmax(0,1fr) 300px; align-items: start; } }
.editor textarea { min-height: 62vh; font-family: var(--mono); font-size: 13px; line-height: 1.68; }
.prose { line-height: 1.68; font-size: 14.5px; }
.prose h1, .prose h2, .prose h3 { margin: 22px 0 9px; }
.prose h1:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 20px; }

/* ── kv list ─────────────────────────────────────────────── */
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv > span:first-child { color: var(--muted); flex: 0 0 auto; }
.kv > span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* ── usage bars ──────────────────────────────────────────── */
.meterline { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.meterline:last-child { border-bottom: none; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 46px; }
.spark > i { flex: 1 1 0; min-width: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .82; }
.spark > i.b { background: var(--good); }

/* ── mobile ──────────────────────────────────────────────── */
.menu-btn { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0,1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; width: var(--sidebar-w);
    transform: translateX(-102%); transition: transform .22s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--sh-3);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 15px 60px; }
  .topbar { padding: 11px 15px; }
  .topbar h1 { font-size: 17px; }
  .scrim { position: fixed; inset: 0; z-index: 99; background: rgba(11,14,20,.4); }
}


/* ── inputs with icons ───────────────────────────────────── */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .in-icon {
  position: absolute; left: 12px; color: var(--faint); pointer-events: none;
  width: 17px; height: 17px; stroke-width: 1.8;
}
.input-wrap input { padding-left: 38px; }
.input-wrap.has-btn input { padding-right: 42px; }
.input-wrap > .in-btn {
  position: absolute; right: 6px; display: grid; place-items: center;
  width: 30px; height: 30px; border: none; background: none; border-radius: 7px;
  color: var(--faint); cursor: pointer; padding: 0;
}
.input-wrap > .in-btn:hover { background: var(--surface-3); color: var(--ink-2); }
.input-wrap input:focus ~ .in-icon { color: var(--accent); }

/* ── checkbox ────────────────────────────────────────────── */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  width: 18px; height: 18px; border-radius: 6px; flex: 0 0 auto;
  border: 1.5px solid var(--line); background: var(--surface);
  display: grid; place-items: center; transition: background .12s, border-color .12s;
}
.check .box svg { width: 12px; height: 12px; stroke-width: 3; color: #fff; opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── login ───────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1fr); background: var(--bg); }
@media (min-width: 1000px) { .login-page { grid-template-columns: 1.02fr .98fr; } }

.login-art {
  display: none; padding: 54px 52px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(158deg, #0C2A52 0%, #0A63D6 56%, #2E8AF0 100%);
  flex-direction: column; justify-content: space-between;
}
@media (min-width: 1000px) { .login-art { display: flex; } }
.login-art::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(620px 340px at 82% 8%, rgba(255,255,255,.20), transparent 62%),
    radial-gradient(520px 420px at 8% 96%, rgba(0,0,0,.22), transparent 60%);
}
.login-art > * { position: relative; z-index: 1; }
.login-art h2 { font-size: 33px; font-weight: 700; letter-spacing: -.032em; line-height: 1.2; max-width: 16ch; }
.login-art .lead { opacity: .82; font-size: 14.5px; max-width: 34ch; margin-top: 12px; }

.login-flow { display: flex; flex-direction: column; gap: 2px; margin-top: 34px; }
.login-flow-row {
  display: flex; align-items: center; gap: 13px; font-size: 14px;
  padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.10); margin-bottom: 7px;
}
.login-flow-row .fi {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: rgba(255,255,255,.16); display: grid; place-items: center;
}
.login-flow-row .fi svg { width: 16px; height: 16px; }

.login-side { display: grid; place-items: center; padding: 30px 22px; }
.login-form { width: min(392px, 100%); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; }
.login-brand .brand-mark { width: 38px; height: 38px; border-radius: 10px; }
.login-form h1 { font-size: 27px; font-weight: 700; letter-spacing: -.03em; }
.login-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* the compact pipeline strip, shown only when the art panel is hidden */
.login-mini { display: flex; gap: 7px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
@media (min-width: 1000px) { .login-mini { display: none; } }
.login-mini > div {
  flex: 1; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.login-mini svg { width: 17px; height: 17px; color: var(--accent); opacity: .85; }
.login-mini span { font-size: 10.5px; line-height: 1.25; }

.picked td { background: var(--accent-soft); }
#sel-all { color: var(--muted); }

/* ── codes and identifiers ───────────────────────────────────
   File codes and account IDs are things people read aloud and type back, so they
   get a monospaced face — but sized, weighted and tracked to sit comfortably
   beside Jakarta rather than looking like pasted terminal output. */
.mono, code, pre, .code-cell,
input.mono, textarea.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 1;
}
.code-cell {
  font-size: 12.8px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.brand-role, .tiny.mono, .avatar + div .mono { letter-spacing: -0.01em; }
.userchip .mono { font-size: 10.8px; font-weight: 500; letter-spacing: .008em; }

/* ── pills read as words, not database values ────────────── */
.pill {
  font-family: var(--font);
  font-weight: 600;
  font-size: 11.6px;
  letter-spacing: -0.004em;
  padding: 3px 10px;
}
.pill.mono, .pill .mono { font-family: var(--mono); font-weight: 500; }

/* Jakarta's caps are wide; ease the tracking back on small uppercase labels. */
.nav-label { letter-spacing: .015em; text-transform: none; font-size: 11.5px; font-weight: 700; }
table.t th { font-size: 11.4px; font-weight: 650; letter-spacing: -0.003em; }
.stat-top { font-weight: 600; }
.tile .k, .meter-label { letter-spacing: .09em; }
h1, h2, h3, h4 { font-weight: 700; }
.btn { font-weight: 600; }
.nav-item { font-weight: 500; }
.nav-item.on { font-weight: 650; }

/* ═══════════════════════════════════════════════════════════════
   POLISH LAYER
   One vocabulary for motion, one for alignment. Everything below
   animates only transform / opacity / colour, so nothing reflows
   mid-transition and the app never judders.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* durations — short enough to feel instant, long enough to read */
  --t-instant: 90ms;
  --t-fast:   150ms;
  --t-base:   220ms;
  --t-slow:   340ms;
  /* easing — standard settles, exit accelerates, spring adds life */
  --e-out:    cubic-bezier(.16, 1, .3, 1);
  --e-in-out: cubic-bezier(.65, 0, .35, 1);
  --e-spring: cubic-bezier(.34, 1.4, .5, 1);
}

/* ── the base pass ───────────────────────────────────────────
   Anything a person can touch responds, and always the same way. */
.btn, .nav-item, .card, .stat, .filerow, .radio-card, .drop,
.pill, .check .box, .in-btn, .avatar, table.t tbody tr, .tile {
  transition:
    background-color var(--t-fast) var(--e-out),
    border-color     var(--t-fast) var(--e-out),
    color            var(--t-fast) var(--e-out),
    box-shadow       var(--t-base) var(--e-out),
    transform        var(--t-fast) var(--e-out),
    opacity          var(--t-fast) var(--e-out);
}

/* ── buttons ─────────────────────────────────────────────── */
.btn { will-change: transform; }
.btn:hover:not([disabled])  { transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active:not([disabled]) { transform: translateY(0) scale(.978); box-shadow: var(--sh-1); transition-duration: var(--t-instant); }
.btn-primary:hover:not([disabled]) { box-shadow: 0 4px 14px -4px color-mix(in oklab, var(--accent) 55%, transparent); }
.btn-good:hover:not([disabled])    { box-shadow: 0 4px 14px -4px color-mix(in oklab, var(--good) 55%, transparent); }
.btn-danger:hover:not([disabled])  { box-shadow: 0 4px 14px -4px color-mix(in oklab, var(--bad) 55%, transparent); }
.btn-ghost:hover:not([disabled])   { transform: none; box-shadow: none; }
.btn[disabled] { transform: none !important; }

/* ── cards lift a little, never a lot ────────────────────── */
.card:hover  { box-shadow: var(--sh-2); }
.stat:hover  { box-shadow: var(--sh-2); transform: translateY(-1px); }
.filerow:hover { background: var(--surface-3); border-color: var(--line); }

/* ── nav ─────────────────────────────────────────────────── */
.nav-item { position: relative; }
.nav-item::before {
  content: ''; position: absolute; left: -11px; top: 50%;
  width: 3px; height: 0; border-radius: 0 3px 3px 0; background: var(--accent);
  transform: translateY(-50%); transition: height var(--t-base) var(--e-out);
}
.nav-item.on::before { height: 18px; }
.nav-item:hover:not(.on) { transform: translateX(1px); }

/* ── rows ────────────────────────────────────────────────── */
table.t tbody tr.click:hover { background: var(--surface-2); }
table.t tbody tr.click:active { background: var(--surface-3); }
.row-done { opacity: .52; }

/* ── inputs settle rather than snap ──────────────────────── */
input, select, textarea {
  transition: border-color var(--t-fast) var(--e-out),
              box-shadow   var(--t-fast) var(--e-out),
              background-color var(--t-fast) var(--e-out);
}
.check .box   { transition: background-color var(--t-fast) var(--e-out), border-color var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-spring); }
.check:hover .box { border-color: var(--accent); }
.check input:checked + .box { transform: scale(1.04); }
.check .box svg { transition: opacity var(--t-fast) var(--e-out), transform var(--t-base) var(--e-spring); }

/* ── table alignment ─────────────────────────────────────────
   Every cell shares one baseline, whatever it holds. */
table.t th, table.t td { vertical-align: middle; }
table.t td > .row { min-height: 24px; }

/* `table.t th` outranks a bare `.num`, so the header rules must be scoped too —
   otherwise a right-aligned column header sits over left-aligned figures. */
table.t th.num, table.t td.num,
table.t th.right, table.t td.right { text-align: right; }
table.t th.num, table.t td.num { font-variant-numeric: tabular-nums; }

/* the select column: header control and row control on one axis */
table.t th.cell-check, table.t td.cell-check {
  width: 44px; padding-left: 16px; padding-right: 0;
  text-align: left; line-height: 0;
}
.cell-check .check { display: inline-flex; gap: 0; vertical-align: middle; }
.check-all {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; padding: 0; border: none; background: none;
  color: var(--muted); cursor: pointer; border-radius: 5px; line-height: 0;
  transition: color var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-spring);
}
.check-all:hover { color: var(--accent); transform: scale(1.08); }
.picked td { background: var(--accent-soft); }
.picked td.code-cell { color: var(--accent); }

/* ── keyframes — four, and only four ─────────────────────── */
@keyframes rise   { from { opacity: 0; transform: translateY(6px);  } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes sheen  { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── view transitions: content arrives, it does not jump ─── */
#view { animation: rise var(--t-slow) var(--e-out) both; }
#view > * { min-height: 0; }
.main { contain: layout paint; }

.modal   { animation: settle var(--t-base) var(--e-spring) both; }
.backdrop{ animation: rise var(--t-fast) var(--e-out) both; }
.toast   { animation: settle var(--t-base) var(--e-spring) both; }

/* ── skeletons replace the bare word "Loading" ───────────── */
.skeleton {
  border-radius: 8px; background: var(--surface-3);
  background-image: linear-gradient(90deg,
    var(--surface-3) 0%, var(--surface-2) 45%, var(--surface-3) 90%);
  background-size: 200% 100%;
  animation: sheen 1.35s linear infinite;
}
.sk-line { height: 12px; margin-bottom: 9px; }
.sk-card { height: 118px; border-radius: var(--r); }

/* ── the spinner is the only thing allowed to spin ───────── */
.spinning { animation: spin 900ms linear infinite; transform-origin: 50% 50%; }
.btn[disabled] .icon { animation: spin 900ms linear infinite; }

/* ── scrollbars and selection, so nothing looks unfinished ─ */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 20px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }
::selection { background: color-mix(in oklab, var(--accent) 26%, transparent); color: var(--ink); }

/* ── keep the theme from flashing on first paint ─────────── */
html { background: var(--bg); color-scheme: light dark; }

/* ── one honest reduced-motion switch ────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover, .stat:hover, .nav-item:hover { transform: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   ONE TYPEFACE
   Plus Jakarta Sans carries everything, including file codes and
   account IDs. Codes get tabular figures and a touch of tracking so
   they stay scannable and typeable without a monospaced face.
   ═══════════════════════════════════════════════════════════════ */

.mono, code, pre, .code-cell, input.mono, textarea.mono,
.stat-v, .tile .v, .meter-pct, .num, .figs, table.t td.num, table.t th.num {
  font-family: var(--font);
  font-variant-numeric: tabular-nums lining;
}

/* identifiers people read out and type back */
.code-cell, .brand-role, .userchip .mono, .tiny.mono {
  letter-spacing: .012em;
  font-variant-numeric: tabular-nums lining;
}
.code-cell { font-size: 13.2px; font-weight: 650; letter-spacing: .01em; }
.userchip .mono { font-size: 11.2px; font-weight: 550; letter-spacing: .02em; }

/* inline code and prompt templates: tinted, not typewritten */
code {
  font-size: 12.6px; font-weight: 600;
  background: var(--surface-3); border: 1px solid var(--line-soft);
  border-radius: 5px; padding: 1px 5px; letter-spacing: .004em;
}
pre, textarea.mono {
  font-size: 13px; line-height: 1.62; letter-spacing: .002em;
  tab-size: 2;
}
textarea.mono { font-weight: 450; }

/* figures stay steady when a number changes under a live update */
.stat-v, .tile .v, .meter-pct, .nav-count, .kv .v { font-variant-numeric: tabular-nums lining; }

/* A value too long to sit beside its label stacks under it instead of
   wrapping into a ragged right-aligned block. */
.kv-long { display: block; }
.kv-long > span:first-child { display: block; margin-bottom: 3px; }
.kv-long > span:last-child { display: block; text-align: left; }

/* ═══════════════════════════════════════════════════════════════
   STEADINESS
   Fixes for the things that made the page move under the cursor.
   Nothing here adds decoration; it all removes movement.
   ═══════════════════════════════════════════════════════════════ */

/* The document must not collapse between routes — losing the scrollbar
   shifts every page 11px sideways for a frame. */
#view { min-height: calc(100vh - 190px); }
html { scrollbar-gutter: stable; }

/* The subtitle appears once data lands; reserve its line from the start. */
.topbar-sub { min-height: 17px; }
.topbar h1 { line-height: 1.25; }

/* A button mid-action keeps its box, so neighbours never shuffle. */
.btn.is-busy { position: relative; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 700ms linear infinite;
}

/* The selection summary changes text on every click — hold its width. */
#bulk-bar { min-height: 30px; }
#sel-count { min-width: 210px; text-align: right; display: inline-block; }

/* The sign-in error must not push the button out from under the pointer. */
#login-error { margin: 0; }
.login-form .stack { min-height: 268px; }

/* Progress: scale a full-width bar instead of animating its width, so the
   browser composites rather than re-lays-out on every frame. */
.bar > i {
  width: 100% !important;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  transition: transform var(--t-slow) var(--e-out);
}

/* Promote only what is actually moving, and only while it moves. */
.btn { will-change: auto; }
.btn:hover:not([disabled]) { will-change: transform; }

/* The backdrop carries a full-screen blur; fade it, never move it. */
@keyframes fadeOnly { from { opacity: 0; } to { opacity: 1; } }
.backdrop { animation: fadeOnly var(--t-fast) var(--e-out) both; }

/* A toast must be able to leave. `both` pinned it at full opacity. */
.toast { animation: settle var(--t-base) var(--e-spring); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--t-base) var(--e-in-out), transform var(--t-base) var(--e-in-out); }

/* One spring on the checkbox, not two fighting each other. */
.check input:checked + .box { transform: none; }
.check .box svg { transition: opacity var(--t-fast) var(--e-out); transform: none; }
.check input:checked + .box svg { opacity: 1; }

/* The nav marker scales rather than growing, so no reflow per hover. */
.nav-item::before { height: 18px; transform: translateY(-50%) scaleY(0); transition: transform var(--t-base) var(--e-out); }
.nav-item.on::before { transform: translateY(-50%) scaleY(1); }

/* Reduced motion wins outright — declared last so nothing can resurrect it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .btn.is-busy::after { animation: none !important; border-right-color: currentColor; opacity: .4; }
}
