/* ==========================================================================
   Studio Hub (Bone Valley)
   One stylesheet for every page in this folder.

   RE-SKIN: every color and font lives in the :root block and the two dark
   blocks right under it. Nothing below those blocks names a hex value or a
   font family, so a new studio is a change to those lines only.
   Spacing uses the --s* scale only: 4, 8, 12, 16, 24, 32, 48, 64.
   ========================================================================== */

/* ---- Fonts: self-hosted, Latin + Cyrillic ------------------------------- */
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../fonts/source-sans-3-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: 'Source Sans 3'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../fonts/source-sans-3-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Bitter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/bitter-600-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: 'Bitter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/bitter-600-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/jetbrains-mono-400-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: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/jetbrains-mono-400-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

/* ---- Tokens ------------------------------------------------------------- */
:root {
  /* Light, "parchment" (default) */
  --bg: #F7F5F0;            /* background, about 60% of any screen */
  --surface: #EDE8DC;       /* cards, tables, panels */
  --surface-step: #E3DCCC;  /* table header, hover tone step on surface */
  --card: #F7F5F0;          /* paper cards sitting on a surface */
  --card-step: #EFEBE1;     /* hover tone step on paper */
  --text: #1A1A1A;
  --text-muted: #57524A;    /* 6.3:1 on surface */
  --primary: #B5502E;       /* canyon rust, the only saturated color */
  --primary-step: #9A4125;  /* rust hover */
  --on-primary: #F7F5F0;
  --accent: #2B3A4A;        /* night ink: focus, selected, secondary, links */
  --accent-wash: #E1E2DC;   /* secondary button hover fill */
  --earth: #4A4E38;         /* quiet olive: area labels, dividers, section marks */
  --sidebar: #E6E5D6;
  --sidebar-step: #D9D8C5;
  --border: #CFC8B8;        /* hairlines */
  --border-strong: #9C9483;
  --ok: #2E6B3F;            /* status colors: UI system only, never brand */
  --warn: #875200;
  --err: #9E1B32;
  --shadow-float: 0 8px 24px rgba(26, 26, 26, 0.14), 0 1px 3px rgba(26, 26, 26, 0.10);

  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-head: 'Bitter', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r: 6px;        /* inputs, buttons, cards */
  --r-stamp: 3px;  /* stamped labels and checkboxes */
  --sidebar-w: 240px;
  --content-max: 1120px;
  --t: 120ms;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1C1A17;
  --surface: #2A2723;
  --surface-step: #35312C;
  --card: #34302B;
  --card-step: #3D3933;
  --text: #F2EEE6;
  --text-muted: #BDB5A6;
  --primary: #D9704A;
  --primary-step: #E58A66;
  --on-primary: #1A1A1A;
  --accent: #9DB2C8;
  --accent-wash: #2E3439;
  --earth: #A8AD8A;
  --sidebar: #25261F;
  --sidebar-step: #33352A;
  --border: #48433C;
  --border-strong: #6E675C;
  --ok: #8CC79A;
  --warn: #E3B35A;
  --err: #F08A9B;
  --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  font-style: normal;
  margin: 0;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
h1 { font-size: 36px; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 28px; line-height: 1.25; }
h3 { font-size: 22px; line-height: 1.3; }
h4 { font-size: 18px; line-height: 1.35; }
p { margin: 0; max-width: 68ch; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 14px; font-weight: 400; }
kbd {
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-stamp);
  padding: 0 var(--s1);
  background: var(--card);
}
strong { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s6) 0; }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-thickness var(--t), text-underline-offset var(--t), color var(--t); }
a:hover { text-decoration-thickness: 2px; text-underline-offset: 2px; }
a.quiet { color: inherit; text-decoration-color: var(--border-strong); }
a.quiet:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--r-stamp); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Hide the page for a moment while Russian strings swap in (max 900ms, see head script) */
.i18n-wait body { visibility: hidden; }
.skip { position: absolute; left: var(--s4); top: -64px; z-index: 50; background: var(--accent); color: var(--bg); padding: var(--s2) var(--s4); border-radius: var(--r); }
.skip:focus { top: var(--s4); }

