/* BeastPing Mail Console — hand-written, no external assets. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f2f2f1;
  --border: #e6e6e4;
  --border-strong: #d4d4d1;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #74736f;
  --accent: #0b0b0b;
  --accent-text: #ffffff;
  --link: #2a5fd6;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --warning-text: #8a5a00;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-text: #b42323;
  --info: #2a78d6;
  --neutral: #8f8e89;
  --grid: #ececea;
  --series-line: #2a78d6;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
  --radius: 10px;
  --row-hover: #fafafa; --menu-bg: #ffffff; --menu-shadow: 0 12px 32px rgba(0,0,0,.12);
  --t-accepted: #0b7a3e; --b-accepted: #e6f6ec;
  --t-deferred: #8a5a00; --b-deferred: #fdf3dc;
  --t-failed: #b42323; --b-failed: #fdecec;
  --t-partial: #a14a12; --b-partial: #fdeee3;
  --t-progress: #1d5fc0; --b-progress: #e8f0fd;
  --t-neutral: #5c5c58; --b-neutral: #f0f0ee;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000; --surface: #0a0a0a; --surface-2: #161616; --border: #1f1f1f; --border-strong: #2e2e2e;
    --text: #ededed; --text-2: #b5b5b5; --muted: #8a8a8a; --accent: #ededed; --accent-text: #0a0a0a;
    --link: #7aa7f5; --good-text: #4cc94c; --warning-text: #fab219; --critical-text: #ef6b6b;
    --info: #3987e5; --neutral: #6d6c67; --grid: #1c1c1c; --series-line: #3987e5; --shadow: none;
    --row-hover: #0d0d0d; --menu-bg: #0f0f0f; --menu-shadow: 0 12px 32px rgba(0,0,0,.6);
    --t-accepted: #3dd68c; --b-accepted: rgba(61,214,140,.12);
    --t-deferred: #f5b740; --b-deferred: rgba(245,183,64,.12);
    --t-failed: #ff7a7a; --b-failed: rgba(255,99,99,.12);
    --t-partial: #f39a62; --b-partial: rgba(243,154,98,.13);
    --t-progress: #7ab3ff; --b-progress: rgba(90,160,255,.13);
    --t-neutral: #a3a3a3; --b-neutral: rgba(163,163,163,.12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --surface: #0a0a0a; --surface-2: #161616; --border: #1f1f1f; --border-strong: #2e2e2e;
  --text: #ededed; --text-2: #b5b5b5; --muted: #8a8a8a; --accent: #ededed; --accent-text: #0a0a0a;
  --link: #7aa7f5; --good-text: #4cc94c; --warning-text: #fab219; --critical-text: #ef6b6b;
  --info: #3987e5; --neutral: #6d6c67; --grid: #1c1c1c; --series-line: #3987e5; --shadow: none;
  --row-hover: #0d0d0d; --menu-bg: #0f0f0f; --menu-shadow: 0 12px 32px rgba(0,0,0,.6);
  --t-accepted: #3dd68c; --b-accepted: rgba(61,214,140,.12);
  --t-deferred: #f5b740; --b-deferred: rgba(245,183,64,.12);
  --t-failed: #ff7a7a; --b-failed: rgba(255,99,99,.12);
  --t-partial: #f39a62; --b-partial: rgba(243,154,98,.13);
  --t-progress: #7ab3ff; --b-progress: rgba(90,160,255,.13);
  --t-neutral: #a3a3a3; --b-neutral: rgba(163,163,163,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 20px 0 8px; color: var(--text-2); }
p { margin: 0 0 10px; }
code, .mono, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.unknown { color: var(--muted); font-style: italic; }
.bad-text { color: var(--critical-text); }
.empty { color: var(--muted); padding: 18px 12px; text-align: center; }

/* layout */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--text); padding: 0 8px; }
.brand:hover { text-decoration: none; }
.brand.big { font-size: 18px; margin-bottom: 18px; padding: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--text-2); padding: 7px 10px; border-radius: 7px; }
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.sidebar nav a.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.sidebar-foot { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 4px; }
.content { padding: 28px 32px 40px; max-width: 1400px; width: 100%; }
.foot { margin-top: 32px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.crumbs { margin-bottom: 6px; color: var(--muted); }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-2 > .card { margin-bottom: 0; }

/* cards & tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card .pad, .card.flush .pad { padding: 14px 18px; }
.card.flush > p.pad { padding-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card.login { width: min(420px, 100%); padding: 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { color: var(--text-2); font-size: 12.5px; }
.tile-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12px; }

/* banners */
.banner { border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; background: var(--surface-2); }
.banner ul { margin: 6px 0 0; padding-left: 18px; }
.banner.error { border-color: var(--critical); }
.banner.warn { border-color: var(--warning); }
.banner.ok { border-color: var(--good); }
.banner.info { border-color: var(--info); }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { opacity: .9; }
button.link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
input, select { font: inherit; font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 7px; padding: 6px 9px; min-width: 0; }
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--info); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .grow { flex: 1 1 260px; }
.filters label { min-width: 0; flex: 1 1 140px; }
.filters input, .filters select { width: 100%; }
.filter-actions { display: flex; gap: 6px; }
.range input[type=datetime-local] { max-width: 100%; }
.range { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg a { padding: 5px 11px; color: var(--text-2); border-right: 1px solid var(--border); font-size: 13px; }
.seg a:last-child { border-right: 0; }
.seg a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.seg a:hover { text-decoration: none; background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--text-2); margin: 0 4px 4px 0; background: var(--bg); }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data.compact td, table.data.compact th { padding: 4px 8px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.addr { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-wrap table.data { min-width: 760px; }
h1.mono { font-size: 20px; }
td.subject { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.resp { max-width: 340px; color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-links { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
dl.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; margin: 0; }
dl.meta dt { color: var(--muted); font-size: 12.5px; }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }
ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; }

/* status badges: tinted background + text label (the label carries the meaning) */
.badge, .pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; letter-spacing: .01em; color: var(--t-neutral); background: var(--b-neutral); font-family: var(--font); }
.st-accepted { --tc: var(--t-accepted); --bc: var(--b-accepted); }
.st-deferred, .st-hold { --tc: var(--t-deferred); --bc: var(--b-deferred); }
.st-bounced, .st-expired, .st-rejected, .st-discarded { --tc: var(--t-failed); --bc: var(--b-failed); }
.st-partial { --tc: var(--t-partial); --bc: var(--b-partial); }
.st-queued, .st-processing { --tc: var(--t-progress); --bc: var(--b-progress); }
.st-removed, .st-unknown { --tc: var(--t-neutral); --bc: var(--b-neutral); }
.badge[class*="st-"], .pill[class*="st-"] { color: var(--tc); background: var(--bc); }
.pill i { display: none; }
.sdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--tc, var(--neutral)); flex: none; }
.mail-ico { width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; flex: none; color: var(--tc, var(--t-neutral)); background: var(--bc, var(--b-neutral)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc, var(--neutral)) 35%, transparent); }
.lvl { font-size: 11.5px; font-family: var(--mono); padding: 0 6px; border-radius: 4px; border: 1px solid var(--border-strong); }
.lvl-error, .lvl-fatal, .lvl-panic { color: var(--critical-text); border-color: var(--critical); }
.lvl-warning { color: var(--warning-text); border-color: var(--warning); }
.lvl-auth { color: var(--text-2); }
.tag { font-family: var(--mono); font-size: 11.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-right: 4px; }

