:root {
    font-family: system-ui, sans-serif;
    color-scheme: dark;
    background: #0b1020;
    color: #edf1ff;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
a {
    color: #b1c3ff;
}
header {
    min-height: 76px;
    padding: 18px max(24px, calc((100vw - 1200px) / 2));
    display: flex;
    align-items: center;
    gap: 32px;
    border-bottom: 1px solid #29334a;
    flex-wrap: wrap;
}
.brand {
    font-weight: 900;
    letter-spacing: -1px;
    font-size: 23px;
    color: inherit;
    text-decoration: none;
}
.brand span {
    color: #8ca5ff;
}
.brand small {
    font-size: 13px;
    margin-left: 12px;
    letter-spacing: 2px;
    color: #9cabc9;
}
nav {
    display: flex;
    gap: 24px;
}
nav a {
    text-decoration: none;
}
header form {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}
.username {
    color: #a6b4d1;
    font-size: 13px;
}
main {
    max-width: 1200px;
    padding: 40px 24px 80px;
    margin: auto;
    min-height: calc(100vh - 145px);
}
h1 {
    font-size: clamp(30px, 4vw, 40px);
    margin: 10px 0;
    letter-spacing: -1px;
}
h2 {
    font-size: 22px;
}
p {
    color: #a6b4d1;
    line-height: 1.7;
}
.eyebrow {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #91aaff;
}
.title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.badge {
    font-size: 13px;
    border: 1px solid #34415d;
    border-radius: 24px;
    padding: 8px 12px;
    color: #b1c3e6;
}
.notice {
    padding: 18px 20px;
    background: #182440;
    border: 1px solid #304269;
    border-radius: 12px;
    line-height: 1.7;
    color: #b6c6e7;
    margin: 28px 0;
}
.notice strong {
    color: #e3ebff;
}
.table-scroll {
    overflow-x: auto;
    border: 1px solid #29354e;
    border-radius: 14px;
}
table {
    border-collapse: collapse;
    width: 100%;
    min-width: 680px;
}
th {
    text-align: left;
    color: #9cabca;
    font-size: 13px;
    background: #141d31;
    padding: 18px;
    white-space: nowrap;
}
td {
    padding: 24px;
}
td.number {
    text-align: right;
    color: #7789ad;
    font-variant-numeric: tabular-nums;
}
.app-meta {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #94a3c0;
}
.status {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #1c2943;
    font-size: 13px;
    font-style: normal;
    color: #b1c3e6;
}
.status-live {
    background: #1b3a2f;
    color: #9fe0bd;
}
.status-disabled {
    background: #3f2530;
    color: #ffb7b7;
}
code {
    font-size: 13px;
    color: #d2dfff;
}
.empty {
    text-align: center;
    height: 220px;
}
.empty strong,
.empty span {
    display: block;
}
.empty span {
    margin-top: 12px;
    color: #94a3c0;
    font-size: 14px;
}
.panel {
    background: #141d31;
    border: 1px solid #29354e;
    border-radius: 14px;
    padding: 28px;
}
.login {
    max-width: 440px;
    margin: 36px auto;
    background: #141d31;
    border: 1px solid #29354e;
    border-radius: 20px;
    padding: 32px;
}
.login form {
    margin-top: 24px;
}
label {
    display: block;
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 600;
}
input {
    width: 100%;
    padding: 12px 14px;
    background: #0b1222;
    border: 1px solid #3b4967;
    border-radius: 9px;
    color: inherit;
    font: inherit;
}
input:focus,
button:focus-visible,
a:focus-visible {
    outline: 2px solid #a6baff;
    outline-offset: 3px;
}
button {
    background: #90aaff;
    color: #101931;
    border: 0;
    border-radius: 9px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.login button {
    width: 100%;
    margin-top: 24px;
}
.quiet {
    background: #1c2943;
    color: #d2dfff;
    padding: 9px 14px;
    font-size: 14px;
}
.hint {
    font-size: 13px;
    margin-bottom: 0;
}
.validation {
    color: #ffb7b7;
    font-size: 13px;
}
.validation ul {
    padding-left: 18px;
}
.validation:empty,
.validation-summary-valid {
    display: none;
}
footer {
    padding: 20px 24px;
    border-top: 1px solid #253049;
    text-align: center;
    font-size: 13px;
    color: #7789ad;
}
@media (max-width: 600px) {
    header {
        gap: 18px;
        padding: 18px;
    }
    header form {
        margin-left: 0;
    }
    main {
        padding: 24px 18px 60px;
    }
    .login {
        padding: 24px;
        margin: 18px auto;
    }
    .username {
        display: none;
    }
}

/* --- Reporting dashboard ------------------------------------------------------------- */
.hidden {
    display: none !important;
}
.muted {
    color: #7789ad;
}
.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    margin: 24px 0 12px;
    padding: 18px 20px;
    background: #141d31;
    border: 1px solid #29354e;
    border-radius: 14px;
}
.controls label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    color: #9cabca;
    min-width: 160px;
    flex: 1 1 160px;
}
.controls label.check {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 0 0 auto;
    padding-bottom: 12px;
    color: #d2dfff;
    font-size: 13px;
}
.controls input,
.controls select {
    padding: 10px 12px;
    background: #0b1222;
    border: 1px solid #3b4967;
    border-radius: 9px;
    color: inherit;
    font: inherit;
    font-size: 14px;
    width: 100%;
}
.controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    accent-color: #90aaff;
}
.controls button {
    padding: 11px 20px;
    flex: 0 0 auto;
}
.freshness {
    font-size: 13px;
    color: #94a3c0;
    margin: 12px 0;
}
.warning {
    padding: 14px 18px;
    background: #3f2f1a;
    border: 1px solid #7a5a22;
    border-radius: 12px;
    color: #ffd9a0;
    line-height: 1.6;
    margin: 12px 0 20px;
}
.totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 20px 0 24px;
}
.stat {
    background: #141d31;
    border: 1px solid #29354e;
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-label {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #91aaff;
    text-transform: uppercase;
}
.stat strong {
    font-size: 30px;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}
.stat-note {
    font-size: 13px;
    color: #7789ad;
}
.provisional {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 10px;
    background: #3f2f1a;
    color: #ffd9a0;
    font-size: 13px;
    font-style: normal;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: middle;
}
table.apps td {
    padding: 18px 20px;
}
table.apps td.number {
    color: #edf1ff;
    font-size: 17px;
}
td.number.unavailable {
    color: #5f6f92;
}
th.number {
    text-align: right;
}
th a {
    color: inherit;
    text-decoration: none;
}
th a:hover {
    color: #d2dfff;
}
.app-title {
    font-weight: 700;
    color: #edf1ff;
    text-decoration: none;
}
.app-title:hover {
    text-decoration: underline;
}
.day-nav {
    display: flex;
    gap: 18px;
    font-size: 13px;
    margin: 8px 0 16px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 16px 0;
}
.panel {
    margin: 16px 0;
}
.panel h2 {
    margin-top: 0;
}
.panel h3 {
    font-size: 15px;
    margin: 26px 0 8px;
}
.panel-note {
    font-size: 13px;
    margin-top: -6px;
}
.funnel {
    list-style: none;
    padding: 0;
    margin: 0;
}
.funnel li {
    display: grid;
    grid-template-columns: 1fr auto 60px;
    gap: 12px;
    align-items: baseline;
    padding: 10px 0;
    border-top: 1px solid #253049;
}
.funnel strong {
    font-size: 20px;
    font-variant-numeric: tabular-nums;
}
.funnel em {
    font-style: normal;
    font-size: 13px;
    color: #7789ad;
    text-align: right;
}
.facts {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
    margin: 0 0 16px;
}
.facts dt {
    color: #9cabca;
    font-size: 13px;
}
.facts dd {
    margin: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.bars {
    list-style: none;
    padding: 0;
    margin: 0;
}
.bars li {
    display: grid;
    grid-template-columns: 110px 1fr 36px;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    color: #9cabca;
    padding: 4px 0;
}
.bars i {
    display: block;
    height: 10px;
    min-width: 2px;
    border-radius: 5px;
    background: #90aaff;
}
/* Bar lengths are quantized to tenths so no inline style is needed under the CSP. */
.bar-0 { width: 0; }
.bar-1 { width: 10%; }
.bar-2 { width: 20%; }
.bar-3 { width: 30%; }
.bar-4 { width: 40%; }
.bar-5 { width: 50%; }
.bar-6 { width: 60%; }
.bar-7 { width: 70%; }
.bar-8 { width: 80%; }
.bar-9 { width: 90%; }
.bar-10 { width: 100%; }
.bars strong {
    text-align: right;
    color: #edf1ff;
}
.errors,
.audit {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
}
.errors li,
.audit li {
    padding: 6px 0;
    border-top: 1px solid #253049;
}
.errors time,
.audit time {
    color: #7789ad;
    margin-right: 8px;
    font-variant-numeric: tabular-nums;
}
.table-scroll.plain {
    border: 0;
    border-radius: 0;
}
.table-scroll.plain table,
table.compact {
    min-width: 0;
}
table.compact {
    width: 100%;
    border-collapse: collapse;
}
table.compact th,
table.compact td {
    padding: 8px 10px;
    font-size: 13px;
}
table.compact th {
    background: transparent;
    padding-top: 0;
}
table.compact td.number {
    color: #edf1ff;
}
.empty.small {
    height: auto;
    padding: 24px;
    color: #94a3c0;
}
.operation {
    margin: 12px 0 0;
}
.operation label {
    margin-top: 0;
}
.operation button {
    margin-top: 14px;
}
button.danger {
    background: #ffb7b7;
    color: #3a1414;
}
@media (max-width: 600px) {
    .stat strong {
        font-size: 24px;
    }
    table.apps td {
        padding: 14px 12px;
    }
}

/* --- Campaigns ----------------------------------------------------------------------- */
table.campaigns {
    min-width: 1800px;
}
table.campaigns th,
table.campaigns td {
    padding: 12px 10px;
    font-size: 13px;
    white-space: nowrap;
}
table.campaigns th {
    text-align: right;
}
table.campaigns th:first-child,
table.campaigns td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: #0e1526;
    min-width: 220px;
}
table.campaigns thead th:first-child {
    background: #141d31;
}
table.campaigns tr.groups th {
    text-align: center;
    color: #91aaff;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 13px;
    border-bottom: 1px solid #29354e;
}
table.campaigns td.number {
    color: #edf1ff;
}
tr.breakdown-row td {
    color: #9cabca;
    background: #0c1222;
    padding-top: 8px;
    padding-bottom: 8px;
}
tr.breakdown-row td.number {
    color: #b1c3e6;
}
.breakdown-label {
    padding-left: 16px;
    font-size: 13px;
}
.panel.narrow {
    max-width: 640px;
}
.fields label {
    margin-top: 14px;
}
.fields select,
.fields textarea {
    width: 100%;
    padding: 12px 14px;
    background: #0b1222;
    border: 1px solid #3b4967;
    border-radius: 9px;
    color: inherit;
    font: inherit;
}
.fields textarea {
    resize: vertical;
}
.fields button {
    margin-top: 18px;
}
.fields input[type="file"] {
    padding: 8px;
}
.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #7789ad;
}
.pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.button-link {
    background: #90aaff;
    color: #101931;
    border-radius: 9px;
    padding: 10px 16px;
    font-weight: 700;
    text-decoration: none;
    font-size: 14px;
}
.links {
    list-style: none;
    padding: 0;
    margin: 0;
}
.links li {
    padding: 12px 0;
    border-top: 1px solid #253049;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
}
.link-head {
    grid-column: 1 / -1;
}
.link-url {
    font-family: ui-monospace, monospace;
    font-size: 14px;
    padding: 8px 10px;
}
form.inline {
    display: inline;
}
.validation ul {
    margin: 6px 0 0;
}
@media (max-width: 600px) {
    .pair {
        grid-template-columns: 1fr;
    }
}

/* Narrow screens: grid children may not force the page wider than the viewport. */
.grid > .panel,
.pair > div {
    min-width: 0;
}
.fields input,
.fields select,
.fields textarea,
.link-url {
    max-width: 100%;
    min-width: 0;
}
.links li {
    grid-template-columns: minmax(0, 1fr) auto;
}
.badge {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* Long inline code such as CSV headers wraps instead of widening the page. */
code {
    overflow-wrap: anywhere;
}

/* --- Sessions ------------------------------------------------------------------------ */
table.sessions {
    min-width: 900px;
}
table.sessions th,
table.sessions td {
    padding: 12px 14px;
    font-size: 13px;
    white-space: nowrap;
}
table.sessions td.number {
    color: #edf1ff;
    font-size: 13px;
}
table.sessions .app-meta {
    margin-top: 2px;
}
.status-ended {
    background: #161f33;
    color: #8294b5;
}
table.timeline {
    min-width: 820px;
}
tr.outcome-clamped td {
    background: #2b2413;
}
tr.outcome-ignored td {
    background: #2b1a1f;
}
/* One payload per line: a timeline is read by scanning down the column, not by reading the JSON in full. */
code.payload {
    display: inline-block;
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: normal;
    vertical-align: bottom;
}