/* ---- Shell: sidebar + work area ----------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: var(--s5) var(--s3) var(--s4);
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s3) var(--s5); color: var(--text); text-decoration: none; }
.brand svg { width: 32px; height: 32px; color: var(--primary); flex: none; }
.brand-name { font-family: var(--font-head); font-weight: 600; font-size: 18px; line-height: 1.2; display: block; }
.brand-sub { display: block; font-size: 13px; font-weight: 600; color: var(--earth); line-height: 1.3; }
.brand:hover .brand-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.nav { display: flex; flex-direction: column; gap: 0; }
.nav a, .nav .nav-group-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r);
  color: var(--text);
  text-decoration: none;
  font-size: 16px; line-height: 1.35;
  transition: background-color var(--t), color var(--t);
}
.nav a:hover { background: var(--sidebar-step); }
.nav a:hover .nav-label { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.nav a[aria-current="page"] { background: var(--sidebar-step); color: var(--accent); font-weight: 600; }
.nav a[aria-current="page"] .nav-count { color: var(--accent); }
.nav-count { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.nav-group { margin: var(--s2) 0; padding: var(--s2) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.nav .nav-group-label { color: var(--earth); font-weight: 600; font-size: 14px; padding-bottom: var(--s1); }
.nav-group a { padding-left: var(--s5); font-size: 15px; }
.nav .stamp { font-size: 13px; }

.sidebar-foot { margin-top: auto; padding: var(--s5) var(--s3) 0; display: grid; gap: var(--s2); }
.who { display: flex; align-items: center; gap: var(--s3); }
.who-name { font-weight: 600; line-height: 1.2; display: block; }
.who-role { font-size: 14px; color: var(--text-muted); line-height: 1.3; display: block; }
.sidebar-foot a { font-size: 15px; }

.sidebar .menu-toggle { display: none; }

.work { min-width: 0; display: flex; flex-direction: column; }

/* Header: two clocks, language, theme */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s6);
  padding: var(--s3) var(--s6);
  border-bottom: 1px solid var(--border);
}
.clocks { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-right: auto; }
.clock { display: flex; align-items: baseline; gap: var(--s2); }
.clock-label { font-size: 14px; font-weight: 600; color: var(--earth); }
.clock time { font-family: var(--font-mono); font-size: 14px; white-space: nowrap; }
.prefs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r); overflow: hidden; }
.seg button, .seg a {
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  background: transparent; color: var(--text); border: 0;
  padding: var(--s2) var(--s3); cursor: pointer; text-decoration: none;
  transition: background-color var(--t), color var(--t);
}
.seg > * + * { border-left: 1px solid var(--border-strong); }
.seg button:hover, .seg a:hover { background: var(--surface-step); }
.seg [aria-pressed="true"], .seg [aria-current="true"] { background: var(--accent); color: var(--bg); }
.seg button:focus-visible, .seg a:focus-visible { outline-offset: -3px; }

.page { width: 100%; max-width: calc(var(--content-max) + 2 * var(--s6)); padding: var(--s6) var(--s6) var(--s8); }
.page.wide { max-width: none; }

