/* JPRAXC Mail — professional chrome in the brand's own colours: the deep
   maroon, warm cream and amber-orange of the JPRAXC Mail mark.
   Layout: top app bar + icon rail + list column + reading pane.
   Theming: light tokens at :root, dark overrides on body[data-theme=dark]. */

:root {
  --ink: #241014;
  --ink-soft: #63464c;
  --ink-faint: #8f7076;
  --accent: #7a1228;
  --accent-deep: #4a0d1c;
  --accent-ink: #4a0d1c;
  --accent-tint: #fbeef1;
  --accent-tint-2: #f5dde2;
  --gold: #e8891f;
  --bg: #f8f2ea;
  --surface: #ffffff;
  --surface-dim: #fbf6f0;
  --line: #ecdfd6;
  --hover: #f5ebe1;
  --ok: #1e7a46;
  --danger: #b3362f;
  --shadow: 0 1px 2px rgba(36, 16, 20, .06), 0 4px 16px rgba(36, 16, 20, .05);
}

body[data-theme="dark"] {
  --ink: #f4e7da;
  --ink-soft: #d5bcb0;
  --ink-faint: #a68a80;
  --accent: #b3374f;
  --accent-deep: #38101b;
  --accent-ink: #f0b98a;
  --accent-tint: #3d1a25;
  --accent-tint-2: #582536;
  --gold: #f09a32;
  --bg: #1c0d12;
  --surface: #2a141c;
  --surface-dim: #24101a;
  --line: #46242f;
  --hover: #351a24;
  --ok: #4fbe85;
  --danger: #ef7a70;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 22px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
body:not(.auth-body) { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
/* Only bare prose links pick up the dark link colour; component anchors
   (.btn, .rail-nav a, .brand, .me-menu a, .pager-btn, chips) keep theirs. */
body[data-theme="dark"] a:not([class]) { color: var(--accent-ink); }
code { background: var(--hover); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; word-break: break-all; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }
kbd { background: var(--hover); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font-size: 11.5px; }

/* ---------------------------------------------------- authentication (60/40)
   Left 60%: the JPRAXC INFYNEX brand panel in the mark's own maroon.
   Right 40%: the sign-in card. The brand panel keeps its identity in both
   themes; the form side follows the light/dark tokens. */
.auth-body { display: block; min-height: 100vh; }
.auth-split { display: grid; grid-template-columns: 60fr 40fr; min-height: 100vh; }
.auth-brand { position: relative; display: flex; flex-direction: column; justify-content: center; overflow: hidden;
  padding: clamp(40px, 7vw, 120px); color: #f7e3c2;
  background: radial-gradient(circle at 82% 108%, rgba(232, 121, 26, .32), transparent 34%),
              radial-gradient(circle at -8% -12%, rgba(232, 137, 31, .16), transparent 30%),
              linear-gradient(148deg, #2c060f, #4a0d1c 55%, #6b1224); }
.auth-brand::after { content: ""; position: absolute; right: -170px; bottom: -280px; width: 620px; height: 620px;
  border: 1px solid rgba(247, 227, 194, .14); border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(247, 227, 194, .04), 0 0 0 160px rgba(247, 227, 194, .025); }
.auth-brand > * { position: relative; z-index: 1; }
.auth-logo { width: clamp(120px, 15vw, 190px); height: auto; margin-bottom: 34px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.auth-eyebrow { color: #f09a32; font-weight: 800; letter-spacing: .16em; font-size: 13px; }
.auth-brand h1 { margin: 12px 0 18px; font-size: clamp(44px, 5vw, 76px); line-height: .96; letter-spacing: -.04em; color: #f7e3c2; }
.auth-brand h1 b { color: #f09a32; }
.auth-brand p { max-width: 560px; margin: 0; color: rgba(247, 227, 194, .78); font-size: 15.5px; line-height: 1.75; }
.auth-trust { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 30px; }
.auth-trust span { padding: 8px 13px; border: 1px solid rgba(247, 227, 194, .22); border-radius: 999px;
  background: rgba(247, 227, 194, .08); font-size: 13px; font-weight: 700; }

.auth-form-wrap { display: grid; place-items: center; padding: 32px 26px; background: var(--bg); }
.auth-card { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 34px 32px 26px; box-shadow: 0 26px 70px rgba(36, 16, 20, .14); }
.auth-card-logo { width: 56px; height: 56px; margin-bottom: 10px; border: 0; border-radius: 0; background: transparent; object-fit: contain; }
.auth-card > small { display: block; color: var(--accent); font-weight: 800; letter-spacing: .13em; font-size: 12px; }
.auth-card h2 { margin: 5px 0 10px; font-size: 27px; letter-spacing: -.02em; }
.auth-lede { color: var(--ink-faint); font-size: 13.5px; line-height: 1.65; margin: 0 0 14px; }
.auth-card label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; color: var(--ink-soft); }
.auth-card input { margin-top: 5px; font-weight: 400; width: 100%; }
.auth-links { text-align: center; margin: 14px 0 0; font-weight: 600; }
.auth-contact { display: grid; gap: 4px; width: min(100%, 430px); margin-top: 26px; padding: 14px 16px; border: 1px solid rgba(247, 227, 194, .22); border-radius: 13px; background: rgba(247, 227, 194, .08); color: rgba(247, 227, 194, .76); font-size: 11.5px; line-height: 1.5; text-align: left; }
.auth-contact strong { color: #fff3dc; font-size: 12px; }
.auth-contact a { color: #f09a32; font-weight: 750; text-decoration: none; }
.auth-contact a:hover { text-decoration: underline; }
.password-control { position: relative; display: inline-block; width: 100%; min-width: 0; }
.password-control > input { width: 100%; padding-right: 44px !important; }
.password-toggle { position: absolute; top: 50%; right: 7px; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; color: var(--ink-faint); background: transparent; cursor: pointer; transform: translateY(-50%); }
.password-toggle:hover, .password-toggle[aria-pressed="true"] { color: var(--accent); background: var(--surface-2); }
.password-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.auth-foot { color: var(--ink-faint); font-size: 11.5px; text-align: center; margin: 20px 0 0; }

.brand-logo { width: 34px; height: 34px; flex: 0 0 34px; border: 0; border-radius: 0; background: transparent; object-fit: contain; }

/* ----------------------------------------------------------------- topbar */
.topbar { display: flex; flex: 0 0 auto; align-items: center; gap: 18px; padding: 8px 16px; background: var(--surface);
  border-top: 3px solid var(--gold); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
  box-shadow: 0 4px 18px rgba(74, 13, 28, .05); }
.brand { display: flex; flex: 0 0 182px; align-items: center; gap: 10px; color: var(--ink); font-size: 17px; letter-spacing: .01em; }
.brand b { color: var(--accent); font-weight: 700; }
.brand-copy { display: grid; gap: 1px; line-height: 1.08; }
.brand-copy strong { color: var(--ink); font-size: 17px; font-weight: 500; white-space: nowrap; }
.brand-copy small { color: var(--ink-faint); font-size: 9.5px; font-weight: 600; letter-spacing: .06em; white-space: nowrap; }

.gsearch { flex: 1; max-width: 640px; display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid transparent; border-radius: 999px; padding: 9px 18px; color: var(--ink-faint); }
.gsearch:focus-within { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.gsearch input { border: 0; outline: 0; background: transparent; flex: 1; font: inherit; color: var(--ink); padding: 0; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; flex: 0 0 34px; overflow: hidden;
  background: hsl(var(--h, 340), 42%, 42%); }
.avatar-lg { width: 42px; height: 42px; flex-basis: 42px; font-size: 18px; }
.avatar-xl { width: 72px; height: 72px; flex-basis: 72px; font-size: 30px; }
.avatar.has-photo { background: var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-row { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.profile-photo-controls { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.photo-pick { cursor: pointer; }
.photo-remove { display: inline-flex !important; align-items: center; gap: 7px; font-weight: 500 !important; margin: 0 !important; }
.photo-remove input { width: auto; accent-color: var(--accent); }

.topbar-actions { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.topbar-signout { margin: 0; }
.topbar-signout .icon-btn { color: var(--accent); }
.topbar-signout .icon-btn:hover { color: #fff; background: var(--accent); }
.me { position: relative; margin-left: 0; }
.me summary { list-style: none; cursor: pointer; display: flex; border-radius: 50%; }
.me summary::-webkit-details-marker { display: none; }
.me summary:hover .avatar { outline: 3px solid var(--accent-tint-2); }
.me-menu { position: absolute; right: 0; top: 44px; width: 250px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; z-index: 40; }
.me-id { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.me-id small { display: block; color: var(--ink-faint); margin-top: 2px; word-break: break-all; }
.me-menu a, .me-menu button { display: block; width: 100%; text-align: left; padding: 10px 16px; color: var(--ink);
  background: none; border: 0; font: inherit; cursor: pointer; }
.me-menu a:hover, .me-menu button:hover { background: var(--hover); }
.me-menu form { border-top: 1px solid var(--line); }
.me-menu form button { color: var(--danger); }

/* ------------------------------------------------------------------- rail */
.app { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.rail { width: 216px; flex: 0 0 216px; padding: 14px 10px; display: flex; flex-direction: column; gap: 16px; }
.compose-btn { display: inline-flex; align-items: center; gap: 10px; background: linear-gradient(135deg, var(--accent-deep), var(--accent) 72%, #a83b27); color: #fff;
  border: 1px solid rgba(232, 137, 31, .42); border-radius: 14px; padding: 13px 20px; font-weight: 700; box-shadow: 0 12px 28px rgba(74, 13, 28, .18); width: fit-content; }
.compose-btn:hover { color: #fff; box-shadow: 0 16px 34px rgba(74, 13, 28, .24); transform: translateY(-1px); }
.compose-btn svg { color: var(--gold); }
.rail-nav { display: flex; flex-direction: column; }
.rail-nav a { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); padding: 8px 14px;
  border-radius: 0 999px 999px 0; font-weight: 500; }
.rail-nav a:hover { background: var(--hover); color: var(--ink); }
.rail-nav a.active { position: relative; background: var(--accent-tint-2); color: var(--accent-ink); font-weight: 700; }
.rail-nav a.active::before { content: ""; position: absolute; left: 3px; top: 7px; bottom: 7px; width: 3px; border-radius: 999px; background: linear-gradient(var(--gold), #f05f24); }
.rail-nav em { font-style: normal; margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent-ink); }
.rail-nav-secondary { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.rail-storage { margin-top: auto; padding: 12px 14px 6px; border-top: 1px solid var(--line); }
.rail-storage .bar { height: 5px; background: var(--line); border-radius: 999px; overflow: hidden; }
.rail-storage .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); }
.rail-storage small { color: var(--ink-faint); font-size: 11.5px; }
.rail-copyright { display: grid; gap: 1px; padding: 2px 14px 8px; color: var(--ink-faint); font-size: 9.5px; line-height: 1.35; }
.rail-copyright span { color: var(--ink-soft); font-weight: 650; }

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 0 16px 16px 0; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 999px; padding: 7px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-primary svg { color: #fff; }
.btn-danger { color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-block { display: flex; justify-content: center; width: 100%; border-radius: 10px; }
.btn-small { padding: 4px 12px; font-size: 12.5px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; color: var(--ink-soft); border: 0; background: none; cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--hover); }

.flash { border-radius: 12px; padding: 11px 15px; margin: 14px 0 0; font-weight: 500; }
.flash-ok, .flash-note { background: #e7f3ec; color: var(--ok); border: 1px solid #bfe0cd; }
.flash-error { background: #fbeae9; color: var(--danger); border: 1px solid #efc7c4; }

/* ---------------------------------------------------------------- mailbox */
.mailbox { display: flex; flex: 1; min-height: 0; gap: 14px; margin-top: 14px; }
.list-col { width: 460px; flex: 0 0 460px; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.mailbox:not(.has-sel) .list-col { flex: 1; width: auto; }

.list-tools { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.checkall { display: inline-flex; padding: 6px 8px 6px 4px; }
.tool-btn { border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.tool-btn:hover { background: var(--hover); color: var(--ink); }
.tool-btn.danger:hover { color: var(--danger); }
.list-count { margin-left: auto; color: var(--ink-faint); font-size: 12.5px; }
.pager-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 50%; color: var(--ink-soft); font-size: 17px; }
.pager-btn:hover { background: var(--hover); }

.rows { overflow-y: auto; flex: 1; }
.empty { padding: 60px 20px; text-align: center; color: var(--ink-faint); }
.empty svg { width: 44px; height: 44px; opacity: .4; }

.mrow { display: flex; align-items: center; padding: 0 6px 0 8px; border-bottom: 1px solid var(--line); position: relative; }
.mrow:hover { box-shadow: inset 0 0 0 999px rgba(125, 36, 64, .035); }
.mrow.sel { background: var(--accent-tint); }
.mrow.unread .mwho, .mrow.unread .msub { font-weight: 700; color: var(--ink); }
.mrow.read { background: var(--surface-dim); }
.mrow.read .mwho, .mrow.read .msub { color: var(--ink-soft); }
.mcheck { display: inline-flex; padding: 6px; }
.mcheck input, .checkall input { accent-color: var(--accent); width: 15px; height: 15px; }
.mstar { border: 0; background: none; cursor: pointer; padding: 6px 4px; color: #c9b6ae; display: inline-flex; }
.mstar svg { fill: none; }
.mstar:hover { color: var(--gold); }
.mstar.on { color: var(--gold); }
.mstar.on svg { fill: var(--gold); }

.mmain { flex: 1; display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 4px; min-width: 0; color: var(--ink); }
.mmain .avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 13px; }
.mwho { flex: 0 0 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msub { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msub em { font-style: normal; color: var(--ink-faint); font-weight: 400; }
.mmain .clip { width: 15px; height: 15px; color: var(--ink-faint); }
.mmain time { color: var(--ink-faint); font-size: 12px; white-space: nowrap; min-width: 44px; text-align: right; }
.mrow.unread .mmain time { color: var(--accent-ink); font-weight: 700; }

.mquick { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: none; gap: 2px;
  background: inherit; padding-left: 6px; }
.mrow:hover .mquick { display: inline-flex; }
.mquick button { border: 0; background: var(--surface); cursor: pointer; width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); box-shadow: var(--shadow); }
.mquick button:hover { color: var(--accent); }

/* When the reading pane is open, hide what no longer fits the narrow list. */
.mailbox.has-sel .msub em { display: none; }
.mailbox.has-sel .mwho { flex-basis: 120px; }

/* ----------------------------------------------------------------- reader */
.reader-col { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.mailbox:not(.has-sel) .reader-col { display: none; }
.reader-tools { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.only-narrow { display: none; }

/* --------------------------------------------------------------- outbox */
.outbox-panel { flex: 1; min-height: 0; margin-top: 14px; overflow: hidden; display: flex; flex-direction: column; }
.outbox-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 22px; border-bottom: 1px solid var(--line); background: linear-gradient(110deg, var(--surface), var(--surface-dim)); }
.outbox-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.outbox-title-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 15px; background: linear-gradient(145deg, var(--accent-deep), var(--accent)); color: var(--gold); box-shadow: 0 10px 24px rgba(74, 13, 28, .16); }
.outbox-title-icon svg { width: 24px; height: 24px; }
.outbox-title small { color: var(--accent); font-size: 10.5px; font-weight: 850; letter-spacing: .15em; }
.outbox-title h1 { margin: 2px 0 3px; font-size: 25px; letter-spacing: -.025em; }
.outbox-title p { margin: 0; color: var(--ink-faint); font-size: 12.5px; line-height: 1.5; }
.outbox-header-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.outbox-header-actions > span { color: var(--ink-faint); font-size: 12px; font-weight: 650; }
.outbox-summary { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-dim); overflow-x: auto; }
.outbox-summary-item { display: flex; align-items: center; gap: 7px; min-width: 110px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-faint); font-size: 11.5px; white-space: nowrap; }
.outbox-summary-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.outbox-summary-item strong { color: var(--ink); font-size: 14px; }
.outbox-summary-item[data-status="queued"] i { background: #d18a1d; }
.outbox-summary-item[data-status="sending"] i { background: var(--gold); box-shadow: 0 0 0 4px rgba(232, 137, 31, .13); }
.outbox-summary-item[data-status="held"] i { background: #6e5ab0; }
.outbox-summary-item[data-status="failed"] i { background: var(--danger); }
.outbox-summary-item[data-status="cancelled"] i { background: var(--ink-faint); }
.outbox-list-head, .outbox-row { display: grid; grid-template-columns: minmax(320px, 1.55fr) 130px minmax(230px, .8fr); gap: 20px; align-items: center; }
.outbox-list-head { padding: 9px 22px; border-bottom: 1px solid var(--line); color: var(--ink-faint); font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.outbox-list { flex: 1; min-height: 0; overflow-y: auto; }
.outbox-row { padding: 15px 22px; border-bottom: 1px solid var(--line); }
.outbox-row:hover { background: var(--surface-dim); }
.outbox-message { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.outbox-message-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; background: var(--accent-tint); color: var(--accent); }
.outbox-message > div { min-width: 0; }
.outbox-message h2 { overflow: hidden; margin: 0 0 3px; color: var(--ink); font-size: 13.5px; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.outbox-message p { overflow: hidden; margin: 0; color: var(--ink-faint); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.outbox-message p strong { color: var(--ink-soft); font-weight: 650; }
.outbox-message small { display: block; overflow: hidden; margin-top: 5px; color: var(--ink-faint); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.outbox-state { display: grid; justify-items: start; gap: 6px; }
.outbox-state small { color: var(--ink-faint); font-size: 10.5px; }
.outbox-delivery { display: grid; min-width: 0; gap: 3px; }
.outbox-delivery strong { color: var(--ink-soft); font-size: 11.5px; }
.outbox-delivery small { overflow: hidden; color: var(--ink-faint); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.outbox-delivery time { color: var(--ink-faint); font-size: 10px; }
.outbox-empty { display: grid; place-items: center; align-content: center; min-height: 310px; padding: 48px 24px; color: var(--ink-faint); text-align: center; }
.outbox-empty svg { width: 54px; height: 54px; margin-bottom: 12px; opacity: .42; }
.outbox-empty h2 { margin: 0 0 5px; color: var(--ink-soft); font-size: 17px; }
.outbox-empty p { margin: 0; font-size: 12.5px; }
.outbox-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 47px; padding: 8px 18px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 11.5px; }
.outbox-footer nav { display: flex; align-items: center; gap: 3px; }
.folder-panel { flex: 1; min-height: 0; margin-top: 14px; overflow: hidden; display: flex; flex-direction: column; }
.folder-panel .mailbox { margin: 0; padding: 14px; background: var(--surface-dim); }
.folder-panel .list-col, .folder-panel .reader-col { box-shadow: var(--shadow); }
.folder-panel .list-tools { background: linear-gradient(90deg, var(--surface), var(--surface-dim)); }
.folder-panel .mrow { min-height: 58px; }
.folder-panel .mrow:last-child { border-bottom: 0; }
.folder-summary { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
.outbox-summary-item[data-status="messages"] i { background: var(--accent); }
.outbox-summary-item[data-status="unread"] i { background: var(--gold); box-shadow: 0 0 0 4px rgba(232, 137, 31, .13); }
.outbox-summary-item[data-status="starred"] i { background: #b47b12; }
.outbox-summary-item[data-status="attachments"] i { background: #6e5ab0; }

.reader { padding: 20px 26px; overflow-y: auto; flex: 1; }
.reader h1 { margin: 0 0 16px; font-size: 21px; font-weight: 600; color: var(--ink); }
.reader-meta { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; margin-bottom: 6px; }
.reader-meta-text small { color: var(--ink-faint); }
.reader-meta time { margin-left: auto; color: var(--ink-faint); font-size: 12.5px; white-space: nowrap; align-self: flex-start; }
.reader-frame { width: 100%; min-height: 380px; border: 0; border-top: 1px solid var(--line); }
.reader-text { border-top: 1px solid var(--line); padding-top: 16px; line-height: 1.7; color: var(--ink-soft); word-break: break-word; }
.attachments { display: flex; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.attachments a { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 13px; background: var(--surface-dim); color: var(--ink); font-weight: 500; }
.attachments a:hover { background: var(--hover); }
.attachments a svg { color: var(--accent); width: 16px; height: 16px; }
.attachments small { color: var(--ink-faint); }

.reader-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--ink-faint); }
.reader-empty svg { width: 52px; height: 52px; opacity: .35; }
.reader-empty p { margin: 0; font-size: 15px; }

/* ---------------------------------------------------------------- compose */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.compose { width: 100%; max-width: none; margin-top: 14px; display: flex; flex-direction: column; }
.compose-modern { overflow: hidden; border-radius: 18px; box-shadow: 0 18px 44px rgba(36, 16, 20, .10); }
.main > .compose.compose-modern { overflow: hidden; scrollbar-gutter: auto; }
.compose-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 78px; padding: 13px 20px; color: #fff; border-radius: 17px 17px 0 0; border-bottom: 3px solid var(--gold);
  background: radial-gradient(circle at 82% -80%, rgba(232, 137, 31, .34), transparent 52%), linear-gradient(120deg, var(--accent-deep), var(--accent)); }
.compose-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.compose-title > span { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 13px; background: rgba(255, 255, 255, .10); color: var(--gold); }
.compose-title > span svg { width: 21px; height: 21px; }
.compose-title small { display: block; margin-bottom: 2px; color: #f4c88f; font-size: 9.5px; font-weight: 850; letter-spacing: .16em; }
.compose-head h1 { margin: 0; color: #fff; font-size: 20px; font-weight: 730; letter-spacing: -.02em; }
.compose-head-meta { display: grid; grid-template-columns: auto auto 34px; align-items: center; gap: 3px 10px; min-width: 0; }
.compose-head-meta > span { color: rgba(255, 255, 255, .68); font-size: 10.5px; text-align: right; }
.compose-head-meta strong { max-width: min(32vw, 340px); overflow: hidden; color: #fff3dc; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.compose-head-meta .icon-btn { grid-row: 1 / 3; grid-column: 3; }
.compose-head .icon-btn { color: #e9cfc5; }
.compose-head .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.compose-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(250px, 22vw, 310px); flex: 1; min-height: 0; overflow: hidden; }
.compose-editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface); }
.compose-fields { flex: 0 0 auto; padding: 8px 22px 0; }
.compose-modern .field { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 51px; margin: 0; border-bottom: 1px solid var(--line); }
.compose-modern .field > span { min-width: 0; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.compose-modern .field input { min-width: 0; padding: 12px 0; border: 0; border-radius: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; }
.compose-modern .field input::placeholder, .compose-body::placeholder { color: var(--ink-faint); opacity: .72; }
.compose-modern .field small { color: var(--ink-faint); font-size: 10.5px; white-space: nowrap; }
.compose-body-wrap { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 15px 22px 20px; }
.compose-body-wrap > span { margin-bottom: 8px; color: var(--ink-soft); font-size: 11.5px; font-weight: 750; }
.compose .compose-body { flex: 1; width: 100%; min-height: 220px; padding: 16px 17px; resize: none; border: 1px solid var(--line); border-radius: 14px; outline: 0; background: var(--surface-dim); color: var(--ink); font: inherit; line-height: 1.65; }
.compose .compose-body:focus { border-color: var(--accent); outline: 3px solid var(--accent-tint); background: var(--surface); }
.compose-sidebar { min-width: 0; overflow-y: auto; padding: 20px; border-left: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-dim), var(--surface)); }
.compose-side-section { display: grid; gap: 11px; padding: 4px 0 20px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.compose-side-section:last-child { margin-bottom: 0; border-bottom: 0; }
.compose-side-section > small { color: var(--accent); font-size: 9.5px; font-weight: 850; letter-spacing: .14em; }
.compose-sender { display: flex; align-items: center; gap: 11px; min-width: 0; }
.compose-sender > span { display: grid; gap: 2px; min-width: 0; }
.compose-sender b, .compose-sender em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-sender b { font-size: 12.5px; }
.compose-sender em { color: var(--ink-faint); font-size: 10.5px; font-style: normal; }
.compose-attach { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px; cursor: pointer; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface); color: var(--ink-soft); transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.compose-attach:hover { border-color: var(--gold); background: var(--hover); transform: translateY(-1px); }
.compose-attach > svg { width: 22px; height: 22px; color: var(--gold); }
.compose-attach input { display: none; }
.compose-attach > span { display: grid; gap: 2px; min-width: 0; }
.compose-attach b { font-size: 12px; }
.compose-attach small { color: var(--ink-faint); font-size: 10.5px; line-height: 1.4; }
.attach-note { display: block; overflow-wrap: anywhere; color: var(--accent); font-size: 10.5px; font-weight: 650; line-height: 1.5; }
.compose-delivery p { display: flex; align-items: flex-start; gap: 10px; margin: 0; }
.compose-delivery i { width: 9px; height: 9px; flex: 0 0 9px; margin-top: 4px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px rgba(30, 122, 70, .11); }
.compose-delivery p > span { display: grid; gap: 4px; }
.compose-delivery b { color: var(--ok); font-size: 11.5px; }
.compose-delivery em { color: var(--ink-faint); font-size: 10.5px; font-style: normal; line-height: 1.5; }
.compose-foot { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-height: 68px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -8px 22px rgba(36, 16, 20, .035); }
.compose-foot .btn-primary { min-width: 152px; justify-content: center; }
.compose-foot .btn-ghost { margin-left: auto; }

/* ------------------------------------------------------------ panels/admin */
.panel { max-width: 1020px; margin-top: 14px; padding: 22px 26px; }
.main > .panel, .main > .compose { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
.panel h1 { margin: 0 0 16px; font-size: 20px; font-weight: 600; }
.panel h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin: 24px 0 10px; }
.panel label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; color: var(--ink-soft); }
.panel label input, .panel label select { margin-top: 5px; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 14px; padding: 12px 14px; }
legend { font-weight: 700; font-size: 13px; color: var(--ink-soft); padding: 0 6px; }
.hint { color: var(--ink-faint); font-size: 13px; line-height: 1.8; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-tint-2); border-color: var(--accent); }

.grid { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.grid th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint);
  border-bottom: 2px solid var(--line); padding: 7px 10px; }
.grid td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: middle; }
.grid td.wrap { word-break: break-all; max-width: 420px; font-size: 12.5px; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.pill-active, .pill-sent { background: #e7f3ec; color: var(--ok); }
.pill-suspended, .pill-failed { background: #fbeae9; color: var(--danger); }
.pill-queued, .pill-sending { background: #fdf3e4; color: #9a6413; }
.pill-held { background: #ece9f7; color: #4b3d8f; }
.pill-cancelled { background: #efe9e7; color: var(--ink-faint); }
.row-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.row-form input, .row-form select { width: auto; flex: 1 1 150px; }
.row-form .btn { flex: 0 0 auto; }
.row-actions form { display: flex; gap: 6px; align-items: center; }
.row-actions input { width: 130px; padding: 4px 9px; font-size: 12.5px; }
.quota-form { display: flex; gap: 6px; align-items: center; }
.quota-form input { width: 88px; padding: 4px 9px; font-size: 12.5px; }

/* Full-width settings and organisation workspaces. */
.workspace-panel { width: 100%; max-width: none; padding: 24px; scroll-behavior: smooth; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.workspace-header h1 { margin: 3px 0 6px; font-size: clamp(27px, 2.2vw, 34px); font-weight: 750; letter-spacing: -.035em; }
.workspace-header p { max-width: 720px; margin: 0; color: var(--ink-faint); line-height: 1.6; }
.workspace-eyebrow { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.workspace-identity { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; min-width: 340px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-dim); }
.workspace-identity > span { display: grid; min-width: 0; }
.workspace-identity b, .workspace-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-identity small { margin-top: 2px; color: var(--ink-faint); font-size: 11.5px; }
.workspace-identity em, .access-badge, .you-badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 5px 9px; background: var(--accent-tint); color: var(--accent-ink); font-size: 11px; font-style: normal; font-weight: 750; white-space: nowrap; }
.workspace-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.workspace-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); align-items: start; gap: 20px; margin-top: 20px; }
.settings-workspace .workspace-layout { grid-template-columns: minmax(0, 1fr); }
.workspace-nav { position: sticky; top: 0; display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-dim); }
.workspace-nav a { display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; padding: 11px; border: 1px solid transparent; border-radius: 12px; color: var(--ink); }
.workspace-nav a:hover { border-color: var(--line); background: var(--surface); box-shadow: var(--shadow); }
.workspace-nav a > span { grid-row: 1 / 3; align-self: center; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--accent-tint); color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.workspace-nav b { font-size: 13px; }
.workspace-nav small { margin-top: 2px; color: var(--ink-faint); font-size: 10.5px; line-height: 1.35; }
.workspace-content, .workspace-content > form { display: grid; gap: 16px; min-width: 0; }

.workspace-section { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.workspace-section:target { outline: 3px solid var(--accent-tint-2); outline-offset: 2px; }
.section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.section-heading > span { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; background: linear-gradient(145deg, var(--accent-deep), var(--accent)); color: #fff; font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.workspace-section .section-heading h2 { margin: 0 0 4px; color: var(--ink); font-size: 17px; font-weight: 750; letter-spacing: -.015em; text-transform: none; }
.section-heading p { margin: 0; color: var(--ink-faint); font-size: 12.5px; line-height: 1.55; }
.section-heading-actions { align-items: center; }
.section-heading-actions > div { flex: 1; }

.profile-card-row { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; padding: 16px; border-radius: 14px; background: var(--surface-dim); }
.profile-avatar-wrap { position: relative; flex: 0 0 auto; }
.avatar-remove { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 23px; height: 23px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); color: #fff; box-shadow: var(--shadow); font: 700 16px/1 Arial, sans-serif; cursor: pointer; }
.avatar-remove:hover { background: var(--danger); transform: scale(1.06); }
.profile-photo-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; gap: 14px; }
.form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid label, .stack-form label, .admin-create-form label { min-width: 0; margin: 0; }
.field-note { display: block; min-height: 34px; margin-top: 3px; color: var(--ink-faint); font-size: 11px; font-weight: 400; line-height: 1.45; }
.section-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.section-footer > span { color: var(--ink-faint); font-size: 11.5px; line-height: 1.5; }

.connection-grid { display: grid; grid-template-columns: 1.35fr .65fr .9fr 1.6fr; gap: 10px; }
.connection-grid > div { display: grid; gap: 7px; min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-dim); }
.connection-grid small { color: var(--ink-faint); font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.connection-grid strong, .connection-grid code { overflow: hidden; margin: 0; padding: 0; background: none; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.connection-note { margin: 12px 0 0; }
.security-callout { display: grid; gap: 3px; padding: 12px 14px; border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; background: var(--surface-dim); }
.security-callout b { font-size: 12.5px; }
.security-callout span { color: var(--ink-faint); font-size: 11.5px; }
.workspace-section.api-section { margin: 0; padding-top: 20px; border-top: 1px solid var(--line); }
.api-status-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 16px 0 12px; }
.api-status { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 11px; background: var(--surface-dim); color: var(--ink-faint); font-size: 11.5px; font-weight: 750; }
.api-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.api-status.is-active { background: #e7f3ec; color: var(--ok); }
.api-status.is-active i { background: var(--ok); box-shadow: 0 0 0 4px rgba(30, 122, 70, .12); }
.compose-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.admin-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.admin-metrics article { position: relative; display: grid; gap: 5px; min-width: 0; overflow: hidden; padding: 17px 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-dim); }
.admin-metrics article::after { content: ""; position: absolute; right: -24px; bottom: -34px; width: 84px; height: 84px; border-radius: 50%; background: var(--accent-tint); }
.admin-metrics small { color: var(--ink-faint); font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.admin-metrics strong { color: var(--accent); font-size: clamp(21px, 2vw, 28px); line-height: 1; }
.admin-metrics strong em { font-size: 11px; font-style: normal; font-weight: 700; }
.admin-metrics span { color: var(--ink-faint); font-size: 11px; }
.admin-metrics .metric-available { border-color: rgba(30, 122, 70, .2); background: #f1f8f4; }
.admin-metrics .metric-available strong { color: var(--ok); }
.admin-pool { margin: 14px 0 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; }
.admin-pool .pool-bar { height: 9px; }
.admin-jump-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0; padding: 6px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-dim); }
.admin-jump-nav a { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 11px; color: var(--ink-soft); font-size: 12.5px; font-weight: 700; }
.admin-jump-nav a:hover { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.admin-jump-nav b { display: grid; place-items: center; min-width: 25px; height: 25px; border-radius: 8px; background: var(--accent-tint); color: var(--accent); font-size: 10.5px; }
.admin-section { margin-top: 16px; }
.admin-section-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.table-wrap .grid { min-width: 780px; margin: 0; }
.compact-table-wrap .grid { min-width: 500px; }
#mailboxes .table-wrap { overflow: visible; }
#mailboxes .table-wrap .grid { min-width: 0; }
.admin-table th { padding: 9px 11px; background: var(--surface-dim); border-bottom-width: 1px; }
.admin-table td { padding: 11px; }
.mailbox-identity { display: grid; gap: 3px; min-width: 190px; }
.mailbox-identity b { font-size: 12.5px; }
.mailbox-identity small, .table-subtext { display: block; margin-top: 2px; color: var(--ink-faint); font-size: 10.5px; }
.self-quota { font-weight: 700; }
.manage-actions { position: relative; min-width: 82px; }
.manage-actions > summary { list-style: none; width: fit-content; }
.manage-actions > summary::-webkit-details-marker { display: none; }
.manage-actions[open] > summary { background: var(--accent-tint); color: var(--accent); }
.manage-actions-form { position: absolute; z-index: 15; top: calc(100% + 7px); right: 0; display: grid !important; grid-template-columns: minmax(220px, 1fr); gap: 7px !important; align-items: stretch !important; width: 260px; margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 18px 44px rgba(36, 16, 20, .18); }
.manage-actions-form label { display: grid !important; gap: 4px; margin: 0 !important; color: var(--ink-faint); font-size: 10.5px !important; }
.manage-actions-form input { margin: 0 !important; padding: 7px 40px 7px 9px; }
.manage-actions-form .password-control { display: block; }
.manage-actions-form .btn { justify-content: flex-start; }
.admin-create-card { display: grid; grid-template-columns: minmax(190px, .34fr) minmax(0, 1fr); gap: 24px; margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-dim); scroll-margin-top: 12px; }
.admin-create-card h3 { margin: 4px 0 7px; font-size: 18px; }
.admin-create-card p { margin: 0; color: var(--ink-faint); font-size: 12px; line-height: 1.55; }
.admin-create-grid { grid-template-columns: repeat(3, minmax(155px, 1fr)); }
.admin-create-form .section-footer { margin-top: 12px; }
.stack-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 9px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.domain-list { display: grid; gap: 9px; }
.domain-list article { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-dim); }
.domain-list article > span:first-child { display: grid; gap: 2px; min-width: 0; }
.domain-list b, .domain-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-list small { color: var(--ink-faint); font-size: 10.5px; }
.empty-table-state { display: grid; gap: 3px; padding: 18px; text-align: center; }
.empty-table-state span { color: var(--ink-faint); font-size: 11.5px; }

/* Storage pool bar (organisation administration). */
.pool { margin-bottom: 8px; }
.pool-bar { position: relative; height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pool-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.pool-assigned { background: var(--accent-tint-2); }
.pool-used { background: var(--accent); }
.pool small { color: var(--ink-faint); display: block; margin-top: 6px; }

.login-links { text-align: center; margin: 14px 0 0; font-weight: 600; }
.login-help { color: var(--ink-soft); font-size: 13px; line-height: 1.7; }

/* ----------------------------------------------------- dark equivalents */
body[data-theme="dark"] .flash-ok, body[data-theme="dark"] .flash-note { background: #16311f; border-color: #275c37; }
body[data-theme="dark"] .flash-error { background: #431f1c; border-color: #6d332e; }
body[data-theme="dark"] .pill-active, body[data-theme="dark"] .pill-sent { background: #16311f; color: #5fce97; }
body[data-theme="dark"] .pill-suspended, body[data-theme="dark"] .pill-failed { background: #431f1c; color: #ef8f86; }
body[data-theme="dark"] .pill-queued, body[data-theme="dark"] .pill-sending { background: #3d2c11; color: #eaae4b; }
body[data-theme="dark"] .pill-held { background: #241f3f; color: #a89ae0; }
body[data-theme="dark"] .pill-cancelled { background: #35232b; color: var(--ink-faint); }
body[data-theme="dark"] .auth-card { box-shadow: 0 26px 70px rgba(0, 0, 0, .5); }
body[data-theme="dark"] .admin-metrics .metric-available { background: #16311f; border-color: #275c37; }

/* --------------------------------------------------------- theme toggle */
.theme-toggle { color: var(--ink-soft); }
.theme-toggle:hover { color: var(--gold); }
.theme-toggle .icon-moon { display: none; }
body[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
body[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* An HTML email is designed on white — keep its canvas white in both themes. */
.reader-frame { background: #fff; border-radius: 0 0 8px 8px; }

/* ------------------------------------------------------------ API access */
.api-section { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 4px; }
.api-section h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin: 18px 0 8px; }
body[data-theme="dark"] .api-section h2 { color: var(--accent-ink); }
.api-key-once { display: inline-block; margin-top: 6px; font-size: 15px; font-weight: 700; padding: 6px 10px; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .mailbox.has-sel .list-col { display: none; }
  .only-narrow { display: inline-flex; }
  .list-col { width: auto; flex: 1; }
  .workspace-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-create-card { grid-template-columns: 1fr; }
  .admin-create-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .admin-section-grid { grid-template-columns: 1fr; }
  .compose-layout { grid-template-columns: minmax(0, 1fr) 250px; }
  .compose-head-meta > span { display: none; }
  .compose-head-meta { grid-template-columns: minmax(0, 1fr) 34px; }
  .compose-head-meta strong { grid-column: 1; }
  .compose-head-meta .icon-btn { grid-row: 1; grid-column: 2; }
}
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-wrap { min-height: 100vh; }
  .workspace-header { align-items: flex-start; flex-direction: column; }
  .workspace-identity { width: 100%; min-width: 0; }
  .workspace-layout { grid-template-columns: 1fr; }
  .workspace-nav { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-create-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .compose-layout { grid-template-columns: 1fr; overflow-y: auto; }
  .compose-editor { min-height: 470px; overflow: visible; }
  .compose-sidebar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; overflow: visible; padding: 16px 20px; border-top: 1px solid var(--line); border-left: 0; }
  .compose-side-section { align-content: start; min-width: 0; margin: 0; padding: 0 16px 0 0; border-right: 1px solid var(--line); border-bottom: 0; }
  .compose-side-section:last-child { padding-right: 0; border-right: 0; }
  .outbox-list-head { display: none; }
  .outbox-row { grid-template-columns: minmax(0, 1fr) auto; }
  .outbox-delivery { grid-column: 1 / -1; padding-left: 50px; }
}
@media (max-width: 760px) {
  .rail { width: 64px; flex-basis: 64px; padding: 12px 6px; }
  .rail-nav a span, .rail-storage, .rail-copyright, .compose-btn { display: none; }
  .rail-nav a { justify-content: center; border-radius: 12px; padding: 10px; }
  .rail-nav em { display: none; }
  .main { padding: 0 10px 10px 0; }
  .mwho { flex-basis: 96px; }
  .msub em { display: none; }
  .gsearch { padding: 7px 14px; }
  .brand { flex-basis: 34px; }
  .brand span { display: none; }
  .workspace-panel { padding: 17px; }
  .form-grid-two, .connection-grid, .admin-metrics, .admin-create-grid { grid-template-columns: 1fr; }
  .workspace-nav { grid-template-columns: 1fr; }
  .workspace-nav small { display: none; }
  .workspace-nav a { grid-template-columns: 30px 1fr; }
  .profile-card-row { align-items: flex-start; }
  .section-footer, .api-status-row { align-items: flex-start; flex-direction: column; }
  .admin-jump-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stack-form { grid-template-columns: 1fr; }
  #mailboxes .table-wrap { overflow-x: auto; overflow-y: visible; }
  #mailboxes .table-wrap .grid { min-width: 760px; }
  .manage-actions-form { grid-template-columns: 1fr; min-width: 250px; }
  .compose-head { min-height: 68px; padding: 10px 13px; }
  .compose-title > span { width: 36px; height: 36px; flex-basis: 36px; }
  .compose-title small, .compose-head-meta strong { display: none; }
  .compose-head-meta { display: block; }
  .compose-head h1 { font-size: 17px; }
  .compose-fields { padding-inline: 14px; }
  .compose-modern .field { grid-template-columns: 48px minmax(0, 1fr); gap: 8px; }
  .compose-modern .field small { display: none; }
  .compose-body-wrap { padding: 13px 14px 16px; }
  .compose-sidebar { grid-template-columns: 1fr; }
  .compose-side-section { padding: 0 0 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .compose-side-section:last-child { padding-bottom: 0; border-bottom: 0; }
  .compose-foot { flex-wrap: wrap; padding: 10px 13px; }
  .compose-foot .btn-primary { min-width: 0; }
  .compose-foot .btn-ghost { margin-left: 0; }
  .outbox-header { align-items: flex-start; padding: 16px; }
  .outbox-title-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .outbox-title p, .outbox-header-actions > span { display: none; }
  .outbox-summary { grid-template-columns: repeat(5, 104px); padding-inline: 12px; }
  .folder-summary { grid-template-columns: repeat(4, 104px); }
  .outbox-row { gap: 12px; padding: 14px; }
  .outbox-delivery { padding-left: 0; }
}
