:root {
    --navy-950: #0a1533;
    --navy-900: #0f2049;
    --navy-800: #16305f;
    --navy-700: #1e3c72;
    --ink: #1a2233;
    --muted: #64748b;
    --border: #e4e8f0;
    --bg: #f4f6fb;
    --accent: #3e5c76;
    --accent-dark: #2c4459;
    --accent-soft: #e8eef3;
    --success: #167a56;
    --danger: #b3261e;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

h1, h2, h3, .font-serif {
    font-family: 'Source Serif 4', Georgia, serif;
}

a { color: var(--accent); }

/* ---------- App shell (sidebar layout) ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy-950), var(--navy-800));
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    padding: 1.1rem .8rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    font-size: .92rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: #fff;
    text-decoration: none;
    padding: .65rem .4rem;
    margin-bottom: .4rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.sidebar-brand-logo-chip {
    width: 32px;
    height: 32px;
    background: #fff;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    flex-shrink: 0;
}

.sidebar-brand-logo-chip img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-brand-name {
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    font-family: 'Source Serif 4', Georgia, serif;
    line-height: 1.2;
}

.sidebar-brand-name small {
    display: block;
    color: #94a3b8;
    font-size: .55rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-brand-text strong {
    font-size: 1rem;
    font-family: 'Source Serif 4', Georgia, serif;
}

.sidebar-brand-text small {
    color: #94a3b8;
    font-size: .72rem;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .45rem .6rem;
    border-radius: 7px;
    color: #dbe3f5;
    text-decoration: none;
    font-size: .82rem;
    font-weight: 500;
    border: none;
    border-left: 3px solid transparent;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}

.sidebar-link i { font-size: .92rem; width: 1rem; text-align: center; opacity: .9; }

.sidebar-link:hover {
    background: rgba(255,255,255,.09);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(94, 138, 175, .28);
    border-left-color: #7fb1d9;
    color: #fff;
    font-weight: 700;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-logout { color: #fca5a5; }
.sidebar-logout:hover { background: rgba(252,165,165,.1); color: #fecaca; }

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: .8rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--navy-900);
}

.app-topbar-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
}

.app-topbar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    object-position: center 10%;
}

.sidebar-toggle {
    border: none;
    background: none;
    font-size: 1.25rem;
    color: var(--navy-900);
    margin-right: .5rem;
}

.app-content {
    padding: 1.5rem;
    flex: 1;
    font-size: .92rem;
}

.app-alert {
    display: flex;
    align-items: center;
    gap: .6rem;
    border: none;
    border-radius: 10px;
}

/* ---------- Cards & panels ---------- */

.panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.panel-body { padding: 1.15rem; }

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.15rem;
    flex-wrap: wrap;
    gap: .6rem;
}

.page-heading h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy-900);
    margin: 0;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.05rem;
    display: flex;
    align-items: center;
    gap: .8rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.stat-card-icon.blue { background: var(--accent-soft); color: var(--accent); }
.stat-card-icon.teal { background: #e4f7f1; color: var(--success); }

.stat-card-label {
    font-size: .7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-weight: 600;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy-900);
    line-height: 1.1;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--navy-900);
    text-decoration: none;
    font-weight: 600;
    font-size: .8rem;
    transition: all .15s ease;
}

.quick-action:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.quick-action.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.quick-action.primary:hover { background: var(--accent-dark); color: #fff; }

.section-title {
    font-size: .88rem;
    font-weight: 700;
    color: var(--navy-900);
    margin-bottom: .75rem;
}

/* ---------- Tables ---------- */

.table-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table-clean {
    margin-bottom: 0;
}

.table-clean thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 700;
    padding: .65rem 1rem;
}

.table-clean tbody td {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: .85rem;
}

.table-clean tbody tr:last-child td { border-bottom: none; }
.table-clean tbody tr:hover { background: #fafbff; }

.badge-theme {
    display: inline-block;
    padding: .22rem .55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: .7rem;
    font-weight: 600;
}

.text-empty { color: var(--muted); font-style: italic; }

.pdf-viewer {
    width: 100%;
    height: 80vh;
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0 0 12px 12px;
}

/* ---------- Forms ---------- */

.form-label { font-weight: 600; font-size: .8rem; color: var(--navy-900); }

.form-control, .form-select {
    border-radius: 7px;
    border-color: var(--border);
    padding: .45rem .7rem;
    font-size: .88rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
    border-radius: 7px;
    font-weight: 600;
    font-size: .82rem;
    padding: .45rem .9rem;
}

.btn-sm {
    font-size: .76rem;
    padding: .3rem .65rem;
}

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

.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-dark { background: var(--navy-900); border-color: var(--navy-900); }
.btn-dark:hover { background: var(--navy-950); border-color: var(--navy-950); }

/* ---------- Guest / auth pages (split-screen brand layout) ---------- */

:root {
    --mhf-maroon: #7c1a2c;
    --mhf-navy: #0f2049;
    --mhf-navy-2: #16305f;
    --mhf-gray: #6b7280;
}

.guest-body { min-height: 100vh; background: #fff; }

.split-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
    .split-page { grid-template-columns: 1fr; }
    .split-navy-panel { min-height: 320px; }
}

.split-panel-light {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.25rem 3.25rem;
    background: linear-gradient(180deg, #ffffff, #f4f6fb);
}

.split-logo { max-width: 175px; margin-bottom: 1.75rem; }

.brand-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--mhf-maroon);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.split-panel-light h1 {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--mhf-navy);
    line-height: 1.15;
    margin-bottom: 1rem;
}