/* timeline */
ol.timeline { list-style: none; margin: 8px 0 0; padding: 0; border-left: 2px solid var(--border); }
.ev { position: relative; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px; padding: 8px 0 10px 18px; }
.ev::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--neutral); }
.ev.ok::before { background: var(--good); border-color: var(--good); }
.ev.warn::before { background: var(--warning); border-color: var(--warning); border-radius: 2px; }
.ev.bad::before { background: var(--critical); border-color: var(--critical); border-radius: 1px; }
.ev-time { color: var(--muted); padding-top: 1px; }
.resp-full { margin-top: 4px; padding: 6px 9px; background: var(--surface-2); border-radius: 6px; overflow-wrap: anywhere; color: var(--text-2); }
details.raw summary { cursor: pointer; margin-top: 4px; }
details.table-view { margin: 8px 0; }
details.table-view summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }

/* services */
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.service { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 3px; }
.svc-head { display: flex; align-items: center; gap: 8px; }
.svc-state { margin-left: auto; font-size: 12px; color: var(--text-2); }
.service .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--neutral); }
.service.ok .dot { background: var(--good); }
.service.bad .dot { background: var(--critical); border-radius: 1px; }
.service.bad { border-color: var(--critical); }

/* charts */
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
svg.chart text { fill: var(--muted); font: 11px var(--font); }
svg.chart text.label { fill: var(--text-2); font-size: 12px; }
svg.chart text.value { fill: var(--text-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
svg.chart .hit { fill: transparent; }
svg.chart .bar:hover .hit { fill: var(--surface-2); }
svg.chart .s-accepted, .sw.s-accepted { fill: var(--good); background: var(--good); }
svg.chart .s-deferred, .sw.s-deferred { fill: var(--warning); background: var(--warning); }
svg.chart .s-failed, .sw.s-failed { fill: var(--critical); background: var(--critical); }
svg.chart .line { fill: none; stroke: var(--series-line); stroke-width: 2; stroke-linejoin: round; }
svg.chart .dot { fill: var(--series-line); stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 16px; gap: 10px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin-top: 0; margin-left: auto; flex-direction: row; gap: 10px; align-items: center; }
  .content { padding: 18px 16px 32px; }
  .grid-2 { grid-template-columns: 1fr; }
  .ev { grid-template-columns: 1fr; gap: 2px; }
}
@media (forced-colors: active) {
  .pill i, .sw, .service .dot, .ev::before { forced-color-adjust: none; }
}


/* ---- EMAILS-UX-02: shell, toolbar, dropdowns, table ---------------------- */
.ico { flex: none; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sidebar { padding: 14px 10px; gap: 14px; }
.brand { padding: 6px 8px; font-size: 14.5px; white-space: nowrap; }
.brand-tag { font-size: 11px; font-weight: 500; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 5px; margin-left: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 14px; }
.sidebar nav a .ico { color: var(--muted); }
.sidebar nav a.active .ico, .sidebar nav a:hover .ico { color: var(--text); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 8px; }
.sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 8px 2px; border-top: 1px solid var(--border); }
.who { display: flex; align-items: center; gap: 9px; line-height: 1.25; }
.avatar { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border-strong); }
.content { max-width: 1180px; margin: 0 auto; padding: 36px 40px 48px; }

