/* Workspace design system.
   One source of truth: tokens first, then base, then components.
   No hardcoded colors below the token block — add a token instead. */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;

  /* Neutral ramp — warm, slightly green-shifted greys. */
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-2: #f3f6f1;
  --surface-3: #eaefe6;
  --border: #e1e7dd;
  --border-strong: #cdd7c8;
  --text: #1c2a23;
  --text-2: #55655b;
  --text-3: #7e8d83;

  /* Brand */
  --brand: #24503c;
  --brand-hover: #1a3c2c;
  --brand-fg: #f2f7ee;
  --brand-soft: #e6eee1;
  --brand-soft-hover: #dde8d6;
  --accent: #226b49;
  --accent-hover: #185738;
  --ring: #6fae8c;

  /* Status */
  --warn-bg: #fdf5e4;
  --warn-border: #eadcb9;
  --warn-fg: #7d5f22;
  --error-bg: #fbeae5;
  --error-border: #eecfc5;
  --error-fg: #8f4a36;
  --good-bg: #e6f1e1;
  --good-border: #cbe0c3;
  --good-fg: #3f6f45;

  /* Elevation */
  --shadow-1: 0 1px 2px rgb(24 45 33 / 0.05);
  --shadow-2: 0 2px 4px rgb(24 45 33 / 0.05), 0 8px 24px rgb(24 45 33 / 0.06);
  --shadow-3: 0 12px 48px rgb(24 45 33 / 0.14);

  /* Geometry */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* Space scale (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 56px;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-cap: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-4xl: 40px;

  /* Layout */
  --sidebar: 240px;
  --page-max: 1560px;
  --page-pad: 40px;
  --read-max: 78ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11170f;
    --surface: #182016;
    --surface-2: #1d271b;
    --surface-3: #243021;
    --border: #2b382a;
    --border-strong: #3c4d3a;
    --text: #e6ede2;
    --text-2: #a7b6a6;
    --text-3: #7f8f80;

    --brand: #5e9a76;
    --brand-hover: #6fae87;
    --brand-fg: #0d1410;
    --brand-soft: #243522;
    --brand-soft-hover: #2c3f2a;
    --accent: #7dc199;
    --accent-hover: #93d0aa;
    --ring: #5e9a76;

    --warn-bg: #2c2415;
    --warn-border: #4a3d20;
    --warn-fg: #d9b972;
    --error-bg: #2d1a16;
    --error-border: #4b2b23;
    --error-fg: #e0a08c;
    --good-bg: #1a2a1c;
    --good-border: #2e4630;
    --good-fg: #8cc593;

    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-2: 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    --shadow-3: 0 12px 48px rgb(0 0 0 / 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #11170f;
  --surface: #182016;
  --surface-2: #1d271b;
  --surface-3: #243021;
  --border: #2b382a;
  --border-strong: #3c4d3a;
  --text: #e6ede2;
  --text-2: #a7b6a6;
  --text-3: #7f8f80;
  --brand: #5e9a76;
  --brand-hover: #6fae87;
  --brand-fg: #0d1410;
  --brand-soft: #243522;
  --brand-soft-hover: #2c3f2a;
  --accent: #7dc199;
  --accent-hover: #93d0aa;
  --ring: #5e9a76;
  --warn-bg: #2c2415;
  --warn-border: #4a3d20;
  --warn-fg: #d9b972;
  --error-bg: #2d1a16;
  --error-border: #4b2b23;
  --error-fg: #e0a08c;
  --good-bg: #1a2a1c;
  --good-border: #2e4630;
  --good-fg: #8cc593;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-2: 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  --shadow-3: 0 12px 48px rgb(0 0 0 / 0.55);
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05" 1;
}

button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }

h1 { font-size: var(--fs-3xl); font-weight: 640; line-height: 1.18; letter-spacing: -0.024em; }
h2 { font-size: var(--fs-xl); font-weight: 620; line-height: 1.3; letter-spacing: -0.016em; }
h3 { font-size: var(--fs-md); font-weight: 600; line-height: 1.4; letter-spacing: -0.008em; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

:is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.muted { color: var(--text-2); }
.subtle { font-size: var(--fs-sm); line-height: 1.6; color: var(--text-3); overflow-wrap: anywhere; }

.eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s-3);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Inline SVG icons inherit color and align to the text baseline. */
.icon {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------ primitives */

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 8px 14px;
  font-size: var(--fs-cap);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
button:hover { background: var(--surface-2); border-color: var(--text-3); }
button:active { background: var(--surface-3); }
button:disabled { opacity: .45; cursor: default; }

.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-fg);
  font-weight: 560;
}
.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-fg); }

.danger-button { border-color: var(--error-border); color: var(--error-fg); background: transparent; }
.danger-button:hover { background: var(--error-bg); border-color: var(--error-fg); }

.text-button {
  border: 0; background: transparent; padding: var(--s-2) 0;
  color: var(--text-3); font-size: var(--fs-sm); justify-content: flex-start;
}
.text-button:hover { background: transparent; color: var(--text); }

.text-link {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; padding: 3px 0; border-radius: 0;
  color: var(--accent); font-size: var(--fs-cap); font-weight: 550;
  text-align: left; line-height: 1.5;
}
.text-link:hover {
  background: transparent; color: var(--accent-hover);
  text-decoration: underline; text-underline-offset: 4px;
}

.download-link {
  display: inline-block; text-decoration: none;
  padding: var(--s-2) var(--s-4); border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  margin: var(--s-3) var(--s-3) var(--s-3) 0;
}

input, select, textarea {
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  padding: 8px 11px;
  font-size: var(--fs-cap);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder { color: var(--text-3); }
input:hover, select:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
  outline: none;
}

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid transparent;
  font-size: var(--fs-xs); font-weight: 550; white-space: nowrap;
}
.badge.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.badge.good { background: var(--good-bg); border-color: var(--good-border); color: var(--good-fg); }
.badge.error { background: var(--error-bg); border-color: var(--error-border); color: var(--error-fg); }

.notice {
  border: 1px solid transparent; background: transparent; padding: 0;
  border-radius: var(--r-md); color: var(--text-3);
  font-size: var(--fs-sm); margin-bottom: var(--s-6);
}
.notice.warn {
  padding: var(--s-3) var(--s-4);
  background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg);
}
.notice.error {
  padding: var(--s-3) var(--s-4);
  background: var(--error-bg); border-color: var(--error-border); color: var(--error-fg);
}

