:root {
    --navy-900: #0a1526;
    --navy-800: #0f1f35;
    --navy-700: #16283f;
    --navy-600: #22374f;
    --emerald: #10b981;
    --emerald-dark: #059669;
    --gold: #d4af37;
    --danger: #dc2626;
    --warning: #f59e0b;
    --surface: #f5f7fb;
    --surface-card: #ffffff;
    --text-primary: #0f1f35;
    --text-muted: #64748b;
    --border-color: #e4e9f2;

    --bs-body-bg: var(--surface);
    --bs-body-color: var(--text-primary);
    --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --bs-primary: var(--emerald);
    --bs-primary-rgb: 16, 185, 129;
    --bs-link-color: var(--emerald-dark);
    --bs-link-hover-color: var(--navy-800);
    --bs-border-radius: 0.5rem;
    --bs-border-radius-lg: 0.75rem;
}

body {
    font-family: var(--bs-body-font-family);
}

h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 {
    font-weight: 600;
    color: var(--navy-800);
}

/* Buttons */
.btn-primary {
    background-color: var(--emerald);
    border-color: var(--emerald);
    font-weight: 500;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--emerald-dark);
    border-color: var(--emerald-dark);
}
.btn-outline-secondary {
    color: var(--navy-700);
    border-color: var(--border-color);
}
.btn-outline-secondary:hover {
    background-color: var(--navy-800);
    border-color: var(--navy-800);
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: 0 1px 2px rgba(15, 31, 53, 0.04);
}
.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--navy-800);
}

/* Stat cards */
.stat-card {
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius-lg);
    background: #fff;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 31, 53, 0.04);
}
.stat-card .stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}
.stat-card .stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--navy-800);
    margin-top: 0.2rem;
}
.stat-card.accent-emerald { border-top: 3px solid var(--emerald); }
.stat-card.accent-gold { border-top: 3px solid var(--gold); }
.stat-card.accent-navy { border-top: 3px solid var(--navy-700); }

/* Tables */
.table thead th {
    background-color: var(--navy-800);
    color: #fff;
    font-weight: 500;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: none;
    vertical-align: middle;
}
.table-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 31, 53, 0.04);
}
.table-card table {
    margin-bottom: 0;
}
.table > :not(caption) > * > * {
    padding: 0.65rem 1rem;
}

/* Badges */
.badge-status {
    font-weight: 500;
    padding: 0.35em 0.7em;
    border-radius: 999px;
}

/* App shell */
.app-shell {
    min-height: 100vh;
    display: flex;
}
.app-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
}
.app-sidebar .brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.app-sidebar .brand a {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.app-sidebar .brand small {
    display: block;
    color: var(--gold);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.15rem;
}
.app-sidebar .nav {
    padding: 0.75rem 0.75rem;
    flex: 1;
}
.app-sidebar .nav-link {
    color: #b7c2d0;
    border-radius: 0.5rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-left: 3px solid transparent;
    margin-bottom: 0.15rem;
}
.app-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.app-sidebar .nav-link.active {
    background: rgba(16, 185, 129, 0.15);
    color: #fff;
    border-left-color: var(--gold);
    font-weight: 500;
}
.app-sidebar .sidebar-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem;
    color: #93a3b8;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.app-topbar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.9rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.app-topbar .page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--navy-800);
    margin: 0;
}
.app-content {
    padding: 1.75rem;
    flex: 1;
}

/* Auth (login / access denied / landing) layout */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, var(--navy-700), var(--navy-900) 65%);
    padding: 1.5rem;
}
.auth-card {
    background: #fff;
    border-radius: var(--bs-border-radius-lg);
    box-shadow: 0 20px 45px rgba(10, 21, 38, 0.35);
    width: 100%;
    max-width: 420px;
    padding: 2.25rem 2rem;
}
.auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-brand .brand-title {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--navy-800);
}
.auth-brand .brand-rule {
    width: 42px;
    height: 3px;
    background: var(--gold);
    margin: 0.6rem auto 0;
    border-radius: 2px;
}

.form-label {
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--navy-700);
}
.form-control:focus, .form-select:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 0.2rem rgba(16, 185, 129, 0.15);
}

fieldset.form-section {
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius-lg);
    padding: 1.1rem 1.25rem 0.6rem;
    margin-bottom: 1.25rem;
}
fieldset.form-section legend {
    float: none;
    width: auto;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--navy-800);
    padding: 0 0.4rem;
    margin-bottom: 0.75rem;
}
