@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* ============================================================
   ManuOS WorkforceOS — Design Tokens
   ============================================================ */
:root {
  /* Brand */
  --teal: #0E6B68;
  --teal-dark: #084C49;
  --teal-soft: rgba(14, 107, 104, 0.10);
  --slate: #334155;
  --copper: #B87333;          /* AI intelligence accent */
  --copper-soft: rgba(184, 115, 51, 0.12);
  --gold: #D4A017;            /* premium highlights */

  /* Semantic */
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --info: #0EA5E9;

  /* Surfaces (light) */
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;
  --line: #E2E8F0;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-line: rgba(15, 23, 42, 0.08);
  --scrim: rgba(15, 23, 42, 0.42);

  /* Radius */
  --r-card: 18px;
  --r-btn: 14px;
  --r-input: 12px;
  --r-pill: 999px;

  /* Shadows */
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 44px rgba(15, 23, 42, 0.16);

  /* Spacing / layout */
  --gap: 14px;
  --pad: 18px;
  --tap: 48px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --topbar-h: 60px;
  --tabbar-h: 66px;

  --font: "Inter", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --bg: #0F172A;
  --surface: #1E293B;
  --surface-2: #223046;
  --text: #F1F5F9;
  --text-2: #CBD5E1;
  --text-3: #94A3B8;
  --line: rgba(255, 255, 255, 0.10);
  --teal: #2A9D97;
  --teal-dark: #0E6B68;
  --teal-soft: rgba(42, 157, 151, 0.16);
  --copper: #D08A46;
  --copper-soft: rgba(208, 138, 70, 0.16);
  --glass: rgba(30, 41, 59, 0.72);
  --glass-line: rgba(255, 255, 255, 0.10);
  --scrim: rgba(2, 6, 23, 0.62);
  --shadow: 0 8px 24px rgba(2, 6, 23, 0.4);
  --shadow-sm: 0 2px 8px rgba(2, 6, 23, 0.3);
  --shadow-lg: 0 18px 44px rgba(2, 6, 23, 0.55);
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #0F172A;
    --surface: #1E293B;
    --surface-2: #223046;
    --text: #F1F5F9;
    --text-2: #CBD5E1;
    --text-3: #94A3B8;
    --line: rgba(255, 255, 255, 0.10);
    --teal: #2A9D97;
    --teal-dark: #0E6B68;
    --teal-soft: rgba(42, 157, 151, 0.16);
    --copper: #D08A46;
    --copper-soft: rgba(208, 138, 70, 0.16);
    --glass: rgba(30, 41, 59, 0.72);
    --glass-line: rgba(255, 255, 255, 0.10);
    --scrim: rgba(2, 6, 23, 0.62);
    --shadow: 0 8px 24px rgba(2, 6, 23, 0.4);
    --shadow-sm: 0 2px 8px rgba(2, 6, 23, 0.3);
    --shadow-lg: 0 18px 44px rgba(2, 6, 23, 0.55);
  }
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { list-style: none; padding: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 6px;
}

.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;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}
.icon--xs { width: 13px; height: 13px; }
.icon--sm { width: 18px; height: 18px; }
.icon--lg { width: 26px; height: 26px; }
.icon--xl { width: 40px; height: 40px; stroke-width: 1.4; }
.muted-icon { color: var(--text-3); }

.muted { color: var(--text-2); }
.dotsep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; margin: 0 8px; vertical-align: middle; opacity: .5; }

