:root {
    --ink: #0a0c12;
    --ink-soft: #11141d;
    --paper: #f4f1ea;
    --paper-bright: #fbfaf7;
    --line: rgba(255,255,255,.11);
    --line-dark: rgba(10,12,18,.12);
    --muted: #9aa2b3;
    --muted-dark: #626a79;
    --accent: #7c8cff;
    --accent-soft: #b7c0ff;
    --signal: #62dfa1;
    --danger: #ff877f;
    --shadow: 0 28px 90px rgba(0,0,0,.23);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--ink);
}

body {
    margin: 0;
    min-height: 100vh;
    color: #f7f8fb;
    background:
        radial-gradient(circle at 8% 4%, rgba(124,140,255,.14), transparent 29rem),
        radial-gradient(circle at 88% 88%, rgba(98,223,161,.08), transparent 32rem),
        var(--ink);
}

button,
input {
    font: inherit;
}

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

a {
    color: inherit;
}

.wordmark {
    display: inline-block;
    width: max-content;
    color: #fff;
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -.055em;
    text-decoration: none;
}

.kicker,
.eyebrow {
    display: block;
    color: var(--accent-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.auth-shell {
    width: min(1180px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    align-items: center;
    gap: clamp(48px, 8vw, 110px);
    padding: 72px 0;
}

.auth-brand {
    position: relative;
    display: flex;
    min-height: 560px;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px 0;
}

.brand-copy {
    max-width: 650px;
}

.brand-copy h1 {
    margin: 18px 0 22px;
    max-width: 8ch;
    font-size: clamp(54px, 7.5vw, 105px);
    font-weight: 720;
    line-height: .87;
    letter-spacing: -.065em;
}

.brand-copy p {
    max-width: 560px;
    margin: 0;
    color: #aeb5c4;
    font-size: clamp(17px, 1.6vw, 21px);
    line-height: 1.62;
}

.journey {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #697183;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .04em;
}

.journey i {
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, #343947, #697183);
}

.auth-panel {
    display: flex;
    justify-content: flex-end;
}

.auth-card {
    width: min(100%, 480px);
    padding: clamp(30px, 5vw, 50px);
    border: 1px solid var(--line);
    border-radius: 28px;
    background: rgba(17,20,29,.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.card-heading {
    margin-bottom: 30px;
}

.card-heading h2 {
    margin: 9px 0 8px;
    font-size: 36px;
    letter-spacing: -.04em;
}

.card-heading p,
.microcopy {
    color: var(--muted);
    line-height: 1.6;
}

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

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

.form-stack label > span {
    color: #c8ced9;
    font-size: 13px;
    font-weight: 650;
}

.form-stack input {
    width: 100%;
    min-height: 52px;
    padding: 0 15px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 13px;
    outline: 0;
    color: #fff;
    background: #0d1017;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.form-stack input:focus {
    border-color: rgba(124,140,255,.72);
    box-shadow: 0 0 0 4px rgba(124,140,255,.10);
}

.primary-button,
.secondary-button,
.ghost-button {
    border: 0;
    cursor: pointer;
    transition: transform .16s ease, opacity .16s ease, background .16s ease;
}

.primary-button {
    min-height: 52px;
    margin-top: 4px;
    border-radius: 13px;
    color: #090b10;
    background: #f5f3ed;
    font-weight: 780;
    letter-spacing: -.015em;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.microcopy {
    margin: 24px 0 0;
    font-size: 12px;
}

.notice {
    margin: 0 0 22px;
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.notice-error {
    border: 1px solid rgba(255,135,127,.24);
    color: #ffd5d1;
    background: rgba(255,135,127,.08);
}

.notice-success {
    border: 1px solid rgba(98,223,161,.2);
    color: #c9f6df;
    background: rgba(98,223,161,.08);
}

.topbar {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-actions form {
    margin: 0;
}

.text-link {
    color: #aeb5c4;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.ghost-button {
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 10px;
    color: #e8eaf0;
    background: rgba(255,255,255,.035);
    font-size: 13px;
    font-weight: 650;
}

.dashboard-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 64px 0 110px;
}

.account-hero {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    align-items: flex-end;
    margin-bottom: 58px;
}

.account-hero h1 {
    margin: 11px 0 6px;
    font-size: clamp(48px, 7vw, 90px);
    line-height: .94;
    letter-spacing: -.06em;
}

.account-hero p {
    margin: 0;
    color: var(--muted);
}

.role-stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.role-badge,
.active-pill,
.product-tags span {
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}

.role-badge {
    padding: 8px 11px;
    border: 1px solid rgba(124,140,255,.26);
    color: #d7dbff;
    background: rgba(124,140,255,.09);
}

.active-context {
    margin-bottom: 30px;
    padding: 26px 28px;
    border: 1px solid rgba(98,223,161,.18);
    border-radius: 20px;
    background:
        linear-gradient(115deg, rgba(98,223,161,.08), transparent 43%),
        #0f1219;
}

.active-context-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-top: 12px;
}

.active-context h2 {
    margin: 0 0 5px;
    font-size: 26px;
    letter-spacing: -.035em;
}

.active-context p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.section-block {
    margin-top: 74px;
}

.section-heading {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 430px);
    gap: 30px;
    align-items: end;
    margin-bottom: 24px;
}

.section-heading h2 {
    margin: 8px 0 0;
    font-size: 34px;
    letter-spacing: -.045em;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

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

.workspace-card {
    position: relative;
    overflow: hidden;
    min-height: 255px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 27px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #0f1219;
}

.workspace-card::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -90px;
    width: 190px;
    height: 190px;
    border: 1px solid rgba(124,140,255,.14);
    border-radius: 50%;
}

.workspace-card.is-active {
    border-color: rgba(98,223,161,.22);
}

.workspace-topline {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.workspace-role {
    color: var(--muted);
    font-size: 11px;
    font-weight: 720;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.active-pill {
    padding: 6px 9px;
    color: #b8f0d2;
    background: rgba(98,223,161,.10);
}

.workspace-card h3 {
    margin: 30px 0 16px;
    max-width: 14ch;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -.04em;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.product-tags span {
    padding: 6px 9px;
    color: #c6ccd7;
    background: rgba(255,255,255,.06);
}

.workspace-card form {
    margin-top: auto;
    padding-top: 28px;
    z-index: 1;
}

.secondary-button {
    padding: 10px 13px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    color: #f1f2f5;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
}

.relationship-card {
    margin-top: 90px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 38px 40px;
    border-radius: 24px;
    color: #0b0d12;
    background: var(--paper);
}

.relationship-card .eyebrow {
    color: #5a64ac;
}

.relationship-card h2 {
    margin: 9px 0 0;
    font-size: clamp(31px, 4vw, 49px);
    line-height: 1;
    letter-spacing: -.05em;
}

.relationship-card p {
    align-self: end;
    margin: 0;
    color: var(--muted-dark);
    font-size: 15px;
    line-height: 1.7;
}

.empty-state {
    padding: 35px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #0f1219;
}

.empty-state h3 {
    margin-top: 0;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.back-link {
    display: inline-block;
    margin-top: 23px;
    color: #aeb5c4;
    font-size: 13px;
    text-decoration: none;
}

.compact-auth .brand-copy h1 {
    max-width: 10ch;
    font-size: clamp(48px, 6vw, 82px);
}

@media (max-width: 820px) {
    .auth-shell {
        grid-template-columns: 1fr;
        gap: 38px;
        padding: 28px 0 50px;
    }

    .auth-brand {
        min-height: auto;
        gap: 72px;
    }

    .brand-copy h1 {
        font-size: clamp(53px, 15vw, 78px);
    }

    .journey {
        display: none;
    }

    .auth-panel,
    .auth-card {
        width: 100%;
    }

    .auth-card {
        border-radius: 20px;
    }

    .account-hero,
    .active-context-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .role-stack {
        justify-content: flex-start;
    }

    .section-heading,
    .relationship-card {
        grid-template-columns: 1fr;
    }

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

    .dashboard-shell {
        padding-top: 36px;
    }
}

@media (max-width: 520px) {
    .topbar,
    .dashboard-shell,
    .auth-shell {
        width: min(100% - 28px, 1180px);
    }

    .topbar {
        padding-top: 20px;
    }

    .dashboard-shell {
        padding-bottom: 70px;
    }

    .account-hero h1 {
        font-size: 48px;
    }

    .workspace-card,
    .active-context {
        padding: 22px;
    }

    .relationship-card {
        padding: 28px 24px;
    }
}

/* Milestone 3C — Identity security and email aliases */
.identity-summary {
    margin: -18px 0 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 23px 25px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.025);
}

.identity-summary h2 {
    margin: 7px 0 5px;
    font-size: 22px;
    letter-spacing: -.025em;
}

.identity-summary p,
.security-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.62;
}

.security-state {
    display: flex;
    align-items: center;
    gap: 13px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.security-shell {
    max-width: 1040px;
}

.security-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 16px;
}

.security-card {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #0f1219;
}

.security-card h2 {
    margin: 9px 0 11px;
    font-size: 26px;
    line-height: 1.08;
    letter-spacing: -.035em;
}

.important-card {
    margin-bottom: 16px;
    border-color: rgba(98,223,161,.25);
    background: linear-gradient(120deg, rgba(98,223,161,.08), transparent 52%), #0f1219;
}

.recovery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 20px;
}

.recovery-grid code,
.secret-code {
    display: block;
    padding: 11px 12px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 10px;
    color: #eef0f5;
    background: #090c12;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.qr-box {
    width: max-content;
    max-width: 100%;
    margin: 22px 0 14px;
    padding: 12px;
    border-radius: 14px;
    background: #fff;
    line-height: 0;
}

.qr-box svg {
    width: min(260px, 66vw);
    height: auto;
}

.security-form {
    margin-top: 22px;
}

.inline-form {
    margin-top: 10px;
}

.status-line {
    width: max-content;
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border-radius: 999px;
    color: #b8f0d2;
    background: rgba(98,223,161,.10);
    font-size: 12px;
    font-weight: 750;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 0 4px rgba(98,223,161,.10);
}

.email-list {
    display: grid;
    gap: 9px;
    margin-top: 20px;
}

.email-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 14px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
}

.email-row strong,
.email-row small {
    display: block;
}

.email-row strong {
    font-size: 13px;
    overflow-wrap: anywhere;
}

.email-row small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.password-card {
    margin-top: 16px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: auto;
    padding: 0 18px;
    margin-top: 20px;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    vertical-align: middle;
}

@media (max-width: 820px) {
    .identity-summary,
    .security-grid {
        grid-template-columns: 1fr;
    }

    .identity-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .security-state {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .security-card,
    .identity-summary {
        padding: 22px;
    }

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

/* Milestone 3D — email verification */
.email-identity-copy {
    min-width: 0;
}

.email-identity-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
}

.verify-email-button {
    appearance: none;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.045);
    color: var(--text);
    border-radius: 9px;
    padding: 8px 11px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.verify-email-button:hover {
    border-color: rgba(255,255,255,.24);
    background: rgba(255,255,255,.075);
}

.verification-result-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.verification-result-card {
    width: min(560px, 100%);
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255,255,255,.025);
    padding: 34px;
}

.verification-result-card h1 {
    margin: 10px 0 13px;
    font-size: clamp(30px, 5vw, 48px);
    letter-spacing: -.045em;
}

.verification-result-card p {
    margin: 0 0 24px;
    color: var(--muted);
    line-height: 1.65;
}

@media (max-width: 680px) {
    .email-row {
        align-items: flex-start;
        gap: 12px;
    }

    .email-identity-actions {
        justify-content: flex-start;
    }
}