.hint { font-size: var(--fs-sm); color: var(--text-3); margin: var(--s-3) 0; }

.empty {
  text-align: center; padding: var(--s-9) var(--s-5);
  color: var(--text-3); font-size: var(--fs-base);
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
}

.more { display: block; margin: var(--s-5) auto; }
.back { margin-bottom: var(--s-5); }

.inline-confirm {
  border: 1px solid var(--error-border); background: var(--error-bg);
  border-radius: var(--r-md); padding: var(--s-4); color: var(--error-fg);
}
.inline-confirm p { margin-bottom: var(--s-3); }

.brand-mark {
  display: grid; place-items: center;
  background: var(--brand); color: var(--brand-fg);
  width: 56px; height: 56px; border-radius: var(--r-xl);
  font-size: 30px; font-weight: 700; letter-spacing: -0.12em; padding-right: 4px;
}
.brand-mark.small { width: 34px; height: 34px; border-radius: var(--r-md); font-size: 20px; }

/* ---------------------------------------------------------- login screen */

.login-screen {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr; align-items: center;
  max-width: 1200px; margin: auto; padding: var(--s-9); gap: var(--s-9);
}
.login-card > .brand-mark { margin-bottom: var(--s-9); }
.login-card h1 { font-size: var(--fs-4xl); letter-spacing: -0.035em; line-height: 1.08; }
.lead { font-size: var(--fs-lg); line-height: 1.6; color: var(--text-2); margin: var(--s-6) 0 var(--s-7); }
.login-card button { padding: 12px 20px; font-size: var(--fs-base); }
.login-card #login-status { margin-top: var(--s-5); font-size: var(--fs-sm); max-width: 360px; color: var(--text-3); }

.login-art {
  height: 470px; position: relative; display: grid; place-items: center;
  background: radial-gradient(ellipse, var(--brand-soft) 0%, var(--surface-2) 45%, transparent 70%);
}
.orbit { position: absolute; border: 1px solid var(--border-strong); border-radius: 50%; transform: rotate(-25deg); }
.o1 { width: 230px; height: 230px; }
.o2 { width: 355px; height: 355px; }
.o3 { width: 470px; height: 470px; border-style: dashed; }
.art-center {
  display: grid; place-items: center; width: 100px; height: 100px;
  background: var(--brand); color: var(--brand-fg); border-radius: 28px;
  font-size: 58px; font-weight: 680; letter-spacing: -0.14em; padding-right: 8px;
  box-shadow: var(--shadow-3);
}
.art-label {
  position: absolute; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  padding: 9px 16px; border-radius: var(--r-sm);
  letter-spacing: 0.18em; font-size: var(--fs-xs); box-shadow: var(--shadow-1);
}
.l1 { top: 50px; left: 60px; }
.l2 { right: 0; top: 200px; }
.l3 { bottom: 50px; left: 75px; }

/* ----------------------------------------------------------------- shell */

#shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

aside {
  position: sticky; top: 0; height: 100vh;
  background: var(--surface-2); border-right: 1px solid var(--border);
  padding: var(--s-6) var(--s-3); display: flex; flex-direction: column;
}

.brand {
  display: flex; gap: var(--s-3); align-items: center;
  text-decoration: none; color: var(--text);
  font-size: var(--fs-lg); font-weight: 640; letter-spacing: -0.02em;
  margin: 0 var(--s-2) var(--s-7); padding: var(--s-1);
  border-radius: var(--r-sm);
}
.brand small {
  display: block; margin-top: 1px;
  font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0; color: var(--text-3);
}

.nav-label {
  font-size: var(--fs-xs); letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 600; color: var(--text-3); margin: 0 var(--s-3) var(--s-3);
}

nav { display: flex; flex-direction: column; gap: 2px; }
nav button {
  justify-content: flex-start; gap: var(--s-3);
  border: 0; background: transparent; border-radius: var(--r-sm);
  color: var(--text-2); padding: 9px var(--s-3);
  font-size: var(--fs-base); font-weight: 500;
}
nav button:hover { background: var(--brand-soft); color: var(--text); }
nav button .icon { opacity: .7; }
nav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
nav button.active .icon { opacity: 1; }
nav button:disabled { cursor: default; opacity: .4; }
nav button:disabled:hover { background: transparent; }

.sidebar-bottom { margin-top: auto; padding: var(--s-5) var(--s-3) 0; color: var(--text-3); font-size: var(--fs-xs); }
.pilot-label { display: flex; align-items: center; gap: var(--s-2); color: var(--text-2); font-size: var(--fs-sm); margin-bottom: 6px; }
.pilot-label i { width: 6px; height: 6px; border-radius: 50%; background: var(--good-fg); flex: none; }
.sidebar-bottom #account {
  margin-top: var(--s-5); padding-top: var(--s-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-2); overflow-wrap: anywhere;
}

main { padding: 0 var(--page-pad); max-width: var(--page-max); min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: var(--s-4);
  min-height: 64px; padding: var(--s-3) 0; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-3);
}
.home-link { text-decoration: none; font-weight: 640; color: var(--text); }
.topbar #breadcrumb { max-width: 280px; overflow-wrap: anywhere; color: var(--text-3); }
.topbar #breadcrumb::before { content: "/"; margin-right: var(--s-2); color: var(--border-strong); }
.topbar #global-search { display: flex; gap: 6px; margin-left: auto; min-width: 200px; max-width: 380px; flex: 1; }
.topbar input { width: 100%; }
.topbar button { font-size: var(--fs-sm); padding: 7px 11px; background: transparent; border-color: transparent; }
.topbar button:hover { background: var(--surface-2); border-color: var(--border-strong); }
.topbar #global-search button { border-color: var(--border-strong); background: var(--surface); }
.topbar #refresh { white-space: nowrap; }

.page-head { padding: var(--s-7) 0 var(--s-5); }
.page-head .eyebrow { display: none; }
.page-head .muted { margin-top: 6px; font-size: var(--fs-md); color: var(--text-2); max-width: var(--read-max); }

footer {
  display: flex; justify-content: center; gap: var(--s-3);
  color: var(--text-3); font-size: var(--fs-xs); padding: var(--s-7) 0;
}

/* ------------------------------------------------------------ containers */

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s-5);
  margin-bottom: var(--s-5); box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); margin-bottom: var(--s-4); flex-wrap: wrap;
}
.panel-head .muted { font-size: var(--fs-sm); color: var(--text-3); }
.panel > .text-link { margin-top: var(--s-4); }