/* ============================================================
   App shell
   ============================================================ */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) calc(var(--pad) + var(--safe-r)) 0 calc(var(--pad) + var(--safe-l));
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--glass-line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand__mark { width: 34px; height: 34px; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand__name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand__sub { font-size: 11px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: var(--tap); height: var(--tap);
  display: inline-grid; place-items: center;
  border-radius: var(--r-btn);
  color: var(--slate);
  position: relative;
  transition: background .18s var(--ease), transform .18s var(--ease);
}
[data-theme="dark"] .icon-btn, [data-theme="auto"] .icon-btn { color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn--soft { background: var(--surface-2); width: 44px; height: 44px; }
.icon-btn--primary { background: var(--teal); color: #fff; width: 44px; height: 44px; }
.icon-btn--primary:hover { background: var(--teal-dark); }

.icon--moon { display: none; }
[data-theme="dark"] .icon--sun { display: none; }
[data-theme="dark"] .icon--moon { display: block; }
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .icon--sun { display: none; }
  [data-theme="auto"] .icon--moon { display: block; }
}

.dot-badge {
  position: absolute; top: 8px; right: 8px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--bg);
}

/* ---------- Screens ---------- */
.screens { flex: 1; min-height: 0; }
.screen { animation: fadeUp .32s var(--ease); }
.screen__inner {
  padding: 20px calc(var(--pad) + var(--safe-r)) 0 calc(var(--pad) + var(--safe-l));
  display: flex; flex-direction: column; gap: 18px;
}
.screen__inner--flush { padding-top: 0; gap: 0; }
.screen__spacer { height: calc(var(--tabbar-h) + var(--safe-b) + 24px); }
.screen__title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.screen__lede { color: var(--text-2); font-size: 14px; margin-top: -12px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Components — cards, buttons, tags
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card__title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card__head > .link-btn, .card__head > .count-chip, .card__head > .pill, .card__head > svg { margin-left: auto; }
.card__actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.card__actions--center { justify-content: center; }
.card--ai { border-color: var(--copper-soft); background: linear-gradient(180deg, var(--copper-soft), transparent 70%), var(--surface); }
.card--focus { border-left: 3px solid var(--teal); }
.card--account { display: flex; align-items: center; gap: 14px; }
.account__name { font-weight: 600; }
.account__meta { font-size: 12px; color: var(--text-3); }
.card--account .btn { margin-left: auto; }

.section { display: flex; flex-direction: column; gap: 12px; }
.section__head { display: flex; align-items: center; gap: 10px; }
.section__title { font-size: 15px; font-weight: 600; }
.section__head .link-btn { margin-left: auto; }

.btn {
  min-height: 44px; padding: 0 16px;
  border-radius: var(--r-btn);
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .18s var(--ease), transform .12s var(--ease), color .18s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--teal); color: #fff; }
.btn--primary:hover { background: var(--teal-dark); }
.btn--quiet { background: var(--surface-2); color: var(--text); }
.btn--quiet:hover { background: var(--line); }
.btn--danger-quiet { background: rgba(220, 38, 38, 0.10); color: var(--danger); }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px;
  border-radius: var(--r-pill);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
}
.ghost-btn:hover { color: var(--text); border-color: var(--teal); }

.link-btn { color: var(--teal); font-size: 13px; font-weight: 600; padding: 6px 2px; }
.link-btn:hover { color: var(--teal-dark); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-2); color: var(--text-2);
}
.pill--ai { background: var(--copper-soft); color: var(--copper); }

