:root {
    color-scheme: light;
    --ink: #101b39;
    --muted: #687287;
    --blue: #183aa8;
    --blue-dark: #102c89;
    --green: #1b654c;
    --green-soft: #e8f4ef;
    --red: #b8403c;
    --red-soft: #fceceb;
    --amber: #ad6a14;
    --amber-soft: #fff6e7;
    --line: #dfe4e1;
    --surface: #ffffff;
    --canvas: #f4f6f2;
    --shadow: 0 18px 45px rgba(25, 42, 65, 0.08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.55;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

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

h1,
h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
    letter-spacing: -0.035em;
}

h1 {
    margin-bottom: 0.35rem;
    font-size: clamp(2.5rem, 5vw, 4.25rem);
    line-height: 1.05;
}

h2 {
    margin-bottom: 0.45rem;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.12;
}

h3 {
    margin-bottom: 0.3rem;
    font-size: 1.05rem;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 2rem;
    min-height: 78px;
    padding: 0.75rem clamp(1rem, 4vw, 4rem);
    border-bottom: 1px solid rgba(16, 27, 57, 0.08);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: max-content;
    text-decoration: none;
}

.brand-mark,
.login-mark {
    display: grid;
    place-items: center;
    width: 48px;
    aspect-ratio: 1;
    border-radius: 14px;
    background: var(--blue);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 0.92rem;
    letter-spacing: 0.02em;
}

.brand small {
    color: var(--muted);
    font-size: 0.78rem;
}

.topbar nav {
    display: flex;
    gap: 0.4rem;
}

.topbar nav a {
    padding: 0.65rem 0.85rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
}

.topbar nav a:hover,
.topbar nav a.active {
    background: #edf1fb;
    color: var(--blue);
}

.topbar form {
    justify-self: end;
}

.content {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4.5rem) clamp(1rem, 3.5vw, 3.25rem) 5rem;
}

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.page-heading > div:first-child > p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.1rem;
}

.eyebrow {
    margin-bottom: 0.65rem;
    color: var(--green);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.period-control {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    min-width: 380px;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 25px rgba(25, 42, 65, 0.04);
}

.period-control strong {
    padding: 0.4rem 0.65rem;
    border-radius: 10px;
    background: #f4f4f1;
}

.period-control span {
    color: var(--muted);
    font-size: 0.9rem;
}

.gate-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid #edd3ad;
    border-radius: 24px;
    background: var(--amber-soft);
    box-shadow: var(--shadow);
}

.gate-card.gate-open {
    border-color: #bcdacb;
    background: var(--green-soft);
}

.score-ring {
    display: grid;
    grid-template-columns: auto auto;
    place-content: center;
    align-items: baseline;
    width: 112px;
    aspect-ratio: 1;
    border: 10px solid rgba(173, 106, 20, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.66);
    color: var(--amber);
}

.gate-open .score-ring {
    border-color: rgba(27, 101, 76, 0.13);
    color: var(--green);
}

.score-ring strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.55rem;
    font-weight: 500;
}

.score-ring span {
    font-size: 0.73rem;
}

.gate-summary h2 {
    font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.gate-summary p:last-child {
    max-width: 900px;
    margin-bottom: 0;
    color: var(--muted);
}

.status-pill {
    padding: 0.7rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    color: #815019;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
}

.gate-open .status-pill {
    color: var(--green);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(360px, 0.9fr);
    gap: 1.5rem;
}

.panel,
.state-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel {
    padding: clamp(1.25rem, 2.4vw, 2rem);
}

.readiness-panel {
    grid-row: span 2;
}

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

.panel-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel-heading h2 {
    margin-bottom: 0;
}

.panel-meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 -2rem -2rem;
    border-top: 1px solid var(--line);
}

.check-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.9rem;
    min-height: 160px;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--line);
}

.check-item:nth-child(odd) {
    border-right: 1px solid var(--line);
}

.check-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 800;
}

.check-icon.pass {
    background: var(--green-soft);
    color: var(--green);
}

.check-icon.fail {
    background: var(--red-soft);
    color: var(--red);
}

.check-title {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.check-title span {
    color: #949b96;
    font-size: 0.75rem;
    white-space: nowrap;
}

.check-item p,
.empty-state {
    margin-bottom: 0;
    color: #747d78;
    font-size: 0.94rem;
}

.source-list,
.run-list {
    display: grid;
    gap: 0;
}

.source-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.95rem 0;
    border-top: 1px solid var(--line);
}

