:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #eef2f7;
    --text: #172033;
    --muted: #667085;
    --border: #dfe4ec;
    --brand: #243b64;
    --brand-strong: #172a4d;
    --accent: #5f6fff;
    --danger-bg: #fff1f1;
    --danger: #b42318;
    --shadow: 0 14px 34px rgba(23, 32, 51, 0.08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

.topbar {
    min-height: 68px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar__brand,
.topbar__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--brand);
}

.organization-name,
.user-name {
    color: var(--muted);
    font-size: 0.92rem;
}

.organization-switcher select {
    min-width: 210px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    padding: 9px 34px 9px 11px;
    color: var(--text);
}

.page-shell {
    width: min(1600px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 56px;
}

.hero,
.module-hero {
    margin-bottom: 30px;
}

.hero h1,
.module-hero h1 {
    margin: 5px 0 7px;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: -0.045em;
}

.hero p,
.module-hero p,
.module-card p,
.workspace-card p,
.empty-state p,
.auth-card p {
    color: var(--muted);
    line-height: 1.6;
}

.eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.module-card {
    min-height: 178px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 17px;
    align-items: start;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(23, 32, 51, 0.025);
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: #c9d1df;
    box-shadow: var(--shadow);
}

.module-card__icon,
.module-hero__icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 15px;
    background: var(--surface-muted);
    font-size: 1.7rem;
}

.module-card h2,
.workspace-card h2 {
    margin: 2px 0 7px;
    font-size: 1.08rem;
}

.module-card p,
.workspace-card p {
    margin: 0;
    font-size: 0.92rem;
}

.module-card__arrow {
    font-size: 1.35rem;
    color: var(--muted);
}

.module-hero {
    display: flex;
    align-items: center;
    gap: 20px;
}

.breadcrumb {
    display: flex;
    gap: 9px;
    margin-bottom: 26px;
    color: var(--muted);
    font-size: 0.9rem;
}

.breadcrumb a {
    text-decoration: none;
}

.workspace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.workspace-card {
    min-height: 154px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 15px;
}

.workspace-card--pending {
    border-style: dashed;
}

.status-pill {
    align-self: flex-start;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.button {
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    padding: 9px 14px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button--primary {
    background: var(--brand);
    color: white;
}

.button--primary:hover {
    background: var(--brand-strong);
}

.button--ghost {
    background: var(--surface-muted);
    color: var(--text);
}

.button--block {
    width: 100%;
    padding-block: 12px;
}

.auth-shell {
    min-height: calc(100vh - 170px);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(420px, 100%);
    padding: 34px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.setup-card {
    width: min(680px, 100%);
}

.auth-card__logo {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--brand);
    color: white;
    font-weight: 900;
    margin-bottom: 18px;
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 1.65rem;
}

.auth-card p {
    margin: 0 0 24px;
}

.form-stack {
    display: grid;
    gap: 16px;
}

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

.field label {
    font-size: 0.88rem;
    font-weight: 700;
}

.field input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(95, 111, 255, 0.12);
}

.setup-modules {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: grid;
    gap: 10px;
}

.setup-modules legend {
    padding: 0 6px;
    font-size: 0.88rem;
    font-weight: 800;
}

.setup-module {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
}

.setup-module:hover {
    background: var(--surface-muted);
}

.setup-module__icon {
    font-size: 1.3rem;
}

.setup-module strong,
.setup-module small {
    display: block;
}

.setup-module small {
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.45;
}

.alert {
    padding: 11px 13px;
    border-radius: 9px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert--error,
.alert--danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.empty-state {
    padding: 48px 28px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: var(--surface);
}

.empty-state--large {
    margin-top: 60px;
}

.empty-state__icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.empty-state h1,
.empty-state h2 {
    margin: 0 0 8px;
}

.empty-state p {
    margin: 0 0 18px;
}

.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;
}

@media (max-width: 720px) {
    .topbar {
        align-items: flex-start;
        padding: 14px 18px;
    }

    .topbar,
    .topbar__actions {
        flex-wrap: wrap;
    }

    .organization-name,
    .user-name {
        display: none;
    }

    .organization-switcher select {
        min-width: 150px;
        max-width: 180px;
    }

    .page-shell {
        width: min(100% - 26px, 1600px);
        padding-top: 28px;
    }

    .module-card {
        grid-template-columns: auto 1fr;
    }

    .module-card__arrow {
        display: none;
    }

    .setup-module {
        grid-template-columns: auto 1fr;
    }

    .setup-module input {
        grid-row: span 2;
    }
}
