/* CrossBorder Care · platform demo · visual language of concept B ("Locomotive")
   One deep teal-ink ground for the shell chrome, one warm paper for everything people read, one luminous
   amber accent for the primary action and "you are here" markers. No external assets (mainland-China safe).
   Motion: expo-out, transform and opacity only, and only when something actually changed (the shell marks
   persona switches with .is-entering and changed chips with .chip-flip). Reduced motion gets a still page.
   Component classes used by views (via ui.js): card, kv, list/row, chip-*, btn-*, next, notice-*, tabs, field,
   input, check, progress, thread, json, empty, grid-2, grid-3, stack, compare, muted, small, money. */

:root {
  color-scheme: light;
  /* teal-ink ground */
  --ink-950: oklch(0.175 0.028 222);
  --ink-900: oklch(0.205 0.034 218);
  --ink-850: oklch(0.235 0.037 214);
  --ink-800: oklch(0.275 0.04 211);
  --ink-line: oklch(0.45 0.035 210 / 0.42);
  --on-ink: oklch(0.955 0.012 85);
  --on-ink-2: oklch(0.84 0.018 200);
  --on-ink-3: oklch(0.72 0.022 205);
  /* warm paper */
  --paper: oklch(0.972 0.01 85);
  --paper-2: oklch(0.946 0.014 85);
  --card: oklch(0.993 0.004 85);
  --ink: oklch(0.235 0.03 220);
  --ink-2: oklch(0.42 0.025 220);
  --muted: oklch(0.5 0.02 220);
  --rule: oklch(0.885 0.012 85);
  --rule-2: oklch(0.8 0.015 220);
  --edge: oklch(0.9 0.01 85);
  --field: oklch(0.66 0.015 220);
  /* teal: confirmed, safe, done */
  --accent: oklch(0.47 0.075 185);
  --accent-ink: oklch(0.37 0.06 185);
  --accent-wash: oklch(0.935 0.03 180);
  --teal-lt: oklch(0.76 0.085 180);
  /* the one luminous accent */
  --glow: oklch(0.84 0.135 78);
  --glow-hi: oklch(0.88 0.12 80);
  --glow-edge: oklch(0.72 0.13 70);
  --glow-soft: oklch(0.84 0.135 78 / 0.22);
  --glow-ink: oklch(0.5 0.11 62);
  --glow-wash: oklch(0.955 0.04 85);
  /* honest problems */
  --alert: oklch(0.5 0.13 35);
  --alert-wash: oklch(0.955 0.025 45);
  --alert-lt: oklch(0.72 0.14 38);
  --warn: oklch(0.6 0.11 72);
  --warn-ink: oklch(0.42 0.09 70);
  --warn-wash: oklch(0.955 0.035 88);

  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, Georgia, serif;
  --serif-zh: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "PingFang SC", "Microsoft YaHei", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1); /* expo-out */
  --r: 14px;
  --bar-h: 60px;
  --lift: 0 1px 0 oklch(1 0 0 / 0.7) inset, 0 18px 40px -30px oklch(0.25 0.03 220 / 0.38), 0 4px 10px -8px oklch(0.25 0.03 220 / 0.16);
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .028 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  /* chip + focus tokens: light (paper) context */
  --focus: var(--glow-ink);
  --c-ok-bg: var(--accent); --c-ok-fg: var(--card);
  --c-pend: var(--ink-2);
  --c-info-bg: var(--paper-2); --c-info-b: var(--rule); --c-info-fg: var(--ink-2);
  --c-mute-b: var(--rule); --c-mute-fg: var(--muted);
  --c-den-bg: var(--alert-wash); --c-den-b: oklch(0.5 0.13 35 / 0.35); --c-den-fg: var(--alert);
  --c-warn-bg: var(--warn-wash); --c-warn-b: oklch(0.6 0.11 72 / 0.45); --c-warn-fg: var(--warn-ink);
  --c-clin-b: var(--accent); --c-clin-fg: var(--accent-ink);
  --c-adm-bg: var(--card); --c-adm-b: var(--rule-2); --c-adm-fg: var(--ink-2);
  --c-fict-b: oklch(0.6 0.1 45); --c-fict-fg: oklch(0.48 0.11 45);
}

/* dark (teal-ink) contexts re-map the same tokens */
.bar, .rail, .side > .tabs, .next, .tour .probe-result, .toast, .processing {
  --focus: var(--glow);
  --c-ok-bg: var(--teal-lt); --c-ok-fg: var(--ink-950);
  --c-pend: var(--on-ink-2);
  --c-info-bg: oklch(0.3 0.04 211); --c-info-b: var(--ink-line); --c-info-fg: var(--on-ink-2);
  --c-mute-b: var(--ink-line); --c-mute-fg: var(--on-ink-3);
  --c-den-bg: oklch(0.62 0.15 35 / 0.2); --c-den-b: oklch(0.72 0.14 38 / 0.6); --c-den-fg: oklch(0.87 0.07 50);
  --c-warn-bg: oklch(0.84 0.135 78 / 0.14); --c-warn-b: oklch(0.84 0.135 78 / 0.5); --c-warn-fg: oklch(0.9 0.08 85);
  --c-clin-b: var(--teal-lt); --c-clin-fg: oklch(0.86 0.06 180);
  --c-adm-bg: transparent; --c-adm-b: var(--ink-line); --c-adm-fg: var(--on-ink-2);
  --c-fict-b: oklch(0.75 0.08 60); --c-fict-fg: oklch(0.82 0.07 70);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background-color: var(--paper); background-image: var(--grain-ink); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: oklch(0.84 0.135 78 / 0.4); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 40px; color: var(--muted); }
html[data-lang="en"] .boot[lang="zh-CN"], html[data-lang="zh"] .boot[lang="en"], html:not([data-lang]) .boot[lang="zh-CN"] { display: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; line-height: 1.25; letter-spacing: -0.005em; text-wrap: balance; }
html[lang="zh-CN"] h1, html[lang="zh-CN"] h2, html[lang="zh-CN"] h3 { font-family: var(--serif-zh); font-weight: 600; letter-spacing: 0; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent-ink); }