.tag {
  font-size: 11px; font-weight: 600; padding: 4px 9px;
  border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.tag--warning { background: rgba(245, 158, 11, .14); color: #B45309; }
.tag--danger { background: rgba(220, 38, 38, .12); color: var(--danger); }
.tag--info { background: rgba(14, 165, 233, .12); color: #0284C7; }
.tag--success { background: rgba(22, 163, 74, .12); color: var(--success); }
[data-theme="dark"] .tag--warning { color: #FBBF24; }
[data-theme="dark"] .tag--info { color: #38BDF8; }

.count-chip {
  min-width: 24px; height: 24px; padding: 0 8px;
  display: grid; place-items: center; border-radius: var(--r-pill);
  background: var(--teal-soft); color: var(--teal);
  font-size: 12px; font-weight: 700;
}
.count-chip--gold { background: rgba(212, 160, 23, .16); color: var(--gold); }

.chip {
  min-height: 38px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.chip--active { background: var(--teal); border-color: var(--teal); color: #fff; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: -4px 0; padding: 4px 0; }
.filter-row::-webkit-scrollbar { display: none; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; margin-right: 7px; }
.status-dot--online { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.16); }
.status-dot--busy { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,.16); }
.status-dot--idle { background: var(--text-3); box-shadow: 0 0 0 3px rgba(148,163,184,.16); }
.status-dot--offline { background: var(--text-3); opacity: .5; }

/* ============================================================
   Home — greeting & orb
   ============================================================ */
.greeting { display: flex; flex-direction: column; gap: 6px; }
.greeting__meta { font-size: 12px; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }
.greeting__title { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.greeting__name { color: var(--teal); }
.greeting__sub { color: var(--text-2); font-size: 16px; }

.orb-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 0 6px; }
.orb {
  position: relative;
  width: 168px; height: 168px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.orb__core {
  width: 116px; height: 116px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 30% 25%, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  box-shadow: 0 18px 40px rgba(14, 107, 104, 0.34), inset 0 1px 0 rgba(255,255,255,.22);
  transition: transform .2s var(--ease);
  z-index: 1;
}
.orb:active .orb__core { transform: scale(0.95); }
.orb__ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--copper);
  opacity: 0;
  animation: pulseRing 3.4s var(--ease) infinite;
}
.orb__ring--2 { animation-delay: 1.7s; }
@keyframes pulseRing {
  0% { transform: scale(0.72); opacity: .5; }
  70% { opacity: .06; }
  100% { transform: scale(1.06); opacity: 0; }
}
.orb-stage__hint { font-size: 13px; color: var(--text-2); }
.orb-stage__hint strong { color: var(--copper); font-weight: 600; }

/* ---------- Focus list ---------- */
.focus-list { display: flex; flex-direction: column; gap: 12px; }
.focus-item { display: flex; gap: 12px; align-items: flex-start; }
.focus-item__rank {
  width: 24px; height: 24px; flex: none; border-radius: 8px;
  background: var(--teal-soft); color: var(--teal);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.focus-item__title { font-size: 14px; font-weight: 500; }
.focus-item__meta { font-size: 12px; color: var(--text-3); }

/* ---------- Quick actions ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qa {
  min-height: 78px; border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  font-size: 11px; font-weight: 500; color: var(--text-2);
  transition: transform .16s var(--ease), border-color .16s var(--ease);
}
.qa .icon { color: var(--teal); }
.qa:hover { border-color: var(--teal); transform: translateY(-2px); }
.qa:active { transform: scale(0.97); }

/* ---------- Timeline / tasks / bullets ---------- */
.timeline { display: flex; flex-direction: column; }
.timeline__row { display: flex; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.timeline__row:first-child { border-top: 0; padding-top: 0; }
.timeline__time { font-size: 12px; font-weight: 600; color: var(--teal); min-width: 46px; padding-top: 2px; }
.timeline__title { font-size: 14px; font-weight: 500; }
.timeline__meta { font-size: 12px; color: var(--text-3); }

.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist > li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); min-height: 44px; }
.checklist > li:first-child { border-top: 0; }
.checklist--tight > li { border-top: 0; padding: 4px 0; min-height: 36px; }
.check { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 20px; height: 20px; flex: none; border-radius: 6px;
  border: 1.5px solid var(--line); background: var(--surface);
  position: relative; transition: all .16s var(--ease);
}
.check input:checked + .check__box { background: var(--teal); border-color: var(--teal); }
.check input:checked + .check__box::after {
  content: ""; position: absolute; left: 6px; top: 2.5px;
  width: 5px; height: 10px; border: 2px solid #fff; border-top: 0; border-left: 0;
  transform: rotate(42deg);
}
.check input:focus-visible + .check__box { outline: 2px solid var(--teal); outline-offset: 2px; }
.check__label { font-size: 14px; }
.check input:checked ~ .check__label { color: var(--text-3); text-decoration: line-through; }

.task-list { display: flex; flex-direction: column; }
.task { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; padding-top: 0; }
.task > div { flex: 1; min-width: 0; }
.task__title { font-size: 14px; font-weight: 500; }
.task__meta { font-size: 12px; color: var(--text-3); }

.bullets { display: flex; flex-direction: column; gap: 9px; }
.bullets li { position: relative; padding-left: 16px; font-size: 14px; color: var(--text-2); }
.bullets li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--teal);
}

.ai-note { font-size: 14px; color: var(--text-2); line-height: 1.55; }

.convo-list { display: flex; flex-direction: column; }
.convo { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.convo:first-child { border-top: 0; padding-top: 0; }
.convo__title { font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo__meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-input); font-size: 13px; }
.alert > span:first-child { flex: 1; }
.alert--danger { background: rgba(220, 38, 38, .08); }
.alert--warning { background: rgba(245, 158, 11, .10); }

/* ---------- Horizontal workforce strip ---------- */
.hscroll {
  display: flex; gap: 12px; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 calc(-1 * var(--pad)); padding: 4px var(--pad) 8px;
}
.hscroll::-webkit-scrollbar { display: none; }

.wf-card {
  flex: none; width: 168px; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 14px; text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .16s var(--ease), border-color .16s var(--ease);
}
.wf-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.wf-card:active { transform: scale(0.98); }
.wf-card__name { font-size: 14px; font-weight: 600; }
.wf-card__dept { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.wf-card__task { font-size: 12px; color: var(--text-2); line-height: 1.45; min-height: 34px; }
.wf-card__status { font-size: 12px; display: flex; align-items: center; color: var(--text-2); }
.wf-card__avail { font-size: 11px; color: var(--text-3); border-top: 1px solid var(--line); padding-top: 8px; }

/* ---------- Workforce grid ---------- */
.wf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.wf-tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; gap: 9px; text-align: left;
  transition: transform .16s var(--ease), border-color .16s var(--ease);
}
.wf-tile:hover { transform: translateY(-2px); border-color: var(--teal); }
.wf-tile__name { font-size: 14px; font-weight: 600; }
.wf-tile__role { font-size: 12px; color: var(--text-2); }
.wf-tile__dept { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.wf-tile__activity { font-size: 11px; color: var(--text-3); }
.wf-tile__cta {
  margin-top: auto; min-height: 40px; border-radius: var(--r-btn);
  background: var(--teal-soft); color: var(--teal);
  font-size: 12px; font-weight: 600;
  display: grid; place-items: center;
}

/* ---------- Avatars ---------- */
.avatar {
  position: relative;
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  overflow: hidden;
  display: grid; place-items: center;
  background: var(--teal-soft); color: var(--teal);
  font-weight: 700; font-size: 15px; letter-spacing: -0.02em;
}
.avatar--xs { width: 24px; height: 24px; border-radius: 8px; font-size: 10px; }
.avatar--sm { width: 36px; height: 36px; border-radius: 12px; font-size: 13px; }
.avatar--lg { width: 56px; height: 56px; border-radius: 18px; font-size: 18px; }
.avatar--xl { width: 86px; height: 86px; border-radius: 28px; font-size: 28px; }
.avatar--ai { background: var(--copper-soft); color: var(--copper); }

/* Step 10: portrait when avatar_ref is set (else the initials show through). */
.avatar__img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: inherit; display: block;
}

/* Step 10: speaking-pulse ring during TTS playback. */
.avatar--speaking { animation: avatarPulse 1.4s ease-in-out infinite; }
@keyframes avatarPulse {
  0%   { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(20, 184, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .avatar--speaking { animation: none; box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.55); }
}

/* ============================================================
   Conversations
   ============================================================ */
.thread-head {
  position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px var(--pad);
  background: var(--glass);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-line);
}
.thread-head__name { font-size: 14px; font-weight: 600; }
.thread-head__meta { font-size: 12px; color: var(--text-3); display: flex; align-items: center; }

.thread {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px var(--pad) calc(var(--tabbar-h) + var(--safe-b) + 90px);
}
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 88%; animation: fadeUp .3s var(--ease); }
.msg--in { align-self: flex-start; }
.msg--out { align-self: flex-end; align-items: flex-end; }
.msg__bubble {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); border-top-left-radius: 6px;
  padding: 13px 15px; box-shadow: var(--shadow-sm);
  font-size: 14px; line-height: 1.55;
}
.msg--out .msg__bubble {
  background: var(--teal); border-color: var(--teal); color: #fff;
  border-top-left-radius: var(--r-card); border-top-right-radius: 6px;
}
.msg__bubble--wide { width: 100%; }
.msg--in .msg__bubble--wide { min-width: 260px; }
.msg__label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--copper); margin-bottom: 6px; }
.msg--out .msg__label { color: rgba(255,255,255,.72); }
.msg__time { font-size: 11px; color: var(--text-3); padding: 0 4px; }
.msg__dur { font-size: 12px; font-variant-numeric: tabular-nums; }
.msg__bubble--voice { display: flex; align-items: center; gap: 10px; }
.msg__bubble--typing { padding: 14px 16px; }
.play-btn {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: rgba(255,255,255,.2); color: inherit;
}
.msg--in .play-btn { background: var(--teal-soft); color: var(--teal); }

