/* Compact local workbench. Imported card documents retain their own styles. */
:root {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-synthesis: none;
  line-height: 1.45;
  color: #e4e4e7;
  background: #202020;
  --sidebar: #252526;
  --surface: #1e1e1e;
  --toolbar: #2d2d30;
  --border: #3e3e42;
  --muted: #a9a9b3;
  --accent: #75a9e8;
  --accent-hover: #92bced;
  --focus: #75a9e8;
  --soft: #2d2d30;
  --radius: 2px;
  --topbar-height: calc(48px + env(safe-area-inset-top, 0px));
}

* { box-sizing: border-box; }
html { min-width: 0; }
body { display: flex; flex-direction: column; height: var(--app-height, 100dvh); min-height: 0; min-width: 0; margin: 0; }
main, section, article, form, fieldset, label, .split > *, .grid > * { min-width: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
p, h1, h2, h3, li, dd, dt, a, button, summary { overflow-wrap: anywhere; }
p { margin: 0 0 8px; }
h1 { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 600; }
h2 { margin: 0 0 8px; font-size: 14px; line-height: 1.4; font-weight: 600; }
h3 { margin: 12px 0 6px; font-size: 13px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 11px; letter-spacing: .06em; font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; }

/* Fixed-size chrome, flexible scrollable work area; no viewport-wide children. */
.workbench-topbar { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; height: 48px; height: var(--topbar-height); padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); border-bottom: 1px solid var(--border); background: var(--toolbar); }
.brand { display: inline-flex; align-items: center; min-height: 44px; color: inherit; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.brand-icon { margin-right: 6px; font-size: 18px; line-height: 1; }
#sidebar-toggle { flex: 0 0 44px; width: 44px; padding: 0; margin: 0; color: inherit; background: transparent; border-color: transparent; }
#workspace-context { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.workbench-topbar > .toolbar { margin-left: auto; }
.workspace-top-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-left: auto; }
.workspace-top-actions button, .workspace-top-actions .button { margin: 0; }
#workbench { display: grid; flex: 1 1 auto; min-height: 0; min-width: 0; grid-template-columns: 48px 224px minmax(0, 1fr); grid-template-areas: "nav sidebar workspace"; grid-template-rows: minmax(0, 1fr); }
#nav { grid-area: nav; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--toolbar); border-right: 1px solid var(--border); }
nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 8px; color: var(--muted); text-decoration: none; }
nav a:hover { background: #37373d; color: #e4e4e7; }
nav a[aria-current="page"] { background: #35353a; color: var(--accent); }
.nav-primary { display: flex; flex-direction: column; }
.nav-primary a { justify-content: center; min-width: 44px; border-left: 2px solid transparent; padding: 4px 0; }
.nav-primary a[aria-current="page"] { border-left-color: var(--accent); }
.nav-primary a > span, .nav-more > summary > span, .visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
nav svg, #sidebar-toggle svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-more { margin: auto 0 0; }
.nav-more > summary { display: flex; align-items: center; justify-content: center; min-width: 44px; padding: 4px; list-style: none; color: var(--muted); }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more[open] > summary { margin: 0; color: var(--accent); background: #35353a; }
.nav-admin { position: absolute; z-index: 40; left: 100%; bottom: 0; display: grid; width: min(320px, calc(100vw - 64px)); max-height: min(70dvh, calc(var(--app-height, 100dvh) - 100px)); overflow: auto; grid-template-columns: minmax(0, 1fr); padding: 4px; border: 1px solid var(--border); background: var(--sidebar); }
.nav-admin > .eyebrow { grid-column: 1 / -1; margin: 8px; }
.nav-admin a { width: 100%; }
#workspace-sidebar { grid-area: sidebar; min-width: 0; min-height: 0; overflow: auto; background: var(--sidebar); border-right: 1px solid var(--border); padding: 8px 0; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 8px; margin: 0; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .05em; }
#sidebar-close { min-width: 44px; min-height: 44px; padding: 0; margin: 0; background: transparent; color: var(--muted); border-color: transparent; font-size: 20px; }
#workspace-tree, #workspace-tree ul { list-style: none; margin: 0; padding: 0; }
#workspace-tree ul { padding-left: 12px; }
#workspace-tree li { min-width: 0; }
#workspace-tree a, .sidebar-context a { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 12px; color: #e4e4e7; text-decoration: none; overflow-wrap: anywhere; }
#workspace-tree a:hover, .sidebar-context a:hover { background: #303034; }
#workspace-tree a[aria-current="page"], .sidebar-context a[aria-current="page"] { background: #34343a; color: var(--accent); }
#workspace-tree .hint { padding: 6px 12px; }
.sidebar-context { display: grid; border-top: 1px solid var(--border); margin-top: 12px; padding-top: 8px; }
#workspace-content { grid-area: workspace; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: auto; background: var(--surface); scroll-padding: 12px; }
main { min-width: 0; max-width: none; flex: 1 0 auto; margin: 0; padding: 12px 16px 20px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.pagehead .eyebrow { display: none; }
.pagehead p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; margin: 12px 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; gap: 0; margin: 12px 0; }
.split > :first-child { padding-right: 12px; }
.split > :nth-child(2) { border-left: 1px solid var(--border); padding-left: 12px; }
.panel, .auth { padding: 12px; border: 1px solid var(--border); border-radius: 0; background: var(--surface); }
.panel + .panel, section.panel + section, .exchange-tools > .panel { margin-top: 8px; }
.grid > .panel, .split > .panel { margin-top: 0; }
.panel > :last-child, .auth > :last-child { margin-bottom: 0; }
.auth { width: min(100%, 460px); margin: 24px auto; }
.empty-state { padding: 16px 12px; border: 1px solid var(--border); border-radius: 0; color: var(--muted); }

/* Native checkboxes remain compact. Their containing label is the touch target. */
label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; font-weight: 500; }
input, textarea, select { font: inherit; color: #e4e4e7; color-scheme: dark; background: #252526; border: 1px solid #626269; border-radius: 2px; min-width: 0; max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select { width: 100%; min-height: 44px; padding: 6px 8px; }
textarea { min-height: 104px; resize: vertical; line-height: 1.45; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 20px; padding: 0; margin: 0 6px 0 0; flex: 0 0 auto; accent-color: var(--accent); vertical-align: middle; }
label:has(input[type="checkbox"]), label:has(input[type="radio"]) { flex-direction: row; align-items: center; min-height: 44px; font-weight: 400; }
label:has(input[type="checkbox"]) > span, label:has(input[type="radio"]) > span { min-width: 0; }
input[type="file"] { font-size: 13px; }
input[type="file"]::file-selector-button { min-height: 44px; min-width: 44px; margin-right: 8px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 2px; background: var(--toolbar); color: #e4e4e7; font: inherit; cursor: pointer; }
fieldset { margin: 12px 0; padding: 10px; border: 1px solid var(--border); border-radius: 0; }
legend { max-width: 100%; padding: 0 6px; font-weight: 600; overflow-wrap: anywhere; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; max-width: 100%; margin: 2px 4px 2px 0; padding: 4px 10px; border: 1px solid #7195c0; border-radius: 2px; background: #35577f; color: #f3f6fc; font: inherit; font-weight: 500; line-height: 1.35; text-align: center; text-decoration: none; white-space: normal; cursor: pointer; }
button:hover:not(:disabled), .button:hover { background: #406995; }
button:disabled { opacity: .55; cursor: not-allowed; }
.secondary, .button.secondary { color: #e4e4e7; background: var(--toolbar); border-color: #626269; }
.secondary:hover:not(:disabled), .button.secondary:hover { background: #39393e; }
.danger, .button.danger { color: #f1b0aa; background: #382b2b; border-color: #8e5c59; }
.danger:hover:not(:disabled), .button.danger:hover { background: #4b3030; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.inline { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.inline label { flex: 1 1 200px; margin: 0; }
.inline button { flex: 0 1 auto; margin: 0; }
.toolbar, #bulk-tools, .editor-actions, .preview-tabs, .bulk-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.toolbar button, #bulk-tools button, .editor-actions button, .preview-tabs button { margin: 0; }
#search-filters select { width: auto; flex: 1 1 160px; }
#bulk-tools { margin: 8px 0; padding: 4px 0; border: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: transparent; }
#bulk-tools label { margin: 0; }
#bulk-tools > .hint, .bulk-actions { flex-basis: 100%; }
#selection-count { margin: 0; font-size: 11px; color: var(--muted); }
#bulk-tools > .hint { font-size: 11px; margin: 0; }
.bulk-actions input, .bulk-actions select { flex: 1 1 160px; width: auto; }
.editor-actions { margin-top: 8px; }
.workspace-pane-switch { display: none; gap: 4px; margin: 0 0 10px; }
.workspace-pane-switch button { flex: 1 1 0; margin: 0; }
.workspace-pane-switch [aria-pressed="true"], .workspace-pane-switch [aria-selected="true"] { border-color: var(--accent); color: var(--accent); background: #303944; }

/* Hierarchy is real list structure; rows replace separate cards. */
.deck-tree, .deck-tree ul { list-style: none; margin: 0; padding: 0; }
.deck-tree ul { margin: 0 0 0 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.deck-tree li { min-width: 0; margin: 0; }
.deck-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 4px 8px; border: 0; border-bottom: 1px solid var(--border); min-height: 52px; }
.deck-row > div:first-child { min-width: 0; flex: 1 1 160px; }
.deck-row h2 { margin-bottom: 2px; font-size: 13px; }
.counts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.deck-actions, .note-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.deck-actions button, .note-actions button { margin: 0; }
.deck-actions details, .note-actions details { margin: 0; }
.deck-actions summary, .note-actions summary { border: 1px solid var(--border); border-radius: 2px; padding: 4px 8px; align-content: center; }
.deck-actions details[open], .note-actions details[open] { flex-basis: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 0; background: var(--sidebar); }
.deck-actions details[open] > button, .note-actions details[open] > button { margin: 4px 4px 0 0; }
#notes-list { max-height: 65dvh; overflow: auto; overscroll-behavior: contain; overflow-anchor: none; padding: 3px; }
#notes-list:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.note-table-head { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(60px, .4fr) 84px; align-items: center; gap: 6px; min-height: 32px; padding: 4px 8px; border-bottom: 1px solid var(--border); background: var(--toolbar); color: var(--muted); font-size: 12px; }
.note-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(60px, .4fr) 84px; align-items: center; gap: 4px 6px; border: 0; border-bottom: 1px solid var(--border); }
#notes-list .panel { margin: 0; padding: 4px 5px; }
.note-row > p { margin: 0; }
.note-row > p:not(.hint) { font-weight: 500; }
.note-row .hint { margin: 0; }
.note-row > button { margin: 0; padding: 4px 6px; }
.note-row > .note-actions, .note-row > section { grid-column: 2 / -1; }
.note-row > .note-actions { justify-self: end; grid-column: 5; grid-row: 1; }
.note-row > .note-actions > summary { width: 44px; min-height: 44px; padding: 0; font-size: 0; text-align: center; list-style: none; }
.note-row > .note-actions > summary::-webkit-details-marker { display: none; }
.note-row > .note-actions > summary::after { content: '⋯'; font-size: 20px; }
.note-row > .note-actions[open] { grid-column: 2 / -1; grid-row: auto; justify-self: stretch; }
.note-row > button { white-space: nowrap; }
#pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#note-editor { border: 0; border-left: 1px solid var(--border); padding-top: 0; }
#note-editor > details { border-top: 1px solid var(--border); padding-top: 6px; }
#draft-preview { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
#draft-preview .preview-tabs { margin: 8px 0; }
.preview-tabs [aria-selected="true"], .preview-tabs [aria-pressed="true"] { background: #35577f; color: #f3f6fc; border-color: var(--accent); }
#draft-preview iframe { display: block; width: 100%; height: clamp(220px, 40dvh, 460px); max-width: 100%; border: 1px solid var(--border); border-radius: 0; background: white; }

/* Card canvas deliberately white. No filter, inversion or inner-document rules. */
.review { max-width: 1000px; margin: 0 auto; }
.review .toolbar, #study-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
#study-tools button { margin: 0; }
iframe.card { display: block; width: 100%; max-width: 100%; height: clamp(180px, 40dvh, 480px); border: 1px solid var(--border); border-radius: 0; background: white; }
#review-controls { margin: 8px 0; }
#review-controls > button { min-height: 48px; }
.ratings { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 8px 0 max(8px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.ratings button { display: block; margin: 0; padding: 6px 4px; }
.ratings button:nth-child(1) { background: #442e30; color: #f1b0aa; border-color: #986461; }
.ratings button:nth-child(2) { background: #403927; color: #e7ce8d; border-color: #8a7d50; }
.ratings button:nth-child(4) { background: #293b4a; color: #b5d8f6; border-color: #6485a0; }
.ratings button:hover:not(:disabled) { border-color: currentColor; }
.ratings small { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; }
#study-timer { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* Data scrolls locally; expanded forms are never clipped to a fixed panel. */
details { min-width: 0; margin: 8px 0; }
summary { min-height: 44px; padding: 6px 0; cursor: pointer; font-weight: 500; }
details[open] > summary { margin-bottom: 6px; }
details.panel > summary { padding-top: 0; padding-bottom: 0; align-content: center; }
pre { max-width: 100%; margin: 8px 0; padding: 8px; background: #252526; border: 1px solid var(--border); border-radius: 0; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; tab-size: 2; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
textarea[spellcheck="false"] { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { color: #e4e4e7; background: var(--toolbar); font-weight: 600; }
img, video, canvas, svg { max-width: 100%; }
progress { max-width: 100%; accent-color: var(--accent); }
#backup-list .panel { padding: 8px; }
#outbox { flex: 0 0 auto; min-width: 0; margin: 8px 16px; padding: 10px; border: 1px solid #8a7d50; border-radius: 0; background: #343024; }
#notice { position: fixed; z-index: 60; top: calc(var(--topbar-height) + 8px); right: max(8px, env(safe-area-inset-right)); pointer-events: none; width: min(420px, calc(100vw - 16px)); max-width: calc(100vw - 16px); max-height: 25dvh; overflow: auto; padding: 8px 12px; border: 1px solid var(--border); border-radius: 2px; font-size: 13px; overflow-wrap: anywhere; }
#notice:empty { display: none; }
.error { color: #f1b0aa; background: #442e30; border-color: #986461; }
.success { color: #b8d7bf; background: #283a2d; border-color: #607e67; }
.statusbar { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; min-height: 24px; padding: 2px max(8px, env(safe-area-inset-right)) max(2px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-top: 1px solid var(--border); background: #252526; color: var(--muted); font-size: 11px; }
#connection, #pending-status { margin: 0; min-width: 0; }
#connection::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: middle; }
[hidden] { display: none !important; }

/* Real tree/pane controls supplied by the presentation module. */
.tree-row { display: flex; align-items: center; min-width: 0; min-height: 44px; }
.tree-toggle, .tree-spacer { flex: 0 0 44px; width: 44px; min-height: 44px; margin: 0; padding: 0; }
.tree-toggle { background: transparent; color: var(--muted); border-color: transparent; font-size: 18px; }
#workspace-tree .tree-row > a { flex: 1; min-width: 0; padding: 4px 8px 4px 0; }
.tree-label { min-width: 0; flex: 1; }
.tree-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.note-select { display: flex; justify-content: center; align-items: center; min-width: 44px; min-height: 44px; margin: 0; padding: 0; }
.note-select input { margin: 0; }
.note-table-head, .note-row { grid-template-columns: 44px minmax(0, 1fr) minmax(60px, .4fr) 84px 44px; }
.sidebar-context h2 { margin: 0; padding: 8px 12px; font-size: 11px; color: var(--muted); font-weight: 500; }
#workspace-info { position: relative; margin: 0; }
#workspace-info > summary { min-height: 20px; padding: 0 8px; font-size: 11px; }
#workspace-info > p { position: absolute; z-index: 45; right: 0; bottom: 100%; width: min(300px, calc(100vw - 16px)); margin: 0; padding: 12px; border: 1px solid var(--border); background: var(--sidebar); }
body:not(.authenticated) #workbench { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "workspace"; }
@media (min-width: 1101px) {
 body.authenticated:not(.sidebar-open) #workbench { grid-template-columns: 48px minmax(0, 1fr); grid-template-areas: "nav workspace"; }
}

@media (max-width: 1100px) {
  #workspace-content { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  #workbench { grid-template-columns: 48px minmax(0, 1fr); grid-template-areas: "nav workspace"; }
  #workspace-sidebar { display: none; position: fixed; z-index: 30; top: var(--topbar-height); bottom: 24px; left: 48px; width: min(288px, calc(100% - 48px)); overflow: auto; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  body.sidebar-open #workspace-sidebar { display: block; }
  #sidebar-backdrop { position: fixed; z-index: 25; top: var(--topbar-height); right: 0; bottom: 0; left: 48px; width: auto; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #0008; }
  main { padding: 12px; }
}

@media (pointer: coarse), (max-width: 1100px) {
  button, .button, nav a, summary, #workspace-tree a, .sidebar-context a { min-width: 44px; min-height: 44px; }
  input, textarea, select, input[type="file"] { font-size: 16px; }
  .statusbar a, .sidebar-heading a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  #workspace-info > summary { min-height: 44px; align-content: center; }
  .nav-admin a { padding-top: 6px; padding-bottom: 6px; }
}

@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
  .workbench-topbar { gap: 8px; }
  #workspace-context { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .workbench-topbar .context-divider { display: none; }
  .workspace-top-actions { flex-wrap: nowrap; }
  #workspace-create { font-size: 12px; white-space: nowrap; padding: 4px 6px; }
  #workbench { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "workspace" "nav"; }
  #nav { display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: stretch; border-right: 0; border-top: 1px solid var(--border); padding: 0 max(4px, env(safe-area-inset-right)) 0 max(4px, env(safe-area-inset-left)); }
  .nav-primary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .nav-primary a { flex-direction: column; gap: 1px; padding: 4px 2px; font-size: 10px; border-left: 0; border-top: 2px solid transparent; }
  .nav-primary a[aria-current="page"] { border-top-color: var(--accent); }
  .nav-primary a > span { position: static; width: auto; height: auto; margin: 0; clip-path: none; white-space: normal; }
  .nav-primary svg { width: 18px; height: 18px; }
  .nav-more { align-self: stretch; margin: 0; }
  .nav-more > summary { height: 100%; }
  .nav-admin { left: auto; right: max(4px, env(safe-area-inset-right)); bottom: 100%; width: min(320px, calc(100vw - 16px)); max-height: calc(var(--app-height, 100dvh) - 130px); }
  #workspace-sidebar { left: 0; bottom: 0; width: min(320px, 100%); }
  #sidebar-backdrop { left: 0; }
  main { padding: 10px 8px 16px; }
  .pagehead { gap: 6px; margin-bottom: 8px; padding-bottom: 8px; }
  .pagehead p { line-height: 1.4; }
  .workspace-pane-switch { display: flex; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .split > :first-child { padding-right: 0; }
  .split > :nth-child(2), #note-editor { border-left: 0; padding-left: 0; }
  main[data-note-pane="list"] #note-editor,
  main[data-note-pane="editor"] .note-list-pane,
  main[data-note-pane="preview"] .note-list-pane,
  main[data-note-pane="preview"] #note-editor > :not(#draft-preview):not(.preview-toolbar) { display: none; }
  main[data-note-pane="preview"] #draft-preview { display: block; margin-top: 0; padding-top: 0; border-top: 0; }
  main[data-note-pane="editor"] > #search, main[data-note-pane="editor"] > #search-filters,
  main[data-note-pane="preview"] > #search, main[data-note-pane="preview"] > #search-filters { display: none; }
  #notes-list { max-height: none; }
  .panel { padding: 8px; }
  .auth { margin: 12px auto; }
  .deck-row { gap: 4px 8px; padding: 4px; }
  .deck-actions { gap: 4px; }
  .deck-tree ul { margin-left: 4px; padding-left: 4px; }
  .deck-tree ul ul { margin-left: 0; padding-left: 0; border-left: 0; }
  .note-table-head { display: none; }
  .note-row { grid-template-columns: 44px minmax(0, 1fr) 90px 44px; gap: 2px 4px; }
  .note-row > .note-select { grid-row: 1 / span 2; }
  .note-row > p:not(.hint) { grid-column: 2; grid-row: 1; }
  .note-row > .hint { grid-column: 2; grid-row: 2; font-size: 11px; }
  .note-row > button { grid-column: 3; grid-row: 1 / span 2; }
  .note-row > .note-actions { grid-column: 4; grid-row: 1 / span 2; }
  .note-row > .note-actions[open] { grid-column: 2 / -1; grid-row: auto; }
  .ratings { gap: 4px; }
  .ratings small { font-size: 10px; }
  #outbox { margin: 8px; padding: 8px; }
  .statusbar { gap: 2px 8px; font-size: 10px; }
  th, td { padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
