:root {
    --bg-0: #07050f;
    --bg-1: #0f0a1d;
    --bg-2: #161028;
    --panel: rgba(20, 16, 35, 0.74);
    --panel-solid: #140f25;
    --text: #f5f3ff;
    --muted: #b6adc8;
    --border: rgba(255, 255, 255, 0.14);
    --brand: #5B2D8E;
    --brand-soft: #7a4ab0;
    --ok: #2dd4bf;
    --error: #fb7185;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    background: radial-gradient(80% 80% at 10% 5%, #251341 0%, transparent 65%),
                radial-gradient(70% 70% at 90% 85%, #3f1451 0%, transparent 65%),
                linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
    color: var(--text);
    min-height: 100vh;
}

.ambient {
    position: fixed;
    inset: -20%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(35% 40% at 15% 25%, rgba(91, 45, 142, 0.34), transparent 70%),
        radial-gradient(30% 35% at 84% 64%, rgba(202, 73, 214, 0.28), transparent 70%);
    filter: blur(60px);
    animation: drift 15s ease-in-out infinite alternate;
}

@keyframes drift {
    from { transform: translate3d(-2%, -1%, 0) scale(1); }
    to { transform: translate3d(2%, 2%, 0) scale(1.06); }
}

.container { width: min(1200px, 92vw); margin: 0 auto; position: relative; z-index: 1; }
.glass {
    background: var(--panel);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 26px 56px rgba(0, 0, 0, 0.35);
}
.card {
    border-radius: 24px;
    padding: 1.35rem;
}
.btn {
    border: 1px solid var(--border);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .95rem 1.5rem;
    background: #0c0b14;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease, background .28s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(0, 0, 0, 0.35); }
.btn-primary {
    background: linear-gradient(140deg, #2a1a49 0%, var(--brand) 55%, #a445c2 100%);
    border-color: rgba(216, 174, 255, 0.42);
}

.portal-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
.sidebar {
    border-right: 1px solid var(--border);
    background: rgba(10, 8, 18, 0.9);
    padding: 1.2rem;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-size: .88rem;
    color: #e8ddff;
}
.nav-link {
    display: block;
    margin-top: .55rem;
    padding: .8rem .95rem;
    border-radius: 12px;
    color: #d8cee8;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all .22s ease;
}
.nav-link:hover, .nav-link.active {
    background: rgba(91, 45, 142, 0.32);
    border-color: rgba(217, 188, 255, 0.26);
    color: #fff;
}
.main { padding: 1.6rem 1.4rem 2.2rem; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.35rem;
}
.headline {
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.05;
    margin: 0;
}
.sub {
    color: var(--muted);
    line-height: 1.7;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

.stat-value { font-size: 1.9rem; font-weight: 800; margin: .3rem 0 .2rem; }
.muted { color: var(--muted); }

input, select, textarea {
    width: 100%;
    background: rgba(6, 6, 12, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: .86rem .95rem;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(181, 132, 247, 0.72);
    box-shadow: 0 0 0 3px rgba(91, 45, 142, 0.2);
}
label { font-size: .9rem; color: #d6cde8; margin-bottom: .35rem; display: block; }

.portal-login {
    width: min(960px, 92vw);
    margin: 5.6rem auto 2rem;
}
.portal-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.portal-choice {
    padding: 1.25rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(160deg, rgba(23, 16, 39, 0.74), rgba(12, 10, 22, 0.88));
    cursor: pointer;
    transition: transform .24s ease, border-color .24s ease, box-shadow .24s ease;
}
.portal-choice:hover {
    transform: translateY(-4px) scale(1.01);
    border-color: rgba(202, 162, 255, 0.62);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35), 0 0 28px rgba(144, 88, 221, 0.25);
}
.portal-choice.active {
    border-color: rgba(219, 194, 255, 0.78);
    box-shadow: 0 0 28px rgba(188, 133, 245, 0.38);
}
.portal-choice-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    text-align: center;
}
.portal-choice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    background: rgba(91, 45, 142, 0.35);
    border: 1px solid rgba(219, 194, 255, 0.35);
    color: #e8ddff;
}
.portal-choice-icon svg {
    width: 1.65rem;
    height: 1.65rem;
}
.portal-choice-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}
.hidden { display: none !important; }
.error {
    color: #ffd5de;
    background: rgba(251, 113, 133, 0.18);
    border: 1px solid rgba(251, 113, 133, 0.45);
    padding: .7rem .9rem;
    border-radius: 12px;
    animation: shake .22s linear 2;
}
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(4px); }
    50% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

.progress {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), #be6df5);
    transition: width .25s ease;
}

@media (max-width: 980px) {
    .portal-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .portal-choice-grid { grid-template-columns: 1fr; }
}
