:root {
    color-scheme: dark;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0b1020;
    color: #eaf0ff;
    --panel: #121a2d;
    --surface: #0d1528;
    --border: #27344d;
    --muted: #a8b6d3;
    --primary: #a2aaff;
    --focus: #acb5ff;
    --green: #72eac0;
    --red: #ffadb8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; }
button, .button {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; padding: .5rem .9rem; border-radius: 8px; border: 1px solid transparent;
    background: var(--primary); color: #151b42; font-size: .875rem; font-weight: 750;
    text-decoration: none; cursor: pointer; width: fit-content; white-space: nowrap;
}
button:hover, .button:hover { filter: brightness(1.12); }
.secondary { background: #1c2740; border-color: #354362; color: #dbe5ff; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.55rem, 2.8vw, 2.3rem); letter-spacing: -.035em; margin-bottom: 0; }
h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }
small, .muted { color: var(--muted); line-height: 1.5; }
.skip { position: absolute; top: -100px; left: 10px; padding: .65rem; background: var(--panel); z-index: 2; }
.skip:focus { top: 10px; }
.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    background: #0d1527; border-right: 1px solid #22304a; display: flex; flex-direction: column;
    gap: 2rem; padding: 1.55rem 1rem; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .65rem; color: #eef3ff; font-weight: 760; text-decoration: none; letter-spacing: -.025em; }
.brand-icon { display: grid; place-items: center; color: #141a3a; background: #a2aaff; height: 32px; width: 32px; border-radius: 9px; font-size: 1.2rem; }
.sidebar nav { display: grid; gap: .36rem; }
.nav-link { color: #c0cbe5; text-decoration: none; font-weight: 570; font-size: .88rem; border-radius: 8px; padding: .62rem .75rem; }
.nav-link:hover { background: #17223a; }
.nav-link.is-current { background: #252b51; color: #e6eaff; box-shadow: inset 3px 0 var(--primary); }
.side-footer { margin-top: auto; display: grid; gap: .65rem; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
main { width: 100%; min-width: 0; }
.shell main { padding: clamp(1rem, 3vw, 2.6rem); max-width: 1740px; }
.page-heading, .section-heading, .table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.section-heading h2 { margin: 0; }
.zone { color: var(--muted); font-size: .82rem; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.content, .chart-panel { padding: clamp(.95rem, 2vw, 1.35rem); margin: 0 0 1rem; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: .8rem; padding: .85rem; margin-bottom: 1rem; }
.filters.plain { padding: 0; }
label { display: grid; gap: .36rem; font-size: .84rem; color: #d4dff7; font-weight: 580; min-width: 0; }
input, select, textarea {
    display: block; min-height: 40px; min-width: 0; max-width: 100%; width: 100%;
    background: var(--surface); color: #eaf0ff; border: 1px solid #344461; border-radius: 7px; padding: .5rem .62rem;
}
textarea { resize: vertical; }
.filters select { max-width: 19rem; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 212px), 1fr)); gap: .8rem; margin-bottom: 1rem; }
.metric { padding: 1rem; }
.metric h2 { font-size: .84rem; color: #c9d5ef; margin-bottom: .68rem; }
.metric p { font-size: clamp(1.13rem, 2.15vw, 1.83rem); font-weight: 760; letter-spacing: -.03em; margin-bottom: .26rem; overflow-wrap: anywhere; }
.metric small { font-size: .75rem; }
.chart-wrap { height: 310px; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: .82rem; white-space: nowrap; }
th, td { text-align: left; padding: .72rem .85rem; border-bottom: 1px solid var(--border); }
th { color: #aebcdb; background: #151f34; }
th a { text-decoration: none; color: inherit; }
tr:nth-child(even) td { background: #10182b; }
tbody tr:last-child td { border-bottom: 0; }
.pill { display: inline-flex; padding: .16rem .48rem; border-radius: 999px; background: #26324e; color: #d6e1fb; font-size: .73rem; font-weight: 720; }
.pill.sent, .pill.active, .pill.accepted { color: var(--green); background: #113a37; }
.pill.failed, .pill.rejected, .pill.uncertain { color: var(--red); background: #422637; }
.pill.pending, .pill.safe_retry, .pill.sending { color: #f7db8d; background: #3e3525; }
.pager { display: flex; gap: .6rem; margin-top: 1rem; }
.stack { display: grid; gap: .85rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .82rem; border: 1px solid var(--border); border-radius: 8px; padding: .85rem; margin: 0; min-width: 0; }
legend { padding: 0 .4rem; color: #c9d4ed; font-size: .88rem; }
.wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: 1.05rem; min-height: 1.05rem; }
.campaign-list { list-style: none; padding: 0; margin: 0; }
.campaign-list li { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; border-top: 1px solid var(--border); padding: .7rem 0; }
.campaign-list a { text-decoration: none; font-weight: 670; overflow-wrap: anywhere; }
.snippet { display: grid; gap: .42rem; margin: 0 0 1rem; }
.snippet textarea, code { font-family: ui-monospace, Consolas, monospace; font-size: .83rem; }
.alert { padding: .72rem .9rem; border: 1px solid #3c6e60; border-radius: 8px; color: var(--green); background: #182d32; }
.alert.error { border-color: #7e4456; color: var(--red); background: #2c2032; }
.narrow { max-width: 650px; }
.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: min(100%, 435px); padding: clamp(1.2rem, 4vw, 2rem); background: var(--panel); border: 1px solid var(--border); border-radius: 15px; }
.auth-card h1 { margin: 1.4rem 0; }
.steps { padding-left: 1.4rem; line-height: 1.65; }
.configuration { display: grid; grid-template-columns: minmax(110px, 145px) minmax(0, 1fr); gap: .55rem; font-size: .87rem; }
.configuration dt { color: var(--muted); }
.configuration dd { margin: 0; overflow-wrap: anywhere; }
summary { cursor: pointer; }
details form, details .snippet { margin-top: .55rem; }
@media (max-width: 760px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; height: auto; padding: .8rem 1rem; gap: .65rem; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar nav { display: flex; flex-wrap: wrap; }
    .side-footer { display: flex; align-items: center; justify-content: space-between; }
}
@media (max-width: 520px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .chart-wrap { height: 245px; }
    .zone { display: block; text-align: right; }
}