.foot {
  margin-top: auto;
  padding: var(--s4) var(--s6);
  border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: baseline;
}
.foot p { max-width: none; }
.linkish {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.linkish:hover { text-decoration-thickness: 2px; text-underline-offset: 2px; }

/* ---- Page header: one question per page --------------------------------- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--s4) var(--s6);
  padding-bottom: var(--s5); margin-bottom: var(--s6);
  border-bottom: 1px solid var(--earth);
}
.page-head .question { margin-top: var(--s2); font-size: 19px; color: var(--text-muted); }
.crumbs { font-size: 14px; margin-bottom: var(--s2); color: var(--text-muted); }
.crumbs a { color: var(--text-muted); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }

.section { margin-top: var(--s7); }
.section:first-child { margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s5); margin-bottom: var(--s4); }
.section-head p { color: var(--text-muted); }
.mark { font-size: 14px; font-weight: 600; color: var(--earth); display: block; margin-bottom: var(--s1); }
.area { font-size: 14px; font-weight: 600; color: var(--earth); white-space: nowrap; }
.muted { color: var(--text-muted); }
.small { font-size: 15px; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-size: 16px; font-weight: 600; line-height: 1.25;
  padding: var(--s3) var(--s5);
  border-radius: var(--r);
  border: 1px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--t), color var(--t), border-color var(--t);
}
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-step); border-color: var(--primary-step); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.btn-secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--accent-wash); }
.btn-small { font-size: 15px; padding: var(--s1) var(--s3); }
.btn[disabled] { cursor: not-allowed; background: transparent; color: var(--text-muted); border-color: var(--border); text-decoration: none; }
.btn svg, .btn img { width: 16px; height: 16px; flex: none; }

/* ---- Stamps: status text as a small bordered box ------------------------ */
.stamp {
  display: inline-block;
  font-size: 13px; font-weight: 600; line-height: 20px;
  padding: 0 var(--s2);
  border: 1px solid currentColor;
  border-radius: var(--r-stamp);
  color: var(--text);
  white-space: nowrap;
  vertical-align: middle;
}
.stamp-accent { color: var(--accent); }
.stamp-earth { color: var(--earth); }
.stamp-ok { color: var(--ok); }
.stamp-warn { color: var(--warn); }
.stamp-err { color: var(--err); }
.stamp-double { box-shadow: inset 0 0 0 1px var(--bg), inset 0 0 0 2px currentColor; padding: 0 var(--s2); }

/* ---- Avatars: initials on paper, no photos ------------------------------ */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px;
  border-radius: var(--r);
  border: 1px solid var(--border-strong);
  background: var(--card);
  font-family: var(--font-head); font-weight: 600; font-size: 14px; line-height: 1;
  color: var(--accent);
}
.avatar-lg { width: 48px; height: 48px; font-size: 22px; }
.avatar-agent { font-family: var(--font-mono); font-weight: 400; font-size: 13px; border-style: dashed; color: var(--text-muted); }
.owner { display: inline-flex; align-items: center; gap: var(--s2); white-space: nowrap; }

/* ---- Pipeline: stepped text track --------------------------------------- */
.track { list-style: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 0; font-size: 14px; line-height: 1.3; white-space: nowrap; }
.track li { display: flex; align-items: center; color: var(--text-muted); }
.track li + li::before { content: ""; width: var(--s3); border-top: 1px dashed var(--border-strong); margin: 0 var(--s1); }
.track li.done { color: var(--text); }
.track li.done + li::before { border-top: 1px solid var(--text); }
.track .step { padding: 0 var(--s1); border: 1px solid transparent; border-radius: var(--r-stamp); line-height: 20px; }
.track li.done .step { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 4px; }
.track li[aria-current="step"] { color: var(--text); font-weight: 600; }
.track li[aria-current="step"] .step { border-color: var(--text); padding: 0 var(--s2); }
.track button.step { font: inherit; color: inherit; background: none; cursor: pointer; transition: background-color var(--t), border-color var(--t); }
.track button.step:hover { background: var(--surface-step); border-color: var(--border-strong); }
.track-note { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); margin-left: var(--s2); }

