/* Mailaya: a calm reading workspace, daylight use on laptop and mobile. */
:root {
  color-scheme: light;
  --canvas: oklch(97.4% .006 327); --surface: oklch(99.2% .003 327);
  --rail: oklch(95.7% .011 327); --ink: oklch(24% .022 327);
  --muted: oklch(47% .023 327); --faint: oklch(61% .018 327);
  --border: oklch(87% .012 327); --accent: oklch(39% .13 327);
  --accent-hover: oklch(32% .13 327); --selection: oklch(93% .032 327);
  --processing: oklch(96% .015 65); --success: oklch(42% .09 155);
  --danger: oklch(47% .14 25); --warning: oklch(47% .08 65);
  --display: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-family: var(--display); font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
button { color: inherit; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .48; }
button { transition: background-color 160ms cubic-bezier(.16,1,.3,1), color 160ms cubic-bezier(.16,1,.3,1); }
:focus-visible { outline: 3px solid oklch(64% .13 327); outline-offset: 3px; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.03em; font-weight: 650; margin-bottom: 6px; }
h2 { font-size: 20px; letter-spacing: -.02em; line-height: 1.35; font-weight: 650; margin-bottom: 8px; }
h3 { font-size: 16px; margin-bottom: 12px; }
p { max-width: 72ch; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; z-index: 30; inset: 12px auto auto 12px; padding: 12px; color: var(--surface); background: var(--accent); }
.app-shell { display: grid; grid-template-columns: 216px minmax(0,1fr); }
.app-rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 30px 16px 24px; background: var(--rail); border-right: 1px solid var(--border); }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; padding: 0 8px; font-size: 21px; font-weight: 720; letter-spacing: -.02em; }
.brand small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.brand-mark { display: grid; place-items: center; height: 35px; width: 35px; border-radius: 9px; color: var(--surface); background: var(--accent); font-size: 20px; font-weight: 700; flex: 0 0 auto; }
.main-nav { display: grid; gap: 5px; margin-top: 44px; }
.main-nav button { display: flex; align-items: center; gap: 12px; border: 0; border-radius: 7px; background: transparent; padding: 12px; text-align: left; font-size: 14px; font-weight: 550; color: var(--muted); min-height: 44px; }
.main-nav button:hover { background: oklch(92% .015 327); color: var(--ink); }
.main-nav button[aria-current] { background: var(--selection); color: var(--accent); font-weight: 650; }
.main-nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; flex: 0 0 auto; }
.rail-bottom { margin-top: auto; display: grid; gap: 12px; padding-top: 18px; }
.guide-link { font-size: 12px; padding: 0 10px; text-decoration: none; }
.guide-link:hover { text-decoration: underline; }
.local-label { font-size: 12px; color: var(--muted); display: flex; gap: 7px; align-items: center; margin: 0; padding: 0 10px; }
.status-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--success); }
.app-body { min-width: 0; }
.profile-menu { position: relative; }
.profile-menu summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--ink); padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); list-style: none; font-size: 13px; font-weight: 550; }
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary::after { content: '⌃'; color: var(--muted); }
.profile-menu #session-badge { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu > div { position: absolute; left: 0; bottom: calc(100% + 6px); width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; z-index: 15; box-shadow: 0 8px 24px oklch(24% .022 327 / .08); }
.profile-menu button,.profile-menu a { display: block; border: 0; width: 100%; text-align: left; padding: 10px; background: transparent; border-radius: 4px; color: var(--ink); font-size: 13px; text-decoration: none; }
.profile-menu button:hover,.profile-menu a:hover { background: var(--rail); }
main { max-width: 1700px; margin: 0 auto; }
.page { padding: 32px 36px 72px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 28px; }
.page-heading p { color: var(--muted); margin-bottom: 0; }
.page-heading.compact { margin-bottom: 18px; }
.page-heading.compact > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.page-heading.compact h1 { margin: 0; }
.page-heading.compact p { font-size: 13px; }
.primary-button,.secondary-button,.danger-button { display: inline-flex; justify-content: center; align-items: center; gap: 12px; width: auto; min-height: 40px; padding: 9px 15px; border-radius: 6px; border: 1px solid var(--border); font-size: 13px; font-weight: 600; white-space: normal; }
.primary-button { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.primary-button:hover { background: var(--accent-hover); }
.secondary-button { background: var(--surface); color: var(--ink); }
.secondary-button:hover { background: var(--rail); border-color: oklch(75% .03 327); }
.danger-button { background: var(--surface); color: var(--danger); border-color: oklch(80% .05 25); }
.text-button { border: 0; background: transparent; color: var(--accent); padding: 5px 0; text-align: left; font-size: 13px; }
.icon-button { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 17px; line-height: 1; }
.icon-button:hover:not(:disabled) { background: var(--rail); }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
label { display: grid; gap: 7px; min-width: 0; }
label > span { color: var(--muted); font-size: 12px; }
input:not([type=checkbox]), select { background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; padding: 10px 11px; min-height: 41px; width: 100%; min-width: 0; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
input::placeholder { color: var(--faint); opacity: 1; }
.field-grid,.filter-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.filter-grid { grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: 20px; }
.check-field { display: flex; align-items: center; gap: 10px; }
.check-field span { color: var(--ink); font-size: 13px; }
.results { min-width: 0; }
.triage-tools { margin-bottom: 12px; }
.list-toolbar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between; }
.view-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.view-tabs button { background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 14px 11px; font-weight: 550; white-space: nowrap; margin-bottom: -1px; }
.view-tabs button[aria-pressed=true] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.view-tabs button:hover { color: var(--ink); }
form { margin: 0; }
.search-line { display: flex; gap: 8px; align-items: end; }
.list-toolbar .search-line { flex: 1 1 420px; max-width: 680px; }
.search-field { flex: 1; }
.scope-field { width: 170px; }
.list-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 0 0; font-size: 12px; color: var(--muted); }
.list-meta .text-button { font-size: 12px; }
.advanced-filters,.list-menu { position: relative; }
.advanced-filters > summary,.list-menu > summary { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 12px; list-style: none; }
.advanced-filters > summary::-webkit-details-marker,.list-menu > summary::-webkit-details-marker { display: none; }
.advanced-filters > summary::after,.list-menu > summary::after { content: '⌄'; color: var(--muted); }
.advanced-filters[open] > summary,.list-menu[open] > summary { border-color: var(--accent); color: var(--accent); }
.filter-popover,.menu-content { position: absolute; top: calc(100% + 6px); z-index: 12; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px oklch(24% .022 327 / .1); }
.filter-popover { left: 0; width: min(720px, calc(100vw - 64px)); }
.filter-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.filter-grid .check-field { align-self: end; min-height: 41px; }
.filter-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.filter-footer p { color: var(--muted); font-size: 12px; margin: 0; }
.count-badge { border-radius: 10px; padding: 0 6px; background: var(--selection); color: var(--accent); font-size: 11px; font-weight: 650; }
.list-menu { margin-left: auto; }
.menu-content { right: 0; width: 280px; display: grid; gap: 4px; }
.menu-content label { margin: 4px 0 6px; }
.menu-content button { display: block; border: 0; background: transparent; padding: 8px 0; font-size: 13px; text-align: left; width: 100%; }
.menu-content button:hover { color: var(--accent); }
.menu-content hr { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid var(--border); }
#active-filter-copy { color: var(--ink); }
#active-filter-copy:empty { display: none; }
.natural-panel { padding: 20px; margin-top: 14px; background: var(--rail); border: 1px solid var(--border); border-radius: 8px; }
.natural-panel h2 { font-size: 16px; }
.natural-panel label:not(.search-field) { max-width: 300px; margin: 12px 0; }
.natural-panel p { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination > span { margin-right: 6px; font-variant-numeric: tabular-nums; }
.pagination:has(> span:empty) { display: none; }
.table-scroll { overflow: auto; }
.message-list .table-scroll { overflow: visible; }
.mail-workspace { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: clip; transition: opacity 160ms cubic-bezier(.16,1,.3,1); }
.mail-workspace[aria-busy=true] { opacity: .6; }
.mail-workspace.reader-open { display: grid; grid-template-columns: minmax(0,1fr) minmax(360px,44%); align-items: start; }
.message-list { min-width: 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 500; padding: 12px 16px; background: var(--rail); border-bottom: 1px solid var(--border); }
thead { position: sticky; top: 0; z-index: 2; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.mail-table { table-layout: fixed; }
.mail-table th:first-child { width: 57%; }
.mail-table th:nth-child(2) { width: 16%; }
.mail-table th:nth-child(3) { width: 16%; }
.mail-table th:nth-child(4) { width: 11%; }
.mail-table tbody tr { cursor: pointer; }
.mail-table tr[data-selected=true] { background: var(--selection); }
.mail-table tbody tr:hover { background: oklch(97% .012 327); }
.mail-table tbody tr[data-selected=true]:hover { background: var(--selection); }
.mail-line { display: flex; justify-content: space-between; gap: 12px; }
.sender-name { font-weight: 600; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { flex: 0 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mail-table tr[data-task=done] .mail-subject,.mail-table tr[data-task=snoozed] .mail-subject { color: var(--muted); font-weight: 500; }
.sender-address { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.mail-subject,.subject { display: block; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--ink); padding: 0; background: transparent; border: 0; width: 100%; text-align: left; margin: 2px 0; }
.mail-subject { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-subject:hover { color: var(--accent); text-decoration: none; }
.preview { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.category-button { background: transparent; border: 0; color: var(--accent); padding: 0; text-align: left; font-size: 13px; }
.priority-label { font-size: 12px; color: var(--muted); }
.priority-label[data-level=critical] { color: var(--danger); font-weight: 650; }
.priority-label[data-level=high] { color: var(--warning); font-weight: 600; }
.signal-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.signal { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.signal::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.signal[data-signal=action] { color: var(--accent); }
.signal[data-signal=spam] { color: var(--danger); }
.mail-table tr[data-spam=true] .mail-subject,.mail-table tr[data-spam=true] .subject,.mail-table tr[data-spam=true] .preview { color: var(--faint); }
.task-label { display: inline-block; font-size: 11px; border-radius: 4px; padding: 3px 7px; background: var(--rail); color: var(--muted); white-space: nowrap; }
.task-label[data-task=todo] { padding: 0; background: none; }
.task-label[data-task=done] { color: var(--success); background: oklch(95% .02 155); }
.task-label[data-task=snoozed] { color: var(--warning); background: var(--processing); }
.reader-open .mail-table th:nth-child(2),.reader-open .mail-table td:nth-child(2) { display: none; }
.reader-open .mail-table th:first-child { width: 66%; }
.reader-open .mail-table th:nth-child(3) { width: 21%; }
.reader-open .mail-table th:nth-child(4) { width: 13%; }
.reader-open .mail-table td { padding: 14px 12px; }
.message-reader { min-width: 0; position: sticky; top: 0; max-height: 100dvh; overflow: auto; overscroll-behavior: contain; border-left: 1px solid var(--border); }
.reader-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 22px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; position: sticky; top: 0; background: var(--surface); z-index: 3; }
.reader-toolbar button { font-size: 12px; }
#reader-content { padding: 24px 22px; }
.reader-heading { font-size: 21px; line-height: 1.3; margin: 6px 0 8px; overflow-wrap: anywhere; }
.reader-meta { font-size: 12px; color: var(--muted); margin-bottom: 14px; overflow-wrap: anywhere; }
.reader-classification { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12px; margin: 0 0 22px; }
.tag { color: var(--accent); font-weight: 600; }
.review-label { color: var(--muted); }
.reader-classification .priority-label[data-level=low],.reader-classification .priority-label[data-level=normal] { color: var(--muted); }
.mail-preview { font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; padding-bottom: 24px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.mail-editor { display: grid; gap: 12px; }
.mail-editor > h3 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.segmented { display: grid; grid-template-columns: repeat(3,1fr); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: var(--surface); }
.segmented button { min-height: 40px; border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--ink); font-size: 13px; font-weight: 550; }
.segmented button:first-child { border-left: 0; }
.segmented button:hover:not(:disabled) { background: var(--rail); }
.segmented button[aria-pressed=true] { background: var(--accent); color: var(--surface); font-weight: 650; }
.snooze-form { display: flex; gap: 10px; align-items: end; }
.snooze-form label { flex: 1; }
.correction-details { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.correction-details summary,.classification-details summary { color: var(--muted); font-size: 12px; }
.correction-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.editor-actions { grid-column: 1/-1; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.editor-note { font-size: 12px; color: var(--muted); margin: 0; }
.classification-details { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.classification-details p { margin-top: 12px; }
.classification-details ul { list-style: none; padding: 0; }
.classification-details li { display: flex; justify-content: space-between; padding: 4px 0; }
.empty-state { text-align: center; padding: 56px 24px; display: grid; justify-items: center; }
.empty-state h2 { font-size: 21px; }
.empty-state p { color: var(--muted); max-width: 45ch; margin-bottom: 22px; }
.empty-symbol { font-size: 36px; color: var(--faint); margin-bottom: 14px; }
.section-heading,.section-label { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.section-heading { margin-bottom: 22px; }
.section-heading p { color: var(--muted); font-size: 13px; margin-bottom: 0; }
.context-line { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; padding: 20px 0; border-block: 1px solid var(--border); margin-bottom: 28px; }
.context-line label { min-width: 200px; }
.reading-page { max-width: 1050px; }
.brief-panel .section-heading { margin-top: 32px; }
.brief-summary { font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.brief-item { padding: 22px 0; border-top: 1px solid var(--border); }
.brief-item .text-button { color: var(--ink); font-size: 16px; font-weight: 600; }
.brief-item p { margin: 8px 0 0; color: var(--ink); font-size: 14px; line-height: 1.7; }
.brief-item .brief-meta { font-size: 12px; color: var(--muted); }
.brief-footnote { font-size: 12px; color: var(--muted); margin-top: 28px; }
.analysis-layout { display: grid; grid-template-columns: minmax(300px,420px) minmax(0,1fr); gap: 50px; padding-bottom: 30px; border-bottom: 1px solid var(--border); }
.analysis-form { padding-right: 0; }
#run-form { display: grid; gap: 18px; margin-top: 24px; }
.model-hint { font-size: 12px; color: var(--muted); margin: -8px 0 0; }
#run-button { width: 100%; justify-content: space-between; margin-top: 6px; }
.run-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.run-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.run-status[data-state=running]::before { background: var(--accent); }
.run-status[data-state=complete]::before { background: var(--success); }
.run-status[data-state=failed]::before { background: var(--danger); }
.progress-section { padding: 12px 0 22px; }
.progress-count { font-size: 13px; color: var(--muted); margin: 18px 0 12px; }
.progress-count strong { font-size: 20px; color: var(--ink); font-weight: 600; }
.progress-track { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-track > span { display: block; height: 100%; width: 0; background: var(--accent); }
.progress-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; padding-block: 20px; border-block: 1px solid var(--border); }
.metrics div { display: grid; gap: 7px; font-size: 11px; color: var(--muted); }
.metrics strong { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 550; }
.category-summary { margin-top: 28px; }
.section-label h3 { margin: 0; font-size: 14px; }
.section-label > span { font-size: 12px; color: var(--muted); }
.category-bars { display: grid; gap: 11px; margin-top: 18px; }
.category-summary-row { display: grid; grid-template-columns: 90px 1fr 25px; gap: 12px; align-items: center; font-size: 12px; }
.category-track,.matrix-line { height: 4px; display: block; background: var(--border); }
.category-track span,.matrix-line span { display: block; height: 100%; background: var(--accent); }
.system-note,.technical-note,.field-hint { color: var(--muted); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.system-note { margin-top: 24px; }
.technical-note p { margin-top: 12px; }
.history-section { margin: 30px 0; }
.history-select { flex: 1; }
.comparison-panel { padding-top: 24px; border-top: 1px solid var(--border); }
#comparison-content > p { color: var(--muted); font-size: 13px; }
#comparison-content .table-scroll { max-height: 420px; border: 1px solid var(--border); border-radius: 6px; margin-top: 24px; }
.data-management { margin-top: 36px; font-size: 12px; color: var(--muted); }
.data-management p { margin-top: 14px; }
#clear-confirm { padding: 16px; border: 1px solid var(--border); margin-top: 14px; border-radius: 6px; }
#clear-confirm p { margin-top: 0; }
.settings-nav { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 32px; overflow-x: auto; }
.settings-nav button { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 12px 0; white-space: nowrap; color: var(--muted); font-size: 13px; }
.settings-nav button[aria-current] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.settings-section, #settings-account { max-width: 840px; }
.settings-section > .section-heading { align-items: start; }
.account-context { max-width: 360px; margin: 26px 0 10px; }
.settings-form { max-width: 680px; }
fieldset { border: 0; border-bottom: 1px solid var(--border); padding: 24px 0; margin: 0; min-width: 0; }
legend { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 0; transform: translateY(15px); }
.feature-switch { display: flex; justify-content: space-between; align-items: center; gap: 28px; padding: 12px 0; }
.feature-switch > span { color: var(--ink); }
.feature-switch strong { font-size: 14px; font-weight: 550; display: block; }
.feature-switch small { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }
.feature-options { display: grid; gap: 18px; margin: 12px 0 4px; padding: 18px; background: var(--rail); border-radius: 6px; }
.feature-options p { font-size: 12px; color: var(--muted); margin: 0; }
.save-bar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--canvas); border-top: 1px solid var(--border); padding: 18px 0; margin-top: 20px; }
.save-bar p { font-size: 12px; color: var(--muted); margin: 0; }
.account-form { display: grid; gap: 18px; margin-top: 22px; max-width: 620px; }
.inset-form,#imap-form { background: var(--surface); padding: 26px; border: 1px solid var(--border); border-radius: 8px; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.imap-item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.imap-item > p { flex-basis: 100%; color: var(--muted); font-size: 12px; margin: -5px 0 0; overflow-wrap: anywhere; }
.imap-item > strong { margin-right: auto; font-size: 14px; font-weight: 600; }
.imap-item .account-actions { margin-top: 0; }
#imap-accounts,#llm-connections,#personal-rules { margin-bottom: 24px; }
#imap-accounts > p,#llm-connections > p,#personal-rules > p { color: var(--muted); font-size: 13px; padding-block: 20px; }
.user-panel { max-width: 600px; }
.user-panel > p { color: var(--muted); }
.user-panel details { margin-top: 22px; }
.user-panel details > p { font-size: 13px; color: var(--muted); margin-top: 14px; }
.inline-notice { background: var(--rail); padding: 16px; margin-bottom: 24px; color: var(--muted); font-size: 13px; border-radius: 6px; }
.workspace-status { position: fixed; bottom: 16px; left: 252px; right: 32px; z-index: 20; width: fit-content; max-width: calc(100vw - 290px); border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 12px; padding: 10px 14px; margin: 0; box-shadow: 0 4px 16px oklch(24% .022 327 / .06); }
.workspace-status { display: flex; align-items: center; gap: 12px; }
.workspace-status p { font: inherit; margin: 0; }
.workspace-status button { border: 0; background: transparent; padding: 4px; font-size: 18px; min-width: 32px; min-height: 32px; }
.workspace-status[data-kind=error] { color: var(--danger); border-color: oklch(80% .05 25); }
.matrix-row { display: none; }
.matrix-row[data-open=true] { display: table-row; }
.matrix-panel { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; padding: 12px 0; }
.matrix-item { font-size: 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.matrix-line { grid-column: 1/-1; }
#public-category { margin-bottom: 20px; max-width: 300px; }
.natural-result { max-width: 75ch; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.natural-result:empty { display: none; }
.guide-page { max-width: 950px; margin: auto; padding: 32px; }
.guide-page article { max-width: 75ch; margin: auto; font-size: 16px; line-height: 1.7; }
.guide-page nav { margin-bottom: 24px; }
.guide-page h1 { font-size: 32px; margin-top: 32px; }
.guide-page h2 { margin-top: 36px; font-size: 24px; }
.guide-page h3 { margin-top: 26px; font-size: 19px; }
.guide-page pre { overflow: auto; padding: 18px; background: var(--rail); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.guide-page code { overflow-wrap: anywhere; }
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 190px minmax(0,1fr); }
  .app-rail { padding-inline: 12px; }
  .page { padding: 28px 26px 60px; }
  .mail-workspace.reader-open { grid-template-columns: minmax(0,1fr) minmax(330px,46%); }
  .reader-open .mail-table th:nth-child(3),.reader-open .mail-table td:nth-child(3) { display: none; }
  .reader-open .mail-table th:first-child { width: 76%; }
  .reader-open .mail-table th:nth-child(4) { width: 24%; }
  .workspace-status { left: 216px; max-width: calc(100vw - 248px); }
  .analysis-layout { gap: 30px; }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .app-rail { height: auto; position: sticky; z-index: 10; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; padding: 10px 18px 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { font-size: 19px; padding: 0; }
  .brand small,.local-label,.guide-link { display: none; }
  .rail-bottom { grid-row: 1; grid-column: 2; margin: 0; padding: 0; }
  .profile-menu summary { padding: 6px 10px; max-width: 160px; }
  .profile-menu summary::after { content: '⌄'; }
  .profile-menu > div { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); }
  .brand-mark { height: 28px; width: 28px; font-size: 16px; border-radius: 6px; }
  .main-nav { grid-column: 1/-1; display: flex; justify-content: space-between; gap: 6px; margin: 10px 0 0; }
  .main-nav button { padding: 10px 12px; font-size: 12px; border-radius: 6px 6px 0 0; white-space: nowrap; min-height: 40px; }
  .main-nav svg { width: 17px; height: 17px; }
  .page { padding: 24px 22px 60px; }
  .mail-workspace.reader-open { display: block; }
  .reader-open .message-list { display: none; }
  .message-reader { position: static; max-height: none; border-left: 0; scroll-margin-top: 110px; }
  .workspace-status { left: 22px; right: 22px; max-width: calc(100vw - 44px); }
  .analysis-layout { grid-template-columns: 1fr 1fr; gap: 28px; }
  .filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  h1 { font-size: 27px; }
  .app-rail { padding-inline: 14px; }
  .main-nav button { flex: 1; justify-content: center; gap: 6px; padding: 10px 4px; font-size: 11px; }
  .main-nav svg { display: none; }
  .page { padding: 24px 16px 64px; }
  .page-heading { align-items: start; gap: 16px; }
  .page-heading > button { font-size: 12px; max-width: 140px; }
  .page-heading > div p { font-size: 12px; }
  .page-heading.compact { align-items: center; }
  .view-tabs { flex: 1 1 100%; }
  .view-tabs button { flex: 1; padding-inline: 6px; }
  .search-line { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  .scope-field { flex: 1; width: auto; }
  .filter-popover { position: fixed; inset: auto 12px 12px; top: auto; width: auto; max-height: 80dvh; overflow: auto; }
  .menu-content { width: min(280px, calc(100vw - 32px)); }
  .list-menu { margin-left: 0; }
  .pagination { margin-left: auto; }
  .correction-form { grid-template-columns: 1fr; }
  .snooze-form { flex-wrap: wrap; }
  .filter-grid,.field-grid { grid-template-columns: 1fr; gap: 14px; }
  .mail-table thead { display: none; }
  .mail-table tbody > tr:not(.matrix-row) { display: grid; grid-template-columns: 1fr auto auto; padding: 12px 16px; gap: 4px 12px; border-bottom: 1px solid var(--border); }
  .mail-table td { padding: 0; border: 0; }
  .mail-table td:first-child { grid-column: 1/-1; padding-bottom: 6px; }
  .mail-subject { white-space: normal; }
  .preview { max-width: 100%; }
  .mail-table td:not(:first-child) { font-size: 12px; }
  .signal-cell { flex-direction: row; flex-wrap: wrap; gap: 4px 10px; }
  .task-label { padding-block: 1px; }
  .message-list .table-scroll { min-height: 0; }
  .matrix-row[data-open=true] { display: block; }
  .matrix-row td { display: block; padding: 18px; }
  .matrix-panel { grid-template-columns: 1fr 1fr; }
  .natural-panel { padding: 16px; }
  .section-heading { align-items: start; flex-wrap: wrap; }
  .context-line label { width: 100%; }
  .brief-item { padding-block: 20px; }
  .analysis-layout { grid-template-columns: 1fr; gap: 36px; }
  .metrics { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
  .settings-nav { gap: 20px; margin-bottom: 26px; }
  .settings-section > .section-heading > button { margin-top: 4px; }
  .feature-switch { gap: 20px; }
  .feature-options { padding: 14px; }
  .save-bar { flex-direction: column; align-items: stretch; }
  .inset-form,#imap-form { padding: 18px; }
  .workspace-status { left: 16px; right: 16px; max-width: calc(100vw - 32px); }
  #comparison-content th,#comparison-content td { padding: 10px; font-size: 12px; }
  .guide-page { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { transition-duration: .01ms !important; scroll-behavior: auto !important; } }
