/* Midnight Ink visual attribution: Emily/server/static/css/style.css lines 7-99
   (minimal palette, typography, radius, spacing and focus tokens only).
   Layout reference: Emily/server/static/index.html sidebar/topbar;
   entry card and white Google button: Emily/server/static/login.html.
   No Emily authentication, application code, remote fonts or assets are copied. */
:root {
  color-scheme: dark;
  --color-bg: #080c14;
  --color-surface: #0d1120;
  --color-surface-2: #121828;
  --color-card: #151c2c;
  --color-elevated: #1e2840;
  --color-accent: #3b82f6;
  --color-accent-light: #60a5fa;
  --color-text-accent: #93c5fd;
  --accent-cyan: #22d3ee;
  --color-text: #e8edf8;
  --color-text-dim: #a0aec6;
  --border: rgb(255 255 255 / 10%);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-xl: 24px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, monospace;
  --focus-ring: 2px solid var(--accent-cyan);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font-family: var(--font-sans); font-size: 1rem; line-height: 1.6; }
a { color: var(--color-text-accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-cyan); }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
button { color: inherit; }
button, input, textarea, select { max-width: 100%; }
button, a, summary, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: var(--focus-ring); outline-offset: 4px; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { line-height: 1.25; text-wrap: balance; }
h1 { margin: 0.5rem 0 1rem; font-size: clamp(1.8rem, 3.2vw, 2.8rem); letter-spacing: -0.04em; }
p { margin: 0 0 1rem; }
code, pre, .document-path { font-family: var(--font-mono); }
.muted { color: var(--color-text-dim); }
.eyebrow { margin: 0; color: var(--accent-cyan); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }
.skip-link { position: fixed; top: 0.75rem; left: 0.75rem; padding: 0.75rem 1rem; background: var(--color-elevated); z-index: 10; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.55rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8125rem; font-weight: 600; text-decoration: none; line-height: 1.4; }
.button-primary { background: #2563c9; border-color: var(--color-accent); color: #fff; }
.button-primary:hover { background: #1d52ae; color: #fff; }
.button-quiet { background: transparent; color: var(--color-text-dim); }
.button-quiet:hover { background: var(--color-elevated); color: var(--color-text); }
.brand-mark { display: inline-flex; flex: 0 0 auto; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid rgb(96 165 250 / 35%); border-radius: 10px; background: linear-gradient(135deg, rgb(59 130 246 / 20%), rgb(6 182 212 / 12%)); color: var(--accent-cyan); font-size: 1.1rem; font-weight: 800; }

/* Private reader shell; no fixed content width may push the viewport sideways. */
.portal-layout { --sidebar-width: 290px; --topbar-height: 76px; display: grid; grid-template-columns: var(--sidebar-width) 0 minmax(0, 1fr); min-height: 100vh; }
.portal-layout.layout-adjustable { grid-template-columns: var(--sidebar-width) 8px minmax(0, 1fr); }
.portal-layout.sidebar-collapsed { grid-template-columns: 0 0 minmax(0, 1fr); }
.sidebar { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; min-width: 0; padding: 1.5rem 1rem 1rem; border-right: 1px solid var(--border); background: var(--color-surface); }
.brand { display: flex; min-height: 44px; align-items: center; gap: 0.75rem; padding: 0 0.25rem; margin-bottom: 1.75rem; color: var(--color-text); font-size: 1rem; font-weight: 750; text-decoration: none; letter-spacing: 0.03em; }
.brand-secondary { color: var(--color-text-dim); font-weight: 400; }
.brand > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.navigation-panel { min-height: 0; overflow-y: auto; scrollbar-color: var(--color-elevated) transparent; }
.navigation-toggle { min-height: 44px; padding: 0.65rem 0.5rem; color: var(--color-text-dim); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.navigation-hint { display: none; }
.navigation-body { padding: 0.5rem 0.25rem; }
.filter-form { margin-bottom: 1.5rem; }
.filter-form label, .error-report label { display: block; margin-bottom: 0.5rem; color: var(--color-text-dim); font-size: 0.75rem; }
.filter-form input { width: 100%; min-height: 44px; padding: 0.65rem 0.75rem; border: 1px solid rgb(255 255 255 / 18%); border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); font-size: 0.8125rem; }
.filter-form input::placeholder { color: var(--color-text-dim); opacity: 1; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.filter-actions .button { flex: 1; }
.document-tree { list-style: none; margin: 0; padding: 0; }
.document-tree .document-tree { margin-left: 0.65rem; padding-left: 0.55rem; border-left: 1px solid var(--border); }
.tree-folder > summary { min-height: 44px; padding: 0.65rem 0.4rem; font-size: 0.8125rem; font-weight: 600; overflow-wrap: anywhere; }
.tree-folder > summary::marker { color: var(--color-text-dim); }
.document-link { display: flex; min-height: 44px; align-items: center; padding: 0.65rem 0.6rem; border-radius: var(--radius-sm); color: var(--color-text-dim); font-size: 0.8125rem; text-decoration: none; line-height: 1.5; overflow-wrap: anywhere; }
.document-link:hover { background: var(--color-surface-2); color: var(--color-text); }
.document-link[aria-current="page"] { background: rgb(59 130 246 / 15%); color: var(--color-text-accent); box-shadow: inset 2px 0 var(--color-accent); }
.index-link { margin-bottom: 0.5rem; }
.navigation-empty { padding: 0.5rem; font-size: 0.8125rem; }
.sidebar-footer { margin-top: auto; padding: 1.5rem 0.5rem 0; color: var(--color-text-dim); font-size: 0.75rem; }
.sidebar-footer span { display: block; font-size: 0.6875rem; }
.reader-layout { grid-column: 3; grid-row: 1; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; position: sticky; top: 0; z-index: 2; min-height: var(--topbar-height, 76px); align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0 clamp(1rem, 2.5vw, 2.5rem) 8px; border-bottom: 1px solid var(--border); background: var(--color-surface); }
.topbar-navigation { display: flex; flex-wrap: wrap; min-width: 0; align-items: center; gap: 0.25rem 0.75rem; }
.sidebar-toggle { flex-shrink: 0; }
.sidebar-toggle svg { flex-shrink: 0; }
.sidebar-collapsed .sidebar-toggle svg { transform: scaleX(-1); }
.topbar-section { display: inline-flex; min-height: 44px; align-items: center; color: var(--color-text); font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.account-controls { display: flex; min-width: 0; flex: 1; justify-content: flex-end; align-items: center; gap: 1rem; }
.person-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-dim); font-size: 0.8125rem; }
.account-controls form { flex-shrink: 0; }
.reader-main { width: 100%; max-width: 1360px; margin: 0 auto; padding: 2rem clamp(1rem, 3.5vw, 3.5rem) 3rem; }
.sidebar-collapsed .reader-main { max-width: none; }
.layout-splitter { touch-action: none; user-select: none; }
.layout-splitter::after { content: ""; position: absolute; border-radius: 3px; background: var(--color-text-dim); opacity: 0.5; }
.layout-splitter:hover, .layout-splitter:focus-visible { background: rgb(59 130 246 / 16%); }
.layout-splitter:hover::after, .layout-splitter:focus-visible::after { background: var(--accent-cyan); opacity: 1; }
.sidebar-splitter { grid-column: 2; grid-row: 1; position: sticky; top: 0; width: 8px; height: 100vh; height: 100dvh; cursor: col-resize; background: var(--color-surface); }
.sidebar-splitter::after { width: 3px; height: 36px; top: calc(50% - 18px); left: 2px; }
.topbar-splitter { position: absolute; bottom: 0; left: 0; width: 100%; height: 8px; cursor: row-resize; }
.topbar-splitter::after { width: 40px; height: 3px; top: 2px; left: calc(50% - 20px); }
.resizing-sidebar, .resizing-sidebar * { cursor: col-resize !important; user-select: none !important; }
.resizing-topbar, .resizing-topbar * { cursor: row-resize !important; user-select: none !important; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; list-style: none; margin: 0 0 1.5rem; padding: 0; font-size: 0.75rem; color: var(--color-text-dim); }
.breadcrumbs li { min-width: 0; overflow-wrap: anywhere; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 0.5rem; }
.breadcrumbs a { display: inline-flex; min-height: 44px; align-items: center; }
.breadcrumbs li > span { display: inline-flex; min-height: 44px; align-items: center; }
.document-heading { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.document-heading p:last-child { margin-bottom: 0; }
.document-path { color: var(--color-text-dim); font-size: 0.75rem; overflow-wrap: anywhere; }
.document-content { min-width: 0; overflow-x: auto; overflow-wrap: anywhere; line-height: 1.8; }
.document-content > :first-child { margin-top: 0; }
.document-content :is(h1, h2, h3, h4, [id]) { scroll-margin-top: calc(var(--topbar-height) + 1rem); }
.document-content :is(h1, h2, h3, h4) { margin-top: 2rem; margin-bottom: 1rem; }
.document-content h1 { font-size: 2rem; }
.document-content h2 { font-size: 1.5rem; }
.document-content h3 { font-size: 1.2rem; }
.document-content h4 { font-size: 1rem; }
.document-content :is(p, ul, ol, blockquote, pre, table) { margin-bottom: 1.25rem; }
.document-content li { margin-bottom: 0.35rem; }
.document-content a { overflow-wrap: anywhere; }
.document-content blockquote { margin-left: 0; margin-right: 0; padding: 0.75rem 1.25rem; border-left: 3px solid var(--color-accent); background: var(--color-surface); color: var(--color-text-dim); }
.document-content blockquote p:last-child { margin-bottom: 0; }
.document-content pre { max-width: 100%; overflow-x: auto; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 0.8125rem; line-height: 1.65; }
.document-content :not(pre) > code { padding: 0.15em 0.35em; border-radius: 4px; background: var(--color-elevated); font-size: 0.875em; }
.document-content img { max-width: 100%; height: auto; }
.document-content hr { margin: 2rem 0; border: 0; border-top: 1px solid var(--border); }
/* Keep table cell/inline financial styling intact; only the wrapper scrolls. */
.table-scroll { max-width: 100%; margin-bottom: 1.25rem; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.document-content table { border-collapse: collapse; font-size: 0.8125rem; line-height: 1.6; }
.table-scroll > table { margin-bottom: 0; }
.document-content :is(th, td) { padding: 0.75rem 0.9rem; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.document-content th { background: var(--color-elevated); font-weight: 600; }
.document-content td { background: var(--color-surface); }
.document-index { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--color-surface); }
.index-list { margin: 0; padding: 0; list-style: none; }
.index-list li + li { border-top: 1px solid var(--border); }
.index-list a { display: flex; min-height: 64px; flex-direction: column; justify-content: center; gap: 0.3rem; padding: 1rem 0.25rem; text-decoration: none; overflow-wrap: anywhere; }
.index-list a:hover > span:first-child { text-decoration: underline; }
.empty-state { padding: 2rem 0.5rem; }
.empty-state h2 { margin-top: 0; font-size: 1.25rem; }
.empty-state p { color: var(--color-text-dim); }
.release-details { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); color: var(--color-text-dim); font-size: 0.6875rem; overflow-wrap: anywhere; }
.release-details dl { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin: 1rem 0; }
.release-details dt { margin-bottom: 0.2rem; }
.release-details dd { margin: 0; color: var(--color-text); }
.release-details code { font-size: 0.75rem; }

/* Comments never reserve a reader column. The mobile panel stays in document flow. */
.document-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.comments-panel { min-width: 0; margin: 0 0 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--color-surface); scroll-margin-top: calc(var(--topbar-height, 76px) + 1rem); }
.comments-panel[open] { position: fixed; z-index: 3; top: calc(var(--topbar-height, 76px) + 1rem); right: 1rem; width: min(460px, calc(100vw - 2rem)); max-height: calc(100vh - var(--topbar-height, 76px) - 2rem); max-height: calc(100dvh - var(--topbar-height, 76px) - 2rem); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 12px 48px rgb(0 0 0 / 55%); scrollbar-color: var(--color-elevated) transparent; }
.comments-summary { position: sticky; top: 0; z-index: 1; min-height: 44px; padding: 0.75rem 1rem; background: var(--color-surface-2); border-radius: var(--radius-md) var(--radius-md) 0 0; font-size: 0.875rem; font-weight: 700; }
.comments-panel-body { padding: 1rem; overflow-wrap: anywhere; }
.comments-panel-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 1rem; }
.comments-panel-heading h2 { margin: 0; font-size: 1.15rem; }
.comment-help, .comment-meta { color: var(--color-text-dim); font-size: 0.75rem; }
.comment-section { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.comment-section h3 { margin: 0 0 1rem; font-size: 1rem; }
.comment-thread-list, .feedback-thread-list, .comment-messages { margin: 0; padding: 0; list-style: none; }
.comment-thread-card { min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--color-card); overflow-wrap: anywhere; }
.comment-thread-card + .comment-thread-card { margin-top: 0.75rem; }
.comment-thread-card[aria-current="true"] { border-color: var(--color-accent-light); }
.comment-thread-link { display: flex; min-height: 44px; align-items: center; font-weight: 600; }
.comment-status { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; margin: 0.35rem 0 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--color-text-dim); font-size: 0.75rem; }
.comment-status-open { color: var(--color-text-accent); border-color: rgb(96 165 250 / 35%); }
.comment-status-resolved { color: #a7f3d0; border-color: rgb(167 243 208 / 35%); }
.comment-status-dismissed { color: #fcdba1; border-color: rgb(252 219 161 / 35%); }
.comment-body, .comment-quote, .comment-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-preview { margin-bottom: 0.75rem; font-size: 0.875rem; }
.comment-thread-card .comment-meta:last-child { margin-bottom: 0; }
.comment-quote { margin: 0.75rem 0 1rem; padding: 0.75rem 1rem; border-left: 3px solid var(--color-accent); background: var(--color-bg); color: var(--color-text-dim); font-size: 0.875rem; }
.comment-notice, .comment-errors { margin: 1rem 0; padding: 1rem; border: 1px solid rgb(96 165 250 / 35%); border-radius: var(--radius-sm); background: var(--color-surface-2); font-size: 0.875rem; }
.comment-errors, .comment-danger-notice { border-color: rgb(252 165 165 / 55%); }
.comment-errors h2, .comment-errors h3 { margin-top: 0; font-size: 1rem; }
.comment-errors ul { padding-left: 1.25rem; }
.comment-errors a { display: inline-block; min-height: 44px; padding-block: 0.5rem; }
.comment-errors > :last-child, .comment-notice > :last-child { margin-bottom: 0; }
.comment-version { margin: 1rem 0; color: var(--color-text-dim); font-size: 0.75rem; }
.comment-version summary, .comment-delete-options summary { min-height: 44px; padding: 0.65rem 0; }
.comment-version dl { margin-top: 0.5rem; }
.comment-version dd { margin: 0 0 0.75rem; color: var(--color-text); overflow-wrap: anywhere; }
.comment-message { margin-top: 1rem; padding: 1rem 0; border-top: 1px solid var(--border); scroll-margin-top: calc(var(--topbar-height, 76px) + 1rem); }
.comment-message-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.75rem; font-size: 0.8125rem; }
.comment-message-heading time { color: var(--color-text-dim); font-size: 0.6875rem; }
.comment-body { font-size: 0.875rem; }
.comment-form { margin-top: 1rem; }
.comment-field label, .feedback-filters label { display: block; margin-bottom: 0.5rem; font-size: 0.8125rem; font-weight: 600; }
.comment-field textarea, .feedback-filters select { display: block; width: 100%; min-height: 44px; padding: 0.75rem; border: 1px solid rgb(255 255 255 / 25%); border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); }
.comment-field textarea { min-height: 140px; resize: vertical; }
.comment-field { margin-bottom: 0.75rem; }
.comment-field-errors { color: #fecaca; font-size: 0.8125rem; }
.comment-field [aria-invalid="true"], .comment-confirm [aria-invalid="true"] { outline: 1px solid #fca5a5; }
.comment-send-note { margin-top: 0.75rem; }
.comment-actions, .comment-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-block: 1rem; }
.comment-actions form { margin: 0; }
.comment-pagination { justify-content: space-between; font-size: 0.75rem; }
.comment-delete-options { margin-top: 1.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); color: var(--color-text-dim); font-size: 0.8125rem; }
.button-danger { border-color: rgb(252 165 165 / 60%); background: #542432; color: #ffe4e6; }
.button-danger:hover { background: #6b293b; color: #fff; }
button:disabled { opacity: 0.6; cursor: wait; }
.comment-confirm { display: flex; align-items: center; gap: 0.75rem; min-height: 44px; padding-block: 0.75rem; cursor: pointer; }
.comment-confirm input { flex: 0 0 auto; width: 24px; height: 24px; margin: 0; accent-color: var(--color-accent); }
.feedback-layout { --topbar-height: 76px; min-height: 100vh; }
.feedback-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 2rem clamp(1rem, 3.5vw, 3.5rem) 3rem; overflow-wrap: anywhere; }
.feedback-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; padding: 1rem; margin-bottom: 2rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--color-surface); }
.feedback-filters > div { flex: 1 1 180px; min-width: 0; }
.feedback-filters > div:nth-child(2) { flex-grow: 2; }
.feedback-group { margin-block: 2rem; }
.feedback-group h2 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.feedback-group h2 a, .comment-document-link { display: inline-flex; min-height: 44px; align-items: center; }
.feedback-thread-list { display: grid; gap: 0.75rem; }
.feedback-thread-list .comment-thread-card { margin: 0; }
.comment-delete-main { max-width: 800px; }
.document-content .comment-target-marker { display: block; scroll-margin-top: calc(var(--topbar-height, 76px) + 1rem); }
.document-content .comment-target-marker:target + .comment-context-link + *, .comment-target-highlight { outline: 2px solid var(--accent-cyan); outline-offset: 4px; }
.document-content .comment-context-link { display: inline-flex; min-height: 44px; align-items: center; padding: 0.5rem; font-size: 0.75rem; }

