:root {
  --ink: #0b1220; --ink-2: #1f2937; --muted: #5b6776; --muted-2: #94a3b8;
  --line: #e5e7eb; --line-2: #f1f5f9; --bg: #f6f5f1; --card: #ffffff;
  --accent: oklch(0.55 0.10 195); --accent-2: oklch(0.96 0.02 195);
  --warn-bg: oklch(0.96 0.05 80); --warn-fg: oklch(0.42 0.10 60);
  --crit-bg: oklch(0.95 0.04 25); --crit-fg: oklch(0.45 0.18 25);
  --good-bg: oklch(0.95 0.05 150); --good-fg: oklch(0.42 0.10 150);
  --info-bg: oklch(0.96 0.03 240); --info-fg: oklch(0.42 0.12 240);
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px;
  --t-cap: 12px; --t-body: 13px; --t-lead: 15px; --t-h3: 18px; --t-h2: 24px; --t-h1: 32px;
  --row-h: 40px;
  --gap-1: 4px; --gap-2: 8px; --gap-3: 12px; --gap-4: 16px; --gap-6: 24px; --gap-8: 32px;
}
[data-density="compact"] { --row-h: 32px; --gap-3: 8px; --gap-4: 12px; --gap-6: 18px; --t-body: 12px; --t-cap: 11px; }
[data-org="rakus"] { --accent: oklch(0.45 0.13 290); --accent-2: oklch(0.96 0.03 290); }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: var(--t-body); line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-feature-settings: "kern" 1, "liga" 1; }
button { font: inherit; cursor: pointer; }
.mono { font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace; }
.serif, [style*="Lora"] { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-feature-settings: "kern" 1, "liga" 1, "calt" 1; font-variation-settings: normal; }
input, textarea { font: inherit; }

