:root {
    --brand: #0b74de;
    --brand-dark: #075cb5;
    --brand-soft: #e8f3ff;
    --surface-page: #f5f7fa;
    --surface-card: #ffffff;
    --text: #172033;
    --text-muted: #5d6a7e;
    --border: #dde3ec;
    --success: #168a45;
    --warning: #b86a00;
    --danger: #d92d20;
    --sidebar: #10213c;
    --radius-sm: 8px;
    --radius: 12px;
    --shadow: 0 8px 30px rgba(23, 32, 51, .07);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--surface-page);
}

* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--surface-page); }
button, input { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(11, 116, 222, .35); outline-offset: 2px; }
.skip-link { position: fixed; z-index: 100; left: 1rem; top: -5rem; padding: .75rem 1rem; background: white; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1.5rem 1rem; color: #dce7f6; background: var(--sidebar); }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; margin: 0 .5rem 2rem; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: white; background: linear-gradient(145deg, #1594ee, #0b5fb7); font-weight: 800; font-size: 1.35rem; }
.brand strong, .brand small { display: block; }
.brand strong { color: white; font-size: 1.12rem; }
.brand small { color: #94a9c7; letter-spacing: .08em; text-transform: uppercase; font-size: .67rem; margin-top: .1rem; }
.navigation a { display: flex; align-items: center; gap: .65rem; min-height: 42px; padding: .55rem .75rem; border-radius: var(--radius-sm); text-decoration: none; color: #bed0e7; font-size: .89rem; }
.navigation a:hover, .navigation a.is-active { color: white; background: rgba(255, 255, 255, .09); }
.navigation a.is-active { box-shadow: inset 3px 0 0 #3ba6ff; }
.nav-home { margin-bottom: 1.25rem; font-weight: 700; }
.nav-group { margin: 1.25rem 0; }
.nav-group h2 { margin: 0 .75rem .45rem; color: #758ba9; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; }
.nav-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #6e89aa; }
.workspace { min-width: 0; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: .8rem 2rem; background: white; border-bottom: 1px solid var(--border); }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; }
.company-context span, .company-context strong, .user-menu strong, .user-menu small { display: block; }
.company-context span, .user-menu small { color: var(--text-muted); font-size: .75rem; }
.user-menu { display: flex; align-items: center; gap: .75rem; }
.company-switcher { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; }
.company-switcher select, .selection-card select { min-height: 42px; max-width: 260px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 2.2rem 0 .75rem; color: var(--text); background: white; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--brand-dark); background: var(--brand-soft); font-weight: 800; }
.content { max-width: 1480px; margin: 0 auto; padding: 2rem; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.5rem; }
.eyebrow { margin: 0 0 .35rem; color: var(--brand-dark); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.7rem, 2vw, 2.25rem); }
h2 { font-size: 1.15rem; }
p { color: var(--text-muted); line-height: 1.6; }
.status-badge { display: inline-flex; align-items: center; width: fit-content; padding: .35rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.status-foundation { color: #075f32; background: #dcf7e9; }
.status-planned { color: #8a4e00; background: #fff0d5; }
.welcome-card, .section-card, .info-card, .module-hero { border: 1px solid var(--border); background: var(--surface-card); border-radius: var(--radius); box-shadow: var(--shadow); }
.welcome-card { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: clamp(1.5rem, 4vw, 3rem); background: linear-gradient(130deg, white 40%, #eaf4ff); }
.welcome-card h2 { max-width: 700px; font-size: clamp(1.5rem, 3vw, 2.4rem); margin-bottom: .75rem; }
.welcome-card p { max-width: 680px; margin-bottom: 0; }
.foundation-symbol { display: grid; place-items: center; width: 120px; height: 120px; flex: 0 0 auto; border-radius: 32px; background: var(--brand); color: white; font-size: 4rem; font-weight: 900; box-shadow: 0 18px 40px rgba(11, 116, 222, .25); }
.foundation-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1rem 0; }
.info-card { padding: 1.25rem; }
.info-card h2 { margin: 1rem 0 .4rem; }
.info-card p { margin: 0; font-size: .9rem; }
.card-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--brand-dark); background: var(--brand-soft); font-size: .75rem; font-weight: 900; }
.section-card { padding: 1.5rem; }
.module-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.module-summary div { padding: 1rem; background: var(--surface-page); border-radius: var(--radius-sm); }
.module-summary strong, .module-summary span { display: block; }
.module-summary span { color: var(--text-muted); margin-top: .25rem; font-size: .82rem; }
.module-hero { display: flex; align-items: center; gap: 1.5rem; padding: clamp(1.5rem, 4vw, 2.5rem); }
.module-hero h2 { margin: .85rem 0 .35rem; font-size: 1.8rem; }
.module-hero p { margin-bottom: 0; }
.module-icon { display: grid; place-items: center; width: 86px; height: 86px; flex: 0 0 auto; border-radius: 24px; color: var(--brand); background: var(--brand-soft); font-size: 2rem; font-weight: 900; }
.institutional-copy { margin-top: 1rem; }
.institutional-copy p:last-child { margin-bottom: 0; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-sm); padding: .65rem 1rem; cursor: pointer; font-weight: 750; }
.button-primary { color: white; background: var(--brand); }
.button-primary:hover { background: var(--brand-dark); }
.button-quiet { color: var(--text-muted); background: white; border-color: var(--border); }
.button-full { width: 100%; }
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1.05fr) minmax(420px, .95fr); }
.auth-intro { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(2rem, 7vw, 6rem); color: white; background: radial-gradient(circle at top right, #147ddb, transparent 40%), #10213c; }
.auth-intro h1 { max-width: 680px; font-size: clamp(2.5rem, 6vw, 5rem); }
.auth-intro p { max-width: 620px; color: #bed0e7; font-size: 1.1rem; }
.brand-light { margin-left: 0; }
.auth-panel { display: grid; place-items: center; padding: 2rem; background: white; }
.auth-card { width: min(100%, 430px); }
.auth-card header { margin-bottom: 2rem; }
.auth-card h2 { font-size: 1.8rem; margin-bottom: .45rem; }
.field { margin-bottom: 1.15rem; }
.field label { display: block; margin-bottom: .45rem; font-size: .88rem; font-weight: 750; }
.field input { width: 100%; height: 48px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 .85rem; color: var(--text); background: white; }
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); outline: 0; }
.field.has-error input { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .8rem; margin: .35rem 0 0; }
.alert { border-radius: var(--radius-sm); padding: .85rem 1rem; margin-bottom: 1rem; }
.alert-danger { color: #8e2018; background: #ffebe9; }
.auth-note { text-align: center; margin: 1rem 0 0; font-size: .78rem; }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: radial-gradient(circle at top, var(--brand-soft), var(--surface-page) 45%); }
.error-card { width: min(100%, 620px); padding: clamp(2rem, 6vw, 4rem); text-align: center; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-card); box-shadow: var(--shadow); }
.error-code { display: block; margin-bottom: 1.25rem; color: var(--brand); font-size: clamp(3rem, 10vw, 6rem); font-weight: 900; line-height: 1; }
.error-card p { max-width: 480px; margin-right: auto; margin-left: auto; }
.selection-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: var(--surface-page); }
.selection-card { width: min(100%, 520px); padding: clamp(2rem, 6vw, 3.5rem); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-card); box-shadow: var(--shadow); }
.selection-brand { margin-left: 0; }
.selection-brand strong { color: var(--text); }
.selection-card select { width: 100%; max-width: none; }

@media (max-width: 1100px) {
    .foundation-grid { grid-template-columns: repeat(2, 1fr); }
    .module-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; z-index: 20; left: -290px; width: 272px; transition: left .2s ease; }
    .sidebar.is-open { left: 0; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
    .menu-toggle { display: block; }
    .topbar { padding: .75rem 1rem; }
    .company-context { flex: 1; }
    .user-menu > span:not(.avatar) { display: none; }
    .content { padding: 1.25rem 1rem; }
    .auth-page { display: block; }
    .auth-intro { min-height: 300px; padding: 2rem; }
    .auth-panel { min-height: calc(100vh - 300px); }
}
@media (max-width: 580px) {
    .page-header { align-items: flex-start; flex-direction: column; }
    .welcome-card { align-items: flex-start; flex-direction: column; }
    .foundation-symbol { width: 72px; height: 72px; border-radius: 20px; font-size: 2.25rem; }
    .foundation-grid, .module-summary { grid-template-columns: 1fr; }
    .module-hero { align-items: flex-start; flex-direction: column; }
    .user-menu .avatar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
