/* ============================================================
   Portal — Enterprise theme
   Neutral grayscale + restrained indigo accent.
   Layered on top of Bootstrap 5.
   ============================================================ */

:root {
    /* Surface */
    --bg:           #F8FAFC;
    --surface:      #FFFFFF;
    --surface-2:    #F1F5F9;
    --surface-3:    #E2E8F0;

    /* Border */
    --border:        #E2E8F0;
    --border-strong: #CBD5E1;

    /* Text */
    --text:        #0F172A;
    --text-soft:   #334155;
    --text-mute:   #64748B;
    --text-faint:  #94A3B8;
    --text-on-dark: #F8FAFC;

    /* Accent — indigo */
    --accent:       #4F46E5;
    --accent-hover: #4338CA;
    --accent-tint:  #EEF2FF;
    --accent-wash:  #F5F3FF;

    /* Status */
    --success:      #16A34A;
    --success-tint: #DCFCE7;
    --danger:       #DC2626;
    --danger-tint:  #FEE2E2;
    --warning:      #B45309;
    --warning-tint: #FEF3C7;
    --info:         #0369A1;
    --info-tint:    #E0F2FE;

    /* Type */
    --font-ui:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    /* Rhythm */
    --r-1: 4px;  --r-2: 8px;  --r-3: 12px; --r-4: 16px;
    --r-5: 20px; --r-6: 24px; --r-7: 32px; --r-8: 48px;

    /* Radii */
    --radius-sm: 4px;
    --radius:    6px;
    --radius-lg: 8px;
    --radius-pill: 999px;

    /* Shadows */
    --shadow-xs: 0 1px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);

    /* Focus */
    --focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

/* ============================================================
   Page foundation
   ============================================================ */

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

::selection { background: var(--accent-tint); color: var(--text); }

/* ============================================================
   Typography
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-ui);
    color: var(--text);
    letter-spacing: -0.01em;
    font-weight: 600;
    line-height: 1.25;
}

h1 { font-size: 1.875rem; font-weight: 600; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p { color: var(--text-soft); }

.mono {
    font-family: var(--font-mono);
    font-feature-settings: "tnum";
    font-size: 0.85em;
}

/* Used in many places as a small uppercase label */
.section-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin-bottom: 8px;
}

/* ============================================================
   Navbar
   ============================================================ */

.navbar {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border);
    padding: 0 !important;
    margin-bottom: var(--r-6) !important;
    height: 56px;
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1400px;
    width: 100%;
    padding: 0 var(--r-4);
}
.navbar-brand {
    font-size: 0.95rem;
    color: var(--text) !important;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin: 0;
}
.navbar-brand::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #7C3AED);
}
.navbar-brand .brand-tag {
    font-size: 0.78rem;
    color: var(--text-mute);
    font-weight: 500;
    margin-left: 2px;
    border-left: 1px solid var(--border);
    padding-left: 10px;
}
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-direction: row;
}
.navbar-nav .nav-item.nav-link,
.navbar .nav-item.nav-link {
    color: var(--text-soft) !important;
    font-size: 0.85rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.navbar-nav .nav-item.nav-link strong {
    color: var(--text);
    font-weight: 500;
}

/* ============================================================
   Login
   ============================================================ */

.auth-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--r-7) var(--r-4) var(--r-8);
}
.auth-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
    gap: var(--r-8);
    align-items: center;
}
.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
    margin-bottom: var(--r-6);
}
.auth-logo::before {
    content: "";
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), #7C3AED);
}
.auth-logo span { color: var(--text-mute); font-weight: 500; }

.auth-hero .lede h1 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    margin: 0 0 var(--r-3);
    line-height: 1.15;
    max-width: 18ch;
}
.auth-sub {
    color: var(--text-mute);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 44ch;
    margin: 0;
}

.auth-ticket-wrap { width: 100%; }
.auth-ticket {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.auth-ticket-body {
    padding: var(--r-6);
}
.auth-ticket-body .title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.auth-ticket-body .ledein {
    font-size: 0.875rem;
    color: var(--text-mute);
    margin: 0 0 var(--r-5);
}
.auth-divider {
    text-align: center;
    margin: var(--r-4) 0;
    font-size: 0.75rem;
    color: var(--text-faint);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: calc(50% - 22px);
    height: 1px;
    background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

@media (max-width: 900px) {
    .auth-hero { grid-template-columns: 1fr; gap: var(--r-6); }
}

/* Sign-in card (generic) */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: var(--r-3) var(--r-5);
}
.card-header h4, .card-header h5 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.card-body {
    padding: var(--r-5);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25;
    border-radius: var(--radius);
    padding: 7px 14px;
    border: 1px solid transparent;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
    box-shadow: none !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring) !important; }

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

