:root {
    --dlv-navy: #0f172a;
    --dlv-navy-light: #1e293b;
    --dlv-crimson: #dc2626;
    --dlv-crimson-hover: #b91c1c;
    --dlv-bg: #f4f6fa;
    --dlv-border: #e2e8f0;
    --dlv-text: #0f172a;
    --dlv-muted: #64748b;
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--dlv-bg);
    color: var(--dlv-text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(220, 38, 38, 0.08), transparent 40%),
                radial-gradient(circle at bottom left, rgba(15, 23, 42, 0.08), transparent 45%),
                var(--dlv-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid var(--dlv-border);
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.auth-card.auth-card-wide {
    max-width: 560px;
}

.auth-brand-bar {
    background: var(--dlv-navy);
    color: #ffffff;
    padding: 1.35rem 1.75rem;
    border-bottom: 4px solid var(--dlv-crimson);
}

.brand-monogram {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--dlv-crimson);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Dashboard Layout */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--dlv-navy);
    color: #cbd5e1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.22s ease;
}

.app-sidebar-header {
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-sidebar-nav {
    padding: 0.9rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.9rem;
    margin-bottom: 0.25rem;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

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

.sidebar-link.active {
    background: var(--dlv-crimson);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

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

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

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-backdrop.show {
        display: block;
    }
    .app-main {
        margin-left: 0;
    }
    .app-content {
        padding: 1rem;
    }
    .app-topbar {
        padding: 0.75rem 1rem;
    }
}

/* Cards & Stats */
.card-elevated {
    background: #ffffff;
    border: 1px solid var(--dlv-border);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--dlv-border);
    border-radius: 14px;
    padding: 1.15rem 1.25rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.btn-dlv {
    background-color: var(--dlv-crimson);
    border-color: var(--dlv-crimson);
    color: #ffffff;
    font-weight: 600;
}

.btn-dlv:hover, .btn-dlv:focus {
    background-color: var(--dlv-crimson-hover);
    border-color: var(--dlv-crimson-hover);
    color: #ffffff;
}

/* Interactive Leave Calendar */
.cal-wrapper {
    background: #ffffff;
    border: 1px solid var(--dlv-border);
    border-radius: 14px;
    overflow: hidden;
}

.cal-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--dlv-border);
    background: #ffffff;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: #f8fafc;
    border-bottom: 1px solid var(--dlv-border);
}

.cal-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--dlv-muted);
    padding: 0.6rem 0.25rem;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-cell {
    min-height: 92px;
    border-right: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
    padding: 0.45rem;
    position: relative;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.cal-cell:nth-child(7n) {
    border-right: none;
}

.cal-cell-empty {
    background: #fafbfd;
}

.cal-cell.cal-selectable {
    cursor: pointer;
}

.cal-cell.cal-selectable:hover {
    background: #f8fafc;
}

.cal-cell.cal-past {
    background: #f8fafc;
    color: #94a3b8;
}

.cal-cell.cal-today {
    box-shadow: inset 0 0 0 2px #0f172a;
}

.cal-cell.cal-selected {
    background: #eff6ff !important;
    box-shadow: inset 0 0 0 2px #2563eb;
}

/* Staff Calendar Status Tints */
.cal-cell.staff-status-pending {
    background: #fffbeb;
}
.cal-cell.staff-status-approved {
    background: #f0fdf4;
}
.cal-cell.staff-status-rejected {
    background: #fef2f2;
}
.cal-cell.staff-status-expired,
.cal-cell.staff-status-past {
    background: #f1f5f9;
}

.cal-day-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}

.cal-day-num {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
}

.cal-today-pill {
    font-size: 0.62rem;
    font-weight: 700;
    background: #0f172a;
    color: #ffffff;
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
}

.cal-markers {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}

.cal-pill {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-pill-yellow {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.cal-pill-green {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.cal-pill-red {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.cal-pill-grey {
    background: #e2e8f0;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.cal-pill-blue {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.cal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.cal-dot-yellow { background: #d97706; }
.cal-dot-green { background: #16a34a; }
.cal-dot-red { background: #dc2626; }
.cal-dot-grey { background: #64748b; }
.cal-dot-blue { background: #2563eb; }

.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    padding: 0.75rem 1.25rem;
    background: #f8fafc;
    border-top: 1px solid var(--dlv-border);
    font-size: 0.8rem;
    color: #334155;
}

.cal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

@media (max-width: 767.98px) {
    .cal-cell {
        min-height: 64px;
        padding: 0.3rem;
    }
    .cal-day-num {
        font-size: 0.78rem;
    }
    .cal-today-pill {
        display: none;
    }
    .cal-pill {
        font-size: 0.62rem;
        padding: 1px 3px;
    }
}

.table > :not(caption) > * > * {
    padding: 0.78rem 0.9rem;
    vertical-align: middle;
}

.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #475569;
    background: #f8fafc;
    font-weight: 700;
    border-bottom: 1px solid var(--dlv-border);
}

.toast-container-custom {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2090;
}

.app-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 2050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.app-loading-card {
    background: #ffffff;
    border: 1px solid var(--dlv-border);
    border-radius: 14px;
    padding: 1.5rem 2rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.22);
    text-align: center;
    max-width: 360px;
    width: 100%;
}