/* ---- Tables: spreadsheet-like, ruled rows, sticky header ---------------- */
.table-tools { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s5); margin-bottom: var(--s3); }
.sheet {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  overflow: auto;
  max-height: 72vh;
}
.sheet table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; line-height: 1.4; }
.sheet th, .sheet td { text-align: left; vertical-align: middle; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
.sheet td + td, .sheet th + th { border-left: 1px solid var(--border); }
.sheet thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-step);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
}
.sheet tbody tr { transition: background-color var(--t); }
.sheet tbody tr:hover { background: var(--surface-step); }
.sheet tbody tr:last-child td { border-bottom: 0; }
.sheet tbody tr:target { background: var(--accent-wash); }
.sheet .id { font-family: var(--font-mono); font-size: 14px; white-space: nowrap; color: var(--text-muted); }
.sheet .num { font-family: var(--font-mono); font-size: 14px; text-align: right; white-space: nowrap; }
.sheet .name { font-weight: 600; min-width: 160px; }
.sheet .name a { color: var(--text); text-decoration-color: var(--border-strong); }
.sheet .name a:hover { text-decoration-color: currentColor; }
.sheet .wrap { min-width: 220px; }
.sheet .nowrap { white-space: nowrap; }
.sheet th button.sort { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: var(--s1); align-items: baseline; }
.sheet th button.sort:hover { text-decoration: underline; text-underline-offset: 3px; }
.sheet th[aria-sort] button.sort::after { content: "\2193"; font-family: var(--font-mono); font-size: 13px; }
.sheet th[aria-sort="ascending"] button.sort::after { content: "\2191"; }
.sheet th button.sort:focus-visible { outline-offset: 2px; }

[data-edit] { cursor: text; text-decoration: underline dotted var(--border-strong); text-underline-offset: 4px; }
[data-edit]:hover { background: var(--card-step); text-decoration-style: solid; }
[data-edit][contenteditable="true"] { background: var(--card); box-shadow: inset 0 0 0 2px var(--accent); outline: none; cursor: text; }
.cell-empty { color: var(--text-muted); }
.sheet-note { margin-top: var(--s2); font-size: 14px; color: var(--text-muted); }
.sheet-empty td { padding: var(--s6) var(--s3); }

.thumb {
  width: 64px; aspect-ratio: 4 / 3;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-stamp);
  background:
    linear-gradient(var(--border), var(--border)) center / 1px 100% no-repeat,
    linear-gradient(var(--border), var(--border)) center / 100% 1px no-repeat,
    var(--card);
}
.tool { display: inline-flex; align-items: center; gap: var(--s2); white-space: nowrap; }
.tool img, .tool svg { width: 16px; height: 16px; flex: none; }
.logo-mono { filter: none; }
:root[data-theme="dark"] .logo-mono { filter: invert(1); }

/* ---- Forms: labels above, 16px minimum ---------------------------------- */
.form { display: grid; gap: var(--s4); max-width: 640px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4); }
.field { display: grid; gap: var(--s1); align-content: start; }
.field label, .field .label, .field legend { font-size: 14px; font-weight: 600; color: var(--text); padding: 0; }
.field .hint { font-size: 14px; color: var(--text-muted); }
input[type="text"], input[type="email"], input[type="date"], input[type="search"], input[type="password"], select, textarea {
  font: inherit; font-size: 16px; line-height: 1.4; color: var(--text);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  padding: var(--s2) var(--s3);
  width: 100%; min-width: 0;
  transition: border-color var(--t), background-color var(--t);
}
input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); border-radius: var(--r); }
textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--err); }
.error-text { font-size: 15px; font-weight: 600; color: var(--err); }
.form-status { font-size: 15px; }
.form-status:empty { display: none; }
.form-status.ok { color: var(--ok); font-weight: 600; }
.wire {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--err);
  border: 1px dashed var(--err);
  border-radius: var(--r-stamp);
  padding: var(--s1) var(--s2);
  justify-self: start;
}
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }

.filter { display: grid; gap: var(--s1); min-width: 220px; }
.filter label { font-size: 14px; font-weight: 600; }

/* ---- Panels ------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s5); }
.panel-plain { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; padding: var(--s4) 0 0; }

/* Ruled list: notebook lines */
.ruled { list-style: none; border-top: 1px solid var(--border); }
.ruled > li { border-bottom: 1px solid var(--border); padding: var(--s3) 0; }

