:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-soft: #f1f5f7;
  --ink: #0d2242;
  --muted: #5f6d7d;
  --line: #cbd4dc;
  --line-soft: #e3e8ed;
  --teal: #007886;
  --teal-dark: #005d68;
  --teal-soft: #e9f5f6;
  --amber: #d57900;
  --amber-soft: #fff5e6;
  --red: #c33131;
  --red-soft: #fff0f0;
  --green: #1e8a55;
  --radius: 9px;
  --sidebar: 224px;
  --topbar: 72px;
  --focus: 0 0 0 3px rgba(0, 120, 134, .2);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); grid-template-rows: var(--topbar) minmax(0, 1fr); }
.sidebar { grid-row: 1 / 3; background: var(--surface); border-right: 1px solid var(--line); padding: 22px 12px 18px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 20; }
.brand, .login-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 18px; font-weight: 750; letter-spacing: -.02em; padding: 0 10px 24px; }
.brand-mark { width: 28px; height: 28px; display: inline-grid; place-items: center; background: var(--ink); color: white; border-radius: 7px; font-size: 14px; }
.nav-list { display: grid; gap: 6px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 13px; min-height: 50px; padding: 0 12px; border-radius: var(--radius); text-decoration: none; font-size: 15px; font-weight: 600; }
.nav-item::before { content: ""; position: absolute; left: -12px; width: 3px; height: 32px; background: transparent; border-radius: 0 2px 2px 0; }
.nav-item:hover { background: var(--surface-soft); }
.nav-item.active { background: #edf1f3; color: var(--teal-dark); }
.nav-item.active::before { background: var(--teal); }
.nav-item svg, .mailbox-state svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.sidebar-foot { margin-top: auto; display: grid; gap: 4px; padding: 12px 10px 0; color: var(--muted); font-size: 12px; }

.topbar { grid-column: 2; display: flex; align-items: stretch; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
.mailbox-strip { display: flex; align-items: stretch; min-width: 0; overflow: hidden; }
.mailbox-state { position: relative; min-width: 205px; max-width: 255px; padding: 14px 22px; border-right: 1px solid var(--line); display: flex; gap: 12px; align-items: center; text-decoration: none; }
.mailbox-state:hover { background: var(--surface-soft); }
.mailbox-state span { min-width: 0; display: grid; }
.mailbox-state strong { overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.mailbox-state small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #8793a1; display: inline-block; flex: 0 0 auto; }
.status-dot.connectee { background: var(--green); }
.status-dot.synchronisation { background: #f0a100; }
.status-dot.erreur { background: var(--red); }
.mobile-status { display: none; }
.mailbox-empty { padding: 25px; color: var(--muted); }
.user-menu { min-width: 250px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 0 20px; white-space: nowrap; }
.user-avatar, .sender-avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; }
.user-avatar { width: 30px; height: 30px; }
.user-menu form { margin-left: 6px; }
.text-button { appearance: none; background: none; border: 0; color: var(--teal-dark); padding: 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--ink); }

.main-content { grid-column: 2; min-width: 0; min-height: 0; background: var(--bg); }
.workspace-grid { height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); display: grid; grid-template-columns: minmax(640px, 1fr) minmax(320px, 430px); }
.work-list { min-width: 0; padding: 24px 20px; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 19px; }
.page-heading h1, .detail-header h1 { margin: 0; font-size: clamp(26px, 2.4vw, 35px); letter-spacing: -.035em; line-height: 1.1; }
.page-heading p, .detail-header p { margin: 7px 0 0; color: var(--muted); }
.search-row { display: grid; grid-template-columns: minmax(260px, 1fr) 210px auto; gap: 12px; margin-bottom: 14px; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid #aeb9c4; border-radius: 5px; padding: 10px 12px; min-height: 42px; }
input:hover, select:hover, textarea:hover { border-color: #8191a0; }
textarea { resize: vertical; line-height: 1.55; }
label { display: grid; gap: 6px; color: #283c57; font-weight: 650; }
.search-field input { padding-left: 14px; }
.status-filters { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 12px; }
.status-filter { display: inline-flex; align-items: center; gap: 9px; border: 1px solid #aeb9c4; background: var(--surface); border-radius: 6px; min-height: 40px; padding: 0 14px; text-decoration: none; white-space: nowrap; font-weight: 600; }
.status-filter span { min-width: 23px; height: 23px; display: inline-grid; place-items: center; background: var(--surface-soft); border-radius: 50%; font-size: 12px; }
.status-filter.active { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.status-filter.urgent.active, .status-filter.urgent:hover { border-color: var(--amber); background: var(--amber-soft); color: #8d4e00; }
.conversation-table-wrap { min-height: 0; overflow: auto; border: 1px solid var(--line); background: var(--surface); }
.conversation-table, .audit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.conversation-table th, .conversation-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.conversation-table th { background: #fafbfc; color: #37475a; font-size: 11px; font-weight: 700; position: sticky; top: 0; z-index: 2; }
.conversation-table tr { position: relative; }
.conversation-table tbody tr:hover td { background: #f5f8f9; }
.conversation-table tr.selected td { background: var(--teal-soft); }
.conversation-table tr.selected td:first-child { box-shadow: inset 3px 0 var(--teal); }
.row-link, .subject-link { text-decoration: none; display: flex; align-items: center; gap: 7px; }
.subject-link:hover { color: var(--teal-dark); text-decoration: underline; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.mailbox-name { color: var(--muted); }
.priority { display: inline-grid; place-items: center; width: 27px; height: 27px; border: 1.5px solid var(--amber); border-radius: 50%; color: #8a4d00; font-weight: 750; }
.priority-1, .priority-4 { border-color: #e23f3f; color: var(--red); }
.priority-5 { border-color: #8693a0; color: #4a5969; }
.status-text { font-weight: 650; }
.status-urgent { color: var(--red); }
.status-termine { color: var(--green); }
.status-indesirable { color: var(--muted); }
.empty-state { display: grid; place-items: center; gap: 6px; color: var(--muted); min-height: 160px; text-align: center; }
.empty-state strong { color: var(--ink); font-size: 16px; }
.list-footer { height: 48px; flex: 0 0 auto; border: 1px solid var(--line); border-top: 0; background: var(--surface); padding: 0 14px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }

.conversation-preview { min-width: 0; border-left: 1px solid var(--line); background: var(--surface); padding: 26px 22px; overflow-y: auto; }
.preview-header { padding-left: 15px; border-left: 3px solid var(--teal); }
.preview-header h2 { margin: 0 0 14px; font-size: 20px; line-height: 1.28; }
.preview-header p, .preview-header time { display: block; margin: 4px 0; color: var(--muted); font-size: 12px; }
.preview-section { padding: 20px 0; border-top: 1px solid var(--line); margin-top: 20px; }
.preview-section h3 { border-left: 3px solid var(--teal); padding-left: 10px; margin: 0 0 13px; font-size: 14px; }
.ai-section h3::before { content: "✦ "; color: #425fc8; }
.message-excerpt { white-space: pre-line; max-height: 280px; overflow: hidden; }
.action-list, .plain-list { padding: 0; margin: 0; list-style: none; display: grid; gap: 7px; }
.action-list li { position: relative; padding-left: 21px; }
.action-list li::before { content: "✓"; position: absolute; left: 0; font-weight: 800; }
.plain-list { list-style: disc; padding-left: 18px; }
.preview-actions { display: grid; gap: 10px; margin-top: 14px; }
.preview-empty { min-height: 60vh; display: grid; align-content: center; justify-items: center; text-align: center; color: var(--muted); }

.button { min-height: 42px; padding: 0 16px; border-radius: 5px; border: 1px solid #8492a0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 700; cursor: pointer; background: var(--surface); }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--teal-dark); border-color: var(--teal-dark); }
.button.primary:hover { background: #004f59; }
.button.secondary { background: var(--surface); color: var(--teal-dark); }
.button.danger { background: var(--surface); border-color: #db7777; color: var(--red); }
.button.full { width: 100%; }
.button.small { min-height: 34px; font-size: 12px; }

.detail-page { min-height: calc(100vh - var(--topbar)); padding-bottom: 74px; background: var(--surface); }
.detail-header { padding: 16px 24px 18px; border-bottom: 1px solid var(--line); }
.detail-header h1 { font-size: 26px; margin-top: 13px; }
.breadcrumb { color: #345fa8; text-decoration: none; font-weight: 650; margin-right: 8px; }
.detail-header > span { color: var(--muted); margin-right: 8px; }
.detail-grid { display: grid; grid-template-columns: minmax(520px, 1fr) minmax(360px, 470px); }
.thread-column { padding: 22px 24px; border-right: 1px solid var(--line); min-width: 0; }
.thread-column > h2, .analysis-panel > h2, .draft-panel > h2 { font-size: 17px; margin: 0 0 16px; }
.timeline { position: relative; padding-left: 17px; display: grid; gap: 14px; }
.timeline::before { content: ""; position: absolute; top: 0; bottom: 0; left: 2px; width: 2px; background: var(--teal); }
.message-panel { position: relative; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding: 16px; }
.message-panel::before { content: ""; position: absolute; left: -20px; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.message-panel > header { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.sender-avatar { width: 36px; height: 36px; font-size: 11px; }
.message-panel header div { display: grid; min-width: 0; }
.message-panel header strong { overflow: hidden; text-overflow: ellipsis; }
.message-panel header small, .message-panel header time { color: var(--muted); font-size: 11px; }
.message-body, .send-summary pre { font: inherit; white-space: pre-wrap; word-break: break-word; margin: 16px 0; color: #29394c; }
.message-body-placeholder { margin: 16px 0; padding: 14px; border: 1px dashed var(--line); background: var(--surface-soft); }
.message-body-placeholder p { margin: 0 0 10px; color: var(--muted); }
.data-note { color: var(--muted); font-size: 12px; }
.attachments { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.attachments h3 { font-size: 12px; margin: 0 0 9px; }
.attachment-row { display: flex; align-items: center; gap: 10px; min-height: 45px; border-top: 1px solid var(--line-soft); }
.attachment-row > span:nth-child(2) { display: grid; min-width: 0; margin-right: auto; }
.attachment-row small { color: var(--muted); }
.file-icon { font-size: 20px; }
.danger-text { color: var(--red); font-size: 12px; }
.inspector-column { min-width: 0; }
.analysis-panel, .draft-panel { padding: 22px 24px; }
.analysis-panel { border-bottom: 1px solid var(--line); }
.analysis-panel h2::before { content: "✦ "; color: #425fc8; }
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin: 0 0 16px; }
.analysis-grid div { display: grid; gap: 3px; }
.analysis-grid .wide { grid-column: 1 / -1; }
.analysis-grid dt, .analysis-panel h3 { font-weight: 750; font-size: 12px; }
.analysis-grid dd { margin: 0; color: #35475b; }
.analysis-panel h3 { margin: 14px 0 6px; }
.analysis-panel .section-rule { border-left: 3px solid var(--teal); padding-left: 10px; margin-top: 20px; }
.draft-form { display: grid; gap: 11px; }
.draft-form label { grid-template-columns: 72px minmax(0, 1fr); align-items: center; font-size: 12px; }
.draft-form label:has(textarea) { grid-template-columns: 1fr; }
.draft-form textarea { min-height: 260px; }
.action-rail { position: fixed; left: var(--sidebar); right: 0; bottom: 0; height: 70px; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 0 24px; z-index: 15; }
.action-rail form { margin: 0; }

.confirmation-stage { min-height: calc(100vh - var(--topbar)); position: relative; overflow: hidden; padding: 22px; }
.confirmation-backdrop { opacity: .28; filter: blur(1px); }
.confirmation-backdrop h1 { font-size: 28px; }
.ghost-lines { display: grid; gap: 14px; margin-top: 30px; }
.ghost-lines span { height: 70px; border: 1px solid var(--line); background: var(--surface); }
.confirmation-modal { position: absolute; width: min(720px, calc(100% - 40px)); top: 48%; left: 50%; transform: translate(-50%, -50%); max-height: calc(100vh - 120px); overflow-y: auto; background: var(--surface); border: 1px solid #9dabb7; border-radius: 7px; padding: 22px 26px; box-shadow: 0 18px 55px rgba(13,34,66,.18); }
.confirmation-modal > header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.confirmation-modal h1 { font-size: 22px; margin: 0; }
.confirmation-modal header p { margin: 5px 0 0; color: var(--muted); }
.modal-close { font-size: 28px; text-decoration: none; line-height: 1; }
.irreversible-warning { color: var(--amber); font-weight: 750; padding: 14px 0; }
.send-summary { display: grid; gap: 10px; margin: 0; }
.send-summary > div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 12px; }
.send-summary dt { font-weight: 750; }
.send-summary dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.send-summary pre { max-height: 180px; overflow-y: auto; background: #fafbfc; border: 1px solid var(--line-soft); padding: 10px; }
.send-summary code { font-size: 11px; }
.external-warning { border: 1px solid #e8a44c; background: var(--amber-soft); padding: 12px 14px; margin-top: 16px; }
.external-warning p { margin: 4px 0; }
.check-row { display: flex; grid-template-columns: auto 1fr; flex-direction: row; align-items: flex-start; gap: 9px; margin-top: 14px; font-weight: 600; }
.check-row input { width: 18px; min-height: 18px; margin: 1px 0 0; }
.modal-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }

.standard-page { padding: 28px; }
.narrow-page { max-width: 1000px; margin: 0 auto; }
.mailbox-admin-grid { display: grid; grid-template-columns: minmax(460px, 1.2fr) minmax(400px, .8fr); gap: 22px; align-items: start; }
.mailbox-list-panel, .form-panel, .rule-editor, .settings-list, .security-reminder { background: var(--surface); border: 1px solid var(--line); padding: 20px; }
.mailbox-list-panel > h2, .form-panel > h2 { margin: 0 0 16px; font-size: 17px; }
.mailbox-row { border-top: 1px solid var(--line); padding: 16px 0; }
.mailbox-row:first-of-type { border-top: 0; }
.mailbox-row-main { display: flex; align-items: center; gap: 10px; }
.mailbox-row-main div { display: grid; }
.mailbox-row-main span { color: var(--muted); font-size: 12px; }
.mailbox-row dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; background: #fafbfc; padding: 11px; margin: 12px 0; }
.mailbox-row dl div { display: grid; }
.mailbox-row dt { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.mailbox-row dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.danger-zone { margin-top: 12px; border-left: 3px solid #d98787; padding-left: 10px; color: var(--muted); }
.danger-zone summary { color: var(--red); cursor: pointer; font-weight: 650; }
.danger-zone form { display: flex; gap: 8px; }
.danger-zone input { min-height: 34px; }
.stack-form { display: grid; gap: 14px; }
.two-column-form { grid-template-columns: 1fr 1fr; }
.two-column-form .wide { grid-column: 1 / -1; }
.form-check { align-self: center; }
.optional { color: var(--muted); font-weight: 400; }
.rule-editor { margin-bottom: 18px; }
.rule-editor header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.rule-editor h2 { margin: 0; font-size: 17px; }
.rule-editor header span { color: var(--muted); }
.code-editor { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; min-height: 260px; }
.alert { padding: 12px 14px; border: 1px solid var(--line); margin: 12px 0; }
.alert-error { border-color: #dc7777; background: var(--red-soft); color: #8e1e1e; }
.alert-success { border-color: #78b69a; background: #eff9f3; color: #176b42; }
.alert-warning { border-color: #e2a653; background: var(--amber-soft); color: #875000; }
.alert-info { border-color: #83b4ba; background: var(--teal-soft); margin-bottom: 18px; }
.audit-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
.audit-table th, .audit-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.audit-table th { background: #fafbfc; font-size: 11px; position: sticky; top: 0; }
.audit-table small { display: block; color: var(--muted); }
.audit-table code { white-space: pre-wrap; font-size: 10px; }
.audit-outcome { font-weight: 700; color: var(--green); }
.audit-outcome.echec, .audit-outcome.etat_inconnu { color: var(--red); }
.settings-list { padding: 0; }
.settings-list > div { display: flex; justify-content: space-between; gap: 20px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.settings-list > div:last-child { border-bottom: 0; }
.settings-list span { color: var(--muted); }
.security-reminder { margin-top: 20px; }
.security-reminder h2 { font-size: 17px; margin: 0 0 7px; }
.security-reminder p { margin: 0; color: var(--muted); }
.settings-security-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.user-admin { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); padding: 20px; }
.user-admin h2, .form-panel h2 { font-size: 17px; margin: 0 0 14px; }
.user-list { border: 1px solid var(--line-soft); margin-bottom: 18px; }
.user-list > div { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.user-list > div:last-child { border-bottom: 0; }
.user-list span { display: grid; }
.user-list small { color: var(--muted); }
.user-create-form { border-top: 1px solid var(--line); padding-top: 18px; }
.totp-panel { max-width: 680px; }
.totp-panel ol { padding-left: 20px; line-height: 1.8; }
.code-input, .provisioning-uri { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.provisioning-uri { display: block; padding: 10px; background: var(--surface-soft); margin: 8px 0 16px; }

.login-body { min-height: 100vh; display: grid; place-items: center; background: #f3f6f8; padding: 20px; }
.login-panel { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); padding: 34px; }
.login-panel .login-brand { padding: 0 0 26px; }
.login-panel h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.login-panel > p { color: var(--muted); margin: 8px 0 22px; }
.login-note { border-top: 1px solid var(--line-soft); padding-top: 18px; font-size: 12px; margin-bottom: 0 !important; }

@media (max-width: 1180px) {
  .mailbox-state { min-width: 170px; padding-inline: 14px; }
  .workspace-grid { grid-template-columns: minmax(600px, 1fr) 340px; }
  .conversation-table th:nth-child(3), .conversation-table td:nth-child(3) { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .thread-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .mailbox-admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  :root { --sidebar: 72px; }
  .brand span:last-child, .nav-item { font-size: 0; }
  .brand { justify-content: center; padding-inline: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item svg { width: 24px; height: 24px; }
  .nav-item::before { left: -12px; }
  .sidebar-foot { display: none; }
  .mailbox-state { min-width: 48px; width: 48px; padding: 0 13px; }
  .mailbox-state > span { display: none; }
  .mailbox-state .mobile-status { display: block; position: absolute; right: 7px; bottom: 16px; width: 6px; height: 6px; box-shadow: 0 0 0 2px var(--surface); }
  .user-menu { min-width: 205px; }
  .workspace-grid { height: auto; min-height: calc(100vh - var(--topbar)); grid-template-columns: 1fr; }
  .work-list { overflow: visible; }
  .conversation-table-wrap { max-height: 60vh; }
  .conversation-preview { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 680px) {
  :root { --topbar: 58px; }
  .app-shell { display: block; padding-bottom: 66px; }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 66px; border-right: 0; border-top: 1px solid var(--line); padding: 6px; display: block; z-index: 50; }
  .brand, .sidebar-foot { display: none; }
  .nav-list { height: 100%; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: 1px; }
  .nav-item { min-height: 52px; }
  .nav-item::before { left: 25%; right: 25%; top: -6px; width: 50%; height: 3px; }
  .topbar { height: var(--topbar); position: sticky; top: 0; z-index: 30; }
  .mailbox-strip { padding-left: 4px; }
  .user-menu { min-width: 0; margin-left: auto; padding: 0 10px; }
  .user-menu > span:nth-child(2) { display: none; }
  .user-menu form { margin-left: 0; }
  .user-menu .text-button { font-size: 0; text-decoration: none; }
  .user-menu .text-button::after { content: "↪"; font-size: 20px; }
  .main-content { min-height: calc(100vh - var(--topbar) - 66px); }
  .work-list, .standard-page { padding: 18px 12px; }
  .page-heading h1 { font-size: 27px; }
  .search-row { grid-template-columns: 1fr; }
  .search-row .button { display: none; }
  .conversation-table th:nth-child(3), .conversation-table td:nth-child(3),
  .conversation-table th:nth-child(4), .conversation-table td:nth-child(4),
  .conversation-table th:nth-child(6), .conversation-table td:nth-child(6) { display: none; }
  .conversation-table th, .conversation-table td { padding: 10px 8px; }
  .conversation-table-wrap { max-height: none; }
  .conversation-preview { padding: 22px 16px; }
  .detail-header { padding: 14px; }
  .detail-header h1 { font-size: 22px; }
  .thread-column, .analysis-panel, .draft-panel { padding: 18px 14px; }
  .message-panel > header { grid-template-columns: 34px 1fr; }
  .message-panel header time { grid-column: 2; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-grid .wide { grid-column: 1; }
  .draft-form label { grid-template-columns: 1fr; }
  .action-rail { position: static; height: auto; flex-wrap: wrap; padding: 12px; }
  .action-rail > *, .action-rail form, .action-rail .button { flex: 1 1 44%; }
  .confirmation-stage { padding: 8px; min-height: calc(100vh - var(--topbar)); }
  .confirmation-modal { position: relative; inset: auto; transform: none; width: 100%; max-height: none; padding: 18px 14px; }
  .confirmation-backdrop { display: none; }
  .send-summary > div { grid-template-columns: 1fr; gap: 2px; }
  .modal-actions { position: sticky; bottom: 0; background: var(--surface); padding-top: 12px; }
  .two-column-form { grid-template-columns: 1fr; }
  .two-column-form .wide { grid-column: 1; }
  .mailbox-row dl { grid-template-columns: 1fr; }
  .login-panel { padding: 25px 20px; }
  .settings-security-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .nav-item, .status-filter { transition: background-color .15s ease, border-color .15s ease, transform .15s ease, color .15s ease; }
}
