
:root {
    color-scheme: dark;
    --bg: #0b0e14;
    --surface: #121823;
    --surface-hover: #192333;
    --border: #263246;
    --text: #edf2fa;
    --muted: #9baac0;
    --accent: #72a9ff;
    --accent-hover: #91bbff;
    --danger: #ff7777;
    --success: #8fe39a;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-hover);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

button:hover,
.button:hover {
    background: #223149;
    border-color: #405879;
}

button:disabled,
.button-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

button.primary,
.button.primary {
    background: #244a7c;
    border-color: #3969a6;
}

button.primary:hover,
.button.primary:hover {
    background: #2e5c96;
}

button.danger {
    background: #672b32;
    border-color: #8b3944;
}

button.danger:hover {
    background: #80333d;
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0d121b;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    line-height: 1.25;
}

h2 {
    font-size: 1.3rem;
}

.muted {
    color: var(--muted);
}

.portal {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    width: 250px;
    padding: 24px 16px;
    overflow-y: auto;
    background: #0f141e;
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 26px;
    color: var(--text);
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    place-items: center;
    border: 1px solid #36527a;
    border-radius: 12px;
    background: #1a2b43;
    color: var(--accent);
    font-size: 20px;
    font-weight: bold;
}

.brand-name {
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.06em;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.12em;
}

.nav-label {
    padding: 12px 10px 7px;
    color: #7889a1;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 2px 0;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #b9c6d8;
}

.nav-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-link.active {
    border-color: #2c4567;
    background: #1a2a40;
    color: #a9ccff;
}

.nav-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-icon {
    width: 22px;
    text-align: center;
    font-size: 17px;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 20px;
}

.portal-main {
    min-width: 0;
    margin-left: 250px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 76px;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 20, 30, 0.85);
}

.topbar-title {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
}

.topbar-user {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.mobile-menu-button {
    display: none;
}

.page-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.page-heading {
    margin-bottom: 26px;
}

.page-heading p {
    margin-bottom: 0;
    color: var(--muted);
}

.card {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.card h2,
.card h3 {
    margin-bottom: 10px;
}

.card p:last-child {
    margin-bottom: 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat-value {
    display: block;
    margin-top: 8px;
    font-size: 28px;
    font-weight: bold;
    overflow-wrap: anywhere;
}

.stat-icon {
    display: grid;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    place-items: center;
    border: 1px solid #2d4668;
    border-radius: 10px;
    background: #192b43;
    color: var(--accent);
    font-size: 20px;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.action-card .button {
    margin-top: auto;
}

.section-spacing {
    margin-top: 28px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 520px;
}

.form-help {
    margin-top: -10px;
    color: var(--muted);
    font-size: 13px;
}

.message {
    margin: 18px 0;
    padding: 13px 16px;
    overflow-wrap: anywhere;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
}

.message.success {
    border-color: #285b39;
    color: var(--success);
}

.message.error {
    border-color: #69343b;
    color: var(--danger);
}

.danger-zone {
    border-color: #69343b;
}

.danger-zone h2 {
    color: var(--danger);
}

.profile-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.profile-picture {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border: 2px solid var(--border);
    border-radius: 50%;
    object-fit: cover;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    overflow-wrap: anywhere;
}

th {
    color: var(--muted);
    font-size: 12px;
}

code {
    overflow-wrap: anywhere;
}

@media (max-width: 1050px) {
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-content {
        padding: 24px;
    }

    .topbar {
        padding-inline: 24px;
    }
}

@media (max-width: 760px) {
    .sidebar {
        width: min(290px, 86vw);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.35);
    }

    .portal-main {
        margin-left: 0;
    }

    .topbar {
        min-height: 66px;
        padding: 12px 16px;
    }

    .mobile-menu-button {
        display: inline-flex;
        min-width: 42px;
        padding: 8px;
    }

    .page-content {
        padding: 24px 16px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

.file-picker-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.file-picker-label:hover {
    background: var(--surface);
    border-color: var(--accent);
}

.file-picker-label:focus-within {
    outline: 2px solid var(--accent);
}


.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-hover);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.profile-value {
    overflow-wrap: anywhere;
    font-size: clamp(1rem, 2vw, 1.5rem);
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-hover);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.button-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.public-profile-bio {
    margin-top: 20px;
    color: var(--text);
    line-height: 1.7;
    overflow-wrap: anywhere;
    white-space: normal;
}