:root {
    --paper: #fafaf9;
    --paper-2: #f1f0ec;
    --card: #ffffff;
    --ink: #1a1a17;
    --ink-70: #4a473f;
    --ink-55: #6b675e;
    --ink-40: #8a857a;
    --ink-25: #b5b0a5;
    --hair: #eceae5;
    --accent: #111110;
    --brand-navy: #15154a;
    --positive: #357a38;
    --positive-soft: #e5f3e2;
    --attention: #9a6e10;
    --attention-soft: #faf0d9;
    --critical: #b0472e;
    --critical-soft: #fae6df;
    --e-card:
        0 1px 2px rgba(26, 26, 23, 0.04), 0 8px 24px -16px rgba(26, 26, 23, 0.1);
    --e-lift:
        0 2px 4px rgba(26, 26, 23, 0.05),
        0 16px 32px -16px rgba(26, 26, 23, 0.14);
    --e-pop:
        0 4px 12px -2px rgba(26, 26, 23, 0.08),
        0 20px 48px -12px rgba(26, 26, 23, 0.18);
    --font:
        'Neue Haas Grotesk Text Pro', 'Helvetica Neue', Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
.file-button {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
.file-button:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

.topbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1440px;
    padding: 28px 48px 16px;
}

.wordmark {
    color: var(--brand-navy);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 31px;
    font-style: italic;
    font-weight: 700;
    letter-spacing: -0.06em;
    line-height: 1;
    text-decoration: none;
}

.topbar-meta {
    align-items: center;
    color: var(--ink-40);
    display: flex;
    font-size: 11px;
    font-weight: 600;
    gap: 12px;
}

.confidential {
    background: var(--paper-2);
    border-radius: 999px;
    color: var(--ink-55);
    letter-spacing: 0.08em;
    padding: 5px 10px;
    text-transform: uppercase;
}

main {
    margin: 0 auto;
    max-width: 1440px;
    padding: 48px 48px 64px;
}

.hero {
    align-items: end;
    display: grid;
    gap: 40px;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.76fr);
    padding: 56px 0 48px;
}

.eyebrow {
    color: var(--ink-40);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.11em;
    margin: 0;
    text-transform: uppercase;
}

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

h1 {
    font-size: clamp(48px, 6.4vw, 92px);
    font-weight: 720;
    letter-spacing: -0.065em;
    line-height: 0.92;
    margin: 18px 0 26px;
    max-width: 900px;
}

.hero-lead {
    color: var(--ink-55);
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 0;
    max-width: 620px;
}

.hero-actions {
    align-content: end;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.button {
    align-items: center;
    background: var(--card);
    border: 0;
    border-radius: 10px;
    box-shadow: var(--e-card);
    color: var(--ink-70);
    cursor: pointer;
    display: inline-flex;
    font-size: 12px;
    font-weight: 650;
    gap: 7px;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    text-decoration: none;
    transition:
        background 150ms ease,
        box-shadow 150ms ease,
        color 150ms ease,
        transform 150ms ease;
}

.button:hover {
    box-shadow: var(--e-lift);
    color: var(--ink);
    transform: translateY(-1px);
}

.button-primary,
.button-primary.is-active {
    background: var(--accent);
    color: white;
}

.button-primary:hover {
    background: #2a2822;
    color: white;
}

.button-icon {
    font-size: 16px;
    line-height: 1;
}

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

.metric-card,
.card {
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--e-card);
}

.metric-card {
    display: flex;
    flex-direction: column;
    min-height: 168px;
    padding: 22px 24px;
}

.metric-topline {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.meaning-dot {
    background: var(--ink-25);
    border-radius: 50%;
    display: inline-block;
    flex: none;
    height: 7px;
    width: 7px;
}

.meaning-dot.positive {
    background: var(--positive);
    box-shadow: 0 0 0 4px var(--positive-soft);
}

.meaning-dot.attention {
    background: var(--attention);
    box-shadow: 0 0 0 4px var(--attention-soft);
}

.meaning-dot.critical {
    background: var(--critical);
    box-shadow: 0 0 0 4px var(--critical-soft);
}

.metric-value {
    font-size: 48px;
    font-weight: 580;
    letter-spacing: -0.055em;
    line-height: 1;
    margin: auto 0 8px;
}

.metric-context {
    color: var(--ink-40);
    font-size: 11px;
    line-height: 1.35;
}

.comparison-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
    margin-bottom: 16px;
}

.card {
    padding: 28px;
}

.card-heading,
.module-head {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
}

h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 8px 0 0;
}

