:root {
    color-scheme: light;
    --ink: #132621;
    --muted: #66746f;
    --subtle: #8a9691;
    --canvas: #f4f6f2;
    --surface: #ffffff;
    --line: #dde4df;
    --primary: #0d6b54;
    --primary-dark: #08513f;
    --primary-soft: #dff1e9;
    --warning: #aa6512;
    --warning-soft: #fff0d9;
    --danger: #b53b35;
    --danger-soft: #fde9e6;
    --info: #3864a5;
    --info-soft: #e7eefb;
    --shadow: 0 18px 45px rgba(24, 52, 44, 0.07);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 2% 0%, rgba(13, 107, 84, 0.09), transparent 28rem),
        var(--canvas);
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: inherit;
}

.topbar {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 12px clamp(20px, 4vw, 64px);
    border-bottom: 1px solid rgba(215, 224, 218, 0.92);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(145deg, #12866a, #075440);
    box-shadow: 0 8px 20px rgba(13, 107, 84, 0.22);
    font-size: 19px;
    font-weight: 800;
}

.brand > span:last-child {
    display: flex;
    flex-direction: column;
}

.brand strong {
    letter-spacing: -0.02em;
    font-size: 16px;
}

.brand small {
    color: var(--muted);
    font-size: 12px;
}

.topbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.refresh {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(20, 42, 35, 0.04);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.refresh:hover,
.refresh:focus-visible {
    border-color: #a9b9b2;
    background: #f9fbfa;
}

main {
    width: min(1500px, calc(100% - 40px));
    margin: 0 auto;
    padding: 42px 0 60px;
}

.hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 30px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 9px;
    letter-spacing: -0.045em;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.05;
}

h2 {
    margin-bottom: 0;
    letter-spacing: -0.025em;
    font-size: 20px;
    line-height: 1.2;
}

.hero-copy {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 16px;
}

.hero-copy strong {
    color: var(--ink);
}

.updated {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    padding-bottom: 4px;
}

.updated span {
    color: var(--subtle);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.updated strong {
    font-size: 14px;
}

.alert {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 22px;
    border: 1px solid #f4c9c4;
    border-radius: 15px;
    background: var(--danger-soft);
}

.alert span {
    color: #7e3834;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.metric-card,
.panel {
    border: 1px solid rgba(219, 227, 221, 0.95);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric-card {
    position: relative;
    min-height: 150px;
    overflow: hidden;
    padding: 23px;
    border-radius: 16px;
}

.metric-card::after {
    position: absolute;
    right: -34px;
    bottom: -46px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(13, 107, 84, 0.045);
    content: "";
}

.metric-card p {
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric-card strong {
    display: block;
    margin-bottom: 5px;
    letter-spacing: -0.045em;
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1;
}

.metric-card > span {
    color: var(--subtle);
    font-size: 12px;
}

.metric-primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(145deg, #13785f, #084f3e);
}

.metric-primary p,
.metric-primary > span {
    color: rgba(255, 255, 255, 0.74);
}

.metric-primary::after {
    background: rgba(255, 255, 255, 0.08);
}

.metric-warning strong {
    color: var(--warning);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
    gap: 16px;
}

.panel {
    min-width: 0;
    padding: 25px;
    border-radius: 18px;
}

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

.panel-wide {
    grid-column: 1;
    grid-row: 1;
}

.progress-panel {
    grid-column: 1;
    grid-row: 2;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.panel-stat,
.deployment-count {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
}

.panel-stat strong,
.deployment-count strong {
    letter-spacing: -0.04em;
    font-size: 24px;
    line-height: 1;
}

.panel-stat span,
.deployment-count span {
    margin-top: 5px;
    color: var(--subtle);
    font-size: 11px;
    text-transform: uppercase;
}

.volume-chart {
    display: flex;
    gap: 7px;
    align-items: stretch;
    height: 220px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 28px 3px 0;
    scrollbar-width: thin;
}

.volume-column {
    position: relative;
    display: flex;
    flex: 1 0 18px;
    min-width: 18px;
    flex-direction: column;
    align-items: center;
}

.volume-value {
    position: absolute;
    z-index: 2;
    top: -25px;
    display: none;
    padding: 3px 6px;
    border-radius: 6px;
    color: #fff;
    background: var(--ink);
    font-size: 10px;
    white-space: nowrap;
}

.volume-column:hover .volume-value {
    display: block;
}

.volume-track {
    position: relative;
    display: block;
    width: 100%;
    height: 170px;
    overflow: hidden;
    border-radius: 7px 7px 4px 4px;
    background: #eff3f0;
}

.volume-bar {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    border-radius: 7px 7px 4px 4px;
    background: linear-gradient(180deg, #36aa86, #0d6b54);
}

.volume-date {
    margin-top: 6px;
    color: var(--subtle);
    font-size: 9px;
}

.chart-caption {
    display: flex;
    justify-content: space-between;
    margin-top: 11px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--subtle);
    font-size: 11px;
}

.status {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    width: max-content;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.status > span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-success {
    color: var(--primary);
    background: var(--primary-soft);
}

.status-warning {
    color: var(--warning);
    background: var(--warning-soft);
}

.status-danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.status-info {
    color: var(--info);
    background: var(--info-soft);
}

.progress-summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 6px;
}

.progress-summary strong {
    letter-spacing: -0.04em;
    font-size: 34px;
}

.progress-summary span {
    color: var(--subtle);
    font-size: 12px;
}

.progress-track {
    height: 10px;
    margin: 12px 0 25px;
    overflow: hidden;
    border-radius: 999px;
    background: #e9eeeb;
}

.progress-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0d6b54, #37ae88);
}

.breakdown {
    margin: 0;
}

.breakdown > div {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.breakdown dt {
    color: var(--muted);
}

.breakdown dd {
    margin: 0;
    font-weight: 800;
}

.text-danger {
    color: var(--danger) !important;
}

.text-success {
    color: var(--primary) !important;
}

.panel-note {
    margin: 17px 0 0;
    padding-top: 15px;
    border-top: 1px solid var(--line);
    color: var(--subtle);
    font-size: 11px;
}

.deployment-panel {
    grid-column: 2;
    grid-row: 1;
}

.errors-panel {
    grid-column: 2;
    grid-row: 2;
}

.breakdown > div {
    gap: 16px;
}

.breakdown dd {
    flex-shrink: 0;
}

.deployment-count strong {
    color: var(--warning);
}

.checklist {
    display: flex;
    margin: 0;
    padding: 0;
    flex-direction: column;
    list-style: none;
}

.checklist li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 15px 0;
    border-top: 1px solid var(--line);
}

.checklist li:first-child {
    border-top: 0;
}

.check-icon {
    display: grid;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin-top: 1px;
    place-items: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 900;
}

.is-done .check-icon {
    color: var(--primary);
    background: var(--primary-soft);
}

.is-pending .check-icon {
    color: var(--warning);
    background: var(--warning-soft);
}

.checklist li > span:last-child {
    display: flex;
    flex-direction: column;
}

.checklist strong {
    font-size: 13px;
}

.checklist small {
    margin-top: 3px;
    color: var(--subtle);
    font-size: 11px;
    line-height: 1.4;
}

.database-meta {
    color: var(--subtle);
    font-size: 11px;
    white-space: nowrap;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

th,
td {
    padding: 13px 15px;
    border-top: 1px solid var(--line);
    text-align: right;
    white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
    text-align: left;
}

th {
    color: var(--subtle);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

td {
    font-size: 13px;
}

td:first-child strong,
td:first-child small {
    display: block;
}

td:first-child small {
    margin-top: 2px;
    color: var(--subtle);
    font-size: 10px;
}

.empty-row {
    padding: 30px;
    color: var(--subtle);
    text-align: center !important;
}

footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: min(1500px, calc(100% - 40px));
    margin: 0 auto;
    padding: 22px 0 34px;
    border-top: 1px solid var(--line);
    color: var(--subtle);
    font-size: 11px;
}

@media (max-width: 1120px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .deployment-panel,
    .errors-panel {
        grid-column: auto;
        grid-row: auto;
    }

    .panel-wide,
    .progress-panel {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 680px) {
    .topbar {
        min-height: 68px;
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .topbar-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .brand small,
    .topbar .status {
        display: none;
    }

    .refresh {
        min-height: 36px;
        padding: 0 12px;
    }

    main {
        width: min(100% - 28px, 1500px);
        padding-top: 30px;
    }

    .hero {
        align-items: flex-start;
        margin-bottom: 23px;
        flex-direction: column;
    }

    .updated {
        align-items: flex-start;
    }

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

    .metric-card {
        min-height: 134px;
    }

    .panel {
        padding: 20px;
        border-radius: 15px;
    }

    .panel-heading {
        margin-bottom: 20px;
    }

    .database-meta {
        display: none;
    }

    footer {
        width: min(100% - 28px, 1500px);
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}