.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--copper); animation: blink 1.3s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.action-card {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: var(--r-card); padding: 14px; box-shadow: var(--shadow-sm);
  width: 100%;
}
.action-card--approval { border-left-color: var(--gold); }
.action-card__head {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--teal); margin-bottom: 8px;
}
.action-card__head--gold { color: var(--gold); }
.action-card__title { font-size: 15px; font-weight: 600; }
.action-card__meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }

.kv { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { font-weight: 600; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; padding: 6px 8px; }
.table td { padding: 8px; border-top: 1px solid var(--line); }
.table .pos { color: var(--success); font-weight: 600; }
.table .neg { color: var(--danger); font-weight: 600; }

.attach-list { display: flex; flex-direction: column; gap: 8px; }
.attach { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: var(--r-input); background: var(--surface-2); }
.attach__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal); flex: none; }
.attach__icon--img { background: var(--copper-soft); color: var(--copper); }
.attach__body { display: flex; flex-direction: column; min-width: 0; }
.attach__name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach__meta { font-size: 11px; color: var(--text-3); }
.img-preview {
  margin-top: 10px; height: 132px; border-radius: var(--r-input);
  background: linear-gradient(135deg, var(--surface-2), var(--teal-soft));
  display: grid; place-items: center; color: var(--text-3); font-size: 12px;
  border: 1px dashed var(--line);
}

