* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Rubik', sans-serif;
}

:root {
    --bg-dark: #090909;
    --bg-panel: #111214;
    --bg-field: #0b0c0e;
    --border-soft: rgba(255,255,255,0.1);
    --border-strong: rgba(255,255,255,0.2);
    --border-red: rgba(211,13,13,0.38);
    --text-main: #fff;
    --text-muted: #a8acb3;
    --text-body: #d7d9dd;
    --red: #d30d0d;
    --red-hot: #f03a3a;
    --green: #24854c;
    --gold: #96702a;
    --teal: #147b86;
    --discord: #5865f2;
    --shadow: rgba(0,0,0,0.34);
}

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

body {
    min-height: 100vh;
    color: var(--text-main);
    background:
        linear-gradient(180deg, rgba(211,13,13,0.08) 0%, rgba(211,13,13,0) 34%),
        linear-gradient(135deg, #0a0a0a 0%, #101113 48%, #090909 100%);
    background-attachment: fixed;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.portal-shell {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 24px;
}

.portal-topbar,
.login-panel,
.staff-hero,
.staff-gate,
.overview-grid article,
.tool-panel {
    background: linear-gradient(180deg, rgba(20,22,26,0.98) 0%, rgba(15,16,19,0.98) 100%);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    box-shadow: 0 18px 44px var(--shadow);
    backdrop-filter: blur(14px);
}

.portal-topbar {
    min-height: 70px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
}

.brand-mark,
.portal-links,
.portal-account,
.discord-login,
.logout-link,
.ghost-button,
.account-chip,
.overview-grid article a,
.tool-list a,
.editor-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.brand-mark,
.portal-links a,
.discord-login,
.logout-link,
.ghost-button,
.overview-grid article a,
.tool-list a {
    color: #fff;
    text-decoration: none;
}

.brand-mark {
    justify-content: flex-start;
    gap: 12px;
}

.brand-mark img,
.account-chip img,
.login-avatar {
    border-radius: 50%;
}

.brand-mark img {
    width: 44px;
    height: 44px;
    border: 1px solid #252525;
}

.brand-mark strong,
.brand-mark small,
.tool-list strong,
.tool-list small {
    display: block;
}

.brand-mark small,
.tool-list small {
    color: var(--text-muted);
    margin-top: 2px;
}

.portal-links {
    justify-self: center;
    gap: 8px;
    flex-wrap: wrap;
}

.portal-links a,
.discord-login,
.logout-link,
.ghost-button,
.overview-grid article a,
.editor-actions button {
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    font-weight: 800;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.portal-links a,
.logout-link,
.ghost-button {
    background: #17191c;
}

.discord-login {
    background: linear-gradient(180deg, #6671ff 0%, var(--discord) 100%);
    box-shadow: 0 10px 24px rgba(88,101,242,0.22);
}

.portal-links a:hover,
.discord-login:hover,
.logout-link:hover,
.ghost-button:hover,
.overview-grid article a:hover,
.tool-list a:hover,
.editor-actions button:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
}

.portal-account {
    justify-self: end;
    gap: 10px;
}

.account-chip {
    min-height: 42px;
    padding: 8px 12px;
    color: var(--text-body);
    background: #15171a;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    font-weight: 700;
}

.account-chip img {
    width: 28px;
    height: 28px;
}

.staff-badge,
.viewer-badge {
    padding: 5px 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}

.staff-badge {
    background: rgba(36,133,76,0.95);
}

.viewer-badge {
    background: #292d33;
}

.login-panel {
    min-height: min(620px, calc(100vh - 132px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
    align-items: center;
    gap: 34px;
    padding: clamp(24px, 5vw, 56px);
    border-color: var(--border-red);
}

.professional-login {
    grid-template-columns: minmax(0, 1.08fr) minmax(340px, 460px);
}

.login-copy h1,
.staff-hero h1 {
    margin-bottom: 14px;
    font-size: clamp(3rem, 8vw, 5.2rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.login-copy p,
.staff-hero p,
.staff-gate p {
    color: var(--text-muted);
    line-height: 1.6;
}

.auth-highlights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.auth-highlights span {
    min-height: 118px;
    display: grid;
    align-content: start;
    gap: 7px;
    padding: 14px;
    color: var(--text-muted);
    background: #15171a;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
}

.auth-highlights i {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--red);
    border-radius: 6px;
}

.auth-highlights span:nth-child(1) i {
    background: var(--discord);
}

.auth-highlights span:nth-child(2) i {
    background: var(--gold);
}

.auth-highlights span:nth-child(3) i {
    background: var(--green);
}

.auth-highlights strong {
    color: #fff;
}

.auth-highlights small {
    line-height: 1.42;
}

.tracker-kicker {
    color: var(--red-hot);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.login-card {
    padding: 20px;
    background: #101215;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
}

.account-card {
    padding: 0;
    overflow: hidden;
}

.login-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    background: #15171a;
    border-bottom: 1px solid var(--border-soft);
}

.login-card-head img {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
}

.login-card-head strong,
.login-card-head small {
    display: block;
}

.login-card-head small {
    margin-top: 3px;
    color: var(--text-muted);
}

.login-state {
    display: grid;
    gap: 13px;
    justify-items: start;
    padding: 20px;
}

.login-state > i {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--discord);
    border-radius: 8px;
    font-size: 1.3rem;
}

.login-avatar {
    width: 72px;
    height: 72px;
    border: 1px solid var(--border-soft);
}

.login-actions,
.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.login-legal {
    margin: 0;
    padding: 16px 18px 18px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-soft);
    font-size: 0.86rem;
    line-height: 1.5;
}

.login-legal a {
    color: #ff6b6b;
    font-weight: 800;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,107,107,0.42);
}

.staff-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
    padding: 24px;
    border-color: var(--border-red);
}

.tracker-status {
    min-width: 150px;
    padding: 11px 13px;
    text-align: center;
    color: var(--text-body);
    background: #15171a;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    font-weight: 700;
}

.tracker-status.staff {
    border-color: rgba(36,133,76,0.52);
    color: #dff8e8;
}

.tracker-status.error {
    border-color: rgba(255,49,49,0.62);
    color: #ffd7d7;
}

.staff-gate {
    max-width: 680px;
    display: grid;
    gap: 12px;
    padding: 26px;
}

.staff-gate > i {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(211,13,13,0.9);
    border-radius: 8px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.overview-grid article {
    min-height: 145px;
    display: grid;
    gap: 8px;
    align-content: start;
    padding: 16px;
}

.overview-grid article i {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--red);
    border-radius: 6px;
}

.overview-grid article:nth-child(2) i {
    background: var(--teal);
}

.overview-grid article:nth-child(3) i {
    background: var(--gold);
}

.overview-grid article:nth-child(4) i {
    background: var(--green);
}

.overview-grid span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.overview-grid strong {
    font-size: 1.35rem;
}

.overview-grid article a {
    width: fit-content;
    min-height: 34px;
    padding: 7px 10px;
    background: #17191c;
    font-size: 0.8rem;
}

.staff-tools {
    display: grid;
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
    gap: 14px;
    align-items: start;
}

.tool-panel {
    padding: 18px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-soft);
}

.panel-head h2 {
    font-size: 1.35rem;
}

.tool-list {
    display: grid;
    gap: 10px;
}

.tool-list a {
    justify-content: flex-start;
    min-height: 78px;
    padding: 13px;
    color: var(--text-body);
    background: #15171a;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
}

.tool-list i {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--red);
    border-radius: 6px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--text-body);
    font-size: 0.86rem;
    font-weight: 800;
}