.section-heading {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4); margin: 0 0 var(--s-4);
}
.section-heading h2 { font-size: var(--fs-xl); }

.grid-two { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--s-5); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); margin-bottom: var(--s-6); }
.stat, .overview-facts { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.stat { padding: var(--s-4) var(--s-5); box-shadow: var(--shadow-1); }
.stat-label { font-size: var(--fs-cap); color: var(--text-2); }
.stat-value { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.028em; margin-top: var(--s-1); font-variant-numeric: tabular-nums; }
.stat-note { font-size: var(--fs-sm); color: var(--text-3); margin-top: var(--s-1); }

.overview-facts {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-bottom: var(--s-6); box-shadow: var(--shadow-1);
}
.overview-facts .stat { border: 0; border-radius: 0; background: none; box-shadow: none; padding: var(--s-4) var(--s-5); }
.overview-facts .stat + .stat { border-left: 1px solid var(--border); }
.overview-facts .stat-value { font-size: var(--fs-2xl); }
.overview-facts .stat:last-child .stat-value { font-size: var(--fs-lg); margin-top: 6px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: var(--fs-cap); }
th {
  color: var(--text-3); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: var(--s-3); border-bottom: 1px solid var(--border);
}
td { padding: var(--s-3); border-bottom: 1px solid var(--border); vertical-align: top; }
td:first-child { max-width: 360px; overflow-wrap: anywhere; }
td small { display: block; color: var(--text-3); font-size: var(--fs-xs); margin-top: var(--s-1); }

.list-item {
  display: flex; gap: var(--s-3); padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border); align-items: flex-start;
}
.list-item:last-child { border: 0; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--r-md); background: var(--surface-3); color: var(--text-2);
  flex-shrink: 0; font-size: var(--fs-sm); font-weight: 600;
}
.item-main { min-width: 0; flex: 1; }
.item-title { font-size: var(--fs-cap); font-weight: 550; overflow-wrap: anywhere; }
.item-meta { color: var(--text-3); font-size: var(--fs-xs); margin-top: 3px; }
.item-button { display: block; text-align: left; background: none; border: none; padding: 0; color: inherit; max-width: 100%; }

.filters { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-5); }
.filters input, .filters select, .filters button { font-size: var(--fs-cap); padding: 9px 11px; }
.filters input[type=search] { flex: 1; min-width: 200px; }

.search-form { display: flex; gap: var(--s-2); margin: 0 0 var(--s-6); }
.search-form input { flex: 1; min-width: 0; padding: 12px var(--s-4); font-size: var(--fs-md); border-radius: var(--r-md); }
.search-form select { max-width: 200px; border-radius: var(--r-md); padding: 10px; color: var(--text-2); }
.search-form button { padding: 10px 20px; }

.inline-form { display: flex; gap: var(--s-2); flex-wrap: wrap; margin: var(--s-4) 0; }
.inline-form select { flex: 1; min-width: 0; }

/* -------------------------------------------------------------- overview */

.work-start { margin-bottom: var(--s-5); }
.work-start h2 { font-size: var(--fs-lg); margin-bottom: var(--s-3); }
.work-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: var(--s-3); margin-bottom: var(--s-3); }
.work-action { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); padding: var(--s-5); text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); white-space: normal; }
.work-action strong { color: var(--text); font-size: var(--fs-base); }
.work-action span { color: var(--text-3); font-size: var(--fs-sm); font-weight: 400; line-height: 1.5; }
.work-action:hover { background: var(--surface-2); border-color: var(--accent); }
.compact-issue p { margin-top: var(--s-1); }

.flow-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); margin-bottom: var(--s-6); box-shadow: var(--shadow-1);
}
.flow-stage { padding: var(--s-4) var(--s-5); border-right: 1px solid var(--border); min-width: 0; }
.flow-stage:last-child { border-right: 0; }
.flow-stage .flow-title { display: block; font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--s-1); }
.flow-stage strong { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.028em; font-variant-numeric: tabular-nums; }
.flow-stage p { font-size: var(--fs-sm); color: var(--text-3); margin-top: 3px; }
.flow-stage.attention p { color: var(--warn-fg); }

.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-3); }
.flow button { display: block; text-align: left; background: var(--surface-2); border-color: var(--border); padding: var(--s-4) var(--s-3); }
.flow strong { display: block; font-size: var(--fs-sm); margin: 6px 0; }
.flow .flow-num { color: var(--text-3); font-size: var(--fs-xs); }
.flow p { font-size: var(--fs-xs); color: var(--text-2); }
.flow small { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--s-1); }

.flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); margin: var(--s-2) 0 var(--s-5); }
.flow-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); min-width: 0; }
.flow-title { display: block; color: var(--text-3); font-size: var(--fs-cap); margin-bottom: var(--s-3); }
.flow-step strong { display: block; font-size: var(--fs-lg); line-height: 1.4; margin-bottom: 6px; }
.flow-step p { font-size: var(--fs-cap); color: var(--text-2); line-height: 1.6; }
.flow-step.attention { background: var(--warn-bg); border-color: var(--warn-border); }
.flow-step.confirmed { border-color: var(--good-border); }

.attention-box {
  padding: var(--s-5); background: var(--warn-bg);
  border: 1px solid var(--warn-border); border-radius: var(--r-lg);
  margin: var(--s-2) 0 var(--s-7); color: var(--warn-fg);
}
.attention-box h2 { font-size: var(--fs-lg); margin-bottom: 6px; color: var(--text); }
.attention-box p { font-size: var(--fs-base); max-width: var(--read-max); margin: 6px 0; }
.attention-box .text-link { margin-top: 6px; color: var(--warn-fg); }

