:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1f2933;
  --muted: #5b6573;
  --border: #e1e4e8;
  --primary: #0f766e;
  --primary-hover: #0b5f58;
  --on-primary: #ffffff;
  --focus: #2563eb;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --ok: #067647;
  --ok-bg: #e3f6ec;
  --warn: #9a5b00;
  --warn-bg: #fff3d6;
  --orange: #b54708;
  --orange-bg: #ffead5;
  --info: #3538cd;
  --info-bg: #eaecfd;
  --neutral: #4b5563;
  --neutral-bg: #eceef1;
  --bar-track: #e6e8ec;
  --bar-ok: #12a26b;
  --bar-warn: #e3a008;
  --bar-bad: #e5484d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e232b;
    --text: #e6e8eb;
    --muted: #a0a8b4;
    --border: #2b313a;
    --primary: #2dd4bf;
    --primary-hover: #5eead4;
    --on-primary: #06201d;
    --focus: #7aa7ff;
    --danger: #ff8a80;
    --danger-bg: #3a1d1b;
    --ok: #6ee7a8;
    --ok-bg: #12301f;
    --warn: #fbd168;
    --warn-bg: #352a10;
    --orange: #fdb07a;
    --orange-bg: #3a2414;
    --info: #a5b4fc;
    --info-bg: #222546;
    --neutral: #c3c9d2;
    --neutral-bg: #2a3038;
    --bar-track: #2b313a;
    --bar-ok: #34c38f;
    --bar-warn: #f0b429;
    --bar-bad: #ff6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--primary); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.noscript { padding: 16px; }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* progress bar */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity .15s; }
.progress.on { opacity: 1; }
.progress-bar { height: 100%; width: 30%; background: var(--primary); animation: progress 1.1s ease-in-out infinite; }
@keyframes progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }

/* toasts */
.toasts { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1100; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: var(--shadow-lg); animation: toast-in .15s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }
.toast-msg { flex: 1; word-break: break-word; }
.toast-close { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; transition: background .08s, transform .05s, box-shadow .08s; white-space: nowrap; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); background: var(--border); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #2a0b08; } }
.btn-danger:hover, .btn-danger:active { background: var(--danger); filter: brightness(.92); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-link-danger { color: var(--danger); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { cursor: progress; opacity: .7; transform: none; }
.btn.busy::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-weight: 500; font-size: 13px; }
.input, select.input { width: 100%; min-height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); }
.form-error { color: var(--danger); background: var(--danger-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 14px; font-size: 13px; }

/* header */
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { max-width: 1280px; margin: 0 auto; padding: 0 16px; min-height: 56px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a:active { background: var(--border); }
.nav a[aria-current="page"] { color: var(--primary); background: var(--surface-2); }

@media (max-width: 480px) {
  .header-inner { gap: 8px; }
  .brand span { display: none; }
}

/* layout */
.view { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; outline: none; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 20px; margin: 0; flex: 1; min-width: 140px; }
.page-meta { color: var(--muted); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-title { font-size: 15px; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.load-error { text-align: center; padding: 40px 16px; }
.load-error p { margin: 0 0 12px; color: var(--muted); }

/* login */
.login-wrap { min-height: calc(100vh - 80px); display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; padding: 28px 24px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 20px; }
.login-card .btn { width: 100%; min-height: 40px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data th:first-child { border-top-left-radius: var(--radius); }
table.data th:last-child { border-top-right-radius: var(--radius); }
.cell-name { font-weight: 500; word-break: break-all; }
.cell-sub { color: var(--muted); font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* switch (interactive) */
.switch { position: relative; display: inline-flex; width: 40px; height: 24px; border-radius: 999px; border: 0; padding: 0; background: var(--bar-track); cursor: pointer; transition: background .1s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .1s; }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { left: 19px; }
.switch:active::after { width: 22px; }
.switch[aria-checked="true"]:active::after { left: 15px; }
.switch.pending { opacity: .7; }
.switch-wrap { display: inline-flex; align-items: center; gap: 8px; }

/* toolbar */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input { width: auto; flex: 1; min-width: 160px; }
.add-form { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(140px, 2fr) auto; gap: 8px; align-items: end; }
.add-form .field { margin: 0; }
.section-title { font-size: 15px; margin: 0 0 10px; }

/* dialogs */
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 0; box-shadow: var(--shadow-lg); max-width: calc(100vw - 24px); }
dialog::backdrop { background: rgba(15, 18, 22, .45); }
.confirm { width: 400px; }
.dlg-body { padding: 20px; }
.dlg-body h2 { font-size: 17px; margin: 0 0 8px; }
.dlg-body p { margin: 0; color: var(--muted); word-break: break-word; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; align-items: center; flex-wrap: wrap; }
.dlg-foot .grow { flex: 1; color: var(--muted); font-size: 13px; }

/* stacked cards on narrow screens */
@media (max-width: 760px) {
  .view { padding: 14px 16px 40px; }
  table.data.stack, table.data.stack tbody, table.data.stack tr, table.data.stack td { display: block; width: 100%; }
  table.data.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.data.stack tr:last-child { border-bottom: 0; }
  table.data.stack td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 78px 1fr; gap: 8px; align-items: start; }
  table.data.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; padding-top: 2px; }
  table.data.stack td.td-title { grid-template-columns: 1fr; padding-bottom: 6px; }
  table.data.stack td.td-title::before { display: none; }
  table.data.stack .row-actions { justify-content: flex-start; }
  .add-form { grid-template-columns: 1fr; }
}

/* ---------- shared bits ---------- */
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.input-sm { min-height: 32px; font-size: 13px; }
.copy-buffer { position: fixed; top: 0; left: -9999px; opacity: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background .08s, color .08s, transform .05s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { background: var(--border); transform: scale(.94); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn:disabled { opacity: .6; cursor: progress; }
.icon-btn.busy .icon { animation: spin .7s linear infinite; }
.copied { color: var(--ok) !important; }
.btn.copied { background: var(--ok); border-color: var(--ok); color: var(--on-primary) !important; }
.btn .icon { margin: 0 -2px; }
a.btn { text-decoration: none; }
.login-logo { margin-bottom: 12px; }
.login-logo img { display: block; }
.inline-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-edit .input { width: auto; flex: 1; min-width: 160px; }
.fwd { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fwd-text { word-break: break-all; }
a.cell-name { color: var(--text); text-decoration: none; }
a.cell-name:hover { color: var(--primary); text-decoration: underline; }

/* ---------- inbox layout ---------- */
.view-wide { max-width: none; padding: 12px 16px 16px; }
.inbox { display: flex; flex-direction: column; gap: 12px; }

/* generator */
.gen { padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.gen-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 520px; min-width: 0; }
.gen-addr-input { display: flex; align-items: center; gap: 6px; flex: 1 1 340px; min-width: 0; }
.gen-local { flex: 1 1 160px; min-width: 0; }
.gen-at { color: var(--muted); font-weight: 600; }
.gen-domain { flex: 1 1 160px; min-width: 0; width: auto; }
.gen-buttons { display: flex; gap: 8px; }
.gen-result { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 320px; padding: 4px 6px 4px 12px; border-radius: 8px; background: var(--ok-bg); animation: toast-in .15s ease-out; }
.gen-label { font-size: 12px; color: var(--ok); font-weight: 600; white-space: nowrap; }
.gen-addr { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.gen-note { margin: 0; width: 100%; }

/* three columns */
.mail { display: grid; grid-template-columns: 260px minmax(300px, 380px) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.pane { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.pane-addr { background: var(--surface-2); border-right: 1px solid var(--border); }
.pane-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.pane-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 6px 8px 6px 14px; background: inherit; border-bottom: 1px solid var(--border); }
.pane-list .pane-head { background: var(--surface); }
.pane-title { flex: 1; min-width: 0; margin: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-btn { display: none; margin-left: -8px; }
.notify-btn { color: var(--muted); }
.notify-btn.on { color: var(--primary); }

@media (min-width: 900px) {
  .inbox { height: calc(100vh - 57px - 28px); height: calc(100dvh - 57px - 28px); min-height: 480px; }
  .mail { flex: 1; min-height: 0; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .mail { grid-template-columns: 220px minmax(260px, 320px) minmax(0, 1fr); }
}

/* address column */
.addr-list { list-style: none; margin: 0; padding: 6px; }
.addr-row { position: relative; border-radius: 8px; }
.addr-item { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.addr-row:not(.editing) .addr-item { padding-right: 10px; }
.addr-item:hover { background: var(--border); }
.addr-item:active { background: var(--border); filter: brightness(.97); }
.addr-item[aria-current="true"] { background: var(--surface); box-shadow: var(--shadow); }
.addr-item[aria-current="true"] .addr-name { color: var(--primary); }
.addr-icon { display: inline-flex; color: var(--muted); }
.addr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.addr-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-item.has-unread .addr-name, .addr-all .addr-name { font-weight: 600; }
.addr-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-note { color: var(--text); opacity: .75; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.addr-actions { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: none; gap: 0; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); }
.addr-row:hover .addr-actions, .addr-row:focus-within .addr-actions { display: flex; }
.addr-row.editing .addr-actions { display: none; }
.addr-empty { padding: 16px 10px; color: var(--muted); font-size: 13px; }
.note-form { padding: 4px 6px 8px; display: flex; flex-direction: column; gap: 6px; }
.note-form-btns { display: flex; gap: 6px; justify-content: flex-end; }
@media (hover: none) {
  /* touch: actions always visible, below the address */
  .addr-row { display: flex; flex-wrap: wrap; align-items: center; }
  .addr-row > .addr-item { flex: 1; min-width: 0; padding-right: 4px; }
  .addr-actions { position: static; transform: none; display: flex; background: transparent; box-shadow: none; }
  .addr-row .addr-actions .icon-btn { width: 34px; height: 40px; }
  .addr-row.editing .note-form { flex-basis: 100%; }
}

/* message list */
.list-search { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.msg-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.msg { position: relative; border-bottom: 1px solid var(--border); }
.msg-link { display: block; padding: 10px 14px 10px 26px; color: var(--text); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.msg-link:hover { background: var(--surface-2); }
.msg-link:active { background: var(--border); }
.msg[aria-current="true"] { background: var(--info-bg); }
.msg[aria-current="true"] .msg-link:hover { background: transparent; }
.msg[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.msg-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dot { position: absolute; left: 10px; top: 17px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); opacity: 0; }
.msg.unread .dot { opacity: 1; }
.msg-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.msg.unread .msg-from { color: var(--text); font-weight: 600; }
.msg-from:has(+ .msg-addr) { flex: 0 1 auto; max-width: 55%; }
.msg-addr { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.sender-name { font-weight: 500; }
.sender-addr { word-break: break-all; }
@media (max-width: 480px) {
  .msg-top { flex-wrap: wrap; row-gap: 0; }
  .msg-from:has(+ .msg-addr) { max-width: none; flex: 1 1 0; }
  .msg-addr { order: 10; flex: 1 1 100%; }
  .sender-addr { display: block; }
}
.msg-clip { display: inline-flex; color: var(--muted); }
.msg-time { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.msg-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.msg.unread .msg-subject { font-weight: 600; }
.msg-preview { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; margin-top: 1px; }
.msg-to { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg > .code-chip { margin: -4px 14px 10px 26px; }
.list-empty { list-style: none; padding: 40px 20px; text-align: center; color: var(--muted); }
.list-foot { padding: 12px; text-align: center; }
.slide-in { animation: slide-in .35s ease-out; }
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-12px); background: var(--ok-bg); }
  60% { background: var(--ok-bg); }
  to { opacity: 1; transform: none; }
}

/* verification code chip */
.code-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 3px 10px 3px 4px; border-radius: 8px; border: 1px solid var(--primary); background: var(--ok-bg); color: var(--text); font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform .05s, background .08s; max-width: calc(100% - 40px); }
.code-chip:hover { filter: brightness(.97); }
.code-chip:active { transform: scale(.96); }
.code-label { font-size: 11px; font-weight: 600; color: var(--on-primary); background: var(--primary); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.code-val { font: 600 16px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; color: var(--primary); overflow: hidden; text-overflow: ellipsis; }
.code-chip .icon { color: var(--primary); }
.code-chip.copied { background: var(--ok); border-color: var(--ok); }
.code-chip.copied .code-val, .code-chip.copied .icon { color: var(--on-primary); }
.code-chip.big { min-height: 44px; padding: 6px 14px 6px 6px; gap: 12px; }
.code-chip.big .code-val { font-size: 24px; letter-spacing: .12em; }

/* message view */
.pane-view { background: var(--surface); }
.view-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.view-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.view-body { padding: 16px 20px 24px; }
.view-loading { padding: 40px 20px; text-align: center; color: var(--muted); }
.pane-view .load-error { padding: 40px 20px; }
.view-empty { height: 100%; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center; color: var(--muted); }
.view-empty-icon { color: var(--border); }
.subject { font-size: 19px; line-height: 1.35; margin: 0 0 12px; word-break: break-word; }
.headers { margin: 0 0 14px; display: grid; gap: 3px; font-size: 13px; }
.hrow { display: grid; grid-template-columns: 52px 1fr; gap: 8px; }
.hrow dt { color: var(--muted); }
.hrow dd { margin: 0; min-width: 0; word-break: break-all; }
.detail-code { margin: 0 0 14px; }
.atts { margin: 0 0 14px; }
.atts-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.att { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 36px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; background: var(--surface-2); }
.att:hover { border-color: var(--primary); }
.att:active { transform: scale(.98); }
.att-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.att-size { font-size: 12px; color: var(--muted); white-space: nowrap; }
.att .icon:last-child { color: var(--primary); }
.body-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.body-tools .hint { flex: 1; min-width: 160px; }
.mail-body { border-top: 1px solid var(--border); padding-top: 12px; }
.body-tools + .mail-body { border-top: 0; padding-top: 0; }
.mail-frame { display: block; width: 100%; height: max(480px, calc(100vh - 280px)); border: 1px solid var(--border); border-radius: 8px; background: #fff; color-scheme: light; }
.mail-text { margin: 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mail-none { padding: 20px 0; }

/* ---------- phones and narrow windows: one column at a time ---------- */
@media (max-width: 899px) {
  .view-wide { padding: 10px 0 24px; }
  .inbox { gap: 10px; }
  .gen { margin: 0 12px; }
  .gen-form { flex-basis: 100%; }
  .gen-addr-input { flex-basis: 100%; }
  .gen-buttons { flex: 1 1 100%; }
  .gen-buttons .btn { flex: 1; }
  .gen-result { flex-basis: 100%; }
  .mail { display: block; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; overflow: visible; }
  .pane { display: none; overflow: visible; border-right: 0; }
  .inbox[data-pane="addresses"] .pane-addr,
  .inbox[data-pane="list"] .pane-list,
  .inbox[data-pane="view"] .pane-view { display: block; }
  .inbox[data-pane="view"] .gen { display: none; }
  .pane-addr { background: var(--surface); }
  .pane-head, .view-head { top: 57px; }
  .back-btn { display: inline-flex; }
  .addr-item { min-height: 52px; }
  .addr-item[aria-current="true"] { background: transparent; box-shadow: none; }
  .addr-item[aria-current="true"] .addr-name { color: var(--text); }
  .view-body { padding: 14px 16px 24px; }
  .view-head { padding: 6px 8px 6px 16px; flex-wrap: wrap; }
  .view-actions { gap: 4px; }
  .mail-frame { height: max(420px, calc(100vh - 220px)); }
  .att-name { max-width: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}