/* ====== APP CHROME ====== */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: var(--gap-3); padding: 8px 16px; position: sticky; top: 0; z-index: 50; }
[data-topbar="dark"] .topbar { background: #0b1220; color: #f8fafc; border-bottom: 1px solid #1f2937; }
[data-topbar="light"] .topbar { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); }
[data-topbar="minimal"] .topbar { background: var(--bg); color: var(--ink); border-bottom: 1px solid var(--line); }
.wordmark { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.org-chip { font-size: 11px; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.10); }
[data-topbar="light"] .org-chip, [data-topbar="minimal"] .org-chip { background: var(--accent-2); border-color: oklch(0.85 0.05 290); color: var(--accent); }
.app-topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #0b1220; color: #f8fafc; border-bottom: 1px solid #1f2937; }
.app-topbar .wordmark { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.app-topbar .org-chip { font-size: 11px; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.10); color: #f8fafc; }
.app-topbar .nav { display: flex; gap: 2px; margin-left: 8px; }
.app-topbar .nav button { background: transparent; color: #f8fafc; border: 1px solid transparent; padding: 6px 11px; border-radius: 5px; font-size: 12px; opacity: 0.78; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.app-topbar .nav button:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.app-topbar .nav button.active { opacity: 1; background: rgba(255,255,255,0.12); font-weight: 600; }
.app-topbar .tb-btn { background: transparent; color: #f8fafc; border: 1px solid transparent; padding: 5px 10px; border-radius: 5px; font-size: 12px; opacity: 0.85; display: inline-flex; align-items: center; gap: 5px; }
.app-topbar .tb-btn:hover { background: rgba(255,255,255,0.08); opacity: 1; }
.app-topbar .tb-btn.iconbtn { width: 30px; height: 30px; padding: 0; justify-content: center; position: relative; }
.app-topbar .badge-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; background: oklch(0.65 0.18 25); border-radius: 99px; border: 2px solid #0b1220; }
.app-topbar .user-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10); border-radius: 99px; color: #f8fafc; font-size: 12px; }
.app-topbar .user-chip .avatar { width: 24px; height: 24px; border-radius: 99px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.topbar.outer { background: var(--bg); color: var(--ink); border-bottom: 1px solid var(--line); padding: 6px 14px; }
.topbar.outer .wordmark { color: var(--muted); }
.nav button { background: transparent; color: inherit; border: 1px solid transparent; padding: 6px 11px; border-radius: 5px; font-size: 12px; opacity: 0.78; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.nav button:hover { opacity: 1; background: rgba(0,0,0,0.04); }
[data-topbar="dark"] .nav button:hover { background: rgba(255,255,255,0.08); }
.nav button.active { opacity: 1; background: rgba(0,0,0,0.05); font-weight: 600; }
[data-topbar="dark"] .nav button.active { background: rgba(255,255,255,0.10); }
[data-topbar="minimal"] .nav button.active, [data-topbar="light"] .nav button.active { color: var(--accent); background: var(--accent-2); }
.tb-btn { background: transparent; color: inherit; border: 1px solid transparent; padding: 5px 10px; border-radius: 5px; font-size: 12px; opacity: 0.85; display: inline-flex; align-items: center; gap: 5px; }
.tb-btn:hover { opacity: 1; background: rgba(0,0,0,0.04); }
[data-topbar="dark"] .tb-btn:hover { background: rgba(255,255,255,0.08); }
.tb-btn.iconbtn { width: 30px; height: 30px; padding: 0; justify-content: center; position: relative; }
.badge-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; background: oklch(0.65 0.18 25); border-radius: 99px; border: 2px solid var(--bg); }
[data-topbar="dark"] .badge-dot { border-color: #0b1220; }
[data-topbar="light"] .badge-dot { border-color: #fff; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 99px; background: rgba(0,0,0,0.04); font-size: 11px; cursor: pointer; }
[data-topbar="dark"] .user-chip { background: rgba(255,255,255,0.08); }
.avatar { width: 22px; height: 22px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* ====== LAYOUT ====== */
.shell { display: grid; grid-template-columns: 240px 1fr; flex: 1; min-height: 0; }
.shell.no-side { grid-template-columns: 1fr; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; max-height: calc(100vh - 80px); position: sticky; top: 80px; }
.sidebar h4 { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin: 12px 0 4px; padding: 0 4px; }
.sidebar h4:first-child { margin-top: 0; }
.sidenav { display: flex; flex-direction: column; gap: 1px; }
.sidenav button { text-align: left; background: transparent; border: none; padding: 5px 8px; border-radius: 4px; font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; line-height: 1.3; }
.sidenav button:hover { background: var(--line-2); }
.sidenav button.active { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.sidenav .id { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 10px; color: var(--muted-2); width: 32px; flex-shrink: 0; }
.sidenav button.active .id { color: var(--accent); }
.sidenav .dot-state { width: 5px; height: 5px; border-radius: 99px; background: var(--muted-2); flex-shrink: 0; margin-left: auto; }
.sidenav .dot-state.changed { background: oklch(0.70 0.15 60); }
.sidenav button.active .dot-state { background: var(--accent); }
.canvas { padding: 18px; overflow-y: auto; min-width: 0; background: var(--bg); }

/* search filter */
.side-search { padding: 4px; margin-bottom: 6px; }
.side-search input { width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; }

/* ====== SCREEN FRAME ====== */
.frame-wrap { display: flex; flex-direction: column; gap: 12px; max-width: 1100px; }
.frame-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.frame-meta .fid { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); padding: 2px 6px; background: var(--line-2); border-radius: 3px; }
.frame-meta .ftitle { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.frame-meta .fpill { font-size: 10px; padding: 2px 8px; border-radius: 99px; }
.fpill.must { background: var(--accent-2); color: var(--accent); }
.fpill.should { background: var(--warn-bg); color: var(--warn-fg); }
.fpill.review { background: oklch(0.96 0.06 70); color: oklch(0.42 0.13 60); }
.fpill.new { background: var(--good-bg); color: var(--good-fg); }
.fpill.v3new { background: oklch(0.96 0.04 290); color: oklch(0.40 0.13 290); }
.frame { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: 0 1px 2px rgba(11,18,32,0.04), 0 8px 24px rgba(11,18,32,0.04); position: relative; }
.frame-bar { height: 26px; background: #fafafa; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 10px; gap: 5px; }
.frame-bar .fdot { width: 8px; height: 8px; border-radius: 99px; background: #e5e7eb; }
.frame-bar .url { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 10px; color: var(--muted); margin-left: 8px; padding: 1px 8px; background: #fff; border: 1px solid var(--line); border-radius: 99px; }
.flow-strip { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px; background: var(--line-2); border-bottom: 1px solid var(--line); font-size: 11px; }
.flow-strip .flbl { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.05em; align-self: center; margin-right: 4px; }
.flow-chip { padding: 3px 9px; border-radius: 99px; background: #fff; border: 1px solid var(--line); cursor: pointer; font-size: 11px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.flow-chip:hover { border-color: var(--accent); color: var(--accent); }
.flow-chip .fcid { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 10px; color: var(--muted); }
.flow-chip:hover .fcid { color: var(--accent); }
.flow-chip.crisis { color: var(--crit-fg); border-color: oklch(0.85 0.06 25); }
.note-strip { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--warn-bg); font-size: 12px; color: var(--warn-fg); }
.note-strip textarea { width: 100%; min-height: 50px; border: 1px solid oklch(0.80 0.05 60); border-radius: 4px; padding: 6px 8px; font-size: 12px; background: #fff; color: var(--ink-2); }

/* ====== INSIDE-FRAME GENERIC ====== */
.ep-header { padding: 12px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, var(--accent-2)); }
.ep-header .row1 { display: flex; align-items: baseline; gap: 10px; }
.ep-header .name { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 18px; font-weight: 700; }
.ep-header .pid { color: var(--muted); font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
.ep-header .meta { color: var(--muted); font-size: 11px; margin-top: 3px; }
.ep-header .roles { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.role-chip { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 5px; }
.role-chip .lab { color: var(--muted); }
.role-chip.coord { background: var(--accent-2); border-color: oklch(0.85 0.05 195); color: var(--accent); }
.role-chip.phys { background: var(--warn-bg); border-color: oklch(0.85 0.08 70); color: var(--warn-fg); }
.status-dot { width: 7px; height: 7px; border-radius: 99px; display: inline-block; }
.status-dot.active { background: oklch(0.65 0.15 150); }
.status-dot.pending { background: oklch(0.75 0.15 80); }
.status-dot.discharged { background: var(--muted-2); }
.status-dot.locked { background: var(--crit-fg); }

.tabs { display: flex; gap: 0; padding: 0 16px; border-bottom: 1px solid var(--line); background: #fff; flex-wrap: wrap; }
.tabs .group { display: flex; gap: 0; }
.tabs .group + .group { margin-left: auto; opacity: 0.7; }
.tab { background: transparent; border: none; padding: 8px 12px; font-size: 12px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { font-size: 10px; color: var(--muted-2); margin-left: 3px; font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; }

.body { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
h2.section { font-family: 'Inter', sans-serif; font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; margin: 0 0 8px; display: flex; align-items: baseline; gap: 6px; }
h2.section .ct { color: var(--muted-2); font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.card.hover:hover { border-color: var(--accent); cursor: pointer; }
.card .h { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 14px; font-weight: 700; line-height: 1.2; }
.card .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }

.btn { font-size: 12px; padding: 6px 10px; border-radius: 5px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent); color: #fff; opacity: 0.92; }
.btn.danger { background: var(--crit-fg); color: #fff; border-color: var(--crit-fg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 4px 8px; font-size: 11px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line); color: var(--ink-2); }

/* ====== M01 DASHBOARD ====== */
.today-hdr { display: flex; align-items: baseline; gap: 12px; }
.today-hdr .date { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.today-hdr .day { color: var(--muted); font-size: 12px; }
.today-hdr .sum { margin-left: auto; font-size: 11px; color: var(--muted); }
.pickup-rail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pickup { padding: 9px 11px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); border-left: 3px solid var(--accent); cursor: pointer; }
.pickup:hover { border-color: var(--accent); }
.pickup .ago { font-size: 10px; color: var(--muted); }
.pickup .pat { font-weight: 600; margin-top: 1px; font-size: 12px; }
.pickup .sec { font-size: 11px; color: var(--muted); margin-top: 1px; }
.pickup .save { font-size: 10px; color: var(--good-fg); margin-top: 4px; display: inline-flex; align-items: center; gap: 3px; }
.action-queue { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.action-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.action-row:last-child { border-bottom: none; }
.action-row .what { flex: 1; min-width: 0; }
.action-row .what .h { font-weight: 600; font-size: 12px; }
.action-row .what .m { font-size: 11px; color: var(--muted); margin-top: 1px; }
.action-row .actions { display: flex; gap: 4px; }
.patient-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.patient-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; cursor: pointer; }
.patient-card:hover { border-color: var(--accent); }
.patient-card .name { font-family: "'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif"; font-size: 14px; font-weight: 700; }
.patient-card .pk { font-family: "'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace"; font-size: 10px; color: var(--muted); }
.patient-card .meta { font-size: 11px; color: var(--ink-2); margin-top: 5px; }
.patient-card .progress { height: 3px; background: var(--line-2); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.patient-card .progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.patient-card .footer { font-size: 10px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; }

/* ====== M02 PATIENT LIST ====== */
.filterbar { display: flex; gap: 6px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.filterbar input[type="text"] { padding: 5px 9px; border: 1px solid var(--line); border-radius: 5px; min-width: 200px; font-size: 11px; }
.filter-chip { font-size: 11px; padding: 4px 9px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.filter-chip.active { background: var(--accent-2); color: var(--accent); border-color: oklch(0.80 0.05 290); }
.ptable { width: 100%; border-collapse: collapse; font-size: 11px; }
.ptable th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fafafa; }
.ptable td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.ptable tr:hover td { background: #fafafa; cursor: pointer; }
.ptable tr.sel td { background: var(--accent-2); }
.org-tag { font-size: 9px; padding: 2px 6px; border-radius: 3px; font-weight: 600; letter-spacing: 0.03em; }
.org-tag.nrc { background: oklch(0.95 0.04 195); color: oklch(0.40 0.12 195); }
.org-tag.rakus { background: oklch(0.95 0.04 290); color: oklch(0.40 0.12 290); }
.pgr-bar { display: inline-block; width: 50px; height: 3px; background: var(--line-2); border-radius: 99px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.pgr-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ====== E03 PROTOCOL EDITOR ====== */
.proto-shell { display: grid; grid-template-columns: 180px 1fr; min-height: 380px; }
.proto-rail { background: #fafafa; border-right: 1px solid var(--line); padding: 10px 8px; }
.proto-rail .grouplabel { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 4px 6px; }
.proto-section { padding: 6px 8px; border-radius: 5px; margin-bottom: 1px; cursor: pointer; font-size: 11px; border-left: 3px solid transparent; }
.proto-section:hover { background: rgba(0,0,0,0.03); }
.proto-section.active { background: #fff; border-left-color: var(--accent); box-shadow: 0 1px 2px rgba(11,18,32,0.04); }
.proto-section .nm { font-weight: 600; }
.proto-section .by { color: var(--muted); font-size: 10px; margin-top: 1px; display: flex; justify-content: space-between; align-items: center; }
.proto-section .by .ro { font-size: 8px; padding: 1px 4px; background: var(--line-2); border-radius: 3px; color: var(--muted); font-weight: 700; }
.proto-section.locked { background: var(--crit-bg); }
.proto-section.locked .nm { color: var(--crit-fg); }
.proto-canvas { padding: 12px 16px; overflow-x: auto; }
.proto-canvas .canvashdr { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.proto-canvas .ttl { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 16px; font-weight: 700; }
.proto-canvas .saveind { font-size: 10px; color: var(--good-fg); display: inline-flex; align-items: center; gap: 4px; }
.longi { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.longi th { font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 600; }
.longi th.tp { text-align: center; width: 80px; }
.longi th.tp.active { color: var(--accent); }
.longi td { padding: 8px; border-bottom: 1px solid var(--line-2); }
.longi td.code { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-weight: 600; color: var(--accent); font-size: 11px; }
.longi td.label { color: var(--ink-2); }
.longi td.cell { text-align: center; font-weight: 600; }
.longi td.cell.active-tp { background: var(--accent-2); border-radius: 4px; }
.longi td.trend { color: var(--good-fg); font-weight: 600; font-size: 10px; }
.longi tr.add-row td { color: var(--muted); cursor: pointer; padding: 10px 8px; }
.longi tr.add-row td:hover { color: var(--accent); }
.qual-input { display: inline-flex; gap: 1px; }
.qual-input span { width: 18px; height: 18px; border-radius: 3px; font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; background: var(--line-2); color: var(--muted); cursor: pointer; }
.qual-input span:hover { background: var(--line); }
.qual-input span.sel { background: var(--accent); color: #fff; }

/* ====== E11 STEPPER ====== */
.stepper { display: flex; gap: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.step { flex: 1; display: flex; align-items: center; gap: 8px; position: relative; }
.step::after { content: ''; position: absolute; right: 0; top: 50%; width: 16px; height: 1px; background: var(--line); }
.step:last-child::after { display: none; }
.step .num { width: 22px; height: 22px; border-radius: 99px; background: var(--line-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; }
.step.done .num { background: var(--good-bg); color: var(--good-fg); }
.step.active .num { background: var(--accent); color: #fff; }
.step .lbl { font-size: 11px; font-weight: 500; color: var(--muted); }
.step.active .lbl, .step.done .lbl { color: var(--ink); font-weight: 600; }
.checklist { display: flex; flex-direction: column; gap: 5px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 5px; }
.check-row.done { background: var(--good-bg); border-color: oklch(0.85 0.06 150); }
.check-row.todo { background: var(--crit-bg); border-color: oklch(0.85 0.06 25); }
.check-row .lab { flex: 1; }
.check-row .lab .h { font-weight: 600; font-size: 12px; }
.check-row .lab .m { font-size: 11px; color: var(--muted); margin-top: 1px; }
.check-icon { width: 18px; height: 18px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.check-icon.done { background: var(--good-fg); color: #fff; }
.check-icon.todo { background: var(--crit-fg); color: #fff; }

/* ====== Composite/segments/chips ====== */
.qual-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qual-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; }
.qual-card .lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.qual-card .val { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 18px; font-weight: 700; margin-top: 3px; }
.qual-card .sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.vas-track { height: 6px; background: linear-gradient(90deg, var(--good-bg), var(--warn-bg), var(--crit-bg)); border-radius: 99px; margin-top: 10px; position: relative; }
.vas-track .knob { position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 99px; background: var(--accent); border: 2px solid #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.seg { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.seg button { background: #fff; border: none; padding: 5px 9px; font-size: 10px; color: var(--muted); border-right: 1px solid var(--line); cursor: pointer; }
.seg button:last-child { border-right: none; }
.seg button.sel { background: var(--accent); color: #fff; font-weight: 600; }
.chip-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 10px; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.chip.sel { background: var(--accent-2); border-color: oklch(0.80 0.05 290); color: var(--accent); font-weight: 600; }

/* ====== Lock card ====== */
.lock-card { background: var(--warn-bg); border: 1px solid oklch(0.85 0.08 70); border-left: 3px solid var(--warn-fg); border-radius: var(--r-md); padding: 12px 14px; }
.lock-card .h { font-weight: 700; color: var(--warn-fg); display: flex; align-items: center; gap: 6px; font-size: 13px; }
.lock-card .actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ====== Thread ====== */
.thread-entry { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 6px; }
.thread-entry .who { display: flex; align-items: center; gap: 8px; }
.thread-entry .who .avatar { width: 24px; height: 24px; font-size: 10px; }
.thread-entry .who .name { font-weight: 600; font-size: 12px; }
.thread-entry .who .when { color: var(--muted); font-size: 10px; margin-left: auto; }
.thread-entry .body { margin-top: 6px; font-size: 12px; color: var(--ink-2); padding: 0; }
.thread-entry.locked { background: var(--good-bg); border-color: oklch(0.85 0.06 150); }

/* ====== Auth ====== */
.auth-shell { background: var(--bg); padding: 40px 16px; min-height: 480px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-org { display: flex; align-items: center; gap: 10px; padding: 6px 14px; background: #fff; border: 1px solid var(--line); border-radius: 99px; font-size: 11px; line-height: 1.3; }
.auth-org .logo { width: 22px; height: 22px; border-radius: 5px; background: var(--accent); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; }
.auth-card { width: 340px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 22px; box-shadow: 0 1px 2px rgba(11,18,32,0.04), 0 8px 24px rgba(11,18,32,0.04); }
.auth-card h1 { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 20px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.auth-card p.sub { color: var(--muted); font-size: 12px; margin: 0 0 16px; }
.field { margin-bottom: 10px; }
.field label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.field input { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; margin-top: 3px; font-size: 12px; }
.otp-grid { display: flex; gap: 5px; justify-content: space-between; }
.otp-grid .box { width: 38px; height: 42px; border: 1px solid var(--line); border-radius: 5px; font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 16px; text-align: center; background: #fff; }
.otp-grid .box.filled { border-color: var(--accent); background: var(--accent-2); }
.otp-single { display: flex; flex-direction: column; gap: 5px; }
.otp-input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 22px; text-align: center; letter-spacing: 0.4em; background: var(--accent-2); color: var(--accent); font-weight: 700; }
.otp-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.otp-hint { font-size: 10px; color: var(--muted); text-align: center; }

/* ====== M03 hero ====== */
.active-ep-hero { background: linear-gradient(135deg, var(--accent-2), #fff); border: 1px solid oklch(0.85 0.05 290); border-radius: var(--r-lg); padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.active-ep-hero .icon { width: 44px; height: 44px; border-radius: 10px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.active-ep-hero .body { flex: 1; min-width: 0; }
.active-ep-hero .lab { font-size: 10px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.active-ep-hero .ttl { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 18px; font-weight: 700; margin-top: 2px; }
.active-ep-hero .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.active-ep-hero .progress { height: 4px; background: rgba(0,0,0,0.06); border-radius: 99px; margin-top: 8px; overflow: hidden; max-width: 240px; }
.active-ep-hero .progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ====== Roles overflow ====== */
.role-more { font-size: 10px; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); border: 1px dashed var(--line); cursor: pointer; }
.role-more:hover { background: var(--accent-2); color: var(--accent); border-color: oklch(0.85 0.05 290); border-style: solid; }
.role-add { background: transparent; border-style: dashed; color: var(--muted); margin-left: auto; }

/* ====== E03 active TP emphasis ====== */
.longi th.tp.active, .longi td.cell.active-tp { box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }
.longi th.tp.active { background: var(--accent-2); border-bottom: 2px solid var(--accent); padding-top: 8px; padding-bottom: 8px; font-weight: 700; }
.longi tr:hover td.label { color: var(--accent); }
.longi tr.icf-row { position: relative; }
.icf-tip { position: absolute; left: 100px; top: -4px; background: #0b1220; color: #fff; padding: 6px 10px; border-radius: 5px; font-size: 11px; line-height: 1.4; max-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,0.25); z-index: 30; pointer-events: none; }
.icf-tip::before { content: ''; position: absolute; left: -5px; top: 10px; border: 5px solid transparent; border-right-color: #0b1220; }
.icf-tip .ttl { font-weight: 700; margin-bottom: 2px; }
.icf-tip .desc { color: #cbd5e1; font-size: 10px; }

/* ====== Qualifier 44px touch targets ====== */
.qual-input.lg { gap: 4px; }
.qual-input.lg span { width: 44px; height: 44px; border-radius: 6px; font-size: 14px; font-weight: 700; }

/* ====== Presence avatars ====== */
.presence { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 4px; border-radius: 99px; background: var(--good-bg); border: 1px solid oklch(0.85 0.06 150); font-size: 10px; color: var(--good-fg); font-weight: 600; }
.presence-stack { display: inline-flex; }
.presence-stack .avatar { width: 18px; height: 18px; font-size: 9px; border: 2px solid var(--good-bg); margin-left: -6px; }
.presence-stack .avatar:first-child { margin-left: 0; }
.presence .live-dot { width: 6px; height: 6px; border-radius: 99px; background: oklch(0.65 0.15 150); animation: livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ====== M06 expanded action queue ====== */
.action-row.expanded { background: var(--accent-2); border-left: 3px solid var(--accent); padding-left: 9px; }
.action-row .ctx { padding: 8px 12px 10px 28px; font-size: 11px; color: var(--ink-2); background: #fafafa; border-top: 1px dashed var(--line); }
.action-row .ctx .quote { font-style: italic; color: var(--muted); border-left: 2px solid var(--line); padding-left: 8px; margin: 4px 0; }

/* ====== E11 discharge gravitas ====== */
.sign-card { background: linear-gradient(180deg, #0b1220, #1f2937); color: #fff; border-radius: var(--r-lg); padding: 22px 24px; box-shadow: 0 12px 32px rgba(11,18,32,0.20); }
.sign-card .seal { display: inline-flex; align-items: center; gap: 6px; font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-style: italic; font-size: 11px; color: oklch(0.85 0.06 80); border: 1px solid oklch(0.85 0.06 80); padding: 4px 10px; border-radius: 99px; }
.sign-card h2 { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 24px; font-weight: 700; margin: 8px 0 4px; letter-spacing: -0.01em; }
.sign-card .lede { font-size: 13px; color: #cbd5e1; max-width: 56ch; }
.sign-card .warn-line { display: flex; align-items: center; gap: 6px; margin-top: 14px; padding: 8px 12px; background: oklch(0.30 0.08 25); border: 1px solid oklch(0.45 0.18 25); border-radius: 6px; font-size: 11px; color: oklch(0.90 0.04 25); }
.sign-card .typed { width: 100%; padding: 10px 14px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.20); border-radius: 6px; font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-style: italic; font-size: 18px; color: #fff; margin-top: 12px; }
.sign-card .typed::placeholder { color: rgba(255,255,255,0.35); }
.sign-card .sign-cta { width: 100%; margin-top: 14px; padding: 14px 18px; background: oklch(0.55 0.18 25); color: #fff; border: none; border-radius: 8px; font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 15px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; }
.sign-card .sign-cta:hover { background: oklch(0.50 0.18 25); }
.sign-card .meta { display: flex; gap: 16px; margin-top: 12px; font-size: 10px; color: #94a3b8; }

/* ====== Cross-tenant read-only ====== */
.banner.readonly { background: oklch(0.95 0.04 195); color: oklch(0.30 0.10 195); border-left: 3px solid oklch(0.45 0.13 195); }
.readonly-shell input, .readonly-shell textarea, .readonly-shell .qual-input span, .readonly-shell .btn.primary { opacity: 0.5; pointer-events: none; }
.readonly-shell .qual-input span.sel { opacity: 0.7; }

/* ====== E08 daily agenda ====== */
.agenda { display: grid; grid-template-columns: 60px 1fr; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.agenda .hours { background: #fafafa; border-right: 1px solid var(--line); }
.agenda .hour-cell { height: 56px; padding: 4px 8px; font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; border-bottom: 1px solid var(--line-2); }
.agenda .lane { position: relative; min-height: 540px; background: repeating-linear-gradient(180deg, #fff 0 56px, var(--line-2) 56px 57px); }
.agenda .session-block { position: absolute; left: 6px; right: 6px; padding: 6px 10px; border-radius: 5px; border-left: 3px solid var(--accent); background: var(--accent-2); font-size: 11px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.agenda .session-block.ft { border-left-color: oklch(0.55 0.13 195); background: oklch(0.96 0.03 195); }
.agenda .session-block.et { border-left-color: oklch(0.55 0.13 80); background: oklch(0.96 0.04 80); }
.agenda .session-block.log { border-left-color: oklch(0.55 0.13 290); background: oklch(0.96 0.03 290); }
.agenda .session-block.md { border-left-color: oklch(0.55 0.18 25); background: oklch(0.95 0.04 25); }
.agenda .session-block .pat { font-weight: 700; }
.agenda .session-block .sub { font-size: 10px; color: var(--muted); margin-top: 1px; }
.agenda .session-block.gap { border-left: 3px dashed var(--muted-2); background: var(--line-2); color: var(--muted); }

/* ====== E02 Gantt-lite timeline ====== */
.gantt { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.gantt .head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.gantt .scale { display: grid; grid-template-columns: 60px 1fr; gap: 0; }
.gantt .lane-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; padding: 6px 0; display: flex; align-items: center; }
.gantt .lane { position: relative; height: 28px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.gantt .lane.axis { background: transparent; height: 22px; border-bottom: 1px solid var(--line); }
.gantt .day-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,0.04); }
.gantt .day-label { position: absolute; top: 2px; font-size: 9px; color: var(--muted); font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; transform: translateX(-50%); }
.gantt .phase { position: absolute; top: 4px; bottom: 4px; padding: 0 8px; display: flex; align-items: center; font-size: 11px; font-weight: 600; color: #fff; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.gantt .phase.done { background: oklch(0.55 0.10 150); }
.gantt .phase.active { background: var(--accent); }
.gantt .phase.future { background: var(--muted-2); }
.gantt .marker { position: absolute; top: -2px; width: 14px; height: 14px; border-radius: 99px; transform: translateX(-50%); display: inline-flex; align-items: center; justify-content: center; font-size: 9px; color: #fff; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.gantt .marker.adm { background: oklch(0.55 0.13 150); }
.gantt .marker.eval { background: oklch(0.55 0.13 80); }
.gantt .marker.meet { background: var(--accent); }
.gantt .marker.disc { background: oklch(0.55 0.18 25); }
.gantt .today { position: absolute; top: -8px; bottom: -4px; width: 2px; background: var(--crit-fg); z-index: 5; }
.gantt .today::before { content: 'šodien'; position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--crit-fg); font-weight: 700; padding: 1px 5px; background: #fff; border: 1px solid var(--crit-fg); border-radius: 99px; white-space: nowrap; }
.gantt .legend { display: flex; gap: 12px; font-size: 10px; color: var(--muted); margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.gantt .legend .li { display: inline-flex; align-items: center; gap: 4px; }
.gantt .legend .sw { width: 10px; height: 10px; border-radius: 99px; }

/* ====== States ====== */
.estate { padding: 36px 16px; text-align: center; color: var(--muted); }
.estate .glyph { width: 48px; height: 48px; border-radius: 99px; background: var(--line-2); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.estate h3 { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 16px; font-weight: 700; color: var(--ink-2); margin: 0 0 4px; }
.estate p { margin: 0 0 12px; font-size: 12px; }
.skeleton { background: linear-gradient(90deg, var(--line-2) 0%, #fff 50%, var(--line-2) 100%); background-size: 200% 100%; animation: shim 1.4s ease-in-out infinite; border-radius: 4px; }
@keyframes shim { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ====== Toast ====== */
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #0b1220; color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 200; display: inline-flex; align-items: center; gap: 8px; animation: toastin 0.2s ease-out; }
@keyframes toastin { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ====== Tweaks ====== */
.tweaks { position: fixed; bottom: 12px; right: 12px; z-index: 100; width: 250px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 8px 32px rgba(11,18,32,0.16); overflow: hidden; font-size: 11px; }
.tweaks header { padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; background: #fafafa; }
.tweaks header h4 { margin: 0; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.tweaks .body { padding: 10px 12px; }
.tweaks .group { margin-bottom: 9px; }
.tweaks .group:last-child { margin-bottom: 0; }
.tweaks .label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 3px; }
.tweaks .opts { display: flex; gap: 3px; }
.tweaks .opts button { flex: 1; padding: 4px 6px; border: 1px solid var(--line); background: #fff; border-radius: 4px; font-size: 10px; color: var(--ink-2); }
.tweaks .opts button.sel { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.tweaks .opts.col { flex-direction: column; }
.tweaks-fab { position: fixed; bottom: 12px; right: 12px; z-index: 99; width: 36px; height: 36px; border-radius: 99px; background: var(--ink); color: #fff; border: none; box-shadow: 0 4px 12px rgba(0,0,0,0.2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* Focus mode / Clinician view — hide all wireflow chrome */
.focus-mode .sidebar { display: none; }
.focus-mode .shell { grid-template-columns: 1fr; }
.focus-mode .canvas { padding: 8px; }
.focus-mode .frame-meta { display: none; }
.focus-mode .frame-bar { display: none; }
.focus-mode .frame { border-radius: 0; border: none; box-shadow: none; }
.focus-mode .canvas { padding: 0; background: #fff; }
.focus-mode .topbar.outer .wordmark { display: none; }

/* ====== EpHeader compact (v3 — single 56px band) ====== */
.ep-header.compact { padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; min-height: 56px; flex-wrap: wrap; row-gap: 6px; }
.ep-header.compact .name-block { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 320px; }
.ep-header.compact .avatar-md { width: 36px; height: 36px; border-radius: 99px; background: var(--accent); color: #fff; font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ep-header.compact .name-block { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ep-header.compact .name-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ep-header.compact .name-line .pname { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 16px; font-weight: 700; line-height: 1.2; }
.ep-header.compact .meta-line { font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ep-header.compact .meta-line .sep { color: var(--muted-2); }
.ep-header.compact .phase-progress { flex: 1; max-width: 220px; display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.ep-header.compact .phase-progress .label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; }
.ep-header.compact .phase-progress .bar { height: 4px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.ep-header.compact .phase-progress .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.ep-header.compact .role-stack { display: inline-flex; align-items: center; padding: 3px 9px 3px 4px; background: var(--line-2); border-radius: 99px; cursor: pointer; font-size: 11px; color: var(--ink-2); }
.ep-header.compact .role-stack:hover { background: var(--accent-2); color: var(--accent); }
.ep-header.compact .role-stack .avatars { display: inline-flex; margin-right: 6px; }
.ep-header.compact .role-stack .avatars .avatar { width: 20px; height: 20px; font-size: 9px; border: 2px solid #fff; margin-left: -6px; }
.ep-header.compact .role-stack .avatars .avatar:first-child { margin-left: 0; }
.ep-header.compact .allergy-pill { font-size: 10px; padding: 2px 8px; border-radius: 99px; background: var(--crit-bg); color: var(--crit-fg); border: 1px solid oklch(0.85 0.06 25); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* Role popover (compact header) */
.role-popover { position: absolute; top: calc(100% + 4px); right: 0; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; box-shadow: 0 10px 28px rgba(11,18,32,0.16); z-index: 30; display: flex; flex-direction: column; gap: 4px; }
.role-popover .role-h { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; padding: 4px 8px 2px; }
.role-popover .role-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px; font-size: 12px; }
.role-popover .role-row:hover { background: var(--line-2); }
.role-popover .role-row .avatar { width: 22px; height: 22px; font-size: 10px; }
.role-popover .role-row .lab { color: var(--muted); font-size: 10px; }

/* ====== Slide-over panel (v3 — replaces wide modal). Absolute, scoped to frame. ====== */
.slideover-backdrop { position: absolute; inset: 0; background: rgba(11,18,32,0.35); z-index: 50; display: flex; justify-content: flex-end; min-height: 600px; }
.slideover { width: 72%; min-width: 0; background: #fff; height: 100%; min-height: 600px; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,0.15); animation: slideIn 0.16s ease-out; overflow: hidden; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.slideover header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.slideover header h3 { margin: 0; font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 18px; font-weight: 700; }
.slideover .body { flex: 1; overflow-y: auto; padding: 0; min-height: 0; }
.slideover footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #fafafa; }

/* ====== Status dot — colorblind-safe variant w/ inline shape ====== */
.sdot { display: inline-flex; width: 14px; height: 14px; align-items: center; justify-content: center; flex-shrink: 0; font-size: 9px; font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }
.sdot.active { color: oklch(0.42 0.10 150); }
.sdot.active::before { content: '●'; }
.sdot.pending { color: oklch(0.55 0.13 80); }
.sdot.pending::before { content: '◆'; }
.sdot.locked { color: var(--crit-fg); }
.sdot.locked::before { content: '■'; }
.sdot.discharged { color: var(--muted-2); }
.sdot.discharged::before { content: '○'; }

/* ====== Permission risk classes (v3 — A03e) ====== */
.perm-cell { display: inline-flex; align-items: center; justify-content: center; min-width: 60px; height: 24px; border-radius: 4px; font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 11px; font-weight: 700; }
.perm-cell.read { background: var(--line-2); color: var(--ink-2); }
.perm-cell.edit { background: var(--info-bg); color: var(--info-fg); }
.perm-cell.elevated { background: var(--warn-bg); color: var(--warn-fg); }
.perm-cell.dangerous { background: var(--crit-bg); color: var(--crit-fg); }
.perm-cell.none { background: transparent; color: var(--muted-2); }
.risk-legend { display: flex; gap: 12px; font-size: 10px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.risk-legend .li { display: inline-flex; align-items: center; gap: 4px; }
.risk-legend .sw { width: 12px; height: 12px; border-radius: 3px; }

/* ====== NVD queue (v3 — A05q) ====== */
.queue-row { display: grid; grid-template-columns: 90px 1fr 100px 90px 120px 100px; gap: 12px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 6px; align-items: center; font-size: 12px; }
.queue-row + .queue-row { margin-top: 6px; }
.queue-row.failed { border-left: 3px solid var(--crit-fg); }
.queue-row.retry { border-left: 3px solid var(--warn-fg); }
.queue-row.ok { border-left: 3px solid var(--good-fg); }
.queue-row .qid { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 10px; color: var(--muted); }
.queue-row .qstate { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 99px; }
.queue-row .qstate.failed { background: var(--crit-bg); color: var(--crit-fg); }
.queue-row .qstate.retry { background: var(--warn-bg); color: var(--warn-fg); }
.queue-row .qstate.ok { background: var(--good-bg); color: var(--good-fg); }
.queue-row .qstate.pending { background: var(--info-bg); color: var(--info-fg); }

/* ====== Audit failed-auth highlight (v3 — A04) ====== */
.ptable tr.failed-auth td { background: oklch(0.98 0.02 25); }
.ptable tr.failed-auth td:first-child { border-left: 3px solid var(--crit-fg); }
.ptable tr.failed-auth .mono { color: var(--crit-fg); font-weight: 600; }

/* ====== Inactivity timeout banner (U17) ====== */
.timeout-modal { width: 380px; background: #fff; border-radius: var(--r-lg); padding: 22px 24px; text-align: center; }
.timeout-modal .countdown { font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 48px; font-weight: 700; color: var(--crit-fg); line-height: 1; margin: 14px 0; }
.timeout-modal .countdown .unit { font-size: 14px; color: var(--muted); font-family: 'Inter'; font-weight: 600; margin-left: 4px; vertical-align: super; }

/* ====== M03 patient header allergy pill ====== */
.allergy-pill-lg { font-size: 11px; padding: 3px 10px; border-radius: 99px; background: var(--crit-bg); color: var(--crit-fg); border: 1px solid oklch(0.85 0.06 25); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.allergy-pill-lg.empty { background: var(--line-2); color: var(--muted); border-color: var(--line); font-weight: 500; }

/* ====== Coordinator schedule (SC01) ====== */
.sched-grid { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.sched-header { display: grid; grid-template-columns: 140px repeat(5, 1fr); background: #fafafa; border-bottom: 1px solid var(--line); }
.sched-header .day-cell { padding: 8px 10px; text-align: center; font-size: 11px; font-weight: 600; border-left: 1px solid var(--line); }
.sched-header .day-cell:first-child { border-left: none; text-align: left; color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em; }
.sched-header .day-cell .date { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 10px; color: var(--muted); margin-top: 2px; }
.sched-row { display: grid; grid-template-columns: 140px repeat(5, 1fr); border-bottom: 1px solid var(--line-2); }
.sched-row:last-child { border-bottom: none; }
.sched-row .who { padding: 10px 12px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sched-row .who .role { font-size: 9px; padding: 1px 6px; background: var(--line-2); border-radius: 99px; color: var(--muted); }
.sched-row .cap-cell { border-left: 1px solid var(--line-2); padding: 6px; position: relative; min-height: 56px; }
.cap-fill { display: flex; flex-direction: column; gap: 2px; height: 100%; }
.cap-fill .fill-bar { height: 6px; background: var(--accent); border-radius: 99px; opacity: 0.7; }
.cap-fill .fill-bar.over { background: var(--crit-fg); opacity: 1; }
.cap-fill .fill-label { font-size: 9px; color: var(--muted); font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; }
.cap-fill .fill-label.over { color: var(--crit-fg); font-weight: 700; }

/* ====== Referral inbox (R01) ====== */
.referral-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.referral-card.urgent { border-left: 3px solid var(--crit-fg); }
.referral-card .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.referral-card .source-chip { font-size: 10px; padding: 2px 7px; border-radius: 3px; background: var(--accent-2); color: var(--accent); font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; }
.referral-card .actions { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }

/* ====== Qualifier 8/9 (not specified / not applicable) ====== */
.qual-input.with-na { display: inline-flex; gap: 1px; align-items: center; }
.qual-input.with-na .sep { color: var(--muted-2); font-size: 10px; margin: 0 4px; }
.qual-input.with-na .na { background: oklch(0.94 0.01 290); color: var(--muted); font-size: 9px; }
.qual-input.with-na .na.sel { background: var(--muted-2); color: #fff; }
.qual-input.lg.with-na .na { width: 38px; height: 44px; font-size: 11px; font-weight: 600; }

/* Print */
@media print { .topbar, .sidebar, .tweaks, .tweaks-fab, .frame-bar, .flow-strip { display: none !important; } .canvas { padding: 0; } .frame { box-shadow: none; border: none; } .frame-meta { padding: 16px 0; } body { background: #fff; } }

.ico { width: 14px; height: 14px; flex-shrink: 0; display: inline-block; }
.ico.lg { width: 18px; height: 18px; }

/* Banner */
.banner { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 6px; font-size: 11px; }
.banner.info { background: var(--info-bg); color: var(--info-fg); border-left: 3px solid var(--info-fg); }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); border-left: 3px solid var(--warn-fg); }
.banner.crit { background: var(--crit-bg); color: var(--crit-fg); border-left: 3px solid var(--crit-fg); }
.banner.good { background: var(--good-bg); color: var(--good-fg); border-left: 3px solid var(--good-fg); }
.banner b { color: inherit; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11,18,32,0.4); z-index: 150; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: var(--r-lg); width: 480px; max-width: 90vw; max-height: 80vh; overflow: hidden; display: flex; flex-direction: column; }
.modal header { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h3 { margin: 0; font-family: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; font-size: 16px; }
.modal .body { flex: 1; overflow-y: auto; }
.modal footer { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 6px; justify-content: flex-end; }

/* ====== Wireflow chrome: persona selector ====== */
.persona-sel { position: relative; display: inline-flex; }
.tb-btn.persona-trigger { gap: 6px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 99px; background: #fff; opacity: 1; }
.tb-btn.persona-trigger:hover { background: var(--accent-2); border-color: var(--accent); }
.persona-av { width: 22px; height: 22px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.persona-trigger .caret { font-size: 9px; color: var(--muted); margin-left: 2px; }
.persona-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; box-shadow: 0 12px 28px rgba(11,18,32,0.16); z-index: 80; display: flex; flex-direction: column; gap: 1px; }
.persona-menu-h { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; padding: 6px 8px 4px; }
.persona-menu button { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: transparent; border: none; border-radius: 5px; font-size: 12px; color: var(--ink-2); cursor: pointer; text-align: left; }
.persona-menu button:hover { background: var(--line-2); }
.persona-menu button.sel { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.persona-menu button.sel .persona-av { background: var(--accent); }

/* ====== Flow-strip — moved OUT of frame; now wireflow meta ====== */
.flow-strip { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 12px; background: transparent; border: 1px dashed var(--line); border-radius: 6px; font-size: 11px; align-items: center; }
.flow-strip .flbl { color: var(--muted); text-transform: uppercase; font-size: 9px; letter-spacing: 0.06em; font-weight: 700; margin-right: 4px; flex-shrink: 0; }
.flow-strip .flow-chip { background: #fff; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-strip::before { content: 'wireflow'; font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); font-weight: 700; padding-right: 8px; border-right: 1px solid var(--line); margin-right: 4px; align-self: center; }

/* Hide outer flow-strip in focus mode */
.focus-mode .flow-strip { display: none !important; }