/* mono eyebrows (B's labelling voice); Chinese drops the mono/uppercase treatment */
.ws-kicker, .next-label, .rail-label, .ops .ops-label, .tour .tour-rule-label, .ops .ops-facts dt, .tour .tour-step .tour-meta, .clk-city, .bar-title, .msg-by {
  font-family: var(--mono); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
}
html[lang="zh-CN"] :is(.tour .tour-count, .tour .tour-group-count, .mail-to),
html[lang="zh-CN"] :is(.ws-kicker, .next-label, .rail-label, .ops .ops-label, .tour .tour-rule-label, .ops .ops-facts dt, .tour .tour-step .tour-meta, .clk-city, .bar-title, .msg-by) {
  font-family: var(--sans); letter-spacing: 0.06em;
}

/* =====================================================================
   Shell · top bar (teal-ink, grain, a time ruler between the two cities)
   ===================================================================== */
#app { height: 100%; display: flex; flex-direction: column; }
.bar { position: relative; overflow: clip; display: flex; align-items: center; gap: 10px 18px; min-height: var(--bar-h); padding: 9px 20px; flex-wrap: wrap; color: var(--on-ink);
  background: radial-gradient(30% 140% at 86% 0%, oklch(0.84 0.135 78 / 0.07), transparent 70%), var(--grain-light), var(--ink-950);
  border-bottom: 1px solid var(--ink-line); }
.bar::after { /* background-work shimmer, shown while .is-processing */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--glow) 45%, var(--glow-hi) 55%, transparent); transform: translateX(-100%); }
body.is-processing .bar::after { opacity: 1; transform: none; }
.bar-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--on-ink); min-width: 0; }
.bar-brand:focus-visible { border-radius: 8px; }
.bar-mark { position: relative; flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px dashed oklch(0.72 0.022 205 / 0.7); }
.bar-mark::before { content: ""; position: absolute; left: 3px; bottom: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--teal-lt); }
.bar-mark::after { content: ""; position: absolute; right: -2px; top: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 3px var(--glow-soft), 0 0 12px 1px oklch(0.84 0.135 78 / 0.45); }
.bar-wm { font: 400 20px/1 var(--serif); letter-spacing: -0.01em; white-space: nowrap; }
.bar-title { font-size: 10.5px; color: var(--on-ink-3); padding-left: 11px; border-left: 1px solid var(--ink-line); line-height: 1.6; white-space: nowrap; }
.bar .chip-demo { font-size: 10px; }
.bar-clock { display: flex; align-items: center; gap: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }
.clk { display: grid; gap: 2px; line-height: 1.1; }
.clk:last-child { text-align: right; }
.clk-city { font-size: 9.5px; color: var(--on-ink-3); letter-spacing: 0.16em; }
.clk-time { font: 400 15px/1.15 var(--serif); color: var(--on-ink); white-space: nowrap; letter-spacing: -0.005em; }
.clk-arc { position: relative; flex: none; width: 76px; height: 18px; align-self: center;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 76 18'%3E%3Cpath d='M3 15 Q38 -5 73 15' fill='none' stroke='%2395a9ab' stroke-width='1.2' stroke-dasharray='1.5 4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.clk-arc::before { content: ""; position: absolute; left: 0; bottom: 1px; width: 1px; height: 7px; background: var(--on-ink-3); }
.clk-arc::after { content: ""; position: absolute; right: -2px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 4px var(--glow-soft), 0 0 14px 2px oklch(0.84 0.135 78 / 0.4); }
.bar-actions { display: flex; align-items: center; gap: 8px; }
.lang { display: inline-flex; border: 1px solid var(--ink-line); background: oklch(0.15 0.025 222 / 0.5); border-radius: 999px; padding: 2px; }
.lang button { border: 0; background: none; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--on-ink-2); transition: color .2s, background-color .25s; }
.lang button:hover { color: var(--on-ink); }
.lang button[aria-pressed="true"] { background: var(--glow); color: var(--ink-950); }

/* =====================================================================
   Shell · layout, persona rail (teal-ink), workspace (paper), side panel
   ===================================================================== */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr) 364px; }
.rail { border-right: 1px solid var(--ink-line); padding: 18px 12px 24px; overflow-y: auto; color: var(--on-ink); scrollbar-color: var(--ink-line) transparent;
  background: radial-gradient(130% 34% at 0% 0%, oklch(0.36 0.055 200 / 0.55), transparent 72%), radial-gradient(90% 26% at 100% 100%, oklch(0.84 0.135 78 / 0.06), transparent 70%), var(--grain-light), var(--ink-900); }
.rail-label { display: flex; align-items: center; gap: 9px; font-size: 10.5px; color: var(--on-ink-3); margin: 0 6px 14px; letter-spacing: 0.16em; }
.rail-label::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 4px var(--glow-soft); }
.rail-group + .rail-group { margin-top: 16px; }
.rail-group-label { display: flex; align-items: center; gap: 10px; font-size: 11.5px; font-weight: 600; color: var(--on-ink-3); margin: 0 6px 6px; letter-spacing: 0.02em; }
.rail-group-label::after { content: ""; flex: 1; height: 1px; background: var(--ink-line); }
.persona { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid transparent; border-radius: 12px; background: none; cursor: pointer; text-align: left; position: relative; color: var(--on-ink);
  transition: background-color .25s, border-color .25s, transform .5s var(--ease); }
.persona:hover { background: oklch(0.26 0.038 212 / 0.85); }
.persona[aria-current="true"] { background: linear-gradient(100deg, oklch(0.84 0.135 78 / 0.1), transparent 60%), oklch(0.285 0.042 210 / 0.9); border-color: var(--ink-line); box-shadow: 0 12px 24px -18px oklch(0.05 0.02 220 / 0.9); }
.persona[aria-current="true"]::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--glow); box-shadow: 0 0 12px 1px oklch(0.84 0.135 78 / 0.55); transform-origin: 50% 50%; }
.persona-text { display: flex; flex-direction: column; min-width: 0; }
.persona-name { font-weight: 600; font-size: 14px; color: var(--on-ink); }
.persona-role { font-size: 12px; color: var(--on-ink-3); line-height: 1.3; }
.persona-badge { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--teal-lt); color: var(--ink-950); display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }

.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; background: var(--accent-wash); color: var(--accent-ink); }
.avatar-team { background: oklch(0.93 0.022 250); color: oklch(0.38 0.05 250); }
.avatar-partner { background: oklch(0.94 0.022 70); color: oklch(0.42 0.06 60); box-shadow: inset 0 0 0 1px oklch(0.8 0.04 70 / 0.45); }
.rail .avatar { background: oklch(0.76 0.085 180 / 0.16); color: oklch(0.86 0.06 180); box-shadow: inset 0 0 0 1px oklch(0.76 0.085 180 / 0.35); }
.rail .avatar-team { background: oklch(0.72 0.06 250 / 0.18); color: oklch(0.87 0.04 250); box-shadow: inset 0 0 0 1px oklch(0.72 0.06 250 / 0.38); }
.rail .avatar-partner { background: oklch(0.8 0.035 70 / 0.13); color: oklch(0.87 0.04 75); box-shadow: inset 0 0 0 1px oklch(0.8 0.035 70 / 0.34); }

