:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --sunken: #efeee8;
  --ink: #1b2420;
  --ink-2: #4a5550;
  --muted: #7a827d;
  --line: #e2e0d8;
  --line-2: #d3d1c7;
  --green: #1d4538;
  --green-2: #2c6150;
  --green-bg: #e7efe9;
  --amber: #9a5b12;
  --amber-bg: #fbefdc;
  --red: #a63a2b;
  --red-bg: #f8e4e0;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(20 30 25 / 6%), 0 8px 24px rgb(20 30 25 / 6%);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: 0.5; }
a { color: var(--green-2); }
:focus-visible { outline: 2px solid var(--green-2); outline-offset: 2px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12px; margin-top: 14px; }
.optional { color: var(--muted); font-weight: 400; }

/* Form controls */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 8px;
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgb(44 97 80 / 14%); }
textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.row-end { justify-content: flex-end; }
.reveal { position: relative; }
.reveal input { padding-right: 56px; }
.reveal .link { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; }
.error { color: var(--red); background: var(--red-bg); border-radius: 8px; padding: 9px 12px; margin-top: 12px; font-size: 13px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover:not(:disabled) { background: var(--sunken); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-2); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-small { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-wide { width: 100%; height: 42px; margin-top: 20px; }
.btn-big { height: 44px; padding: 0 20px; font-size: 14px; }
.link { color: var(--green-2); font-weight: 600; font-size: 13px; }
.link:hover { text-decoration: underline; }
.danger { color: var(--red); }

/* Brand */
.brand { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand::before { content: ""; display: inline-block; width: 14px; height: 18px; margin-right: 8px; border: 2px solid currentColor; border-radius: 2px; vertical-align: -2px; box-shadow: 3px -3px 0 -1px var(--bg), 3px -3px 0 1px currentColor; }
.brand-light { color: #fff; }
.brand-light::before { box-shadow: 3px -3px 0 -1px var(--green), 3px -3px 0 1px #fff; }

/* Auth */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-story {
  background: radial-gradient(120% 80% at 0% 0%, rgb(255 255 255 / 7%), transparent 60%), radial-gradient(90% 60% at 100% 100%, rgb(0 0 0 / 18%), transparent 70%), var(--green);
  color: #e6eee9; padding: 40px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.auth-pitch { max-width: 520px; }
.auth-sample { margin-top: 32px; max-width: 440px; background: var(--surface); color: var(--ink); border-radius: 12px; padding: 16px 18px; box-shadow: 0 18px 50px rgb(0 0 0 / 28%); transform: rotate(-1deg); }
.sample-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sample-envelope { flex: none; width: 44px; height: 32px; border-radius: 4px; border: 1px solid var(--line-2); background: linear-gradient(155deg, transparent 49%, var(--line-2) 50%, transparent 51%) top / 100% 60% no-repeat, linear-gradient(25deg, transparent 49%, var(--line-2) 50%, transparent 51%) top / 100% 60% no-repeat, var(--sunken); }
.sample-from { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.sample-from small { color: var(--muted); font-size: 12px; }
.sample-from strong { font-weight: 600; }
.sample-steps { list-style: none; counter-reset: s; margin: 10px 0 0; padding: 0; display: grid; gap: 7px; font-size: 13px; color: var(--ink-2); }
.sample-steps li { counter-increment: s; display: flex; align-items: center; gap: 9px; }
.sample-steps li::before { content: counter(s); flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--green-bg); color: var(--green); font-size: 11px; font-weight: 700; }
.sample-steps b { color: var(--ink); font-weight: 600; }
.sample-steps em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600; color: var(--amber); background: var(--amber-bg); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
@media (max-height: 860px) { .auth-sample { display: none; } }
.auth-pitch h1 { font-family: var(--serif); font-weight: 500; font-size: 40px; line-height: 1.12; color: #fff; letter-spacing: -0.01em; }
.auth-pitch > p { margin-top: 18px; font-size: 16px; color: #c5d4cc; }
.how { list-style: none; counter-reset: how; padding: 0; margin: 36px 0 0; display: grid; gap: 18px; }
.how li { counter-increment: how; display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; }
.how li::before { content: counter(how); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgb(255 255 255 / 35%); display: grid; place-items: center; font-size: 13px; color: #fff; }
.how strong { color: #fff; font-weight: 600; }
.how span { color: #b9cbc1; }
.auth-fine { color: #9fb5a9; font-size: 13px; }
.auth-panel { display: grid; place-items: center; align-content: center; gap: 0; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 360px; }
.auth-form h2 { font-family: var(--serif); font-size: 28px; font-weight: 500; }
.auth-form > p.muted { margin: 6px 0 10px; }
.auth-switch { margin-top: 18px; color: var(--muted); font-size: 13px; text-align: center; }
.auth-form input { height: 42px; }
.auth-form input:focus-visible { outline: none; }
.auth-form .reveal input { padding-right: 60px; }
.field-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.field-hint.ok { color: var(--green-2); }
.field-hint.ok::before { content: "✓ "; font-weight: 700; }

/* App shell */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 22px 14px; border-right: 1px solid var(--line); background: #fbfaf6; }
.sidebar > .brand { padding: 0 10px 18px; }
.nav { display: grid; gap: 2px; }
.nav-secondary { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 7px; text-align: left; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.nav-item:hover { background: var(--sunken); }
.nav-item.active { background: var(--green-bg); color: var(--green); font-weight: 600; }
.nav-item b { font-weight: 500; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item.active b { color: var(--green); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.dot-on { background: #3a9a6b; }

.main { min-width: 0; padding: 30px 40px 60px; max-width: 1080px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-weight: 500; font-size: 30px; letter-spacing: -0.01em; }
.page-head p { margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }
.page-actions input { width: 220px; height: 36px; }
.banner { background: var(--green-bg); color: var(--green); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.banner-warn { background: var(--amber-bg); color: var(--amber); }
.foot { font-size: 12px; margin-top: 16px; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; margin-bottom: 20px; }
.connect { display: grid; grid-template-columns: 1fr 340px; gap: 40px; }
.connect h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin-bottom: 8px; }
.connect-copy p { color: var(--ink-2); margin-bottom: 12px; max-width: 46ch; }
.connect-form label:first-child { margin-top: 0; }
.connected-line { display: flex; gap: 8px; align-items: center; font-weight: 600; }
#disconnect { margin-top: 18px; display: block; font-weight: 500; }

/* Mail list */
.mail-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mail-list:empty { display: none; }
.mail-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 16px; align-items: center; width: 100%; padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); transition: background 0.1s; }
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: #fafaf6; }
.thumb { width: 52px; height: 38px; border-radius: 4px; background: var(--sunken); overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mail-main { min-width: 0; }
.mail-meta { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); }
.mail-meta strong { color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-title { font-weight: 600; font-size: 14.5px; margin-top: 1px; }
.mail-summary { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.mail-tags { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; max-width: 260px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.chip-action { background: var(--amber-bg); color: var(--amber); }
.chip-done { background: var(--green-bg); color: var(--green); }
.chip-high { background: var(--red-bg); color: var(--red); }
.chip-wait::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.empty { text-align: center; padding: 60px 20px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty h3 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin-bottom: 6px; }

/* Dialogs */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); box-shadow: 0 24px 60px rgb(10 20 15 / 25%); }
dialog::backdrop { background: rgb(20 28 24 / 45%); }
.close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); font-size: 14px; z-index: 2; }
.close:hover { background: var(--sunken); color: var(--ink); }
.modal { width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border-radius: 14px; padding: 28px; }
.modal-wide { width: min(760px, calc(100vw - 32px)); }
.modal h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin-bottom: 6px; padding-right: 30px; }
.sheet { width: min(1200px, calc(100vw - 32px)); height: calc(100vh - 48px); max-height: none; border-radius: 14px; overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; }
.sheet > div { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sheet-doc { width: min(960px, calc(100vw - 32px)); }

/* Segmented control */
.segmented { display: inline-flex; background: var(--sunken); border-radius: 9px; padding: 3px; margin-top: 14px; }
.segmented button { padding: 6px 14px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 10%); }
.segmented-small { margin-top: 16px; }

/* Vault */
.vault-group { margin-top: 24px; }
.vault-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.vault-group-head h3 { font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.vault-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.vault-item strong { display: block; font-weight: 600; }
.vault-item small { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.vault-item .row { margin: 0; gap: 4px; }
.vault-empty { color: var(--muted); font-size: 13px; padding: 12px 0; border-top: 1px solid var(--line); }

/* Detail */
.detail-head { padding: 22px 64px 18px 28px; border-bottom: 1px solid var(--line); }
.detail-head .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.detail-head h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.detail-head .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.detail-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 0.85fr) 1.15fr; }
.detail-cols > section { overflow-y: auto; padding: 24px 28px 40px; }
.detail-source { background: #fbfaf6; border-right: 1px solid var(--line); }
.detail-source h3, .detail-plan h3.label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 24px 0 8px; }
.detail-source p { color: var(--ink-2); }
.quote { border-left: 2px solid var(--line-2); padding: 2px 0 2px 12px; margin: 6px 0; color: var(--ink-2); font-family: var(--serif); font-size: 14.5px; }
.bullets { margin: 0; padding-left: 18px; color: var(--ink-2); }
.bullets li { margin: 3px 0; }
details { margin-top: 14px; }
summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.source-text { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; background: var(--sunken); border-radius: 8px; padding: 12px; max-height: 320px; overflow: auto; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; margin-top: 10px; color: var(--ink-2); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.preview { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.preview .segmented { margin: 0; }
.preview .segmented button { padding: 4px 10px; font-size: 12px; }
#inline-document img { display: block; width: 100%; max-height: 300px; object-fit: contain; background: var(--sunken); }
#inline-document iframe { display: block; width: 100%; height: 420px; border: 0; background: var(--sunken); }
#document-body { padding: 54px 16px 16px; }
#document-body img { display: block; max-width: 100%; max-height: calc(100vh - 140px); margin: 0 auto; }
#document-body iframe { width: 100%; height: calc(100vh - 140px); border: 0; }

/* Plan */
.stepper { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.stepper a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 6px; border-radius: 20px; background: var(--sunken); color: var(--ink-2); text-decoration: none; font-size: 12.5px; font-weight: 600; }
.stepper a span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-size: 11px; }
.stepper a.done span { background: var(--green); color: #fff; }
.plan-section { margin-top: 26px; }
.plan-section > h3 { font-family: var(--serif); font-weight: 500; font-size: 19px; display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.plan-section > h3 small { font-family: var(--sans); font-size: 12.5px; color: var(--muted); font-weight: 500; }
.plan-section > p.muted { margin-bottom: 12px; font-size: 13px; }
.plan-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin: 4px 0 6px; }
.plan-facts b { color: var(--muted); font-weight: 500; margin-right: 4px; }

.steps { list-style: none; padding: 0; margin: 12px 0 0; counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 18px 40px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.steps > li::after { content: ""; position: absolute; left: 13px; top: 30px; bottom: 4px; width: 1px; background: var(--line); }
.steps > li:last-child::after { display: none; }
.step-kind { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.step-kind span { text-transform: none; letter-spacing: 0; font-weight: 500; }
.steps h4 { font-size: 14.5px; font-weight: 650; margin: 2px 0 4px; }
.steps p { color: var(--ink-2); }
.done-when { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.done-when b { color: var(--green); font-weight: 600; }
.step-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.inputs { display: grid; gap: 10px; }
.input-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.input-card.ok { border-color: #bcd5c6; background: #f8fbf9; }
.input-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.input-top strong { font-weight: 650; }
.input-card p { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.input-env { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.input-pick { display: flex; gap: 8px; margin-top: 10px; }
.input-pick select { flex: 1; height: 34px; padding: 4px 10px; }
.input-using { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }
.input-using span { color: var(--ink-2); }
.input-using small { color: var(--muted); font-family: var(--mono); font-size: 12px; }

.handoff { background: var(--green); color: #e6eee9; border-radius: 12px; padding: 22px; margin-top: 12px; }
.handoff p { color: #c5d4cc; font-size: 13.5px; }
.handoff .btn-primary { background: #fff; color: var(--green); border-color: #fff; margin-top: 16px; }
.handoff .btn-primary:hover:not(:disabled) { background: #e9f0ec; }
.handoff .handoff-note { margin-top: 12px; font-size: 12.5px; color: #a9bfb3; }
.handoff code { font-family: var(--mono); font-size: 12px; background: rgb(255 255 255 / 10%); padding: 1px 5px; border-radius: 4px; color: #fff; }
.handoff-missing { margin-top: 12px; font-size: 13px; color: #f6d9a8; }

.sources a { display: block; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.sources a:hover strong { text-decoration: underline; }
.sources strong { font-weight: 600; }
.sources p { color: var(--ink-2); font-size: 13px; }
.sources small { color: var(--muted); font-size: 12px; }

.feedback textarea { margin-top: 10px; }
.history { margin-top: 12px; display: grid; gap: 8px; }
.history article { font-size: 13px; padding: 10px 12px; background: var(--sunken); border-radius: 8px; }
.history article p { margin: 4px 0 2px; color: var(--ink-2); }
.history small { color: var(--muted); }
.generated { color: var(--muted); font-size: 12px; margin-top: 30px; }

.prompt { font-family: var(--mono); font-size: 12px; line-height: 1.55; background: var(--sunken); border: 0; margin-top: 14px; height: 360px; }

/* Admin */
.admin-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
.admin-grid h3 { font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 10px; }
.card-top { display: flex; justify-content: space-between; gap: 10px; }
.card p { color: var(--ink-2); margin: 6px 0; }
.card small { color: var(--muted); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 13px; margin-top: 8px; }
.compare h4 { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.compare ol { padding-left: 18px; margin: 6px 0 0; }
.suggestion { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px; box-shadow: var(--shadow); z-index: 100; max-width: calc(100vw - 32px); }

/* Responsive */
@media (max-width: 960px) {
  .detail-cols { grid-template-columns: 1fr; overflow-y: auto; }
  .detail-cols > section { overflow: visible; }
  .detail-source { border-right: 0; border-bottom: 1px solid var(--line); }
  .connect, .admin-grid { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-story { padding: 24px 24px 28px; gap: 20px; }
  .auth-pitch h1 { font-size: 26px; }
  .auth-pitch > p { font-size: 14.5px; margin-top: 10px; }
  .auth-story .how, .auth-sample { display: none; }
  .auth-panel { place-items: start center; padding: 28px 24px 40px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); gap: 4px 8px; }
  .sidebar > .brand { padding: 0 8px 0 0; }
  .nav { display: flex; overflow-x: auto; gap: 2px; }
  .nav-secondary { margin: 0; padding: 0; border: 0; }
  .nav-item { width: auto; white-space: nowrap; padding: 6px 9px; }
  .main { padding: 20px 16px 48px; }
  .page-actions { width: 100%; }
  .page-actions input { flex: 1; width: auto; }
  .mail-row { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; }
  .thumb { display: none; }
  .mail-tags { justify-content: flex-start; max-width: none; }
  .sheet { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; border-radius: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
.empty-pad { margin: 24px; }
.input-using .row { margin: 0; gap: 2px; flex-wrap: nowrap; }
.fine-inline { color: var(--muted); font-size: 12px; }
@media (max-width: 820px) {
  #inline-document iframe { height: 300px; }
  #inline-document img { max-height: 220px; }
}
#kind-switch + #method-switch:not([hidden]) { margin-left: 8px; }

/* Account switcher */
.account { position: relative; margin-top: auto; padding: 10px 0 0; border-top: 1px solid var(--line); display: block; }
.account-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; }
.account-button:hover, .account-button[aria-expanded="true"] { background: var(--sunken); }
.account-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink); }
.chev { width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-135deg); margin: 3px 4px 0; }
.account-button[aria-expanded="true"] .chev { transform: rotate(45deg); margin-top: -3px; }
.account-button.has-others .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--amber); }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: #fff; background: hsl(var(--hue, 158) 38% 36%); }
.hue-0 { --hue: 158; } .hue-1 { --hue: 28; } .hue-2 { --hue: 210; } .hue-3 { --hue: 340; }
.hue-4 { --hue: 265; } .hue-5 { --hue: 48; } .hue-6 { --hue: 190; } .hue-7 { --hue: 0; }
.account-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgb(10 20 15 / 18%); padding: 6px; z-index: 20; }
.account-menu-list { max-height: 320px; overflow-y: auto; }
.account-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.account-option:hover { background: var(--sunken); }
.account-option-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account-option.current .account-option-email { font-weight: 650; }
.account-option .count { background: var(--amber-bg); color: var(--amber); border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 700; line-height: 20px; }
.account-option .check { color: var(--green); font-weight: 700; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.menu-item:hover { background: var(--sunken); color: var(--ink); }
.modal-narrow { width: min(420px, calc(100vw - 32px)); }
.auth-panel { align-content: center; }
.auth-accounts h2 { font-family: var(--serif); font-size: 28px; font-weight: 500; margin-bottom: 12px; }
.account-list { display: grid; gap: 6px; }
.auth-accounts .account-option { border: 1px solid var(--line); background: var(--surface); padding: 10px 12px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin: 22px 0 6px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 820px) {
  .account { position: absolute; top: 8px; right: 12px; margin: 0; padding: 0; border: 0; }
  .sidebar { position: relative; padding-right: 56px; }
  .account-button { padding: 4px; }
  .account-email, .chev { display: none; }
  .account-menu { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); width: min(320px, calc(100vw - 24px)); }
}

/* Sidebar focus: keep the ring inside the item so it lines up with the active highlight. */
.nav-item:focus-visible, .account-button:focus-visible { outline: 2px solid var(--green-2); outline-offset: -2px; }

/* Vault page */
.vault .vault-group { margin: 0 0 16px; padding: 22px 24px 10px; }
.vault .vault-group-head { align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.vault .vault-group-head h2 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 0; text-transform: none; letter-spacing: 0; color: var(--ink); }
.vault .vault-group-head p { font-size: 13px; margin-top: 2px; }
.vault .vault-item { padding: 13px 0; }
.vault .vault-item:last-child { border-bottom: 0; }
.vault .vault-empty { padding: 16px 0 14px; }
@media (max-width: 560px) {
  .vault .vault-group-head { flex-direction: column; }
}
.nav-item.active:focus-visible { outline: none; }
