:root {
    color-scheme: light;

    --background: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-muted: #f1f5f9;

    --text: #0f172a;
    --text-soft: #64748b;
    --text-faint: #94a3b8;

    --line: #e2e8f0;
    --line-strong: #cbd5e1;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --primary-line: #c7d2fe;

    --focus: rgba(79, 70, 229, 0.18);

    --danger: #b42318;
    --danger-background: #fef3f2;
    --success: #067647;
    --success-background: #ecfdf3;

    --shadow-sm:
        0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md:
        0 10px 30px rgba(15, 23, 42, 0.08),
        0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-lg:
        0 24px 70px rgba(15, 23, 42, 0.12),
        0 8px 24px rgba(15, 23, 42, 0.06);

    --radius-large: 24px;
    --radius-medium: 14px;
    --radius-small: 10px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(
            circle at 15% -10%,
            rgba(99, 102, 241, 0.13),
            transparent 34%
        ),
        radial-gradient(
            circle at 88% 4%,
            rgba(14, 165, 233, 0.08),
            transparent 28%
        ),
        var(--background);
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

::selection {
    color: #312e81;
    background: #e0e7ff;
}

.page-shell {
    min-height: 100vh;
}

.site-header {
    position: relative;
    z-index: 10;
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    padding: 0 42px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    position: relative;
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    color: #ffffff;
    background:
        linear-gradient(145deg, #6366f1 0%, #4338ca 100%);
    box-shadow:
        0 8px 18px rgba(79, 70, 229, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-mark::after {
    position: absolute;
    top: -14px;
    right: -10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    content: "";
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.brand-copy strong {
    font-size: 14px;
    font-weight: 760;
    letter-spacing: -0.015em;
}

.brand-copy span {
    color: var(--text-soft);
    font-size: 11px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-username {
    color: var(--text-soft);
    font-size: 13px;
}

.main-content {
    min-height: calc(100vh - 79px);
}

.auth-layout {
    position: relative;
    display: grid;
    min-height: calc(100vh - 79px);
    overflow: hidden;
    padding: 68px 22px;
    place-items: center;
}

.auth-layout::before,
.auth-layout::after {
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    filter: blur(1px);
    content: "";
    pointer-events: none;
}

.auth-layout::before {
    top: 8%;
    left: 8%;
    width: 280px;
    height: 280px;
    background: rgba(99, 102, 241, 0.07);
}

.auth-layout::after {
    right: 7%;
    bottom: 10%;
    width: 220px;
    height: 220px;
    background: rgba(14, 165, 233, 0.06);
}

.auth-card {
    width: min(100%, 430px);
    padding: 38px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: var(--radius-large);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.auth-card-wide {
    width: min(100%, 470px);
}

.card-icon {
    display: grid;
    width: 50px;
    height: 50px;
    margin-bottom: 26px;
    place-items: center;
    border: 1px solid var(--primary-line);
    border-radius: 15px;
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.card-icon svg {
    width: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.card-heading {
    margin-bottom: 28px;
}

.card-heading h1,
.dashboard-heading h1 {
    margin: 6px 0 10px;
    color: var(--text);
    font-size: clamp(29px, 5vw, 36px);
    font-weight: 760;
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.card-heading > p:last-child,
.dashboard-heading > div > p:last-child {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.65;
}

.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field > span {
    color: #334155;
    font-size: 12px;
    font-weight: 750;
}

.field small {
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.5;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    outline: none;
    color: var(--text);
    background: #ffffff;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease,
        background 150ms ease;
}

.field input,
.field select {
    min-height: 48px;
    padding: 0 14px;
}

.field textarea {
    min-height: 110px;
    padding: 12px 14px;
    resize: vertical;
    line-height: 1.55;
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--text-faint);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: #b8c4d4;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: #818cf8;
    box-shadow:
        0 0 0 4px var(--focus),
        0 1px 2px rgba(15, 23, 42, 0.04);
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 760;
    letter-spacing: -0.005em;
    box-shadow: var(--shadow-sm);
    transition:
        background 150ms ease,
        border-color 150ms ease,
        color 150ms ease,
        box-shadow 150ms ease,
        transform 150ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:focus-visible,
.auth-tab:focus-visible,
.text-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--focus);
}

.button:disabled {
    cursor: wait;
    opacity: 0.62;
}

.button-primary {
    color: #ffffff;
    background: linear-gradient(180deg, #5b52e8 0%, var(--primary) 100%);
    box-shadow:
        0 8px 18px rgba(79, 70, 229, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.button-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #5046db 0%, var(--primary-hover) 100%);
    box-shadow:
        0 10px 22px rgba(79, 70, 229, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.button-secondary {
    border-color: var(--line);
    color: #334155;
    background: #ffffff;
}

.button-secondary:hover:not(:disabled) {
    border-color: var(--line-strong);
    background: var(--surface-soft);
}

.button-small {
    min-height: 36px;
    padding: 0 13px;
    border-radius: 9px;
}

.form-message {
    margin: 0;
    padding: 12px 13px;
    border: 1px solid #fecdca;
    border-radius: 10px;
    color: var(--danger);
    background: var(--danger-background);
    font-size: 12px;
    line-height: 1.5;
}

.form-message.success {
    border-color: #abefc6;
    color: var(--success);
    background: var(--success-background);
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-bottom: 26px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-muted);
}

.auth-tab {
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    color: var(--text-soft);
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
    transition:
        color 140ms ease,
        background 140ms ease,
        box-shadow 140ms ease;
}

.auth-tab:hover {
    color: var(--text);
}

.auth-tab.active {
    color: var(--text);
    background: #ffffff;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 4px 12px rgba(15, 23, 42, 0.04);
}

.text-button {
    display: block;
    margin: 24px auto 0;
    padding: 5px 7px;
    border: 0;
    border-radius: 7px;
    color: var(--text-soft);
    background: transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 650;
}

.text-button:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.loading-card {
    display: flex;
    min-height: 130px;
    align-items: center;
    justify-content: center;
    gap: 13px;
}

.loading-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.dashboard {
    width: min(1180px, calc(100% - 44px));
    margin: 0 auto;
    padding: 64px 0 90px;
}

.dashboard-heading {
    margin-bottom: 32px;
}

.empty-dashboard {
    display: grid;
    min-height: 370px;
    padding: 40px;
    place-items: center;
    align-content: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-large);
    background: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.empty-dashboard-icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    place-items: center;
    border: 1px solid var(--primary-line);
    border-radius: 16px;
    color: var(--primary);
    background: var(--primary-soft);
}

.empty-dashboard-icon svg {
    width: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.empty-dashboard h2 {
    margin: 0 0 8px;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.empty-dashboard p {
    max-width: 390px;
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.6;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .site-header {
        min-height: 68px;
        padding: 0 18px;
    }

    .brand-mark {
        width: 37px;
        height: 37px;
        border-radius: 11px;
    }

    .brand-copy span,
    .header-username {
        display: none;
    }

    .main-content {
        min-height: calc(100vh - 69px);
    }

    .auth-layout {
        min-height: calc(100vh - 69px);
        padding: 32px 16px;
    }

    .auth-card {
        padding: 28px 22px;
        border-radius: 20px;
    }

    .card-heading {
        margin-bottom: 24px;
    }

    .dashboard {
        width: calc(100% - 32px);
        padding: 42px 0 70px;
    }

    .empty-dashboard {
        min-height: 300px;
        padding: 28px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}