/* ---- Today -------------------------------------------------------------- */
.greeting { margin-bottom: var(--s6); }
.greeting h1 { font-size: 36px; }
.greeting p { margin-top: var(--s2); font-size: 19px; }

.week-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s4); }
.nextup {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s4) var(--s6); align-items: center;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
  padding: var(--s5);
  margin-bottom: var(--s4);
}
.nextup h3 { margin: var(--s1) 0 var(--s2); }
.nextup .meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; font-size: 15px; }
.nextup .go { display: grid; gap: var(--s2); justify-items: end; }

.tasklist > li { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto auto; gap: var(--s2) var(--s4); align-items: center; }
.tasklist .day { font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); }
.tasklist .t-title { font-weight: 600; }
.tasklist .t-title a { color: var(--text); text-decoration-color: var(--border-strong); }
.tasklist .t-title a:hover { text-decoration-color: currentColor; }
.tasklist .t-meta { display: block; font-size: 14px; font-weight: 400; }

.pulse { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.pulse .panel h3 { margin-bottom: var(--s2); }
.ticks { display: flex; gap: var(--s1); margin: var(--s4) 0 var(--s2); }
.ticks span { flex: 1; height: 12px; border: 1px solid var(--text); border-radius: 2px; }
.ticks span.met { background: var(--text); }
.criteria-short { list-style: none; display: grid; gap: var(--s1); margin-top: var(--s4); font-size: 15px; }
.criteria-short li { display: flex; gap: var(--s2); align-items: baseline; }
.criteria-short .box { font-family: var(--font-mono); font-size: 14px; }
.playtest-time { display: grid; gap: var(--s1); margin: var(--s3) 0 var(--s4); }
.playtest-time div { display: flex; gap: var(--s3); align-items: baseline; }
.playtest-time dt { font-size: 14px; font-weight: 600; color: var(--earth); min-width: 96px; }
.playtest-time dd { margin: 0; font-family: var(--font-mono); font-size: 14px; }
.log { list-style: none; }
.log li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.log li:first-child { border-top: 1px solid var(--border); }
.log time { font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); }

.quick { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }

