:root {
  font-family: "Pretendard", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #25241f; background: #fffefa; font-synthesis: none; font-size: 14px;
  --muted: #706d65; --border: #e8e5de; --soft: #f7f5ef; --focus: #585148;
  --sidebar-width: 216px; --header-height: 72px;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; min-height: 40px; padding: 10px 15px; font-weight: 550; }
button:disabled { cursor: default; opacity: .45; }
button, input, select, textarea { border: 1px solid var(--border); border-radius: 5px; background: #fffefa; }
button:hover:not(:disabled) { background: #f3f1e9; }
button.primary { background: #292720; color: #fffefa; border-color: #292720; }
button.primary:hover:not(:disabled) { background: #454137; }
button.danger { color: #a62c2c; border-color: #e7caca; }
button.quiet { background: transparent; border-color: transparent; color: #706a60; }
input, select, textarea { padding: 11px 12px; min-height: 44px; max-width: 100%; outline: none; }
textarea { resize: vertical; line-height: 1.7; }
input:focus, textarea:focus, select:focus { border-color: #81796a; }
input[type="checkbox"] { width: 17px; height: 17px; min-height: 17px; accent-color: #202124; padding: 0; cursor: pointer; }
label { font-weight: 550; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; letter-spacing: -.8px; line-height: 1.35; }
h2 { font-size: 22px; letter-spacing: -.5px; line-height: 1.45; }
h3 { font-size: 16px; }
p { line-height: 1.7; }
small, .muted { color: var(--muted); }
small { font-size: 12px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.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; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; background: #fff; padding: 12px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; width: 40px; height: 40px; padding: 0; border-color: transparent; background: transparent; border-radius: 5px; }
.with-icon { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.divider { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }

/* A restrained header frames the mailbox without competing with messages. */
#app:has(#mail-header) { height: 100dvh; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#mail-header { flex: 0 0 var(--header-height); }
.topbar { height: var(--header-height); display: flex; align-items: center; gap: 14px; padding: 0 24px 0 18px; background: #fffefa; border-bottom: 1px solid var(--border); position: relative; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand img { width: 89px; height: 29px; object-fit: contain; }
.brand span { font-size: 20px; color: #292720; letter-spacing: -.5px; font-weight: 500; }
.topbar > .brand { min-width: 140px; }
.menu-toggle { flex: none; color: #706a60; }
.header-context { font-size: 12px; color: #706d65; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 15px; flex: 1; }
.header-compose { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.header-compose > button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; min-height: 39px; border: 1px solid #292720; border-radius: 5px; font-size: 12px; white-space: nowrap; }
.header-compose svg { width: 18px; height: 18px; }
.header-search { flex: 1; min-width: 0; max-width: 760px; margin-left: 10px; }
.search-form { position: relative; display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.search-input-row { position: relative; display: flex; align-items: center; min-width: 0; }
.search-input-row > input { flex: 1; min-width: 0; }
.search-input-row > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: #968d7e; pointer-events: none; }
.search-input-row > [data-action="clear-search"] { position: absolute; right: 82px; left: auto; top: 2px; }
.search-form .search-submit[type="submit"] { position: static; width: 68px; flex: none; margin-left: 8px; min-height: 44px; padding: 9px 12px; border: 1px solid #b9af9e; border-radius: 5px; background: transparent; font-size: 12px; }
.search-input-row > input { width: 100%; padding: 11px 45px; border-color: #d8d3c8; border-radius: 5px; background: #fffefa; font-size: 13px; height: 44px; }
.search-input-row > input:focus { background: #fff; box-shadow: none; border-color: #70695e; }
.search-form input::-webkit-search-cancel-button { -webkit-appearance: none; }
.account { position: relative; min-width: 0; margin-left: 7px; }
.account-toggle { display: flex; gap: 10px; align-items: center; border-color: transparent; background: transparent; padding: 5px 7px; border-radius: 5px; }
.account-initial { width: 31px; height: 31px; background: #eeebe3; border: 1px solid #e1dccf; border-radius: 6px; display: grid; place-items: center; font-size: 12px; color: #70695e; font-weight: 550; flex: none; }
.account-label { display: block; max-width: 140px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.account-toggle > svg { width: 15px; height: 15px; color: #82868d; }
.account-menu { position: absolute; right: 0; top: 50px; width: min(290px, calc(100vw - 32px)); background: #fffefa; border: 1px solid #dbd6cc; border-radius: 6px; padding: 20px; box-shadow: 0 8px 24px #29272012; z-index: 50; }
.account-menu p { font-size: 13px; overflow-wrap: anywhere; }
.account-menu button { margin-top: 12px; width: 100%; text-align: left; }
#workspace-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); padding: 0; }
.mail-surface { min-width: 0; min-height: 0; overflow: hidden; background: #fffefa; border: 0; border-radius: 0; display: flex; flex-direction: column; }
.workspace[data-step="list"] .mail-surface > .reader, .workspace[data-step="reader"] .mail-surface > .mail-list { display: none; }
.workspace.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
.workspace.sidebar-collapsed > .sidebar { display: none; }
.mobile-only, .sidebar-backdrop { display: none; }
.sidebar-heading { display: none; }

/* Navigation. */
.sidebar { padding: 27px 15px 17px; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; }
.sidebar-mailbox { margin: 0 0 24px; padding: 0 10px 18px; border-bottom: 1px solid var(--border); }
.sidebar-mailbox > label { display: block; font-size: 10px; color: #746f65; font-weight: 500; margin-bottom: 7px; }
.mailbox-picker { width: 100%; font-size: 12px; background: transparent; border-color: transparent; padding: 6px 0; margin: 0; color: #504b43; min-height: 35px; }
.folder-nav { display: flex; flex-direction: column; gap: 4px; }
.folder-button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 39px; background: transparent; border: 0; border-left: 2px solid transparent; border-radius: 0; text-align: left; color: #706d65; padding: 9px 12px; font-weight: 450; font-size: 12px; }
.folder-button svg { width: 17px; height: 17px; }
.folder-button.selected { background: #f4f1e8; color: #292720; font-weight: 600; border-left-color: #292720; }
.folder-button > span { flex: 1; }
.folder-button > .folder-count { flex: 0 0 auto; font-size: 11px; min-width: 15px; text-align: right; color: #666d77; font-weight: 550; }
.sidebar-bottom { margin-top: auto; padding-top: 32px; }
.sidebar-bottom .folder-button { font-size: 12px; }
.mailbox-usage { font-size: 10px; color: #746f65; line-height: 1.7; margin: 20px 13px 0; }
.sidebar footer { font-size: 10px; color: #746f65; padding: 16px 13px 0; }
.mailbox-disabled { margin-bottom: 15px; }

/* Search is a part of the mailbox, with explicit scope and useful filters. */
.search-panel { padding: 27px 32px 23px; border-bottom: 1px solid var(--border); flex: none; }
.search-panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.search-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; min-width: 0; }
.search-heading h1 { font-size: 25px; font-weight: 550; letter-spacing: -.8px; }
.folder-summary { font-size: 11px; color: #746f65; line-height: 1.7; font-weight: 400; }
.search-panel .search-form { max-width: 720px; }
.search-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 15px; margin-top: 13px; color: #706a5f; font-size: 11px; }
.search-filters select { min-height: 36px; padding: 7px 10px; width: 204px; font-size: 12px; color: #6a6255; }
.scope-filter { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 400; }
.sender-filter { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 400; }
.sender-filter input { width: 185px; min-height: 36px; padding: 7px 10px; font-size: 11px; }
.search-filters .check-label { min-height: 36px; font-size: 11px; color: #706d65; white-space: nowrap; }
.search-filters .quiet { font-size: 11px; min-height: 36px; padding: 7px 9px; }
.search-pending { display: block; font-size: 11px; line-height: 1.65; color: #706d65; margin-top: 11px; }

/* Selection and message opening are distinct controls. */
.mail-list { display: flex; flex-direction: column; min-width: 0; min-height: 0; flex: 1; }
.list-header { padding: 0 20px; }
.list-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list-title h1 { font-size: 17px; font-weight: 550; letter-spacing: -.3px; }
.mail-list > .list-title { padding: 14px 27px; min-height: 51px; border-bottom: 1px solid var(--border); gap: 13px; flex-wrap: wrap; flex: none; }
.list-toolbar { display: flex; align-items: center; min-height: 56px; padding: 8px 24px; gap: 13px; border-bottom: 1px solid var(--border); flex-wrap: wrap; flex: none; }
.bulk-action { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; min-height: 35px; padding: 8px 10px; border-color: transparent; background: transparent; white-space: nowrap; }
.bulk-action svg { width: 16px; height: 16px; }
.list-tools, .selection-tools { display: flex; align-items: center; gap: 3px; min-width: 0; }
.selection-tools { gap: 5px; }
.selection-tools > span, .selection-count { color: #5f6368; font-size: 12px; margin: 0 8px; white-space: nowrap; }
.select-all-label { display: grid; place-items: center; width: 40px; min-height: 40px; flex: none; cursor: pointer; }
.list-toolbar .icon-button { color: #6b7077; }
.list-toolbar .icon-button:hover { color: #202124; }
.list-toolbar .list-title { margin-right: auto; }
.list-range { color: #746f65; font-size: 11px; white-space: nowrap; margin-left: auto; }
.search-scope { color: #746f65; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-row { display: flex; align-items: center; gap: 15px; color: #746f65; font-size: 12px; margin-left: auto; white-space: nowrap; }
.check-label, .unread-toggle { display: flex; align-items: center; gap: 9px; min-height: 40px; font-weight: 400; font-size: 12px; cursor: pointer; }
.messages { overflow-y: auto; min-height: 0; flex: 1; overscroll-behavior: contain; padding-bottom: 8px; }
.day-heading { display: flex; align-items: center; gap: 15px; padding: 18px 32px 10px; font-size: 10px; color: #746f65; letter-spacing: .15px; font-weight: 450; }
.day-heading::after { content: ""; height: 1px; background: #eeebe4; flex: 1; }
.message-row { display: flex; position: relative; align-items: center; min-height: 65px; padding: 0 22px; gap: 0; border-bottom: 1px solid #eeeae2; background: #fffefa; }
.message-row.unread { background: #fffefa; }
.message-row.checked, .message-row.selected { background: #f0ece2; }
.message-row:hover { background: #f7f4ec; box-shadow: none; z-index: 1; }
.message-row.checked:hover, .message-row.selected:hover { background: #eee8db; }
.row-check { width: 32px; min-height: 44px; display: grid; place-items: center; flex: none; cursor: pointer; }
.message-row > .star { width: 36px; min-width: 36px; height: 40px; color: #9298a1; }
.star.active { color: #a77d20; }
.star.active svg { fill: #d8ae4a66; }
.message-select { border: 0; border-radius: 0; background: transparent !important; text-align: left; min-width: 0; flex: 1; padding: 16px 12px; font-weight: 400; display: grid; align-items: center; grid-template-columns: 155px minmax(0, 1fr) 18px 60px; gap: 14px; min-height: 65px; }
.row-sender { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #746c5f; font-size: 12px; }
.row-copy { display: flex; align-items: baseline; min-width: 0; gap: 8px; overflow: hidden; }
.row-subject { font-size: 13px; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4c463b; min-width: 0; flex: 0 1 auto; }
.row-preview { font-size: 12px; line-height: 1.6; color: #706a5f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 100px; min-width: 0; }
.row-origin { display: inline-flex; align-items: center; max-width: 90px; border: 1px solid #d9d2c5; border-radius: 3px; padding: 2px 6px; font-size: 11px; color: #706a5f; white-space: nowrap; flex: none; }
.row-preview:not(:empty)::before { content: "— "; color: #746f65; }
.row-date { grid-column: 4; white-space: nowrap; font-size: 11px; color: #746f65; text-align: right; }
.message-row.unread .row-subject, .message-row.unread .row-sender { font-weight: 600; color: #292720; }
.message-row.unread .row-date { font-weight: 600; color: #5b616b; }
.row-status, .row-attachment { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; color: #956b2e; flex: none; }
.row-attachment { color: #746f65; grid-column: 3; justify-self: end; }
.row-status svg, .row-attachment svg { width: 13px; height: 13px; }
.row-actions { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 0; padding-left: 10px; background: #f7f4ec; visibility: hidden; opacity: 0; }
.message-row:hover .row-actions, .message-row:focus-within .row-actions { visibility: visible; opacity: 1; }
.message-row.checked .row-actions { background: #eee8db; }
.row-actions .icon-button { width: 36px; min-width: 36px; height: 36px; color: #6c727b; }
.load-more { margin: 23px auto; display: block; width: fit-content; min-width: 170px; border-color: #e1dbcf; background: transparent; font-size: 11px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 70px 28px; gap: 13px; min-height: 320px; color: #746f65; }
.empty-state > svg { width: 35px; height: 35px; color: #bcc2ca; stroke-width: 1.3; }
.empty-state h2 { font-size: 16px; color: #646b75; letter-spacing: -.2px; font-weight: 500; }
.empty-state p { font-size: 13px; max-width: 290px; }
.empty-state button { margin-top: 8px; font-size: 13px; }
.mobile-compose { display: none; }

/* Reader. */
.reader { display: flex; flex-direction: column; min-width: 0; min-height: 0; flex: 1; overflow-y: auto; padding: 0 34px 34px; }
.reader > * { flex-shrink: 0; }
.reader > .empty-state { height: 100%; }
.reader-toolbar { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 8px; min-height: 61px; flex: none; }
.toolbar-group, .reader-navigation { display: flex; align-items: center; gap: 4px; }
.toolbar-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #746f65; margin-right: 5px; }
.reader-navigation > span { font-size: 11px; color: #746f65; white-space: nowrap; margin-right: 5px; }
.reader-toolbar .icon-button { color: #6b7078; }
.next-message svg { transform: rotate(180deg); }
.reader-header { padding: 30px 0 23px; border-bottom: 1px solid var(--border); }
.reader-header h2 { overflow-wrap: anywhere; margin-bottom: 24px; font-size: 26px; font-weight: 550; letter-spacing: -.8px; color: #292720; }
.message-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; font-size: 12px; color: #746f65; line-height: 1.8; }
.sender-name { font-size: 14px; font-weight: 550; color: #514a3f; }
.sender-address, .recipient-address { overflow-wrap: anywhere; }
.message-date { white-space: nowrap; font-size: 11px; padding-top: 4px; }
.recipient-details { margin-top: 8px; font-size: 12px; line-height: 1.8; color: #737b86; }
.recipient-details summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; width: fit-content; gap: 7px; }
.recipient-details summary svg { width: 14px; height: 14px; }
.recipient-details dl { margin: 0; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 6px; }
.recipient-details dt { color: #746f65; }
.recipient-details dd { margin: 0; overflow-wrap: anywhere; }
.message-text { font-family: inherit; font-size: 14px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; margin: 28px 0; min-height: 80px; color: #5a5347; }
.attachments { border-top: 1px solid var(--border); padding-top: 21px; margin-top: 25px; }
.attachments h3 { font-size: 12px; font-weight: 550; color: #746f65; margin-bottom: 12px; }
.attachment-link { display: flex; align-items: center; gap: 10px; min-height: 44px; width: fit-content; max-width: 100%; text-decoration: none; padding: 10px 13px; background: transparent; border: 1px solid #ded8cd; border-radius: 5px; margin-bottom: 8px; font-size: 12px; }
.attachment-link:hover { background: #f5f1e8; }
.attachment-link span { overflow-wrap: anywhere; }
.attachment-link small { white-space: nowrap; margin-left: 8px; }
.reply-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 35px; }
.reply-actions button { font-size: 12px; border-radius: 5px; padding: 10px 17px; }
.inline-note { background: #f7f4ed; border-radius: 5px; border-left: 2px solid #c7beae; padding: 14px 17px; margin: 21px 0; font-size: 13px; line-height: 1.7; color: #706a5f; }
.inline-note.warning { background: #fff8ee; color: #7f5a2d; }
.inline-note.error { background: #fff5f4; color: #8e2929; }
.shared-note { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #746f65; margin-top: 11px; }
.shared-note svg { width: 14px; height: 14px; }
.body-view { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 20px; }
.body-view button { font-size: 11px; border-radius: 5px; }
.body-view span { font-size: 11px; color: #746f65; }
.email-frame { width: 100%; height: 480px; border: 1px solid var(--border); border-radius: 5px; margin-top: 15px; background: #fff; flex: none; }
.email-frame + .attachments { margin-top: 20px; }
.reader-loading { padding: 50px 0; color: #746f65; font-size: 13px; }

/* Snackbar does not alter mailbox height or scroll position. */
.notice { position: fixed; left: calc(var(--sidebar-width) + 20px); bottom: 24px; z-index: 60; padding: 11px 12px 11px 18px; background: #353026; border: 1px solid #353026; border-radius: 5px; color: #fffefa; box-shadow: 0 5px 15px #29272015; font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 15px; line-height: 1.6; max-width: min(560px, calc(100vw - var(--sidebar-width) - 45px)); }
.notice.error { background: #fff7f5; color: #922f28; border-color: #e8ceca; }
.notice > span { overflow-wrap: anywhere; }
.notice .icon-button { flex: none; width: 32px; height: 32px; min-width: 32px; color: inherit; }
.notice:not(.error) .icon-button:hover { background: #ffffff15; }
.notice-undo { flex: none; color: #fff; font-size: 12px; background: transparent; border-color: transparent; padding: 6px 10px; min-height: 32px; text-decoration: underline; }
.notice-undo:hover:not(:disabled) { background: #ffffff15; }
.notice.error .notice-undo { color: inherit; }

/* Sign-in and initial address allocation. */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; gap: 25px; background: #fffefa; }
.welcome-panel { max-width: 420px; width: 100%; padding-top: 26px; border-top: 1px solid #c9c1b3; }
.welcome .brand { align-self: flex-start; margin-bottom: 40px; }
.welcome h1 { margin-bottom: 12px; }
.welcome .lead { color: #706a5f; margin-bottom: 28px; }
.welcome footer { font-size: 11px; color: #746f65; margin-top: 40px; }
.welcome-panel > button { width: 100%; }
.setup-form { margin-top: 28px; }
.setup-form label { display: block; font-size: 13px; margin-bottom: 9px; }
.address-input { display: flex; border: 1px solid #d4cabb; border-radius: 5px; align-items: center; overflow: hidden; }
.address-input:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.address-input input { min-width: 0; flex: 1; border: 0; outline: none !important; }
.address-input span { padding-right: 13px; color: #737b85; font-size: 14px; white-space: nowrap; }
.field-hint { font-size: 12px; color: #746f65; line-height: 1.7; margin-top: 9px; }
.availability { min-height: 53px; font-size: 13px; line-height: 1.65; padding: 13px 0; overflow-wrap: anywhere; }
.availability.valid { color: #2a6748; }
.availability.invalid { color: #a62c2c; }
.setup-form .primary { width: 100%; margin-top: 12px; }
.setup-form .address-policy { font-size: 12px; color: #746f65; margin-top: 17px; }
.setup-shared { width: 100%; margin-top: 16px; }
.welcome-account { font-size: 12px; color: #746f65; margin-top: 25px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.welcome-account button { font-size: 12px; }
.welcome-error { font-size: 13px; color: #952c2c; line-height: 1.7; margin: 15px 0; }

/* Administration exposes metadata separately from the reader. */
.admin-pane { flex: 1; min-width: 0; min-height: 0; padding: 30px 34px; overflow-y: auto; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.admin-heading h1 { font-size: 25px; font-weight: 550; color: #292720; }
.admin-pane > .lead { font-size: 13px; color: #746f65; max-width: 650px; line-height: 1.8; margin-bottom: 25px; }
.admin-tabs { display: flex; gap: 7px; margin: 24px 0; border-bottom: 1px solid var(--border); }
.admin-tabs button { border: 0; border-radius: 0; color: #746f65; border-bottom: 2px solid transparent; background: transparent; margin-bottom: -1px; }
.admin-tabs button.selected { color: #202124; border-bottom-color: #202124; }
.mailbox-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.mailbox-table th { font-size: 11px; color: #746f65; font-weight: 500; padding: 13px 12px; border-bottom: 1px solid #dfe3e8; white-space: nowrap; }
.mailbox-table td { padding: 20px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.mailbox-table td:first-child, .mailbox-table th:first-child { padding-left: 0; }
.mailbox-table td:last-child { text-align: right; padding-right: 0; }
.mailbox-table .mailbox-address { font-weight: 550; overflow-wrap: anywhere; }
.mailbox-table small { display: block; margin-top: 5px; }
.mailbox-table button { font-size: 12px; }
.status-disabled { color: #a62c2c; }
.audit-list { list-style: none; padding: 0; margin: 0; }
.audit-list li { display: flex; justify-content: space-between; gap: 15px; padding: 18px 0; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.audit-list time { font-size: 11px; color: #746f65; white-space: nowrap; }
.audit-identity { font-size: 11px; color: #746f65; margin-top: 7px; }
.audit-identity summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; }
.audit-identity span { overflow-wrap: anywhere; }
.busy { color: #746f65; font-size: 13px; line-height: 1.8; }

/* Composing gets its own space on wide screens, with a focused drawer below. */
.modal-scrim { position: fixed; inset: 0; z-index: 80; background: #29272038; display: flex; align-items: center; justify-content: center; padding: 24px; }
.dialog { width: min(720px, 100%); max-height: calc(100dvh - 48px); background: #fffefa; box-shadow: 0 8px 28px #29272018; border: 1px solid #d4cabb; border-radius: 6px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 15px 9px 20px; border-bottom: 1px solid var(--border); flex: none; }
.dialog-header h2 { font-size: 15px; font-weight: 550; letter-spacing: -.25px; }
.dialog-body { padding: 20px 23px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.dialog-footer { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fffefa; flex: none; }
.dialog-footer .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.dialog-footer button { font-size: 12px; }
.compose-shell { position: fixed; z-index: 40; inset: 88px 24px 24px auto; width: 516px; pointer-events: none; }
.compose-dialog { width: 100%; height: 100%; max-height: none; border-radius: 6px; pointer-events: auto; box-shadow: 0 2px 15px #29272008; }
.compose-dialog .dialog-header { background: #f7f4ed; padding-top: 14px; padding-bottom: 14px; }
.compose-controls { display: flex; align-items: center; gap: 0; }
.compose-controls .icon-button { width: 32px; min-width: 32px; height: 32px; }
.compose-controls svg { width: 17px; height: 17px; }
.compose-dialog .dialog-body { display: flex; flex-direction: column; flex: 1; padding: 6px 21px 14px; }
.compose-from { display: flex; gap: 12px; font-size: 11px; color: #746f65; padding: 6px 0; overflow-wrap: anywhere; flex: none; }
.compose-from > span:first-child { flex: 0 0 68px; white-space: nowrap; }
.compose-from > span:last-child { min-width: 0; }
.compose-restore { background: transparent; border: 0; border-radius: 0; padding: 0; min-height: 32px; color: inherit; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; font-size: inherit; }
.compose-line { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); flex: none; }
.compose-line > label { font-size: 12px; color: #746f65; width: 68px; flex: none; white-space: nowrap; }
.compose-line > input { flex: 1; min-width: 0; border: 0; border-radius: 0; padding: 12px 0; outline-offset: -2px; font-size: 13px; }
.compose-extra { display: block; margin: 0; flex: none; }
.compose-extra > summary { font-size: 11px; color: #746f65; min-height: 38px; display: flex; justify-content: flex-end; align-items: center; cursor: pointer; }
.compose-text-label { font-size: 11px; color: #746f65; margin: 16px 0 12px; flex: none; }
.compose-text { flex: 1 0 120px; min-height: 120px; border: 0; border-radius: 0; padding: 0; font-size: 14px; resize: none; }
.compose-text:focus-visible { outline: 2px solid #8b8479; outline-offset: 4px; }
.compose-note { font-size: 11px; line-height: 1.6; color: #746f65; margin: 12px 0 0; flex: none; }
.compose-error { color: #952c2c; background: #fff5f4; padding: 11px 13px; border-radius: 7px; line-height: 1.6; font-size: 12px; margin-top: 12px; overflow-wrap: anywhere; flex: none; }
.locked-compose-note { margin-top: 12px; }
.compose-error button { margin-top: 10px; font-size: 12px; }
.compose-file-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 7px; flex: none; }
.compose-file-list li { display: flex; align-items: center; max-width: 100%; border: 1px solid var(--border); border-radius: 4px; padding-left: 10px; font-size: 12px; gap: 8px; }
.compose-file-list span { overflow-wrap: anywhere; }
.compose-file-list small { white-space: nowrap; }
.compose-file-list .icon-button { width: 36px; min-width: 36px; height: 36px; }
.compose-save-state { font-size: 10px; color: #746f65; line-height: 1.6; max-width: 140px; text-align: right; white-space: nowrap; }
.attachment-progress { font-size: 12px; color: #746f65; margin: 10px 0; flex: none; }
.compose-shell.expanded { inset: 0; width: auto; background: #29272038; display: flex; align-items: center; justify-content: center; padding: 32px; pointer-events: auto; z-index: 50; }
.compose-shell.expanded .compose-dialog { width: min(1000px, 100%); height: calc(100dvh - 64px); max-height: calc(100dvh - 64px); border-radius: 6px; }
.compose-shell.minimized { inset: auto 24px 20px auto; width: 320px; height: auto; }
.compose-shell.minimized .compose-dialog { width: 100%; height: auto; }
.compose-shell.minimized .dialog-body, .compose-shell.minimized .dialog-footer { display: none; }
.compose-shell.minimized .dialog-header { border-bottom: 0; }
.compose-shell.minimized .dialog-header h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog.confirm { width: min(440px, 100%); }
.confirm .dialog-header { border: 0; padding: 24px 25px 0; }
.confirm .dialog-header h2 { font-size: 18px; }
.confirm .dialog-body { padding: 20px 25px 25px; line-height: 1.8; }
.confirm p { font-size: 14px; color: #737b85; overflow-wrap: anywhere; }
.confirm .dialog-footer { justify-content: flex-end; flex-wrap: wrap; border-top: 0; padding: 0 23px 23px; }

@media (min-width: 1600px) {
  :root { --sidebar-width: 228px; }
  .topbar > .brand { min-width: 140px; }
  .reader { padding-left: 48px; padding-right: 48px; }
  .message-select { grid-template-columns: 170px minmax(0, 1fr) 18px 65px; }
}
@media (min-width: 1180px) {
  #app.compose-open #workspace-content { margin-right: 540px; }
  #app.compose-open .message-select { grid-template-columns: 105px minmax(0, 1fr) 15px 47px; gap: 9px; padding-left: 7px; padding-right: 7px; }
  #app.compose-open .message-row { padding-left: 16px; padding-right: 14px; }
  #app.compose-open .search-panel { padding-left: 26px; padding-right: 26px; }
  #app.compose-open .search-filters { gap: 8px 10px; }
}
@media (min-width: 761px) and (max-width: 1179px) {
  .compose-shell { inset: 0; width: auto; z-index: 50; background: #29272038; display: flex; align-items: stretch; justify-content: flex-end; padding: 22px; pointer-events: auto; }
  .compose-shell .compose-dialog { width: min(516px, 100%); height: calc(100dvh - 44px); max-height: calc(100dvh - 44px); }
  .compose-shell.expanded { justify-content: center; align-items: center; padding: 24px; }
  .compose-shell.expanded .compose-dialog { width: min(950px, 100%); }
  .compose-shell.minimized { inset: auto 22px 20px auto; width: 320px; height: auto; padding: 0; background: transparent; }
  .compose-shell.minimized .compose-dialog { height: auto; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  :root { --sidebar-width: 204px; }
  .topbar { padding-right: 16px; }
  .topbar > .brand { min-width: 123px; }
  .brand img { width: 78px; height: 26px; }
  .brand span { font-size: 19px; }
  .header-search { margin-left: 0; }
  .account-label { max-width: 100px; }
  .account-toggle > svg { display: none; }
  .sidebar { padding-left: 8px; padding-right: 10px; }
  .message-select { grid-template-columns: 132px minmax(0, 1fr) 18px 52px; gap: 10px; }
  .row-preview { flex-basis: 70px; }
  .reader { padding-left: 27px; padding-right: 27px; }
  .reader-header h2 { font-size: 22px; }
  .admin-pane { padding: 28px; }
}
@media (max-width: 760px) {
  :root { font-size: 15px; --header-height: 64px; }
  button { min-height: 44px; }
  .icon-button { width: 44px; min-width: 44px; height: 44px; }
  .mobile-only { display: inline-flex; }
  .topbar { height: var(--header-height); padding: 6px 12px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; grid-template-rows: 51px; gap: 7px; }
  .topbar > .menu-toggle { grid-column: 1; grid-row: 1; }
  .topbar > .brand { grid-column: 2; grid-row: 1; min-width: 0; justify-self: start; }
  .brand img { width: 76px; height: 25px; }
  .brand span { font-size: 19px; }
  .brand { gap: 9px; }
  .header-context, .header-compose { display: none; }
  .header-search { display: none; }
  input, select, textarea { font-size: 16px; }
  .search-input-row > input { height: 44px; border-radius: 5px; }
  .topbar > .account { grid-column: 3; grid-row: 1; margin: 0; }
  .account-label { display: block; max-width: 63px; font-size: 11px; }
  .account-toggle > svg { display: none; }
  .account-toggle { padding: 3px; gap: 6px; }
  .account-menu { top: 48px; right: -1px; }
  .workspace, .workspace.sidebar-collapsed { display: block; padding: 0; position: relative; }
  .mail-surface { height: 100%; width: 100%; border: 0; border-radius: 0; }
  .sidebar, .workspace.sidebar-collapsed > .sidebar { position: fixed; inset: 0 auto 0 0; display: flex; z-index: 75; width: min(288px, calc(100vw - 42px)); height: 100dvh; padding: max(22px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); background: #fffefa; box-shadow: 5px 0 25px #29272012; transform: translateX(-110%); visibility: hidden; }
  .workspace.sidebar-open .sidebar, .workspace[data-step="folders"] .sidebar { transform: translateX(0); visibility: visible; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 70; border: 0; border-radius: 0; background: #20212445; padding: 0; }
  .sidebar-backdrop:hover:not(:disabled) { background: #20212445; }
  .sidebar-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 16px; padding-left: 12px; font-size: 17px; font-weight: 550; }
  .mailbox-picker { font-size: 13px; padding: 6px 0; }
  .sidebar-mailbox { padding: 0 12px 18px; margin-bottom: 19px; }
  .folder-button { padding: 12px 15px; min-height: 47px; }
  .sidebar-bottom { padding-top: 25px; }
  .search-panel { padding: 16px 18px 12px; }
  .search-panel-title { margin-bottom: 10px; }
  .search-heading { gap: 7px 10px; align-items: baseline; flex-direction: row; }
  .search-heading h1 { font-size: 22px; }
  .folder-summary { font-size: 11px; }
  .search-filters { gap: 6px 12px; margin-top: 8px; }
  .scope-filter { width: 100%; }
  .search-filters select { width: auto; flex: 1; min-width: 0; font-size: 12px; }
  .search-input-row > input { font-size: 16px; padding-right: 93px; }
  .search-form .search-submit[type="submit"] { position: absolute; right: 0; top: 0; width: 55px; margin: 0; padding: 8px 10px; font-size: 12px; border-color: transparent; border-left-color: #d8d3c8; border-radius: 0 5px 5px 0; }
  .search-input-row > [data-action="clear-search"] { right: 56px; }
  .sender-filter { gap: 6px; font-size: 11px; min-width: 0; }
  .sender-filter input { width: 135px; min-width: 0; font-size: 12px; }
  .search-filters .check-label { font-size: 11px; }
  .search-filters .quiet { font-size: 11px; }
  .list-toolbar { min-height: 56px; padding: 6px 12px; gap: 6px; }
  .list-toolbar .icon-button { width: 40px; min-width: 40px; height: 44px; }
  .list-title h1 { font-size: 16px; }
  .mail-list > .list-title { padding: 12px 19px; min-height: 48px; }
  .list-tools, .selection-tools { gap: 0; }
  .selection-tools > span, .selection-count { margin: 0 3px; font-size: 11px; }
  .selection-tools { flex-wrap: wrap; gap: 3px; }
  .selection-tools > .quiet { padding: 8px 5px; font-size: 11px; white-space: nowrap; }
  .bulk-action { padding: 7px 6px; min-height: 36px; font-size: 10px; gap: 5px; }
  .list-toolbar:has(.selection-tools) .list-range { display: none; }
  .select-all-label { width: 30px; min-height: 44px; }
  .filter-row { gap: 8px; font-size: 11px; }
  .filter-row .check-label, .unread-toggle { font-size: 11px; gap: 5px; }
  .list-range { font-size: 10px; }
  .messages { padding-bottom: 83px; }
  .day-heading { padding: 16px 18px 8px; font-size: 10px; }
  .message-row { min-height: 89px; padding: 0 8px 0 8px; align-items: center; }
  .row-check { width: 27px; min-height: 44px; }
  .message-row > .star { width: 32px; min-width: 32px; height: 44px; }
  .message-row > .star svg { width: 18px; height: 18px; }
  .message-select { grid-template-columns: minmax(0, 1fr) 46px; align-items: start; gap: 4px 8px; padding: 14px 8px; min-height: 89px; }
  .row-sender { grid-column: 1; grid-row: 1; font-size: 13px; line-height: 1.6; }
  .row-date { grid-column: 2; grid-row: 1; padding-top: 3px; font-size: 10px; }
  .row-copy { display: block; grid-column: 1 / -1; grid-row: 2; padding-right: 18px; }
  .row-subject { display: block; font-size: 14px; line-height: 1.5; }
  .row-preview { display: block; font-size: 12px; line-height: 1.6; margin-top: 2px; }
  .row-preview:not(:empty)::before { content: none; }
  .row-status, .row-attachment { margin-top: 3px; font-size: 10px; }
  .row-origin { display: inline-flex; margin-top: 4px; font-size: 11px; }
  .row-attachment { grid-column: 2; grid-row: 2; align-self: end; }
  .row-actions { display: none; }
  .empty-state { padding: 55px 24px; min-height: 300px; }
  .mobile-compose { position: fixed; right: 18px; bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); z-index: 15; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; padding: 12px 16px; min-height: 49px; box-shadow: 0 4px 12px #29272015; font-size: 12px; }
  .reader { padding: 0 20px 30px; }
  .reader-toolbar { padding: 8px 0; min-height: 61px; gap: 2px; }
  .toolbar-group, .reader-navigation { gap: 0; }
  .toolbar-label { display: none; }
  .reader-toolbar .icon-button { width: 40px; min-width: 40px; }
  .reader-header { padding-top: 24px; }
  .reader-header h2 { font-size: 22px; margin-bottom: 20px; }
  .message-meta { display: block; }
  .message-date { padding-top: 9px; }
  .message-text { font-size: 15px; margin-top: 25px; }
  .reply-actions { gap: 7px; }
  .reply-actions button { font-size: 12px; padding-left: 13px; padding-right: 13px; }
  .attachment-link { width: 100%; }
  .attachment-link small { margin-left: auto; }
  .body-view { gap: 10px; }
  .body-view span { font-size: 10px; }
  .email-frame { height: 420px; }
  .notice { left: 12px; right: 12px; bottom: max(90px, calc(env(safe-area-inset-bottom) + 80px)); max-width: none; padding: 10px 10px 10px 14px; font-size: 12px; gap: 10px; }
  .admin-pane { padding: 22px 20px; }
  .admin-heading { gap: 8px; margin-top: 0; }
  .admin-heading h1 { font-size: 21px; }
  .admin-heading > div { display: flex; align-items: center; gap: 8px; }
  .mailbox-table thead { display: none; }
  .mailbox-table tbody { display: block; }
  .mailbox-table tr { display: grid; grid-template-columns: 1fr auto; gap: 14px; border-bottom: 1px solid var(--border); padding: 22px 0; }
  .mailbox-table td { display: block; border: 0; padding: 0; }
  .mailbox-table td:first-child { grid-column: 1 / 3; }
  .mailbox-table td:nth-child(2) { font-size: 12px; }
  .mailbox-table td:nth-child(3) { grid-column: 1; font-size: 12px; color: #746f65; }
  .mailbox-table td:last-child { grid-column: 2; grid-row: 2 / 4; align-self: center; }
  .mailbox-table td:last-child button { font-size: 12px; }
  .mailbox-table td::before { content: attr(data-label); display: inline; margin-right: 8px; color: #746f65; font-size: 11px; }
  .mailbox-table td:first-child::before, .mailbox-table td:last-child::before { display: none; }
  .audit-list li { display: block; }
  .audit-list time { display: block; margin-top: 8px; }
  .compose-shell, .compose-shell.expanded { inset: 0; width: auto; display: flex; align-items: stretch; justify-content: stretch; padding: 0; background: #fffefa; pointer-events: auto; z-index: 50; }
  .compose-dialog, .compose-shell.expanded .compose-dialog { height: 100dvh; max-height: 100dvh; width: 100%; border-radius: 0; border: 0; box-shadow: none; }
  .compose-controls .icon-button { width: 38px; min-width: 38px; height: 38px; }
  .compose-controls [data-action="maximize-compose"] { display: none; }
  .dialog-header { padding: 10px 13px 10px 20px; }
  .dialog-header h2 { font-size: 16px; }
  .dialog-body { padding: 16px; }
  .compose-dialog .dialog-body { padding: 8px 20px 14px; }
  .compose-line { gap: 8px; }
  .compose-line > label { width: 68px; }
  .compose-line > input { font-size: 16px; }
  .compose-text { font-size: 16px; min-height: 120px; flex: 1 0 120px; }
  .compose-text-label { margin-top: 12px; }
  .compose-extra > summary { min-height: 38px; }
  .dialog-footer { padding: 11px 16px; gap: 8px; flex-wrap: wrap; padding-bottom: max(11px, env(safe-area-inset-bottom)); }
  .compose-dialog .dialog-footer { align-items: center; }
  .compose-save-state { max-width: none; width: 100%; font-size: 10px; text-align: left; white-space: nowrap; }
  .compose-dialog .dialog-footer .actions { gap: 3px; }
  .compose-dialog .dialog-footer button { padding: 10px 10px; font-size: 12px; }
  .compose-shell.minimized { inset: auto 12px 12px; width: auto; background: transparent; }
  .compose-shell.minimized .compose-dialog { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 3px 18px #29272018; }
  .modal-scrim { padding: 16px; }
  .dialog.confirm { max-height: calc(100dvh - 32px); border-radius: 6px; }
  .confirm .dialog-header { padding: 22px 20px 0; }
  .confirm .dialog-body { padding: 17px 20px 23px; }
  .confirm .dialog-footer { padding: 0 17px 20px; gap: 7px; }
  .confirm .dialog-footer button { flex: 1; padding: 10px 11px; }
  .welcome { padding: 35px 24px; }
  .welcome .brand { margin-bottom: 30px; }
  .welcome h1 { font-size: 25px; }
  .welcome .lead { font-size: 14px; }
  .address-input input { font-size: 16px; }
  .address-input span { font-size: 13px; }
}
@media (max-width: 760px) and (max-height: 500px) {
  .compose-text { min-height: 95px; flex-basis: 95px; }
  .compose-dialog .dialog-body { padding-bottom: 10px; }
  .compose-dialog .dialog-header { padding-top: 5px; padding-bottom: 5px; }
  .compose-line > input { padding-top: 10px; padding-bottom: 10px; }
}
@media (prefers-reduced-motion: no-preference) {
  .account-menu, .dialog.confirm { animation: reveal .13s ease-out; }
  .sidebar { transition: transform .18s ease-out, visibility .18s; }
  @keyframes reveal { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
}
@media print {
  .topbar, .sidebar, .reader-toolbar, .reply-actions, .notice, .compose-shell { display: none !important; }
  #app:has(#mail-header), .workspace, .mail-surface, .reader { display: block; height: auto; overflow: visible; }
  .workspace { padding: 0; }
  .mail-surface { border: 0; }
}