.issue-row { padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.issue-row:last-child { border: 0; }
.issue-row p { margin-top: var(--s-1); }
.issue-row .text-link { margin-top: 6px; }

.compact-issue { padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.compact-issue:last-of-type { margin-bottom: var(--s-3); border-bottom: 0; }
.compact-issue .text-link { color: var(--warn-fg); font-size: var(--fs-cap); text-align: left; line-height: 1.5; }

.overview-layout {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: var(--s-6); align-items: start;
}
.overview-layout .section-heading { margin-top: 0; }
.recent-work { display: grid; gap: var(--s-4); }
.overview-layout .work-card { margin: 0; }
.overview-layout .panel { padding: var(--s-5); }
.overview-layout .panel-head { margin-bottom: var(--s-2); }
.overview-layout .file-row { padding: var(--s-3) 0; align-items: flex-start; flex-direction: column; gap: var(--s-1); }
.overview-layout .file-row .work-title { font-size: var(--fs-base); }
.overview-layout .file-row .badge { display: none; }
.overview-layout .work-result p { font-size: var(--fs-base); }
.overview-layout .work-card-top { margin-bottom: 6px; }

.status-row, .team-row {
  display: flex; justify-content: space-between; gap: var(--s-5);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-cap);
}
.status-row:last-child, .team-row:last-child { border-bottom: 0; }
.status-row strong { font-weight: 550; min-width: 130px; }
.status-row span { color: var(--text-2); text-align: right; }
.team-name { font-weight: 600; }

/* ---------------------------------------------------------- work / cards */

.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); margin-bottom: var(--s-7); }
.work-grid > .empty, .work-grid > .more { grid-column: 1 / -1; }

.work-card, .knowledge-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s-5); min-width: 0;
  box-shadow: var(--shadow-1);
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.work-card:hover, .knowledge-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.work-card { display: flex; flex-direction: column; }
.work-card-top {
  display: flex; justify-content: space-between; gap: var(--s-3);
  font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--s-3);
}
.work-owner { color: var(--text-2); font-weight: 560; }
.work-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.work-title {
  display: block; text-align: left; border: 0; background: none; padding: 0;
  font-size: var(--fs-xl); font-weight: 620; line-height: 1.35; letter-spacing: -0.018em;
  overflow-wrap: anywhere; max-width: 100%; color: var(--text);
}
.work-title:hover { background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.work-project { font-size: var(--fs-sm); color: var(--text-3); margin: 6px 0 var(--s-3); }
.work-result { border-top: 1px solid var(--border); padding-top: var(--s-3); flex: 1; }
.section-kicker {
  display: block; font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px;
}
.work-result > p {
  font-size: var(--fs-base); line-height: 1.65; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.work-pending { font-size: var(--fs-base); line-height: 1.65; color: var(--text-3); margin: var(--s-3) 0; }
.work-card-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: var(--s-2); padding-top: var(--s-4);
}
.work-card-bottom .subtle { font-size: var(--fs-xs); }

.knowledge-results { max-width: 980px; }
.knowledge-card { margin: 0 0 var(--s-4); }
.knowledge-excerpt { font-size: var(--fs-md); line-height: 1.7; margin: var(--s-3) 0; color: var(--text-2); }
.knowledge-card > .text-link { margin-right: var(--s-6); }
.knowledge-card > .badge { margin-bottom: var(--s-2); }
.knowledge-card .work-title { display: block; }

.search-result {
  display: block; width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: var(--s-4) 0; background: transparent;
}
.search-result:hover { background: var(--surface-2); }
.search-result pre {
  font: var(--fs-cap)/1.7 var(--font); white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--text-2); margin-top: var(--s-2); max-height: 120px; overflow: hidden;
}

/* ------------------------------------------------------- conversation UI */

.session-answer {
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s-5); margin-bottom: var(--s-6);
}
.session-answer .answer-preview { max-height: 230px; overflow: hidden; mask-image: linear-gradient(#000 75%, transparent); }
.session-answer > .disclosure { margin-top: var(--s-3); }
.session-answer:has(details[open]) .answer-preview { display: none; }
.session-answer .text-link { margin-top: 6px; }

.conversation-tabs {
  display: flex; gap: var(--s-1); padding: var(--s-1);
  background: var(--surface-3); border-radius: var(--r-md);
  width: fit-content; max-width: 100%; margin-bottom: var(--s-3);
}
.conversation-tabs button { background: none; border: 0; color: var(--text-2); padding: 8px 16px; font-size: var(--fs-cap); }
.conversation-tabs button:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.conversation-tabs button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }
.conversation-status { font-size: var(--fs-sm); color: var(--text-3); margin: var(--s-3) 0 var(--s-6); }
.conversation { max-width: 980px; }

.message {
  padding: var(--s-5); margin: 0 0 var(--s-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.message.user { background: var(--brand-soft); border-color: transparent; margin-left: var(--s-8); }
.message.tool, .message.service { padding: var(--s-3) var(--s-4); background: var(--surface-2); }
.message-head {
  display: flex; justify-content: space-between; gap: var(--s-5);
  margin-bottom: var(--s-3); font-size: var(--fs-cap); color: var(--text-2);
}
.message-head strong { font-weight: 600; }
.message-head time { font-size: var(--fs-sm); white-space: nowrap; color: var(--text-3); font-variant-numeric: tabular-nums; }
.message-sources { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-3); }
.message-sources .text-link { font-size: var(--fs-xs); color: var(--text-3); }
.message .reading { max-width: var(--read-max); }

.reading { font-size: var(--fs-md); line-height: 1.72; color: var(--text); overflow-wrap: anywhere; }
.reading p { margin: 0 0 var(--s-3); white-space: pre-wrap; }
.reading p:last-child { margin-bottom: 0; }
.reading h4 { font-size: var(--fs-lg); line-height: 1.45; margin: var(--s-5) 0 var(--s-3); font-weight: 620; }
.reading h4:first-child { margin-top: 0; }
.reading pre {
  font: var(--fs-cap)/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: var(--s-4); border-radius: var(--r-sm);
}
.reading code { font: var(--fs-cap)/1.6 var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: var(--r-xs); }
.reading ul, .reading ol { padding-left: var(--s-6); margin: var(--s-2) 0 var(--s-4); }
.reading li { margin: var(--s-1) 0; }

.disclosure { font-size: var(--fs-cap); color: var(--text-2); overflow-wrap: anywhere; }
.disclosure > summary { cursor: pointer; padding: var(--s-2) 0; font-weight: 550; color: var(--text-2); }
.disclosure > summary:hover { color: var(--text); }
.disclosure[open] > summary { margin-bottom: var(--s-2); }
.disclosure > p { margin: var(--s-2) 0; }

.history-item { border-left: 2px solid var(--border); padding: var(--s-1) 0 var(--s-5) var(--s-4); margin-left: var(--s-1); }
.history-item pre {
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 170px; overflow: auto;
  background: var(--surface-2); padding: var(--s-3); font-size: var(--fs-sm);
  border-radius: var(--r-sm); color: var(--text-2); margin: var(--s-2) 0;
}
.history-item button { font-size: var(--fs-sm); }

.event-row { padding: var(--s-4) 0; border-bottom: 1px solid var(--border); display: flex; gap: var(--s-4); font-size: var(--fs-base); }
.event-row time { min-width: 120px; font-size: var(--fs-sm); color: var(--text-3); font-variant-numeric: tabular-nums; }
.event-row p { margin: var(--s-1) 0; font-size: var(--fs-sm); color: var(--text-2); }

/* ----------------------------------------------------------------- files */

.file-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 0 var(--s-5); box-shadow: var(--shadow-1); }
.file-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--border); min-width: 0;
}
.file-row:last-child { border-bottom: 0; }
.file-row > div { min-width: 0; }
.file-row .work-title { font-size: var(--fs-md); overflow-wrap: anywhere; }
.file-row p { margin-top: var(--s-1); }
.file-controls { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; margin: var(--s-2) 0 var(--s-4); }
.file-content {
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 65vh; overflow: auto;
  font: var(--fs-cap)/1.65 var(--mono); background: var(--surface-2);
  border: 1px solid var(--border); padding: var(--s-5); border-radius: var(--r-md);
}