.workspace { overflow-y: auto; padding: 0 30px 56px; min-width: 0; }
.ws-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; margin: 0 -30px; padding: 8px 30px;
  background: color-mix(in oklch, var(--paper) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.ws-path { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font: 500 12px/1 var(--mono); letter-spacing: 0.01em; color: var(--muted); background: var(--card); border: 1px solid var(--rule); padding: 7px 12px 7px 10px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-path::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.ws-who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); min-width: 0; }
.ws-who .avatar { width: 26px; height: 26px; font-size: 10.5px; }
.ws-kicker { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); letter-spacing: 0.16em; margin: 26px 0 8px; }
.ws-kicker::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--glow-ink); box-shadow: 0 0 0 4px oklch(0.84 0.135 78 / 0.3); }

.side { border-left: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; background: var(--card); }
.side > .tabs { min-height: 52px; align-items: flex-end; padding: 0 8px; margin: 0; gap: 0; border-bottom: 1px solid var(--ink-line);
  background: radial-gradient(60% 160% at 100% 0%, oklch(0.36 0.055 200 / 0.5), transparent 70%), var(--grain-light), var(--ink-900); }
.side > .tabs .tab { color: var(--on-ink-3); padding: 10px 9px 13px; border-bottom-width: 2px; }
.side > .tabs .tab:hover { color: var(--on-ink); }
.side > .tabs .tab[aria-selected="true"] { color: var(--on-ink); border-bottom-color: var(--glow); background: linear-gradient(0deg, oklch(0.84 0.135 78 / 0.1), transparent 70%); }
.side > .tabs .tab-badge { background: var(--alert-lt); color: var(--ink-950); }
.side-body { flex: 1; overflow-y: auto; padding: 16px; }
.side-intro { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.side-foot { border-top: 1px solid var(--rule); padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 7px; background: var(--paper-2); }
.side-foot-label { font-size: 12px; color: var(--muted); }
.side-foot-actions { display: flex; gap: 8px; }

/* =====================================================================
   Workspace content
   ===================================================================== */
.ws-head { margin-bottom: 20px; }
.ws-title { font-size: 32px; font-weight: 400; letter-spacing: -0.018em; line-height: 1.12; }
html[lang="zh-CN"] .ws-title { font-size: 28px; font-weight: 600; }
.ws-sub { color: var(--ink-2); margin-top: 6px; max-width: 46em; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack > *, .grid-2 > *, .grid-3 > *, .card, .card-body { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.01em; }

/* cards are B's product windows: warm card, hairline edge, long soft shadow */
.card { position: relative; background: var(--card); border: 1px solid var(--edge); border-radius: var(--r); box-shadow: var(--lift); }
.card-tone-accent, .card-accent { border-color: color-mix(in oklch, var(--accent) 34%, var(--edge));
  background: linear-gradient(180deg, oklch(0.955 0.022 180 / 0.55), var(--card) 120px); }
.card-warn { border-color: color-mix(in oklch, var(--warn) 50%, var(--edge)); background: linear-gradient(180deg, oklch(0.96 0.035 88 / 0.6), var(--card) 110px); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px 0; }
.card-title { font-size: 19px; line-height: 1.25; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 12px 20px 18px; }
.card-body > * + * { margin-top: 12px; }

.kv { margin: 0; display: grid; gap: 0; }
.kv-row { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.kv-row:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.row-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; max-width: 55%; }
.row-chips, .row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* chips: dashed = pending or requested, solid = confirmed, hairline = muted, rust = denied */
.chip { --ring: currentColor; position: relative; display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1.4 var(--sans); letter-spacing: 0; text-transform: none; padding: 2px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.chip-confirmed { --ring: var(--c-ok-bg); background: var(--c-ok-bg); color: var(--c-ok-fg); }
.chip-confirmed::before { content: ""; flex: none; width: 7px; height: 4px; margin: 0 1px 2px 0; border: solid currentColor; border-width: 0 0 1.6px 1.6px; transform: rotate(-45deg); }
.chip-pending { border: 1px dashed var(--c-pend); color: var(--c-pend); }
.chip-info { background: var(--c-info-bg); border-color: var(--c-info-b); color: var(--c-info-fg); }
.chip-warn { background: var(--c-warn-bg); border-color: var(--c-warn-b); color: var(--c-warn-fg); }
.chip-denied { background: var(--c-den-bg); border-color: var(--c-den-b); color: var(--c-den-fg); }
.chip-muted { background: transparent; border-color: var(--c-mute-b); color: var(--c-mute-fg); }
.chip-clinical { border-color: var(--c-clin-b); color: var(--c-clin-fg); }
.chip-admin { background: var(--c-adm-bg); border-color: var(--c-adm-b); color: var(--c-adm-fg); }
.chip-demo { border: 1px dashed var(--c-fict-b); color: var(--c-fict-fg); text-transform: uppercase; letter-spacing: 0.07em; font-size: 10.5px; padding: 2px 8px; }

/* buttons: amber pill for the primary action, paper pill otherwise */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px; line-height: 1.3; padding: 9px 16px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .5s var(--ease), background-color .2s, border-color .2s, color .2s, box-shadow .2s; }
.btn:hover:not([disabled]) { transform: translateY(-1px); }
.btn:active:not([disabled]) { transform: translateY(0) scale(0.98); transition-duration: .08s; }
.btn-sm { font-size: 12.5px; padding: 6px 12px; }
.btn-primary { background: var(--glow); border-color: var(--glow-edge); color: var(--ink-950); box-shadow: 0 1px 0 oklch(1 0 0 / 0.4) inset, 0 8px 16px -10px oklch(0.55 0.13 62 / 0.75); }
.btn-primary:hover:not([disabled]) { background: var(--glow-hi); box-shadow: 0 1px 0 oklch(1 0 0 / 0.45) inset, 0 12px 20px -10px oklch(0.55 0.13 62 / 0.8); }
.btn-quiet { background: var(--card); border-color: var(--rule-2); color: var(--ink); }
.btn-quiet:hover:not([disabled]) { border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { background: var(--card); border-color: color-mix(in oklch, var(--alert) 45%, var(--rule)); color: var(--alert); }
.btn-danger:hover:not([disabled]) { background: var(--alert-wash); }
.btn-ghost { background: none; color: var(--accent-ink); padding-left: 4px; padding-right: 4px; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.btn-ghost:hover:not([disabled]) { text-decoration-color: currentColor; transform: none; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
:is(.bar, .next, .tour .probe-result) .btn-quiet { background: oklch(0.15 0.025 222 / 0.35); border-color: var(--ink-line); color: var(--on-ink); }
:is(.bar, .next, .tour .probe-result) .btn-quiet:hover:not([disabled]) { border-color: var(--on-ink-3); color: var(--on-ink); background: oklch(0.3 0.04 211 / 0.6); }
:is(.next, .tour .probe-result) .btn-ghost { color: var(--teal-lt); }

/* next step: the case's one focal point, set in teal-ink with a soft light and an amber "you are here" pip */
.next { position: relative; isolation: isolate; overflow: hidden; color: var(--on-ink); border-radius: var(--r); padding: 18px 20px 20px; display: grid; gap: 6px; align-content: start;
  background: radial-gradient(70% 120% at 100% 0%, oklch(0.36 0.055 200 / 0.75), transparent 70%), radial-gradient(36% 60% at 96% 100%, oklch(0.84 0.135 78 / 0.13), transparent 70%), var(--grain-light), var(--ink-900);
  box-shadow: 0 22px 44px -30px oklch(0.08 0.03 220 / 0.75), 0 6px 14px -10px oklch(0.08 0.03 220 / 0.35); }
.next-label { display: flex; align-items: center; gap: 10px; font-size: 10.5px; letter-spacing: 0.16em; color: var(--on-ink-3); }
.next-label::before { content: ""; position: relative; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 4px var(--glow-soft), 0 0 12px 2px oklch(0.84 0.135 78 / 0.4); }
.next-text { font: 500 19px/1.32 var(--serif); letter-spacing: -0.005em; color: var(--on-ink); max-width: 30em; }
html[lang="zh-CN"] .next-text { font-family: var(--serif-zh); font-weight: 600; font-size: 18px; }
.next-action { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.next .muted { color: var(--on-ink-3); }

.notice { font-size: 13.5px; padding: 10px 14px; border-radius: 12px; border: 1px solid transparent; }
.notice-info { background: var(--paper-2); border-color: var(--rule); color: var(--ink-2); }
.notice-warn { background: var(--warn-wash); border-color: oklch(0.6 0.11 72 / 0.35); color: var(--warn-ink); }
.notice-denied { background: var(--alert-wash); border-color: oklch(0.5 0.13 35 / 0.3); color: var(--alert); }
.notice-ok { background: var(--accent-wash); border-color: oklch(0.47 0.075 185 / 0.25); color: var(--accent-ink); }
.empty { color: var(--muted); font-size: 13.5px; padding: 6px 0; }

/* tabs (light): the current tab carries B's light-context marker, an amber wash with a deep-amber edge */
/* tab strips wrap rather than hide tabs off-edge */
.tabs { display: flex; flex-wrap: wrap; gap: 0; margin: 4px 0 14px; border-bottom: 1px solid var(--rule); }
.tab { border: 0; background: none; padding: 9px 10px 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; border-radius: 8px 8px 0 0;
  transition: color .2s, background-color .25s, border-color .25s; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--glow-ink); background: linear-gradient(0deg, var(--glow-wash), transparent); }
.tab-badge { font-size: 10.5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--alert-wash); color: var(--alert); border: 1px solid oklch(0.5 0.13 35 / 0.3); display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }

.field { display: grid; gap: 5px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.input { width: 100%; border: 1px solid var(--field); background: var(--card); border-radius: 10px; padding: 8px 11px; font-size: 14px; transition: border-color .2s, box-shadow .25s; }
.input:hover { border-color: var(--ink-2); }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px oklch(0.47 0.075 185 / 0.25); }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
textarea.input { resize: vertical; min-height: 64px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 180px; }

/* case progress: B's meter. Done stages teal, the current stage an amber capsule that glows */
.progress { list-style: none; margin: 2px 0; padding: 0; display: flex; align-items: center; gap: 4px; min-height: 10px; }
.progress li { position: relative; flex: 1; height: 4px; border-radius: 2px; background: var(--rule); transform-origin: 0 50%; }
.progress li.done { background: var(--accent); }
.progress li.current { height: 8px; border-radius: 4px; background: var(--glow); box-shadow: inset 0 0 0 1px var(--glow-edge), 0 0 12px oklch(0.84 0.135 78 / 0.55); }
.progress li.current::after { content: ""; position: absolute; inset: -4px; border-radius: 8px; background: oklch(0.84 0.135 78 / 0.35); opacity: 0; pointer-events: none; }

/* case timeline: a dotted track, the latest status lit */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; padding: 7px 0 7px 22px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; border-left: 1px dashed var(--rule-2); }
.timeline li:first-child::before { top: 16px; }
.timeline li:last-child::before { bottom: calc(100% - 16px); }
.timeline li::after { content: ""; position: absolute; left: 0; top: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--accent); }
.timeline li:last-child::after { background: var(--glow); border-color: var(--glow-edge); box-shadow: 0 0 0 4px oklch(0.84 0.135 78 / 0.25); }
.timeline time, .timeline .when { font: 500 12px/1.9 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }

.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.compare thead th { font-family: var(--serif); font-weight: 500; font-size: 17px; border-bottom-color: var(--rule-2); }
html[lang="zh-CN"] .compare thead th { font-family: var(--serif-zh); font-weight: 600; }
.compare tbody th { color: var(--muted); font-weight: 500; font-size: 13px; width: 26%; }
.compare tbody tr:last-child > * { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.thread { display: grid; gap: 10px; }
.thread-people { font-size: 12.5px; color: var(--muted); }
.msgs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.msg { max-width: 85%; padding: 9px 13px; border-radius: 14px 14px 14px 4px; background: var(--paper-2); border: 1px solid var(--rule); display: grid; gap: 3px; }
.msg-me { justify-self: end; background: var(--accent-wash); border-color: oklch(0.47 0.075 185 / 0.2); border-radius: 14px 14px 4px 14px; }
.msg-by { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; }
.msg-form { display: flex; gap: 8px; }

/* behind the scenes: raw projection in a teal-ink code panel */
.json { font: 11.5px/1.6 var(--mono); background: var(--grain-light), var(--ink-950); color: var(--on-ink-2); border: 1px solid var(--ink-line); border-radius: 12px; padding: 14px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.04); }
.json::selection { background: oklch(0.84 0.135 78 / 0.35); color: var(--on-ink); }

/* audit log: a ledger on a dotted track; denied entries carry a rust edge */
.audit { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.audit .chip { white-space: normal; overflow-wrap: anywhere; border-radius: 10px; }
.audit li { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 9px 8px 9px 24px; border-bottom: 1px solid var(--rule); font-size: 12.5px; }
.audit li::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; border-left: 1px dashed var(--rule-2); }
.audit li:first-child::before { top: 16px; }
.audit li:last-child::before { bottom: calc(100% - 16px); }
.audit li::after { content: ""; position: absolute; left: 5px; top: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--accent); }
.audit li.audit-denied::after { background: var(--alert); border-color: var(--alert); box-shadow: 0 0 0 3px var(--alert-wash); }
.audit-time { font: 500 11.5px/1.4 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-who { font-weight: 600; }
.audit-action { font: 500 11px/1.4 var(--mono); background: var(--paper-2); border: 1px solid var(--rule); color: var(--ink-2); padding: 1px 6px; border-radius: 6px; }
.audit-target { color: var(--ink-2); overflow-wrap: anywhere; }
.audit-denied { background: color-mix(in oklch, var(--alert-wash) 65%, transparent); box-shadow: inset 2px 0 0 var(--alert); }

/* outbox: email notifications as envelopes, never with medical detail */
.mail { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mail li { position: relative; border: 1px solid var(--edge); border-radius: 12px; padding: 11px 14px 12px; background: var(--card); box-shadow: 0 10px 22px -20px oklch(0.25 0.03 220 / 0.5); overflow: hidden; }
.mail li::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: repeating-linear-gradient(90deg, var(--accent) 0 14px, transparent 14px 20px, var(--glow) 20px 34px, transparent 34px 40px); opacity: 0.55; }
.mail-to { font: 500 11.5px/1.5 var(--mono); color: var(--muted); }
.mail-subject { font: 500 15.5px/1.35 var(--serif); margin-top: 3px; }
html[lang="zh-CN"] .mail-subject { font-family: var(--serif-zh); font-weight: 600; }
.mail-body { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.mail-trigger { font-size: 11.5px; color: var(--muted); margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--rule); font-style: italic; }

/* guided tour (shared hooks) */
.guide { display: grid; gap: 16px; }
.guide-step { border: 1px solid var(--edge); border-radius: var(--r); padding: 14px; background: var(--card); box-shadow: var(--lift); }
.guide-step h3 { font-size: 17px; margin: 4px 0 6px; }
.guide-step p { font-size: 13.5px; color: var(--ink-2); }
.guide-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.guide-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.guide-list li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; padding: 4px 0; color: var(--ink-2); }
.guide-list li.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--rule); }
.guide-list li.current { color: var(--ink); font-weight: 600; }
.guide-at { font: 600 10.5px/1 var(--mono); letter-spacing: 0.04em; color: var(--accent-ink); background: var(--accent-wash); border: 1px solid oklch(0.47 0.075 185 / 0.18); padding: 3px 6px; border-radius: 6px; flex: none; text-transform: none; }
.probe { display: grid; gap: 7px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.probe:last-child { border-bottom: 0; }
.probe-title { font-size: 13.5px; font-weight: 600; }
.probe-result { font-size: 12.5px; }

/* toasts & background processing: teal-ink glass */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 20; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; position: relative; padding: 12px 16px 12px 40px; border-radius: 14px; font-size: 14px; line-height: 1.45; color: var(--on-ink); border: 1px solid var(--ink-line);
  background: var(--grain-light), oklch(0.205 0.034 218 / 0.97); box-shadow: 0 26px 50px -22px oklch(0.08 0.03 220 / 0.7), 0 8px 18px -12px oklch(0.08 0.03 220 / 0.5); }