.source-row small,
.source-row strong {
    display: block;
}

.source-row small {
    color: var(--muted);
    font-size: 0.75rem;
}

.source-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #a9afab;
}

.source-dot.active,
.source-dot.complete {
    background: #31a778;
}

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

.source-dot.running {
    background: #f0a536;
}

.source-stat {
    text-align: right;
}

.definition-list {
    margin: 0;
}

.definition-list > div {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 1rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--line);
}

.definition-list dt {
    color: var(--muted);
    font-size: 0.8rem;
}

.definition-list dd {
    margin: 0;
    font-weight: 650;
}

.subheading {
    margin-top: 1.5rem;
}

.run-list > div {
    display: grid;
    grid-template-columns: auto 110px 1fr;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--line);
}

.run-list small {
    grid-column: 2 / -1;
    margin-top: -0.5rem;
    color: var(--muted);
}

.change-table article {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 180px 150px;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--line);
}

.change-table article div span,
.change-table article div strong {
    display: block;
}

.change-table article div span,
.change-table article > span,
.change-table time {
    color: var(--muted);
    font-size: 0.83rem;
}

.change-table code {
    overflow: hidden;
    text-overflow: ellipsis;
}

.generated-at {
    margin: 1.25rem 0 0;
    color: var(--muted);
    font-size: 0.76rem;
    text-align: right;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.75rem 1.2rem;
    border: 1px solid var(--blue);
    border-radius: 12px;
    background: var(--blue);
    color: #fff;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

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

.button-secondary {
    border-color: #cbd4e9;
    background: #fff;
    color: var(--blue);
}

.button-secondary:hover {
    background: #edf1fb;
}

.button-compact {
    min-height: 40px;
    padding: 0.5rem 0.9rem;
    font-size: 0.84rem;
}

.button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.state-card {
    padding: clamp(2rem, 5vw, 4rem);
}

.state-card-error {
    border-color: #e9bcb9;
}

.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    background:
        radial-gradient(circle at top left, rgba(24, 58, 168, 0.11), transparent 36%),
        linear-gradient(145deg, #f5f7fb, #eef2f8);
}

.login-card {
    width: min(620px, 100%);
    padding: clamp(2rem, 7vw, 5.5rem);
    border: 1px solid #d7deec;
    border-radius: 32px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(27, 43, 81, 0.14);
}

.login-mark {
    width: 64px;
    margin-bottom: 2.5rem;
    border-radius: 18px;
    font-size: 1.15rem;
}

.login-card h1 {
    font-size: clamp(2.5rem, 6vw, 3.7rem);
}

.login-card > p:not(.eyebrow) {
    color: var(--muted);
    font-size: 1.05rem;
}

.login-form {
    display: grid;
    gap: 0.75rem;
    margin-top: 2rem;
}

.login-form label {
    font-weight: 750;
}

.login-form input {
    min-height: 60px;
    padding: 0.8rem 1rem;
    border: 2px solid #c3cee4;
    border-radius: 14px;
    font-size: 1.1rem;
}

.login-form input:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(24, 58, 168, 0.12);
}

.login-form .button {
    margin-top: 0.45rem;
    min-height: 58px;
    font-size: 1.05rem;
}

.login-error {
    margin: 1.5rem 0 0;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: var(--red-soft);
    color: #822f2c;
}

h1:focus {
    outline: none;
}

@media (max-width: 1050px) {
    .topbar {
        grid-template-columns: 1fr auto;
    }

    .topbar nav {
        display: none;
    }

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

    .readiness-panel {
        grid-row: auto;
    }

    .wide-panel {
        grid-column: auto;
    }
}

@media (max-width: 760px) {
    .brand span:last-child {
        display: none;
    }

    .content {
        padding-top: 2rem;
    }

    .page-heading {
        display: block;
    }

    .period-control {
        min-width: 0;
        margin-top: 1.5rem;
        gap: 1rem;
    }

    .gate-card {
        grid-template-columns: auto 1fr;
        gap: 1rem;
    }

    .score-ring {
        width: 86px;
    }

    .score-ring strong {
        font-size: 2rem;
    }

    .status-pill {
        grid-column: 1 / -1;
        width: max-content;
    }

    .check-grid {
        grid-template-columns: 1fr;
        margin: 0 -1.25rem -1.25rem;
    }

    .check-item {
        min-height: 0;
        padding: 1.25rem;
    }

    .check-item:nth-child(odd) {
        border-right: 0;
    }

    .change-table article {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}
