/* YouMail admin console.
 *
 * The same ink, paper and highlighter as the mailbox, read as an operations ledger: the overview opens
 * with a plain-language verdict, health is a status mark plus a sentence, and colour carries meaning
 * only (green working, amber needs attention, stamp red failing). Numbers use Archivo's wide axis and
 * tabular figures. Bars are SVG rectangles coloured by class, because the CSP forbids inline styles.
 */

/* ---------- shell ---------- */

.adm-badge {
    display: inline-flex; align-items: center; gap: 6px; margin: -6px 0 16px 6px; padding: 3px 8px;
    border: 1px solid rgba(255, 194, 26, .45); border-radius: var(--r-label); color: var(--hl);
    font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
}
.adm-who { display: grid; gap: 2px; padding: 0 10px 6px; color: var(--side-muted); font-size: 12px; }
.adm-who-key { display: inline-flex; align-items: center; gap: 6px; color: var(--side-text); font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-host { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-stretch: var(--semi-wide); }
.adm-host .icon { color: var(--slate); }
.adm-host .faint { font-weight: 500; font-stretch: var(--narrow); font-size: 12.5px; }
.adm-updated { font-stretch: var(--narrow); font-variant-numeric: tabular-nums; margin-right: 8px; }
.adm-live {
    display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; margin-right: 2px;
    border: 1px solid var(--rule-strong); border-radius: 14px; background: var(--sheet); color: var(--muted);
    font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s;
}
.adm-live:hover { border-color: var(--muted); color: var(--ink); }
.adm-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.adm-live.on { color: var(--ink); }
/* The console's only ambient motion: a slow pulse while it is refreshing on its own. */
.adm-live.on .adm-live-dot { background: var(--ok); animation: live 2.4s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); } }
.adm-page { padding-top: 28px; }
.adm-inner { max-width: 1240px; margin: 0 auto; }
.adm-loading { display: flex; align-items: center; gap: 12px; padding: 48px 0; color: var(--muted); }
.adm-back { margin: -8px 0 12px -8px; }
.adm-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.adm-two .card { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.page-header .btn { flex-shrink: 0; }

/* sign in */
.adm-signin .auth-card h1 { font-stretch: var(--wide); }
.adm-howto { margin-top: 22px; font-size: 13px; }
.adm-howto code, .card code, .page-sub code, p code { font-family: var(--mono); font-size: .88em; background: var(--sheet-2); border: 1px solid var(--rule); border-radius: var(--r-label); padding: 0 4px; overflow-wrap: anywhere; }

/* ---------- status ---------- */

.status-mark { display: inline-flex; flex-shrink: 0; }
.status-mark.ok { color: var(--ok); }
.status-mark.warn { color: var(--warn); }
.status-mark.fail { color: var(--stamp); }
.status-mark.off { color: var(--faint); }

.result {
    display: inline-block; font-size: 11.5px; font-weight: 650; line-height: 19px; padding: 0 7px; white-space: nowrap;
    border-radius: var(--r-label); background: var(--sheet-2); color: var(--ink-2);
}
.result.delivered { background: var(--ok-soft); color: var(--ok); }
.result.spam { background: var(--hl-soft); color: var(--ink); }
.result.rejected, .result.bounced { background: var(--stamp-soft); color: var(--stamp); }
.result.deferred { background: var(--warn-soft); color: var(--warn); }

/* ---------- overview: the verdict ---------- */

.verdict {
    position: relative; background: var(--sheet); border: 1px solid var(--rule); border-left: 6px solid var(--ok);
    border-radius: 0 var(--r-sheet) var(--r-sheet) 0; padding: 22px 26px; margin-bottom: 18px; overflow: hidden;
}
.verdict.warn { border-left-color: var(--warn); }
.verdict.fail { border-left-color: var(--stamp); background: linear-gradient(90deg, var(--stamp-soft), var(--sheet) 60%); }
.verdict-head { display: flex; gap: 16px; align-items: flex-start; }
.verdict-head .status-mark { margin-top: 3px; }
.verdict h1 { font-size: 30px; margin: 0 0 4px; }
.verdict-head p { margin: 0; }
.verdict-list { list-style: none; margin: 18px 0 0 42px; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.verdict-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.verdict-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.verdict-list .status-mark { margin-top: 2px; }
.fix { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Ruled grids: each cell draws its right and bottom rule, and the frame clips the outer ones, so a short last row leaves no hole. */
.adm-stats, .facts { display: grid; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; }
.adm-stats > *, .facts > * { box-shadow: 1px 0 0 var(--rule), 0 1px 0 var(--rule); }
.adm-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { padding: 14px 16px 15px; display: grid; gap: 3px; align-content: start; color: inherit; text-decoration: none; transition: background .15s; }
a.stat:hover { background: var(--sheet-2); }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 560; }
.stat strong { font-size: 23px; font-weight: 780; font-stretch: var(--wide); letter-spacing: -.01em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-note { color: var(--muted); font-size: 12.5px; }
.stat.alert strong { color: var(--stamp); }

/* ---------- charts ---------- */

.adm-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.chart { margin: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: 14px 16px 12px; min-width: 0; }
.chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.chart-title { font-weight: 650; font-size: 13.5px; }
.chart-total { font-weight: 780; font-stretch: var(--wide); font-variant-numeric: tabular-nums; font-size: 18px; }
.chart-svg { display: block; width: 100%; height: 112px; overflow: visible; }
.chart-grid { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bar { transform-box: fill-box; transform-origin: 50% 100%; animation: bar-in .55s var(--ease-out) both; }
.bar.ink { fill: var(--ink); }
.bar.hl { fill: var(--hl); }
.bar.stamp { fill: var(--stamp); }
.bar.slate { fill: var(--slate); }
.bar.empty { fill: var(--rule-strong); animation: none; }
.bar:hover { opacity: .78; }
@keyframes bar-in { from { transform: scaleY(0); } }
.chart-axis { display: flex; justify-content: space-between; color: var(--faint); font-size: 11.5px; font-stretch: var(--narrow); font-variant-numeric: tabular-nums; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--rule-strong); }
.chart-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch.ink { background: var(--ink); }
.swatch.hl { background: var(--hl); }
.swatch.stamp { background: var(--stamp); }
.swatch.slate { background: var(--slate); }

/* ---------- health ---------- */

.health-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.health-group { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; }
.health-group h3 { margin: 0; padding: 11px 16px; font-size: 13px; font-stretch: var(--semi-wide); border-bottom: 1px solid var(--rule); background: var(--sheet-2); }
.health-group ul { list-style: none; margin: 0; padding: 0; }
.health-group li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.health-group li:last-child { border-bottom: 0; }
.health-group li .status-mark { margin-top: 1px; }
.health-group li > div { display: grid; gap: 1px; min-width: 0; font-size: 13px; }
.health-group li.fail { background: color-mix(in srgb, var(--stamp-soft) 60%, transparent); }

/* ---------- lists, filters, tables ---------- */

.adm-tabs { margin: 0 0 16px; }
.adm-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 12px; margin-bottom: 4px; }
.adm-filters label { min-width: 150px; }
.adm-filters .btn { margin-bottom: 14px; height: 37px; }
.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); margin-bottom: 12px; }
.adm-table { margin: 0; }
.adm-table th { background: var(--sheet-2); white-space: nowrap; }
.adm-table th:first-child, .adm-table td:first-child { padding-left: 14px; }
.adm-table th:last-child, .adm-table td:last-child { padding-right: 14px; }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table td.addr { min-width: 210px; max-width: 320px; overflow-wrap: break-word; }
.adm-table td.why { max-width: 380px; overflow-wrap: anywhere; color: var(--ink-2); }
.adm-table .tag { margin-left: 6px; }
.adm-table.compact td { padding: 6px 8px; }
.adm-table .dir { color: var(--slate); margin-top: -2px; }
.adm-table .acct { display: block; font-size: 12px; color: var(--muted); }
.adm-table tr.warn-row td { color: inherit; }
.adm-table tr.warn-row { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.adm-table tr.muted-row td { color: var(--faint); }
.adm-table tr.clickable { cursor: pointer; transition: background .12s; }
.adm-table tr.clickable:hover { background: var(--sheet-2); }
.acct-cell { display: flex; align-items: center; gap: 10px; }
.acct-cell a { font-weight: 600; text-decoration: none; }
.acct-cell a:hover { text-decoration: underline; }
.storage-cell { min-width: 170px; }
.storage-cell .usage { margin: 6px 0 4px; }
.adm-pager { margin: 4px 0 20px; }
.check.inline { display: inline-flex; margin: 0 0 0 auto; font-size: 13px; color: var(--muted); }

/* usage bar: width comes from a 5% step class */
.usage { display: block; width: 100%; max-width: 220px; height: 5px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.usage-fill { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 3px; transition: width .4s var(--ease-out); }
.usage.mid .usage-fill { background: var(--warn); }
.usage.high .usage-fill { background: var(--stamp); }
.usage-fill.w5 { width: 5%; } .usage-fill.w10 { width: 10%; } .usage-fill.w15 { width: 15%; } .usage-fill.w20 { width: 20%; } .usage-fill.w25 { width: 25%; } .usage-fill.w30 { width: 30%; } .usage-fill.w35 { width: 35%; }
.usage-fill.w40 { width: 40%; } .usage-fill.w45 { width: 45%; } .usage-fill.w50 { width: 50%; } .usage-fill.w55 { width: 55%; } .usage-fill.w60 { width: 60%; } .usage-fill.w65 { width: 65%; } .usage-fill.w70 { width: 70%; }
.usage-fill.w75 { width: 75%; } .usage-fill.w80 { width: 80%; } .usage-fill.w85 { width: 85%; } .usage-fill.w90 { width: 90%; } .usage-fill.w95 { width: 95%; } .usage-fill.w100 { width: 100%; }

/* ---------- account ---------- */

.acct-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.acct-head h1 { margin: 0 0 2px; }
.acct-tags { margin-top: 10px; }
.facts { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 18px; }
.facts > div { padding: 11px 16px; min-width: 0; }
.facts dt { color: var(--muted); font-size: 12px; font-weight: 560; margin-bottom: 3px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd .usage { margin: 5px 0 5px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.action-list { display: grid; }
.action { display: flex; align-items: center; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.action:last-child { border-bottom: 0; padding-bottom: 0; }
.action:first-child { padding-top: 0; }
.action > div { flex: 1; min-width: 0; }
.action p { margin: 2px 0 0; }
.action .btn { flex-shrink: 0; }
.inline-input { margin-top: 8px; max-width: 360px; height: 32px; }
.danger-zone { border-color: color-mix(in srgb, var(--stamp) 35%, var(--rule)); margin-top: 28px; }
.danger-zone h2 .icon { color: var(--stamp); }

/* ---------- access rules ---------- */

.geo-rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.geo-rules .card { margin: 0; }
.geo-rules .segmented { display: flex; flex-wrap: wrap; margin: 0 0 14px; }
.geo-codes { margin-top: 2px; }

/* ---------- announcements ---------- */

.announce .segmented { margin: 0 0 16px; }
.announce-to { margin-bottom: 14px; }
.announce .callout { margin-top: 16px; }

/* ---------- admin keys ---------- */

.adm-keys { margin-top: 18px; }

/* ---------- system ---------- */

.doctor { list-style: none; margin: 0 0 8px; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; }
.doctor li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.doctor li:last-child { border-bottom: 0; }
.doctor li.fail { background: color-mix(in srgb, var(--stamp-soft) 60%, transparent); }
.doctor .status-mark { margin-top: 1px; }
.doctor .fix { overflow-wrap: anywhere; }
.settings-groups { display: grid; gap: 6px; }
.settings-group { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); }
.settings-group summary { cursor: pointer; padding: 10px 16px; font-weight: 650; display: flex; gap: 8px; align-items: baseline; }
.settings-group[open] summary { border-bottom: 1px solid var(--rule); }
.settings-group .table { margin: 0; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
    .adm-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .adm-charts, .health-grid, .geo-rules { grid-template-columns: minmax(0, 1fr); }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .adm-two, .facts, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
    .verdict { padding: 18px; }
    .verdict h1 { font-size: 23px; }
    .verdict-list { margin-left: 0; }
    .adm-updated, .adm-host .faint { display: none; }
    .action { flex-direction: column; align-items: stretch; gap: 10px; }
    .action .btn { align-self: flex-start; }
    .adm-filters label { min-width: 0; flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) {
    .adm-live.on .adm-live-dot { animation: none; }
    .bar { animation: none; }
}

/* ---------- domains ---------- */

.domain-card h3 { font-size: 13px; margin: 16px 0 6px; color: var(--ink-2); }
.dns-table td { vertical-align: top; }
.dns-table .dns-value { word-break: break-all; font-size: 11.5px; max-width: 520px; }
.catch-all-row { margin: 4px 0 6px; }
.catch-all-row input { width: 260px; max-width: 100%; }
.dns-checks { margin-top: 10px; }
.dns-checks .fix { display: block; margin: 4px 0 0 23px; font-size: 11.5px; word-break: break-all; }