/* ---------- Composer ---------- */
.composer {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 30;
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 10px calc(var(--pad) + var(--safe-r)) 10px calc(var(--pad) + var(--safe-l));
  background: var(--glass);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--glass-line);
}
.composer__input {
  flex: 1; min-width: 0; min-height: 44px;
  border-radius: var(--r-input); border: 1px solid var(--line);
  background: var(--surface); padding: 0 14px; font-size: 14px;
}
.composer__input::placeholder { color: var(--text-3); }
.composer__input:focus { outline: none; border-color: var(--teal); }

/* ============================================================
   Employee profile
   ============================================================ */
.profile-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 8px 0 4px; }
.profile-hero__name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.profile-hero__role { font-size: 13px; color: var(--text-2); }
.profile-hero__status { font-size: 13px; color: var(--text-2); display: flex; align-items: center; }

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--surface-2); border-radius: var(--r-input); padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.kpi__value { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.kpi__label { font-size: 11px; color: var(--text-3); }

/* ============================================================
   Dashboard
   ============================================================ */
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-sm);
  padding: 14px 12px; text-align: center;
}
.metric__value { display: block; font-size: 22px; font-weight: 700; color: var(--teal); letter-spacing: -0.02em; }
.metric__label { font-size: 11px; color: var(--text-3); }

.dash-grid { display: flex; flex-direction: column; gap: 14px; }

.progress-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.progress-row__label { font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { width: 96px; height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; flex: none; }
.progress__bar { display: block; height: 100%; width: var(--pct, 50%); border-radius: var(--r-pill); background: var(--teal); }

/* ============================================================
   Knowledge
   ============================================================ */
.search { position: relative; display: flex; align-items: center; }
.search__icon { position: absolute; left: 14px; color: var(--text-3); }
.search__input {
  width: 100%; min-height: 48px; padding: 0 14px 0 42px;
  border-radius: var(--r-input); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-sm); font-size: 14px;
}
.search__input:focus { outline: none; border-color: var(--teal); }

.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-sm); padding: 14px; min-height: 92px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.cat:hover { border-color: var(--teal); transform: translateY(-2px); }
.cat .icon { color: var(--teal); }
.cat span { font-size: 14px; font-weight: 600; }
.cat small { font-size: 11px; color: var(--text-3); }

.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-input); box-shadow: var(--shadow-sm); min-height: 56px;
}
.doc__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--slate); flex: none; }
[data-theme="dark"] .doc__icon { color: var(--text-2); }
.doc__body { display: flex; flex-direction: column; min-width: 0; }
.doc__name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc__meta { font-size: 11px; color: var(--text-3); }

