/* mdocs design tokens + base styles (BRAND.md / ADR-0019).
   Phase 0 hand-rolled CSS; the Tailwind standalone build (ADR-0018) layers on later. */
:root {
  --accent: #4F46E5; --accent-hover: #4338CA; --accent-fg: #fff; --accent-subtle: #EEF2FF;
  --bg: #F6F7FB; --surface: #fff; --surface-2: #F8FAFC; --border: #E6E9F0; --text: #0F172A; --text-muted: #64748B;
  --success: #16A34A; --warning: #D97706; --danger: #DC2626; --info: #0EA5E9;
  --radius: 8px; --radius-sm: 6px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05); --shadow-md: 0 6px 22px rgba(15,23,42,.09);
}
.dark {
  --accent: #818CF8; --accent-fg: #0B1120; --accent-subtle: #1E1B4B;
  --bg: #0B1120; --surface: #0F172A; --surface-2: #131C30; --border: #1E293B; --text: #E2E8F0; --text-muted: #94A3B8;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.45); --shadow-md: 0 8px 26px rgba(0,0,0,.55);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  overflow-x: hidden; /* belt-and-braces: nothing should force horizontal page scroll */
}
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  flex-wrap: wrap; /* wrap on narrow screens instead of overflowing */
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text);
  text-decoration: none; font-size: 18px; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: block; box-shadow: var(--shadow-sm); }
.omni, .capture-input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit;
}
.omni { flex: 1 1 140px; min-width: 0; }
.iconbtn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer;
}
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }
.capture { margin: 8px 0 16px; }
.capture-input { width: 100%; padding: 12px 14px; background: var(--surface); }
h2 { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.cards { list-style: none; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.card-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-id { color: var(--text-muted); font-family: ui-monospace, monospace; font-size: 11px; margin-left: auto; }
.empty { color: var(--text-muted); }
.ws { color: var(--text-muted); font-size: 13px; margin-top: 16px; }
.foot { max-width: 1100px; margin: 24px auto; padding: 16px; color: var(--text-muted);
  border-top: 1px solid var(--border); font-size: 13px; }
@media (max-width: 640px) { .container { padding: 12px; } }

/* --- Phase 1 components --- */
[x-cloak] { display: none !important; }
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 12px; cursor: pointer; font: inherit; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px; }
kbd { border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 11px; }
code { font-family: ui-monospace, monospace; font-size: 12px; }

/* workspace switcher */
.switcher { position: relative; }
.ws-btn { display: flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; color: var(--text); }
.ws-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ws-menu { position: absolute; top: 110%; left: 0; min-width: 200px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.ws-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: 0; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); text-decoration: none; }
.ws-item:hover { background: var(--accent-subtle); }
.ai-off { font-size: 10px; color: var(--warning); border: 1px solid var(--warning); border-radius: 4px; padding: 0 4px; margin-left: auto; }

/* command palette */
.palette-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex;
  justify-content: center; align-items: flex-start; padding-top: 12vh; z-index: 100; }
