/*
 * Inbox UI. Design system (from UI UX Pro Max): Flat design, blue primary, slate neutrals,
 * Plus Jakarta Sans, 150–200 ms transitions, visible focus, WCAG AA contrast in both themes.
 */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* light */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5fd;
  --border: #e4ecfc;
  --input-border: #8492a6;
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --on-primary: #ffffff;
  --primary-text: #1d4ed8;
  --primary-soft: #e8efff;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --success: #15803d;
  --star: #b45309;
  --ring: #2563eb;
  --overlay: rgba(15, 23, 42, .45);
  --shadow-overlay: 0 12px 32px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);

  /* type, space, motion, layers */
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --radius-sm: 8px;
  --dur-fast: 150ms;
  --dur: 200ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --z-sticky: 10;
  --z-sidebar: 20;
  --z-menu: 40;
  --z-toast: 100;
  color-scheme: light;
}

/* Dark: follows the system unless the user picked Light; or forced with data-theme="dark". */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1a2335;
    --border: #243049;
    --input-border: #64748b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-text: #93c5fd;
    --primary-soft: #172554;
    --danger: #f87171;
    --danger-soft: #2a1215;
    --success: #4ade80;
    --star: #fbbf24;
    --ring: #60a5fa;
    --overlay: rgba(0, 0, 0, .6);
    --shadow-overlay: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1a2335;
  --border: #243049;
  --input-border: #64748b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-text: #93c5fd;
  --primary-soft: #172554;
  --danger: #f87171;
  --danger-soft: #2a1215;
  --success: #4ade80;
  --star: #fbbf24;
  --ring: #60a5fa;
  --overlay: rgba(0, 0, 0, .6);
  --shadow-overlay: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, [role="button"], summary, label.btn { touch-action: manipulation; }
a { color: var(--primary-text); text-underline-offset: 2px; }
h1, h2 { text-wrap: balance; }
kbd { font: 12px var(--mono); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface-2); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: var(--z-toast); background: var(--surface); color: var(--primary-text); padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-weight: 600; }
.skip-link:focus { top: 8px; }

/* ---------- buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 7px 14px; cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast), border-color var(--dur-fast); }
.btn .icon { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.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-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: var(--danger-soft); }
.icon-btn { border: 0; background: transparent; color: var(--muted); border-radius: var(--radius-sm); width: 36px; height: 36px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; transition: background-color var(--dur-fast), color var(--dur-fast); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn.star, .icon-btn[aria-pressed="true"] { color: var(--star); }
.icon-btn[aria-pressed="true"] .icon { fill: currentColor; }
.link-btn { border: 0; background: none; color: var(--primary-text); cursor: pointer; padding: 4px 0; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.link-btn:hover { text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 38px; border: 1px solid var(--input-border); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--surface); outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, input:focus, select:focus, textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent); outline: none; }
textarea { resize: vertical; line-height: 1.55; }
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check-field { align-self: end; margin-bottom: 16px; }
.form-error { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); padding: 8px 12px; border-radius: var(--radius-sm); margin: 8px 0; }
.chip { min-height: 30px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background-color var(--dur-fast), color var(--dur-fast); }
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.select-small { width: auto; min-height: 32px; padding: 4px 8px; font-size: 13px; }

/* ---------- auth ---------- */
.auth-body { display: grid; place-items: center; padding: 16px; min-height: 100dvh; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px 28px; }
.auth-card > .muted { margin: 6px 0 24px; }
.auth-prefs { position: fixed; top: 12px; right: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-lg { font-size: 21px; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--primary); color: var(--on-primary); font-size: 12px; letter-spacing: .5px; }