.btn-outline-secondary, .btn-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-outline-secondary:hover, .btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-outline-primary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-outline-primary:hover {
    background: var(--accent-tint);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.btn-outline-light {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text) !important;
}
.btn-outline-light:hover {
    background: var(--surface-2);
    color: var(--text) !important;
}

.btn-success, .btn-outline-success {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--success);
}
.btn-success:hover, .btn-outline-success:hover {
    background: var(--success-tint);
    border-color: var(--success);
    color: var(--success);
}

.btn-danger, .btn-outline-danger {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--danger);
}
.btn-danger:hover, .btn-outline-danger:hover {
    background: var(--danger-tint);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-warning, .btn-outline-warning {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--warning);
}
.btn-warning:hover, .btn-outline-warning:hover {
    background: var(--warning-tint);
    border-color: var(--warning);
    color: var(--warning);
}

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* Google sign-in */
.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--text);
    color: #fff;
    border: 1px solid var(--text);
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background 120ms ease;
}
.btn-google:hover {
    background: #1E293B;
    color: #fff;
}
.btn-google .domain {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
    margin-left: 4px;
}
.btn-google .arr {
    font-size: 1rem;
    transition: transform 200ms ease;
}
.btn-google:hover .arr { transform: translateX(2px); }

/* ============================================================
   Forms
   ============================================================ */

.form-label {
    font-size: 0.8rem;
    color: var(--text-soft);
    font-weight: 500;
    margin-bottom: 6px;
    letter-spacing: 0;
    text-transform: none;
}
.form-control, .form-select {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 7px 10px;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--text);
    box-shadow: none !important;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    width: 100%;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    background: var(--surface);
    outline: none;
    box-shadow: var(--focus-ring) !important;
    color: var(--text);
}
.form-control::placeholder { color: var(--text-faint); }
textarea.form-control { padding: 8px 10px; line-height: 1.5; }

.form-check-input {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    width: 1rem;
    height: 1rem;
    margin-top: 0.18em;
}
.form-check-input:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.form-check-input:focus { box-shadow: var(--focus-ring) !important; }
.form-check-label { color: var(--text); font-size: 0.875rem; }

/* ============================================================
   Alerts
   ============================================================ */

.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    padding: 10px 14px;
    font-size: 0.875rem;
}
.alert-info     { background: var(--info-tint);    border-color: rgba(3, 105, 161, 0.2); color: #075985; }
.alert-success  { background: var(--success-tint); border-color: rgba(22, 163, 74, 0.25); color: #14532D; }
.alert-danger   { background: var(--danger-tint);  border-color: rgba(220, 38, 38, 0.25); color: #7F1D1D; }
.alert-warning  { background: var(--warning-tint); border-color: rgba(180, 83, 9, 0.25); color: #78350F; }

/* ============================================================
   Sidebar
   ============================================================ */

.main-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--r-4);
    display: grid !important;
    grid-template-columns: 220px 1fr;
    gap: var(--r-7);
    min-height: calc(100vh - 120px);
}

.sidebar {
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    width: auto !important;
    height: fit-content;
    position: sticky;
    top: 16px;
}
.sidebar-brand {
    color: var(--text-mute) !important;
    font-size: 0.7rem !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 0 !important;
    padding: 0 8px var(--r-2) !important;
    margin: 0 0 4px !important;
    font-weight: 600 !important;
    background: transparent !important;
}

.sidebar .nav-item { margin: 1px 0 !important; }
.sidebar .nav-link {
    color: var(--text-soft) !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px 10px !important;
    border-radius: var(--radius) !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: background 120ms ease, color 120ms ease;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.sidebar .nav-link:hover {
    color: var(--text) !important;
    background: var(--surface-2) !important;
}
.sidebar .nav-link.active {
    color: var(--text) !important;
    background: var(--surface-3) !important;
    font-weight: 600;
}

/* ============================================================
   Dashboard hero
   ============================================================ */

.dash-hero {
    margin-bottom: var(--r-6);
}
.dash-hero-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--r-4);
    flex-wrap: wrap;
}
.dash-hero-greet {
    font-size: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--text);
    margin: 0 0 6px;
    font-weight: 600;
}
.dash-hero-sub {
    font-size: 0.9rem;
    color: var(--text-mute);
    margin: 0;
    max-width: 60ch;
    line-height: 1.5;
}
.dash-hero-sub strong { color: var(--text); font-weight: 600; }
.dash-hero-date {
    font-size: 0.8rem;
    color: var(--text-mute);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: var(--radius-pill);
}