/* Dropdown menu: the one place with a soft shadow (with dialogs) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); margin-left: var(--s1); }
.menu-list {
  position: absolute; z-index: 20; top: calc(100% + var(--s2)); left: 0;
  min-width: 220px; list-style: none;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--shadow-float);
  padding: var(--s1);
}
.menu-list a { display: block; padding: var(--s2) var(--s3); border-radius: var(--r-stamp); color: var(--text); text-decoration: none; }
.menu-list a:hover { background: var(--card-step); text-decoration: underline; text-underline-offset: 3px; }

.notice { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: baseline; justify-content: space-between; border: 1px dashed var(--border-strong); border-radius: var(--r); padding: var(--s3) var(--s4); font-size: 15px; color: var(--text-muted); }
.notice p { max-width: none; }

/* ---- Kanban ------------------------------------------------------------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: var(--s4); align-items: start; overflow-x: auto; padding-bottom: var(--s2); }
.col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s3); min-height: 240px; transition: background-color var(--t), border-color var(--t); }
.col.drop-ok { background: var(--surface-step); border-color: var(--accent); border-style: dashed; }
.col-head { display: flex; align-items: baseline; justify-content: space-between; padding: var(--s1) var(--s1) var(--s3); border-bottom: 1px solid var(--earth); margin-bottom: var(--s3); }
.col-head h2 { font-size: 18px; }
.col-count { font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); }
.cards { list-style: none; display: grid; gap: var(--s3); min-height: var(--s7); }
.card {
  background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--r);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  transition: background-color var(--t), border-color var(--t);
}
.card:hover { background: var(--card-step); border-color: var(--text-muted); }
.card:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { border-style: dashed; background: var(--surface-step); }
.card-top { display: flex; justify-content: space-between; gap: var(--s2); align-items: baseline; }
.card .id { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.card h3 { font-family: var(--font-body); font-size: 16px; font-weight: 600; line-height: 1.35; margin: var(--s1) 0 var(--s3); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.card-foot .due { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.col-empty { font-size: 15px; color: var(--text-muted); padding: var(--s3) var(--s1); border: 1px dashed var(--border); border-radius: var(--r); }

.js [data-view-panel] { display: none; }
.js [data-view-panel].is-shown { display: block; }
.view-note { font-size: 14px; color: var(--text-muted); margin-top: var(--s2); }

/* ---- Milestones: horizontal line with gates ----------------------------- */
.gates { list-style: none; position: relative; display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: var(--s5); overflow-x: auto; padding-top: var(--s2); }
.gates::before { content: ""; position: absolute; left: 0; right: 0; top: 19px; border-top: 2px solid var(--text); }
.gate { position: relative; }
.gate-marker { position: relative; z-index: 1; width: 24px; height: 24px; border: 2px solid var(--text); background: var(--bg); border-radius: var(--r-stamp); transform: rotate(45deg); margin: 0 0 var(--s5) var(--s1); }
.gate.passed .gate-marker { background: var(--text); }
.gate.current .gate-marker { background: var(--primary); border-color: var(--primary); }
.gate .when { font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); display: block; }
.gate h2 { font-size: 22px; margin: var(--s1) 0 var(--s2); }
.gate .gate-sum { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s4); font-size: 15px; }
.checklist { list-style: none; border-top: 1px solid var(--border); }
.checklist li { border-bottom: 1px solid var(--border); }
.checklist label { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s2) 0; font-size: 15px; line-height: 1.45; cursor: pointer; }
.checklist input { margin-top: 2px; }
.checklist label:hover span { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.checklist input:checked + span { color: var(--text-muted); }

/* ---- World map with pins ------------------------------------------------ */
.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s5); align-items: start; }
.map { position: relative; border: 1px solid var(--border-strong); border-radius: var(--r); overflow: hidden; background: var(--card); }
.map svg { width: 100%; height: auto; color: var(--text); }
.pin {
  position: absolute; transform: translate(-50%, -100%);
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: var(--text);
}
.pin-label {
  font-size: 13px; font-weight: 600; line-height: 20px; white-space: nowrap;
  background: var(--card); border: 1px solid var(--text); border-radius: var(--r-stamp);
  padding: 0 var(--s2);
  transition: background-color var(--t), color var(--t);
}
.pin::after { content: ""; width: 2px; height: 12px; background: var(--text); }
.pin:hover .pin-label, .pin:focus-visible .pin-label { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.map-caption { font-size: 14px; color: var(--text-muted); margin-top: var(--s2); }
.zone-list { list-style: none; border-top: 1px solid var(--border); }
.zone-list li { border-bottom: 1px solid var(--border); padding: var(--s3) 0; }
.zone-list li:target { background: var(--accent-wash); padding-left: var(--s3); padding-right: var(--s3); }
.zone-list h3 { font-size: 18px; }

/* ---- Detail page: image left, fields right, journal below --------------- */
.detail { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s6); align-items: start; }
.plate {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background:
    linear-gradient(var(--border), var(--border)) center / 1px 100% no-repeat,
    linear-gradient(var(--border), var(--border)) center / 100% 1px no-repeat,
    var(--card);
  display: grid; place-items: center; text-align: center;
  padding: var(--s5);
  overflow: hidden;
}
.plate-inner { background: var(--card); padding: var(--s3) var(--s4); display: grid; gap: var(--s2); justify-items: center; }
.plate img.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.plate-cap { display: flex; justify-content: space-between; gap: var(--s3); font-size: 14px; color: var(--text-muted); margin-top: var(--s2); }
.fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); border-top: 1px solid var(--border); margin: 0; }
.fields dt, .fields dd { margin: 0; padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.fields dt { line-height: 27px; font-size: 14px; font-weight: 600; color: var(--earth); padding-right: var(--s6); }
.fields dd { min-width: 0; }
.fields .track { overflow-x: auto; }
.journal { margin-top: var(--s7); max-width: 760px; }
.journal-entry { border-top: 1px solid var(--earth); padding: var(--s4) 0 var(--s5); }
.journal-entry header { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; margin-bottom: var(--s2); }
.journal-entry .by { font-size: 14px; font-weight: 600; color: var(--earth); }
.journal-text {
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.6em - 1px), var(--border) calc(1.6em - 1px), var(--border) 1.6em);
  line-height: 1.6;
}
.journal-text p + p { margin-top: 1.6em; }

