:root {
    --bg: #f5f4ef;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --surface-muted: #eef2f7;
    --line: #d7dfeb;
    --line-strong: #c0cad8;
    --text: #17324d;
    --text-muted: #4e6376;
    --text-soft: #708497;
    --brand: #0f5ea6;
    --brand-strong: #083d73;
    --brand-wash: #e8f0f9;
    --success: #1d6a48;
    --success-wash: #e6f4ec;
    --warning: #8f6000;
    --warning-wash: #fff4d8;
    --danger: #a13a2c;
    --danger-wash: #fdebe7;
    --low: #33605a;
    --low-wash: #e8f2f0;
    --shadow: 0 18px 60px rgba(23, 50, 77, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --content-width: min(1240px, calc(100vw - 2rem));
}

* {
    box-sizing: border-box;
}

html {
    background: radial-gradient(circle at top left, #d7e5f5 0, rgba(215, 229, 245, 0.2) 28%, transparent 55%), var(--bg);
    color: var(--text);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.skip-link {
    position: absolute;
    top: -999px;
    left: 16px;
    z-index: 1000;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: var(--brand-strong);
    color: #fff;
}

.skip-link:focus {
    top: 12px;
}

.no-script {
    width: var(--content-width);
    margin: 3rem auto;
    padding: 2rem;
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.shell {
    width: var(--content-width);
    margin: 0 auto;
    padding: 1rem 0 4rem;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 1rem 0 1.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(215, 223, 235, 0.92);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 40px rgba(23, 50, 77, 0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.brand-mark {
    width: 2.8rem;
    height: 2.8rem;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #0f5ea6 0%, #2a7fbe 100%);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand-kicker,
.eyebrow,
.stat-label {
    display: block;
    color: var(--brand);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.78rem;
    font-weight: 700;
}

.brand-name {
    display: block;
    font-weight: 700;
    color: var(--text);
}

.topbar-nav,
.hero-actions,
.pill-row,
.toolbar,
.filter-chip-row,
.footer-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.topbar-nav {
    justify-content: flex-end;
}

.nav-link {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
}

.nav-link:hover,
.nav-link:focus-visible {
    background: var(--brand-wash);
    color: var(--brand-strong);
    outline: none;
}

.nav-link.is-active {
    background: var(--brand-strong);
    color: #fff;
}

.nav-link.is-locked::after {
    content: "Locked";
    margin-left: 0.45rem;
    font-size: 0.75rem;
    opacity: 0.75;
}

.page,
.section,
.review-list,
.kpi-stack,
.export-panel,
.field-row,
.workspace-grid,
.governed-grid,
.workspace-shell,
.workspace-item-list,
.workspace-note-grid,
.method-grid,
.metrics-grid,
.hero-grid,
.card-grid,
.service-grid,
.checklist-grid,
.detail-grid {
    display: grid;
    gap: 1rem;
}

.page-hero,
.panel,
.stat-card,
.service-card,
.review-card,
.detail-panel,
.governed-card,
.empty-state,
.error-state,
.loading-state {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.page-hero,
.panel,
.service-card,
.review-card,
.detail-panel,
.empty-state,
.error-state,
.loading-state {
    padding: 1.2rem;
}

.page-hero {
    padding: 1.75rem;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.98) 0%, rgba(242, 247, 253, 0.96) 60%, rgba(235, 242, 249, 0.95) 100%);
}

.hero-grid {
    grid-template-columns: 1.6fr 1fr;
    align-items: start;
}

.card-grid,
.workspace-grid,
.governed-grid,
.workspace-note-grid,
.method-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

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

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

.detail-grid {
    grid-template-columns: 300px minmax(0, 1fr) 400px;
    align-items: start;
}

.hero-title,
.section-title,
.detail-title,
.service-title {
    margin: 0;
    font-family: "IBM Plex Serif", Georgia, serif;
    letter-spacing: -0.03em;
    color: var(--text);
}

.hero-title {
    font-size: clamp(2.6rem, 4.7vw, 4.4rem);
    line-height: 0.98;
    max-width: 12ch;
}

.section-title {
    font-size: clamp(1.6rem, 2vw, 2.1rem);
}

.detail-title {
    font-size: 1.9rem;
}

.hero-copy,
.section-copy,
.meta-copy {
    color: var(--text-muted);
    line-height: 1.6;
}

.section-header {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: end;
    flex-wrap: wrap;
}

.button,
.button-secondary,
.button-quiet {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.82rem 1.15rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.button:hover,
.button-secondary:hover,
.button-quiet:hover,
.button:focus-visible,
.button-secondary:focus-visible,
.button-quiet:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.button {
    background: var(--brand-strong);
    color: #fff;
}

.button-secondary {
    background: #fff;
    border-color: var(--line-strong);
    color: var(--text);
}

.button-quiet {
    background: transparent;
    border-color: var(--line);
    color: var(--text-muted);
}

.mode-card,
.trust-card,
.governed-card,
.workspace-item-card,
.workspace-note-card,
.method-card,
.stat-card {
    padding: 1.2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--surface-strong);
}

.stat-value {
    font-size: clamp(1.9rem, 2.6vw, 2.8rem);
    font-weight: 700;
    color: var(--text);
}

.stat-note {
    margin: 0.55rem 0 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.34rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.chip.ga-ready { background: var(--success-wash); color: var(--success); }
.chip.advisory { background: #eef1f5; color: #43556a; }
.chip.preview { background: var(--warning-wash); color: var(--warning); }
.chip.deprecated,
.chip.high { background: var(--danger-wash); color: var(--danger); }
.chip.medium { background: var(--warning-wash); color: var(--warning); }
.chip.low { background: var(--low-wash); color: var(--low); }
.chip.public { background: var(--brand-wash); color: var(--brand-strong); }
.chip.governed { background: #eef1f5; color: #304559; }

.filter-panel,
.detail-panel {
    position: sticky;
    top: 6.2rem;
}

.filter-group {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.filter-group label,
.field-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.input,
.select,
.textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 0.82rem 0.9rem;
    background: #fff;
    color: var(--text);
    min-height: 46px;
}

.textarea {
    min-height: 150px;
    resize: vertical;
}

.review-card {
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.review-card:hover,
.review-card:focus-visible {
    border-color: var(--brand);
    transform: translateY(-2px);
    outline: none;
}

.review-card.is-selected {
    border-color: var(--brand-strong);
    box-shadow: 0 12px 32px rgba(15, 94, 166, 0.16);
}

.review-card.preview-item {
    border-style: dashed;
    background: linear-gradient(180deg, #fffdf7 0%, #ffffff 100%);
}

.detail-panel {
    display: grid;
    gap: 1rem;
}

.workspace-shell {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    align-items: start;
}

.workspace-sidebar {
    display: grid;
    gap: 1rem;
}

.workspace-item-list {
    gap: 0.9rem;
}

.workspace-item-card,
.workspace-note-card {
    display: grid;
    gap: 0.9rem;
}

.detail-block {
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
}

.detail-block h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.detail-list,
.copy-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.detail-list li + li,
.copy-list li + li {
    margin-top: 0.45rem;
}

.inline-link {
    color: var(--brand-strong);
    text-decoration: none;
}

.inline-link:hover,
.inline-link:focus-visible {
    text-decoration: underline;
    outline: none;
}

.toolbar {
    justify-content: space-between;
}

.export-panel {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--surface-muted);
}

.warning-callout,
.info-callout,
.locked-banner {
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    line-height: 1.55;
}

.warning-callout { border: 1px solid #efd08a; background: var(--warning-wash); color: #7a5400; }
.info-callout { border: 1px solid #bfd4ec; background: var(--brand-wash); color: var(--brand-strong); }
.locked-banner { border: 1px solid #d8dde8; background: #f5f7fa; color: #3b4d5d; }

.footer {
    margin-top: 2rem;
    padding: 1.4rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-note {
    color: var(--text-muted);
    max-width: 60ch;
}

.error-state,
.empty-state,
.loading-state {
    min-height: 260px;
    display: grid;
    place-items: center;
    text-align: center;
}

.loading-state::after {
    content: "";
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid var(--line);
    border-top-color: var(--brand);
    animation: spin 0.9s linear infinite;
    margin-top: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1080px) {
    .hero-grid,
    .workspace-shell,
    .detail-grid,
    .service-grid,
    .checklist-grid {
        grid-template-columns: 1fr;
    }

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

    .filter-panel,
    .detail-panel {
        position: static;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100vw - 1rem, 1240px);
    }

    .topbar {
        border-radius: 24px;
        align-items: start;
        flex-direction: column;
    }

    .topbar-nav {
        justify-content: flex-start;
    }

    .card-grid,
    .metrics-grid,
    .field-row,
    .workspace-grid,
    .governed-grid,
    .workspace-note-grid,
    .method-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        max-width: 100%;
    }
}