select,
textarea {
    width: 100%;
    color: #fff;
    background: var(--bg-field);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

select {
    min-width: 230px;
    min-height: 42px;
    padding: 10px 12px;
}

textarea {
    min-height: 420px;
    padding: 12px;
    resize: vertical;
    line-height: 1.45;
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

select:focus,
textarea:focus {
    border-color: rgba(255,49,49,0.72);
    box-shadow: 0 0 0 3px rgba(211,13,13,0.18);
}

.editor-actions {
    justify-content: flex-end;
    margin-top: 12px;
}

.editor-actions button {
    color: #fff;
    background: linear-gradient(180deg, #ef2424 0%, var(--red) 100%);
    box-shadow: 0 10px 24px rgba(211,13,13,0.22);
}

.editor-actions button:disabled {
    opacity: 0.58;
    cursor: wait;
}

.legal-shell {
    width: min(1180px, 100%);
}

.legal-document {
    max-width: 980px;
    margin: 0 auto;
    padding: clamp(22px, 4vw, 42px);
    color: var(--text-body);
    background: linear-gradient(180deg, rgba(20,22,26,0.98) 0%, rgba(15,16,19,0.98) 100%);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    box-shadow: 0 18px 44px var(--shadow);
}

.legal-document h1 {
    margin-bottom: 16px;
    color: #fff;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    line-height: 0.98;
}

.legal-document h2 {
    margin: 30px 0 10px;
    padding-top: 18px;
    color: #fff;
    border-top: 1px solid var(--border-soft);
    font-size: 1.25rem;
}

.legal-document p {
    color: var(--text-muted);
    line-height: 1.7;
}

.legal-document p + p {
    margin-top: 12px;
}

@media (max-width: 1040px) {
    .portal-topbar,
    .login-panel,
    .staff-hero,
    .staff-tools {
        grid-template-columns: 1fr;
    }

    .portal-topbar,
    .staff-hero {
        align-items: stretch;
        display: flex;
        flex-direction: column;
    }

    .portal-links,
    .portal-account {
        justify-self: start;
        justify-content: flex-start;
    }

    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .auth-highlights {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .portal-shell {
        padding: 16px;
    }

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

    .portal-links,
    .portal-links a,
    .portal-account,
    .discord-login,
    .logout-link,
    .ghost-button,
    .account-chip,
    select,
    .editor-actions button {
        width: 100%;
    }

    .panel-head,
    .editor-actions {
        align-items: stretch;
        flex-direction: column;
    }
}