.palette { width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; box-shadow: 0 16px 48px rgba(0,0,0,.3); }
.palette-input { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.palette-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.palette-actions a { text-decoration: none; color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; }
.palette-list { list-style: none; padding: 0; margin: 0; }
.palette-list a { display: block; padding: 8px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.palette-list a:hover { background: var(--accent-subtle); }

/* entry view */
.entry-head { display: flex; align-items: center; gap: 10px; }
.entry-head h1 { font-size: 22px; margin: 8px 0; flex: 1; }
.back { text-decoration: none; color: var(--text-muted); font-size: 24px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.chip { background: var(--accent-subtle); color: var(--accent); border-radius: 999px; padding: 2px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.dark .chip { color: var(--text); }
.chip-x { background: none; border: 0; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; }
.chip-add input { border: 1px dashed var(--border); border-radius: 999px; padding: 2px 8px; background: transparent; color: var(--text); font: inherit; width: 80px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.file-img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.file-pdf { width: 100%; height: 480px; border: 1px solid var(--border); border-radius: var(--radius); grid-column: 1 / -1; }
.file-link { display: inline-block; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; text-decoration: none; color: var(--text); }
.note-body { line-height: 1.6; }
.note-body img { max-width: 100%; }
.note-edit textarea, .form textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.meta { color: var(--text-muted); font-size: 12px; font-family: ui-monospace, monospace; }

/* forms + settings */
.form { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-form { flex-flow: row wrap; align-items: center; }
.row-form input, .row-form select { padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.card-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.ws-list { list-style: none; padding: 0; }
.ws-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.banner { background: var(--accent-subtle); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.dup { color: var(--warning); font-size: 13px; margin-top: 4px; }
.card-link { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); overflow: hidden; }

/* --- Phase 2: AI inbox/outbox --- */
.ai-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; background: var(--surface); }
.ai-panel h2 { color: var(--text); }
.ai-access { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.privacy { color: var(--warning); font-size: 13px; }
.muted { color: var(--text-muted); font-size: 13px; }
.jobs { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.job { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.job-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-prompt { color: var(--text); }
.job-link { font-weight: 500; color: var(--text); text-decoration: none; }
.job-meta { color: var(--text-muted); font-size: 12px; font-family: ui-monospace, monospace; margin-left: auto; }
.job-msg { color: var(--warning); font-size: 13px; margin: 6px 0; }
.pill { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; border-radius: 999px; padding: 2px 8px; color: #fff; }
.pill.pending { background: #94A3B8; }
.pill.running { background: var(--info); }
.pill.done { background: var(--success); }
.pill.error { background: var(--danger); }
.pill.needs_input { background: var(--warning); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.filters a { text-decoration: none; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; }

/* --- Phase 3: auth --- */
.authbox { max-width: 420px; margin: 8vh auto; }
.authbox .form input, .authbox .form select { padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.err { color: var(--danger); }
.break { word-break: break-all; font-size: 12px; }
.mono { list-style: none; padding: 0; columns: 2; }
.mono code { font-family: ui-monospace, monospace; }
.capture-row { display: flex; gap: 8px; margin: 8px 0 16px; }
.capture-row .btn { text-decoration: none; }

/* office viewers (docx-preview / SheetJS) — ADR-0009 */
.office { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 12px; max-height: 640px; overflow: auto; }
.office .docx-wrapper { background: transparent !important; padding: 0 !important; }
.sheet-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.sheet-view table { border-collapse: collapse; font-size: 13px; }
.sheet-view td, .sheet-view th { border: 1px solid var(--border); padding: 2px 6px; white-space: nowrap; }

/* Markdown editor with side preview (ADR-0018) */
.md-editor { width: 100%; }
.md-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.md-toolbar .btn { padding: 4px 9px; }
/* Fixed-height, user-resizable split: each pane scrolls internally so a long
   preview never pushes the Save button away. */
.md-split { display: flex; gap: 12px; height: 420px; min-height: 220px; resize: vertical; overflow: hidden; }
.md-input { flex: 1; height: 100%; min-height: 0; overflow: auto; resize: none;
  font-family: ui-monospace, monospace; font-size: 13px; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); }
.md-preview { flex: 1; height: 100%; overflow: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; background: var(--bg); }
@media (max-width: 768px) { .md-split { flex-direction: column; height: 360px; } .md-preview { display: none; } }

/* text / code / media file previews (ADR-0009) */
.code-view { padding: 0; }
.code-view pre { margin: 0; padding: 12px; overflow: auto; font-size: 12px; }
.txt { margin: 0; white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 12px; }
.file-media { max-width: 100%; border-radius: var(--radius); grid-column: 1 / -1; }

/* drag-and-drop overlay (ADR-0012) */
.drop-overlay { display: none; position: fixed; inset: 0; z-index: 200; pointer-events: none;
  align-items: center; justify-content: center; font-size: 22px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); border: 3px dashed var(--accent); }

/* browse / filter (tag + date) */
.filters-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }
.filters-form label { display: inline-flex; gap: 6px; align-items: center; color: var(--text-muted); font-size: 13px; }
.filters-form input[type=date], .filters-form select { padding: 7px 9px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.tagcloud .chip { text-decoration: none; }
.tagcloud .chip.active { background: var(--accent); color: var(--accent-fg); }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; margin-top: 4px; }
@media (max-width: 920px) { .dash { grid-template-columns: 1fr; gap: 20px; } }
.dash-main { min-width: 0; }
.dash-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 78px; }
@media (max-width: 920px) { .dash-side { position: static; } }

/* page header */
.dash-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 16px; }
.dash-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.dash-head .sub { color: var(--text-muted); font-size: 13px; }

/* capture hero */
.capture-card { background: linear-gradient(135deg, var(--accent-subtle), var(--surface) 62%);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.capture { display: flex; gap: 10px; }
.capture .capture-input { flex: 1; font-size: 15px; padding: 13px 16px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); }
.capture-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.btn.primary { box-shadow: var(--shadow-sm); border-radius: 10px; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.capture-row { display: flex; gap: 8px; margin: 14px 0 0; flex-wrap: wrap; }
.btn.ghost { background: var(--surface); text-decoration: none; border-radius: 10px; color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.section-head h2 { margin: 0; }
.link { color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 600; }
.link:hover { text-decoration: underline; }
.empty-state { text-align: center; padding: 44px 16px; color: var(--text-muted);
  border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.empty-emoji { font-size: 44px; margin-bottom: 8px; }

.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm); }
.widget h3 { margin: 0 0 14px; font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .06em; display: flex; align-items: center; gap: 6px; }

.stat-row { display: flex; gap: 8px; }
.stat { flex: 1; text-align: center; text-decoration: none; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 4px;
  transition: border-color .12s ease, background .12s ease; }
.stat:hover { background: var(--accent-subtle); border-color: var(--accent); }
.stat b { display: block; font-size: 20px; font-weight: 700; line-height: 1.2; }
.stat span { font-size: 11px; color: var(--text-muted); }
.stat.warn b { color: var(--warning); }
.stat.err b { color: var(--danger); }
.widget .muted { margin: 12px 0 0; }

/* mini calendar */
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.cal-nav a { text-decoration: none; color: var(--text-muted); width: 26px; height: 26px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 16px; border-radius: 7px; }
.cal-nav a:hover { background: var(--accent-subtle); color: var(--accent); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 10px; font-weight: 600; color: var(--text-muted); padding: 2px 0; }
.cal-day { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; text-decoration: none;
  color: var(--text); font-size: 12px; border-radius: 8px; position: relative; transition: background .1s ease; }
.cal-day:hover { background: var(--accent-subtle); }
.cal-day.out { color: var(--text-muted); opacity: .3; }
.cal-day.today { background: var(--accent); color: var(--accent-fg); font-weight: 700; }
.cal-day.has { font-weight: 700; }
.cal-day.has:not(.today)::after { content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

/* recent cards lift on hover */
.card { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* inline preview of LLM/agent result files (AI panel) */
.ai-result { border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0;
  background: var(--surface); overflow: hidden; }
.ai-result-head { display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); font-family: ui-monospace, monospace; }
.ai-result-head .link { margin-left: auto; }
.ai-result-body { padding: 10px 14px; max-height: 520px; overflow: auto; }
.ai-result-body > :first-child { margin-top: 0; }
.ai-result-body > :last-child { margin-bottom: 0; }

/* workspace row actions (settings) */
.ws-actions { margin-left: auto; display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ws-actions .btn { padding: 4px 9px; font-size: 12px; }

/* accent color picker + preset swatches (settings) */
.accent-pick { display: inline-flex; align-items: center; gap: 8px; }
.accent-pick input[type=color] { width: 42px; height: 34px; padding: 2px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.swatches { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; padding: 0; }
.swatch:hover { outline: 2px solid var(--accent); outline-offset: 1px; }

/* tasks / simple to-do (per-workspace) */
.tasks-wrap { max-width: 680px; }
.tasks-wrap .page-title { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.task-add { display: flex; gap: 8px; margin: 0 0 14px; }
.task-add .task-input { flex: 1; padding: 11px 14px; }
.task-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.task { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; }
.task:hover { background: var(--surface-2); }
.task:hover .task-del { opacity: 1; }
.task form { display: inline; margin: 0; }
.task-check { background: none; border: 0; cursor: pointer; font-size: 19px; line-height: 1; padding: 0; color: var(--accent); }
.task-check:hover { color: var(--accent-hover); }
.task-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task.done .task-text { text-decoration: line-through; color: var(--text-muted); }
.task-del { opacity: 0; transition: opacity .12s ease; }
.task-clear { margin-top: 14px; font-size: 13px; }
.task-list.mini { gap: 0; margin-bottom: 10px; }
.task-list.mini .task { padding: 6px 4px; font-size: 13px; }
.task-list.mini .task-check { font-size: 16px; }
.widget h3 .wc { margin-left: auto; background: var(--accent-subtle); color: var(--accent);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.dark .widget h3 .wc { color: var(--text); }

/* confidential badge + entry header layout */
.badge.conf { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning);
  border-radius: 6px; padding: 1px 5px; font-size: 12px; }
.head-spacer { flex: 1; }
.entry-head h1 { flex: 0 1 auto; }

/* ---------- top bar menu (hamburger on mobile) ---------- */
.topbar-menu { display: flex; align-items: center; gap: 8px; position: relative; margin-left: auto; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.menu-toggle { display: none; }              /* desktop: full nav is inline */
.nav .lbl, .topbar-actions .iconbtn .lbl { display: none; } /* desktop: icon-only */

/* ---------- mobile / overflow safety ---------- */
/* long content (code blocks, pasted URLs, AI output, sheets) scrolls inside its
   box or wraps — it must never widen the page. */
.note-body, .ai-result-body { overflow-wrap: anywhere; }
.note-body img, .note-body table, .note-body video { max-width: 100%; height: auto; }
.note-body pre, .ai-result-body pre, .code-view pre { overflow: auto; max-width: 100%; }
.ws-list li { flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.ws-list li code, .meta, .break { overflow-wrap: anywhere; }
.form input, .row-form input, .row-form select { max-width: 100%; }

@media (max-width: 720px) {
  /* the bar fits: brand + workspace + ☰ on one row, search on its own row */
  .omni { flex-basis: 100%; order: 10; }
  .menu-toggle { display: inline-flex; font-size: 18px; line-height: 1; }
  .topbar-actions {
    display: none; position: absolute; top: calc(100% + 10px); right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; min-width: 210px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 8px; z-index: 40;
  }
  .topbar-actions.open { display: flex; }
  .topbar-actions .nav { flex-direction: column; gap: 2px; width: 100%; }
  .topbar-actions .nav a,
  .topbar-actions .iconbtn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    border: 0; border-radius: var(--radius-sm); padding: 11px 12px; text-align: left; font-size: 15px;
  }
  .topbar-actions form { width: 100%; margin: 0; }
  .topbar-actions .nav a:hover, .topbar-actions .iconbtn:hover { background: var(--accent-subtle); }
  .nav .lbl, .topbar-actions .iconbtn .lbl { display: inline; }
}

@media (max-width: 640px) {
  .entry-head h1 { font-size: 19px; }
  .card-box, .widget, .capture-card { padding: 14px; }
  .files { grid-template-columns: 1fr; }    /* file previews stack */
  .file-pdf { height: 70vh; }
  .ws-actions { width: 100%; margin-left: 0; } /* workspace/provider actions wrap under */
}
