/* Gourmet Nut ops — one design system for every page, in the Gourmet Nut
   brand (gourmetnut.com): warm cream ground, charcoal type and pill buttons,
   almond cards, a slab-serif display face and a hand-drawn highlighter under
   headings. Palette is the site's own theme palette (--global-palette1..9).

   Theme is chosen by [data-theme] on <html>, which an inline script in <head>
   sets from the saved choice or the system setting before first paint. One
   definition per theme, no duplicated media-query block. */

:root, :root[data-theme="light"] {
  color-scheme: light;

  /* brand palette, verbatim from gourmetnut.com */
  --gn-charcoal: #231f20;   /* palette1 */
  --gn-green:    #b8e396;   /* palette2 */
  --gn-sage:     #c8d7be;   /* palette3 */
  --gn-red:      #ce132a;   /* palette4 */
  --gn-gold:     #edc893;   /* palette7 */
  --gn-cream:    #fffcee;   /* palette8 */
  --gn-olive:    #648d3d;
  --gn-almond:   #f6e7c9;   /* the brand-card tan */

  --bg:          var(--gn-cream);
  --surface:     #ffffff;
  --surface-2:   #fdf8ea;
  --border:      #eee5cf;
  --border-2:    #e0d4b8;
  --text:        var(--gn-charcoal);
  --text-2:      #4d4d4d;
  --muted:       #857e70;

  --accent:      var(--gn-charcoal);
  --accent-2:    #3b3536;
  --accent-soft: #f5ebd5;
  --on-accent:   var(--gn-cream);
  --swash:       var(--gn-gold);
  --swash-2:     var(--gn-green);
  --tile:        var(--gn-almond);

  --ok:    #4d7a26;  --ok-soft:    #edf6e3;
  --err:   var(--gn-red);  --err-soft: #fdebed;
  --warn:  #9c5a06;  --warn-soft:  #fbefd9;
  --info:  #2d6a8f;  --info-soft:  #e7f0f5;
  --gray:  #6d675d;  --gray-soft:  #f3ede0;

  --r-lg: 20px;  --r: 14px;  --r-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(35,31,32,.05);
  --shadow:    0 1px 3px rgba(35,31,32,.06), 0 1px 2px rgba(35,31,32,.04);
  --shadow-lg: 0 18px 40px -18px rgba(35,31,32,.28);
  --ring:      0 0 0 3px color-mix(in srgb, var(--gn-gold) 70%, transparent);

  --font:  "Figtree", "Greycliff CF", ui-sans-serif, -apple-system, BlinkMacSystemFont,
           "Segoe UI", system-ui, sans-serif;
  --serif: "Bitter", "Lexia", "Roboto Slab", Georgia, "Times New Roman", serif;
  --mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:          #1a1817;
  --surface:     #221f1e;
  --surface-2:   #292524;
  --border:      #36312d;
  --border-2:    #47413b;
  --text:        #f7f1e2;
  --text-2:      #d0c7b4;
  --muted:       #9d9482;

  --accent:      var(--gn-cream);
  --accent-2:    #efe7cf;
  --accent-soft: rgba(237,200,147,.14);
  --on-accent:   var(--gn-charcoal);
  --swash:       rgba(237,200,147,.55);
  --swash-2:     rgba(184,227,150,.45);
  --tile:        #2e2925;

  --ok:    #a9d886;  --ok-soft:    rgba(184,227,150,.13);
  --err:   #f26b78;  --err-soft:   rgba(206,19,42,.20);
  --warn:  #f2c265;  --warn-soft:  rgba(242,194,101,.13);
  --info:  #8ec3e4;  --info-soft:  rgba(142,195,228,.13);
  --gray:  #b3aa99;  --gray-soft:  rgba(179,170,153,.11);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 1px 3px rgba(0,0,0,.45);
  --shadow-lg: 0 18px 40px -18px rgba(0,0,0,.75);
  --ring:      0 0 0 3px rgba(237,200,147,.35);
}

