* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --ink: #182230;
  --muted: #788394;
  --line: #e7ebf1;
  --accent: #6558e8;
  --accent-soft: #f0efff;
  --danger: #c6413f;
  --danger-soft: #fdf0f0;
  --ok: #178b68;
  --shadow: 0 12px 34px rgba(25, 39, 68, .055);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11141b;
  --surface: #191e28;
  --surface-2: #202633;
  --ink: #e8edf5;
  --muted: #9aa6b8;
  --line: #2c3442;
  --accent: #a39aff;
  --accent-soft: #2b2949;
  --danger: #ff8f8d;
  --danger-soft: #3a2223;
  --ok: #67d3ae;
  --shadow: 0 12px 34px rgba(0, 0, 0, .18);
}
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
.shell { max-width: 1440px; min-height: 100vh; margin: 0 auto; padding: 0 32px 26px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 78px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 20px; font-weight: 800; box-shadow: 0 5px 14px rgba(101, 88, 232, .28); }
.brand-text strong { display: block; font-size: 16px; line-height: 1.1; letter-spacing: -.04em; }
.brand-text small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #d8a43c; }
.status.online .status-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(23, 139, 104, .14); }
.status.offline .status-dot { background: var(--danger); }
.icon-button { display: inline-grid; place-items: center; width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); cursor: pointer; transition: .16s ease; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* panels */
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
main { display: grid; gap: 16px; padding-top: 22px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

/* hero */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 24px; }
.hero-main { min-width: 0; }
.address { margin: 0; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: clamp(18px, 3.2vw, 27px); letter-spacing: -.02em; overflow-wrap: anywhere; }
.hero-meta { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 11px; font-weight: 750; white-space: nowrap; cursor: pointer; transition: .16s ease; }
.button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button.primary { border-color: transparent; background: var(--accent); color: #fff; box-shadow: 0 5px 13px rgba(101, 88, 232, .24); }
.button.primary:hover:not(:disabled) { filter: brightness(1.07); color: #fff; background: var(--accent); }
.button.danger { color: var(--danger); }
.button.danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.extend-group { display: inline-flex; align-items: center; gap: 4px; }
.extend-group select { height: 38px; padding: 0 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 11px; font-weight: 700; cursor: pointer; }

/* empty state */
.empty-state { display: grid; justify-items: center; gap: 4px; padding: 54px 24px 60px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 10px; border-radius: 17px; background: var(--accent-soft); color: var(--accent); font-size: 22px; }
.empty-state h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.empty-state p { max-width: 420px; margin: 6px 0 18px; color: var(--muted); font-size: 12px; }

/* inbox */
.inbox { overflow: hidden; }
.inbox-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.inbox-title { display: flex; align-items: center; gap: 8px; }
.inbox-title h2 { margin: 0; font-size: 14px; }
.inbox-symbol { color: var(--accent); font-size: 16px; }
.badge { min-width: 20px; height: 19px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; }
.live-hint { color: var(--muted); font-size: 10px; }
.inbox-tools { display: flex; align-items: center; gap: 8px; }
.search { display: flex; align-items: center; gap: 7px; width: 210px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(101, 88, 232, .1); }
.search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 11px; }
.inbox-body { display: grid; grid-template-columns: minmax(250px, 36%) minmax(0, 1fr); min-height: 460px; }
.message-list { border-right: 1px solid var(--line); }

/* message rows */
.message { display: flex; gap: 10px; width: 100%; padding: 14px 15px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.message:hover { background: var(--surface-2); }
.message.active { background: var(--accent-soft); }
.message-dot { flex: none; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: transparent; }
.message-dot.unread { background: var(--accent); }
.message-body { min-width: 0; flex: 1; }
.message-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.message-sender { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 750; }
.message-time { flex: none; color: var(--muted); font-size: 9px; }
.message-subject { display: block; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.message-preview { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.list-placeholder { display: grid; place-items: center; min-height: 300px; padding: 28px; text-align: center; color: var(--muted); }
.list-placeholder h3 { margin: 0 0 4px; color: var(--ink); font-size: 13px; }
.list-placeholder p { margin: 0; font-size: 11px; }

/* reader */
.reader { min-width: 0; padding: 20px 22px; }
.reader-empty { display: grid; place-items: center; min-height: 380px; text-align: center; color: var(--muted); }
.reader-empty h3 { margin: 0 0 4px; color: var(--ink); font-size: 13px; }
.reader-empty p { margin: 0; font-size: 11px; }
.reader-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.reader-label { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.reader-tools { display: flex; gap: 6px; }
.mini { min-height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 10px; cursor: pointer; }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.reader-subject { margin: 16px 0 14px; font-size: 18px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.reader-sender { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.reader-sender strong { display: block; color: var(--ink); font-size: 11px; }
.reader-body { margin-top: 18px; font-size: 12.5px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.attachments { margin-top: 18px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 10px; }
.reader-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }

/* footer */
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 3px 0; color: var(--muted); font-size: 10px; }
.footer-right { display: flex; align-items: center; gap: 8px; }
.dot-ok { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.link-button { border: 0; background: none; color: var(--accent); font-size: 10px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* dialogs */
.dialog { width: min(460px, calc(100% - 28px)); padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(15, 20, 32, .22); }
.dialog::backdrop { background: rgba(16, 22, 35, .45); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dialog-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.label { display: block; margin: 14px 0 6px; font-size: 11px; font-weight: 750; }
.input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 12px; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(101, 88, 232, .12); }
select.input { cursor: pointer; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.admin-domains { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.admin-row { display: flex; gap: 8px; }
.admin-row .input { flex: 1; }
.domain-list { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.domain-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; }
.domain-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-tags { display: inline-flex; align-items: center; gap: 6px; }
.pill { padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 8.5px; font-weight: 800; letter-spacing: .08em; }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.domain-actions { display: inline-flex; gap: 5px; flex: none; }
.domain-item .off { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.domain-empty { color: var(--muted); font-size: 10px; }

/* custom domain setup */
.dialog-wide { width: min(660px, calc(100% - 24px)); max-height: min(88vh, 900px); overflow-y: auto; }
.dialog-title-row { display: flex; align-items: center; gap: 11px; }
.globe { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); font-size: 17px; }
.dialog-sub { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.alert-box { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0 12px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line)); border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 11px; line-height: 1.55; }
.alert-icon { flex: none; display: grid; place-items: center; width: 17px; height: 17px; margin-top: 1px; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 10px; font-weight: 800; }
.step-head { margin: 16px 0 6px; font-size: 12px; font-weight: 800; letter-spacing: -.01em; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 7px; color: var(--ink); font-size: 11.5px; line-height: 1.65; }
.steps li::marker { color: var(--accent); font-weight: 800; }
.steps code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.code-block { margin: 14px 0 0; padding: 14px 15px; border: 1px solid var(--line); border-radius: 11px; background: #0f1420; color: #d9e2f2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; line-height: 1.65; white-space: pre; overflow-x: auto; tab-size: 2; }
.hint.warn { color: var(--danger); }

/* toast */
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(340px, calc(100% - 28px)); padding: 11px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.sr-only { position: fixed; top: -1000px; left: -1000px; width: 1px; height: 1px; opacity: 0; }

/* responsive */
@media (max-width: 1080px) {
  .shell { padding: 0 20px 20px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
}
@media (max-width: 860px) {
  .inbox-head { align-items: flex-start; flex-direction: column; }
  .inbox-tools { width: 100%; }
  .search { flex: 1; width: auto; }
  .inbox-body { grid-template-columns: 1fr; }
  .message-list { max-height: 320px; overflow-y: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .reader { min-height: 280px; padding: 16px; }
  .reader-empty { min-height: 220px; }
}
@media (max-width: 620px) {
  .shell { padding: 0 13px 16px; }
  .topbar { height: 66px; }
  .status span:last-child { display: none; }
  .brand-text small { letter-spacing: .12em; }
  .hero { padding: 17px 16px; }
  .hero-actions { width: 100%; }
  .hero-actions .button { flex: 1 1 auto; }
  .extend-group { flex: 1 1 100%; }
  .extend-group .button { flex: 1; }
  .footer { flex-direction: column; align-items: flex-start; }
  .live-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- address bar (compact) + inbox focus ---------- */
.address-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; }
.address-main { min-width: 0; }
.address-main .address { font-size: clamp(17px, 2.6vw, 23px); }
.address-main .eyebrow { margin-bottom: 3px; }
.address-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.address-actions .button { min-height: 34px; padding: 0 11px; }
.address-actions .extend-group select { height: 34px; }

.inbox { border-color: color-mix(in srgb, var(--accent) 16%, var(--line)); box-shadow: 0 18px 48px rgba(25, 39, 68, .09); }
:root[data-theme="dark"] .inbox { box-shadow: 0 18px 48px rgba(0, 0, 0, .3); }
.inbox-head { padding: 18px 20px; }
.inbox-title { gap: 11px; }
.inbox-title h2 { font-size: 17px; letter-spacing: -.03em; }
.inbox-symbol { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft); font-size: 16px; }
.inbox-sub { display: flex; align-items: center; gap: 6px; margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(23, 139, 104, .14); }
.badge { min-width: 24px; height: 22px; font-size: 11px; }
.inbox-body { min-height: 520px; grid-template-columns: minmax(280px, 38%) minmax(0, 1fr); }
.inbox .message { padding: 15px 16px; }
.inbox .message-sender { font-size: 12px; }
.inbox .message-subject { font-size: 12px; }
.inbox .reader { padding: 22px 24px; }
.inbox .reader-subject { font-size: 19px; }
.inbox .reader-body { font-size: 13px; }
.inbox-foot { display: flex; justify-content: flex-end; gap: 6px; margin: 0; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.inbox-foot a { color: var(--accent); text-decoration: none; font-weight: 700; }
.notice-line { display: flex; align-items: center; gap: 7px; margin: 12px 2px 0; color: var(--muted); font-size: 10px; }
.notice-line span[aria-hidden] { color: var(--accent); }

/* ---------- admin ---------- */
.admin-shell { max-width: 1080px; }
.admin-main { display: grid; gap: 16px; padding: 26px 0 60px; }
.login-card, .setup-card { max-width: 430px; margin: 6vh auto 0; padding: 30px 28px; text-align: center; }
.login-icon { display: grid; place-items: center; width: 50px; height: 50px; margin: 0 auto 12px; border-radius: 16px; background: var(--accent-soft); font-size: 21px; }
.login-card h1, .setup-card h1 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.02em; }
.login-card .muted, .setup-card .muted { margin: 0; font-size: 11.5px; line-height: 1.6; }
.login-card form { margin-top: 18px; text-align: left; }
.login-submit { width: 100%; margin-top: 14px; }
.login-error { min-height: 15px; margin: 8px 0 0; color: var(--danger); font-size: 11px; }
.admin-head h1 { margin: 4px 0 6px; font-size: 23px; letter-spacing: -.03em; }
.admin-head .muted { margin: 0; font-size: 11.5px; }
.admin-add { padding: 15px 16px; }
.admin-add .admin-row { display: flex; gap: 8px; }
.admin-add .admin-row .input:first-child { flex: 2; }
.admin-add .admin-row select { flex: 1; }
.admin-table-wrap { padding: 4px 6px 2px; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th { padding: 12px 10px; text-align: left; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .right { text-align: right; white-space: nowrap; }
.admin-table .mini + .mini { margin-left: 5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.state-on { color: var(--ok); font-weight: 700; font-size: 11px; }
.state-off { color: var(--muted); font-size: 11px; }
.mini.danger { color: var(--danger); }
.mini.danger:hover { border-color: var(--danger); color: var(--danger); }
.empty-row { margin: 14px; color: var(--muted); font-size: 11px; }
.admin-diag { padding: 15px 16px; }
.diag-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.diag-body { margin: 0; padding: 13px; border-radius: 10px; background: #0f1420; color: #d9e2f2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; line-height: 1.6; max-height: 300px; overflow: auto; }

@media (max-width: 860px) {
  .address-bar { align-items: flex-start; flex-direction: column; }
  .address-actions { width: 100%; justify-content: flex-start; }
  .inbox-body { min-height: 0; }
}
.inbox-foot { align-items: center; justify-content: space-between; }
.foot-links { display: inline-flex; align-items: center; gap: 12px; }
.inbox-foot .link-button, .inbox-foot a { font-size: 10px; font-weight: 700; color: var(--accent); text-decoration: none; }
.inbox-foot .link-button { padding: 0; }

/* ---------- admin: connect / relay guide ---------- */
.connect-card { padding: 18px 18px 14px; }
.connect-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.connect-head h2 { margin: 2px 0 0; font-size: 18px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.connect-card .steps { margin-top: 6px; }

/* ---------- HTML email reader ---------- */
.reader-switch { display: flex; gap: 6px; margin: 14px 0 10px; }
.reader-switch .mini.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.mail-frame-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.mail-frame { display: block; width: 100%; height: min(58vh, 520px); border: 0; background: #fff; }
@media (max-width: 620px) { .mail-frame { height: 46vh; } }

/* ---------- motion: icon spin + reader skeleton ---------- */
@keyframes tm-spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: tm-spin .75s linear infinite; }

.reader-skeleton { padding: 6px 0; }
.sk-line, .sk-avatar { background: var(--surface-2); border-radius: 7px; }
.reader-skeleton .sk-line { height: 12px; margin-bottom: 10px; }
.reader-skeleton .sk-title { height: 22px; width: 72%; margin: 12px 0 16px; }
.reader-skeleton .sk-xs { width: 64px; height: 9px; }
.reader-skeleton .sk-sm { width: 55%; height: 11px; margin: 0; }
.reader-skeleton .sk-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.reader-skeleton .sk-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.reader-skeleton .sk-80 { width: 80%; }
.reader-skeleton .sk-60 { width: 60%; }
.reader-skeleton .sk-line, .reader-skeleton .sk-avatar {
  background-image: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 55%, var(--line)), var(--surface-2));
  background-size: 200% 100%;
  animation: tm-shimmer 1.2s ease-in-out infinite;
}
@keyframes tm-shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }
@media (prefers-reduced-motion: reduce) {
  .spin, .reader-skeleton .sk-line, .reader-skeleton .sk-avatar { animation: none !important; }
}

/* ---------- address history ---------- */
.history-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 7px; max-height: 320px; overflow-y: auto; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.history-item.current { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); background: var(--accent-soft); }
.history-item.expired { opacity: .6; }
.history-main { min-width: 0; display: grid; gap: 3px; }
.history-address { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { color: var(--muted); font-size: 10px; }
.history-actions { display: inline-flex; gap: 5px; flex: none; min-width: 104px; justify-content: flex-end; }
.history-empty { padding: 18px 4px; color: var(--muted); font-size: 11.5px; text-align: center; }
#history-btn .count-badge { margin-left: 2px; }