/* ============================================================
   Dashboard stat strip — KPI cards
   ============================================================ */

.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--r-3);
    margin-bottom: var(--r-6);
}
.dash-stat {
    padding: var(--r-4) var(--r-4) var(--r-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.dash-stat:hover {
    border-color: var(--border-strong);
}
.dash-stat .label {
    font-size: 0.75rem;
    color: var(--text-mute);
    font-weight: 500;
}
.dash-stat .figure {
    font-family: var(--font-ui);
    font-feature-settings: "tnum", "lnum";
    font-size: 1.75rem;
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: var(--text);
    font-weight: 600;
}
.dash-stat .unit {
    font-size: 0.78rem;
    color: var(--text-mute);
    margin-top: -2px;
}
.dash-stat-cta {
    background: var(--text);
    border-color: var(--text);
}
.dash-stat-cta .label { color: rgba(248, 250, 252, 0.65); }
.dash-stat-cta .cta-link {
    font-size: 0.95rem;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    transition: gap 200ms ease;
}
.dash-stat-cta .cta-link .arr { transition: transform 200ms ease; }
.dash-stat-cta .cta-link:hover { color: #fff; }
.dash-stat-cta .cta-link:hover .arr { transform: translateX(3px); }

/* ============================================================
   Next-leave callout
   ============================================================ */

.next-leave {
    margin-bottom: var(--r-6);
    padding: var(--r-4) var(--r-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}
.next-leave .section-label { color: var(--accent); margin-bottom: 10px; }
.next-leave-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--r-5);
    align-items: center;
}
.next-leave-when {
    text-align: center;
    padding: var(--r-3) var(--r-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    min-width: 80px;
}
.next-leave-when .day {
    font-feature-settings: "tnum", "lnum";
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text);
    letter-spacing: -0.02em;
    font-weight: 600;
    font-family: var(--font-ui);
}
.next-leave-when .month {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-top: 4px;
    font-weight: 600;
    font-family: var(--font-ui);
}
.next-leave-body h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text);
}
.next-leave-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-mute);
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font-mono);
}
.next-leave-count {
    text-align: right;
    padding-left: var(--r-4);
    border-left: 1px solid var(--border);
}
.next-leave-count .figure {
    font-feature-settings: "tnum", "lnum";
    font-size: 1.75rem;
    line-height: 1;
    color: var(--accent);
    letter-spacing: -0.02em;
    display: block;
    font-weight: 600;
    font-family: var(--font-ui);
}
.next-leave-count .unit {
    font-size: 0.72rem;
    color: var(--text-mute);
    margin-top: 4px;
    display: block;
}

@media (max-width: 900px) {
    .dash-stats { grid-template-columns: repeat(2, 1fr); }
    .next-leave-row {
        grid-template-columns: auto 1fr;
        gap: var(--r-3);
    }
    .next-leave-count {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: var(--r-3);
        text-align: left;
    }
}

/* ============================================================
   Leave balances panel
   ============================================================ */

.dashboard-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: var(--r-6) !important;
}

.leave-balances-section {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xs) !important;
    padding: var(--r-5) !important;
}
.leave-balances-title {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: var(--text) !important;
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 0 var(--r-4) !important;
    letter-spacing: -0.01em;
}

.balance-table {
    width: 100%;
    border-collapse: collapse;
    border-top: 1px solid var(--border);
}
.balance-table thead { display: none; }
.balance-table tr {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr);
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: var(--r-3) 0;
}
.balance-table tr:last-child { border-bottom: 0; }
.balance-table td {
    border: 0 !important;
    padding: 0 !important;
}
.balance-table td:first-child strong {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}
.balance-remaining {
    font-feature-settings: "tnum", "lnum";
    font-size: 1.5rem !important;
    line-height: 1 !important;
    color: var(--text) !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em;
}
.balance-breakdown {
    font-family: var(--font-mono) !important;
    font-size: 0.78rem !important;
    color: var(--text-mute) !important;
    margin-top: 0 !important;
    text-align: right;
}
.balance-used    { color: var(--danger) !important; font-weight: 500 !important; }
.balance-total   { color: var(--text-mute) !important; font-weight: 400 !important; }
.balance-pending { color: var(--warning) !important; font-weight: 500 !important; }

