:root {
    --portal-bg: #f3f6fb;
    --portal-bg-accent: radial-gradient(circle at top, rgba(37, 99, 235, 0.14), transparent 34%);
    --portal-surface: rgba(255, 255, 255, 0.88);
    --portal-surface-strong: #ffffff;
    --portal-border: rgba(148, 163, 184, 0.26);
    --portal-border-strong: rgba(148, 163, 184, 0.38);
    --portal-text: #172033;
    --portal-muted: #5f6f86;
    --portal-primary: #2563eb;
    --portal-primary-strong: #1d4ed8;
    --portal-secondary: #0f172a;
    --portal-success: #198754;
    --portal-warning: #f59e0b;
    --portal-danger: #dc3545;
    --portal-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
    --portal-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
    --portal-radius: 1.15rem;
    --portal-radius-sm: 0.85rem;
}

html {
    height: 100%;
    min-height: 100%;
}

body.portal-body,
body.auth-body {
    min-height: 100vh;
    margin: 0;
    color: var(--portal-text);
    background:
        var(--portal-bg-accent),
        linear-gradient(180deg, #f8fbff 0%, var(--portal-bg) 52%, #edf2f9 100%);
}

body.portal-body {
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 100vh;
    min-height: 100dvh;
}

body {
    font-feature-settings: "liga" 1, "kern" 1;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--portal-primary);
    text-decoration: none;
}

a:hover,
a:focus {
    color: var(--portal-primary-strong);
}

.portal-shell {
    position: relative;
    width: 100%;
}

.portal-navbar,
.auth-card,
.panel,
.jumbotron,
.table,
.portal-card,
.portal-surface {
    background: var(--portal-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.portal-navbar {
    border: 1px solid var(--portal-border);
    border-radius: calc(var(--portal-radius) + 0.1rem);
    box-shadow: var(--portal-shadow-soft);
    padding: 0.85rem 1.1rem;
}

.portal-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.7rem;
    background: linear-gradient(135deg, var(--portal-primary) 0%, #60a5fa 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.portal-navbar-logo {
    max-height: 2.35rem;
    width: auto;
    object-fit: contain;
}

.navbar-brand {
    font-weight: 700;
    color: var(--portal-secondary);
}

.navbar-brand:hover,
.navbar-brand:focus {
    color: var(--portal-primary-strong);
}

.portal-navbar .nav-link {
    border-radius: 999px;
    color: var(--portal-muted);
    font-weight: 600;
    padding: 0.65rem 0.95rem;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.portal-navbar .nav-link:hover,
.portal-navbar .nav-link:focus,
.portal-navbar .nav-link.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--portal-primary-strong);
}

.portal-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.alert {
    border: 0;
    border-radius: 1rem;
    box-shadow: var(--portal-shadow-soft);
}

.alert-info {
    color: #0c5460;
    background: #e9f8fb;
}

.jumbotron,
.panel {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow-soft);
}

.jumbotron {
    padding: clamp(1.75rem, 4vw, 3rem);
    margin-bottom: 1.5rem;
}

.jumbotron h1,
.jumbotron h2 {
    font-weight: 700;
    margin-top: 0;
}

.panel-heading {
    border-bottom: 1px solid var(--portal-border);
    padding: 1.25rem 1.5rem 0.95rem;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.panel-body {
    padding: 1.4rem 1.5rem 1.5rem;
}

.table {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    overflow: hidden;
    box-shadow: var(--portal-shadow-soft);
    margin-bottom: 1.5rem;
}

.table > :not(caption) > * > * {
    padding: 0.95rem 1rem;
    vertical-align: middle;
    border-bottom-color: rgba(226, 232, 240, 0.85);
}

.table > thead {
    background: rgba(226, 232, 240, 0.42);
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(37, 99, 235, 0.04);
}

tr.success > td,
tr.success > th {
    background-color: rgba(25, 135, 84, 0.09) !important;
}

tr.danger > td,
tr.danger > th {
    background-color: rgba(220, 53, 69, 0.08) !important;
}

.table-scrollable {
    overflow: auto;
    max-height: 22rem;
    border-radius: 1rem;
}

.btn {
    border-radius: 0.9rem;
    font-weight: 600;
    padding: 0.7rem 1.05rem;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--portal-primary) 0%, #3b82f6 100%);
    border-color: transparent;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--portal-primary-strong) 0%, var(--portal-primary) 100%);
    border-color: transparent;
}

.btn-success {
    background: linear-gradient(135deg, #0f9f69 0%, #34d399 100%);
    border-color: transparent;
}

.btn-info,
.btn-default {
    background: #eef4ff;
    border-color: rgba(59, 130, 246, 0.18);
    color: var(--portal-primary-strong);
}

.btn-danger {
    background: #fff1f2;
    border-color: rgba(220, 53, 69, 0.18);
    color: #be123c;
}

.btn-xs {
    padding: 0.38rem 0.7rem;
    font-size: 0.8125rem;
    border-radius: 0.75rem;
}

.btn-lg {
    padding: 0.9rem 1.25rem;
}

.form-control,
.form-select {
    min-height: 3rem;
    border: 1px solid var(--portal-border-strong);
    border-radius: 0.95rem;
    padding: 0.75rem 0.95rem;
    background-color: rgba(255, 255, 255, 0.92);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.12);
}