/* Centered Midnight Ink login/error card, adapted without inline CSS or script. */
.entry-layout { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding: 2rem 1rem; background: radial-gradient(ellipse at 12% 8%, rgb(59 130 246 / 9%), transparent 50%), radial-gradient(ellipse at 90% 90%, rgb(6 182 212 / 6%), transparent 50%); }
.entry-card { width: 100%; max-width: 460px; padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--color-card); box-shadow: 0 4px 24px rgb(0 0 0 / 35%), 0 0 32px rgb(59 130 246 / 6%); }
.entry-card > .brand-mark { width: 48px; height: 48px; margin-bottom: 2rem; font-size: 1.4rem; }
.entry-card h1 { margin-top: 0.75rem; font-size: 2.2rem; }
.entry-description { margin: 1.25rem 0 2rem; color: var(--color-text-dim); font-size: 0.875rem; }
.google-button { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.75rem 1rem; border: 1px solid #747775; border-radius: 4px; background: #fff; color: #1f1f1f; font-size: 0.875rem; font-weight: 500; line-height: 1.5; }
.google-button:hover { background: #f2f5fa; box-shadow: 0 2px 8px rgb(0 0 0 / 20%); }
.google-icon { flex-shrink: 0; }
.entry-note { margin: 1.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--border); color: var(--color-text-dim); font-size: 0.75rem; }
.entry-brand { display: inline-flex; min-height: 44px; align-items: center; font-weight: 700; text-decoration: none; }
.error-card { max-width: 620px; overflow-wrap: anywhere; }
.error-status { margin: 1.5rem 0 0; color: var(--accent-cyan); font: 1.25rem var(--font-mono); }
.error-identifiers { font-size: 0.75rem; }
.error-identifiers > div { margin-bottom: 0.75rem; }
.error-identifiers dt { color: var(--color-text-dim); }
.error-identifiers dd { margin: 0; }
.error-report { margin: 1.5rem 0; }
.error-report textarea { display: block; width: 100%; min-height: 160px; margin-bottom: 0.75rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); resize: vertical; font: 0.75rem/1.7 var(--font-mono); }
.copy-help, .copy-status { margin: 0.75rem 0 0; font-size: 0.75rem; }
.copy-status:empty { margin: 0; }
.error-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