/* ============================================================
   Tables (generic)
   ============================================================ */

.table {
    color: var(--text);
    background: var(--surface);
    margin-bottom: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.table thead th {
    background: var(--surface-2) !important;
    color: var(--text-mute) !important;
    text-transform: none;
    font-size: 0.75rem;
    letter-spacing: 0;
    font-weight: 600;
    border-bottom: 1px solid var(--border) !important;
    padding: 8px 12px !important;
}
.table tbody td {
    border-color: var(--border) !important;
    padding: 10px 12px !important;
    vertical-align: middle;
    font-size: 0.875rem;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
    background: var(--surface-2);
    color: var(--text);
}
.table tbody tr:hover { background: var(--accent-wash) !important; }

.table-responsive {
    border-radius: var(--radius-lg);
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.72rem !important;
    letter-spacing: 0;
    text-transform: none;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-2) !important;
    color: var(--text-soft) !important;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge.status-badge.bg-success, .badge.bg-success {
    background: var(--success-tint) !important;
    color: #14532D !important;
    border-color: rgba(22, 163, 74, 0.25);
}
.badge.status-badge.bg-danger, .badge.bg-danger {
    background: var(--danger-tint) !important;
    color: #7F1D1D !important;
    border-color: rgba(220, 38, 38, 0.25);
}
.badge.status-badge.bg-warning, .badge.bg-warning {
    background: var(--warning-tint) !important;
    color: #78350F !important;
    border-color: rgba(180, 83, 9, 0.25);
}
.badge.status-badge.bg-secondary, .badge.bg-secondary {
    background: var(--surface-2) !important;
    color: var(--text-mute) !important;
    border-color: var(--border);
}
.badge.status-badge.bg-info, .badge.bg-info {
    background: var(--info-tint) !important;
    color: #075985 !important;
    border-color: rgba(3, 105, 161, 0.25);
}
.emergency-badge {
    background: var(--danger) !important;
    color: #fff !important;
    border-color: var(--danger) !important;
}

/* Role pill */
.role-pill {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    padding: 2px 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius-pill);
    color: var(--text-mute);
}
.role-pill.role-hr      { color: #6D28D9; background: #F5F3FF; border-color: rgba(109, 40, 217, 0.2); }
.role-pill.role-manager { color: #0369A1; background: var(--info-tint); border-color: rgba(3, 105, 161, 0.2); }

/* ============================================================
   Calendar tab
   ============================================================ */

.cal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--r-4);
    padding-bottom: var(--r-3);
    border-bottom: 1px solid var(--border);
    gap: var(--r-4);
    flex-wrap: wrap;
}
.cal-title {
    font-size: 1.25rem;
    margin: 0;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}
.cal-title .mono {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text-mute);
    margin-left: 6px;
    font-weight: 400;
}
.cal-nav {
    display: inline-flex;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}
.cal-nav-btn {
    background: transparent;
    border: 0;
    border-right: 1px solid var(--border);
    padding: 5px 12px;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    transition: background 120ms ease;
}
.cal-nav-btn:last-child { border-right: 0; }
.cal-nav-btn:hover { background: var(--surface-2); color: var(--text); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.cal-dh {
    background: var(--surface-2);
    padding: 8px 10px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-mute);
    text-align: left;
    font-weight: 600;
}
.cal-dh-weekend { color: var(--text-faint); }

.cal-day {
    background: var(--surface);
    min-height: 110px;
    padding: 6px 8px 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cal-day.cal-other {
    background: var(--surface-2);
    color: var(--text-faint);
}
.cal-day.cal-weekend { background: var(--surface-2); }
.cal-day.cal-today {
    box-shadow: inset 0 0 0 2px var(--accent);
    background: var(--accent-wash);
}
.cal-day-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-bottom: 2px;
    font-feature-settings: "tnum";
}
.cal-day.cal-other .cal-day-num { color: var(--text-faint); }