/* ─── base ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
code { font: 12px/1.4 var(--mono); background: var(--gray-soft);
       padding: 1px 6px; border-radius: 5px; }
b, strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

main { max-width: 1200px; margin: 0 auto; padding: 32px 28px 72px; }

/* ─── top bar ──────────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: 1200px; margin: 0 auto; padding: 0 28px; height: 60px;
  display: flex; align-items: center; gap: 22px;
}
.brand {
  display: flex; align-items: center; gap: 9px; text-decoration: none; white-space: nowrap;
}
.brand img { height: 26px; width: auto; display: block; }
/* Charcoal wordmark on light, cream on dark, wherever the logo appears. */
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark  { display: block !important; }
.brand em {
  font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); padding: 3px 7px 2px;
  border: 1px solid var(--border-2); border-radius: 999px; margin-top: 3px;
}
.logo {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  font-size: 11.5px; font-weight: 750; letter-spacing: .02em;
}

.tabs { display: flex; gap: 2px; padding: 4px; border-radius: 999px;
        background: var(--gray-soft); }
.tabs a {
  text-decoration: none; color: var(--text-2); font-size: 13.5px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.status {
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
  font-size: 12.5px; font-weight: 550; padding: 5px 11px; border-radius: 999px;
  white-space: nowrap;
}
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.warn { color: var(--warn); background: var(--warn-soft); }
.status.ok   { color: var(--ok);   background: var(--ok-soft); }
.status:hover { filter: brightness(.97); }

.theme-btn {
  width: 34px; height: 34px; padding: 0; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.theme-btn:hover:not(:disabled) { border-color: var(--border-2); color: var(--text); }
.theme-btn svg { width: 16px; height: 16px; }

.refresh { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
           min-width: 84px; text-align: right; }

.me { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700;
}
.me-name { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; font-weight: 550; }
.me-name small { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.me-out { font-size: 12.5px; color: var(--muted); text-decoration: none; margin-left: 4px; }
.me-out:hover { color: var(--text); }

.banner {
  background: var(--warn-soft); color: var(--warn); font-size: 13px;
  border-bottom: 1px solid var(--border); padding: 10px 28px; text-align: center;
}

/* ─── page header ──────────────────────────────────────────────────── */

.page { display: flex; align-items: flex-end; justify-content: space-between;
        gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page h1 {
  margin: 0 0 10px; font: 700 32px/1.15 var(--serif); letter-spacing: -.01em;
  position: relative; display: inline-block; z-index: 0;
}
/* The brand's marker swash: a slightly tilted, uneven band under the words. */
.page h1::after {
  content: ""; position: absolute; z-index: -1;
  left: -6px; right: -8px; bottom: 2px; height: 10px;
  background: var(--swash); border-radius: 3px 10px 4px 12px / 4px 8px 3px 10px;
  transform: rotate(-1.1deg);
}
.page h1.swash-green::after { background: var(--swash-2); transform: rotate(.8deg); }
.lede { margin: 0; color: var(--text-2); font-size: 14px; max-width: 70ch; }
.lede .muted { color: var(--muted); }

h2.sub {
  display: flex; align-items: baseline; gap: 8px;
  margin: 38px 0 14px; font: 700 19px/1.2 var(--serif); letter-spacing: -.005em;
}
h2.sub .muted { font-weight: 500; font-size: 13px; }

/* ─── surfaces ─────────────────────────────────────────────────────── */

.card, .builder, .latest, .empty, .table-wrap, .rows {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
}

/* ─── buttons ──────────────────────────────────────────────────────── */

.btn, button {
  font: inherit; font-size: 13.5px; font-weight: 550; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.btn:hover:not(:disabled), button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg, button svg { width: 15px; height: 15px; flex: none; }

.btn-primary, button.primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled), button.primary:hover:not(:disabled) {
  background: var(--accent-2); border-color: var(--accent-2);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-soft); border-color: transparent; color: var(--text); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }

/* ─── pills, tags, dots ────────────────────────────────────────────── */

.tag {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 550;
  padding: 2px 8px; border-radius: 999px; background: var(--gray-soft);
  color: var(--text-2); white-space: nowrap; margin-left: 6px;
}
.tag.std { background: var(--ok-soft);   color: var(--ok); }
.tag.new { background: var(--info-soft); color: var(--info); }

.kind {
  display: inline-flex; font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px;
}
.tone-go      { color: var(--ok);   background: var(--ok-soft); }
.tone-stop    { color: var(--err);  background: var(--err-soft); }
.tone-warn    { color: var(--warn); background: var(--warn-soft); }
.tone-cool    { color: var(--info); background: var(--info-soft); }
.tone-neutral { color: var(--gray); background: var(--gray-soft); }

.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
        text-transform: capitalize; }
.pill.approve { color: var(--ok);   background: var(--ok-soft); }
.pill.route   { color: var(--info); background: var(--info-soft); }
.pill.reject  { color: var(--err);  background: var(--err-soft); }

.s { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none;
     background: var(--gray); }
.s.ok { background: var(--ok); }        .s.error { background: var(--err); }
.s.degraded { background: var(--warn); } .s.skipped { background: var(--muted); }
.s.running { background: var(--info); box-shadow: 0 0 0 0 var(--info);
             animation: pulse 1.8s ease-out infinite; }
.s.never   { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-2); }
.s.missing { background: transparent; box-shadow: inset 0 0 0 1.5px var(--err); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--info) 55%, transparent); }
                   100% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .s.running { animation: none; } }

