@font-face {
  font-family: "DM Sans";
  src: url("/static/vendor/dm-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/static/vendor/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #fcfaf6;
  --paper: #fffefa;
  --rail: #f7f3ed;
  --tint: #f9f5ef;
  --rule: #e9e0d7;
  --rule-strong: #ddd1c8;
  --ink: #302626;
  --muted: #6f6262;
  --subtle: #796c69;
  --plum: #74394d;
  --plum-dark: #59293c;
  --plum-light: #f3e7eb;
  --moss: #426454;
  --moss-light: #edf2ea;
  --amber: #875023;
  --amber-light: #faf0e2;
  --radius: 12px;
  --shadow: 0 12px 32px rgba(57, 34, 32, .10);
  --sans: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, "Noto Serif", "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink); font: 400 16px/1.52 var(--sans); }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }
a { color: var(--plum); text-underline-offset: 3px; }
a:hover { color: var(--plum-dark); }
svg { display: block; flex: 0 0 auto; }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 3px; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
small, .small { font-size: 13px; }
h1 { color: var(--ink); font: 400 clamp(2.45rem, 4.6vw, 3.35rem)/1.03 var(--serif); letter-spacing: -.027em; overflow-wrap: anywhere; }
h2 { font-size: 17px; letter-spacing: -.02em; line-height: 1.35; }
h3 { font-size: 15px; line-height: 1.35; letter-spacing: -.015em; }
code { font: .88em/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.app-shell { display: grid; grid-template-columns: 226px minmax(0,1fr); min-height: 100vh; }
.app-main { min-width: 0; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; align-self: start; height: 100vh; height: 100dvh; z-index: 6; background: var(--rail); border-right: 1px solid var(--rule); padding: 25px 15px 16px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 50px; padding: 0 7px; color: var(--ink); text-decoration: none; }
.brand > span:last-child { min-width: 0; }
.brand strong { display: block; font: 400 27px/1 var(--serif); letter-spacing: -.022em; white-space: nowrap; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; flex: 0 0 auto; background: var(--plum); color: #fff8f4; border-radius: 13px; }
.navigation { display: grid; gap: 4px; margin-top: 39px; }
.nav-label { padding: 0 10px 5px; color: var(--subtle); font-size: 11.5px; font-weight: 660; letter-spacing: .08em; text-transform: uppercase; }
.nav-label-secondary { margin-top: 20px; }
.nav-link { min-height: 44px; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border: 1px solid transparent; border-radius: 9px; color: #5f5150; text-decoration: none; font-size: 14px; font-weight: 550; }
.nav-link:hover { background: #f0eae3; color: var(--plum-dark); }
.nav-link.current { background: #efe3e8; border-color: #eadee2; color: var(--plum-dark); font-weight: 670; }
.nav-count { margin-left: auto; min-width: 23px; padding: 1px 5px; text-align: center; border-radius: 20px; background: #f0e4d6; color: #7c4a25; font-size: 12px; }
.profile { margin-top: auto; border-top: 1px solid var(--rule); padding-top: 13px; }
.profile summary { display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 5px 3px; }
.profile summary:hover { background: #f1eae4; }
.profile summary > svg { margin-left: auto; color: var(--muted); }
.profile-text { display: grid; min-width: 0; }
.profile-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.profile-text small { color: var(--muted); }
.profile form { margin: 4px 0 0 45px; }
.avatar { display: grid; flex: 0 0 auto; width: 33px; height: 33px; place-items: center; border-radius: 50%; background: #eadbd5; color: #6b463d; font-size: 13px; font-weight: 700; }
.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 30px; border-bottom: 1px solid var(--rule); background: var(--page); }
.topbar-start, .breadcrumb { display: flex; align-items: center; gap: 9px; min-width: 0; }
.breadcrumb { color: var(--muted); white-space: nowrap; font-size: 14px; }
.breadcrumb strong { font-weight: 670; color: var(--ink); }
.global-search { display: flex; flex: 0 1 326px; align-items: center; gap: 9px; min-width: 155px; border: 1px solid var(--rule); border-radius: 9px; padding: 0 10px; background: var(--paper); color: var(--muted); }
.global-search input { width: 100%; height: 36px; padding: 0; border: 0; outline: 0; background: transparent; min-width: 0; color: var(--ink); font-size: 14px; }
.global-search:focus-within { outline: 2px solid var(--plum); outline-offset: 2px; }
.global-search input::placeholder { color: #776967; opacity: 1; }
kbd { padding: 0 5px; border: 1px solid var(--rule); border-radius: 4px; color: var(--subtle); font: 12px/20px ui-monospace, monospace; }
.mobile-menu, .nav-backdrop { display: none !important; }
.flash { display: flex; gap: 9px; align-items: start; margin: 17px clamp(16px,3vw,38px) 0; padding: 10px 13px; border: 1px solid; border-radius: 9px; font-size: 14px; }
.flash svg { margin-top: 1px; }
.flash-error { background: #faece9; color: #822d32; border-color: #edcfca; }
.flash-info { background: var(--moss-light); color: var(--moss); border-color: #d6e3d5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 7px 12px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--ink); font-size: 14px; font-weight: 620; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.button-primary { border-color: var(--plum); background: var(--plum); color: #fffaf7; }
.button-primary:hover { border-color: var(--plum-dark); background: var(--plum-dark); color: #fffaf7; }
.button-secondary { border-color: var(--rule-strong); background: var(--paper); color: var(--plum-dark); }
.button-secondary:hover { background: var(--plum-light); color: var(--plum-dark); }
.button-quiet { color: var(--muted); }
.button-quiet:hover { background: #f3ece6; color: var(--plum-dark); }
.icon-button { display: inline-grid; min-width: 34px; min-height: 34px; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); text-decoration: none; }
.icon-button:hover { background: var(--plum-light); color: var(--plum); }
.text-link { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 660; text-decoration: none; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.symbol { display: inline-grid; align-items: center; justify-items: center; flex: 0 0 auto; width: 45px; height: 45px; border-radius: 12px; }
.symbol-soft { background: var(--tint); color: var(--plum); }
.symbol-rose { background: var(--plum-light); color: var(--plum); }

.chat-workspace { display: grid; grid-template-columns: minmax(0,1fr) minmax(285px,29.2%); min-height: calc(100vh - 70px); min-height: calc(100dvh - 70px); }
.chat-main { display: flex; flex-direction: column; min-width: 0; padding: 38px clamp(24px,3.25vw,52px) 19px; }
.chat-header { padding-bottom: 26px; border-bottom: 1px solid var(--rule); }
.chat-heading { display: flex; align-items: flex-start; gap: 15px; }
.chat-heading .symbol { width: 51px; height: 51px; margin-top: 3px; }
.chat-heading h1 { font-size: clamp(2.2rem, 4.2vw, 3.35rem); }
.chat-heading p, .page-heading p { margin-top: 10px; color: var(--muted); font-size: 15px; }
.conversation { display: flex; flex: 1; flex-direction: column; gap: 22px; padding-top: 25px; padding-bottom: 22px; }
.chat-start { align-content: center; min-height: 180px; margin: auto 0; padding: 22px 0; }
.chat-start h2 { color: var(--ink); font: 400 27px/1.2 var(--serif); letter-spacing: -.035em; }
.chat-start p { max-width: 410px; margin-top: 9px; color: var(--muted); font-size: 15px; }
.message { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.message-user { justify-content: end; }
.message-assistant { justify-content: start; }
.avatar-assistant { background: var(--plum-light); color: var(--plum); }
.avatar-user { background: #eadbd5; color: #69483e; }
.message-inner { max-width: min(92%, 610px); min-width: 0; padding: 12px 15px; border: 1px solid var(--rule); border-radius: 13px; background: var(--paper); }
.message-user .message-inner { max-width: min(85%, 555px); border-color: #eadce2; border-top-right-radius: 4px; background: #f5ebee; }
.message-assistant .message-inner { border-top-left-radius: 4px; }
.message-inner header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 22px; margin-bottom: 5px; }
.message-inner header strong { font-size: 13px; line-height: 1.4; }
.message-inner header time { font-size: 12px; color: var(--subtle); }
.message-copy { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.59; }
.message-copy span.choice { color: var(--plum); }
.message-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.message-attachments a { display: flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--rule-strong); border-radius: 7px; background: var(--paper); color: var(--plum-dark); font-size: 13px; text-decoration: none; overflow-wrap: anywhere; }
.message-attachments a:hover { background: var(--plum-light); }
.chat-bottom { padding-top: 10px; }
.prompts { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 11px; }
.prompt { display: inline-flex; align-items: center; gap: 6px; min-height: 35px; padding: 5px 9px; border: 1px solid var(--rule); border-radius: 7px; background: var(--paper); color: #625352; font-size: 13px; font-weight: 575; }
.prompt svg { color: var(--plum); }
.prompt:hover { border-color: #dcbfc9; background: var(--plum-light); color: var(--plum-dark); }
.composer { display: grid; padding: 10px 11px 9px; border: 1px solid var(--rule-strong); border-radius: 13px; background: var(--paper); box-shadow: 0 2px 8px rgba(92, 63, 51, .04); }
.composer:focus-within { border-color: #b893a1; }
.composer textarea { width: 100%; min-height: 61px; max-height: 24dvh; padding: 3px 4px 5px; resize: vertical; border: 0; outline: none; color: var(--ink); background: transparent; font-size: 16px; }
.composer textarea::placeholder { color: #786b69; opacity: 1; }
.composer-tools { display: flex; align-items: center; gap: 1px; }
.composer-tools .button-quiet { padding-left: 7px; padding-right: 9px; }
.send-button { margin-left: auto; padding-left: 13px; padding-right: 13px; }
.send-button svg { order: 1; }
.attachment-control { position: relative; cursor: pointer; }
.attachment-control input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.attachment-control:focus-within { outline: 2px solid var(--plum); }
.attachment-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 3px 8px; }
.attachment-chip { display: inline-flex; max-width: 100%; gap: 5px; align-items: center; padding: 4px 8px; border: 1px solid var(--rule); border-radius: 7px; background: var(--tint); color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.attachment-chip button { background: none; border: none; color: var(--plum); padding: 1px 3px; line-height: 1; font-size: 16px; }
.privacy-foot { display: flex; align-items: center; gap: 5px; margin-top: 9px; padding: 0 2px; color: var(--subtle); font-size: 12px; }
.pending-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; min-height: 39px; }
.pending-status svg { color: var(--plum); }
.workspace-panel { min-width: 0; padding: 33px 23px 24px; border-left: 1px solid var(--rule); background: var(--tint); }
.workspace-panel > h2 { font-size: 16px; margin-bottom: 13px; }
.workspace-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.stat-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 7px; min-height: 76px; padding: 9px 10px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); color: var(--ink); text-decoration: none; }
.stat-card:hover { border-color: #d8bfc8; background: #fdf7f8; }
.stat-icon { display: inline-grid; width: 26px; height: 26px; place-items: center; border-radius: 7px; background: var(--plum-light); color: var(--plum); }
.stat-warm { background: var(--amber-light); color: var(--amber); }
.stat-number { font: 400 25px/1 var(--serif); letter-spacing: -.06em; }
.stat-label { grid-column: 1 / -1; color: var(--muted); font-size: 12px; white-space: nowrap; }
.summary-section { margin-top: 28px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; margin-bottom: 9px; }
.section-heading .text-link { font-size: 12px; }
.summary-rows { display: grid; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); overflow: hidden; }
.summary-rows li + li { border-top: 1px solid var(--rule); }
.summary-row { display: flex; gap: 8px; align-items: center; min-height: 56px; padding: 7px 8px; color: var(--ink); text-decoration: none; }
.summary-row:hover { background: #faf2f4; }
.summary-row > span:nth-child(2) { display: grid; flex: 1; min-width: 0; }
.summary-row strong, .summary-row small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-row strong { font-size: 13px; font-weight: 650; }
.summary-row small { color: var(--muted); font-size: 12px; }
.summary-row > svg { color: var(--subtle); }
.summary-icon { display: inline-grid; flex: 0 0 auto; align-items: center; justify-items: center; width: 32px; height: 32px; border-radius: 8px; }
.summary-amber { background: var(--amber-light); color: var(--amber); }
.summary-violet { background: var(--plum-light); color: var(--plum); }
.summary-file { background: #ede9e2; color: #72564f; }
.summary-empty { display: flex; align-items: center; gap: 8px; border: 1px dashed var(--rule-strong); border-radius: 9px; padding: 9px 10px; min-height: 45px; color: var(--muted); font-size: 13px; }
.summary-empty svg { color: var(--plum); }

.content-page { max-width: 1550px; margin: 0 auto; padding: 31px clamp(17px,3.4vw,52px) 48px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px 22px; margin-bottom: 23px; }
.page-heading h1 { font-size: clamp(2.25rem,4.3vw,3.2rem); }
.page-heading p { max-width: 57ch; }
.heading-actions, .inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.heading-actions { flex: 0 0 auto; }
.back-link { margin-bottom: 13px; }
.panel { min-width: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.panel-heading p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.panel-body { margin: 0; padding: 15px 16px; }
.empty-state { display: grid; gap: 6px; justify-items: center; padding: 37px 16px; text-align: center; }
.empty-state .symbol { margin-bottom: 2px; }
.empty-state strong { font-size: 17px; }
.empty-state p { color: var(--muted); font-size: 14px; }
.pill { display: inline-flex; gap: 4px; align-items: center; border-radius: 15px; padding: 3px 8px; color: #675951; background: #f0ece5; font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill-rose { color: var(--plum-dark); background: var(--plum-light); }
.pill-amber { color: var(--amber); background: var(--amber-light); }
.pill-green { color: var(--moss); background: var(--moss-light); }
.section-note { display: flex; gap: 6px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 13px; }
.action-details { position: relative; }
.action-details[open] > summary { outline: 2px solid #b98d9d; outline-offset: 1px; }
.popover { position: absolute; top: calc(100% + 9px); right: 0; z-index: 4; width: min(295px, calc(100vw - 34px)); padding: 13px; border: 1px solid var(--rule-strong); border-radius: 9px; background: var(--paper); box-shadow: var(--shadow); }
.popover p { font-size: 13px; color: var(--muted); }
.stacked-form, .stacked-form label { display: grid; gap: 5px; }
.stacked-form { gap: 12px; }
.stacked-form label { color: #5b504f; font-size: 14px; font-weight: 600; }
.stacked-form input, .stacked-form textarea, .stacked-form select, .cell-form input, .cell-form select { width: 100%; min-width: 0; min-height: 38px; padding: 7px 8px; border: 1px solid var(--rule-strong); border-radius: 7px; background: var(--paper); color: var(--ink); font-size: 15px; font-weight: 400; }
.stacked-form input[type="file"] { min-height: 42px; padding: 7px 6px; font-size: 13px; }
.stacked-form textarea { resize: vertical; }
.table-scroll { width: 100%; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.data-table thead th { white-space: nowrap; background: var(--tint); color: #5f514f; font-weight: 670; }
.data-table tbody th { font-weight: 600; }
.data-table tbody tr:last-child > * { border-bottom: none; }
.data-table tbody tr:nth-child(even) { background: #fdfbf8; }
.data-table tfoot { border-top: 1px solid var(--rule); background: var(--tint); font-weight: 650; }
.data-table tfoot td, .data-table tfoot th { border-bottom: none; }
.data-table .table-group > th { background: var(--plum-light); color: var(--plum-dark); font-size: 13px; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 13px; }
.view-tab { padding: 6px 11px; border: 1px solid var(--rule); border-radius: 20px; background: var(--paper); color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 570; }
.view-tab:hover { color: var(--plum-dark); border-color: #d8bfc8; }
.view-tab.current { color: var(--plum-dark); background: var(--plum-light); border-color: #ead7df; font-weight: 650; }
.record-code, .record-link { white-space: nowrap; font: 650 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.record-link { color: var(--plum-dark); }
.column-edit { color: var(--subtle); padding-left: 5px; display: inline-block; vertical-align: -2px; }
.cell-editor summary { display: flex; gap: 5px; align-items: center; justify-content: space-between; padding: 4px 5px; margin: -4px -5px; min-width: 70px; border-radius: 5px; }
.cell-editor summary svg { color: var(--plum); opacity: .34; }
.cell-editor summary:hover, .cell-editor summary:focus-visible { background: var(--plum-light); }
.cell-editor summary:hover svg, .cell-editor summary:focus-visible svg { opacity: 1; }
.cell-editor[open] > summary { display: none; }
.cell-form { display: flex; align-items: center; gap: 3px; min-width: 160px; }
.cell-form input, .cell-form select { width: 112px; min-height: 34px; padding: 4px 5px; font-size: 14px; }
.cell-form .icon-button { min-width: 26px; min-height: 30px; }
.cell-save { color: var(--moss); }
.entity-identity { display: flex; gap: 7px; align-items: center; margin-bottom: 7px; }
.detail-layout, .settings-layout { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,.85fr); gap: 13px; align-items: start; }
.detail-side { display: grid; gap: 13px; }
.settings-layout + .settings-layout { margin-top: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.span-2 { grid-column: 1 / -1; }
.definition-list { display: grid; gap: 9px; }
.definition-list div { min-width: 0; }
.definition-list dt, .compare-grid dt { color: var(--muted); font-size: 13px; }
.definition-list dd, .compare-grid dd { margin: 2px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.definition-list .record-code { font-size: 12px; }
.detail-list { display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.detail-list strong { color: var(--ink); }
.source-details + .source-details { margin-top: 13px; }
.source-details .definition-list { display: flex; flex-wrap: wrap; gap: 10px 27px; }
.file-link { display: flex; gap: 8px; color: var(--ink); text-decoration: none; align-items: center; }
.file-link > span:last-child { display: grid; overflow-wrap: anywhere; }
.file-link small { color: var(--muted); }
.evidence-text { min-width: 135px; overflow-wrap: anywhere; white-space: pre-wrap; }
.issue-list { display: grid; gap: 12px; }
.issue-card { scroll-margin-top: 10px; }
.issue-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.issue-header .summary-icon { width: 36px; height: 36px; }
.issue-header > .text-link { margin-left: auto; }
.issue-header p { margin-top: 1px; color: var(--muted); font-size: 13px; }
.issue-body { display: grid; gap: 10px; padding: 11px 14px; }
.issue-source { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.compare-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 0; }
.compare-grid > div { padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--tint); }
.issue-actions { justify-content: end; }
.candidate-list { display: grid; gap: 6px; }
.candidate-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border: 1px solid var(--rule); border-radius: 8px; }
.candidate-copy { display: grid; gap: 2px; font-size: 14px; }
.candidate-copy small { color: var(--muted); }
.history-entry { display: flex; align-items: start; gap: 12px; padding: 13px 15px; }
.history-entry + .history-entry { border-top: 1px solid var(--rule); }
.history-copy { flex: 1; min-width: 0; }
.history-copy p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.change-details { margin-top: 7px; font-size: 13px; }
.change-details summary { color: var(--plum); font-weight: 620; }
.change-details ul { display: grid; gap: 5px; margin-top: 5px; }
.change-details li { display: grid; gap: 2px; }
.change-details li > span { display: flex; align-items: center; gap: 7px; }
.change-details svg { color: var(--subtle); }
.login-layout { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding: 18px; background: var(--rail); }
.login-card { width: min(100%,420px); padding: clamp(20px,4vw,32px); border: 1px solid var(--rule); border-radius: 15px; background: var(--paper); box-shadow: var(--shadow); }
.login-brand { padding: 0; margin-bottom: 28px; }
.login-brand .brand-mark { width: 45px; height: 45px; }
.login-card h1 { font-size: 2.55rem; }
.login-card .flash { margin: 10px 0; }
.login-card .stacked-form { margin-top: 19px; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 194px minmax(0,1fr); }
  .sidebar { padding-left: 11px; padding-right: 11px; }
  .brand { gap: 8px; padding: 0 3px; }
  .brand strong { font-size: 23px; }
  .topbar { padding-left: 23px; padding-right: 23px; }
  .chat-workspace { grid-template-columns: minmax(0,1fr) minmax(245px,29%); }
  .chat-main { padding-left: 23px; padding-right: 23px; }
  .workspace-panel { padding-left: 15px; padding-right: 15px; }
}
@media (max-width: 900px) {
  .chat-workspace { grid-template-columns: minmax(0,1fr); }
  .chat-main { min-height: calc(100dvh - 70px); }
  .workspace-panel { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 14px; padding: 21px 23px; border-left: 0; border-top: 1px solid var(--rule); }
  .workspace-panel > h2, .workspace-stats { grid-column: 1 / -1; margin: 0; }
  .workspace-stats { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .summary-section { margin-top: 3px; }
}
@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: min(246px,86vw); z-index: 11; padding: 18px 13px 12px; box-shadow: var(--shadow); }
  .sidebar.navigation-open { display: flex; }
  .mobile-menu { display: inline-grid !important; }
  .nav-backdrop:not([hidden]) { position: fixed; display: block !important; inset: 0; z-index: 10; background: #30262644; border: 0; }
  .topbar { min-height: 59px; padding: 8px 12px; gap: 7px; }
  .topbar-start { gap: 4px; }
  .topbar .breadcrumb > span, .topbar .breadcrumb > svg { display: none; }
  .breadcrumb { font-size: 13px; }
  .global-search { min-width: 0; max-width: min(54vw,270px); }
  .global-search kbd { display: none; }
  .global-search input { height: 34px; font-size: 13px; }
  .chat-main { min-height: calc(100dvh - 59px); padding: 22px 14px 15px; }
  .chat-header { padding-bottom: 16px; }
  .chat-heading { gap: 9px; }
  .chat-heading .symbol { width: 38px; height: 38px; border-radius: 9px; }
  .chat-heading .symbol svg { width: 22px; height: 22px; }
  .chat-heading p { margin-top: 5px; }
  .conversation { padding-top: 16px; gap: 13px; }
  .message { gap: 5px; }
  .message .avatar { width: 28px; height: 28px; }
  .message-inner { padding: 9px 9px; }
  .message-copy { line-height: 1.5; }
  .workspace-panel { padding: 16px 14px 22px; gap: 12px; }
  .content-page { padding: 21px 13px 35px; }
  .page-heading { flex-wrap: wrap; align-items: start; margin-bottom: 16px; }
  .page-heading p { margin-top: 6px; }
  .page-heading .action-details > .popover { right: auto; left: 0; }
  .detail-layout, .settings-layout { grid-template-columns: 1fr; }
  .head-actions { width: 100%; }
}
@media (max-width: 410px) {
  .workspace-panel { grid-template-columns: minmax(0,1fr); }
  .workspace-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .chat-continuity .button { padding-left: 7px; padding-right: 7px; }
  .stat-card { min-height: 58px; }
  .prompt { font-size: 12px; }
  .message-inner { max-width: 89%; }
  .composer textarea { min-height: 48px; }
  .source-table .summary-icon { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .nav-link, .prompt, .stat-card { transition: background 120ms ease, border-color 120ms ease; }
}
@media print {
  .sidebar, .topbar, .heading-actions, .action-details, .cell-editor summary svg, .view-tabs, .section-note { display: none !important; }
  .app-shell { display: block; }
  .cell-editor .cell-form { display: none; }
  .cell-editor[open] > summary { display: flex; }
  .content-page { max-width: none; padding: 0; }
  .table-scroll { overflow: visible; }
  body { background: white; font-size: 12pt; }
}

.chat-continuity { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 -11px 64px; }
.chat-continuity .button { min-height: 32px; font-size: 13px; }
.chat-continuity .popover, .view-form .popover { right: auto; left: 0; }
.thread-list { display: grid; gap: 4px; padding: 7px; }
.thread-list a { display: block; padding: 6px 7px; border-radius: 5px; text-decoration: none; font-size: 14px; }
.thread-list a:hover, .thread-list a[aria-current="page"] { background: var(--plum-light); }
.view-form > summary { display: inline-flex; align-items: center; gap: 5px; }
.search-results { margin-bottom: 13px; }
.search-matches { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 6px 10px; max-height: 340px; overflow: auto; }
.search-matches a { display: grid; gap: 1px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; }
.search-matches strong { font-size: 14px; overflow-wrap: anywhere; }
.search-matches small { color: var(--muted); }
.original-preview img { display: block; max-width: 100%; max-height: 64vh; margin: 0 auto; object-fit: contain; }
@media (max-width: 700px) {
  .chat-continuity { margin: 7px 0 -7px 44px; }
}

.operation-panel { margin-bottom: 13px; }
.audit-table th { min-width: 128px; }
.audit-table td { max-width: 450px; vertical-align: top; }
.history-copy h2 a { color: var(--ink); text-decoration: none; }
.history-copy h2 a:hover { color: var(--plum); text-decoration: underline; }
.rule-editor > summary { display: flex; align-items: center; gap: 7px; }
.rule-editor > summary svg { margin-left: auto; }
.rule-editor > p { margin: 3px 0 8px; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 12; transform: translateY(-160%); padding: 7px 11px; border-radius: 6px; background: var(--paper); color: var(--plum); }
.skip-link:focus { transform: none; }
.send-button:disabled { cursor: not-allowed; }
@media (max-width: 700px) {
  .content-page, .chat-header { position: relative; }
  .content-page .action-details, .chat-continuity .action-details { position: static; }
  .content-page .action-details > .popover, .content-page .page-heading .action-details > .popover {
    inset: auto 13px;
    width: auto;
    margin-top: 7px;
  }
  .chat-continuity .popover { inset: auto 0; width: auto; margin-top: 6px; }
}