textarea.form-control {
    min-height: 8rem;
}

.form-group {
    margin-bottom: 1rem;
}

.label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.label-success {
    background: rgba(25, 135, 84, 0.12);
    color: #146c43;
}

.label-info {
    background: rgba(13, 202, 240, 0.14);
    color: #055160;
}

.label-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #92400e;
}

.label-danger {
    background: rgba(220, 53, 69, 0.12);
    color: #b02a37;
}

.nav-pills,
.nav-tabs {
    gap: 0.65rem;
    border-bottom: 0;
    margin-bottom: 1rem;
}

.nav-pills > li,
.nav-tabs > li {
    float: none;
    display: inline-flex;
}

.nav-pills > li > a,
.nav-tabs > li > a,
.nav-link.tab-link {
    border: 0;
    border-radius: 999px;
    color: var(--portal-muted);
    font-weight: 600;
    padding: 0.65rem 0.95rem;
    background: rgba(255, 255, 255, 0.75);
}

.nav-pills > li.active > a,
.nav-tabs > li.active > a,
.nav-pills > li > a:hover,
.nav-tabs > li > a:hover,
.nav-link.tab-link.active,
.nav-link.tab-link:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--portal-primary-strong);
}

.tab-content > .tab-pane {
    display: none;
}

.tab-content > .active,
.tab-content > .show.active {
    display: block;
}

.checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 500;
}

.checkbox input[type="checkbox"] {
    margin: 0;
}

.center,
td.centered {
    text-align: center;
}

.left {
    text-align: left;
}

.pull-right {
    float: right !important;
}

.pull-left {
    float: left !important;
}

.portal-card {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow-soft);
    padding: 1.5rem;
}

.home-tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    min-height: 18rem;
}

.home-tile h3 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}

.home-tile p {
    flex: 1 1 auto;
    margin-bottom: 0;
    min-height: 4.8em;
}

.home-tile i {
    color: var(--portal-primary-strong);
}

.payment-tile .payment-logo {
    width: min(100%, 16rem);
    height: 4rem;
    object-fit: contain;
    margin: 0 auto;
}

.portal-footer {
    align-self: end;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

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

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: min(100%, 70rem);
    border: 1px solid var(--portal-border);
    border-radius: 1.5rem;
    box-shadow: var(--portal-shadow);
    overflow: hidden;
}

.auth-compact {
    max-width: 30rem;
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.auth-login-grid {
    grid-template-columns: 20px minmax(0, 1fr);
}

.auth-aside {
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.36), transparent 40%),
        linear-gradient(145deg, #172554 0%, #1d4ed8 48%, #3b82f6 100%);
    color: #eff6ff;
    padding: 2.4rem;
}

.auth-login-accent {
    min-height: 100%;
    padding: 0;
}

.auth-aside h1,
.auth-aside h2,
.auth-content h1,
.auth-content h2 {
    font-weight: 700;
}

.auth-aside p {
    color: rgba(239, 246, 255, 0.8);
}

.auth-content {
    padding: 2.4rem;
}

.auth-logo {
    max-height: 7rem;
    width: auto;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.4rem;
}

.auth-brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.auth-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
}

.auth-list li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.9rem;
}

.auth-list i {
    font-size: 1rem;
}

.auth-section-title {
    margin-bottom: 0.35rem;
}

.auth-subtitle {
    color: var(--portal-muted);
    margin-bottom: 1.5rem;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--portal-muted);
    font-weight: 600;
}

.item {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    box-shadow: var(--portal-shadow-soft);
}

.item-pic {
    width: 2.25rem;
    height: 2.25rem;
    object-fit: cover;
}

.status-stack dt {
    color: var(--portal-muted);
    font-weight: 600;
}

.status-stack dd {
    margin-bottom: 0.8rem;
}

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

    .auth-login-grid {
        grid-template-columns: 20px minmax(0, 1fr);
    }

    .auth-aside,
    .auth-content {
        padding: 1.75rem;
    }

    .auth-login-accent {
        padding: 0;
    }

    .portal-navbar {
        padding: 0.8rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .portal-shell {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .auth-shell {
        padding: 1rem 0.75rem;
    }

    .auth-aside,
    .auth-content {
        padding: 1.35rem;
    }

    .auth-login-accent {
        padding: 0;
    }

    .btn,
    .btn-lg {
        width: 100%;
    }

    .pull-right,
    .pull-left {
        float: none !important;
    }
}