.state-ok { color: var(--ok); }
.state-error, .state-missing { color: var(--err); font-weight: 550; }
.state-degraded { color: var(--warn); font-weight: 550; }
.state-running  { color: var(--info); }

/* ─── filter chips ─────────────────────────────────────────────────── */

.filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: border-color .15s, background .15s;
}
.chip b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.chip:hover { border-color: var(--border-2); color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip.on b { color: color-mix(in srgb, var(--surface) 70%, transparent); }

/* ─── tables ───────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  text-align: left; font-size: 12px; font-weight: 550; color: var(--muted);
  padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap;
}
th:first-child { border-top-left-radius: var(--r-lg); }
th:last-child  { border-top-right-radius: var(--r-lg); }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tr.off { opacity: .5; }
tr.fresh td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ─── summary cards (Health) ───────────────────────────────────────── */

.cards { display: grid; gap: 12px; margin-bottom: 24px;
         grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.cards .card { padding: 16px 18px; box-shadow: var(--shadow-sm); }
.card .n { font: 700 30px/1.1 var(--serif); letter-spacing: -.01em;
           font-variant-numeric: tabular-nums; }
.card .t { font-size: 13px; font-weight: 600; margin-top: 6px; }
.card .d { font-size: 12px; color: var(--muted); margin-top: 1px; }
.card.ok .n { color: var(--ok); }        .card.error .n, .card.missing .n { color: var(--err); }
.card.degraded .n { color: var(--warn); } .card.running .n { color: var(--info); }
.card.never .n, .card.skipped .n { color: var(--muted); }

/* ─── Health table ─────────────────────────────────────────────────── */

.health .rt { font-weight: 600; }
.health .sched div { white-space: nowrap; }
.health .sched .tz { color: var(--muted); font-size: 11.5px; }
.fails { margin-top: 6px; }
.fails summary { cursor: pointer; color: var(--err); font-size: 12.5px; font-weight: 500;
                 list-style: none; display: inline-flex; align-items: center; gap: 5px; }
.fails summary::-webkit-details-marker { display: none; }
.fails summary::before { content: ""; width: 0; height: 0; border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent; transition: transform .15s; }
.fails[open] summary::before { transform: rotate(90deg); }
.fail { margin: 8px 0 0; padding: 9px 12px; background: var(--err-soft);
        border-radius: var(--r-sm); font-size: 12.5px; }
.run { white-space: nowrap; }
.run .muted { margin-top: 5px; }

/* ─── run / build output ───────────────────────────────────────────── */

#runout, #buildout {
  margin-top: 16px; background: #0d1117; color: #c9d1d9;
  padding: 14px 16px; border-radius: var(--r); white-space: pre-wrap;
  font: 12px/1.6 var(--mono); overflow-x: auto; border: 1px solid #21262d;
  border-left: 3px solid #484f58;
}
#runout.ok, #buildout.ok { border-left-color: #3fb950; }
#runout.error, #buildout.error { border-left-color: #f85149; }
#runout.skipped { border-left-color: #d29922; }
#runout.running, #buildout.running { border-left-color: #58a6ff; }

/* ─── Actions list ─────────────────────────────────────────────────── */

.rows { overflow: hidden; }
.arow {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) 300px; gap: 20px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.arow:last-child { border-bottom: 0; }
.arow:hover { background: var(--surface-2); }
.arow.decided { background: var(--surface-2); }
.arow.decided .arow-main { opacity: .6; }
.arow-kind .lane { font-size: 11.5px; color: var(--muted); margin-top: 7px; }
.arow-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.arow-title b { font: 700 15.5px/1.3 var(--serif); }
.arow-sub { color: var(--text-2); font-size: 13.5px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 9px 0 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 11.5px; color: var(--muted); }
.facts dd { margin: 1px 0 0; font-size: 13px; font-weight: 550; font-variant-numeric: tabular-nums; }
.arow-body {
  margin: 12px 0 0; padding: 10px 12px; font-size: 13.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.arow-decided { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.arow-act form { display: flex; flex-direction: column; gap: 8px; }
.note-input, .note {
  width: 100%; font: inherit; font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
}
.note-input:focus, .note:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.seg { display: flex; }
.seg button { flex: 1; border-radius: 0; margin-left: -1px; padding: 8px 10px; font-size: 13px; }
.seg button:first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
.seg button:last-child  { border-radius: 0 999px 999px 0; }
.seg .b-approve { color: var(--ok); }
.seg .b-route   { color: var(--info); }
.seg .b-reject  { color: var(--err); }
.seg .b-approve:hover:not(:disabled) { background: var(--ok-soft); border-color: var(--ok); z-index: 1; }
.seg .b-route:hover:not(:disabled)   { background: var(--info-soft); border-color: var(--info); z-index: 1; }
.seg .b-reject:hover:not(:disabled)  { background: var(--err-soft); border-color: var(--err); z-index: 1; }
.change summary { cursor: pointer; font-size: 12.5px; color: var(--muted); list-style: none; }
.change summary::-webkit-details-marker { display: none; }
.change summary:hover { color: var(--text); }
.change[open] summary { margin-bottom: 8px; }

/* ─── Purchasing desk ──────────────────────────────────────────────── */

.builder { padding: 0; margin-bottom: 26px; overflow: hidden; }
.two-up { display: grid; grid-template-columns: 1fr 1.35fr; }
.opt { padding: 20px 22px; display: flex; flex-direction: column; }
.opt + .opt { border-left: 1px solid var(--border); }
.opt h3 { margin: 0 0 5px; font: 700 18px/1.25 var(--serif); }
.opt p { margin: 0 0 14px; color: var(--text-2); font-size: 13px; }
.opt form { display: flex; flex-direction: column; flex: 1; margin: 0; }
.opt textarea {
  width: 100%; font: inherit; font-size: 13.5px; padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--border-2); border-radius: var(--r-sm); resize: vertical;
  background: var(--surface); color: var(--text); min-height: 64px;
}
.opt textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.opt .opt-foot { margin-top: auto; display: flex; gap: 10px; align-items: center; }
.includes { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 7px; }
.includes li { position: relative; padding-left: 22px; font-size: 13px; color: var(--text-2); }
.includes li::before {
  content: ""; position: absolute; left: 2px; top: 4px; width: 11px; height: 6px;
  border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg);
}
.builder #buildout { margin: 0 22px 20px; }

.latest { padding: 22px 24px; margin-bottom: 8px; }
.latest.fresh { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.latest-head { display: flex; justify-content: space-between; align-items: flex-start;
               gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
           color: var(--muted); margin-bottom: 6px; }
.latest-title { margin: 0; font: 700 26px/1.2 var(--serif);
                display: flex; align-items: center; gap: 4px; }
.latest-meta { margin-top: 5px; font-size: 13px; color: var(--muted); }
.latest-meta b { color: var(--text); }
.latest-act { display: flex; gap: 8px; }

.tiles { display: grid; gap: 10px; margin-top: 20px;
         grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tile { background: var(--tile); border: 1px solid transparent;
        border-radius: var(--r); padding: 14px 16px; }
.tile .n { font: 700 28px/1.1 var(--serif); letter-spacing: -.01em;
           font-variant-numeric: tabular-nums; }
.tile .t { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tile.hot { background: var(--err-soft); border-color: transparent; }
.tile.hot .n { color: var(--err); }

.books td { vertical-align: middle; }
.rep-title { font-weight: 600; max-width: 46ch; overflow: hidden;
             text-overflow: ellipsis; white-space: nowrap; }
.rep-sub { margin-top: 5px; display: flex; gap: 4px; flex-wrap: wrap; }
.rep-sub .tag { margin-left: 0; }
td.when, td.took { white-space: nowrap; font-size: 13px; }
td.took b { font-variant-numeric: tabular-nums; }
td.lanes { max-width: 300px; }
.lane-chip {
  display: inline-flex; gap: 5px; font-size: 11.5px; padding: 2px 8px; margin: 2px 4px 2px 0;
  border-radius: 999px; background: var(--gray-soft); color: var(--text-2);
  white-space: nowrap;
}
.lane-chip b { font-variant-numeric: tabular-nums; }
.lane-chip.hot { background: var(--err-soft); color: var(--err); }
.wb-act { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }

/* ─── empty + footnote ─────────────────────────────────────────────── */

.empty { padding: 48px 32px; text-align: center; }
.empty p { margin: 0 auto 6px; max-width: 54ch; }
.note-foot { margin-top: 18px; color: var(--muted); font-size: 12.5px; max-width: 80ch; }

/* ─── login ────────────────────────────────────────────────────────── */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login {
  width: 360px; max-width: 100%; padding: 32px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
}
.login .wordmark { height: 40px; width: auto; display: block; margin: 0 0 22px; }
.login h1 { font-family: var(--serif); }
.login h1 { margin: 0 0 4px; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.login label { display: block; margin: 16px 0 0; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.login input {
  width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
}
.login input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.login button { width: 100%; margin-top: 22px; padding: 11px; font-size: 14px;
                background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.login button:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.err { margin-top: 14px; padding: 9px 12px; border-radius: var(--r-sm);
       background: var(--err-soft); color: var(--err); font-size: 13px; }

/* ─── narrow screens ───────────────────────────────────────────────── */

@media (max-width: 900px) {
  .arow { grid-template-columns: 1fr; gap: 12px; }
  .arow-kind { display: flex; align-items: center; gap: 10px; }
  .arow-kind .lane { margin: 0; }
  .two-up { grid-template-columns: 1fr; }
  .opt + .opt { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 720px) {
  .topbar-in { gap: 12px; padding: 0 16px; }
  .brand > span:last-child, .refresh, .me-name, .status span { display: none; }
  main { padding: 22px 16px 56px; }
  .rep-title { max-width: 24ch; }
  .latest-act { width: 100%; }
  .latest-act .btn { flex: 1; }
}

.nowrap { white-space: nowrap; }
td.act-cell { width: 1%; }
td.lanes { max-width: 340px; }
.rep-title { max-width: 40ch; }

/* ─── review bar (Actions) ─────────────────────────────────────────── */

.review-bar {
  display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 16px;
}
.review-bar.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: var(--ok-soft); }
.review-count { display: flex; flex-direction: column; gap: 6px; min-width: 240px; flex: 1; }
.review-count b { font: 700 17px/1.2 var(--serif); }
.review-act { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.review-act form { margin: 0; }
.meter { height: 6px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; max-width: 420px; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.meter.hot i { background: var(--warn); }
.bad { color: var(--err); }

.flash { padding: 11px 16px; border-radius: var(--r); margin-bottom: 16px; font-size: 13.5px; }
.flash.ok  { background: var(--ok-soft);  color: var(--ok); }
.flash.bad { background: var(--err-soft); color: var(--err); }
.ai-off { color: var(--warn); background: var(--warn-soft); padding: 8px 12px; border-radius: var(--r-sm); margin: 0 0 12px; }

/* Viewers see the board, not the controls. The server refuses them anyway. */
body[data-role="viewer"] [data-run],
body[data-role="viewer"] [data-mail],
body[data-role="viewer"] #stdBtn,
body[data-role="viewer"] #buildForm { display: none; }

/* ─── admin ────────────────────────────────────────────────────────── */

.admin-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.card.pad { padding: 20px 22px; margin-bottom: 14px; }
.admin-grid .card.pad { margin-bottom: 0; }
.card h3 { margin: 0 0 5px; font: 700 17px/1.25 var(--serif); }
.card h3.gap { margin-top: 22px; }
.card p { margin: 0 0 12px; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.row-between form { margin: 0; flex: none; }

form.inline { display: flex; gap: 10px; align-items: flex-end; margin: 0 0 8px; }
form.inline.wrap { flex-wrap: wrap; }
form.inline label, .card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 550; }
form.inline label.grow { flex: 1; min-width: 220px; }
form.inline input[type=password] { flex: 1; }
.card input, .card select, table.users input, table.users select, table.routines select {
  font: inherit; font-size: 13.5px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--r-sm); padding: 8px 11px;
}
.card input:focus, .card select:focus, table input:focus, table select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.pages { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.pages label { flex-direction: row !important; align-items: center; gap: 5px !important; color: var(--text-2) !important; font-weight: 500 !important; white-space: nowrap; }
.danger { color: var(--err) !important; }

.spend { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.spend-top { display: flex; align-items: baseline; gap: 8px; }
.spend-n { font: 700 30px/1 var(--serif); }
.spend .meter { max-width: none; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 48px; margin-top: 6px; }
.bars i { flex: 1; background: var(--swash); border-radius: 3px 3px 0 0; min-height: 2px; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-2); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--surface); border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

.row-act { white-space: nowrap; text-align: right; }
.row-act > * { vertical-align: middle; }
details.more { display: inline-block; position: relative; }
details.more summary { list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more .menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; }
details.more .menu form { margin: 0; }
details.more .menu button { width: 100%; justify-content: flex-start; }

.reveal { padding: 20px 22px; margin-bottom: 18px; border-color: var(--swash); }
.reveal-grid { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.qr svg { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: var(--r-sm); }
.kv { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.kv div { display: flex; gap: 10px; align-items: baseline; }
.kv dt { width: 90px; color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; }
.kv code { font: 600 15px var(--mono); background: var(--surface-2); padding: 3px 8px; border-radius: 6px; user-select: all; }

@media (max-width: 800px) {
  .admin-grid { grid-template-columns: 1fr; }
  form.inline { flex-wrap: wrap; }
  .review-act { align-items: flex-start; text-align: left; }
}

/* ─── top-bar AI switch ────────────────────────────────────────────── */
.ai-switch-form { margin: 0; }
.ai-switch { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; font-size: 12.5px;
  font-weight: 650; border-radius: 999px; border: 1px solid transparent; line-height: 1; }
.ai-switch i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ai-switch.on  { color: var(--ok);  background: var(--ok-soft); }
.ai-switch.off { color: var(--err); background: var(--err-soft); }
button.ai-switch:hover:not(:disabled) { border-color: currentColor; }

/* Claude account switch */
label.radio { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; font-size: 14px; cursor: pointer; }

/* Email account card */
p.big { font-size: 18px; margin: 4px 0; }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
ol.steps { padding-left: 18px; margin: 0 0 12px; color: var(--text-2); }
ol.steps li { margin: 4px 0; }
form.stack { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
form.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
form.stack button { align-self: flex-start; }

/* Admin log: its own scroll box, so a long history doesn't stretch the page */
.log-box { max-height: 420px; overflow-y: auto; }
.log-box thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }

/* Stop button above the run output */
.stop-run { margin: 8px 0; }

/* Full failure report / log viewer */
body.textview { padding: 20px; max-width: 1100px; margin: 0 auto; }
pre.textview { white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; font-size: 12.5px; line-height: 1.5; }