/* ---------- app layout ---------- */
.app-body { height: 100%; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.search { flex: 1; max-width: 560px; margin: 0 auto; position: relative; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; width: 16px; height: 16px; }
.search input { padding-left: 34px; background: var(--surface-2); border-color: transparent; }
.search input:hover { border-color: var(--border); }
.topbar-actions { display: flex; align-items: center; gap: 2px; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 252px minmax(300px, 400px) 1fr; }

.sidebar { border-right: 1px solid var(--border); padding: 14px 10px; overflow-y: auto; background: var(--surface); }
.sidebar .btn-primary { min-height: 40px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.nav-heading { margin: 20px 10px 0; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; border: 0; background: transparent; text-align: left; border-radius: var(--radius-sm); padding: 7px 10px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text); transition: background-color var(--dur-fast), color var(--dur-fast); }
.nav-item .icon { width: 17px; height: 17px; color: var(--muted); }
.nav-item:hover { background: var(--surface-2); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary-text); font-weight: 700; }
.nav-item.is-active .icon { color: currentColor; }
.nav-item .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item.is-active .count { color: currentColor; }
.nav-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub { padding-left: 28px; font-size: 13px; min-height: 32px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.domain-label { margin: 12px 10px 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.account-error { margin-left: auto; color: var(--danger); display: inline-flex; }
.account-error .icon { width: 15px; height: 15px; }
.notify-btn { margin: 16px 10px 0; text-align: left; }
.sync-status { margin: 16px 10px 0; font-size: 12px; font-variant-numeric: tabular-nums; }

.list-pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; background: var(--surface); }
.list-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 16px 6px; }
.list-head h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.list-head p { margin: 2px 0 0; overflow-wrap: anywhere; }
.filters { display: flex; gap: 6px; padding: 6px 16px 12px; flex-wrap: wrap; }
.bulkbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: var(--z-sticky); min-height: 44px; }
.bulkbar { container-type: inline-size; }
.bulkbar .check { white-space: nowrap; min-width: 0; }
/* Narrow list pane: show only the count (the word stays for screen readers) and tighten the icons. */
@container (max-width: 330px) {
  .bulkbar .sel-word { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bulkbar .bulk-actions { gap: 0; }
  .bulkbar .bulk-actions .icon-btn { width: 26px; height: 30px; }
}
.bulk-actions { display: flex; flex-wrap: nowrap; gap: 2px; flex: none; }
.bulk-actions .icon-btn { width: 34px; height: 34px; }
.bulk-actions .icon-btn-danger { color: var(--danger); }
.message-list { list-style: none; margin: 0; padding: 0; }
.message-list:focus { outline: none; }
.msg { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 3px 8px; padding: 11px 16px 11px 12px; border-bottom: 1px solid var(--border); cursor: pointer; border-left: 3px solid transparent; position: relative; transition: background-color var(--dur-fast); }
.msg:hover { background: var(--surface-2); }
.msg.is-open { background: var(--primary-soft); }
.msg.is-cursor { background: var(--surface-2); }
.msg:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.msg input[type=checkbox] { margin-top: 2px; grid-row: span 3; }
.msg-from { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.msg-date { font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.msg-subject { grid-column: 2 / 4; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.msg-snippet { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-meta { grid-column: 2 / 4; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.msg-meta:empty { display: none; }
.meta-icon { display: inline-flex; }
.meta-icon .icon, .msg-date .icon { width: 13px; height: 13px; }
.msg.is-unread .msg-from, .msg.is-unread .msg-subject { color: var(--text); font-weight: 700; }
.msg.is-unread::before { content: ""; position: absolute; left: 4px; top: 17px; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.account-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star { color: var(--star); display: inline-flex; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 48px 16px; }
.empty p { margin: 0; }
.empty-icon { width: 40px; height: 40px; stroke-width: 1.5; color: var(--muted); opacity: .8; }

/* skeleton (progressive loading) */
.msg-skeleton { cursor: default; }
.msg-skeleton:hover { background: none; }
.sk { display: block; height: 10px; margin: 3px 0; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 45%, var(--surface-2) 65%); background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.w-15 { width: 40px; } .w-40 { width: 45%; } .w-70 { width: 75%; } .w-90 { width: 92%; }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

.reader-pane { min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.reader-empty { margin: auto; text-align: center; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.reader-empty h2 { margin: 6px 0 0; font-size: 18px; }
.reader-empty p { margin: 0; }
.reader { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); position: relative; container-type: inline-size; }
.reader.is-loading::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: loading-bar 1s linear infinite; z-index: 1; }
.reader.is-loading .reader-frame { opacity: .35; }
@keyframes loading-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.reader-toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.btn-label { margin-left: 2px; }
@container (max-width: 560px) { .btn-label { display: none; } .reader-toolbar .btn-small { padding: 5px 8px; } }
@container (max-width: 440px) {
  .reader-toolbar { flex-wrap: wrap; row-gap: 4px; }
  .reader-toolbar .toolbar-gap { flex-basis: 100%; height: 0; }
  .reader-toolbar .toolbar-gap ~ * { order: 1; }
  .move-select { margin-right: auto; }
}
.toolbar-gap { flex: 1; }
.move-select { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); border-radius: var(--radius-sm); padding-left: 8px; cursor: pointer; transition: background-color var(--dur-fast); }
.move-select:hover { background: var(--surface-2); color: var(--text); }
.move-select select { width: auto; min-height: 36px; max-width: 130px; border-color: transparent; background: transparent; padding: 4px 4px; font-size: 13px; cursor: pointer; }
.reader-head { padding: 18px 22px 10px; }
.reader-head h2 { margin: 0 0 14px; font-size: 20px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.reader-meta { display: flex; gap: 12px; align-items: flex-start; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; }
.reader-from { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.reader-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; font-variant-numeric: tabular-nums; }
.images-bar { display: flex; align-items: center; gap: 10px; margin: 0 22px 10px; padding: 6px 8px 6px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.images-bar .btn { margin-left: auto; color: var(--primary-text); }
.attachments { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 22px 12px; padding: 0; }
.attachments a { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; text-decoration: none; color: var(--text); font-size: 13px; max-width: 300px; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.attachments a:hover { background: var(--surface-2); border-color: var(--input-border); }
.attachments .icon { width: 15px; height: 15px; color: var(--muted); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-frame { flex: 1; min-height: 240px; width: 100%; border: 0; border-top: 1px solid var(--border); background: #fff; transition: opacity var(--dur); }
.reader-foot { padding: 8px 22px; border-top: 1px solid var(--border); }
.reader-foot a { display: inline-flex; align-items: center; gap: 6px; }
.reader-foot .icon { width: 14px; height: 14px; }

/* ---------- dialogs ---------- */
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-overlay); }
.dialog[open] { animation: dialog-in var(--dur) var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialog-wide { width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: var(--overlay); }
.dialog > *:not(.dialog-head):not(.dialog-foot):not(form), .dialog form > *:not(.dialog-head):not(.dialog-foot) { margin-left: 20px; margin-right: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.dialog-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.dialog-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); margin-top: 16px; flex-wrap: wrap; }
.field-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 8px; margin-bottom: 8px; }
.field-row > span { color: var(--muted); font-size: 13px; font-weight: 600; }
.field-row-links { text-align: right; margin-top: -4px; margin-bottom: 6px; }
#c-body { width: calc(100% - 40px); min-height: 240px; margin-top: 4px; font-family: var(--font); display: block; }
.c-attachments ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.c-attachments li { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 2px 2px 2px 10px; font-size: 13px; }
.c-attachments .icon-btn { width: 30px; height: 30px; }
.c-attachments .icon-btn .icon { width: 15px; height: 15px; }
.file-btn { cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1.3fr; gap: 0 12px; }
.advanced { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.advanced summary { cursor: pointer; font-weight: 600; font-size: 13px; min-height: 28px; display: flex; align-items: center; }
.advanced[open] summary { margin-bottom: 12px; }
.account-rows { list-style: none; padding: 0; margin: 0; }
.account-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.account-row .info { flex: 1; min-width: 0; }
.account-row .info strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.status-ok { color: var(--success); }
.status-error { color: var(--danger); }
.test-result { border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); font-size: 13px; margin-bottom: 8px; }
.test-result div { display: flex; align-items: flex-start; gap: 8px; margin: 3px 0; }
.test-result .icon { width: 16px; height: 16px; margin-top: 2px; }

/* Accounts dialog: tabs + Cloudflare domains */
.tabs { margin-bottom: 8px; }
.tabs button { font-size: 13px; }
.tab-intro { margin: 10px 0 4px; }
.account-row.is-wrap { flex-wrap: wrap; }
.account-row .info > span { display: block; overflow-wrap: anywhere; }
.account-row > .test-result, .account-row > .edit-panel { flex-basis: 100%; margin: 0; }
.row-icon { display: inline-flex; color: var(--muted); }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.badge { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge.is-paid { margin-left: 4px; color: var(--primary-text); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.check-hint { margin: -4px 0 0 24px; max-width: 60ch; line-height: 1.5; }
/* Domain "send through" select: Worker / Mailketing hint and the Mailketing status line */
.send-via { margin: 0 0 14px; }
.send-via .field { margin-bottom: 8px; }
.send-hint { margin: 0 0 8px; max-width: 70ch; line-height: 1.5; }
.send-hint .badge.is-paid { margin: 0 4px 0 0; vertical-align: 1px; }
.send-status { border-radius: var(--radius); padding: 8px 12px; background: var(--surface-2); }
.send-status div { display: flex; align-items: flex-start; gap: 8px; margin: 3px 0; overflow-wrap: anywhere; }
.send-status .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.c-mk-note { margin: 10px 0 0; }
.badge.is-on { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.meter { display: inline-block; width: 96px; height: 6px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; min-width: 2px; background: var(--primary); }
.meter.is-high > span { background: var(--danger); }
.alias-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alias-info strong, .account-row .alias-info > span { display: inline; }
.alias-info .icon { width: 15px; height: 15px; }
.view-title { margin: 0 0 12px; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.view-title:focus { outline: none; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.section-title .icon { width: 16px; height: 16px; color: var(--muted); }
.manage-head { display: flex; align-items: flex-start; gap: 6px; margin: -4px 0 4px -8px; }
.manage-title { min-width: 0; padding-top: 6px; }
.manage-title .view-title { margin: 0; }
.manage-title p { margin: 2px 0 0; }
.manage-section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.manage-section > p.muted { margin: 0 0 8px; }
.manage-section .advanced { margin: 12px 0 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.check-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.check-stack .field { align-self: stretch; margin: 0 0 0 24px; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 0 10px; align-items: end; margin-top: 12px; }
.inline-form > .btn { margin-bottom: 14px; min-height: 38px; }
.addr-input { display: flex; align-items: center; gap: 6px; }
.field > span.addr-input { font-size: inherit; font-weight: 400; color: var(--text); }
.addr-input input { flex: 1; min-width: 0; }
.addr-suffix { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.edit-panel { margin-top: 10px !important; padding: 14px 14px 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.edit-panel .form-actions { margin-bottom: 12px; }
.edit-panel input[type=color] { width: 56px; height: 38px; padding: 2px; border: 1px solid var(--input-border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.code-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px dashed var(--input-border); border-radius: var(--radius-sm); background: var(--surface-2); margin: 6px 0; }
.code-box code { flex: 1; min-width: 0; font: 13px/1.5 var(--mono); color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }
.code-box .icon-btn { width: 32px; height: 32px; }
.code-box .is-copied { color: var(--success); }
.callout { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 13px; margin: 0 0 12px; }
.callout .icon { width: 16px; height: 16px; margin-top: 2px; }
.callout-warn { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.setup-steps { margin: 0; padding-left: 22px; }
.setup-steps > li { margin-bottom: 14px; padding-left: 4px; }
.setup-steps > li::marker { font-weight: 700; color: var(--primary-text); }
.setup-steps p { margin: 0 0 4px; }
.setup-steps .callout { margin-top: 8px; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.danger-zone:last-child { border-color: color-mix(in srgb, var(--danger) 35%, transparent); margin-bottom: 4px; }
.dz-text { flex: 1; min-width: 220px; }
.dz-text p { margin: 2px 0 0; }
.delete-confirm { flex-basis: 100%; }
.delete-confirm .field { margin-bottom: 8px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
#domain-manage-view form > * { margin-left: 0; margin-right: 0; }
[data-style="clay"] .edit-panel, [data-style="clay"] .danger-zone, [data-style="clay"] .code-box { border: 2.5px dashed var(--edge); }
[data-style="brutal"] .edit-panel, [data-style="brutal"] .danger-zone, [data-style="brutal"] .code-box, [data-style="brutal"] .callout-warn { border: 3px solid var(--edge); border-radius: var(--radius-sm); }
[data-style="brutal"] .badge { border: 2px solid var(--edge); border-radius: var(--radius-sm); color: var(--text); }
[data-style="terminal"] .edit-panel, [data-style="terminal"] .danger-zone, [data-style="terminal"] .code-box, [data-style="terminal"] .callout, [data-style="terminal"] .badge { border-radius: 0; }
[data-style="terminal"] .edit-panel, [data-style="terminal"] .danger-zone { border: 1px dashed var(--edge); background: transparent; }
.copy-buffer { position: fixed; left: -9999px; top: 0; opacity: 0; }
@media (max-width: 860px) {
  .inline-form { grid-template-columns: 1fr; }
  .account-row.is-wrap .row-actions { flex-basis: 100%; justify-content: flex-start; }
}
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; padding-bottom: 20px; margin-top: 0; }
.shortcuts dd { margin: 0; }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: var(--z-toast); align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-overlay); font-size: 13.5px; font-weight: 500; max-width: min(520px, calc(100vw - 32px)); pointer-events: auto; animation: toast-in var(--dur) var(--ease-out); }
.toast.is-error { background: #b91c1c; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- theme & language menu ---------- */
.prefs { position: relative; }
.prefs > summary { list-style: none; }
.prefs > summary::-webkit-details-marker { display: none; }
.prefs[open] > summary { background: var(--surface-2); }
.prefs-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: var(--z-menu); width: 296px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-overlay); padding: 12px; }
.prefs-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 2px 2px 6px; }
.prefs-label + .segmented { margin-bottom: 12px; }
.segmented { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 9px; }
.segmented button { flex: 1; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; background: transparent; border-radius: 7px; padding: 6px 4px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background-color var(--dur-fast), color var(--dur-fast); }
.segmented button .icon { width: 15px; height: 15px; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

.only-mobile { display: none; }

/* style swatches in the Display menu */
.style-swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.swatch-flat { background: #2563eb; }
.swatch-clay { background: linear-gradient(135deg, #ff4d8d 50%, #ffd23f 50%); border: 1.5px solid #1a1033; border-radius: 5px; }

/* =====================================================================
 * Style: Claymorphism + Vibrant & Block-based  (html[data-style="clay"])
 * Soft 3D blocks: thick ink borders, 16–26px radius, double (outer + inner) shadows,
 * vivid colour blocks with dark text, bouncy press. Fredoka headings, Nunito body.
 * All colour pairs checked for WCAG AA in light and dark.
 * ===================================================================== */
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root[data-style="clay"] {
  --bg: #fff4e8;
  --surface: #ffffff;
  --surface-2: #f3eeff;
  --border: #f3eeff;
  --edge: #1a1033;
  --ink: #1a1033;
  --input-border: #1a1033;
  --text: #1a1033;
  --muted: #4c4466;
  --primary: #ff4d8d;
  --primary-hover: #ff3378;
  --on-primary: #1a1033;
  --primary-text: #6d28d9;
  --primary-soft: #fff3c4;
  --danger: #be123c;
  --danger-soft: #ffe4ea;
  --success: #15803d;
  --star: #b45309;
  --ring: #1a1033;
  --sun: #ffd23f;
  --cyan: #22d3ee;
  --green: #4ade80;
  --lilac: #c4b5fd;
  --orange: #ffb86b;
  --rose: #fca5a5;
  --side-bg: #6d28d9;
  --accent-icon: #6d28d9;
  --highlight: #ffd23f;
  --side-text: #ffffff;
  --side-muted: #e9d5ff;
  --toast-error: #ff8fa3;
  --overlay: rgba(46, 16, 101, .45);
  --pattern: rgba(109, 40, 217, .14);
  --clay-shadow: 8px 10px 22px rgba(91, 33, 182, .2), inset -5px -5px 12px rgba(91, 33, 182, .1), inset 5px 5px 12px rgba(255, 255, 255, .85);
  --clay-btn: 3px 4px 10px rgba(91, 33, 182, .22), inset -2px -3px 6px rgba(26, 16, 51, .14), inset 2px 3px 6px rgba(255, 255, 255, .65);
  --clay-pressed: inset 2px 3px 7px rgba(26, 16, 51, .25);
  --clay-inset: inset 2px 3px 6px rgba(91, 33, 182, .1);
  --shadow-overlay: 10px 14px 32px rgba(46, 16, 101, .28), inset -4px -4px 10px rgba(91, 33, 182, .08), inset 4px 4px 10px rgba(255, 255, 255, .8);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --radius: 18px;
  --radius-sm: 14px;
  --radius-lg: 24px;
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="clay"]:not([data-theme="light"]) {
    --bg: #140b2b; --surface: #241845; --surface-2: #30235a; --border: #30235a; --edge: #9b87ea; --input-border: #9b87ea;
    --text: #f5f3ff; --muted: #c9bdf5; --primary: #ff6fa5; --primary-hover: #ff8ab7; --primary-text: #67e8f9; --primary-soft: #3b2a6b;
    --danger: #fda4af; --danger-soft: #3d1426; --success: #86efac; --star: #fde047; --ring: #ffd23f;
    --side-bg: #4c1d95; --side-muted: #ddd6fe; --accent-icon: #c4b5fd; --highlight: #7c3aed; --overlay: rgba(5, 2, 15, .65); --pattern: rgba(196, 181, 253, .1);
    --clay-shadow: 8px 10px 24px rgba(0, 0, 0, .55), inset -5px -5px 12px rgba(0, 0, 0, .35), inset 5px 5px 12px rgba(255, 255, 255, .06);
    --clay-btn: 3px 4px 10px rgba(0, 0, 0, .45), inset -2px -3px 6px rgba(0, 0, 0, .35), inset 2px 3px 6px rgba(255, 255, 255, .18);
    --clay-pressed: inset 2px 3px 7px rgba(0, 0, 0, .5);
    --clay-inset: inset 2px 3px 6px rgba(0, 0, 0, .35);
    --shadow-overlay: 10px 14px 34px rgba(0, 0, 0, .6), inset 4px 4px 10px rgba(255, 255, 255, .05);
    color-scheme: dark;
  }
}
:root[data-style="clay"][data-theme="dark"] {
  --bg: #140b2b; --surface: #241845; --surface-2: #30235a; --border: #30235a; --edge: #9b87ea; --input-border: #9b87ea;
  --text: #f5f3ff; --muted: #c9bdf5; --primary: #ff6fa5; --primary-hover: #ff8ab7; --primary-text: #67e8f9; --primary-soft: #3b2a6b;
  --danger: #fda4af; --danger-soft: #3d1426; --success: #86efac; --star: #fde047; --ring: #ffd23f;
  --side-bg: #4c1d95; --side-muted: #ddd6fe; --accent-icon: #c4b5fd; --highlight: #7c3aed; --overlay: rgba(5, 2, 15, .65); --pattern: rgba(196, 181, 253, .1);
  --clay-shadow: 8px 10px 24px rgba(0, 0, 0, .55), inset -5px -5px 12px rgba(0, 0, 0, .35), inset 5px 5px 12px rgba(255, 255, 255, .06);
  --clay-btn: 3px 4px 10px rgba(0, 0, 0, .45), inset -2px -3px 6px rgba(0, 0, 0, .35), inset 2px 3px 6px rgba(255, 255, 255, .18);
  --clay-pressed: inset 2px 3px 7px rgba(0, 0, 0, .5);
  --clay-inset: inset 2px 3px 6px rgba(0, 0, 0, .35);
  --shadow-overlay: 10px 14px 34px rgba(0, 0, 0, .6), inset 4px 4px 10px rgba(255, 255, 255, .05);
  color-scheme: dark;
}

/* page: dotted geometric pattern (static, no continuous animation in a work app) */
[data-style="clay"] body { background: radial-gradient(var(--pattern) 1.6px, transparent 1.7px) 0 0 / 22px 22px, var(--bg); }
[data-style="clay"] :focus-visible { outline-width: 3px; outline-offset: 3px; }
[data-style="clay"] h1, [data-style="clay"] h2, [data-style="clay"] .brand { font-family: var(--font-display); letter-spacing: 0; }
[data-style="clay"] .brand-mark { background: var(--primary); color: var(--ink); border: 2.5px solid var(--edge); border-radius: 12px; transform: rotate(-6deg); box-shadow: var(--clay-btn); font-family: var(--font-display); }
[data-style="clay"] kbd { border: 2px solid var(--edge); border-radius: 6px; background: var(--sun); color: var(--ink); }

/* blocks: top bar and the three panes float as chunky cards */
[data-style="clay"] .topbar { height: 62px; margin: 14px 14px 0; border: 3px solid var(--edge); border-radius: var(--radius-lg); box-shadow: var(--clay-shadow); }
[data-style="clay"] .layout { padding: 14px; gap: 14px; }
[data-style="clay"] .sidebar, [data-style="clay"] .list-pane, [data-style="clay"] .reader-pane { border: 3px solid var(--edge); border-radius: var(--radius-lg); box-shadow: var(--clay-shadow); }
[data-style="clay"] .reader-pane { background: var(--surface); }
[data-style="clay"] .list-pane { border-right: 3px solid var(--edge); }

/* buttons: soft 3D, bouncy press */
[data-style="clay"] .btn { border: 2.5px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--clay-btn); font-weight: 800; transition: transform 200ms var(--bounce), box-shadow 200ms ease-out, background-color 150ms; }
[data-style="clay"] .btn:hover { transform: translateY(-2px); background: var(--surface-2); }
[data-style="clay"] .btn:active { transform: translateY(1px); box-shadow: var(--clay-pressed); }
[data-style="clay"] .btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--edge); }
[data-style="clay"] .btn-primary:hover { background: var(--primary-hover); }
[data-style="clay"] .btn-ghost { border-color: transparent; box-shadow: none; }
[data-style="clay"] .btn-ghost:hover { transform: none; background: var(--surface-2); }
[data-style="clay"] .btn-ghost:active { box-shadow: var(--clay-pressed); }
[data-style="clay"] .icon-btn { border-radius: 12px; transition: transform 200ms var(--bounce), background-color 150ms, color 150ms; }
[data-style="clay"] .icon-btn:active { transform: scale(.92); }
[data-style="clay"] .icon-btn[aria-pressed="true"] { background: var(--sun); color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--edge); }
[data-style="clay"] .chip { border: 2.5px solid var(--edge); color: var(--text); font-weight: 800; box-shadow: var(--clay-btn); transition: transform 200ms var(--bounce), background-color 150ms; }
[data-style="clay"] .chip:hover { transform: translateY(-1px); }
[data-style="clay"] .chip.is-active { background: var(--sun); color: var(--ink); border-color: var(--edge); }
[data-style="clay"] .link-btn { font-weight: 800; }

/* fields: pressed-in clay */
[data-style="clay"] input[type=text], [data-style="clay"] input[type=email], [data-style="clay"] input[type=password], [data-style="clay"] input[type=number], [data-style="clay"] input[type=search], [data-style="clay"] select, [data-style="clay"] textarea {
  border: 2.5px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--clay-inset); background: var(--surface);
}
[data-style="clay"] input:focus, [data-style="clay"] select:focus, [data-style="clay"] textarea:focus { border-color: var(--edge); box-shadow: var(--clay-inset), 0 0 0 4px color-mix(in srgb, var(--primary) 45%, transparent); }
[data-style="clay"] .search input { background: var(--surface-2); border-color: var(--edge); }
[data-style="clay"] input[type=checkbox] { accent-color: #6d28d9; }
[data-style="clay"] .form-error { border: 2.5px solid var(--danger); border-radius: var(--radius-sm); }

/* sidebar: one vivid colour block, folder icons as coloured tiles */
[data-style="clay"] .sidebar { background: var(--side-bg); color: var(--side-text); --ring: #ffd23f; }
[data-style="clay"] .nav-heading, [data-style="clay"] .domain-label, [data-style="clay"] .sync-status { color: var(--side-muted); }
[data-style="clay"] .nav-item { color: var(--side-text); border-radius: var(--radius-sm); font-weight: 700; border: 2.5px solid transparent; transition: transform 200ms var(--bounce), background-color 150ms; }
[data-style="clay"] .nav-item:hover { background: rgba(255, 255, 255, .14); }
[data-style="clay"] .nav-item:active { transform: scale(.98); }
[data-style="clay"] .nav-item .count { color: var(--side-muted); }
[data-style="clay"] .nav-item.is-active { background: var(--sun); color: var(--ink); border-color: var(--ink); box-shadow: 3px 4px 0 rgba(26, 16, 51, .35); }
[data-style="clay"] .nav-item.is-active .count { color: var(--ink); }
[data-style="clay"] .nav-item .icon { width: 28px; height: 28px; padding: 5px; border-radius: 9px; background: rgba(255, 255, 255, .18); color: var(--side-text); stroke-width: 2.25; }
[data-style="clay"] .nav-item[data-role] .icon { color: var(--ink); box-shadow: inset 0 0 0 2px rgba(26, 16, 51, .25); }
[data-style="clay"] .nav-item[data-role="inbox"] .icon { background: var(--cyan); }
[data-style="clay"] .nav-item[data-role="starred"] .icon { background: var(--sun); }
[data-style="clay"] .nav-item[data-role="drafts"] .icon { background: var(--lilac); }
[data-style="clay"] .nav-item[data-role="sent"] .icon { background: var(--green); }
[data-style="clay"] .nav-item[data-role="archive"] .icon { background: var(--orange); }
[data-style="clay"] .nav-item[data-role="junk"] .icon { background: #ff8fb1; }
[data-style="clay"] .nav-item[data-role="trash"] .icon { background: var(--rose); }
[data-style="clay"] .nav-item[data-role="custom"] .icon { background: #e9d5ff; }
[data-style="clay"] .nav-item .dot { width: 12px; height: 12px; border: 2px solid var(--side-text); }
[data-style="clay"] .nav-item.is-active .dot { border-color: var(--ink); }
[data-style="clay"] .sidebar .link-btn { color: var(--side-text); }
[data-style="clay"] .sidebar .btn-primary { min-height: 46px; font-size: 15px; }
[data-style="clay"] .account-error { color: var(--sun); }

/* message list */
[data-style="clay"] .list-head h1 { font-size: 28px; font-weight: 600; display: inline; background: linear-gradient(transparent 62%, var(--highlight) 62%); color: var(--text); padding: 0 4px; }
[data-style="clay"] .bulkbar { border-color: var(--surface-2); border-width: 2.5px 0; }
[data-style="clay"] .msg { border-bottom: 2px solid var(--surface-2); transition: background-color 150ms, transform 200ms var(--bounce); }
[data-style="clay"] .msg:hover { background: var(--surface-2); }
[data-style="clay"] .msg.is-open { background: var(--primary-soft); }
[data-style="clay"] .msg { padding-left: 20px; }
[data-style="clay"] .msg.is-unread::before { width: 9px; height: 9px; left: 5px; top: 17px; background: var(--primary); box-shadow: 0 0 0 2px var(--edge); }
[data-style="clay"] .msg-skeleton:hover { background: none; }
[data-style="clay"] .sk { border-radius: 999px; }
[data-style="clay"] .empty-icon { color: var(--accent-icon); opacity: 1; stroke-width: 2; }

/* reader */
[data-style="clay"] .reader { background: var(--surface); }
[data-style="clay"] .reader-toolbar { border-bottom: 2.5px solid var(--surface-2); }
[data-style="clay"] .reader-head h2 { font-size: 24px; font-weight: 600; }
[data-style="clay"] .avatar { border: 2.5px solid var(--edge); box-shadow: var(--clay-btn); font-family: var(--font-display); }
[data-style="clay"] .attachments a { border: 2.5px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--clay-btn); font-weight: 700; transition: transform 200ms var(--bounce); }
[data-style="clay"] .attachments a:hover { transform: translateY(-2px); background: var(--surface); }
[data-style="clay"] .images-bar { border: 2px dashed var(--edge); border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--text); }
[data-style="clay"] .reader-frame { border-top: 2.5px solid var(--surface-2); }
[data-style="clay"] .reader-foot { border-top: 2.5px solid var(--surface-2); }
[data-style="clay"] .move-select { border-radius: 12px; }

/* dialogs, menus, toasts */
[data-style="clay"] .dialog { border: 3px solid var(--edge); border-radius: 26px; box-shadow: var(--shadow-overlay); }
[data-style="clay"] .dialog-head, [data-style="clay"] .dialog-foot { border-color: var(--surface-2); border-width: 2.5px; }
[data-style="clay"] .dialog[open] { animation: clay-pop 320ms var(--bounce); }
@keyframes clay-pop { from { opacity: 0; transform: translateY(12px) scale(.94); } }
[data-style="clay"] .advanced, [data-style="clay"] .test-result, [data-style="clay"] .send-status { border: 2.5px dashed var(--edge); border-radius: var(--radius); }
[data-style="clay"] .account-row { border-bottom: 2px solid var(--surface-2); }
[data-style="clay"] .c-attachments li { border: 2px solid var(--edge); border-radius: 12px; }
[data-style="clay"] .prefs-menu { border: 3px solid var(--edge); border-radius: 22px; box-shadow: var(--shadow-overlay); }
[data-style="clay"] .segmented { border: 2.5px solid var(--edge); border-radius: var(--radius-sm); padding: 3px; }
[data-style="clay"] .segmented button { border-radius: 10px; font-weight: 800; }
[data-style="clay"] .segmented button[aria-pressed="true"], [data-style="clay"] .segmented button[aria-selected="true"] { background: var(--sun); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
[data-style="clay"] .toast { background: var(--sun); color: var(--ink); border: 3px solid var(--ink); border-radius: 16px; font-weight: 800; box-shadow: 4px 5px 0 rgba(26, 16, 51, .35); animation: clay-pop 300ms var(--bounce); }
[data-style="clay"] .toast.is-error { background: var(--toast-error); color: var(--ink); }
[data-style="clay"] .skip-link { border: 3px solid var(--edge); border-radius: var(--radius-sm); }

/* login */
[data-style="clay"] .auth-card { border: 3px solid var(--edge); border-radius: 28px; box-shadow: var(--shadow-overlay); }

@media (max-width: 860px) {
  [data-style="clay"] .topbar { margin: 8px 8px 0; border-radius: 18px; height: 58px; }
  [data-style="clay"] .layout { padding: 8px; gap: 8px; }
  [data-style="clay"] .sidebar { inset: 8px auto 8px 8px; }
  [data-style="clay"] .list-head h1 { font-size: 24px; }
}

/* =====================================================================
 * Style: Glassmorphism  (html[data-style="glass"])
 * Frosted translucent panels (blur 20px) floating over a static mesh gradient, thin light
 * borders with a top highlight, soft depth. Text contrast is checked against the composited
 * panel over the strongest gradient colour. Falls back to opaque panels when backdrop-filter
 * is unsupported or the user asks for reduced transparency.
 * ===================================================================== */
.swatch-glass { background: linear-gradient(135deg, #8ec5ff, #a78bfa 55%, #f9a8d4); border: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(15, 23, 42, .25); }

:root[data-style="glass"] {
  --bg: #eef2ff;
  --mesh: radial-gradient(at 12% 18%, #8ec5ff 0, transparent 46%), radial-gradient(at 88% 10%, #f9a8d4 0, transparent 42%), radial-gradient(at 72% 88%, #a78bfa 0, transparent 46%), radial-gradient(at 10% 92%, #5eead4 0, transparent 40%);
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-solid: rgba(248, 250, 252, .95);
  --glass-border: rgba(255, 255, 255, .7);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, .8);
  --surface: rgba(255, 255, 255, .72);
  --surface-2: rgba(255, 255, 255, .5);
  --border: rgba(15, 23, 42, .08);
  --input-border: #8492a6;
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-grad: linear-gradient(135deg, #2563eb, #4f46e5);
  --primary-text: #1d4ed8;
  --primary-soft: rgba(255, 255, 255, .82);
  --danger: #b91c1c;
  --ring: #1d4ed8;
  --overlay: rgba(15, 23, 42, .25);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, .14);
  --shadow-overlay: 0 20px 50px rgba(31, 38, 135, .22), inset 0 1px 0 rgba(255, 255, 255, .8);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 22px;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="glass"]:not([data-theme="light"]) {
    --bg: #0b1026;
    --mesh: radial-gradient(at 12% 18%, #1e3a8a 0, transparent 48%), radial-gradient(at 88% 10%, #6b21a8 0, transparent 44%), radial-gradient(at 72% 88%, #9d174d 0, transparent 44%), radial-gradient(at 10% 92%, #115e59 0, transparent 42%);
    --glass: rgba(15, 23, 42, .66); --glass-strong: rgba(15, 23, 42, .82); --glass-solid: rgba(15, 23, 42, .96);
    --glass-border: rgba(255, 255, 255, .12); --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, .08);
    --surface: rgba(30, 41, 59, .7); --surface-2: rgba(255, 255, 255, .08); --border: rgba(255, 255, 255, .08); --input-border: #64748b;
    --text: #e2e8f0; --muted: #b4c0d2; --primary-text: #93c5fd; --primary-soft: rgba(255, 255, 255, .12);
    --danger: #fca5a5; --ring: #93c5fd; --overlay: rgba(2, 6, 23, .5);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, .45);
    --shadow-overlay: 0 20px 50px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
    color-scheme: dark;
  }
}
:root[data-style="glass"][data-theme="dark"] {
  --bg: #0b1026;
  --mesh: radial-gradient(at 12% 18%, #1e3a8a 0, transparent 48%), radial-gradient(at 88% 10%, #6b21a8 0, transparent 44%), radial-gradient(at 72% 88%, #9d174d 0, transparent 44%), radial-gradient(at 10% 92%, #115e59 0, transparent 42%);
  --glass: rgba(15, 23, 42, .66); --glass-strong: rgba(15, 23, 42, .82); --glass-solid: rgba(15, 23, 42, .96);
  --glass-border: rgba(255, 255, 255, .12); --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, .08);
  --surface: rgba(30, 41, 59, .7); --surface-2: rgba(255, 255, 255, .08); --border: rgba(255, 255, 255, .08); --input-border: #64748b;
  --text: #e2e8f0; --muted: #b4c0d2; --primary-text: #93c5fd; --primary-soft: rgba(255, 255, 255, .12);
  --danger: #fca5a5; --ring: #93c5fd; --overlay: rgba(2, 6, 23, .5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, .45);
  --shadow-overlay: 0 20px 50px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
  color-scheme: dark;
}

/* static mesh gradient behind everything (no animation: this is a reading app) */
[data-style="glass"] body { background: var(--mesh), var(--bg); background-attachment: fixed; }

/* frosted panels */
[data-style="glass"] .topbar,
[data-style="glass"] .sidebar,
[data-style="glass"] .list-pane,
[data-style="glass"] .reader-pane,
[data-style="glass"] .auth-card,
[data-style="glass"] .prefs-menu,
[data-style="glass"] .dialog {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
}
/* backdrop-filter creates a stacking context per panel: keep the top bar (and its menu) above the panes */
[data-style="glass"] .topbar { margin: 12px 12px 0; border-radius: var(--radius-lg); position: relative; z-index: var(--z-menu); }
[data-style="glass"] .layout { padding: 12px; gap: 12px; }
[data-style="glass"] .sidebar, [data-style="glass"] .list-pane, [data-style="glass"] .reader-pane { border-radius: var(--radius-lg); }
[data-style="glass"] .reader { background: transparent; }
[data-style="glass"] .dialog { background: var(--glass-strong); border-radius: 24px; box-shadow: var(--shadow-overlay); }
[data-style="glass"] .dialog::backdrop { background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
[data-style="glass"] .prefs-menu { background: var(--glass-strong); border-radius: 18px; box-shadow: var(--shadow-overlay); }
[data-style="glass"] .auth-card { border-radius: 26px; background: var(--glass-strong); }

/* list: sticky header stays frosted, rows are tinted not opaque */
[data-style="glass"] .bulkbar { background: var(--glass-strong); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-color: var(--border); }
[data-style="glass"] .msg { border-bottom-color: var(--border); }
[data-style="glass"] .msg:hover, [data-style="glass"] .msg.is-cursor { background: var(--surface-2); }
[data-style="glass"] .msg.is-open { background: var(--glass-strong); box-shadow: inset 3px 0 0 var(--primary); }
[data-style="glass"] .list-head h1 { font-weight: 700; }

/* sidebar */
[data-style="glass"] .nav-item:hover { background: var(--surface-2); }
[data-style="glass"] .nav-item.is-active { background: var(--primary-soft); color: var(--primary-text); box-shadow: var(--glass-highlight), 0 2px 8px rgba(31, 38, 135, .1); }

/* controls */
[data-style="glass"] .btn { border-color: var(--glass-border); background: var(--surface); box-shadow: var(--glass-highlight); border-radius: var(--radius-sm); }
[data-style="glass"] .btn:hover { background: var(--glass-strong); }
[data-style="glass"] .btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
[data-style="glass"] .btn-ghost:hover { background: var(--surface-2); }
[data-style="glass"] .btn-primary { background: var(--primary-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, .35), inset 0 1px 0 rgba(255, 255, 255, .25); }
[data-style="glass"] .btn-primary:hover { background: var(--primary-grad); filter: brightness(.92); }
[data-style="glass"] .btn-danger-text:hover { background: var(--danger-soft); }
[data-style="glass"] .icon-btn { border-radius: 10px; }
[data-style="glass"] .icon-btn:hover { background: var(--surface-2); }
[data-style="glass"] .chip { background: var(--surface-2); border-color: var(--glass-border); }
[data-style="glass"] .chip:hover { background: var(--glass-strong); }
[data-style="glass"] .chip.is-active { background: var(--text); color: var(--bg); border-color: transparent; }
[data-style="glass"] .segmented { background: var(--surface-2); }
[data-style="glass"] .segmented button[aria-pressed="true"], [data-style="glass"] .segmented button[aria-selected="true"] { background: var(--glass-strong); box-shadow: var(--glass-highlight), 0 1px 4px rgba(15, 23, 42, .12); }
[data-style="glass"] input[type=text], [data-style="glass"] input[type=email], [data-style="glass"] input[type=password], [data-style="glass"] input[type=number], [data-style="glass"] input[type=search], [data-style="glass"] select, [data-style="glass"] textarea {
  background: var(--surface); border-radius: var(--radius-sm);
}
[data-style="glass"] .search input { background: var(--surface-2); border-color: var(--glass-border); }
[data-style="glass"] .search input:focus { background: var(--glass-strong); }

/* reader */
[data-style="glass"] .reader-toolbar, [data-style="glass"] .reader-foot { border-color: var(--border); }
[data-style="glass"] .attachments a { background: var(--surface); border-color: var(--glass-border); box-shadow: var(--glass-highlight); border-radius: var(--radius-sm); }
[data-style="glass"] .images-bar { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); }
[data-style="glass"] .reader-frame { border-top-color: var(--border); }
[data-style="glass"] .avatar { box-shadow: 0 0 0 2px var(--glass-border), 0 4px 12px rgba(15, 23, 42, .15); }
[data-style="glass"] .brand-mark { background: var(--primary-grad); box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }

/* toasts: dark frosted pill in both themes */
[data-style="glass"] .toast { background: rgba(15, 23, 42, .82); color: #f8fafc; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, .15); border-radius: 14px; }
[data-style="glass"] .toast.is-error { background: rgba(153, 27, 27, .9); }
[data-style="glass"] .dialog-head, [data-style="glass"] .dialog-foot, [data-style="glass"] .account-row { border-color: var(--border); }
[data-style="glass"] .advanced, [data-style="glass"] .test-result, [data-style="glass"] .send-status { background: var(--surface-2); border-color: var(--glass-border); }

@media (max-width: 860px) {
  [data-style="glass"] .topbar { margin: 8px 8px 0; }
  [data-style="glass"] .layout { padding: 8px; gap: 8px; }
  [data-style="glass"] .sidebar { inset: 8px auto 8px 8px; background: var(--glass-strong); }
}

/* No backdrop-filter, or the user asked for less transparency: solid panels, same layout. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  [data-style="glass"] .topbar, [data-style="glass"] .sidebar, [data-style="glass"] .list-pane, [data-style="glass"] .reader-pane,
  [data-style="glass"] .auth-card, [data-style="glass"] .prefs-menu, [data-style="glass"] .dialog, [data-style="glass"] .bulkbar { background: var(--glass-solid); }
}
@media (prefers-reduced-transparency: reduce) {
  [data-style="glass"] .topbar, [data-style="glass"] .sidebar, [data-style="glass"] .list-pane, [data-style="glass"] .reader-pane,
  [data-style="glass"] .auth-card, [data-style="glass"] .prefs-menu, [data-style="glass"] .dialog, [data-style="glass"] .bulkbar, [data-style="glass"] .toast {
    background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}

/* style picker: 5 styles in a 3-column grid */
.prefs-menu { width: 320px; }
.segmented-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.swatch-brutal { background: #ffdb58; border: 2px solid #000; border-radius: 1px; box-shadow: 2px 2px 0 #000; }
.swatch-terminal { background: #0a0f0a; border: 1px solid #39ff14; border-radius: 0; box-shadow: inset 0 -4px 0 #39ff14; }

/* =====================================================================
 * Style: Neubrutalism  (html[data-style="brutal"])
 * Hard 3px black borders, hard offset shadows (no blur), flat saturated colour blocks with
 * black text, near-square corners, bold Space Grotesk. Buttons "push in" when pressed.
 * Dark variant: cream lines and yellow hard shadows on charcoal.
 * ===================================================================== */
@font-face { font-family: "Space Grotesk"; src: url("fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root[data-style="brutal"] {
  --bg: #fff6dc; --surface: #ffffff; --surface-2: #fff1c2; --border: #000000; --edge: #000000; --input-border: #000000;
  --text: #000000; --muted: #3d3d3d; --primary: #ff6b6b; --primary-hover: #ff5252; --on-primary: #000000;
  --primary-text: #1d4ed8; --primary-soft: #ffdb58; --danger: #b91c1c; --danger-soft: #ffe0e0; --success: #15803d; --star: #000000;
  --ring: #1d4ed8; --overlay: rgba(0, 0, 0, .45);
  --yellow: #ffdb58; --red: #ff6b6b; --teal: #4ecdc4; --blue: #7cb7ff; --green: #c4f1a0; --pink: #ffa3d1;
  --side-bg: #4ecdc4; --side-text: #000000; --side-muted: #1f1f1f; --check: #000000;
  --shadow-color: #000000; --hard: 4px 4px 0 var(--shadow-color); --hard-lg: 6px 6px 0 var(--shadow-color);
  --shadow-overlay: 8px 8px 0 var(--shadow-color);
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 6px; --radius-sm: 4px; --radius-lg: 8px;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="brutal"]:not([data-theme="light"]) {
    --bg: #141414; --surface: #1f1f1f; --surface-2: #2a2a2a; --border: #f5f0e6; --edge: #f5f0e6; --input-border: #f5f0e6;
    --text: #f5f0e6; --muted: #c8c0b0; --primary-text: #7cb7ff; --primary-soft: #2f2a17; --danger: #ff8a8a; --danger-soft: #3a1616; --success: #86efac; --star: #ffdb58;
    --ring: #7cb7ff; --overlay: rgba(0, 0, 0, .65); --side-bg: #1f1f1f; --side-text: #f5f0e6; --side-muted: #c8c0b0; --shadow-color: #ffdb58; --check: #ffdb58;
    color-scheme: dark;
  }
}
:root[data-style="brutal"][data-theme="dark"] {
  --bg: #141414; --surface: #1f1f1f; --surface-2: #2a2a2a; --border: #f5f0e6; --edge: #f5f0e6; --input-border: #f5f0e6;
  --text: #f5f0e6; --muted: #c8c0b0; --primary-text: #7cb7ff; --primary-soft: #2f2a17; --danger: #ff8a8a; --danger-soft: #3a1616; --success: #86efac; --star: #ffdb58;
  --ring: #7cb7ff; --overlay: rgba(0, 0, 0, .65); --side-bg: #1f1f1f; --side-text: #f5f0e6; --side-muted: #c8c0b0; --shadow-color: #ffdb58; --check: #ffdb58;
  color-scheme: dark;
}

[data-style="brutal"] body { font-weight: 500; }
[data-style="brutal"] :focus-visible { outline-width: 3px; outline-offset: 3px; }
[data-style="brutal"] h1, [data-style="brutal"] h2, [data-style="brutal"] .brand { font-weight: 700; letter-spacing: -.02em; }
[data-style="brutal"] .brand-mark { background: var(--yellow); color: #000; border: 3px solid #000; border-radius: 2px; box-shadow: 3px 3px 0 var(--shadow-color); }
[data-style="brutal"] kbd { border: 2px solid var(--edge); border-radius: 2px; background: var(--yellow); color: #000; }

/* boxes */
[data-style="brutal"] .topbar { margin: 16px 16px 0; height: 60px; border: 3px solid var(--edge); border-radius: var(--radius-lg); box-shadow: var(--hard); }
[data-style="brutal"] .layout { padding: 16px; gap: 18px; }
[data-style="brutal"] .sidebar, [data-style="brutal"] .list-pane, [data-style="brutal"] .reader-pane { border: 3px solid var(--edge); border-radius: var(--radius-lg); box-shadow: var(--hard-lg); }
[data-style="brutal"] .reader-pane, [data-style="brutal"] .reader { background: var(--surface); }
[data-style="brutal"] .list-pane { border-right: 3px solid var(--edge); }

/* buttons push in */
[data-style="brutal"] .btn { border: 3px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--hard); font-weight: 700; transition: transform 90ms ease-out, box-shadow 90ms ease-out, background-color 120ms; }
[data-style="brutal"] .btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow-color); background: var(--surface-2); }
[data-style="brutal"] .btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--shadow-color); }
[data-style="brutal"] .btn-primary { background: var(--primary); color: var(--on-primary); }
[data-style="brutal"] .btn-primary:hover { background: var(--primary-hover); }
[data-style="brutal"] .btn-ghost { border-color: transparent; box-shadow: none; }
[data-style="brutal"] .btn-ghost:hover { transform: none; box-shadow: none; background: var(--surface-2); }
[data-style="brutal"] .btn-ghost:active { transform: none; }
[data-style="brutal"] .icon-btn { border-radius: var(--radius-sm); color: var(--text); border: 2px solid transparent; }
[data-style="brutal"] .icon-btn:hover { background: var(--yellow); color: #000; border-color: #000; }
[data-style="brutal"] .icon-btn[aria-pressed="true"] { background: var(--yellow); color: #000; border-color: #000; box-shadow: 2px 2px 0 #000; }
[data-style="brutal"] .icon-btn-danger:hover { background: var(--red); color: #000; }
[data-style="brutal"] .chip { border: 2.5px solid var(--edge); border-radius: var(--radius-sm); color: var(--text); font-weight: 700; box-shadow: 2px 2px 0 var(--shadow-color); }
[data-style="brutal"] .chip:hover { background: var(--surface-2); }
[data-style="brutal"] .chip.is-active { background: var(--yellow); color: #000; border-color: var(--edge); }
[data-style="brutal"] .link-btn { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; }

/* fields */
[data-style="brutal"] input[type=text], [data-style="brutal"] input[type=email], [data-style="brutal"] input[type=password], [data-style="brutal"] input[type=number], [data-style="brutal"] input[type=search], [data-style="brutal"] select, [data-style="brutal"] textarea {
  border: 3px solid var(--edge); border-radius: var(--radius-sm); background: var(--surface);
}
[data-style="brutal"] input:focus, [data-style="brutal"] select:focus, [data-style="brutal"] textarea:focus { border-color: var(--edge); box-shadow: 4px 4px 0 var(--blue); }
[data-style="brutal"] .search input { background: var(--surface); }
[data-style="brutal"] input[type=checkbox] { accent-color: var(--check); }
[data-style="brutal"] .form-error { border: 3px solid var(--danger); border-radius: var(--radius-sm); }

/* sidebar block */
[data-style="brutal"] .sidebar { background: var(--side-bg); color: var(--side-text); }
[data-style="brutal"] .nav-heading, [data-style="brutal"] .domain-label, [data-style="brutal"] .sync-status { color: var(--side-muted); }
[data-style="brutal"] .nav-heading { font-weight: 700; }
[data-style="brutal"] .nav-item { color: var(--side-text); border: 2.5px solid transparent; border-radius: var(--radius-sm); font-weight: 700; }
[data-style="brutal"] .nav-item:hover { border-color: var(--edge); background: var(--surface); color: var(--text); }
[data-style="brutal"] .nav-item .count { color: currentColor; }
[data-style="brutal"] .nav-item.is-active { background: var(--yellow); color: #000; border-color: #000; box-shadow: 3px 3px 0 #000; }
[data-style="brutal"] .nav-item .icon { width: 28px; height: 28px; padding: 5px; border: 2px solid #000; border-radius: 3px; background: #fff; color: #000; }
[data-style="brutal"] .nav-item[data-role="inbox"] .icon { background: var(--blue); }
[data-style="brutal"] .nav-item[data-role="starred"] .icon { background: var(--yellow); }
[data-style="brutal"] .nav-item[data-role="drafts"] .icon { background: #fff; }
[data-style="brutal"] .nav-item[data-role="sent"] .icon { background: var(--green); }
[data-style="brutal"] .nav-item[data-role="archive"] .icon { background: #ffc078; }
[data-style="brutal"] .nav-item[data-role="junk"] .icon { background: var(--pink); }
[data-style="brutal"] .nav-item[data-role="trash"] .icon { background: var(--red); }
[data-style="brutal"] .nav-item .dot { width: 12px; height: 12px; border-radius: 2px; border: 2px solid currentColor; }
[data-style="brutal"] .sidebar .link-btn { color: var(--side-text); }
[data-style="brutal"] .sidebar .btn-primary { min-height: 46px; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; }
[data-style="brutal"] .account-error { color: var(--danger); }

/* list */
[data-style="brutal"] .list-head h1 { display: inline-block; font-size: 28px; text-transform: uppercase; background: var(--yellow); color: #000; border: 3px solid #000; padding: 0 8px; box-shadow: 3px 3px 0 var(--shadow-color); }
[data-style="brutal"] .bulkbar { border-width: 3px 0; border-color: var(--edge); }
[data-style="brutal"] .msg { border-bottom: 2px solid var(--edge); padding-left: 20px; }
[data-style="brutal"] .msg:hover { background: var(--surface-2); }
[data-style="brutal"] .msg.is-open { background: var(--primary-soft); box-shadow: inset 6px 0 0 var(--edge); }
[data-style="brutal"] .msg.is-unread::before { width: 9px; height: 9px; left: 5px; top: 17px; border-radius: 1px; background: var(--red); box-shadow: 0 0 0 2px var(--edge); }
[data-style="brutal"] .empty-icon { color: var(--text); opacity: 1; stroke-width: 2.25; }

/* reader */
[data-style="brutal"] .reader-toolbar, [data-style="brutal"] .reader-foot { border-color: var(--edge); border-width: 3px; }
[data-style="brutal"] .reader-head h2 { font-size: 26px; }
[data-style="brutal"] .avatar { border: 3px solid var(--edge); border-radius: 4px; box-shadow: 3px 3px 0 var(--shadow-color); }
[data-style="brutal"] .attachments a { border: 3px solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--hard); font-weight: 700; transition: transform 90ms, box-shadow 90ms; }
[data-style="brutal"] .attachments a:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow-color); background: var(--surface); }
[data-style="brutal"] .images-bar { background: var(--yellow); color: #000; border: 3px solid #000; border-radius: var(--radius-sm); }
[data-style="brutal"] .images-bar .btn { color: #000; }
[data-style="brutal"] .reader-frame { border-top: 3px solid var(--edge); }

/* dialogs, menus, toasts */
[data-style="brutal"] .dialog { border: 3px solid var(--edge); border-radius: var(--radius-lg); box-shadow: var(--shadow-overlay); }
[data-style="brutal"] .dialog[open] { animation: none; }
[data-style="brutal"] .dialog-head { background: var(--yellow); color: #000; border-bottom: 3px solid var(--edge); }
[data-style="brutal"] .dialog-head .icon-btn { color: #000; }
[data-style="brutal"] .dialog-foot, [data-style="brutal"] .account-row { border-color: var(--edge); border-width: 3px; }
[data-style="brutal"] .account-row { border-width: 0 0 2px; }
[data-style="brutal"] .advanced, [data-style="brutal"] .test-result, [data-style="brutal"] .send-status { border: 3px solid var(--edge); border-radius: var(--radius-sm); }
[data-style="brutal"] .c-attachments li { border: 2px solid var(--edge); border-radius: var(--radius-sm); }
[data-style="brutal"] .prefs-menu { border: 3px solid var(--edge); border-radius: var(--radius-lg); box-shadow: var(--shadow-overlay); }
[data-style="brutal"] .segmented { border: 2.5px solid var(--edge); border-radius: var(--radius-sm); }
[data-style="brutal"] .segmented button { border-radius: 2px; font-weight: 700; }
[data-style="brutal"] .segmented button[aria-pressed="true"], [data-style="brutal"] .segmented button[aria-selected="true"] { background: var(--yellow); color: #000; box-shadow: inset 0 0 0 2px #000; }
[data-style="brutal"] .toast { background: var(--yellow); color: #000; border: 3px solid #000; border-radius: var(--radius-sm); font-weight: 700; box-shadow: 4px 4px 0 #000; }
[data-style="brutal"] .toast.is-error { background: var(--red); color: #000; }
[data-style="brutal"] .auth-card { border: 3px solid var(--edge); border-radius: var(--radius-lg); box-shadow: var(--shadow-overlay); }

@media (max-width: 860px) {
  [data-style="brutal"] .topbar { margin: 8px 8px 0; height: 56px; }
  [data-style="brutal"] .layout { padding: 8px 14px 14px 8px; gap: 8px; }
  [data-style="brutal"] .sidebar { inset: 8px auto 14px 8px; }
  [data-style="brutal"] .list-head h1 { font-size: 22px; }
}

/* =====================================================================
 * Style: Terminal  (html[data-style="terminal"])
 * Monospace (JetBrains Mono), square corners, 1px lines, inverted selection for active items,
 * [bracketed] buttons, "> " prompts. Dark: phosphor green on black with faint scanlines and a
 * soft glow on headings. Light: dark-green ink on paper, like a printed terminal session.
 * No glitch effects (they hurt reading); the title cursor blink stops under reduced motion.
 * ===================================================================== */
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root[data-style="terminal"] {
  --bg: #f3f1e7; --surface: #fbfaf4; --surface-2: #ecebdf; --border: #c9c6b4; --edge: #6f8f74; --input-border: #3f5f45;
  --text: #14301a; --muted: #3f5f45; --primary: #14301a; --primary-hover: #0a7a2f; --on-primary: #f3f1e7;
  --primary-text: #005f87; --primary-soft: #e2efd9; --accent: #0a7a2f; --magenta: #a3007d; --danger: #b3261e; --danger-soft: #f7e4e1;
  --success: #0a7a2f; --star: #a3007d; --ring: #005f87; --overlay: rgba(20, 48, 26, .35); --glow: none;
  --shadow-overlay: 0 0 0 1px var(--edge), 6px 6px 0 rgba(20, 48, 26, .12);
  --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 0; --radius-sm: 0; --radius-lg: 0;
  --scanlines: none;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="terminal"]:not([data-theme="light"]) {
    --bg: #0a0f0a; --surface: #0e150e; --surface-2: #132013; --border: #1f3d24; --edge: #3a8045; --input-border: #3a8045;
    --text: #c8facc; --muted: #86c98f; --primary: #39ff14; --primary-hover: #2ee60f; --on-primary: #000000;
    --primary-text: #3ee8ff; --primary-soft: #143a14; --accent: #39ff14; --magenta: #ff5fd7; --danger: #ff8080; --danger-soft: #2a0f0f;
    --success: #39ff14; --star: #ff5fd7; --ring: #3ee8ff; --overlay: rgba(0, 0, 0, .7); --glow: 0 0 6px rgba(57, 255, 20, .45);
    --shadow-overlay: 0 0 0 1px var(--edge), 0 0 24px rgba(57, 255, 20, .12);
    --scanlines: repeating-linear-gradient(0deg, rgba(0, 0, 0, .14) 0 1px, transparent 1px 3px);
    color-scheme: dark;
  }
}
:root[data-style="terminal"][data-theme="dark"] {
  --bg: #0a0f0a; --surface: #0e150e; --surface-2: #132013; --border: #1f3d24; --edge: #3a8045; --input-border: #3a8045;
  --text: #c8facc; --muted: #86c98f; --primary: #39ff14; --primary-hover: #2ee60f; --on-primary: #000000;
  --primary-text: #3ee8ff; --primary-soft: #143a14; --accent: #39ff14; --magenta: #ff5fd7; --danger: #ff8080; --danger-soft: #2a0f0f;
  --success: #39ff14; --star: #ff5fd7; --ring: #3ee8ff; --overlay: rgba(0, 0, 0, .7); --glow: 0 0 6px rgba(57, 255, 20, .45);
  --shadow-overlay: 0 0 0 1px var(--edge), 0 0 24px rgba(57, 255, 20, .12);
  --scanlines: repeating-linear-gradient(0deg, rgba(0, 0, 0, .14) 0 1px, transparent 1px 3px);
  color-scheme: dark;
}

[data-style="terminal"] body { font-size: 13px; line-height: 1.5; }
/* scanlines sit in the panel backgrounds (behind text), never over the email content */
[data-style="terminal"] .topbar, [data-style="terminal"] .sidebar, [data-style="terminal"] .list-pane, [data-style="terminal"] .reader-toolbar, [data-style="terminal"] .reader-head, [data-style="terminal"] .reader-foot, [data-style="terminal"] .dialog { background-image: var(--scanlines); }
@media (prefers-contrast: more) { :root[data-style="terminal"] { --scanlines: none !important; } }
[data-style="terminal"] ::selection { background: var(--primary); color: var(--on-primary); }
[data-style="terminal"] :focus-visible { outline: 1px solid var(--ring); outline-offset: 2px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
[data-style="terminal"] h1, [data-style="terminal"] h2 { font-weight: 700; text-transform: uppercase; letter-spacing: .02em; text-shadow: var(--glow); }
[data-style="terminal"] .brand { font-weight: 700; text-transform: lowercase; }
[data-style="terminal"] .brand-mark { background: transparent; color: var(--accent); border: 1px solid var(--accent); border-radius: 0; text-shadow: var(--glow); }
[data-style="terminal"] kbd { border: 1px solid var(--edge); border-radius: 0; background: transparent; color: var(--accent); }
[data-style="terminal"] a { color: var(--primary-text); }

/* windows */
[data-style="terminal"] .topbar { margin: 10px 10px 0; border: 1px solid var(--edge); background: var(--surface); }
[data-style="terminal"] .layout { padding: 10px; gap: 10px; }
[data-style="terminal"] .sidebar, [data-style="terminal"] .list-pane, [data-style="terminal"] .reader-pane { border: 1px solid var(--edge); background: var(--surface); }
[data-style="terminal"] .reader { background: var(--surface); }
[data-style="terminal"] .list-pane { border-right: 1px solid var(--edge); }

/* [ bracketed ] buttons, inverted on hover */
[data-style="terminal"] .btn { border: 1px solid var(--edge); border-radius: 0; background: transparent; color: var(--text); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; font-size: 12.5px; gap: 6px; }
[data-style="terminal"] .btn::before { content: "["; color: var(--accent); }
[data-style="terminal"] .btn::after { content: "]"; color: var(--accent); }
[data-style="terminal"] .btn:hover, [data-style="terminal"] .btn-ghost:hover { background: var(--primary); color: var(--on-primary); }
[data-style="terminal"] .btn:hover::before, [data-style="terminal"] .btn:hover::after { color: var(--on-primary); }
[data-style="terminal"] .btn-ghost { border-color: transparent; }
[data-style="terminal"] .btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
[data-style="terminal"] .btn-primary::before, [data-style="terminal"] .btn-primary::after { color: var(--on-primary); }
[data-style="terminal"] .btn-primary:hover { background: var(--primary-hover); }
[data-style="terminal"] .btn-danger-text { color: var(--danger); }
[data-style="terminal"] .icon-btn { border-radius: 0; color: var(--muted); }
[data-style="terminal"] .icon-btn:hover { background: var(--primary); color: var(--on-primary); }
[data-style="terminal"] .icon-btn[aria-pressed="true"] { color: var(--star); }
[data-style="terminal"] .icon-btn .icon, [data-style="terminal"] .nav-item .icon { stroke-width: 1.75; }
[data-style="terminal"] .chip { border-radius: 0; border: 1px solid var(--edge); background: transparent; color: var(--muted); text-transform: lowercase; font-weight: 600; }
[data-style="terminal"] .chip::before { content: "--"; }
[data-style="terminal"] .chip:hover { color: var(--text); background: var(--surface-2); }
[data-style="terminal"] .chip.is-active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
[data-style="terminal"] .link-btn { color: var(--primary-text); }

/* fields */
[data-style="terminal"] input[type=text], [data-style="terminal"] input[type=email], [data-style="terminal"] input[type=password], [data-style="terminal"] input[type=number], [data-style="terminal"] input[type=search], [data-style="terminal"] select, [data-style="terminal"] textarea {
  border: 1px solid var(--input-border); border-radius: 0; background: var(--bg); caret-color: var(--accent);
}
[data-style="terminal"] input:focus, [data-style="terminal"] select:focus, [data-style="terminal"] textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--glow); }
[data-style="terminal"] .search input { background: var(--bg); border-color: var(--input-border); }
[data-style="terminal"] input[type=checkbox] { accent-color: var(--accent); }
[data-style="terminal"] .form-error { border: 1px solid var(--danger); border-radius: 0; }
[data-style="terminal"] .form-error::before { content: "ERR: "; font-weight: 700; }

/* sidebar: the selected item is inverted, like a cursor line */
[data-style="terminal"] .nav-heading { font-size: 11px; }
[data-style="terminal"] .nav-heading::before { content: "# "; }
[data-style="terminal"] .nav-item { border-radius: 0; font-weight: 500; }
[data-style="terminal"] .nav-item:hover { background: var(--surface-2); }
[data-style="terminal"] .nav-item.is-active { background: var(--primary); color: var(--on-primary); font-weight: 700; }
[data-style="terminal"] .nav-item.is-active .icon, [data-style="terminal"] .nav-item.is-active .count { color: var(--on-primary); }
[data-style="terminal"] .nav-item .dot { border-radius: 0; }
[data-style="terminal"] .sync-status::before { content: "$ "; color: var(--accent); }

/* list */
[data-style="terminal"] .list-head h1 { font-size: 18px; }
[data-style="terminal"] .list-head h1::before { content: "> "; color: var(--accent); }
[data-style="terminal"] .list-head h1::after { content: "_"; color: var(--accent); animation: term-blink 1.1s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }
[data-style="terminal"] .bulkbar { border-color: var(--edge); }
[data-style="terminal"] .msg { border-bottom: 1px dashed var(--border); padding-left: 18px; }
[data-style="terminal"] .msg:hover { background: var(--surface-2); }
[data-style="terminal"] .msg.is-open { background: var(--primary-soft); box-shadow: inset 2px 0 0 var(--accent); }
[data-style="terminal"] .msg.is-unread::before { content: ""; width: 7px; height: 7px; left: 5px; top: 17px; border-radius: 0; background: var(--magenta); }
[data-style="terminal"] .msg.is-unread .msg-subject { color: var(--text); }
[data-style="terminal"] .star { color: var(--star); }
[data-style="terminal"] .sk { border-radius: 0; background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 9px); animation: none; }
[data-style="terminal"] .empty-icon { color: var(--accent); stroke-width: 1.5; opacity: 1; filter: drop-shadow(var(--glow, none)); }

/* reader */
[data-style="terminal"] .reader-toolbar, [data-style="terminal"] .reader-foot { border-color: var(--edge); }
[data-style="terminal"] .reader-head h2 { font-size: 18px; }
[data-style="terminal"] .avatar { background: transparent !important; color: var(--accent); border: 1px solid var(--accent); border-radius: 0; text-shadow: var(--glow); }
[data-style="terminal"] .attachments a { border: 1px solid var(--edge); border-radius: 0; background: transparent; }
[data-style="terminal"] .attachments a:hover { background: var(--primary); color: var(--on-primary); }
[data-style="terminal"] .attachments a:hover .icon, [data-style="terminal"] .attachments a:hover .muted { color: var(--on-primary); }
[data-style="terminal"] .images-bar { border: 1px dashed var(--edge); border-radius: 0; background: transparent; }
[data-style="terminal"] .images-bar span::before { content: "! "; color: var(--magenta); }
[data-style="terminal"] .reader-frame { border-top: 1px solid var(--edge); }
[data-style="terminal"] .move-select { border-radius: 0; }

/* dialogs, menus, toasts */
[data-style="terminal"] .dialog { border: 1px solid var(--edge); border-radius: 0; box-shadow: var(--shadow-overlay); }
[data-style="terminal"] .dialog[open] { animation: none; }
[data-style="terminal"] .dialog-head { background: var(--surface-2); border-color: var(--edge); }
[data-style="terminal"] .dialog-head h2::before { content: "## "; color: var(--accent); }
[data-style="terminal"] .dialog-foot, [data-style="terminal"] .account-row { border-color: var(--edge); }
[data-style="terminal"] .advanced, [data-style="terminal"] .test-result, [data-style="terminal"] .send-status { border: 1px dashed var(--edge); border-radius: 0; background: transparent; }
[data-style="terminal"] .c-attachments li { border: 1px solid var(--edge); border-radius: 0; }
[data-style="terminal"] .prefs-menu { border: 1px solid var(--edge); border-radius: 0; box-shadow: var(--shadow-overlay); }
[data-style="terminal"] .prefs-label::before { content: "# "; }
[data-style="terminal"] .segmented { border: 1px solid var(--edge); border-radius: 0; background: transparent; }
[data-style="terminal"] .segmented button { border-radius: 0; }
[data-style="terminal"] .segmented button[aria-pressed="true"], [data-style="terminal"] .segmented button[aria-selected="true"] { background: var(--primary); color: var(--on-primary); box-shadow: none; }
[data-style="terminal"] .toast { background: var(--surface); color: var(--text); border: 1px solid var(--accent); border-radius: 0; box-shadow: var(--shadow-overlay); }
[data-style="terminal"] .toast::before { content: "$ "; color: var(--accent); }
[data-style="terminal"] .toast.is-error { border-color: var(--danger); color: var(--danger); }
[data-style="terminal"] .toast.is-error::before { content: "ERR "; color: var(--danger); }
[data-style="terminal"] .auth-card { border: 1px solid var(--edge); border-radius: 0; box-shadow: var(--shadow-overlay); }

@media (max-width: 860px) {
  [data-style="terminal"] .topbar { margin: 6px 6px 0; }
  [data-style="terminal"] .layout { padding: 6px; gap: 6px; }
  [data-style="terminal"] .sidebar { inset: 6px auto 6px 6px; }
  [data-style="terminal"] .btn { letter-spacing: 0; }
  /* icon-only top bar buttons: drop the [ ] so search keeps its room */
  [data-style="terminal"] .topbar .btn::before, [data-style="terminal"] .topbar .btn::after { content: none; }
}

/* ---------- touch devices: 44px targets ---------- */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .btn, .btn-small, .nav-item, .chip, .segmented button, .move-select select, .link-btn { min-height: 44px; }
  .nav-sub { min-height: 44px; }
  input[type=checkbox] { width: 20px; height: 20px; }
  .bulk-actions { gap: 4px; }
  .bulk-actions .icon-btn { width: 40px; height: 40px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 224px minmax(280px, 340px) 1fr; }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-flex; }
  .hide-mobile { display: none; }
  body { font-size: 15px; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea { font-size: 16px; }
  .topbar { gap: 6px; padding: 0 8px; }
  .layout { grid-template-columns: 1fr; position: relative; }
  .sidebar { position: absolute; inset: 0 auto 0 0; width: min(290px, 85vw); z-index: var(--z-sidebar); transform: translateX(-100%); transition: transform var(--dur) var(--ease-out); box-shadow: var(--shadow-overlay); visibility: hidden; }
  body.menu-open .sidebar { transform: none; visibility: visible; }
  body.menu-open .layout::before { content: ""; position: absolute; inset: 0; background: var(--overlay); z-index: calc(var(--z-sidebar) - 1); }
  .list-pane, .reader-pane { grid-column: 1; grid-row: 1; border-right: 0; }
  body[data-pane="list"] .reader-pane { display: none; }
  body[data-pane="reader"] .list-pane { display: none; }
  .reader-head { padding: 14px 14px 8px; }
  .images-bar, .attachments { margin-left: 14px; margin-right: 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .reader-side { display: none; }
  .field-row { grid-template-columns: 1fr; gap: 4px; }
  .msg-subject, .msg-from { font-size: 14.5px; }
}

@media (max-width: 420px) {
  .topbar .brand { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .sk { animation: none; }
}

/* =====================================================================
 * Admin security: login steps (views/login.php) and the Security dialog (security.js)
 * ===================================================================== */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }

/* login */
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
#passkey-login { white-space: normal; text-align: center; min-height: 40px; }
.auth-step-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.auth-step-title:focus { outline: none; }
.auth-step-title .icon { color: var(--primary-text); width: 20px; height: 20px; }
#twofa-form p.muted { margin: 0 0 16px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.auth-links .link-btn { min-height: 32px; }
.otp-input { font: 600 22px/1.2 var(--mono) !important; letter-spacing: .35em; text-align: center; }
.otp-input::placeholder { letter-spacing: normal; }

/* dialog layout */
#security-dialog form > * { margin-left: 0; margin-right: 0; }
.sec-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 4px; }
.sec-tabs button { min-width: 0; }
.sec-tabs button span { overflow: hidden; text-overflow: ellipsis; }
.sec-panel { padding: 14px 0 20px; }
.sec-panel .view-title { margin-bottom: 4px; }
.sec-intro { margin: 0 0 14px; max-width: 70ch; }
.sec-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec-actions { margin-top: 12px; }
.field-note { margin: -8px 0 12px; }
.field-note:empty { display: none; }
.row-title { display: flex !important; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.badge.is-new { color: var(--primary-text); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }

/* password strength */
.strength { display: flex; align-items: center; gap: 10px; margin: -6px 0 8px; min-height: 18px; }
.strength-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 160px; flex: none; }
.strength-bar span { height: 6px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); transition: background-color var(--dur-fast); }
.strength-bar[data-level="1"] span:nth-child(-n+1) { background: var(--danger); box-shadow: none; }
.strength-bar[data-level="2"] span:nth-child(-n+2) { background: #d97706; box-shadow: none; }
.strength-bar[data-level="3"] span:nth-child(-n+3) { background: var(--success); box-shadow: none; }
.strength-bar[data-level="4"] span { background: var(--success); box-shadow: none; }
.rules { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 4px; color: var(--muted); }
.rules li { display: flex; align-items: center; gap: 6px; }
.rules .icon { width: 14px; height: 14px; opacity: .35; }
.rules li.is-ok { color: var(--success); }
.rules li.is-ok .icon { opacity: 1; }
.rules li.is-bad { color: var(--danger); }
.rules li.is-bad .icon { opacity: 1; }

/* two-step verification */
.status-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.status-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.status-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); color: var(--muted); flex: none; }
.status-card.is-on .status-icon { color: var(--success); }
.status-card + .callout { margin-top: 12px; }
.qr-box { display: inline-block; padding: 12px; margin: 6px 0 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); line-height: 0; }
.qr-box img { width: 196px; height: 196px; image-rendering: pixelated; }
#sec-qr-label:focus { outline: none; }
#sec-otpauth { margin: 4px 0 0; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 0 0 14px; padding: 12px 16px 12px 36px; border: 1px dashed var(--input-border); border-radius: var(--radius-sm); background: var(--surface-2); }
.recovery-codes li { font: 600 14px/1.6 var(--mono); }
.recovery-codes li::marker { color: var(--muted); font-weight: 400; }
.recovery-codes code { font: inherit; user-select: all; }
#sec-codes-title:focus { outline: none; }
.danger-zone > .edit-panel { flex-basis: 100%; margin: 0 !important; }
.confirm-panel .confirm-title { margin: 0 0 4px; }
.confirm-panel > p.muted { margin: 0 0 10px; }
#sec-pk-add-slot .edit-panel { margin-top: 12px !important; }

/* notifications */
.radio-group { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.radio-group legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.radio-group:disabled { opacity: .55; }
.radio-group:disabled .check { cursor: not-allowed; }
input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; cursor: pointer; }

/* activity */
.event-list { list-style: none; padding: 0; margin: 0; }
.event-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.event-row:focus { outline: none; }
.event-row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.event-row .info > span { overflow-wrap: anywhere; }
.event-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--muted); flex: none; }
.event-icon .icon { width: 15px; height: 15px; }
.event-row.is-bad .event-icon { background: var(--danger-soft); color: var(--danger); }
.event-row.is-bad strong { color: var(--danger); }
#security-dialog time[title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

/* styles */
[data-style="clay"] .status-card, [data-style="clay"] .qr-box, [data-style="clay"] .recovery-codes { border: 2.5px dashed var(--edge); }
[data-style="clay"] .status-card { border-style: solid; box-shadow: var(--clay-inset); }
[data-style="clay"] .auth-step-title, [data-style="clay"] .view-title { font-family: var(--font-display); }
[data-style="brutal"] .status-card, [data-style="brutal"] .qr-box, [data-style="brutal"] .recovery-codes { border: 3px solid var(--edge); border-radius: var(--radius-sm); box-shadow: none; }
[data-style="brutal"] .strength-bar span { height: 10px; border: 2px solid var(--edge); border-radius: 2px; box-shadow: none; }
[data-style="brutal"] .status-icon, [data-style="brutal"] .event-icon { border: 2px solid var(--edge); border-radius: var(--radius-sm); }
[data-style="brutal"] .event-row { border-bottom: 2px solid var(--edge); }
[data-style="terminal"] .status-card, [data-style="terminal"] .recovery-codes { border: 1px dashed var(--edge); border-radius: 0; background: transparent; }
[data-style="terminal"] .qr-box, [data-style="terminal"] .strength-bar span, [data-style="terminal"] .status-icon, [data-style="terminal"] .event-icon { border-radius: 0; }
[data-style="terminal"] .event-row { border-color: var(--edge); }
[data-style="terminal"] .auth-step-title::before, [data-style="terminal"] #security-dialog .view-title::before { content: "> "; color: var(--accent); }
[data-style="glass"] .status-card, [data-style="glass"] .recovery-codes { background: var(--surface-2); border-color: var(--glass-border); }

@media (max-width: 640px) {
  .sec-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .recovery-codes { grid-template-columns: 1fr; }
  .status-card { flex-wrap: wrap; }
}
@media (pointer: coarse) {
  input[type=radio] { width: 20px; height: 20px; }
  .radio-group .check, #security-dialog .check-stack .check { min-height: 44px; }
  .auth-links .link-btn { min-height: 44px; }
}
.sec-note { margin: 12px 0 0; max-width: 70ch; }
@media (max-width: 420px) {
  .sec-tabs button .icon { display: none; }
}