.split-panel-light .lede {
    color: var(--mhf-gray);
    font-size: .92rem;
    line-height: 1.55;
    max-width: 420px;
    margin-bottom: 1.5rem;
}

.btn-maroon {
    background: var(--mhf-maroon);
    border-color: var(--mhf-maroon);
    color: #fff;
    padding: .55rem 1.2rem;
    font-weight: 700;
    font-size: .88rem;
}

.btn-maroon:hover { background: #631523; border-color: #631523; color: #fff; }

.btn-outline-navy {
    border: 1px solid #d7dce6;
    color: var(--mhf-navy);
    background: #fff;
    padding: .55rem 1.2rem;
    font-weight: 700;
    font-size: .88rem;
}

.btn-outline-navy:hover { background: #f4f6fb; color: var(--mhf-navy); }

.or-divider {
    display: flex;
    align-items: center;
    gap: .85rem;
    color: var(--mhf-gray);
    font-size: .78rem;
    margin: .85rem 0;
    max-width: 380px;
}

.or-divider::before, .or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.secure-note {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin-top: 1.15rem;
    max-width: 380px;
}

.secure-note i { font-size: 1.15rem; color: var(--mhf-navy); }
.secure-note strong { display: block; color: var(--mhf-navy); font-size: .85rem; }
.secure-note span { color: var(--mhf-gray); font-size: .78rem; }

.split-navy-panel {
    position: relative;
    background: linear-gradient(160deg, var(--mhf-navy-2), var(--mhf-navy) 70%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.split-navy-panel svg { position: absolute; opacity: .5; }

/* Login page: split navy on the left, stacked white logo strip + promo content */
.login-left {
    display: flex;
    flex-direction: column;
}

.login-left-logo {
    background: #fff;
    padding: 1.5rem 2rem;
}

.login-left-logo img { max-width: 140px; }

.login-left-promo {
    flex: 1;
    background: linear-gradient(160deg, var(--mhf-navy-2), var(--mhf-navy) 75%);
    color: #fff;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-left-promo svg { position: absolute; opacity: .5; }

.login-left-promo .content { position: relative; z-index: 1; }

.login-left-promo h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: .75rem;
}

.login-left-promo p {
    color: #c3ccdf;
    font-size: .88rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    max-width: 380px;
}

.feature-row {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 1.25rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    font-size: .64rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #cbd5e1;
    font-weight: 700;
}

.feature-item i { font-size: 1.15rem; color: #fff; }

.login-right {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f6fb;
    padding: 1.5rem;
}

.auth-card {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 360px;
    padding: 1.85rem;
    box-shadow: 0 20px 45px rgba(15, 32, 73, .12);
}

.auth-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--mhf-maroon);
    color: var(--mhf-maroon);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin: 0 auto .85rem;
}

.auth-card h1 {
    font-size: 1.25rem;
    font-weight: 800;
    text-align: center;
    color: var(--mhf-navy);
    margin-bottom: .3rem;
}

.auth-card .subtext {
    text-align: center;
    color: var(--mhf-gray);
    font-size: .8rem;
    margin-bottom: 1.35rem;
}

.input-icon-group {
    position: relative;
}

.input-icon-group i {
    position: absolute;
    left: .9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa4b8;
}

.input-icon-group input {
    padding-left: 2.5rem;
}

.input-icon-group .toggle-password {
    position: absolute;
    right: .9rem;
    left: auto;
    cursor: pointer;
    background: none;
    border: none;
    color: #9aa4b8;
}

.guest-footer {
    text-align: center;
    color: var(--mhf-gray);
    font-size: .8rem;
    margin-top: 1.5rem;
}

.guest-footer strong { color: var(--mhf-maroon); display: block; }

@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 40;
        transition: left .2s ease;
        box-shadow: 0 0 0 100vmax rgba(0,0,0,0);
    }
    .sidebar-open .sidebar { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .app-content { padding: 1.25rem; }
    .app-topbar { padding: 1rem 1.25rem; }
}

@media print {
    .no-print, .app-topbar, .sidebar { display: none !important; }
    .app-content { padding: 0; }
    .app-shell { display: block; }
}
