:root {
    color-scheme: dark;
    --bg: #030404;
    --bg-soft: #070909;
    --surface: rgba(8, 10, 10, 0.92);
    --surface-strong: #0b0d0f;
    --surface-soft: #101417;
    --line: rgba(255, 255, 255, 0.13);
    --line-soft: rgba(255, 255, 255, 0.08);
    --ink: #f3f5f4;
    --muted: #8b9298;
    --muted-strong: #b8bec2;
    --blue: #2f7cff;
    --blue-soft: rgba(47, 124, 255, 0.16);
    --accent: #63d3ad;
    --accent-soft: rgba(99, 211, 173, 0.13);
    --danger: #ff6b7a;
    --danger-soft: rgba(255, 107, 122, 0.12);
    --warning: #e0b45a;
    --warning-soft: rgba(224, 180, 90, 0.13);
    --shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
    --mono: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--ink);
    background:
        radial-gradient(circle at 50% 0%, rgba(82, 173, 149, 0.14), transparent 32rem),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        var(--bg);
    background-size: auto, 96px 96px, 96px 96px, auto;
}

a {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 72px;
    padding: 0 42px;
    border-bottom: 1px solid var(--line);
    background: rgba(3, 4, 4, 0.86);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    color: var(--ink);
    font-size: 1.04rem;
    font-weight: 700;
    letter-spacing: 0;
}

.brand-mark {
    width: 40px;
    height: 24px;
    flex: 0 0 auto;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 24' fill='none'%3E%3Cpath d='M2 13H15L20 4L27 21L33 9L38 13H46' stroke='%232f7cff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    filter: drop-shadow(0 0 9px rgba(47, 124, 255, 0.42));
}

.nav-group {
    display: flex;
    align-items: stretch;
    gap: 4px;
    min-height: 72px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

.sidebar-note,
.environment-pill {
    margin-left: auto;
    padding: 6px 13px;
    border: 1px solid rgba(99, 211, 173, 0.35);
    border-radius: 999px;
    color: var(--accent);
    background: rgba(99, 211, 173, 0.055);
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.2;
}

.content {
    width: 100%;
    margin: 0;
    padding: 30px 42px 52px;
}

.topbar,
.hero,
.panel,
.table-panel,
.stats,
.filters-row {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 92px;
    padding: 20px 22px;
    border-radius: 8px 8px 0 0;
}

.crumb {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.84rem;
    text-transform: uppercase;
}

.crumb strong {
    display: block;
    margin-top: 8px;
    color: var(--ink);
    font-family: var(--sans);
    font-size: clamp(1.75rem, 3.5vw, 3.25rem);
    font-weight: 520;
    line-height: 0.98;
    text-transform: none;
}

.crumb span,
.panel-head p,
.table-head p,
.panel p {
    color: var(--muted);
}

.crumb span {
    display: block;
    max-width: 78ch;
    margin-top: 8px;
    overflow-wrap: anywhere;
    text-transform: none;
}

.top-actions,
.form-actions,
.action-row,
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button-link,
.submit,
.action-link,
.inline-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    background: #101214;
    font: inherit;
    font-weight: 620;
    text-decoration: none;
    cursor: pointer;
}

.button-link.primary,
.submit,
.inline-form button.run {
    border-color: #eff2f0;
    background: #eff2f0;
    color: #050606;
}

.button-link.secondary {
    color: var(--muted-strong);
}

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

.inline-form button.delete {
    color: var(--danger);
    border-color: rgba(255, 107, 122, 0.36);
    background: rgba(255, 107, 122, 0.055);
}

.inline-form button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.hero {
    position: relative;
    margin-top: -1px;
    padding: 26px 24px;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.dashboard-summary {
    padding: 18px 24px 24px;
}

.hero::before,
.panel::before {
    position: absolute;
    inset: 0;
    pointer-events: none;
    content: "";
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.18) 1px, transparent 1.7px),
        linear-gradient(135deg, transparent 0 46%, rgba(255, 255, 255, 0.1) 47% 53%, transparent 54% 100%);
    background-position: right 28px top 22px, left 18px bottom 16px;
    background-size: 22px 22px, 28px 28px;
    opacity: 0.12;
}

.hero > *,
.panel > * {
    position: relative;
    z-index: 1;
}

.eyebrow,
.stat-label,
th,
.detail-label {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.eyebrow {
    margin: 0 0 12px;
}

h1 {
    margin: 0;
    max-width: 1120px;
    font-size: clamp(2.7rem, 6vw, 5.7rem);
    font-weight: 500;
    letter-spacing: 0;
    line-height: 0.96;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0;
    margin-top: 18px;
    border-radius: 8px;
    overflow: hidden;
}

.dashboard-summary .stats {
    margin-top: 0;
}

.stat {
    min-height: 106px;
    padding: 20px 22px;
    border-right: 1px solid var(--line-soft);
    background: rgba(5, 6, 6, 0.64);
}

.stat:last-child {
    border-right: 0;
}

.stat-value {
    display: block;
    margin-top: 10px;
    color: var(--ink);
    font-family: var(--mono);
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    line-height: 1;
    overflow-wrap: anywhere;
}

.stat-value.danger {
    color: var(--danger);
}

.grid,
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.55fr);
    gap: 18px;
    margin-top: 18px;
    align-items: start;
}

