:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --surface: #ffffff;
    --surface-soft: #f9fbfc;
    --text: #182230;
    --muted: #667085;
    --line: #d8dee5;
    --line-soft: #e8edf2;
    --accent: #1f6f78;
    --accent-dark: #17545b;
    --green-bg: #eaf7ef;
    --green: #207044;
    --blue-bg: #eaf2fb;
    --blue: #285f9f;
    --amber-bg: #fff5dd;
    --amber: #93610f;
    --red-bg: #fff0ef;
    --red: #a23a32;
    --gray-bg: #eef1f4;
    --gray: #5c6670;
    --shadow: 0 10px 25px rgba(20, 31, 43, 0.07);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand,
.app-brand a {
    color: var(--text);
    font-weight: 800;
    font-size: 20px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.nav a.active {
    color: var(--text);
    font-weight: 700;
}

.main {
    padding: 32px 0;
}

.app-body {
    background: #eef3f4;
}

.app-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.app-brand {
    border-bottom: 1px solid var(--line-soft);
    display: grid;
    gap: 2px;
    padding: 0 6px 16px;
}

.app-brand a:hover {
    text-decoration: none;
}

.app-brand span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.side-nav {
    display: grid;
    gap: 4px;
}

.side-nav p {
    color: #7a8591;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 14px 8px 4px;
    text-transform: uppercase;
}

.side-nav a {
    border-radius: 6px;
    color: #334155;
    font-weight: 700;
    padding: 8px 10px;
}

.side-nav a:hover {
    background: #f0f5f6;
    text-decoration: none;
}

.side-nav a.active {
    background: #e6f1f2;
    color: var(--accent-dark);
}

.sidebar-footer {
    border-top: 1px solid var(--line-soft);
    display: grid;
    gap: 8px;
    margin-top: auto;
    padding: 14px 6px 0;
}

.sidebar-footer span {
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.app-main {
    min-width: 0;
}

.app-topbar {
    align-items: center;
    background: rgba(245, 247, 248, 0.92);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.app-topbar h1 {
    font-size: 24px;
    line-height: 1.15;
    margin: 2px 0 0;
}

.topbar-context {
    color: var(--muted);
    display: grid;
    gap: 2px;
    justify-items: end;
}

.topbar-context strong {
    color: var(--text);
}

.app-content {
    display: grid;
    gap: 16px;
    padding: 20px 28px 32px;
}

.eyebrow {
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.page-intro,
.data-panel,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.page-intro {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
}

.page-intro h2,
.panel h1,
.panel h2,
.data-panel h3,
.panel-heading h3 {
    line-height: 1.2;
    margin: 0;
}

.page-intro p,
.data-panel p,
.panel p {
    color: var(--muted);
    margin: 6px 0 0;
}

.metric-strip {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-strip.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-strip article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 3px;
    min-height: 112px;
    padding: 14px 16px;
}

.metric-strip span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric-strip strong {
    color: var(--text);
    font-size: 30px;
    line-height: 1.05;
}

.metric-strip .metric-word {
    font-size: 20px;
    overflow-wrap: anywhere;
}

.metric-strip small,
.data-table small,
.mini-row span,
.panel-note,
.table-note {
    color: var(--muted);
}

.content-grid {
    display: grid;
    gap: 16px;
}

.content-grid.two-one {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}

.content-grid.halves {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.data-panel {
    min-width: 0;
    padding: 16px;
}

.panel-heading {
    align-items: start;
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: -2px 0 14px;
    padding-bottom: 12px;
}

.panel-heading.tight {
    margin-bottom: 10px;
}

.panel-heading a,
.panel-link {
    font-size: 13px;
    font-weight: 800;
}

.empty-state {
    background: var(--surface-soft);
    border: 1px dashed #cfd8df;
    border-radius: 8px;
    padding: 18px;
}

.empty-state.compact {
    padding: 14px;
}

.empty-state strong {
    display: block;
    margin-bottom: 4px;
}

.stat-list {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
}

.stat-list div {
    align-items: center;
    background: var(--surface-soft);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
}

.stat-list dt {
    color: var(--muted);
    font-weight: 700;
}

.stat-list dd {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
}

.mini-table {
    display: grid;
    gap: 8px;
}

.mini-row {
    align-items: center;
    border-bottom: 1px solid var(--line-soft);
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(120px, 1fr) 120px auto;
    padding: 8px 0;
}

.mini-row:last-child {
    border-bottom: 0;
}

.table-panel {
    overflow-x: auto;
    padding: 0;
}

.table-heading {
    margin: 0;
    padding: 14px 16px;
}

.data-table,
table {
    border-collapse: collapse;
    width: 100%;
    min-width: 900px;
}

.runs-table {
    min-width: 1120px;
}

th,
td {
    border-bottom: 1px solid var(--line-soft);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafb;
    color: #5e6975;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

td strong,
td small {
    display: block;
}

tr:last-child td {
    border-bottom: 0;
}

.status-chip,
.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 8px;
    white-space: nowrap;
}

.status-chip.ok,
.status-pill.ok {
    background: var(--green-bg);
    color: var(--green);
}

.status-chip.info,
.status-pill.info {
    background: var(--blue-bg);
    color: var(--blue);
}

.status-chip.bad,
.status-pill.bad {
    background: var(--red-bg);
    color: var(--red);
}

.status-chip.off,
.status-chip.muted,
.status-pill.off,
.status-pill.muted,
.status-pill {
    background: var(--gray-bg);
    color: var(--gray);
}

.plain-list {
    color: var(--muted);
    margin: 0;
    padding-left: 18px;
}

.plain-list li + li {
    margin-top: 8px;
}

.inline-form {
    display: inline;
    margin: 0;
}

button {
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 10px 14px;
}

button:hover {
    background: var(--accent-dark);
}

.link-button {
    background: transparent;
    color: var(--accent);
    padding: 0;
}

.link-button:hover {
    background: transparent;
    text-decoration: underline;
}

.narrow {
    max-width: 440px;
}

.stack {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
}

.alert,
.success,
.flash {
    border-radius: 6px;
    padding: 10px 12px;
}

.alert,
.flash.error {
    background: var(--red-bg);
    color: var(--red) !important;
}

.success,
.flash.success,
.flash.info {
    background: var(--green-bg);
    color: var(--green) !important;
}

.flash {
    margin: 0;
}

.details {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 8px 16px;
}

.details dt {
    color: var(--muted);
    font-weight: 800;
}

.details dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.empty {
    color: var(--muted);
    text-align: center;
}

code {
    background: var(--gray-bg);
    border-radius: 4px;
    padding: 2px 5px;
}

pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        height: auto;
        position: static;
    }

    .side-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .side-nav p {
        grid-column: 1 / -1;
    }

    .content-grid.two-one,
    .content-grid.halves,
    .metric-strip,
    .metric-strip.compact {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .header-inner,
    .app-topbar,
    .page-intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-content,
    .app-topbar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .topbar-context {
        justify-items: start;
    }

    .mini-row {
        grid-template-columns: 1fr;
    }

    .details {
        grid-template-columns: 1fr;
    }
}