.cal-holiday-pill {
    font-size: 0.68rem;
    background: var(--warning-tint);
    color: #78350F;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.cal-leave {
    font-size: 0.72rem;
    background: var(--accent-tint);
    color: var(--accent-hover);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
    font-weight: 500;
}
.cal-leave-half {
    background: repeating-linear-gradient(135deg, var(--accent-tint) 0 6px, transparent 6px 10px);
    border: 1px dashed rgba(79, 70, 229, 0.4);
}

.cal-legend {
    display: flex;
    gap: 16px;
    margin-top: var(--r-3);
    font-size: 0.78rem;
    color: var(--text-mute);
    align-items: center;
}
.cal-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border-radius: var(--radius-sm);
    vertical-align: middle;
}
.cal-legend-leave { background: var(--accent-tint); }
.cal-legend-half  { background: repeating-linear-gradient(135deg, var(--accent-tint) 0 4px, var(--surface) 4px 8px); border: 1px dashed rgba(79, 70, 229, 0.4); }
.cal-legend-ph    { background: var(--warning-tint); }

/* ============================================================
   Section header pattern
   ============================================================ */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--r-4);
    padding-bottom: var(--r-3);
    border-bottom: 1px solid var(--border);
}
.section-head h2 {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
}
.section-head .meta {
    font-size: 0.78rem;
    color: var(--text-mute);
}

/* Generic h3 used as tab titles */
.main-content > div > h3 {
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: var(--r-4);
    padding-bottom: var(--r-3);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ============================================================
   People
   ============================================================ */

.people-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.people-table th {
    font-size: 0.72rem;
    color: var(--text-mute);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    background: var(--surface-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.people-table th.num { text-align: right; }
.people-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
    font-size: 0.875rem;
}
.people-table tbody tr:last-child td { border-bottom: 0; }
.people-table td.num { text-align: right; font-feature-settings: "tnum", "lnum"; }
.people-table tbody tr {
    cursor: pointer;
    transition: background 120ms ease;
}
.people-table tbody tr:hover { background: var(--accent-wash); }
.people-name {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
    line-height: 1.3;
}
.people-sub {
    font-size: 0.74rem;
    color: var(--text-mute);
    margin-top: 2px;
}
.figure-md {
    font-feature-settings: "tnum", "lnum";
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.01em;
    font-weight: 600;
    font-family: var(--font-ui);
}
.people-arrow {
    color: var(--text-faint);
    font-size: 1rem;
    transition: transform 200ms ease, color 120ms ease;
    display: inline-block;
}
.people-table tbody tr:hover .people-arrow {
    color: var(--accent);
    transform: translateX(2px);
}

/* ============================================================
   Person detail modal
   ============================================================ */

.modal-card-wide { width: min(820px, 100%); }

.modal-x {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: 0;
    color: var(--text-mute);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background 120ms ease, color 120ms ease;
    z-index: 1;
}
.modal-x:hover { color: var(--text); background: var(--surface-2); }

.person-modal {
    padding: var(--r-5) var(--r-6) 0;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}
.person-header {
    padding-bottom: var(--r-4);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--r-5);
}
.person-title {
    font-size: 1.3rem;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--text);
    margin: 0 0 6px;
    font-weight: 600;
}
.person-year {
    display: block;
    font-size: 0.78rem;
    color: var(--text-mute);
    margin-bottom: 10px;
}
.person-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-mute);
}
.person-meta .mono { font-family: var(--font-mono); }
.person-meta-sep { color: var(--text-faint); }

