:root {
    --site-bg: #f3f3f3;
    --site-surface: #ffffff;
    --site-surface-soft: #fafafa;
    --site-surface-raised: #fbfbfb;
    --site-text: #1f1f1f;
    --site-muted: #5f5f5f;
    --site-border: #e5e5e5;
    --site-border-strong: #d1d1d1;
    --site-primary: #005fb8;
    --site-primary-hover: #0f6cbd;
    --site-danger: #c42b1c;
    --site-success: #107c10;
    --site-warning: #f7630c;
    --site-radius: 8px;
    --site-radius-sm: 6px;
    --site-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    --site-font: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

body[data-theme="dark"] {
    --site-bg: #202020;
    --site-surface: #2b2b2b;
    --site-surface-soft: #252525;
    --site-surface-raised: #303030;
    --site-text: #f3f3f3;
    --site-muted: #d6d6d6;
    --site-border: #3a3a3a;
    --site-border-strong: #505050;
    --site-primary: #60cdff;
    --site-primary-hover: #8addff;
    --site-shadow: none;
}

body.public-theme,
body.portal-theme,
body.admin-theme {
    background:
        radial-gradient(circle at top left, rgba(0, 95, 184, 0.07), transparent 30rem),
        var(--site-bg) !important;
    color: var(--site-text);
    font-family: var(--site-font);
    letter-spacing: 0;
}

body[data-theme="dark"],
body[data-theme="dark"] p,
body[data-theme="dark"] span,
body[data-theme="dark"] small,
body[data-theme="dark"] label,
body[data-theme="dark"] li,
body[data-theme="dark"] td,
body[data-theme="dark"] th,
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] h4,
body[data-theme="dark"] h5,
body[data-theme="dark"] h6 {
    color: var(--site-text) !important;
}

body[data-theme="dark"] a {
    color: #8addff;
}

body[data-theme="dark"] a:hover {
    color: #b8ecff;
}

.card,
.modal-content,
.dropdown-menu,
.offcanvas,
.list-group-item {
    background: var(--site-surface);
    border-color: var(--site-border);
    border-radius: var(--site-radius);
}

.card {
    box-shadow: var(--site-shadow);
}

.card-header {
    background: var(--site-surface-soft);
    border-bottom-color: var(--site-border);
    font-weight: 600;
}

.btn {
    border-radius: var(--site-radius-sm);
    font-weight: 600;
}

.btn-primary {
    background: var(--site-primary);
    border-color: var(--site-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--site-primary-hover);
    border-color: var(--site-primary-hover);
}

.btn-outline-secondary,
.theme-toggle-btn {
    background: var(--site-surface-raised);
    border-color: var(--site-border-strong);
    color: var(--site-text);
}

.form-control,
.form-select,
.input-group-text {
    background: var(--site-surface);
    color: var(--site-text);
    border-color: var(--site-border-strong);
    border-radius: var(--site-radius-sm);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--site-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-primary) 22%, transparent);
}

.table {
    color: var(--site-text);
    border-color: var(--site-border);
}

