:root {
    --bg: #f2f1ec;
    --surface: #fcfbf8;
    --surface-alt: #f6f4ee;
    --panel: #121a22;
    --panel-soft: #1c2731;
    --text: #16202a;
    --muted: #68747f;
    --border: #d8ddd4;
    --border-strong: #bfc7bc;
    --accent: #0f766e;
    --accent-soft: #dff2ee;
    --warning: #b7791f;
    --warning-soft: #f9eed7;
    --danger: #9b2c2c;
    --danger-soft: #fde7e7;
    --foundation: #0f766e;
    --planned: #24567a;
    --candidate: #8c5a14;
    --read-only: #5c4b8a;
    --neutral: #64748b;
    --shadow: 0 24px 50px rgba(18, 26, 34, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --font-sans: "Aptos", "Segoe UI Variable", "Source Sans 3", "Helvetica Neue", sans-serif;
    --font-display: "Aptos Display", "Segoe UI Variable Display", "IBM Plex Sans", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: linear-gradient(180deg, #f7f5ef 0%, #efede6 100%);
    color: var(--text);
    font-family: var(--font-sans);
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

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

.sidebar {
    width: 332px;
    padding: 28px 22px;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 30%),
        linear-gradient(180deg, #111820 0%, #18212b 100%);
    color: #e7edf2;
    display: flex;
    flex-direction: column;
    gap: 26px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, #0f766e 0%, #184d65 100%);
    color: #f5fbfa;
}

.brand-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
}

.brand-subtitle,
.sidebar-footer p,
.section-eyebrow,
.small-label,
.stat-label,
.topbar-eyebrow {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    padding-right: 4px;
}

.nav-section {
    padding: 8px;
    border-radius: var(--radius-md);
    transition: background 0.2s ease;
}

.nav-section.is-active {
    background: rgba(255, 255, 255, 0.06);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    color: #f7fafc;
    font-weight: 600;
}

.nav-link:hover,
.nav-child:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nav-children {
    display: none;
    padding: 8px 0 0 46px;
    gap: 8px;
}

.nav-section.is-active .nav-children {
    display: grid;
}

.nav-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    color: #c9d3dc;
    font-size: 0.92rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer p:first-child {
    color: #edf2f7;
    margin-bottom: 8px;
}

.app-frame {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 30px 18px;
    background: rgba(252, 251, 248, 0.88);
    border-bottom: 1px solid rgba(191, 199, 188, 0.5);
    backdrop-filter: blur(14px);
}

.topbar-copy h1,
.hero-title,
.panel h3,
.section-card h4 {
    margin: 0;
    font-family: var(--font-display);
}

.topbar-copy h1 {
    font-size: 1.4rem;
    letter-spacing: -0.02em;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.app-content {
    padding: 28px 30px 44px;
    display: grid;
    gap: 24px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
    gap: 22px;
    align-items: stretch;
}

.hero-title {
    font-size: clamp(2rem, 3vw, 2.8rem);
    letter-spacing: -0.03em;
    margin-top: 4px;
}

.hero-text {
    margin: 14px 0 0;
    max-width: 68ch;
    line-height: 1.7;
    color: var(--muted);
    font-size: 1rem;
}

.hero-card,
.panel,
.stat-card,
.domain-card,
.section-card {
    background: rgba(252, 251, 248, 0.88);
    border: 1px solid rgba(191, 199, 188, 0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 22px;
    display: grid;
    gap: 14px;
    align-content: start;
    background:
        linear-gradient(145deg, rgba(15, 118, 110, 0.07), rgba(18, 26, 34, 0.02)),
        rgba(252, 251, 248, 0.96);
}

.hero-card-copy {
    margin: 0;
    line-height: 1.7;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    padding: 22px;
}

.stat-value {
    margin: 12px 0 8px;
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.stat-note,
.panel p,
.section-card p,
.stack-list li,
.foundation-table td,
.foundation-table th {
    color: var(--muted);
    line-height: 1.65;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.panel {
    padding: 22px;
}

.panel-table {
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel h3 {
    font-size: 1.16rem;
    letter-spacing: -0.02em;
}

.stack-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
}

.domain-grid,
.section-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.domain-card,
.section-card {
    padding: 20px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.domain-card:hover,
.section-card:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 118, 110, 0.45);
}

.domain-card-top,
.section-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.domain-card-top {
    justify-content: flex-start;
}

.domain-card-title {
    font-weight: 700;
    font-size: 1.02rem;
}

.domain-card-copy {
    margin: 0 0 16px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.small-label-spaced {
    margin-top: 8px;
}

.tag,
.pill,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.79rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tag,
.pill {
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
}

.badge-neutral {
    background: rgba(255, 255, 255, 0.1);
    color: #edf2f7;
}

.badge-foundation {
    background: var(--accent-soft);
    color: var(--foundation);
}

.badge-planned {
    background: rgba(36, 86, 122, 0.12);
    color: var(--planned);
}

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

.badge-read_only,
.badge-read-only {
    background: rgba(92, 75, 138, 0.12);
    color: var(--read-only);
}

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

.field {
    display: grid;
    gap: 8px;
}

.field span {
    font-weight: 700;
    color: var(--text);
}

.field input,
.field select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px 14px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.button {
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
}

.button-primary {
    background: linear-gradient(135deg, #0f766e 0%, #14516b 100%);
    color: #f3fbfa;
}

.button-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    background: rgba(15, 118, 110, 0.08);
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

.text-link {
    color: var(--accent);
    font-weight: 700;
}

.text-link:hover {
    text-decoration: underline;
}

.context-note {
    display: grid;
    grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
    gap: 20px;
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(15, 118, 110, 0.18);
    background: rgba(15, 118, 110, 0.08);
}

.callout-list {
    display: grid;
    gap: 12px;
}

.callout-list p {
    margin: 0;
    line-height: 1.7;
}

.table-wrap {
    overflow: auto;
}

.selector-form {
    display: grid;
    gap: 14px;
}

.section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.section-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid rgba(191, 199, 188, 0.7);
    background: rgba(252, 251, 248, 0.88);
    box-shadow: var(--shadow);
    font-weight: 700;
    color: var(--text);
}

.section-nav-link:hover {
    border-color: rgba(15, 118, 110, 0.4);
    color: var(--accent);
}

.section-card-foot {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(191, 199, 188, 0.55);
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.project-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.portfolio-stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.project-meta-card {
    padding: 20px;
    background: rgba(252, 251, 248, 0.9);
    border: 1px solid rgba(191, 199, 188, 0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.project-meta-card h3 {
    margin: 8px 0 6px;
    font-size: 1.18rem;
    letter-spacing: -0.02em;
}

.project-center-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
}

.split-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.status-list,
.metric-list,
.timeline-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.status-list li,
.metric-list li,
.timeline-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-alt);
    border: 1px solid rgba(191, 199, 188, 0.55);
}

.status-list li strong,
.metric-list li strong,
.timeline-list li strong {
    color: var(--text);
}

.metric-list li div p,
.timeline-list li div p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.timeline-list li {
    align-items: flex-start;
}

.timeline-bullet {
    width: 10px;
    height: 10px;
    margin-top: 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0f766e 0%, #184d65 100%);
    flex: 0 0 10px;
}

.empty-state {
    margin: 0;
    padding: 16px;
    border-radius: 14px;
    background: var(--surface-alt);
    border: 1px dashed var(--border-strong);
}

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

.foundation-table th,
.foundation-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(191, 199, 188, 0.55);
    text-align: left;
}

.foundation-table thead th {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    background: rgba(22, 32, 42, 0.03);
}

.compact-table th,
.compact-table td {
    white-space: nowrap;
    padding: 12px 14px;
}

.portfolio-table td {
    vertical-align: top;
}

.table-primary p,
.signal-stack small {
    margin: 4px 0 0;
    color: var(--muted);
    display: block;
}

.signal-stack {
    display: grid;
    gap: 6px;
}

.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.small-label {
    color: var(--muted);
}

.sidebar-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
}

@media (max-width: 1280px) {
    .stats-grid,
    .content-grid,
    .domain-grid,
    .section-card-grid,
    .project-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 40;
        width: min(88vw, 332px);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: inline-grid;
        place-items: center;
    }

    .hero,
    .stats-grid,
    .content-grid,
    .context-note,
    .domain-grid,
    .section-card-grid,
    .foundation-form,
    .project-meta-grid,
    .split-columns {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding-inline: 18px;
    }

    .app-content {
        padding: 20px 18px 32px;
    }
}