.person-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--r-3);
    margin-bottom: var(--r-5);
}
.person-stat {
    padding: var(--r-3) var(--r-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.person-stat .label {
    font-size: 0.72rem;
    color: var(--text-mute);
    font-weight: 500;
}
.person-stat .figure {
    font-feature-settings: "tnum", "lnum";
    font-size: 1.5rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
    font-weight: 600;
    font-family: var(--font-ui);
}
.person-stat .unit {
    font-size: 0.72rem;
    color: var(--text-mute);
}

.person-section {
    margin-bottom: var(--r-5);
    overflow-x: auto;
}
.person-section:last-of-type { margin-bottom: 0; }
.person-section-head {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-mute);
    margin: 0 0 10px;
    font-weight: 600;
}
.person-empty {
    font-size: 0.875rem;
    color: var(--text-mute);
    padding: var(--r-3) 0;
    border-top: 1px solid var(--border);
}
.person-dates {
    font-size: 0.82rem;
    color: var(--text-soft);
}

.person-footer {
    margin: var(--r-4) calc(-1 * var(--r-6)) 0;
    padding: var(--r-3) var(--r-6);
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    bottom: 0;
}
.person-footer-meta {
    font-size: 0.74rem;
    color: var(--text-mute);
}

.person-modal { overflow: hidden; }
.person-modal > .person-header,
.person-modal > .person-stats,
.person-modal > .person-section,
.person-modal > .person-empty { flex-shrink: 0; }
.person-modal { overflow-y: auto; }

@media (max-width: 720px) {
    .person-stats { grid-template-columns: 1fr; }
}

/* Compact balance / history table inside the person modal */
.balance-mini {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.balance-mini th {
    font-size: 0.7rem;
    color: var(--text-mute);
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.balance-mini th.num { text-align: right; }
.balance-mini td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
    font-size: 0.85rem;
}
.balance-mini td.num { text-align: right; font-feature-settings: "tnum"; }
.balance-mini tbody tr:last-child td { border-bottom: 0; }
.balance-type {
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 500;
    line-height: 1.3;
}

.val-zero    { color: var(--text-faint); }
.val-used    { color: var(--danger);  font-weight: 500; }
.val-pending { color: var(--warning); font-weight: 500; }

.figure-sm {
    font-feature-settings: "tnum", "lnum";
    font-size: 1rem;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.01em;
    font-weight: 600;
    font-family: var(--font-ui);
}

/* ============================================================
   Toasts
   ============================================================ */

.toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 40px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-mute);
    border-radius: var(--radius);
    padding: 10px 32px 12px 14px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: toast-in 200ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-mute);
    margin-bottom: 2px;
    font-weight: 600;
}
.toast-body {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text);
}
.toast-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: 0;
    color: var(--text-mute);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: background 120ms ease, color 120ms ease;
}
.toast-close:hover { color: var(--text); background: var(--surface-2); }

.toast-success { border-left-color: var(--success); }
.toast-success .toast-eyebrow { color: var(--success); }
.toast-danger  { border-left-color: var(--danger); }
.toast-danger  .toast-eyebrow { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-eyebrow { color: var(--warning); }
.toast-info    { border-left-color: var(--accent); }
.toast-info    .toast-eyebrow { color: var(--accent); }

/* ============================================================
   Confirmation modal
   ============================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1090;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--r-4);
}
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--r-5) var(--r-6) var(--r-5);
    width: min(440px, 100%);
    position: relative;
}
.modal-title {
    font-size: 1.05rem;
    color: var(--text);
    margin: 0 0 var(--r-2);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.modal-body {
    font-size: 0.9rem;
    color: var(--text-soft);
    line-height: 1.5;
    margin: 0 0 var(--r-4);
}
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.btn-confirm-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-confirm-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    color: #fff;
}

.modal-fade-enter-active, .modal-fade-leave-active {
    transition: opacity 160ms ease;
}
.modal-fade-enter-from, .modal-fade-leave-to {
    opacity: 0;
}
.modal-fade-enter-active .modal-card,
.modal-fade-leave-active .modal-card {
    transition: transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.modal-fade-enter-from .modal-card { transform: translateY(6px); }
.modal-fade-leave-to   .modal-card { transform: translateY(-3px); }

/* ============================================================
   Reveal animation (subtle)
   ============================================================ */

@keyframes settle {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dash-hero, .dash-stats, .next-leave, .leave-balances-section,
.main-content > div {
    animation: settle 240ms ease both;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   Misc Bootstrap overrides
   ============================================================ */

.text-muted { color: var(--text-mute) !important; }
.fw-bold { font-weight: 600 !important; }
hr { border-color: var(--border) !important; opacity: 1; }

a { color: var(--accent); text-decoration: none; transition: color 120ms ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
    .auth-hero {
        grid-template-columns: 1fr;
        gap: var(--r-5);
    }
    .main-layout {
        grid-template-columns: 1fr;
        gap: var(--r-4);
    }
    .sidebar {
        border-right: 0 !important;
        border-bottom: 1px solid var(--border) !important;
        padding: 0 0 var(--r-4) 0 !important;
        position: static;
    }
    .balance-table tr {
        grid-template-columns: 1fr 1fr;
        gap: var(--r-2);
    }
    .balance-table td:nth-child(3) { grid-column: 1 / -1; text-align: left; }
    .balance-breakdown { text-align: left; }
}