/* ------------------------------------------------------------------ team */

.team-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.team-cards > .panel { min-width: 0; }
.permission-row { padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.permission-row:last-child { border-bottom: 0; }
.permission-row strong { font-size: var(--fs-cap); overflow-wrap: anywhere; }
.permission-source { display: flex; gap: var(--s-3); justify-content: space-between; margin-top: 3px; font-size: var(--fs-sm); overflow-wrap: anywhere; color: var(--text-3); }
.invite-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--s-3); }
.invite-form h2, .invite-form p { grid-column: 1 / -1; }
.invite-form input { width: 100%; padding: 10px 11px; }
.invite-form .subtle input { margin-top: var(--s-3); }
.access-rights { display: flex; gap: var(--s-2); margin: var(--s-3) 0; flex-wrap: wrap; }

.device-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-4); }
.device-card {
  padding: var(--s-5); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: var(--s-3); font-size: var(--fs-base);
  box-shadow: var(--shadow-1);
}
.device-card h3 { font-size: var(--fs-lg); margin-bottom: 6px; overflow-wrap: anywhere; }
.device-card > .subtle { margin: var(--s-2) 0; }
.device-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); font-size: var(--fs-cap); }
.device-card dt { color: var(--text-3); }
.device-card dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.device-card .disclosure { margin-top: var(--s-4); }

/* --------------------------------------------------------------- connect */

.connect-page { max-width: 1040px; }
.connect-intro { margin: var(--s-1) 0 var(--s-6); max-width: 680px; }
.connect-intro h2 { font-size: var(--fs-2xl); line-height: 1.3; }
.connect-intro p { font-size: var(--fs-md); color: var(--text-2); margin-top: var(--s-3); line-height: 1.65; }

.connect-clients { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); margin-bottom: var(--s-5); }
.connect-client {
  display: flex; align-items: center; gap: var(--s-3); text-align: left;
  padding: var(--s-4); border-radius: var(--r-lg); min-height: 88px;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-1);
}
.connect-client:hover { border-color: var(--border-strong); background: var(--surface); box-shadow: var(--shadow-2); }
.connect-client[aria-pressed=true] {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}
.connect-client strong { display: block; font-size: var(--fs-md); }
.connect-client small { display: block; color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.client-mark {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px;
  border-radius: var(--r-md); background: var(--surface-3); color: var(--brand);
  font-size: var(--fs-xl); font-weight: 650;
}

.connect-setup { padding: var(--s-6); }
.connect-setup > h2 { font-size: var(--fs-2xl); margin-bottom: var(--s-5); }
.connect-steps { list-style: none; padding: 0; margin: 0; }
.connect-step { display: flex; gap: var(--s-4); margin: 0 0 var(--s-6); }
.connect-step:last-child { margin-bottom: var(--s-3); }
.step-number {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px;
  border-radius: 50%; font-size: var(--fs-cap); font-weight: 650;
  color: var(--brand); background: var(--brand-soft);
}
.connect-step > div { min-width: 0; flex: 1; max-width: 740px; }
.connect-step h3 { font-size: var(--fs-lg); line-height: 1.5; margin: 0 0 6px; }
.connect-step p { font-size: var(--fs-base); line-height: 1.65; color: var(--text-2); margin: 6px 0; }
.connect-step .text-link { display: inline-flex; margin-top: var(--s-1); }
.connect-start {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 12px 20px; margin: var(--s-3) 0;
  border-radius: var(--r-md); background: var(--brand); color: var(--brand-fg);
  font-size: var(--fs-md); font-weight: 600; text-decoration: none;
}
.connect-start:hover { filter: brightness(.92); text-decoration: none; }
.connect-start:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }

.connect-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2); align-items: start; margin: var(--s-3) 0; }
.connect-copy pre {
  margin: 0; min-height: 48px; width: 100%;
  font: var(--fs-cap)/1.6 var(--mono); padding: var(--s-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap;
}
.connect-copy button { min-height: 46px; }
.connect-copy-status { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--good-fg); min-height: 0; }

.connection-list { padding: var(--s-6); }
.connection-list h2 { font-size: var(--fs-2xl); }
.connection-item { border-top: 1px solid var(--border); padding: var(--s-5) 0; }
.connection-item:last-child { padding-bottom: 0; }
.connection-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.connection-item h3 { font-size: var(--fs-lg); }
.connection-item-head .subtle { margin-top: var(--s-1); }
.connection-item .badge { white-space: normal; }
.connection-evidence { font-size: var(--fs-base); margin-top: var(--s-3); color: var(--text-2); }
.connect-scope-list { font-size: var(--fs-base); color: var(--text-2); padding-left: var(--s-5); margin: var(--s-3) 0; }
.connection-controls { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-top: var(--s-4); }
.connection-controls p { flex-basis: 100%; font-size: var(--fs-base); }
.connection-controls .text-link { font-size: var(--fs-cap); color: var(--error-fg); }
.connect-boundary { padding: 0 var(--s-1) var(--s-6); max-width: 760px; }
.connect-boundary p { font-size: var(--fs-base); line-height: 1.7; color: var(--text-2); }
.connect-unavailable { padding: var(--s-4) 0; font-size: var(--fs-md); max-width: 580px; color: var(--text-2); }
.connect-page .panel-head { flex-wrap: wrap; }