.card--graph .graph { background: var(--surface-2); border-radius: var(--r-input); padding: 8px; margin-bottom: 12px; }
.graph svg { width: 100%; height: auto; display: block; }
.graph line { stroke: var(--line); stroke-width: 1.5; }
.graph circle { fill: var(--surface); stroke: var(--teal); stroke-width: 1.5; }
.graph__hub { fill: var(--teal-soft); stroke: var(--copper); stroke-width: 2; }

/* ============================================================
   Settings
   ============================================================ */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); border-radius: var(--r-btn); padding: 4px; }
.seg__btn { min-height: 40px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg__btn[aria-checked="true"] { background: var(--surface); color: var(--teal); box-shadow: var(--shadow-sm); }

.settings-list { display: flex; flex-direction: column; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; min-height: 52px; }
.setting:first-child { border-top: 0; }

.switch { position: relative; display: inline-flex; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track {
  width: 48px; height: 28px; border-radius: var(--r-pill);
  background: var(--line); position: relative; transition: background .2s var(--ease);
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm); transition: transform .2s var(--ease);
}
.switch input:checked + .switch__track { background: var(--teal); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--teal); outline-offset: 2px; }

.version { text-align: center; font-size: 12px; color: var(--text-3); }

/* ============================================================
   Floating action button + tab bar
   ============================================================ */
.fab {
  position: fixed;
  right: calc(18px + var(--safe-r));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  z-index: 45;
  width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: radial-gradient(120% 120% at 30% 25%, var(--teal) 0%, var(--teal-dark) 100%);
  box-shadow: 0 12px 30px rgba(14, 107, 104, 0.36);
  transition: transform .18s var(--ease);
}
.fab::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px solid var(--copper); opacity: 0;
  animation: pulseRing 3.6s var(--ease) infinite;
}
.fab:active { transform: scale(0.93); }
body[data-screen="conversations"] .fab { bottom: calc(var(--tabbar-h) + var(--safe-b) + 78px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 720px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--glass-line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10px; font-weight: 500; color: var(--text-3);
  min-height: var(--tap);
  transition: color .18s var(--ease);
}
.tab .icon { width: 21px; height: 21px; }
.tab--active { color: var(--teal); }
.tab--active .icon { stroke-width: 1.9; }

/* ============================================================
   Overlays — voice panel & notification sheet (glass)
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; background: var(--scrim);
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.overlay--voice { align-items: stretch; justify-content: center; }
.overlay__panel {
  position: relative;
  width: 100%; max-width: 720px;
  padding: calc(var(--safe-t) + 26px) calc(var(--pad) + var(--safe-r)) calc(var(--safe-b) + 26px) calc(var(--pad) + var(--safe-l));
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(28px);
  -webkit-backdrop-filter: saturate(160%) blur(28px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
  animation: scaleIn .26s var(--ease);
  overflow-y: auto;
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.overlay__close { position: absolute; top: calc(var(--safe-t) + 10px); right: calc(var(--pad) + var(--safe-r)); }

.voice-state {
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--copper);
}

.voice-orb { position: relative; width: 200px; height: 200px; display: grid; place-items: center; }
.voice-orb__core {
  width: 128px; height: 128px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: radial-gradient(120% 120% at 30% 25%, var(--teal) 0%, var(--teal-dark) 100%);
  box-shadow: 0 20px 46px rgba(14, 107, 104, 0.4), inset 0 1px 0 rgba(255,255,255,.22);
  z-index: 1; transition: transform .2s var(--ease), background .3s var(--ease);
}
.voice-orb__halo {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid var(--copper); opacity: 0;
}
.voice-orb[data-state="listening"] .voice-orb__halo { animation: pulseRing 1.9s var(--ease) infinite; }
.voice-orb[data-state="listening"] .voice-orb__halo--2 { animation-delay: .95s; }
.voice-orb[data-state="listening"] .voice-orb__core { animation: breathe 1.9s var(--ease) infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.voice-orb[data-state="thinking"] .voice-orb__core { background: radial-gradient(120% 120% at 30% 25%, var(--copper) 0%, #8A5522 100%); }
.voice-orb[data-state="thinking"] .voice-orb__halo {
  opacity: 1; border-color: transparent; border-top-color: var(--copper);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.voice-orb[data-state="speaking"] .voice-orb__core { animation: breathe 1.1s var(--ease) infinite; }
.voice-orb[data-state="muted"] .voice-orb__core { background: var(--surface-2); color: var(--text-3); box-shadow: var(--shadow-sm); }
.voice-orb[data-state="cancelled"] .voice-orb__core { background: var(--surface-2); color: var(--danger); box-shadow: var(--shadow-sm); }

/* Waveform */
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 44px; }
.wave i {
  width: 3px; height: 6px; border-radius: var(--r-pill);
  background: var(--copper); opacity: .45;
  transition: height .12s linear, opacity .2s linear;
}
.wave--static { height: 22px; }
.wave--static i { background: currentColor; opacity: .55; }
.msg--in .wave--static i { background: var(--teal); }
.wave--static i:nth-child(odd) { height: 12px; }
.wave--static i:nth-child(3n) { height: 18px; }

