/* Visual reference: MathModelAgent's inset sidebar, task shell and login page.
   Native HTML/CSS adaptation; no runtime dependency on the reference project. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --sidebar: hsl(48 33% 96%);
  --sidebar-active: hsl(45 29% 91%);
  --sidebar-line: hsl(45 18% 87%);
  --text: #202124;
  --muted: #6b6d72;
  --line: #e7e7e9;
  --soft: #f6f6f7;
  --accent: #242628;
  --accent-hover: #3c3e40;
  --on-accent: #ffffff;
  --focus: #5b8078;
  --success: #347367;
  --success-bg: #edf6f1;
  --pending: #86652c;
  --pending-bg: #faf4e8;
  --danger: #a53e3e;
  --danger-bg: #fdf2f2;
  --mint: #dce6e3;
  --mint-text: #1f2928;
  --mint-muted: #51635e;
  --mint-subtle: #566961;
  --shell-line: rgb(36 38 48 / 5%);
  --dialog-shadow: 0 24px 80px rgb(24 28 26 / 16%);
  --backdrop: rgb(20 26 23 / 32%);
  --shadow: 0 2px 8px rgb(36 38 48 / 4%);
  --radius: 8px;
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: var(--sidebar);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; }
.local-preview-banner { padding: 9px 16px; background: #fff5dc; color: #664d1a; text-align: center; font-size: 12px; line-height: 1.7; }
.local-preview .workspace { height: calc(100dvh - 39px); }
.local-preview .login-shell, .local-preview .login-visual, .local-preview .login-form-panel { min-height: calc(100dvh - 39px); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: .48; cursor: not-allowed; }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: var(--shadow); }
button.secondary:hover:not(:disabled) { background: var(--soft); border-color: var(--sidebar-line); }
button.danger { color: var(--danger); background: transparent; border-color: var(--line); }
button.danger:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }
button.icon-button { width: 34px; min-height: 34px; padding: 8px; flex-shrink: 0; color: var(--muted); background: transparent; }
button.icon-button:hover:not(:disabled) { background: var(--soft); color: var(--text); }
.icon { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.muted-icon { color: var(--muted); }
input, select, textarea { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px); background: var(--surface); color: var(--text); transition: border-color 160ms ease, box-shadow 160ms ease; }
input, select { min-height: 38px; }
textarea { resize: vertical; line-height: 1.8; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--sidebar-line); }
input::placeholder, textarea::placeholder { color: var(--muted); font-weight: 400; }
input:disabled, textarea:disabled { background: var(--soft); color: var(--muted); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
label { display: grid; align-content: start; gap: 8px; font-size: 13px; font-weight: 500; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { font-weight: 600; line-height: 1.4; }
h2 { font-size: 25px; letter-spacing: -.6px; }
h3 { font-size: 19px; }
a { color: var(--text); text-underline-offset: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }
.error { color: var(--danger); font-size: 13px; }
.error:empty { display: none; }
.brand-lockup { display: flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 600; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 34px; background: var(--accent); color: var(--on-accent); border-radius: var(--radius); }
.brand-mark .icon { width: 19px; height: 19px; }

/* The scene keeps its 76 x 42 proportions inside a 44 px tall hit target. */
.theme-control { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; flex-shrink: 0; min-width: 76px; min-height: 44px; }
.theme-caption { color: var(--muted); font-size: 12px; }
.dnt.theme-toggle { --dnt-focus: var(--focus); --dnt-edge: var(--sidebar-line); transition: none; }
.dnt.theme-toggle:hover:not(:disabled) { background: transparent; }
.login-theme { position: absolute; top: 24px; right: 32px; }
.header-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