.consent-card { max-width: 760px; margin: var(--s-1) auto var(--s-8); padding: var(--s-7); }
.consent-card h2 { font-size: var(--fs-3xl); }
.consent-card > p { font-size: var(--fs-md); line-height: 1.65; margin-bottom: var(--s-3); color: var(--text-2); }
.consent-card > .eyebrow { font-size: var(--fs-xs); }
.consent-card .consent-client { font-size: var(--fs-2xl); font-weight: 620; margin: var(--s-3) 0 var(--s-2); overflow-wrap: anywhere; }
.consent-card .consent-origin {
  font-size: var(--fs-cap); color: var(--text-2); overflow-wrap: anywhere;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: var(--s-3); border-radius: var(--r-sm); font-family: var(--mono);
}
.consent-card fieldset { border: 0; padding: 0; margin: var(--s-6) 0 var(--s-4); }
.consent-card legend { font-size: var(--fs-md); font-weight: 620; margin-bottom: var(--s-3); }
.consent-scope {
  display: flex; align-items: flex-start; gap: var(--s-3); cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--s-4); margin-bottom: var(--s-2); background: var(--surface);
}
.consent-scope:hover { border-color: var(--border-strong); }
.consent-scope:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }
.consent-scope:has(input:disabled) { opacity: .6; cursor: default; }
.consent-scope input { width: 18px; height: 18px; flex: none; margin-top: 2px; accent-color: var(--brand); }
.consent-scope strong { display: block; font-size: var(--fs-md); }
.consent-scope small { display: block; font-size: var(--fs-cap); line-height: 1.6; color: var(--text-2); margin-top: 5px; }
.consent-actions { display: flex; gap: var(--s-3); margin: var(--s-5) 0 var(--s-3); }
.consent-actions button { min-height: 46px; padding: 10px 18px; }
.consent-status { font-size: var(--fs-base); color: var(--text-2); margin-top: var(--s-3); }
.consent-unverified { font-size: var(--fs-cap); color: var(--warn-fg); }

/* ------------------------------------------------------- document dialog */

dialog {
  max-width: 1100px; width: calc(100% - 32px); max-height: 92vh;
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: var(--s-6) var(--s-7); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-3); scrollbar-gutter: stable;
}
dialog::backdrop { background: rgb(12 22 16 / 0.5); backdrop-filter: blur(4px); }
dialog header {
  position: sticky; top: calc(var(--s-6) * -1); z-index: 1;
  display: flex; justify-content: space-between; gap: var(--s-4); align-items: flex-start;
  background: var(--surface); padding: var(--s-3) 0; border-bottom: 1px solid var(--border);
}
dialog header button { border: 0; background: transparent; }
dialog header h2 { font-size: var(--fs-2xl); }
dialog header .eyebrow { margin-bottom: var(--s-1); }
dialog pre {
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  font: var(--fs-cap)/1.65 var(--mono); padding: var(--s-4);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
dialog .muted { font-size: var(--fs-sm); margin: var(--s-3) 0; }

#document-status { font-size: var(--fs-cap); color: var(--text-2); margin: var(--s-4) 0 var(--s-6); }
.document-section { margin: 0 0 var(--s-6); min-width: 0; }
.document-section > h3 { font-size: var(--fs-cap); color: var(--text-2); margin-bottom: var(--s-2); font-weight: 650; }
.document-section h4 { font-size: var(--fs-xl); line-height: 1.4; margin: var(--s-5) 0 var(--s-3); overflow-wrap: anywhere; }
.document-prose { font-size: var(--fs-md); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 var(--s-3); max-width: var(--read-max); }
#document .document-code {
  font: var(--fs-base)/1.7 var(--mono); background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: var(--s-4) var(--s-5); margin: var(--s-2) 0 var(--s-4);
  tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere;
}
.document-technical { border-top: 1px solid var(--border); padding: var(--s-4) 0; color: var(--text-2); font-size: var(--fs-cap); overflow-wrap: anywhere; }
.document-technical summary { cursor: pointer; padding: 6px 0; }
.document-technical p { margin: var(--s-3) 0; }
#document .reading { white-space: normal; }
#document .reading pre { font-size: var(--fs-cap); }
#document .reading p { margin-bottom: var(--s-3); }

/* ------------------------------------------------------------ responsive */

#mobile-account, .mobile-logout { display: none; }

@media (max-width: 1150px) {
  :root { --page-pad: 24px; --sidebar: 210px; }
  .flow-grid { gap: var(--s-2); }
  .flow-step { padding: var(--s-4); }
  .team-cards { grid-template-columns: 1fr; }
  .topbar #breadcrumb { max-width: 200px; }
}

