/* Tokens (colours, type and spacing scales), the shell (header, ☰ menu, content), focus, loading. */
:root {
    /* Steel greys for the surface; status colours apart from the brand. */
    --bg: #15181b; --panel: #1e2327; --raised: #262c31; --hover: #2e353b; --line: #343b41; --line-soft: #2b3136;
    --text: #e3e5e1; --dim: #9aa3a9; --faint: #8a949b;   /* 4.5:1 or better on every surface, raised included */
    --pass: #4fb06d; --fail: #e0625a; --warn: #d6a23c; --accent: #3f6fb6; --link: #8db0ea; --sel: #24344d;
    /* The temper scale: the colours steel turns as it is heated, straw to blue. The brand (the mark,
       home's flow, a training's checkpoints); never a status. */
    /* Status: text, a fill behind it, a border. Every status colour comes from here (chips, toasts, the review grid, diagrams). */
    --good-text: #7fd39a; --good-bg: rgba(79, 176, 109, .14); --good-line: #3c7a50;
    --bad-text: #f2958e; --bad-bg: rgba(224, 98, 90, .14); --bad-line: #8f3f3a;
    --warn-text: #e8c177; --warn-bg: rgba(214, 162, 60, .14); --warn-line: #8a6a2e;
    --busy-text: #9dbbf5; --busy-bg: rgba(91, 141, 239, .16); --busy-line: #3d5f9a;
    --idle-text: #b4bcc1; --idle-bg: rgba(154, 163, 169, .12);
    --bad-solid: #3b2422; --good-solid: #1e3428;   /* toasts: opaque, over the page */
    --kind-llm: #8b7bd8; --kind-automation: #3fa39a; --kind-score: #c49a4a;   /* a judge step's kind, in its diagram */
    --img-bg: #22282d;   /* behind an image while it loads */
    --t1: #d8b45c; --t2: #b8763a; --t3: #7b4f9d; --t4: #3f6fb6;
    --temper: linear-gradient(90deg, var(--t1), var(--t2) 33%, var(--t3) 66%, var(--t4));
    --header-h: 52px;
    /* One type scale and one spacing scale: use these, not new pixel values. */
    --fs-xs: 12px; --fs-s: 13px; --fs-m: 14px; --fs-l: 16px; --fs-xl: 20px; --fs-2xl: 28px;
    --s0: 2px; --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
    --radius-s: 4px; --radius: 6px; --radius-l: 10px;
    --control-h: 36px;   /* every field, picker and button in a form or toolbar is this tall */
    --font: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
/* Schibsted Grotesk (SIL Open Font License, fonts/OFL.txt), served with the page. */
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 700; font-display: swap;
    src: url(../fonts/schibsted-grotesk-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 700; font-display: swap;
    src: url(../fonts/schibsted-grotesk-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* hidden wins over a part's own display */
html, body { margin: 0; }
body {
    background: var(--bg); color: var(--text); min-height: 100vh;
    font: 14px/1.45 var(--font);
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
    background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--s1) var(--s3); cursor: pointer; min-height: var(--control-h); font-weight: 500;
}
button:hover { background-color: var(--hover); }
button:disabled { opacity: .5; cursor: default; }
button.primary, a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { border-color: #7a3a35; color: #f0a39c; }
button.primary:hover, a.button.primary:hover { background: #3866aa; }   /* darker on hover: white text stays above 4.5:1 */
button.small { padding: var(--s1) var(--s3); font-size: var(--fs-s); min-height: 28px; }
button.ghost { background: none; border-color: transparent; color: #b4bcc1; }
button.ghost:hover { background: var(--raised); color: var(--text); }
a.button { display: inline-flex; align-items: center; min-height: var(--control-h); background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s1) var(--s3); color: var(--text); text-decoration: none; font-weight: 500; }
a.button:hover { background: var(--hover); }
input[type=text], input[type=password], input[type=email], input[type=number], textarea, select {
    width: 100%; background: #1a1e22; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s1) var(--s2);
    font-size: var(--fs-m); color: var(--text); min-height: var(--control-h);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:disabled, textarea:disabled, select:disabled { background: transparent; border-style: dashed; color: var(--dim); cursor: not-allowed; }
textarea { resize: vertical; min-height: 2.6em; }
/* A file field's button looks like every other button. */
input[type=file]::file-selector-button { font: inherit; font-weight: 500; color: var(--text); background: var(--raised); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 6px 12px; margin-right: var(--s3); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--hover); }
/* One dropdown look: a native select and searchPicker()'s button share the chevron at the right edge. */
select, .vpick-btn { appearance: none; -webkit-appearance: none; padding-right: 30px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' stroke='%239aa3a9' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; }
/* Links in the app are plain until hovered; prose (docs, posts) underlines its own. */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.doc a, .post a, .help a { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: var(--fs-s); }
.help { color: var(--dim); font-size: var(--fs-s); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.page-view:not([hidden]) { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.empty { color: var(--dim); padding: var(--s5); }

/* Keyboard focus: one visible ring on everything you can reach with Tab. */
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.tabbar button:focus-visible, .rowline:focus-visible, .seg button:focus-visible, .crow:focus-visible, .crow a:focus-visible { outline-offset: -2px; }
.skip { position: absolute; left: var(--s2); top: -100px; z-index: 30; background: var(--accent); color: #fff; padding: var(--s2) var(--s3); border-radius: var(--radius); }
.skip:focus { top: var(--s2); }
/* A row that scrolls sideways (tabs, diagrams) fades at an edge with more to see. */
.more-r { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.more-l { mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
.more-l.more-r { mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
/* Waiting for data: one loading line for every page. */
#actions:focus { outline: none; }
.loading, .card > .body:empty, .rows:empty { color: var(--dim); padding: var(--s3); display: flex; gap: var(--s2); align-items: center; font-size: var(--fs-s); }
.card > .body:empty::after, .rows:empty::after { content: 'Loading…'; }
.loading::before, .card > .body:empty::before, .rows:empty::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading.inline { display: inline-flex; padding: 0; }
/* #page-wait: laid out like a page (.page-view), so its grey bars sit where the page draws; its spinner or note padded. */
.page-wait:not([hidden]) { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.page-wait > .loading, .page-wait.note { padding: var(--s4) var(--s3); }
@media (prefers-reduced-motion: reduce) { .loading::before, .card > .body:empty::before, .rows:empty::before { animation: none; } }
progress { width: 100%; height: 6px; }

/* Shell: header, navigation (the ☰ menu at the top right, floating over the page), content. */
header {
    position: sticky; top: 0; z-index: 7; height: var(--header-h); background: var(--bg);
    display: flex; gap: var(--s3); align-items: center; padding: 0 var(--header-right) 0 20px; border-bottom: 1px solid var(--line-soft);
}
/* The header's right side keeps its place whether the page has a scrollbar or not: its padding is 24px from the
   window's edge less the scrollbar (100vw - 100%: the scrollbar's width, 0 without one or with overlay ones).
   Its rule still runs the page's full width. phone.css sets its own. */
:root { --header-right: max(var(--s1), calc(24px - (100vw - 100%))); }
header .brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
header .brand .mark { width: 26px; height: 26px; display: block; }
header .brand-name { font-weight: 700; font-size: var(--fs-l); }
/* Dev (html[data-env=dev], set by an inline script on dev.temperwork.com): an amber-striped header and a DEV badge on the brand. */
:root[data-env="dev"] header {
    background: repeating-linear-gradient(-45deg, #2a2412 0 14px, var(--bg) 14px 28px);
    border-bottom: 2px solid var(--warn);
}
:root[data-env="dev"] header .brand::after {
    content: 'DEV'; padding: 2px 7px; border-radius: 4px; background: var(--warn); color: #15181b;
    font-size: 11px; font-weight: 800; letter-spacing: .08em; line-height: 1.4;
}
/* The trail: "/ Training / sample-colorize", the page above as a link. */
header .trail { display: flex; align-items: baseline; gap: var(--s2); min-width: 0; font-size: 15px; color: var(--dim); white-space: nowrap; }
header .trail > * { min-width: 2.5em; overflow: hidden; text-overflow: ellipsis; }
header .trail > .page { flex: 0 1 auto; }
header .trail > a { flex: 0 1 auto; max-width: 18em; color: #c9cfd2; text-decoration: none; }
header .trail > a:hover { color: var(--text); text-decoration: underline; }
header .trail > a::before, header .trail > .page:not(:empty)::before { content: '/'; color: #5c656c; margin-right: var(--s2); }
header .trail > .page { color: var(--text); }
#rail {
    display: none; position: fixed; z-index: 8; top: calc(var(--header-h) + var(--s1)); right: max(var(--s1), calc(20px - (100vw - 100%)));   /* under ☰, wherever the scrollbar puts it */
    width: 240px; max-height: calc(100vh - var(--header-h) - var(--s4)); overflow-y: auto;
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
    padding: var(--s2); flex-direction: column; gap: var(--s0);
}
#rail.open { display: flex; }
.nav-group { font-size: var(--fs-s); color: var(--faint); font-weight: 500; padding: var(--s3) var(--s3) var(--s1); }
.nav-group:first-child, #nav-email[hidden] + .nav-group { padding-top: 2px; }
/* Each section after the first is set apart by the same rule as the email above it. */
#rail a + .nav-group { margin-top: var(--s1); border-top: 1px solid var(--line); }
#rail a { display: block; padding: var(--s2) var(--s3); border-radius: var(--radius); color: var(--text); text-decoration: none; }
#rail a:hover { background: var(--raised); }
#rail a.on { background: var(--sel); }
#rail .rail-phone { display: none; }   /* phone.css shows them */
#menu-btn { padding: var(--s1) var(--s3); font-size: var(--fs-l); line-height: 1; }
/* Every page: at most 1180px wide, centered in the window (the side padding takes the rest). */
#actions { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4) max(var(--s4), calc((100% - 1180px) / 2)); }

/* The end of a job's log, as its worker recorded it. */
.logbox { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); min-width: 0; }
.loghead { display: flex; gap: var(--s2); align-items: center; padding: var(--s2) var(--s2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.logcmd { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); cursor: copy; }
.log { margin: 0; padding: var(--s2) var(--s3); max-height: 360px; min-height: 60px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