.transcript {
  width: 100%; max-width: 460px; min-height: 92px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 14px 16px;
}
.transcript__label { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.transcript__text { font-size: 15px; line-height: 1.55; }

.voice-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.round-btn {
  min-height: var(--tap); padding: 0 20px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .14s var(--ease);
}
.round-btn:active { transform: scale(0.96); }
.round-btn[aria-pressed="true"] { background: var(--slate); color: #fff; border-color: var(--slate); }
.round-btn--primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.round-btn--danger { color: var(--danger); }

.state-strip { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.state-chip {
  min-height: 34px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--glass-line); background: transparent;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3);
}
.state-chip[aria-current="true"] { color: var(--copper); border-color: var(--copper); }

/* ---------- Notification sheet ---------- */
.overlay--sheet { align-items: flex-end; }
.sheet {
  width: 100%; max-width: 720px; margin: 0 auto;
  max-height: 84dvh; display: flex; flex-direction: column;
  border-radius: 26px 26px 0 0;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(26px);
  -webkit-backdrop-filter: saturate(160%) blur(26px);
  border-top: 1px solid var(--glass-line);
  box-shadow: var(--shadow-lg);
  animation: slideUp .28s var(--ease);
  padding-bottom: var(--safe-b);
}
@keyframes slideUp { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__grab { width: 40px; height: 4px; border-radius: var(--r-pill); background: var(--line); margin: 10px auto 4px; }
.sheet__head { display: flex; align-items: center; padding: 8px var(--pad) 10px; }
.sheet__title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.sheet__head .icon-btn { margin-left: auto; }
.sheet__body { overflow-y: auto; padding: 0 var(--pad) 20px; display: flex; flex-direction: column; gap: 10px; }

.notif {
  display: flex; gap: 12px; padding: 13px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--text-3);
  border-radius: var(--r-input); box-shadow: var(--shadow-sm);
}
.notif__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.notif__body { min-width: 0; flex: 1; }
.notif__title { font-size: 14px; font-weight: 600; }
.notif__text { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.notif__time { font-size: 11px; color: var(--text-3); margin-top: 4px; display: block; }
.notif--information { border-left-color: var(--info); }
.notif--information .notif__icon { background: rgba(14,165,233,.12); color: var(--info); }
.notif--reminder { border-left-color: var(--slate); }
.notif--reminder .notif__icon { background: rgba(51,65,85,.10); color: var(--slate); }
[data-theme="dark"] .notif--reminder .notif__icon { color: var(--text-2); }
.notif--urgent { border-left-color: var(--danger); }
.notif--urgent .notif__icon { background: rgba(220,38,38,.12); color: var(--danger); }
.notif--approval { border-left-color: var(--gold); }
.notif--approval .notif__icon { background: rgba(212,160,23,.14); color: var(--gold); }
.notif--completed { border-left-color: var(--success); }
.notif--completed .notif__icon { background: rgba(22,163,74,.12); color: var(--success); }
.notif__actions { display: flex; gap: 8px; margin-top: 10px; }

/* Loading shimmer utility */
.shimmer {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-input);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Ripple */
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: currentColor; opacity: .22; pointer-events: none;
  animation: ripple .55s var(--ease) forwards;
}
@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }

/* ============================================================
   Responsive — tablet
   ============================================================ */
