:root {
    --bg: #07111f;
    --panel: rgba(14, 29, 47, 0.88);
    --text: #f5f8fb;
    --muted: #91a1b5;
    --accent: #20d59b;
    --accent-dark: #08ae7d;
    --line: rgba(166, 187, 209, 0.16);
    --danger: #ff7b7b;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: "Manrope", sans-serif;
    background:
        radial-gradient(circle at 78% 30%, rgba(15, 153, 126, 0.14), transparent 26rem),
        radial-gradient(circle at 10% 90%, rgba(18, 69, 101, 0.18), transparent 30rem),
        var(--bg);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    content: "";
    opacity: 0.2;
    background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 90%);
}

.page-shell { width: min(1180px, calc(100% - 48px)); min-height: 100vh; margin: auto; display: flex; flex-direction: column; }
.site-header { min-height: 106px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand__logo { width: 40px; height: 40px; display: block; object-fit: contain; border-radius: 7px; }
.brand__name { font-size: 22px; font-weight: 800; letter-spacing: -.7px; }
.brand__name span { color: var(--accent); }
.system-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 600; }
.system-status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }

.hero { flex: 1; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(60px, 9vw, 130px); padding: 70px 0; }
.eyebrow { margin: 0 0 22px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 2.2px; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 700px; font-size: clamp(47px, 6vw, 74px); line-height: 1.06; letter-spacing: -4px; }
.hero h1 span { color: transparent; background: linear-gradient(95deg, var(--accent), #a4f1d6); background-clip: text; -webkit-background-clip: text; }
.hero__lead { max-width: 580px; margin: 27px 0 42px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.metrics { display: flex; gap: 28px; }
.metric { display: flex; align-items: center; gap: 13px; }
.metric__icon { width: 40px; height: 40px; display: grid; flex: none; place-items: center; border-radius: 10px; color: var(--accent); background: rgba(32,213,155,.09); }
.metric svg, .login-card svg, .input-wrap svg, .login-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.metric strong, .metric small { display: block; }
.metric strong { margin-bottom: 4px; font-size: 12px; }
.metric small { color: var(--muted); font-size: 10px; }

.login-card { position: relative; padding: 38px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,.3); backdrop-filter: blur(18px); }
.login-card__glow { position: absolute; top: -100px; right: -100px; width: 230px; height: 230px; border-radius: 50%; pointer-events: none; background: rgba(32,213,155,.09); filter: blur(38px); }
.login-card__heading { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.login-card__heading p { margin: 0 0 3px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.login-card__heading h2 { margin: 0; font-size: 24px; }
.login-card__badge { width: 47px; height: 47px; display: grid; place-items: center; color: var(--accent); border: 1px solid rgba(32,213,155,.25); border-radius: 12px; background: rgba(32,213,155,.08); }
.login-form label { display: block; margin: 17px 0 8px; color: #c8d2dd; font-size: 11px; font-weight: 700; }
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; top: 50%; left: 15px; width: 17px; color: #708197; transform: translateY(-50%); pointer-events: none; }
.input-wrap input { width: 100%; height: 52px; padding: 0 47px 0 45px; outline: none; color: var(--text); font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(4,13,24,.55); transition: border-color .2s, box-shadow .2s; }
.input-wrap input:focus { border-color: rgba(32,213,155,.7); box-shadow: 0 0 0 3px rgba(32,213,155,.09); }
.input-wrap input::placeholder { color: #5f7085; }
.password-toggle { position: absolute; top: 50%; right: 10px; width: 35px; height: 35px; padding: 0; display: grid; place-items: center; color: #708197; border: 0; background: transparent; transform: translateY(-50%); cursor: pointer; }
.password-toggle:hover { color: var(--accent); }
.login-button { width: 100%; height: 52px; margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 10px; color: #032117; font: inherit; font-size: 12px; font-weight: 800; border: 0; border-radius: 9px; background: linear-gradient(120deg, var(--accent), #4ee3b2); box-shadow: 0 10px 30px rgba(32,213,155,.16); cursor: pointer; transition: transform .2s, box-shadow .2s; }
.login-button:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(32,213,155,.24); }
.login-button:disabled, .input-wrap input:disabled, .password-toggle:disabled { opacity: .5; cursor: not-allowed; }
.login-button:disabled:hover { transform: none; box-shadow: 0 10px 30px rgba(32,213,155,.16); }
.login-button svg { width: 17px; }
.login-countdown { margin: 14px 0 0; color: var(--danger); font-size: 13px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.login-card__help { margin: 25px 0 0; padding-top: 22px; color: var(--muted); font-size: 10px; text-align: center; border-top: 1px solid var(--line); }
.login-card__help a { color: #cbd6df; font-weight: 700; text-decoration: none; }
.login-card__help a:hover { color: var(--accent); }
.form-alert { padding: 11px 13px; color: #ffd3d3; font-size: 11px; border: 1px solid rgba(255,123,123,.25); border-radius: 8px; background: rgba(255,123,123,.08); }
.form-success { padding: 14px; color: #b9f7e2; font-size: 12px; line-height: 1.7; border: 1px solid rgba(32,213,155,.28); border-radius: 8px; background: rgba(32,213,155,.09); }
.setup-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.setup-card { width: min(100%, 450px); }
.setup-card h1 { margin: 0; font-size: 24px; }
.setup-card__intro { margin: 0 0 25px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.setup-card__intro strong { color: var(--text); }
.setup-card__link { text-decoration: none; }
.two-factor-card { width: min(100%, 480px); }
.two-factor-card h1 { margin: 0; font-size: 22px; }
.two-factor-steps { margin: 0 0 16px; padding-left: 22px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.two-factor-qr { width: 230px; max-width: 100%; margin: 0 auto 16px; padding: 8px; border-radius: 8px; background: #fff; }
.two-factor-qr svg { width: 100%; height: auto; display: block; }
.two-factor-manual { margin-bottom: 16px; color: var(--muted); font-size: 11px; }
.two-factor-manual summary { color: var(--text); cursor: pointer; }
.two-factor-manual code { display: block; margin-top: 8px; padding: 10px; overflow-wrap: anywhere; color: var(--accent); border-radius: 6px; background: rgba(0,0,0,.25); }
.otp-input { width: 100%; height: 56px; padding: 0 16px; color: var(--text); font: 700 24px/1 "Manrope", sans-serif; text-align: center; letter-spacing: 8px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: rgba(4,13,24,.55); }
.otp-input:focus { border-color: rgba(32,213,155,.7); box-shadow: 0 0 0 3px rgba(32,213,155,.09); }
.two-factor-back { display: block; margin-top: 16px; color: var(--muted); font-size: 11px; text-align: center; }
.portal-page { width: min(1180px, calc(100% - 16px)); min-height: 100vh; margin: auto; }
.portal-header { min-height: 96px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.portal-logout { padding: 10px 15px; color: var(--text); font-size: 12px; font-weight: 700; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; }
.portal-logout:hover { color: var(--accent); border-color: rgba(32,213,155,.4); }
.portal-nav { display: flex; align-items: center; gap: 8px; }
.portal-nav a { padding: 9px 12px; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; border: 1px solid transparent; border-radius: 8px; }
.portal-nav a:hover, .portal-nav a.is-active { color: var(--accent); border-color: var(--line); background: rgba(255,255,255,.025); }
.portal-layout { margin-top: 8px; display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 8px; }
.portal-sidebar { min-height: 180px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.portal-sidebar__title { margin: 0 0 8px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.portal-menu { display: grid; gap: 8px; }
.portal-menu a { min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; border: 1px solid transparent; border-radius: 8px; }
.portal-menu a:hover, .portal-menu a.is-active { color: var(--accent); border-color: rgba(32,213,155,.22); background: rgba(32,213,155,.08); }
.portal-menu svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.portal-main { min-width: 0; }
.portal-content { margin-top: 0; padding: 24px; display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.portal-content .eyebrow { margin: 0; }
.portal-content h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; letter-spacing: -1px; }
.portal-content > p { margin: 0; color: var(--muted); line-height: 1.7; }
.accounts-heading { margin: 0 0 8px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.accounts-heading .eyebrow { margin: 0 0 8px; }
.accounts-heading h1 { margin: 0; font-size: 28px; }
.account-button { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); font: inherit; font-size: 11px; font-weight: 800; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer; }
.account-button--primary { color: #032117; border-color: transparent; background: var(--accent); }
.account-form-card { margin-bottom: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.account-form-card summary { font-size: 13px; font-weight: 800; cursor: pointer; }
.account-form-card h2 { margin: 0 0 16px; font-size: 18px; }
.account-form { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.account-form label { color: #c8d2dd; font-size: 11px; font-weight: 700; }
.account-form input { width: 100%; height: 42px; margin-top: 8px; padding: 0 12px; color: var(--text); font: inherit; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: rgba(4,13,24,.55); }
.account-form input:focus { border-color: var(--accent); }
.account-form__wide { grid-column: 1 / -1; }
.accounts-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.accounts-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.accounts-table th, .accounts-table td { padding: 12px 8px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.accounts-table th { color: var(--muted); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }
.accounts-table tr:last-child td { border-bottom: 0; }
.accounts-table strong, .accounts-table small { display: block; }
.accounts-table small { margin-top: 4px; color: var(--muted); }
.accounts-table code { color: #b8c6d5; }
.status-badge { padding: 5px 8px; display: inline-block; border-radius: 20px; font-size: 9px; font-weight: 800; }
.status-badge--active { color: #8ff1d1; background: rgba(32,213,155,.12); }
.status-badge--suspended { color: #ffb2b2; background: rgba(255,123,123,.12); }
.status-badge--invited { color: #b9cbff; background: rgba(100,135,255,.12); }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.account-actions form { margin: 0; }
.account-actions a, .account-actions button { padding: 0; color: var(--muted); font: inherit; font-size: 10px; text-decoration: underline; border: 0; background: transparent; cursor: pointer; }
.account-actions a:hover, .account-actions button:hover { color: var(--accent); }
.account-actions .is-danger:hover { color: var(--danger); }
.password-reset-request, .account-actions .password-reset-action { color: #ffd27d; font-weight: 800; }
.admin-login-countdown, .account-actions .login-lock-reset { color: var(--danger); font-weight: 800; font-variant-numeric: tabular-nums; }
.account-protected { color: var(--muted); font-size: 9px; }

@media (max-width: 700px) {
    .portal-header { align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; }
    .portal-nav { width: 100%; overflow-x: auto; }
    .accounts-heading { align-items: flex-start; flex-direction: column; }
    .account-form { grid-template-columns: 1fr; }
    .account-form__wide { grid-column: auto; }
    .portal-layout { grid-template-columns: 1fr; }
    .portal-sidebar { min-height: auto; padding: 8px; }
    .portal-sidebar__title { padding: 0 4px; }
}
.site-footer { min-height: 76px; display: flex; align-items: center; justify-content: space-between; color: #607086; font-size: 10px; border-top: 1px solid var(--line); }
.site-footer p:last-child { display: flex; align-items: center; gap: 7px; }
.site-footer p span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: 50px; padding: 60px 0; }
    .hero__content { text-align: center; }
    .hero__lead { margin-right: auto; margin-left: auto; }
    .metrics { justify-content: center; }
    .login-card { width: min(100%, 470px); margin: auto; }
}

@media (max-width: 560px) {
    .page-shell { width: min(100% - 28px, 1180px); }
    .site-header { min-height: 82px; }
    .system-status { font-size: 0; }
    .hero { padding: 45px 0; }
    .hero h1 { font-size: 44px; letter-spacing: -2.7px; }
    .metrics { display: grid; justify-content: start; width: max-content; margin: auto; text-align: left; }
    .login-card { padding: 27px 22px; }
    .site-footer { flex-direction: column; justify-content: center; gap: 3px; }
    .site-footer p { margin: 3px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