@media (max-width: 1100px) {
  .sidebar-toggle { width: 44px; padding: 0; }
  .sidebar-toggle span { display: none; }
}

@media (max-width: 800px) {
  .portal-layout { display: block; }
  .sidebar { position: static; height: auto; padding: 1rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { margin-bottom: 0.75rem; }
  .navigation-panel { overflow: visible; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .navigation-toggle { padding: 0.75rem; }
  .navigation-hint { display: inline; float: right; color: var(--color-text-dim); font-size: 0.625rem; }
  .navigation-body { padding: 0.75rem; }
  .sidebar-footer { display: none; }
  .topbar { height: auto; min-height: 68px; gap: 0.5rem; padding: 0.75rem 1rem; }
  .layout-splitter { display: none; }
  .account-controls { gap: 0.5rem; }
  .person-name { max-width: 9rem; }
  .topbar-section { font-size: 0.75rem; }
  .reader-main { padding-top: 1.5rem; }
  .document-content :is(h1, h2, h3, h4, [id]) { scroll-margin-top: 8rem; }
  .document-content .comment-target-marker { scroll-margin-top: 10rem; }
  .comments-panel, .comments-panel[open] { position: static; width: 100%; max-width: none; max-height: 70vh; max-height: 70dvh; margin-bottom: 1.5rem; box-shadow: none; scroll-margin-top: 10rem; }
  .comments-panel[open] { overflow-y: auto; }
  .comments-panel-body { padding: 0.75rem; }
  .topbar-navigation { flex: 1 1 100%; }
  .account-controls { flex: 1 1 100%; justify-content: space-between; }
  .person-name { max-width: none; }
  .feedback-filters > div { flex-basis: 100%; }
}

@media (max-width: 400px) {
  .topbar { flex-wrap: wrap; }
  .account-controls { width: 100%; justify-content: space-between; }
  .person-name { max-width: none; }
  .entry-card h1 { font-size: 1.9rem; }
  .google-button { padding: 0.75rem; gap: 0.5rem; }
}

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

@media (forced-colors: active) {
  .document-link[aria-current="page"] { outline: 1px solid Highlight; }
  .brand-mark { border-color: ButtonText; }
}