/* ---- Look: image boards ------------------------------------------------- */
.boards { display: grid; gap: var(--s7); }
.board-set .plates { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s3); }
.board-set .plate { padding: var(--s3); font-size: 14px; color: var(--text-muted); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s3); list-style: none; }
.swatch { border: 1px solid var(--border-strong); border-radius: var(--r); overflow: hidden; background: var(--card); }
.swatch-chip { aspect-ratio: 4 / 3; }
.swatch-body { padding: var(--s2) var(--s3); font-size: 15px; line-height: 1.4; }
.swatch-body code { display: block; color: var(--text-muted); }

/* ---- Empty states: short sentence + one action -------------------------- */
.empty { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: var(--s5); align-items: center; border: 1px dashed var(--border-strong); border-radius: var(--r); padding: var(--s5); }
.empty svg { width: 160px; height: auto; color: var(--text); }
.empty p { margin-bottom: var(--s3); }

/* ---- People ------------------------------------------------------------- */
.people { list-style: none; display: grid; gap: 0; border-top: 1px solid var(--earth); }
.person { display: grid; grid-template-columns: 48px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3) var(--s5); padding: var(--s5) 0; border-bottom: 1px solid var(--border); align-items: start; }
.person h2 { font-size: 22px; }
.person .role { color: var(--text-muted); }
.person dl { margin: 0; display: grid; gap: var(--s2); }
.person dt { font-size: 14px; font-weight: 600; color: var(--earth); }
.person dd { margin: 0; }
.person .local-time { font-family: var(--font-mono); font-size: 14px; }
.overlap { margin-top: var(--s6); }
.hours { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s2) var(--s4); align-items: center; font-size: 15px; }
.hours-bar { position: relative; height: 24px; border: 1px solid var(--border-strong); border-radius: var(--r-stamp); background: var(--card); overflow: hidden; }
.hours-bar span { position: absolute; top: 0; bottom: 0; background: var(--accent); }
.hours-bar span.shared { background: var(--primary); }
.hours-scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }

/* ---- Docs --------------------------------------------------------------- */
.doc-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6) var(--s7); }
.doc-group-title { font-family: var(--font-body); font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--earth); margin-bottom: var(--s2); }
.doc-list { list-style: none; border-top: 1px solid var(--earth); }
.doc-list li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.doc-list .doc-meta { display: flex; gap: var(--s2); align-items: center; flex: none; }
.doc-list .tool img { width: 16px; height: 16px; }
.doc { max-width: 760px; }
.doc .lede { font-size: 19px; margin-bottom: var(--s6); }
.steps { list-style: none; counter-reset: step; border-top: 1px solid var(--border); }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s3); padding: var(--s4) 0; border-bottom: 1px solid var(--border); }
.steps > li::before { content: counter(step); font-family: var(--font-head); font-weight: 600; font-size: 22px; line-height: 1.2; color: var(--primary); }
.steps h3 { font-family: var(--font-body); font-size: 17px; font-weight: 600; line-height: 1.5; }
.steps p { margin-top: var(--s1); color: var(--text-muted); }
.doc-foot { margin-top: var(--s6); display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }

/* ---- Sign in ------------------------------------------------------------ */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.signin-side { background: var(--sidebar); border-right: 1px solid var(--border); padding: var(--s7) var(--s7) var(--s6); display: flex; flex-direction: column; gap: var(--s6); }
.signin-side svg.drawing { width: 100%; max-width: 440px; color: var(--text); margin-top: auto; }
.signin-main { padding: var(--s8) var(--s7); display: flex; flex-direction: column; justify-content: center; }
.signin-main .form { max-width: 480px; }
.signin .topline { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.pick { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.pick legend { font-size: 14px; font-weight: 600; margin-bottom: var(--s2); }
.pick-opt { position: relative; display: flex; gap: var(--s3); align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r); padding: var(--s3) var(--s4); background: var(--card); cursor: pointer; transition: background-color var(--t), border-color var(--t); }
.pick-opt:hover { background: var(--card-step); border-color: var(--text-muted); }
.pick-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pick-opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-wash); }
.pick-opt:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.pick-opt .who-role { margin-left: auto; }

/* ---- 404 ---------------------------------------------------------------- */
.lost { max-width: 760px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s6); align-items: center; }
.lost svg { width: 200px; color: var(--text); }

/* Controls that only work with JavaScript stay out of the way without it */
html:not(.js) .topbar, html:not(.js) [data-clear-local], html:not(.js) .signin .topline { display: none; }

/* Admin gate (the server must enforce this too) */
.admin-only-note { display: none; }
.not-admin .admin-only-note { display: block; }
.not-admin .admin-content { display: none; }
.not-admin .nav-admin { display: none; }

/* Language: while switching nothing else is needed; RU strings run ~20% longer
   and every layout above wraps or scrolls instead of relying on fixed widths. */

/* ---- Responsive: sidebar becomes a top menu ----------------------------- */
@media (max-width: 1080px) {
  .pulse { grid-template-columns: minmax(0, 1fr); }
  .map-wrap { grid-template-columns: minmax(0, 1fr); }
  .person { grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr); }
  .person > :nth-child(4) { grid-column: 2 / -1; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: var(--s3) var(--s4); }
  .sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
  .brand { padding: 0; }
  .js .sidebar .menu-toggle { display: inline-flex; }
  .nav { margin-top: var(--s3); }
  .js .sidebar:not(.open) .nav, .js .sidebar:not(.open) .sidebar-foot { display: none; }
  .sidebar-foot { padding: var(--s4) var(--s3) var(--s2); }
  .topbar, .page, .foot { padding-left: var(--s4); padding-right: var(--s4); }
  .page { padding-top: var(--s5); }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .doc-groups { grid-template-columns: minmax(0, 1fr); }
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin-side { order: 2; border-right: 0; border-top: 1px solid var(--border); padding: var(--s6) var(--s4); }
  .signin-main { padding: var(--s6) var(--s4); }
}
@media (max-width: 640px) {
  h1, .greeting h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .nextup { grid-template-columns: minmax(0, 1fr); }
  .nextup .go { justify-items: start; }
  .tasklist > li { grid-template-columns: minmax(0, 1fr) auto; }
  .tasklist .day { grid-column: 1 / -1; }
  .tasklist .btn { justify-self: start; }
  .person { grid-template-columns: 48px minmax(0, 1fr); }
  .person > :nth-child(3), .person > :nth-child(4) { grid-column: 1 / -1; }
  .empty, .lost { grid-template-columns: minmax(0, 1fr); }
  .empty svg { width: 120px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .fields dt { border-bottom: 0; padding-bottom: 0; }
  .log li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hours { grid-template-columns: minmax(0, 1fr); }
  .gates { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
  .gates::before { display: none; }
  .gate-marker { margin-bottom: var(--s3); }
  .sheet .thumb-col { display: none; }
}

/* Motion: 120ms color and tone changes only. Nothing moves on scroll.
   With reduced motion set, the state changes become instant. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; scroll-behavior: auto !important; }
}

@media print {
  .sidebar, .topbar, .foot, .actions, .quick, form { display: none !important; }
  .shell { display: block; }
  .sheet { max-height: none; overflow: visible; }
}