@media (max-width: 1100px) {
  aside { padding: var(--s-5) var(--s-2); }
  .flow { grid-template-columns: repeat(3, 1fr); }
  .grid-two, .overview-layout { grid-template-columns: 1fr; }
  .stat { padding: var(--s-4); }
  .connect-clients { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-card { padding: var(--s-4); }
  .work-card-top { flex-direction: column; gap: 2px; }
  .work-title { font-size: var(--fs-lg); }
  .status-row { flex-direction: column; gap: var(--s-1); }
  .status-row span { text-align: left; }
  .flow-stage { padding: var(--s-3) var(--s-4); }
  .flow-stage strong { font-size: var(--fs-xl); }
}

@media (max-width: 750px) {
  :root { --page-pad: 16px; }

  #shell { display: block; }
  aside {
    position: sticky; top: 0; z-index: 20; height: auto;
    padding: var(--s-3) var(--s-4); border-right: 0; border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-2) 92%, transparent);
    backdrop-filter: blur(8px);
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s-3);
  }
  .brand { margin: 0; font-size: var(--fs-base); }
  .brand small { display: none; }
  .nav-label, .sidebar-bottom { display: none; }
  nav {
    flex-direction: row; overflow-x: auto; gap: var(--s-1);
    scrollbar-width: none; justify-content: flex-start;
    scroll-snap-type: x proximity;
  }
  nav::-webkit-scrollbar { display: none; }
  nav button { white-space: nowrap; padding: 7px var(--s-2); font-size: var(--fs-sm); scroll-snap-align: start; }
  nav button span:not(.icon) { display: none; }

  .topbar { min-height: 0; gap: var(--s-2); padding: var(--s-3) 0; }
  .topbar .home-link, .topbar #breadcrumb { display: none; }
  .topbar #global-search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .topbar #refresh { font-size: var(--fs-xs); }
  #mobile-account {
    display: block; flex: 1; min-width: 0; font-size: var(--fs-xs);
    color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mobile-logout { display: inline-flex; flex-shrink: 0; }

  .page-head { padding: var(--s-5) 0 var(--s-4); }
  h1, .page-head h1 { font-size: var(--fs-2xl); }
  .page-head .muted { font-size: var(--fs-base); }

  .stats { grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
  .flow { grid-template-columns: 1fr 1fr; }
  .flow-grid { grid-template-columns: 1fr; }
  .panel { padding: var(--s-4); }
  .panel-head { align-items: flex-start; }
  .panel-head h2 { font-size: var(--fs-lg); }

  .flow-strip { grid-template-columns: 1fr; }
  .flow-stage {
    padding: var(--s-3) var(--s-4); border-right: 0; border-bottom: 1px solid var(--border);
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 var(--s-3);
  }
  .flow-stage .flow-title { margin: 0; }
  .flow-stage strong { font-size: var(--fs-lg); text-align: right; }
  .flow-stage p { grid-column: 1 / -1; font-size: var(--fs-xs); }

  .overview-facts { grid-template-columns: 1fr; }
  .overview-facts .stat { padding: var(--s-3) var(--s-4); display: grid; grid-template-columns: 1fr auto; gap: 2px; }
  .overview-facts .stat + .stat { border-left: 0; border-top: 1px solid var(--border); }
  .overview-facts .stat-value,
  .overview-facts .stat:last-child .stat-value { font-size: var(--fs-lg); margin: 0; grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .overview-facts .stat-note { margin: 0; }

  .overview-layout, .recent-work { gap: var(--s-4); }
  .work-grid { grid-template-columns: 1fr; }
  .work-card-top { flex-direction: row; flex-wrap: wrap; }
  .work-title { font-size: var(--fs-lg); }
  .section-heading h2 { font-size: var(--fs-lg); }
  .attention-box { padding: var(--s-4); }

  .message { padding: var(--s-4); }
  .message.user { margin-left: var(--s-3); }
  .session-answer { padding: var(--s-4); }
  .reading { font-size: var(--fs-base); }
  .conversation-tabs { width: 100%; overflow: auto; }
  .conversation-tabs button { padding: 8px var(--s-3); white-space: nowrap; font-size: var(--fs-sm); }

  .search-form { flex-wrap: wrap; }
  .search-form input { flex-basis: 100%; padding: 11px var(--s-3); font-size: var(--fs-base); }
  .search-form select { flex: 1; max-width: none; }
  .search-form button { flex: none; padding: 10px 16px; }

  .event-row { display: block; }
  .event-row time { display: block; margin-bottom: 6px; }

  .file-list { padding: 0 var(--s-4); }
  .file-row { align-items: flex-start; flex-direction: column; gap: var(--s-2); }
  .invite-form { grid-template-columns: 1fr; }
  .invite-form h2, .invite-form p { grid-column: 1; }
  .permission-source { flex-wrap: wrap; }

  .login-screen { display: block; padding: var(--s-8) var(--s-6); }
  .login-card > .brand-mark { margin-bottom: var(--s-8); }
  .login-card h1 { font-size: var(--fs-3xl); }
  .login-card #login-status { min-height: 35px; }
  .login-art { height: 260px; max-width: 300px; margin: var(--s-7) auto; }
  .orbit.o3 { width: 280px; height: 280px; }
  .orbit.o2 { width: 210px; height: 210px; }
  .orbit.o1 { width: 140px; height: 140px; }
  .art-center { width: 64px; height: 64px; font-size: 38px; border-radius: 18px; }
  .l1 { top: 0; left: 0; }
  .l2 { right: -10px; top: 130px; }
  .l3 { bottom: 0; left: 20px; }

  .connect-intro h2 { font-size: var(--fs-xl); }
  .connect-intro p { font-size: var(--fs-base); }
  .connect-clients { gap: var(--s-2); }
  .connect-client { gap: var(--s-2); padding: var(--s-3); min-height: 80px; }
  .connect-client strong { font-size: var(--fs-base); }
  .connect-client small { font-size: var(--fs-xs); }
  .client-mark { width: 28px; height: 28px; font-size: var(--fs-lg); }
  .connect-setup, .connection-list { padding: var(--s-5) var(--s-4); }
  .connect-step { gap: var(--s-3); margin-bottom: var(--s-5); }
  .step-number { width: 24px; height: 24px; font-size: var(--fs-sm); }
  .connect-step h3 { font-size: var(--fs-md); }
  .connect-step p { font-size: var(--fs-cap); }
  .connect-copy { grid-template-columns: minmax(0, 1fr); }
  .connect-copy button { justify-self: start; min-height: 42px; }
  .connection-item-head { flex-direction: column; }
  .connection-item h3 { font-size: var(--fs-md); }
  .consent-card { padding: var(--s-5) var(--s-4); }
  .consent-card h2 { font-size: var(--fs-2xl); }
  .consent-actions { flex-direction: column; }
  .consent-actions button { width: 100%; }
  .consent-scope { padding: var(--s-3); }
  .consent-scope small { font-size: var(--fs-sm); }

  dialog { width: calc(100% - 16px); max-height: 94dvh; padding: var(--s-4); }
  dialog header { top: calc(var(--s-4) * -1); }
  dialog header h2 { font-size: var(--fs-xl); }
  #document .document-code { padding: var(--s-3); font-size: var(--fs-cap); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ------------------------------------------------- additions: UX layer */

.sidebar-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin-top: var(--s-2); }

/* Whole session card is the click target; inner controls still win. */
.work-card--open { cursor: pointer; }
.work-card--open:hover { border-color: var(--brand); }
.work-card--open:hover .work-title { color: var(--accent); }

/* Day separators keep long session lists scannable. */
.day-divider {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: var(--s-3);
  margin: var(--s-4) 0 0;
  font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3);
}
.day-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.day-divider:first-child { margin-top: 0; }

/* Loading placeholders instead of a bare "Загружаем…". */
.skeleton-wrap { display: grid; gap: var(--s-4); grid-column: 1 / -1; }
.skeleton-card {
  height: 132px; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface);
  position: relative; overflow: hidden;
}
.skeleton-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-3) 80%, transparent), transparent);
  transform: translateX(-100%);
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}
@keyframes skeleton-sweep { to { transform: translateX(100%); } }