.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.disabled { opacity: .45; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-2); cursor: pointer; list-style: none; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.ghost { border-color: transparent; background: transparent; width: 30px; height: 30px; }
.icon-btn.ghost:hover { background: var(--surface-2); }
.icon-btn.active { color: var(--t-accepted); border-color: color-mix(in srgb, var(--t-accepted) 40%, transparent); }
summary.icon-btn::-webkit-details-marker, .dd > summary::-webkit-details-marker { display: none; }

.emails-head { margin-bottom: 14px; }
.emails-head h1 { font-size: 26px; letter-spacing: -.02em; }
.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tabs { display: inline-flex; gap: 4px; }
.tab { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { background: var(--surface-2); color: var(--text); }
.tab.disabled { cursor: not-allowed; opacity: .75; }
.tab.disabled:hover { color: var(--muted); }
.tab-note { font-size: 11px; font-weight: 400; border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 5px; margin-left: 4px; }
.tab-actions { display: flex; gap: 8px; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.search-box { flex: 1 1 auto; position: relative; display: block; min-width: 0; }
.search-box .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { width: 100%; height: 34px; padding: 0 12px 0 34px; border-radius: 8px; background: var(--bg); font-size: 13.5px; }
.search-box input::placeholder { color: var(--muted); }

.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 34px; padding: 0 10px 0 12px; min-width: 170px; max-width: 240px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 13.5px; user-select: none; }
.dd-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn .ico { color: var(--muted); transition: transform .15s; }
.dd[open] > .dd-btn { border-color: var(--muted); }
.dd[open] > .dd-btn .ico { transform: rotate(180deg); }
.dd-btn:hover { background: var(--surface-2); }
.dd-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: min(360px, 92vw); background: var(--menu-bg); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--menu-shadow); padding: 5px; display: flex; flex-direction: column; }
.dd-menu.right, .toolbar .dd:last-of-type .dd-menu { left: auto; right: 0; }
.dd-menu.wide { width: 440px; max-width: 92vw; padding: 12px 14px; }
.dd-menu.scroll { max-height: 340px; overflow-y: auto; }
.dd-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; color: var(--text); font: inherit; font-size: 13px; background: none; border: 0; text-align: left; cursor: pointer; white-space: nowrap; }
.dd-item:hover, .dd-item:focus-visible { background: var(--surface-2); text-decoration: none; outline: none; }
.dd-item > .ico:first-child { color: transparent; }
.dd-item.checked > .ico:first-child { color: var(--text); }
.row-menu .dd-item > .ico:first-child { color: var(--muted); }
.dd-item code { margin-left: auto; font-size: 11.5px; color: var(--muted); background: none; padding: 0; }
.dd-item.disabled { color: var(--muted); cursor: default; }
.dd-item.disabled:hover { background: none; }
.dd-count { margin-left: auto; padding-left: 16px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dd-sender { max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
.dd-sep { height: 1px; background: var(--border); margin: 5px -5px; }
.dd-title { font-size: 12px; color: var(--muted); font-weight: 500; margin: 0 0 6px; }
.dd-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.dd-custom { display: flex; flex-direction: column; gap: 8px; padding: 6px 8px 8px; }
.dd-custom label { font-size: 12px; }
.dot-label { display: inline-flex; align-items: center; gap: 8px; }
.status-help { display: grid; grid-template-columns: max-content 1fr; gap: 9px 12px; margin: 0; white-space: normal; }
.status-help dd { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }

.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -2px 0 12px; }
.chip.x { display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px 2px 10px; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.x:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.chip.x .ico { width: 13px; height: 13px; color: var(--muted); }
.clear-all { font-size: 12.5px; margin-left: 4px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }

.tbl { border: 1px solid var(--border); border-radius: 12px; overflow: visible; background: var(--bg); }
table.emails { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; table-layout: fixed; }
table.emails thead th { background: var(--surface); color: var(--muted); font-weight: 500; font-size: 12.5px; text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.emails thead th:first-child { border-top-left-radius: 12px; }
table.emails thead th:last-child { border-top-right-radius: 12px; }
table.emails thead th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
table.emails thead th a:hover { color: var(--text); text-decoration: none; }
table.emails thead th[aria-sort="ascending"] a, table.emails thead th[aria-sort="descending"] a { color: var(--text); }
table.emails thead th .ico { width: 13px; height: 13px; }
table.emails td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.emails tbody tr:last-child td { border-bottom: 0; }
table.emails tbody tr[data-href] { cursor: pointer; }
table.emails tbody tr:hover td { background: var(--row-hover); }
table.emails tbody tr:last-child td:first-child { border-bottom-left-radius: 12px; }
table.emails tbody tr:last-child td:last-child { border-bottom-right-radius: 12px; }
.col-to { width: 38%; }
.col-status { width: 17%; }
.col-subject { width: auto; }
.col-sent { width: 108px; text-align: right; }
table.emails thead th.col-sent { text-align: right; }
table.emails thead th.col-sent a { justify-content: flex-end; }
.col-act { width: 52px; text-align: right; padding-left: 0 !important; }
.to-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.to-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.to-link { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.to-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subject { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); text-align: left; unicode-bidi: plaintext; }
.na { color: var(--muted); font-style: italic; font-size: 13px; }
.col-sent time { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-menu .dd-menu { min-width: 230px; }
.empty-state { text-align: center; padding: 56px 20px 60px; }
.empty-state h2 { font-size: 16px; margin: 12px 0 6px; }
.empty-state p { color: var(--muted); max-width: 440px; margin: 0 auto 12px; }
.empty-icon { width: 44px; height: 44px; margin: 0 auto; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-strong); }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tbl + .pager { border-top: 0; padding: 14px 2px; }

@media (max-width: 900px) {
  .content { padding: 20px 16px 32px; }
  .brand-tag { display: none; }
  .sidebar { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand foot" "nav nav"; gap: 8px 10px; padding: 10px 12px 8px; }
  .brand { grid-area: brand; padding: 4px 2px; }
  .sidebar-foot { grid-area: foot; border-top: 0; padding: 0; gap: 6px; }
  .sidebar nav { grid-area: nav; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 2px; margin: 0 -4px; scrollbar-width: none; }
  .sidebar nav a { padding: 6px 10px; font-size: 13.5px; white-space: nowrap; }
  .nav-sep { display: none; }
  .who .small { display: none; }
  .emails-head h1 { font-size: 22px; }
  .tabs-row { margin-bottom: 10px; }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .toolbar .dd { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .toolbar .dd:last-of-type { flex-basis: calc(100% - 50px); }
  .dd-btn { min-width: 0; max-width: none; }
  .tbl { border-radius: 10px; }
  table.emails, table.emails tbody { display: block; }
  table.emails thead { display: none; }
  table.emails tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "to to sent act" "status subject subject subject"; align-items: center; column-gap: 10px; row-gap: 6px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--border); }
  table.emails tbody tr:last-child { border-bottom: 0; }
  table.emails td { display: block; padding: 0; border: 0; width: auto !important; }
  table.emails tbody tr:hover td { background: none; }
  .col-to { grid-area: to; }
  .col-sent { grid-area: sent; font-size: 12.5px; }
  .col-act { grid-area: act; }
  .col-status { grid-area: status; padding-left: 46px !important; }
  .col-subject { grid-area: subject; min-width: 0; }
  .mail-ico { width: 34px; height: 34px; }
  .dd-menu { max-width: calc(100vw - 32px); }
  /* On phones every toolbar menu spans the toolbar instead of its own button. */
  .toolbar { position: relative; }
  .toolbar .dd { position: static; }
  .toolbar .dd > .dd-menu, .toolbar .dd:last-of-type > .dd-menu { left: 0; right: 0; width: auto; max-width: none; }
  .dd-item { white-space: normal; }
}

/* ---- details page --------------------------------------------------------- */
.crumbs a { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.detail-head { display: flex; align-items: flex-start; gap: 14px; margin: 8px 0 6px; }
.detail-head .mail-ico { width: 44px; height: 44px; border-radius: 11px; }
.detail-title { flex: 1 1 auto; min-width: 0; }
.detail-title h1 { font-size: 22px; margin: 0 0 4px; overflow-wrap: anywhere; }
.eyebrow { font-size: 12px; color: var(--muted); margin: 0 0 2px; text-transform: uppercase; letter-spacing: .06em; }
.na-title { color: var(--muted); font-weight: 500; }
.detail-route { color: var(--text-2); margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; overflow-wrap: anywhere; }
.detail-route .arrow { color: var(--muted); }
.detail-status { padding-top: 22px; }
.status-explain { color: var(--muted); font-size: 13px; margin: 0 0 18px 58px; }
.section h2 { font-size: 15px; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.kv .k, .related .k { color: var(--muted); font-size: 13px; }
.kv .v { overflow-wrap: anywhere; }
.kv.block { grid-template-columns: 1fr; border-bottom: 0; padding-top: 14px; }
.related { padding-top: 14px; display: grid; gap: 6px; }
.copy-inline { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; vertical-align: middle; border-radius: 4px; }
.copy-inline:hover { color: var(--text); background: var(--surface-2); }
.timeline-title { margin-top: 6px; }
td.addr-wrap { white-space: nowrap; }
.content-empty { display: flex; gap: 14px; align-items: flex-start; padding: 6px 0; }
.content-empty .empty-icon { margin: 0; flex: none; }
.content-empty p { margin: 0 0 4px; }
.body-text { max-height: 420px; overflow: auto; white-space: pre-wrap; }
.html-preview { width: 100%; height: 480px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; }
@media (max-width: 900px) {
  .meta-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px minmax(0, 1fr); }
  .status-explain { margin-left: 0; }
  .detail-status { padding-top: 0; }
  .detail-head { flex-wrap: wrap; }
}


/* ---- MAIL-CONTENT-01: archived content ----------------------------------- */
.content-meta { margin: -4px 0 12px; }
.addr-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 14px; }
.addr-block { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--bg); }
.addr-block h3 { margin: 0 0 8px; color: var(--text); font-size: 13px; }
dl.meta.compact { grid-template-columns: 90px minmax(0, 1fr); gap: 5px 12px; font-size: 13px; }
.ctabs > input { position: absolute; opacity: 0; pointer-events: none; }
.ctab-labels { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.ctab-labels label { padding: 7px 12px; cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; flex-direction: row; display: inline-flex; gap: 6px; align-items: center; }
.ctab-labels label:hover { color: var(--text); }
.ctab-labels .btn { margin-left: auto; margin-bottom: 6px; }
.ctab-labels .count { font-size: 11px; background: var(--surface-2); border-radius: 999px; padding: 0 6px; }
.ctab-panel { display: none; }
#ct-html:checked ~ .ctab-labels label[for="ct-html"], #ct-text:checked ~ .ctab-labels label[for="ct-text"],
#ct-head:checked ~ .ctab-labels label[for="ct-head"], #ct-att:checked ~ .ctab-labels label[for="ct-att"] { color: var(--text); border-bottom-color: var(--text); }
#ct-html:checked ~ .ctab-panels .p-html, #ct-text:checked ~ .ctab-panels .p-text,
#ct-head:checked ~ .ctab-panels .p-head, #ct-att:checked ~ .ctab-panels .p-att { display: block; }
.ctabs > input:focus-visible ~ .ctab-labels { outline: 2px solid var(--info); outline-offset: 2px; border-radius: 6px; }
.headers-raw { max-height: 420px; overflow: auto; white-space: pre-wrap; font-size: 12px; }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font); font-size: 13.5px; line-height: 1.6; unicode-bidi: plaintext; }
.html-preview { height: 640px; }
@media (max-width: 900px) {
  .addr-blocks { grid-template-columns: 1fr; }
  .html-preview { height: 520px; }
}
.addr-block dd[dir="auto"], .p-att td[dir="auto"] { text-align: left; unicode-bidi: plaintext; }