.date-range,
.micro-copy {
    color: var(--ink-40);
    font-size: 11px;
    font-weight: 600;
}

.insight-lead {
    font-size: 26px;
    font-weight: 620;
    letter-spacing: -0.035em;
    line-height: 1.16;
    margin: 40px 0 10px;
    max-width: 590px;
}

.insight-copy,
.section-copy {
    color: var(--ink-55);
    font-size: 12.5px;
    line-height: 1.5;
    margin-bottom: 0;
}

.change-list {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 32px;
}

.change-item {
    align-items: center;
    background: var(--paper);
    border-radius: 12px;
    display: grid;
    gap: 12px;
    grid-template-columns: auto auto 1fr;
    padding: 13px 14px;
}

.change-id,
.module-id {
    color: var(--ink-40);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.change-item strong,
.change-item span {
    display: block;
}

.change-item strong {
    font-size: 12px;
    font-weight: 650;
}

.change-item div span {
    color: var(--ink-40);
    font-size: 10.5px;
    margin-top: 3px;
}

.status-bars {
    display: grid;
    gap: 17px;
    margin-top: 36px;
}

.status-bar-row {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 102px 1fr 22px;
}

.status-bar-label {
    align-items: center;
    color: var(--ink-55);
    display: flex;
    font-size: 11px;
    gap: 9px;
}

.status-bar-track {
    background: var(--paper-2);
    border-radius: 999px;
    height: 7px;
    overflow: hidden;
}

.status-bar-fill {
    background: var(--ink-25);
    border-radius: inherit;
    display: block;
    height: 100%;
    transition: width 450ms cubic-bezier(0.2, 0.7, 0.25, 1);
}

.status-bar-fill.positive {
    background: var(--positive);
}

.status-bar-fill.attention {
    background: var(--attention);
}

.status-bar-row strong {
    font-size: 12px;
    font-weight: 650;
    text-align: right;
}

.module-card {
    padding: 28px 0 8px;
}

.module-head {
    gap: 32px;
    padding: 0 28px 24px;
}

.module-head .section-copy {
    margin-top: 8px;
}

.module-tools {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.search-field {
    align-items: center;
    background: var(--paper-2);
    border-radius: 10px;
    display: flex;
    gap: 8px;
    padding: 0 11px;
}

.search-field svg {
    fill: none;
    height: 15px;
    stroke: var(--ink-40);
    stroke-width: 1.8;
    width: 15px;
}

.search-field input,
.module-tools select,
.phase-input,
.note-field input,
.status-select select {
    background: var(--paper-2);
    border: 0;
    border-radius: 10px;
    color: var(--ink);
    font-size: 11.5px;
    min-height: 38px;
    outline: 0;
}

.search-field input {
    background: transparent;
    min-width: 170px;
}

.module-tools select {
    cursor: pointer;
    min-width: 130px;
    padding: 0 32px 0 12px;
}

.segmented-button,
.text-button {
    background: transparent;
    border: 0;
    color: var(--ink-55);
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 650;
}

.segmented-button {
    border-radius: 999px;
    min-height: 38px;
    padding: 0 13px;
}

.segmented-button:hover,
.segmented-button[aria-pressed='true'] {
    background: var(--paper-2);
    color: var(--ink);
}

.edit-banner {
    align-items: center;
    background: var(--paper-2);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    margin: 0 28px 16px;
    padding: 13px 15px;
}

.edit-banner[hidden] {
    display: none;
}

.edit-banner strong,
.edit-banner span {
    display: block;
}

.edit-banner strong {
    font-size: 12px;
}

.edit-banner span {
    color: var(--ink-40);
    font-size: 10.5px;
    margin-top: 2px;
}

.edit-banner-actions {
    display: flex;
    gap: 14px;
}

.text-button:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.text-button.danger {
    color: var(--critical);
}

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

table {
    border-collapse: collapse;
    min-width: 920px;
    width: 100%;
}

th {
    color: var(--ink-40);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 11px 16px;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

th:first-child,
td:first-child {
    padding-left: 28px;
}

th:last-child,
td:last-child {
    padding-right: 28px;
}

td {
    border-top: 1px solid var(--hair);
    font-size: 12px;
    padding: 16px;
    vertical-align: middle;
}

tbody tr {
    transition: background 140ms ease;
}

tbody tr:hover {
    background: rgba(26, 26, 23, 0.025);
}

tbody tr.is-changed {
    box-shadow: inset 3px 0 0 var(--positive);
}

.module-cell {
    align-items: flex-start;
    display: grid;
    gap: 14px;
    grid-template-columns: 29px minmax(230px, 1fr);
    max-width: 580px;
}

.module-cell strong,
.module-cell span,
.module-cell em {
    display: block;
}

.module-cell strong {
    font-size: 12.5px;
    font-weight: 650;
}

.module-cell div > span {
    color: var(--ink-40);
    font-size: 10.5px;
    line-height: 1.45;
    margin-top: 4px;
}

.module-cell em {
    color: var(--ink-70);
    font-size: 10.5px;
    font-style: normal;
    font-weight: 600;
    margin-top: 7px;
}

.status-pill,
.phase-label,
.area-label {
    display: inline-flex;
    white-space: nowrap;
}

.status-pill {
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 650;
    padding: 4px 9px;
}

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

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

.status-pill.neutral {
    background: var(--paper-2);
    color: var(--ink-55);
}

.change-column {
    padding-left: 5px;
    padding-right: 5px;
    text-align: center;
    width: 38px;
}

.change-arrow {
    color: var(--ink-25);
    font-size: 16px;
}

.change-arrow.active {
    color: var(--positive);
}

.phase-label,
.area-label {
    color: var(--ink-55);
    font-size: 10.5px;
    font-weight: 600;
}

.status-select {
    border-radius: 999px;
    display: inline-flex;
}

.status-select select {
    cursor: pointer;
    min-height: 30px;
    padding: 0 8px;
}

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

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

.phase-input {
    max-width: 90px;
    min-height: 30px;
    padding: 0 8px;
}

.note-field {
    display: block;
    margin-top: 8px;
}

.note-field input {
    min-height: 32px;
    padding: 0 9px;
    width: min(100%, 420px);
}

.empty-state {
    color: var(--ink-40);
    font-size: 12px;
    margin: 0;
    padding: 48px 28px 56px;
    text-align: center;
}

.source-note {
    align-items: center;
    color: var(--ink-40);
    display: flex;
    font-size: 10.5px;
    justify-content: space-between;
    padding: 24px 4px 0;
}

.source-note p {
    margin: 0;
}

.source-note strong {
    color: var(--ink-55);
}

.toast {
    background: var(--ink);
    border-radius: 999px;
    bottom: 28px;
    box-shadow: var(--e-pop);
    color: white;
    font-size: 11.5px;
    font-weight: 650;
    left: 50%;
    padding: 11px 16px;
    position: fixed;
    transform: translateX(-50%);
    z-index: 100;
}

.toast[hidden] {
    display: none;
}

.sr-only {
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.reveal {
    animation: reveal 500ms cubic-bezier(0.2, 0.7, 0.25, 1) both;
    animation-delay: var(--delay);
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1050px) {
    .hero {
        align-items: start;
        grid-template-columns: 1fr;
    }

    .hero-actions {
        justify-content: flex-start;
    }

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

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

    .module-head {
        display: block;
    }

    .module-tools {
        justify-content: flex-start;
        margin-top: 20px;
    }
}

@media (max-width: 680px) {
    .topbar {
        padding: 22px 20px 8px;
    }

    .topbar-meta > span:last-child {
        display: none;
    }

    main {
        padding: 24px 16px 48px;
    }

    .hero {
        gap: 28px;
        padding: 42px 4px 36px;
    }

    h1 {
        font-size: 52px;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .metric-card {
        min-height: 146px;
        padding: 18px;
    }

    .metric-value {
        font-size: 40px;
    }

    .card {
        padding: 22px;
    }

    .card-heading {
        display: block;
    }

    .date-range,
    .micro-copy {
        display: block;
        margin-top: 8px;
    }

    .change-list {
        grid-template-columns: 1fr;
    }

    .module-card {
        padding-left: 0;
        padding-right: 0;
    }

    .module-head {
        padding: 0 22px 20px;
    }

    .module-tools {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .search-field input,
    .module-tools select,
    .segmented-button {
        width: 100%;
    }

    .edit-banner {
        align-items: flex-start;
        display: grid;
        gap: 12px;
        margin-left: 22px;
        margin-right: 22px;
    }

    .edit-banner-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .source-note {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
        padding-left: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .hero-actions,
    .module-tools,
    .edit-banner,
    .source-note button {
        display: none !important;
    }

    body {
        background: white;
    }

    .topbar,
    main {
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    .metric-card,
    .card {
        box-shadow: inset 0 0 0 1px var(--hair);
    }

    .table-wrap {
        overflow: visible;
    }

    table {
        min-width: 0;
    }
}