.table thead th {
    background: var(--site-surface-soft);
    color: var(--site-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.text-muted {
    color: var(--site-muted) !important;
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .modal-content,
body[data-theme="dark"] .dropdown-menu,
body[data-theme="dark"] .offcanvas,
body[data-theme="dark"] .table,
body[data-theme="dark"] .list-group-item {
    background: var(--site-surface);
    color: var(--site-text);
    border-color: var(--site-border);
}

body[data-theme="dark"] .table {
    --bs-table-bg: var(--site-surface);
    --bs-table-color: var(--site-text);
    --bs-table-striped-bg: #242424;
    --bs-table-striped-color: var(--site-text);
    --bs-table-hover-bg: #333333;
    --bs-table-hover-color: var(--site-text);
    --bs-table-border-color: var(--site-border-strong);
}

body[data-theme="dark"] .table tbody,
body[data-theme="dark"] .table tbody tr,
body[data-theme="dark"] .table tbody td,
body[data-theme="dark"] .table tbody th {
    background-color: var(--bs-table-bg) !important;
    color: var(--site-text) !important;
}

body[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) td,
body[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) th {
    background-color: var(--bs-table-striped-bg) !important;
    color: var(--site-text) !important;
}

body[data-theme="dark"] .table-hover tbody tr:hover td,
body[data-theme="dark"] .table-hover tbody tr:hover th {
    background-color: var(--bs-table-hover-bg) !important;
    color: var(--site-text) !important;
}

body[data-theme="dark"] .navbar-dark .navbar-brand,
body[data-theme="dark"] .navbar-dark .nav-link,
body[data-theme="dark"] .navbar-brand,
body[data-theme="dark"] .nav-link {
    color: var(--site-text) !important;
}

body[data-theme="dark"] .badge.bg-light,
body[data-theme="dark"] .badge.text-dark {
    color: var(--site-text) !important;
    background: #3a3a3a !important;
    border-color: var(--site-border-strong) !important;
}

body[data-theme="dark"] .form-control::placeholder {
    color: #bdbdbd;
}

body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select,
body[data-theme="dark"] .input-group-text {
    background: var(--site-surface-raised) !important;
    color: var(--site-text) !important;
    border-color: var(--site-border-strong) !important;
}

body[data-theme="dark"] .nav-tabs {
    border-bottom-color: var(--site-border-strong);
}

body[data-theme="dark"] .nav-tabs .nav-link {
    background: transparent;
    color: var(--site-text) !important;
    border-color: transparent;
}

body[data-theme="dark"] .nav-tabs .nav-link:hover,
body[data-theme="dark"] .nav-tabs .nav-link:focus {
    background: var(--site-surface-soft);
    border-color: var(--site-border-strong);
}

body[data-theme="dark"] .nav-tabs .nav-link.active,
body[data-theme="dark"] .nav-tabs .nav-item.show .nav-link {
    background: var(--site-surface-raised) !important;
    color: var(--site-text) !important;
    border-color: var(--site-border-strong) var(--site-border-strong) var(--site-surface-raised) !important;
}

body[data-theme="dark"] .nav-pills .nav-link {
    color: var(--site-text) !important;
}

body[data-theme="dark"] .nav-pills .nav-link.active,
body[data-theme="dark"] .nav-pills .show > .nav-link {
    background: #0f6cbd !important;
    color: #ffffff !important;
}

body[data-theme="dark"] .alert {
    color: var(--site-text);
}

body[data-theme="dark"] .bg-white,
body[data-theme="dark"] .bg-light,
body[data-theme="dark"] .table-light,
body[data-theme="dark"] [style*="background:#fff"],
body[data-theme="dark"] [style*="background: #fff"],
body[data-theme="dark"] [style*="background-color:#fff"],
body[data-theme="dark"] [style*="background-color: #fff"],
body[data-theme="dark"] [style*="background:#ffffff"],
body[data-theme="dark"] [style*="background: #ffffff"],
body[data-theme="dark"] [style*="background-color:#ffffff"],
body[data-theme="dark"] [style*="background-color: #ffffff"] {
    color: #1f1f1f !important;
}

body[data-theme="dark"] .bg-white *,
body[data-theme="dark"] .bg-light *,
body[data-theme="dark"] .table-light *,
body[data-theme="dark"] [style*="background:#fff"] *,
body[data-theme="dark"] [style*="background: #fff"] *,
body[data-theme="dark"] [style*="background-color:#fff"] *,
body[data-theme="dark"] [style*="background-color: #fff"] *,
body[data-theme="dark"] [style*="background:#ffffff"] *,
body[data-theme="dark"] [style*="background: #ffffff"] *,
body[data-theme="dark"] [style*="background-color:#ffffff"] *,
body[data-theme="dark"] [style*="background-color: #ffffff"] * {
    color: #1f1f1f !important;
}

body[data-theme="dark"] .bg-white a,
body[data-theme="dark"] .bg-light a,
body[data-theme="dark"] .table-light a,
body[data-theme="dark"] [style*="background:#fff"] a,
body[data-theme="dark"] [style*="background: #fff"] a,
body[data-theme="dark"] [style*="background-color:#fff"] a,
body[data-theme="dark"] [style*="background-color: #fff"] a,
body[data-theme="dark"] [style*="background:#ffffff"] a,
body[data-theme="dark"] [style*="background: #ffffff"] a,
body[data-theme="dark"] [style*="background-color:#ffffff"] a,
body[data-theme="dark"] [style*="background-color: #ffffff"] a {
    color: #005fb8 !important;
}

.theme-toggle-btn {
    min-width: 88px;
}

.auth-shell {
    min-height: calc(100vh - 7rem);
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.auth-panel {
    width: min(100%, 1040px);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
    gap: 1rem;
    align-items: stretch;
}

.auth-hero,
.auth-card {
    border: 1px solid var(--site-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--site-surface) 92%, transparent);
    box-shadow: var(--site-shadow);
}

.auth-hero {
    padding: clamp(1.5rem, 3vw, 2.4rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
}

.auth-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--site-primary) 18%, transparent), transparent 42%),
        radial-gradient(circle at 86% 15%, color-mix(in srgb, var(--site-primary) 16%, transparent), transparent 18rem);
    pointer-events: none;
}

.auth-hero > * {
    position: relative;
    z-index: 1;
}

.auth-eyebrow {
    color: var(--site-primary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.auth-title {
    color: var(--site-text);
    font-size: clamp(1.9rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.08;
    margin: 0.6rem 0 0.85rem;
}

.auth-copy {
    color: var(--site-muted);
    max-width: 35rem;
    font-size: 1rem;
    line-height: 1.6;
}

.auth-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-top: 2rem;
}

.auth-meta-item {
    padding: 0.85rem;
    border: 1px solid var(--site-border);
    border-radius: 10px;
    background: var(--site-surface-raised);
}

.auth-meta-item i {
    color: var(--site-primary);
    display: block;
    margin-bottom: 0.35rem;
}

.auth-meta-item span {
    display: block;
    color: var(--site-text);
    font-size: 0.86rem;
    font-weight: 650;
}

.auth-card {
    padding: clamp(1.25rem, 3vw, 2rem);
}

.auth-card-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.4rem;
}

.auth-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--site-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.auth-card h2 {
    color: var(--site-text);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.auth-card p {
    color: var(--site-muted);
    margin: 0.2rem 0 0;
}

.auth-card .form-control {
    min-height: 46px;
}

.auth-card .btn {
    min-height: 46px;
}

.auth-link-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.9rem;
    flex-wrap: wrap;
}

.auth-link-row a {
    font-weight: 600;
    text-decoration: none;
}

@media (max-width: 860px) {
    .auth-panel {
        grid-template-columns: 1fr;
    }

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