/* Speaker identity in a conversation. */
.message-who { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.message-who strong { overflow-wrap: anywhere; }
.avatar-sm { width: 24px; height: 24px; border-radius: var(--r-sm); font-size: var(--fs-xs); }
.avatar-sm.assistant { background: var(--brand); color: var(--brand-fg); }
.avatar-sm.user { background: var(--surface); color: var(--text-2); border: 1px solid var(--border-strong); }

/* The search field carries its own shortcut hint. */
.topbar #global-query { padding-right: var(--s-4); }

/* Guided Mac installation; progress comes from server observations. */
/* Mac onboarding — personal steps inside the Connections hub. */
.mac-onboarding { max-width: 1040px; margin: 0 0 var(--s-6); }
.mac-hero { padding: var(--s-2) 0 var(--s-5); }
.mac-hero h2 { font-size: var(--fs-2xl); letter-spacing: -.02em; margin: var(--s-2) 0 var(--s-3); }
.mac-hero p { max-width: 640px; line-height: 1.6; color: var(--text-2); }
.mac-steps { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.mac-step { display: flex; gap: var(--s-5); padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--border); }
.mac-step:last-child { border-bottom: 0; }
.mac-step > div { min-width: 0; flex: 1; }
.mac-step h3 { margin: 0 0 var(--s-2); font-size: var(--fs-lg); }
.mac-step p { line-height: 1.6; margin: var(--s-2) 0 var(--s-4); color: var(--text-2); }
.mac-step.is-done .step-number { background: var(--good-bg); border-color: var(--good-border); color: var(--good-fg); }
.mac-download { display: inline-flex; text-decoration: none; padding: 10px 16px; border-radius: var(--r-md); }
.mac-fingerprint { font-family: var(--mono); overflow-wrap: anywhere; font-size: var(--fs-xs); }
.mac-boundary { padding: var(--s-5) var(--s-6); margin-top: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); line-height: 1.6; background: var(--surface-2); }
.mac-boundary p { margin-bottom: 0; color: var(--text-2); }
@media (max-width: 600px) { .mac-step { padding: var(--s-4) var(--s-3); gap: var(--s-3); } .mac-hero h2 { font-size: var(--fs-xl); } }

/* Connections hub: next step, two independent tracks, team progress. */
.hub-head { display: grid; gap: var(--s-5); margin: 0 0 var(--s-5); max-width: 1040px; }
.hub-intro h2 { font-size: var(--fs-2xl); letter-spacing: -.02em; margin: var(--s-2) 0 var(--s-2); }
.hub-intro > p.subtle { max-width: 680px; line-height: 1.6; margin: 0; }
.hub-next { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-4); padding: var(--s-4) var(--s-5); border: 1px solid var(--brand-soft-hover); background: var(--brand-soft); border-radius: var(--r-lg); }
.hub-next > div { display: grid; gap: 2px; min-width: 0; }
.hub-next small { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.hub-next strong { font-size: var(--fs-md); }
.hub-next .subtle { font-size: var(--fs-sm); }
.hub-next.is-done { border-color: var(--good-border); background: var(--good-bg); color: var(--good-fg); }
.hub-tracks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.hub-track { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.hub-track-top { display: flex; justify-content: space-between; gap: var(--s-3); align-items: flex-start; }
.hub-track h3 { margin: 0 0 var(--s-1); font-size: var(--fs-lg); }
.hub-track-top p { margin: 0; font-size: var(--fs-sm); line-height: 1.5; }
.hub-track > .text-link { align-self: flex-start; margin-top: auto; }
.hub-meter { flex: none; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); padding: 3px 10px; border-radius: var(--r-full); border: 1px solid var(--border); background: linear-gradient(90deg, var(--brand-soft) calc(var(--progress, 0) * 100%), transparent 0); }
.hub-meter.is-complete { color: var(--good-fg); border-color: var(--good-border); background: var(--good-bg); }
.hub-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hub-step { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: var(--s-2) 0; }
.hub-step > div { display: grid; gap: 2px; min-width: 0; }
.hub-step > div > span { font-size: var(--fs-base); }
.hub-step small { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.45; }
.hub-dot { width: 12px; height: 12px; margin-top: 5px; border-radius: var(--r-full); border: 2px solid var(--border-strong); background: var(--surface); }
.hub-state { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; padding-top: 3px; }
.hub-step.is-done .hub-dot { background: var(--good-fg); border-color: var(--good-fg); }
.hub-step.is-done > div > span { color: var(--text-2); }
.hub-step.is-current .hub-dot { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hub-step.is-current > div > span { font-weight: 600; }
.hub-step.is-current .hub-state { color: var(--brand); font-weight: 600; }
.hub-step.is-blocked .hub-dot { border-color: var(--warn-border); background: var(--warn-bg); }
.hub-step.is-blocked .hub-state { color: var(--warn-fg); font-weight: 600; }
.hub-step.is-later .hub-dot { border-style: dashed; }
.hub-step.is-todo > div > span, .hub-step.is-later > div > span { color: var(--text-2); }
.hub-tabs { margin-bottom: var(--s-5); }
.hub-body { max-width: 1040px; }
.hub-error { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.hub-team { max-width: 1040px; }
.hub-team .panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.hub-team-table { width: 100%; border-collapse: collapse; margin-top: var(--s-3); }
.hub-team-table th, .hub-team-table td { text-align: left; padding: var(--s-3) var(--s-2); border-bottom: 1px solid var(--border); font-size: var(--fs-base); vertical-align: middle; }
.hub-team-table thead th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; }
.hub-team-table tbody th { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); font-size: var(--fs-base); }
.hub-team-table tbody th small { margin-left: var(--s-2); font-weight: 400; color: var(--text-3); }
.hub-team-table tbody tr:last-child > * { border-bottom: 0; }
.table-scroll { overflow-x: auto; }
.hub-services { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-4); }
.hub-service h3 { margin: 0 0 var(--s-2); }
.client-kind { display: inline-block; margin-top: var(--s-2); font-size: var(--fs-xs); color: var(--text-3); border: 1px solid var(--border); border-radius: var(--r-full); padding: 1px 8px; }
@media (max-width: 760px) {
  .hub-tracks { grid-template-columns: 1fr; }
  .hub-next { flex-direction: column; align-items: stretch; }
  .hub-intro h2 { font-size: var(--fs-xl); }
  .hub-tabs { overflow-x: auto; max-width: 100%; }
}
.hub-body .connect-intro { margin-top: 0; }
.hub-body .connect-intro h2 { font-size: var(--fs-xl); }