.dashboard-grid {
    min-height: clamp(420px, calc(100vh - 540px), 720px);
    align-items: stretch;
}

.dashboard-grid .panel {
    display: flex;
    flex-direction: column;
}

.panel,
.table-panel {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.panel {
    padding: 22px;
}

.panel-head,
.table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.panel-head {
    margin-bottom: 18px;
}

.table-head {
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2,
.table-head h2,
.panel h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.08rem;
    font-weight: 560;
}

.panel-head p,
.table-head p,
.panel p {
    margin: 5px 0 0;
    line-height: 1.5;
}

.chart-shell {
    height: 315px;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--bg-soft);
}

.latency-chart {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.activity-panel .chart-shell {
    flex: 1;
    min-height: 315px;
    height: auto;
}

.legend-item,
.method-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 28px;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1;
    text-transform: lowercase;
}

.method-badge {
    color: var(--blue);
    background: var(--blue-soft);
    border-color: rgba(47, 124, 255, 0.35);
    text-transform: uppercase;
}

.status-pill.healthy,
.pill-healthy {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(99, 211, 173, 0.34);
}

.status-pill.failed,
.pill-failed {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(255, 107, 122, 0.34);
}

.status-pill.pending {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: rgba(224, 180, 90, 0.34);
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 11px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.78rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.dot-healthy {
    background: var(--accent);
}

.dot-failed {
    background: var(--danger);
}

.timeline-list,
.details-list {
    display: grid;
    gap: 10px;
}

.latest-runs-list {
    align-content: start;
    flex: 1;
}

.latest-runs-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.03);
    font-weight: 620;
    text-decoration: none;
}

.timeline-item,
.detail-row {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--surface-soft);
}

.timeline-item {
    grid-template-columns: 96px minmax(0, 1fr) auto;
    align-items: center;
}

.empty-run-item {
    display: block;
    min-height: 128px;
    padding: 18px 20px;
}

.empty-run-item .timeline-main strong,
.empty-run-item .timeline-main span {
    display: block;
}

.empty-run-item .timeline-main strong {
    margin-bottom: 8px;
}

.empty-run-item .timeline-main span {
    max-width: 18ch;
    line-height: 1.35;
}

.timeline-main strong,
.run-time strong,
.endpoint-cell strong,
.detail-value {
    color: var(--ink);
    font-weight: 560;
}

.timeline-main span,
.run-time span,
.endpoint-cell span,
.mini-note,
.disabled-note {
    color: var(--muted);
    font-size: 0.88rem;
}

.timeline-latency,
.detail-value,
td {
    font-family: var(--mono);
}

.table-panel {
    margin-top: 18px;
}

.filters-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 180px;
    gap: 12px;
    padding: 16px 22px;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
}

.field input:not([type="checkbox"]),
.field select,
.filters-row input,
.filters-row select {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #070909;
    font: inherit;
    outline: none;
}

.field input:focus,
.field select:focus,
.filters-row input:focus,
.filters-row select:focus {
    border-color: rgba(47, 124, 255, 0.68);
    box-shadow: 0 0 0 3px rgba(47, 124, 255, 0.13);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 18px;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.035);
}

.endpoint-cell span {
    display: block;
    max-width: 44ch;
    margin-top: 5px;
    overflow-wrap: anywhere;
}

.empty-row,
.empty-state,
.empty-graph {
    display: grid;
    min-height: 160px;
    place-items: center;
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.toggle-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #070909;
    cursor: pointer;
}

.toggle-field input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.toggle-field span {
    color: var(--muted-strong);
}

@media (max-width: 1080px) {
    .sidebar {
        flex-wrap: wrap;
        gap: 12px 18px;
        padding: 14px 20px;
    }

    .nav-group {
        order: 3;
        width: 100%;
        min-height: 42px;
        overflow-x: auto;
    }

    .nav-link {
        min-height: 42px;
        white-space: nowrap;
    }

    .content {
        padding: 20px 16px 38px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-summary .stats {
        margin-top: 0;
    }

    .grid,
    .layout {
        grid-template-columns: 1fr;
    }

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

    table {
        min-width: 900px;
    }

    .filters-row,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .timeline-item {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .sidebar-note,
    .environment-pill {
        margin-left: 0;
    }

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

    .stat {
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
    }

    .stat:last-child {
        border-bottom: 0;
    }

    h1 {
        font-size: 2.65rem;
    }
}