@media (min-width: 600px) {
  :root { --pad: 24px; }
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .wf-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); align-items: start; }
  .metric-row { grid-template-columns: repeat(3, 1fr); }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .greeting__title { font-size: 34px; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* hidden attribute must win over display rules */
[hidden] { display: none !important; }

/* ============================================================
   WorkforceOS app additions (server-rendered screens)
   ============================================================ */

/* Screens rendered as pages (no SPA hidden toggling) */
.screen { display: block; }

/* Tab bar as links */
.tab { text-decoration: none; }

/* ---------- Flash + errors ---------- */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-input);
  background: rgba(22, 163, 74, .10); color: var(--success);
  font-size: 13.5px; font-weight: 500;
  border: 1px solid rgba(22, 163, 74, .25);
}
.errbox {
  padding: 12px 14px; border-radius: var(--r-input);
  background: rgba(220, 38, 38, .08); color: var(--danger);
  font-size: 13.5px; border: 1px solid rgba(220, 38, 38, .28);
}
.errbox ul { padding-left: 16px; list-style: disc; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border-radius: var(--r-input); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.55; }
textarea.input--tall { min-height: 200px; font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 13px; }
.input:focus { outline: none; border-color: var(--teal); }
select.input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
.f-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 600px) { .f-grid { grid-template-columns: 1fr 1fr; } .f-span { grid-column: 1 / -1; } }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Data tables (admin) ---------- */
.table td { vertical-align: middle; }
.table .input { min-height: 38px; padding: 6px 10px; font-size: 13px; }

/* ---------- Code + mono ---------- */
.mono { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.code-chip { color: var(--teal); font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; letter-spacing: .02em; }

/* ---------- Definition rows ---------- */
.def { display: grid; grid-template-columns: 148px 1fr; gap: 8px 14px; font-size: 14px; }
.def dt { color: var(--text-3); }
.def dd { min-width: 0; overflow-wrap: break-word; }
@media (max-width: 520px) { .def { grid-template-columns: 1fr; } .def dt { margin-top: 6px; } }

/* ---------- Version blocks (prompts, SOPs, knowledge) ---------- */
.ver { border: 1px solid var(--line); border-radius: var(--r-input); padding: 12px 14px; margin-top: 10px; background: var(--surface-2); }
.ver-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ver-head .v { color: var(--teal); font-weight: 700; font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.ver-head .when { color: var(--text-3); font-size: 12px; }
.ver-head .push { margin-left: auto; }
.ver pre, .content-body {
  white-space: pre-wrap; overflow-wrap: break-word;
  font-size: 13.5px; line-height: 1.6; color: var(--text-2); margin-top: 8px;
}
.content-body { color: var(--text); font-size: 14.5px; max-width: 65ch; }
details > summary { cursor: pointer; color: var(--text-2); font-size: 13px; margin-top: 8px; font-weight: 500; }
details[open] > summary { color: var(--teal); }

/* ---------- Directory grouping ---------- */
.dept-head { display: flex; align-items: baseline; gap: 10px; padding: 4px 2px 8px; }
.dept-head .dept-name { font-size: 14px; font-weight: 600; }
.dept-head .dept-count { margin-left: auto; font-size: 12px; color: var(--text-3); }

/* wf-tile status corner */
.wf-tile { position: relative; }
.wf-tile__flag { position: absolute; top: 12px; right: 12px; }

/* ---------- Build rail (reuse focus-item language) ---------- */
.rail { display: flex; flex-direction: column; }
.rail > li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.rail > li:first-child { border-top: 0; padding-top: 0; }
.rail .dot {
  width: 26px; height: 26px; flex: none; border-radius: 9px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-3);
}
.rail .done .dot { background: var(--teal); color: #fff; }
.rail .next .dot { background: var(--teal-soft); color: var(--teal); }
.rail .name { font-size: 14px; font-weight: 600; }
.rail .done .name::after { content: " · live"; color: var(--success); font-weight: 600; font-size: 12px; }
.rail .next .name::after { content: " · next"; color: var(--copper); font-weight: 600; font-size: 12px; }
.rail .detail { font-size: 12.5px; color: var(--text-3); }

/* ---------- Auth (login) ---------- */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth-brand img { width: 64px; height: 64px; object-fit: contain; }
.auth-brand h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.auth-brand p { font-size: 12px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Misc ---------- */
.spread { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread .push { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.tag--dormant { opacity: .75; }
a.doc, a.wf-tile, a.cat { text-decoration: none; color: inherit; }
.inline-form { display: inline; }
