/* Remedy Caseflow demo — palette taken from the original console:
   dark navy shell, light "paper" work surfaces with navy borders. */
:root {
  --shell: #0d1321;
  --aside: #1a2035;
  --bg: #141824;
  --line-dark: #1e293b;
  --line-dark-2: #334155;
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --text-3: #94a3b8;
  --text-4: #64748b;
  --paper: #cbd5e1;
  --paper-2: #e2e8f0;
  --paper-3: #f1f5f9;
  --navy: #1e3a5f;
  --ink: #0a2342;
  --ink-2: #15314f;
  --ink-3: #2c4f73;
  --ink-4: #3f6690;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --blue-ink: #1e40af;
  --blue-soft: #dbeafe;
  --green: #059669;
  --green-dark: #065f46;
  --green-soft: #d1fae5;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --amber-line: #fcd34d;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --purple: #7c3aed;
  --radius: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--blue); color: #fff; padding: 6px 12px; border-radius: 6px; z-index: 200; }
.skip-link:focus { left: 8px; }

/* ── Header ─────────────────────────────────────────────────────────── */
.app-header { background: var(--shell); border-bottom: 1px solid var(--line-dark); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; flex-wrap: wrap; position: sticky; top: 0; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.brand-mark { width: 24px; height: 24px; flex-shrink: 0; }
.brand-name { font-weight: 600; font-size: 14px; text-decoration: none; color: var(--text); letter-spacing: -0.01em; }
.demo-pill { font-size: 11px; font-weight: 600; color: #fde68a; background: rgba(180, 83, 9, 0.22); border: 1px solid rgba(251, 191, 36, 0.4); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.role-switch { display: flex; align-items: center; background: #111827; border: 1px solid var(--line-dark-2); border-radius: 8px; padding: 2px; }
.role-label { font-size: 11px; color: var(--text-4); padding: 0 8px; }
.role-switch button { border: 0; background: transparent; color: var(--text-3); font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 6px; }
.role-switch button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.role-switch button[data-role="admin"][aria-pressed="true"] { background: var(--purple); }
.operator-name { font-size: 12px; color: var(--text-3); }
.btn-ghost { background: transparent; border: 1px solid var(--line-dark-2); color: var(--text-2); font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-ghost:hover { background: #1e293b; color: #fff; }
.btn-reset.is-armed { border-color: var(--red); color: #fecaca; }

.btn-primary, .btn-secondary, .btn-danger, .btn-success { border: 1px solid transparent; font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-2); }
.btn-success { background: var(--green-dark); color: #fff; }
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }
.btn-secondary { background: var(--paper-2); color: var(--ink); border-color: var(--navy); }
.btn-secondary:hover:not(:disabled) { background: #b9c4d1; }
.btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled, .btn-success:disabled { opacity: 0.45; }
.is-armed { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.5); }
.btn-sm { font-size: 12px; padding: 4px 10px; border-radius: 6px; }

.view { flex: 1; display: flex; min-height: 0; outline: none; }

/* ── Queue ──────────────────────────────────────────────────────────── */
.queue-layout { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 220px; flex-shrink: 0; background: var(--shell); border-right: 1px solid var(--line-dark); padding: 12px; }
.sidebar-label { font-size: 10px; font-weight: 700; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.12em; padding: 8px 12px; margin: 0; }
.folder-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 0; background: transparent; color: var(--text-3); font-size: 12.5px; font-weight: 500; text-align: left; }
.folder-btn:hover { background: #1e293b; color: #fff; }
.folder-btn.is-active { background: #1e293b; color: #fff; box-shadow: inset 2px 0 0 var(--blue); }
.folder-btn.is-locked { opacity: 0.55; }
.folder-btn .count { font-family: var(--mono); font-size: 11px; }
.folder-btn .lock { font-size: 10px; color: #c4b5fd; border: 1px solid rgba(167, 139, 250, 0.4); border-radius: 4px; padding: 0 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.queue-main { flex: 1; overflow-y: auto; padding: 28px 24px 200px; }
.queue-inner { max-width: 900px; margin: 0 auto; }
.queue-head { margin-bottom: 18px; }
.queue-head h1 { font-size: 17px; margin: 0 0 2px; }
.queue-head p { margin: 0; color: var(--text-3); font-size: 13px; }
.locked-note { background: rgba(124, 58, 237, 0.12); border: 1px solid rgba(167, 139, 250, 0.35); color: #ddd6fe; border-radius: var(--radius); padding: 14px 16px; font-size: 13px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.case-card { background: #0f172a; border: 1px solid var(--line-dark); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; display: flex; gap: 16px; align-items: center; justify-content: space-between; transition: border-color .15s; }
.case-card:hover { border-color: var(--line-dark-2); }
.case-card.is-featured { border-color: rgba(96, 165, 250, 0.55); box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2); }
.case-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.case-num { font-family: var(--mono); font-size: 12px; font-weight: 600; color: #60a5fa; background: rgba(30, 58, 138, 0.35); border: 1px solid rgba(30, 64, 175, 0.5); padding: 1px 8px; border-radius: 5px; }
.case-carrier { font-weight: 600; font-size: 14px; }
.case-status { font-size: 11px; font-weight: 500; }
.chip { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 5px; border: 1px solid; white-space: nowrap; }
.chip-red { color: #fca5a5; background: rgba(127, 29, 29, 0.4); border-color: #991b1b; }
.chip-amber { color: #fcd34d; background: rgba(120, 53, 15, 0.4); border-color: #92400e; }
.chip-purple { color: #c4b5fd; background: rgba(76, 29, 149, 0.35); border-color: #6d28d9; }
.case-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 24px; }
.metric-label { font-size: 10px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.1em; }
.metric-value { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-value.strong { color: #fff; font-weight: 500; }
.empty { text-align: center; color: var(--text-3); padding: 60px 20px; border: 1px dashed var(--line-dark-2); border-radius: var(--radius); }
.empty strong { display: block; color: var(--text-2); margin-bottom: 4px; }

/* ── Case workstation ───────────────────────────────────────────────── */
.ws { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ws-bar { background: var(--shell); border-bottom: 1px solid var(--line-dark); padding: 8px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ws-bar a.back { color: var(--text-3); text-decoration: none; font-size: 12px; }
.ws-bar a.back:hover { color: #fff; }
.sep { width: 1px; height: 16px; background: var(--line-dark-2); }
.status-badge { font-size: 10.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid; }
.ws-split { display: flex; flex: 1; min-height: 0; }
.ws-aside { width: 310px; flex-shrink: 0; background: var(--aside); border-right: 1px solid var(--line-dark); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 53px; align-self: flex-start; max-height: calc(100vh - 53px); }
.ws-main { flex: 1; overflow-y: auto; padding: 22px 24px 220px; min-width: 0; }

.paper { background: var(--paper); border: 1px solid var(--navy); border-radius: var(--radius); color: var(--ink); box-shadow: 0 6px 28px rgba(0, 0, 0, 0.42), 0 2px 8px rgba(0, 0, 0, 0.22); }
.paper-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--navy); flex-wrap: wrap; }
.paper-body { padding: 14px 16px; }
.eyebrow { font-size: 10px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: 0.08em; margin: 0; }
.paper .muted, .paper-note { color: var(--ink-3); font-size: 12.5px; }
.paper dl.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.paper dl.meta dt { color: var(--ink-3); }
.paper dl.meta dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.deadline-note { display: block; font-size: 11px; font-weight: 700; margin-top: 1px; }
.tool-btn { font-size: 11.5px; font-weight: 500; color: var(--navy); background: var(--paper-2); border: 1px solid var(--navy); border-radius: 5px; padding: 3px 10px; white-space: nowrap; }
.tool-btn:hover:not(:disabled) { background: #b9c4d1; }
.tool-btn:disabled { opacity: 0.45; }
.tool-btn.save { background: var(--green-dark); color: #fff; font-weight: 600; }
.tool-btn.save:hover:not(:disabled) { background: #047857; }
.tool-btn.on { background: var(--ink-2); color: var(--paper-2); }
.badge-edited { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; color: var(--amber); background: var(--amber-soft); border: 1px solid var(--amber-line); }
.badge-sim { font-size: 10px; font-weight: 700; color: #92400e; background: #fde68a; border: 1px solid #f59e0b; border-radius: 4px; padding: 1px 6px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.badge-real { font-size: 10px; font-weight: 700; color: var(--green-dark); background: var(--green-soft); border: 1px solid #6ee7b7; border-radius: 4px; padding: 1px 6px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }

/* Key loader */
.key-card .key-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.key-loaded { display: flex; align-items: center; gap: 8px; color: var(--green-dark); font-weight: 600; font-size: 13px; }
.file-link { font-size: 12px; color: var(--blue-ink); text-decoration: underline; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.cipher { font-family: var(--mono); font-size: 10.5px; background: var(--paper-3); border: 1px solid #94a3b8; border-radius: 6px; padding: 8px; color: var(--ink-3); overflow-wrap: anywhere; margin-top: 8px; }
details.inline summary { cursor: pointer; font-size: 12px; color: var(--blue-ink); margin-top: 10px; }

/* Pipeline */
.pipeline { list-style: none; margin: 0; padding: 0; }
.pipeline li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 6px 0; font-size: 12.5px; }
.pipeline li + li { border-top: 1px dashed #94a3b8; }
.pipeline .tick { width: 16px; height: 16px; border-radius: 50%; background: var(--green-dark); color: #fff; font-size: 10px; display: grid; place-items: center; margin-top: 1px; }
.pipeline .tick.hold { background: var(--amber); }
.pipeline strong { color: var(--ink); font-weight: 600; display: block; }
.pipeline span { color: var(--ink-3); font-size: 11.5px; }

/* Patient identity */
.identity-placeholder { border: 1px dashed var(--line-dark-2); border-radius: var(--radius); padding: 12px 16px; color: var(--text-4); font-size: 12.5px; margin-bottom: 16px; }
.identity { margin-bottom: 16px; }
.identity-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 24px; }
.identity-grid .k { font-size: 11px; color: var(--ink-3); }
.identity-grid .v { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.identity-grid .v.mono { color: var(--blue-ink); font-size: 13px; }

/* Drafting grid */
.drafting { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 16px; align-items: start; margin-bottom: 16px; }
.letter-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.letter-grid.with-diff { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.drafting.has-diff { grid-template-columns: minmax(0, 1fr); }
.drafting.has-diff .ref-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
.letter-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.char-count { font-size: 10.5px; color: var(--ink-4); font-family: var(--mono); }
#editor { display: block; width: 100%; min-height: 520px; resize: none; overflow: hidden; border: 0; outline: none; background: transparent; color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.8; padding: 16px 20px; }
#editor[readonly] { cursor: default; }
.letter-preview { padding: 16px 20px; font-size: 15px; line-height: 1.8; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-body { padding: 16px 20px; font-size: 14px; line-height: 1.8; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 900px; overflow-y: auto; }
mark.diff-add { background: #fef9c3; border: 1px solid #fde047; border-radius: 2px; padding: 0 3px; color: #854d0e; }
del.diff-del { text-decoration: line-through; color: #b91c1c; background: #fee2e2; border-radius: 2px; padding: 0 2px; }
.subs { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--navy); background: #d6dee8; }
.subs h4 { margin: 0 0 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--navy); }
.sub-row { display: grid; grid-template-columns: max-content auto minmax(0, 1fr); align-items: baseline; gap: 6px; font-size: 11.5px; line-height: 1.6; background: none; border: 0; padding: 0 2px; text-align: left; width: 100%; color: inherit; border-radius: 3px; }
.sub-row:hover { background: var(--paper-2); }
.sub-row .tok { font-family: var(--mono); color: var(--ink-4); white-space: nowrap; }
.sub-row .val { color: var(--blue-ink); font-weight: 500; overflow-wrap: break-word; min-width: 0; }
.sub-row .val.manual { color: var(--green); font-style: italic; }
.chip-token { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: #92400e; background: var(--amber-soft); border: 1px solid var(--amber-line); border-radius: 4px; padding: 2px 8px; margin: 0 6px 6px 0; }
.chip-token:hover { background: #fde68a; }
.hint { font-size: 11.5px; color: var(--ink-3); margin: 4px 0 0; }
.citation-tag { display: inline-block; background: var(--blue-soft); border: 1px solid #93c5fd; color: var(--blue-ink); font-size: 11px; padding: 2px 8px; border-radius: 999px; margin: 2px; }
.ref-col { display: flex; flex-direction: column; gap: 16px; }
.route-box { font-size: 12px; color: var(--ink-2); }
.route-box .addr { margin: 6px 0; line-height: 1.5; }

/* Bundle rows */
.bundle-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--navy); flex-wrap: wrap; }
.bundle-row:first-of-type { border-top: 0; }
.bundle-row .name { flex: 1; min-width: 160px; }
.bundle-row .name strong { display: block; font-size: 13.5px; color: var(--ink); font-weight: 600; }
.bundle-row .name span { font-size: 12px; color: var(--ink-3); }
.bundle-row .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-label { font-size: 10px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: 0.08em; padding: 10px 16px 0; margin: 0; border-top: 1px solid var(--navy); }
.include-btn[aria-pressed="true"] { background: var(--ink-2); color: var(--paper-2); }
.warn { color: var(--amber); font-size: 12px; }

/* Checklist + gate */
.lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 13px; }
.check input { margin-top: 3px; accent-color: var(--blue-ink); flex-shrink: 0; width: 15px; height: 15px; }
.check strong { display: block; color: var(--ink); }
.check small { color: var(--ink-2); font-size: 12px; }
.check-list { display: flex; flex-direction: column; gap: 14px; }
.gate { margin: 10px 0 0; padding: 0; list-style: none; font-size: 12px; }
.gate li { display: flex; gap: 6px; align-items: baseline; color: var(--ink-3); padding: 1px 0; }
.gate li::before { content: "○"; color: var(--amber); font-weight: 700; }
.gate li.ok::before { content: "✓"; color: var(--green); }
.gate li.ok { color: var(--ink-4); text-decoration: line-through; text-decoration-color: rgba(63,102,144,.5); }

/* Mode panels (scope, submission, transmitted) */
.mode-panel { max-width: 760px; margin-bottom: 16px; }
.mode-panel .paper-body p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
.callout { border-radius: 8px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 12px; }
.callout-amber { background: var(--amber-soft); border: 1px solid var(--amber-line); color: #78350f; }
.callout-green { background: var(--green-soft); border: 1px solid #6ee7b7; color: #064e3b; }
.callout-blue { background: var(--blue-soft); border: 1px solid #93c5fd; color: #1e3a8a; }
.callout-purple { background: #ede9fe; border: 1px solid #c4b5fd; color: #4c1d95; }
.paper textarea, .paper input[type="text"] { width: 100%; border: 1px solid var(--ink-4); border-radius: 8px; background: var(--paper-3); color: var(--ink); padding: 8px 10px; font-size: 13px; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.channel { border: 1px solid var(--navy); background: var(--paper-2); border-radius: 10px; padding: 12px; text-align: left; color: var(--ink); }
.channel:hover:not(:disabled) { background: #b9c4d1; }
.channel:disabled { opacity: 0.5; }
.channel strong { display: block; font-size: 13.5px; }
.channel span { font-size: 12px; color: var(--ink-3); }
.log { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.log li { padding: 8px 0; border-top: 1px dashed #94a3b8; }
.log li:first-child { border-top: 0; }

/* ── Modals ─────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(2, 6, 23, 0.82); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #0f172a; border: 1px solid var(--line-dark-2); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
.modal-wide { max-width: 760px; }
.modal-pdf { max-width: 980px; height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-dark); flex-wrap: wrap; }
.modal-head h2 { font-size: 15px; margin: 0; }
.modal-head-actions { display: flex; gap: 8px; align-items: center; }
.modal-x { background: none; border: 0; color: var(--text-3); font-size: 22px; line-height: 1; padding: 0 4px; }
.modal-x:hover { color: #fff; }
.modal-body { padding: 16px 18px; overflow-y: auto; font-size: 13.5px; color: var(--text-2); }
.modal-body p { margin: 0 0 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line-dark); }
.sim-banner { background: rgba(180, 83, 9, 0.22); border-bottom: 1px solid rgba(251, 191, 36, 0.35); color: #fde68a; font-size: 12px; padding: 8px 18px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 13px; }
dl.kv dt { color: var(--text-4); }
dl.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
.field input { background: #020617; border: 1px solid var(--line-dark-2); border-radius: 8px; color: var(--text); padding: 9px 11px; font-size: 14px; }
.field input:focus { border-color: #60a5fa; outline: none; }
.field-note { font-size: 12px; color: var(--text-3); margin: -2px 0 12px; }
.modal .check { color: var(--text-2); font-size: 12.5px; }
.error { color: #fca5a5; font-size: 12.5px; margin: 8px 0 0; }
.address-block { white-space: pre-line; background: #020617; border: 1px solid var(--line-dark-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--text); }
.stages { list-style: none; margin: 0; padding: 0; }
.stages li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 13px; color: var(--text-4); }
.stages li::before { content: "○"; width: 14px; flex-shrink: 0; }
.stages li.active { color: var(--text); }
.stages li.active::before { content: "◌"; color: #60a5fa; animation: pulse 0.8s infinite alternate; }
.stages li.done { color: var(--text-2); }
.stages li.done::before { content: "✓"; color: #34d399; }
.stages .result { color: #6ee7b7; font-family: var(--mono); }
@keyframes pulse { to { opacity: 0.3; } }
.pdf-frame-wrap { flex: 1; position: relative; background: #334155; }
.pdf-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.pdf-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); margin: 0; }
.about .lede { font-size: 15px; color: var(--text); line-height: 1.6; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.about-grid > div { background: #020617; border: 1px solid var(--line-dark); border-radius: 10px; padding: 12px 14px; }
.about-grid h3 { margin: 0 0 6px; font-size: 13px; }
.about-grid > div:first-child h3 { color: #6ee7b7; }
.about-grid > div:last-child h3 { color: #fcd34d; }
.about-grid ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.about-grid li { margin: 3px 0; }
.fine { font-size: 12px; color: var(--text-3); }

/* ── Walkthrough guide ──────────────────────────────────────────────── */
.guide { position: fixed; right: 16px; bottom: 16px; z-index: 60; width: 300px; background: #0b1222; border: 1px solid #1e3a8a; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); font-size: 12.5px; }
.guide-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line-dark); }
.guide-head strong { font-size: 12.5px; }
.guide-head button { background: none; border: 0; color: var(--text-3); font-size: 12px; }
.guide-progress { height: 3px; background: #1e293b; }
.guide-progress span { display: block; height: 100%; background: #60a5fa; transition: width .3s; }
.guide ol { list-style: none; margin: 0; padding: 8px 14px 12px; max-height: 50vh; overflow-y: auto; }
.guide li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 5px 0; color: var(--text-4); }
.guide li::before { content: "○"; }
.guide li.done { color: var(--text-3); }
.guide li.done::before { content: "✓"; color: #34d399; }
.guide li.current { color: var(--text); }
.guide li.current::before { content: "→"; color: #60a5fa; font-weight: 700; }
.guide li .tip { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.guide li a { color: #93c5fd; }
.guide.is-collapsed ol, .guide.is-collapsed .guide-progress { display: none; }
.guide.is-collapsed { width: auto; }

/* ── Toasts ─────────────────────────────────────────────────────────── */
.toasts { position: fixed; top: 64px; right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); border: 1px solid var(--ink-2); color: var(--text); border-radius: 10px; padding: 10px 14px; max-width: 360px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); animation: toastIn .2s ease-out; }
.toast-success { border-color: #059669; }
.toast-sim { border-color: #b45309; }
.toast-out { opacity: 0; transition: opacity .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .drafting { grid-template-columns: minmax(0, 1fr); }
  .ref-col { display: grid; grid-template-columns: 1fr 1fr; }
  .letter-grid.with-diff { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  body { min-height: auto; }
  .ws-split, .queue-layout { flex-direction: column; }
  .ws-aside { width: auto; border-right: 0; border-bottom: 1px solid var(--line-dark); position: static; max-height: none; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--line-dark); display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar .sidebar-label { width: 100%; }
  .folder-btn { width: auto; }
  .lower { grid-template-columns: minmax(0, 1fr); }
  .guide { width: calc(100% - 32px); }
}
@media (max-width: 640px) {
  .app-header { padding: 10px 16px; }
  .queue-main, .ws-main { padding: 18px 16px 220px; }
  .case-card { flex-direction: column; align-items: stretch; }
  .case-metrics, .identity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ref-col, .subs, .about-grid, .channel-grid { grid-template-columns: minmax(0, 1fr); }
  .role-label, .operator-name { display: none; }
  .toasts { top: auto; bottom: 150px; left: 16px; right: 16px; }
  .toast { max-width: none; }
  #editor { padding: 14px; font-size: 14px; }
}