.toast::before { content: ""; position: absolute; left: 17px; top: 18px; width: 9px; height: 9px; border-radius: 50%; }
.toast-ok::before { background: var(--teal-lt); box-shadow: 0 0 0 4px oklch(0.76 0.085 180 / 0.2); }
.toast-denied { box-shadow: inset 3px 0 0 var(--alert-lt), 0 26px 50px -22px oklch(0.08 0.03 220 / 0.7), 0 8px 18px -12px oklch(0.08 0.03 220 / 0.5); }
.toast-denied::before { background: var(--alert-lt); box-shadow: 0 0 0 4px oklch(0.72 0.14 38 / 0.22); }
.processing { position: fixed; top: calc(var(--bar-h) + 12px); left: 0; right: 0; margin: 0 auto; width: max-content; max-width: calc(100vw - 32px); z-index: 15; display: flex; align-items: center; gap: 10px;
  padding: 7px 16px 7px 14px; border-radius: 999px; font-size: 13px; color: var(--on-ink-2); border: 1px solid var(--ink-line);
  background: var(--grain-light), oklch(0.205 0.034 218 / 0.96); box-shadow: 0 16px 34px -18px oklch(0.08 0.03 220 / 0.7); }
.processing::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 12px 2px oklch(0.84 0.135 78 / 0.5); }
.processing::after { content: ""; position: absolute; left: 14px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--glow); opacity: 0; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 214px minmax(0, 1fr) 324px; }
  .side > .tabs { padding: 0 8px; }
  .side > .tabs .tab { padding-left: 6px; padding-right: 6px; font-size: 12.5px; gap: 4px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clk-arc { width: 48px; }
}
@media (max-width: 980px) {
  #app { height: auto; }
  .layout { display: block; }
  .rail { border-right: 0; border-bottom: 1px solid var(--ink-line); padding: 10px 12px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .rail-label, .rail-group-label { display: none; }
  .rail-group { display: flex; gap: 6px; }
  .rail-group + .rail-group { margin-top: 0; padding-left: 6px; border-left: 1px solid var(--ink-line); }
  .persona { width: auto; flex: none; padding: 6px 10px 6px 6px; background: oklch(0.24 0.037 214 / 0.8); border-color: var(--ink-line); }
  .persona[aria-current="true"] { border-color: var(--glow); box-shadow: 0 0 0 3px var(--glow-soft); }
  .persona[aria-current="true"]::before { display: none; }
  .persona-role { max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .workspace { overflow: visible; padding: 0 16px 32px; }
  .ws-bar { margin: 0 -16px; padding: 8px 16px; top: 0; }
  .side { border-left: 0; border-top: 1px solid var(--rule); }
  .side-body { max-height: 70vh; }
  .bar-clock { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; }
  .clk-arc { width: 64px; }
  .processing { top: 12px; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .bar { gap: 8px 10px; padding: 10px 14px; }
  .bar-title { display: none; }
  .bar-wm { font-size: 18px; }
  .ws-who span:last-child { display: none; }
  .row { flex-direction: column; }
  .row-side { align-items: flex-start; max-width: 100%; }
  .row-chips, .row-actions { justify-content: flex-start; }
  .kv-row { grid-template-columns: 1fr; gap: 2px; }
  .ws-title { font-size: 26px; }
  html[lang="zh-CN"] .ws-title { font-size: 24px; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  .next-text { font-size: 17.5px; }
}

/* ---------- operations console (js/views/ops.js) ---------- */
.ops .ops-sec { border-top: 1px solid var(--rule); padding-top: 14px; display: grid; gap: 10px; }
.ops .ops-h3 { font-size: 16.5px; }
.ops .ops-label { font-size: 10.5px; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 6px; }
.ops .ops-hint { font-size: 12.5px; color: var(--muted); }
.ops .ops-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ops .ops-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ops .ops-box { border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; background: var(--paper); display: grid; gap: 10px; min-width: 0; }
.ops .ops-box-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.ops .ops-item { display: grid; gap: 6px; min-width: 0; }
.ops .ops-item + .ops-item { border-top: 1px dashed var(--rule-2); padding-top: 10px; margin-top: 4px; }
.ops .ops-quote { border-left: 2px solid var(--rule-2); padding: 2px 0 2px 12px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.ops .ops-quote-clinical { border-left-color: var(--accent); }
.ops .ops-lines { margin: 0; display: grid; }
.ops .ops-lines > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--rule); font-size: 14px; }
.ops .ops-lines dd { margin: 0; font-variant-numeric: tabular-nums; }
.ops .ops-lines > .ops-total { border-bottom: 0; font-weight: 700; padding-top: 8px; }
.ops .ops-facts { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; }
.ops .ops-facts > div { padding-left: 12px; border-left: 1px solid var(--rule); }
.ops .ops-facts > div:first-child { padding-left: 0; border-left: 0; }
.ops .ops-facts dt { font-size: 10px; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 2px; }
.ops .ops-facts dd { margin: 0; font-weight: 600; font-size: 14px; }
.ops .ops-progress { display: grid; gap: 7px; }
.ops .ops-fields { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; }
.ops .ops-fields ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.ops .ops-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ops .ops-meta-lines { display: grid; gap: 1px; }
.ops fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 6px; }
.ops legend { padding: 0; margin-bottom: 4px; }
.ops .row-title, .ops .row-sub { overflow-wrap: anywhere; }
.ops .stack, .ops .ops-sec, .ops .ops-box, .ops .ops-item { grid-template-columns: minmax(0, 1fr); }
.ops .ops-tabs { min-width: 0; }
.ops .ops-tabs > .tabs { margin-top: 0; }
.ops .ops-nw { white-space: nowrap; }
@media (max-width: 640px) {
  .ops .ops-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops .ops-facts > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .ops .ops-fields { grid-template-columns: 1fr; }
}

/* ---------- guided tour (js/tour.js) ---------- */
.tour .tour-h { font-size: 17px; }
.tour .tour-intro { border: 1px solid var(--rule); border-radius: var(--r); padding: 13px 15px 14px; background: var(--paper); display: grid; gap: 8px; }
.tour .tour-intro p { font-size: 13px; color: var(--ink-2); }
.tour .tour-intro-closed { margin: -4px 0 -6px; }
/* the current step reads like one of B's product windows: a mono title strip, then the step */
.tour .tour-step { padding: 14px 16px 16px; overflow: hidden; }
.tour .tour-step .tour-meta { margin: -14px -16px 12px; padding: 9px 16px; background: var(--paper-2); border-bottom: 1px solid var(--rule); font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-2); }
.tour .tour-step-title { font-size: 18px; margin: 4px 0 4px; }
.tour .tour-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; color: var(--muted); }
.tour .tour-who { display: flex; align-items: center; gap: 9px; margin: 10px 0 10px; padding: 7px 10px 7px 7px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); width: fit-content; max-width: 100%; }
.tour .tour-who .avatar { width: 28px; height: 28px; font-size: 10.5px; }
.tour .tour-who-text { display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; min-width: 0; }
.tour .tour-who-text span { color: var(--muted); font-size: 12px; }
.tour .tour-step p + p { margin-top: 10px; }
.tour .tour-rule { padding: 10px 12px 11px; background: var(--accent-wash); border-radius: 10px; color: var(--accent-ink); border: 1px solid oklch(0.47 0.075 185 / 0.18); }
.tour .tour-rule-label { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: 0.14em; margin-bottom: 3px; }
.tour .tour-rule-label::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.tour .tour-note { font-size: 12.5px; color: var(--muted); }
.tour .tour-jump { display: grid; gap: 8px; }
.tour .tour-section { display: grid; gap: 10px; }
.tour .tour-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tour .tour-count { font: 500 11.5px/1.4 var(--mono); color: var(--muted); }
.tour details.tour-group { border-top: 1px solid var(--rule); }
.tour details.tour-group:last-child { border-bottom: 1px solid var(--rule); }
.tour details.tour-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 10px 2px; font-size: 13.5px; font-weight: 600; border-radius: 8px; }
.tour details.tour-group > summary:hover .tour-group-name { color: var(--accent-ink); }
.tour details.tour-group > summary::-webkit-details-marker { display: none; }
.tour details.tour-group > summary::after { content: "+"; margin-left: 4px; color: var(--muted); font-weight: 400; width: 14px; text-align: center; }
.tour details.tour-group[open] > summary::after { content: "\2212"; }
.tour .tour-group-name { flex: 1; min-width: 0; transition: color .2s; }
.tour .tour-group-count { font: 500 11.5px/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.tour .guide-list { padding-bottom: 10px; }
.tour .guide-list li { position: relative; align-items: flex-start; padding: 6px 8px; border-radius: 8px; }
.tour .guide-list li.done { text-decoration: none; }
.tour .guide-list li.done .tour-li-title { text-decoration: line-through; text-decoration-color: color-mix(in oklch, var(--muted) 60%, transparent); }
.tour .guide-list li.current { background: var(--glow-wash); color: var(--ink); box-shadow: inset 2px 0 0 var(--glow-ink); }
.tour .tour-num { flex: none; width: 20px; text-align: right; font: 500 11.5px/1.65 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.tour .guide-list li.done .tour-num { color: var(--accent); }
.tour .guide-list li.current .tour-num { color: var(--glow-ink); font-weight: 700; }
.tour .tour-li-main { display: flex; flex-direction: column; min-width: 0; }
.tour .tour-li-who { font-size: 12px; font-weight: 400; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tour .tour-tag { font-size: 11px; border: 1px dashed var(--rule-2); border-radius: 999px; padding: 0 7px; }
.tour .tour-probes .probe:first-child { padding-top: 4px; }
.tour .tour-probe-head { display: flex; align-items: baseline; gap: 8px; }
.tour h3.probe-title { font-family: var(--sans); font-weight: 600; font-size: 13.5px; line-height: 1.4; }
.tour .tour-probe-desc { font-size: 12.5px; color: var(--ink-2); }
.tour .tour-probe-locked .probe-title, .tour .tour-probe-locked .tour-probe-desc { color: var(--muted); }
.tour .tour-probe-locked .guide-at { background: transparent; color: var(--muted); border-style: dashed; border-color: var(--rule-2); }
.tour .tour-probe-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.tour .tour-probe-why { font-size: 12px; color: var(--muted); flex: 1 1 160px; }
/* a probe's answer comes back from the "server" in a teal-ink panel */
.tour .probe-result { display: grid; gap: 8px; color: var(--on-ink-2); border: 1px solid var(--ink-line); border-radius: 12px; padding: 11px 12px 8px;
  background: radial-gradient(80% 90% at 100% 0%, oklch(0.32 0.05 200 / 0.6), transparent 70%), var(--grain-light), var(--ink-900); box-shadow: 0 16px 30px -24px oklch(0.08 0.03 220 / 0.8); }
.tour .tour-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tour .tour-line { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; line-height: 1.45; }
.tour .tour-line .chip { flex: none; }
.tour .tour-line-text { min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 1px; }
.tour .tour-line-label { font-weight: 600; color: var(--on-ink); }
.tour .tour-line-note { color: var(--on-ink-3); }
.tour .tour-audit { margin: -2px 0 -2px; padding-top: 4px; border-top: 1px solid var(--ink-line); }

/* ---------- partner portal & vendor workspace (js/views/partner.js) ---------- */
.partner .partner-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 12px; }
.partner .partner-meta-text { font-size: 13px; color: var(--muted); }
.partner .partner-h3 { font-size: 16px; margin-top: 18px; }
.partner .partner-note { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.partner .partner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.partner .partner-form { display: grid; gap: 12px; padding-top: 14px; border-top: 1px dashed var(--rule-2); }
.partner .partner-form:first-child { padding-top: 0; border-top: 0; }
.partner .partner-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
.partner .partner-fieldset legend { padding: 0; margin-bottom: 8px; }
.partner .partner-sign { font-size: 13px; padding: 9px 12px; border: 1px solid var(--rule); box-shadow: inset 2px 0 0 var(--accent); background: var(--paper); border-radius: 10px; color: var(--ink-2); }
.partner .partner-resp-text { white-space: pre-wrap; margin: 8px 0 4px; }
.partner .partner-example { font-size: 12px; color: var(--muted); white-space: nowrap; }
.partner .partner-error { color: var(--alert); }
.partner .partner-fixed { background: var(--paper-2); color: var(--ink-2); }
.partner .form-row > .partner-narrow { flex: 0 0 96px; }
.partner .form-row > .btn { flex: none; }
.partner .partner-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.partner .partner-docs li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); }
.partner .partner-tags { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.partner .partner-tags .chip-muted::before { content: ""; flex: none; width: 16px; height: 7px; border-radius: 2px; transform-origin: 0 50%;
  background: repeating-linear-gradient(-45deg, oklch(0.7 0.014 220) 0 2px, oklch(0.88 0.008 220) 2px 4.5px); }
.partner .partner-detail { scroll-margin-top: 64px; }
.partner .card-body > .partner-h3 + * { margin-top: 8px; }

/* ---------- patient portal (js/views/patient.js) ---------- */
.pt-nav .tabs { flex-wrap: wrap; gap: 6px; margin: 0; border-bottom: 0; overflow: visible; }
.pt-nav .tab { margin: 0; padding: 6px 13px; border: 1px solid var(--rule-2); border-radius: 999px; background: var(--card); color: var(--ink-2); }
.pt-nav .tab:hover { border-color: var(--accent); color: var(--accent-ink); }
.pt-nav .tab[aria-selected="true"] { gap: 8px; background: var(--grain-light), var(--ink-900); border-color: var(--ink-900); color: var(--on-ink); box-shadow: 0 8px 16px -12px oklch(0.08 0.03 220 / 0.8); }
.pt-nav .tab[aria-selected="true"]::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 3px var(--glow-soft); }
.pt-nav .tab[aria-selected="true"]:focus-visible { outline-color: var(--glow-ink); }
.pt-summary { align-items: start; }
.pt-tight { gap: 12px; align-content: start; }
.pt-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pt-h3 { font-size: 16.5px; }
.pt-section { display: grid; gap: 8px; }
.pt-section + .pt-section { border-top: 1px solid var(--rule); padding-top: 14px; }
.pt-confirm { display: grid; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--alert-wash); border: 1px solid color-mix(in oklch, var(--alert) 30%, var(--rule)); }
.pt-confirm-calm { background: var(--accent-wash); border-color: color-mix(in oklch, var(--accent) 35%, var(--rule)); }
.pt-confirm > p { font-size: 14px; color: var(--ink); }
.pt-bullets { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.pt-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.pt-steps li::marker { font: 600 12px var(--mono); color: var(--glow-ink); }
.pt-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pt-line { display: block; }
.pt-file { overflow-wrap: anywhere; }
.pt-example { font-size: 12px; color: var(--muted); }
.pt-fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.pt-fieldset > legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.pt-checks { display: grid; gap: 8px; }
.pt-compare { min-width: 560px; }
.pt-compare thead th { vertical-align: bottom; }
.pt-cell { display: grid; gap: 6px; justify-items: start; }
.pt-amount { font: 400 21px/1.2 var(--serif); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.pt-resp { display: grid; gap: 4px; justify-items: start; padding-left: 11px; border-left: 2px solid var(--rule-2); }
.pt-resp-clinical { border-left-color: var(--accent); }
.pt-svc-off .row-title { color: var(--ink-2); }
@media (max-width: 640px) {
  .pt-nav .tab { padding: 5px 11px; font-size: 13px; }
}

/* =====================================================================
   Motion · only when the reader hasn't asked for less. Every element's resting style above is its final
   state, so reduced motion (and anything that misses an animation) gets a complete, still page.
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
  /* persona switch (and first load): the workspace, the guide and the rail marker arrive in reading order */
  .is-entering .workspace :is(.ws-kicker, .ws-head, .pt-nav, .card, .stack > .notice, .stack > .next) { animation: cb-rise .8s var(--ease) both; }
  .is-entering .workspace .ws-head { animation-delay: .04s; }
  .is-entering .workspace :is(.stack, .grid-2, .grid-3) > :nth-child(2) { animation-delay: .08s; }
  .is-entering .workspace :is(.stack, .grid-2, .grid-3) > :nth-child(3) { animation-delay: .13s; }
  .is-entering .workspace :is(.stack, .grid-2, .grid-3) > :nth-child(4) { animation-delay: .18s; }
  .is-entering .workspace :is(.stack, .grid-2, .grid-3) > :nth-child(5) { animation-delay: .23s; }
  .is-entering .workspace :is(.stack, .grid-2, .grid-3) > :nth-child(n+6) { animation-delay: .28s; }
  .is-entering .workspace .ws-bar .ws-who { animation: cb-fade .6s var(--ease) both; }
  .is-entering .side-body > .guide > * { animation: cb-slide .8s var(--ease) both; }
  .is-entering .side-body > .guide > :nth-child(2) { animation-delay: .06s; }
  .is-entering .side-body > .guide > :nth-child(3) { animation-delay: .12s; }
  .is-entering .side-body > .guide > :nth-child(n+4) { animation-delay: .18s; }
  .is-entering .persona[aria-current="true"]::before { animation: cb-mark .7s var(--ease) .05s both; }
  .is-entering .persona[aria-current="true"] .avatar { animation: cb-pop .7s var(--ease) both; }
  .is-entering .bar .clk-arc::after { animation: cb-token 1.4s var(--ease) .2s both; }

  /* the progress meter fills stage by stage, then the current stage breathes three times */
  .is-entering .progress li:is(.done, .current) { animation: cb-fill .7s var(--ease) both; }
  .is-entering .progress li:nth-child(2) { animation-delay: .03s; } .is-entering .progress li:nth-child(3) { animation-delay: .06s; }
  .is-entering .progress li:nth-child(4) { animation-delay: .09s; } .is-entering .progress li:nth-child(5) { animation-delay: .12s; }
  .is-entering .progress li:nth-child(6) { animation-delay: .15s; } .is-entering .progress li:nth-child(7) { animation-delay: .18s; }
  .is-entering .progress li:nth-child(8) { animation-delay: .21s; } .is-entering .progress li:nth-child(9) { animation-delay: .24s; }
  .is-entering .progress li:nth-child(10) { animation-delay: .27s; } .is-entering .progress li:nth-child(n+11) { animation-delay: .3s; }
  .progress li.current::after { animation: cb-breathe 2.6s var(--ease) .5s 3; }
  .timeline li:last-child::after, .audit li.audit-denied:first-child::after { animation: cb-pop .7s var(--ease) both; }
  .is-entering .partner .partner-tags .chip-muted::before { animation: cb-fill .9s var(--ease) .35s both; }
  .is-entering .partner .partner-tags li:nth-child(2) .chip-muted::before { animation-delay: .45s; }
  .is-entering .partner .partner-tags li:nth-child(3) .chip-muted::before { animation-delay: .55s; }
  .is-entering .partner .partner-tags li:nth-child(n+4) .chip-muted::before { animation-delay: .65s; }

  /* a section or side tab that just opened */
  .is-new { animation: cb-rise .6s var(--ease) both; }
  .side-body.is-new > * { animation: cb-slide .6s var(--ease) both; }
  .tour .tour-step.is-new { animation: cb-slide .7s var(--ease) both; }
  .tour .probe-result.is-new { animation: cb-rise .6s var(--ease) both; }
  .tour .probe-result.is-new .tour-line { animation: cb-slide .6s var(--ease) both; }
  .tour .probe-result.is-new .tour-line:nth-child(2) { animation-delay: .08s; }
  .tour .probe-result.is-new .tour-line:nth-child(3) { animation-delay: .16s; }
  .tour .probe-result.is-new .tour-line:nth-child(n+4) { animation-delay: .24s; }

  /* a status that changed in place flips over to its new label, with one ring */
  .chip-flip { animation: cb-flip .75s var(--ease) both; transform-origin: 50% 0; }
  .chip-flip::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; border: 1.5px solid var(--ring); pointer-events: none; animation: cb-ring .9s var(--ease) .3s both; }

  /* toasts and background work */
  .toast { animation: cb-toast .7s var(--ease) both; }
  .toast::before { animation: cb-pop .6s var(--ease) .1s both; }
  .processing { animation: cb-drop .6s var(--ease) both; }
  .processing::after { animation: cb-beacon 1.4s var(--ease) infinite; }
  body.is-processing .bar::after { animation: cb-sweep 1.4s var(--ease) infinite; }
  .tour details.tour-group[open] > .guide-list { animation: cb-fade .5s var(--ease) both; }
}
@keyframes cb-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes cb-slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes cb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cb-mark { from { transform: scaleY(0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cb-pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cb-fill { from { transform: scaleX(0); } to { transform: none; } }
@keyframes cb-breathe { 0% { opacity: 0; transform: scale(0.9, 0.6); } 35% { opacity: 1; } 100% { opacity: 0; transform: scale(1.08, 1.9); } }
@keyframes cb-token { from { transform: translateX(-72px); opacity: 0; } 25% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes cb-flip { from { opacity: 0; transform: perspective(300px) translateY(45%) rotateX(-80deg); } to { opacity: 1; transform: none; } }
@keyframes cb-ring { from { opacity: 0.8; transform: none; } to { opacity: 0; transform: scale(1.14, 1.5); } }
@keyframes cb-toast { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes cb-drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes cb-beacon { from { opacity: 0.55; transform: scale(1); } to { opacity: 0; transform: scale(3.2); } }
@keyframes cb-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:hover:not([disabled]), .btn:active:not([disabled]) { transform: none; }
}