/* Split login and focus-responsive geometric characters echo the reference. */
.login-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(384px, .95fr); min-height: 100dvh; background: var(--surface); }
.login-visual { display: flex; flex-direction: column; min-height: 100dvh; padding: 38px 46px 30px; overflow: hidden; background: var(--mint); color: var(--mint-text); }
.login-visual .brand-mark { color: #fff; background: #293532; }
.login-story { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding-top: 48px; }
.login-story h2 { width: min(100%, 500px); font-size: clamp(28px, 2.6vw, 38px); font-weight: 600; line-height: 1.4; letter-spacing: -1px; }
.login-story > p { width: min(100%, 500px); margin-top: 16px; color: var(--mint-muted); font-size: 14px; }
.login-footer { font-size: 12px; color: var(--mint-subtle); margin-top: 28px; }
.login-form-panel { position: relative; display: grid; place-items: center; min-width: 0; min-height: 100dvh; padding: 96px 48px 48px; }
.login-form { width: min(100%, 370px); display: grid; gap: 22px; }
.login-form-heading { margin-bottom: 8px; }
.login-form-heading .brand-mark { width: 40px; height: 40px; margin-bottom: 22px; }
.login-form-heading h1 { font-size: 30px; letter-spacing: -.8px; margin-bottom: 8px; }
.login-form input { min-height: 46px; }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
#login-button { min-height: 46px; }
.login-help { font-size: 12px; text-align: center; }
.mascot-frame { width: min(100%, 500px); height: 365px; display: flex; align-items: flex-end; justify-content: center; margin-top: 36px; overflow: hidden; }
.mascot-stage { position: relative; width: 500px; height: 365px; flex: 0 0 500px; transform-origin: bottom center; }
.character { position: absolute; bottom: 0; transform-origin: bottom center; transition: transform 420ms cubic-bezier(.22, 1, .36, 1); }
.character-teal { left: 62px; z-index: 1; width: 174px; height: 365px; background: #397d75; border-radius: 10px 10px 0 0; }
.character-charcoal { left: 226px; z-index: 2; width: 118px; height: 292px; background: #292d32; border-radius: 8px 8px 0 0; }
.character-coral { left: 4px; z-index: 3; width: 235px; height: 190px; background: #ed8b72; border-radius: 118px 118px 0 0; }
.character-yellow { left: 304px; z-index: 4; width: 142px; height: 220px; background: #e0c953; border-radius: 72px 72px 0 0; }
.eyes { position: absolute; display: flex; align-items: center; transition: transform 260ms ease; }
.eyes-teal { top: 66px; left: 52px; gap: 22px; }
.eyes-charcoal { top: 34px; left: 27px; gap: 20px; }
.eyes-coral { top: 86px; left: 88px; gap: 31px; }
.eyes-yellow { top: 46px; left: 49px; gap: 24px; }
.eye { display: flex; width: 26px; height: 26px; align-items: center; justify-content: center; overflow: hidden; border-radius: 50%; background: #fff; transition: height 180ms ease; }
.eye-small { width: 18px; height: 18px; }
.pupil { width: 9px; height: 9px; border-radius: 50%; background: #22272b; transition: transform 240ms ease; }
.eye-small .pupil { width: 6px; height: 6px; }
.dot-eye { width: 12px; height: 12px; border-radius: 50%; background: #272b30; transition: transform 240ms ease, height 180ms ease; }
.mouth { position: absolute; top: 90px; left: 43px; width: 58px; height: 4px; border-radius: 4px; background: #272b30; }
.login-shell:has(input:focus) .character-teal { transform: rotate(-1.5deg) translateX(4px); }
.login-shell:has(input:focus) .character-charcoal { transform: rotate(2deg) translateX(5px); }
.login-shell:has(input:focus) .pupil, .login-shell:has(input:focus) .dot-eye { transform: translate(4px, -1px); }
.login-shell:has(#password:focus) .eye, .login-shell:has(#password:focus) .dot-eye { height: 4px; }

/* Inset white work surface and compact navigation from MathModelAgent. */
.workspace { display: grid; grid-template-columns: 244px minmax(0, 1fr); height: 100dvh; min-height: 640px; background: var(--sidebar); }
.sidebar { min-width: 0; display: flex; flex-direction: column; padding: 20px 12px 12px; overflow: auto; }
.sidebar-brand { min-height: 42px; gap: 10px; padding: 0 7px; margin-bottom: 22px; }
.sidebar-copy { min-width: 0; }
.sidebar .brand { font-size: 13px; font-weight: 650; line-height: 1.4; }
.sidebar h1 { font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 3px; letter-spacing: .3px; }
.new-entry { width: 100%; justify-content: flex-start; padding-left: 13px; }
.navigation-group { margin-top: 28px; }
.sidebar-section-label { padding: 0 12px 10px; color: var(--muted); font-size: 11px; font-weight: 500; }
nav { display: grid; gap: 5px; }
.nav-button { display: flex; width: 100%; min-height: 40px; justify-content: flex-start; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; background: transparent; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 400; white-space: nowrap; }
.nav-button:hover:not(:disabled), .nav-button.active { background: var(--sidebar-active); color: var(--text); }
.nav-button.active { font-weight: 500; }
.sidebar-bottom { display: grid; gap: 8px; margin-top: auto; padding-top: 32px; }
.sidebar-note { display: flex; align-items: flex-start; gap: 9px; padding: 0 12px 22px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.sidebar-note .icon { margin-top: 2px; width: 15px; height: 15px; }
.account-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; padding: 16px 10px 4px; border-top: 1px solid var(--sidebar-line); }
.account-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border: 1px solid var(--sidebar-line); border-radius: 7px; background: var(--sidebar-active); font-size: 12px; }
.account-row p { font-size: 12px; font-weight: 500; }
.account-row .muted { font-size: 11px; }
.main-shell { display: flex; flex-direction: column; min-width: 0; min-height: 0; margin: 8px 8px 8px 0; overflow: hidden; border: 1px solid var(--shell-line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.app-header { display: flex; min-height: 56px; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.header-breadcrumb { display: flex; align-items: center; min-width: 0; gap: 10px; font-size: 12px; }
.header-divider { height: 17px; width: 1px; background: var(--line); }
.header-root { color: var(--muted); }
.breadcrumb-chevron { width: 13px; height: 13px; color: var(--muted); }
#breadcrumb-current { font-weight: 500; }
.header-purpose { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 3px 9px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); font-size: 11px; }
.header-purpose .icon { width: 13px; height: 13px; }
.workbench { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; padding: 26px 28px 24px; }
.page-head { flex-shrink: 0; margin-bottom: 22px; }
.page-head p { margin-top: 7px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; flex-shrink: 0; gap: 10px; margin-bottom: 22px; }
.search-label { position: relative; flex: 1; min-width: 180px; }
.search-label > .icon { position: absolute; top: 12px; left: 12px; width: 15px; height: 15px; pointer-events: none; color: var(--muted); }
.search-label input { padding-left: 36px; }
.status-filter { min-width: 130px; }
.toolbar > button { min-height: 38px; }
.content-grid { display: grid; grid-template-columns: minmax(270px, .9fr) minmax(320px, 1.4fr); gap: 20px; flex: 1; min-height: 0; }
.list-pane, .detail-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pane-heading { display: flex; min-height: 48px; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; }
.count-label { color: var(--muted); font-size: 11px; font-weight: 400; }
.list-loading { flex-shrink: 0; font-size: 12px; color: var(--muted); }
.list-loading:not(:empty) { padding: 9px 18px; background: var(--soft); border-bottom: 1px solid var(--line); }
#records { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
#records[aria-busy=true] { opacity: .6; }
.record { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; gap: 10px; width: 100%; text-align: left; white-space: normal; background: transparent; color: var(--text); padding: 16px 12px; border: 1px solid transparent; border-radius: 7px; font-weight: 400; }
.record + .record { margin-top: 3px; }
.record:hover:not(:disabled) { background: var(--soft); }
.record.selected { background: var(--sidebar); border-color: var(--sidebar-line); }
.record-symbol { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); }
.record.selected .record-symbol { color: var(--text); }
.record-symbol .icon { width: 15px; height: 15px; }
.record-copy { min-width: 0; }
.record-title { display: block; font-size: 13px; font-weight: 500; line-height: 1.65; overflow-wrap: anywhere; }
.record-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.5; }
.badge.published, .badge.resolved { background: var(--success-bg); color: var(--success); }
.badge.draft, .badge.pending, .badge.reviewing { background: var(--pending-bg); color: var(--pending); }
.pagination { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.pagination button { min-height: 30px; padding: 5px 10px; font-size: 11px; box-shadow: none; }
.detail-pane { min-height: 0; flex: 1; padding: 26px; overflow-y: auto; overscroll-behavior: contain; }
.detail-heading { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.detail-heading h3 { margin-top: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.detail-kicker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-kicker > .muted { font-size: 11px; }
.detail-section { margin: 24px 0; }
.detail-section h4 { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 500; }
.detail-section h4 .icon { width: 14px; height: 14px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.95; font-size: 13px; }
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.detail-actions button { font-size: 12px; }
.detail-pane label { margin-top: 18px; }
.reference-details { padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); }
summary { cursor: pointer; color: var(--muted); font-size: 12px; }
summary:hover { color: var(--text); }
.reference-snapshot { margin: 14px 0 0; font: 11px/1.8 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; height: 100%; padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--sidebar); box-shadow: var(--shadow); }
.empty-icon .icon { width: 22px; height: 22px; }
.empty h3 { margin-bottom: 8px; color: var(--text); font-size: 15px; font-weight: 500; }
.empty p { max-width: 240px; font-size: 12px; }
.notice { display: flex; flex-shrink: 0; align-items: flex-start; gap: 9px; padding: 11px 14px; margin-bottom: 18px; border: 1px solid var(--sidebar-line); border-radius: 7px; background: var(--sidebar); color: var(--text); font-size: 12px; }
.notice::before { content: ''; display: block; flex: 0 0 6px; height: 6px; border-radius: 50%; background: var(--success); margin-top: 7px; }
.notice.error { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.notice.error::before { background: var(--danger); }
.revision { margin-bottom: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.revision summary { padding: 11px 13px; }
.revision-body { padding: 0 13px 13px; }
.revision .muted { font-size: 11px; margin-bottom: 8px; }
.revision pre { padding: 12px; margin: 12px 0 0; border-radius: 6px; background: var(--soft); font-family: inherit; font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }

/* A fixed heading and action bar keep long reviews navigable. */
dialog { width: min(820px, calc(100% - 40px)); max-height: calc(100dvh - 48px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); box-shadow: var(--dialog-shadow); }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog[open] { animation: panel-enter 200ms cubic-bezier(.22, 1, .36, 1); }
#entry-form { display: flex; flex-direction: column; max-height: calc(100dvh - 50px); }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; padding: 22px 28px; border-bottom: 1px solid var(--line); }
.editor-heading .muted { margin-bottom: 4px; font-size: 11px; }
.editor-heading h2 { font-size: 20px; }
.editor-body { display: grid; gap: 22px; min-height: 0; padding: 26px 28px; overflow-y: auto; overscroll-behavior: contain; }
.editor-grid { display: grid; grid-template-columns: 1.2fr 1fr; align-items: start; gap: 20px; }
.editor-help { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px; border-radius: 7px; background: var(--sidebar); color: var(--muted); font-size: 12px; }
.editor-help .icon { width: 15px; height: 15px; margin-top: 3px; }
.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; padding: 16px 28px; border-top: 1px solid var(--line); background: var(--surface); }
.editor-actions > div { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
#records, .detail-pane, .editor-body, .sidebar { scrollbar-width: thin; scrollbar-color: var(--sidebar-line) transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes panel-enter { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (min-width: 801px) {
  .workspace.sidebar-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
  .sidebar-collapsed .sidebar { padding-left: 8px; padding-right: 8px; }
  .sidebar-collapsed .sidebar-brand { padding: 0; justify-content: center; }
  .sidebar-collapsed .sidebar-label, .sidebar-collapsed .sidebar-copy { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sidebar-collapsed .sidebar-note, .sidebar-collapsed .sidebar-section-label { display: none; }
  .sidebar-collapsed .nav-button, .sidebar-collapsed .new-entry { justify-content: center; padding-left: 8px; padding-right: 8px; }
  .sidebar-collapsed .account-row { padding-left: 0; padding-right: 0; justify-content: center; }
}
@media (max-width: 1200px) {
  .workspace { grid-template-columns: 216px minmax(0, 1fr); }
  .workbench { padding: 24px 20px 20px; }
  .content-grid { gap: 14px; }
  .detail-pane { padding: 22px; }
  .mascot-frame { height: 292px; }
  .mascot-stage { transform: scale(.8); }
}
@media (max-width: 1100px) {
  .workspace { height: auto; min-height: 100dvh; }
  .sidebar { position: sticky; top: 0; height: 100dvh; }
  .main-shell { min-height: calc(100dvh - 16px); }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  #records { max-height: 330px; }
  .detail-pane { min-height: 380px; }
  .empty { min-height: 240px; }
}
@media (max-width: 1023px) {
  .local-preview .login-visual, .local-preview .login-form-panel { min-height: 0; }
  .login-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 250px minmax(0, 1fr); }
  .login-visual { min-height: 0; padding: 22px 28px 0; }
  .login-story { padding-top: 0; justify-content: flex-end; }
  .login-story h2, .login-story > p, .login-footer { display: none; }
  .mascot-frame { height: 178px; margin-top: 12px; }
  .mascot-stage { transform: scale(.48); }
  .login-form-panel { min-height: 0; padding: 84px 24px 40px; align-items: start; }
  .login-theme { top: 16px; right: 24px; }
  .login-form-heading .brand-mark { display: none; }
}
@media (max-width: 800px) {
  .local-preview .workspace { height: auto; }
  .workspace { display: block; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 18px 16px; overflow: visible; }
  .sidebar-brand { margin: 0; padding: 0; }
  .new-entry { width: auto; padding-left: 12px; align-self: center; }
  .navigation-group { grid-column: 1 / -1; margin: 0; }
  .sidebar-section-label, .sidebar-note { display: none; }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .nav-button { justify-content: center; gap: 7px; font-size: 12px; padding: 8px; }
  .sidebar-bottom { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0; margin: 0; }
  .sidebar-bottom .nav-button { width: auto; min-height: 32px; }
  .account-row { margin: 0; padding: 0; border: 0; flex: 1; }
  .account-row .sidebar-copy > p { display: none; }
  .account-avatar { width: 24px; height: 24px; font-size: 10px; }
  .main-shell { margin: 0 8px 8px; min-height: 640px; }
  .app-header { padding: 0 16px; min-height: 48px; }
  #sidebar-toggle, .header-divider { display: none; }
  .workbench { padding: 22px 16px; }
  .page-head { margin-bottom: 18px; }
  .page-head h2 { font-size: 23px; }
  .toolbar { gap: 8px; margin-bottom: 18px; }
  .search-label { flex-basis: 100%; }
  .status-filter { flex: 1; }
  .detail-pane { padding: 20px; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .editor-heading, .editor-body { padding: 20px; }
  .editor-actions { padding: 14px 20px; flex-wrap: wrap; gap: 10px; }
  .editor-actions button { min-height: 40px; font-size: 12px; }
}
@media (max-width: 420px) {
  .header-purpose { display: none; }
  .nav-button .icon { width: 15px; height: 15px; }
  nav .nav-button { flex-direction: column; gap: 4px; font-size: 11px; }
  dialog { width: calc(100% - 20px); }
  .editor-actions > div { width: 100%; }
  .editor-actions > div button { flex: 1; }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #202322; --surface: #202322; --sidebar: #191c1b;
  --sidebar-active: #303632; --sidebar-line: #424944;
  --text: #e8ebe8; --muted: #a6afa9; --line: #373c39;
  --soft: #292e2b; --accent: #e5eae6; --accent-hover: #cdd8d0; --on-accent: #202823;
  --focus: #93b4a7; --success: #a0c6b2; --success-bg: #263c31;
  --pending: #dbc18a; --pending-bg: #383429; --danger: #e7aaaa; --danger-bg: #402b2b;
  --mint: #283e36; --mint-text: #e2eee7; --mint-muted: #b3c9bd; --mint-subtle: #b3c9bd;
  --shell-line: var(--line); --shadow: 0 2px 8px rgb(0 0 0 / 10%);
  --dialog-shadow: 0 24px 80px rgb(0 0 0 / 32%); --backdrop: rgb(8 13 10 / 60%);
}
@media (prefers-reduced-motion: no-preference) {
  :root, .workspace, .main-shell, .login-shell, .login-visual, .login-story > p, .login-footer,
  .list-pane, .detail-panel, .record-symbol, .empty-icon, .badge, .notice, .revision,
  .reference-details, .revision pre, .editor-help, .editor-actions, dialog {
    transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .login-shell:has(input:focus) .character, .login-shell:has(input:focus) .pupil, .login-shell:has(input:focus) .dot-eye { transform: none; }
}
