/* ─── CSS Variables (Brand / White Label defaults) ─────────────────────── */
:root {
    --brand-primary:        #6B4FBB;
    --brand-primary-rgb:    107, 79, 187;
    --brand-primary-light:  rgba(107, 79, 187, 0.10);

    --bg-app:               #F5F6FA;
    --bg-card:              #FFFFFF;
    --bg-sidebar:           #FFFFFF;

    --text-primary:         #1A1D23;
    --text-secondary:       #6B7280;
    --text-muted:           #9CA3AF;

    --border-color:         #E5E7EB;
    --shadow-card:          0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);

    --sidebar-width:        200px;
    --topbar-height:        48px;
}

/* ─── Base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-app);
    margin: 0;
}

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

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dim overlay when mobile sidebar is open */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 199;
    opacity: 0;
    transition: opacity 240ms;
}
.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

.sidebar-logo {
    height: var(--topbar-height);
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    box-sizing: border-box;
}

.sidebar-logo img {
    height: 28px;
    width: auto;
}

.sidebar-logo-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 6px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 8px 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    height: 34px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 140ms, color 140ms;
    margin-bottom: 1px;
}

.nav-item:hover {
    background: var(--bg-app);
    color: var(--text-primary);
}

.sidebar-nav > .nav-item {
    font-weight: 600;
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-item svg,
.nav-item .nav-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.sidebar-user {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 10px;
    color: var(--text-muted);
}

/* ─── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 99;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.topbar-breadcrumb {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-user-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 7px;
    transition: background 140ms;
}

.topbar-user-pill:hover {
    background: var(--bg-app);
}

/* Hamburger toggle — hidden on desktop, shown on mobile */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    padding: 4px 5px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 19px;
    line-height: 1;
    transition: background 140ms, color 140ms;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-app);
    color: var(--text-primary);
}

/* ─── Main content ──────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 20px;
    min-height: calc(100vh - var(--topbar-height));
    min-width: 0;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    padding: 16px;
}

.card-panel {
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    padding: 20px;
}

.card-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 14px;
}

/* ─── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    height: 100%;
}

.stat-card-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card-value.highlight {
    color: var(--brand-primary);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #fff !important;
    font-weight: 500;
    border-radius: 7px;
    font-size: 13px;
    padding: 7px 14px;
    transition: opacity 140ms;
    display: inline-flex;
    align-items: center;
}

.btn-primary:hover, .btn-primary:focus {
    opacity: 0.88;
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

.btn-secondary, .btn-outline-secondary {
    border: 1px solid var(--border-color) !important;
    background: #fff !important;
    color: var(--text-primary) !important;
    font-weight: 500;
    border-radius: 7px;
    font-size: 13px;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
}

.btn-outline-secondary.active {
    background: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #fff !important;
}

.btn-danger {
    background-color: #EF4444 !important;
    border-color: #EF4444 !important;
    font-weight: 500;
    border-radius: 7px;
    font-size: 13px;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-control, .form-select {
    height: 34px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-primary);
    transition: border-color 140ms, box-shadow 140ms;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.14);
    outline: none;
}

textarea.form-control {
    height: auto;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table {
    font-size: 13px;
    border-collapse: collapse;
}

.table thead th {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: #F9FAFB;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    white-space: nowrap;
}

.table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr:hover td {
    background: #F9FAFB;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Status badges ──────────────────────────────────────────────────────── */
.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.badge-approved {
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
}

.badge-pending {
    background: rgba(245, 158, 11, 0.12);
    color: #F59E0B;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
}

.badge-denied {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
}

/* ─── Pill badges (role / team / info labels) ────────────────────────────── */
.badge-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.badge-info {
    background: rgba(107, 79, 187, 0.10);
    color: var(--brand-primary);
}

/* ─── Utility font-weight helpers ────────────────────────────────────────── */
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }

/* ─── Vacation balance bar ───────────────────────────────────────────────── */
.balance-number { font-size: 28px; font-weight: 700; line-height: 1; }
.balance-label  { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); font-weight: 600; margin-top: 2px; }
.balance-item   { display: flex; align-items: center; gap: 6px; }
.balance-dot    { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.balance-item-val { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.balance-item-lbl { font-size: 11px; color: var(--text-secondary); }

/* ─── Bootstrap nav/badge overrides ─────────────────────────────────────── */
.nav-link.active {
    color: var(--brand-primary) !important;
}

.badge.bg-primary {
    background-color: var(--brand-primary) !important;
}

/* ─── Tab nav ────────────────────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: none;
    background: #f0f1f6;
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
    display: inline-flex;
    flex-wrap: wrap;
}

.nav-tabs .nav-item {
    margin: 0;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 7px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    transition: color 150ms, background 150ms, box-shadow 150ms;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    margin: 0;
}

.nav-tabs .nav-link:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(0,0,0,0.04);
}

.nav-tabs .nav-link.active {
    color: var(--brand-primary) !important;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
    font-weight: 600;
}

.nav-tabs .nav-link .badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: 700;
    line-height: 1.4;
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 14px 18px;
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 10px 18px;
    justify-content: flex-end;
}

/* ─── Auth layout ────────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.06) 0%, #f0f1f6 100%);
    padding: 24px 16px;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    width: 440px;
    height: 440px;
    border-radius: 50%;
    background: rgba(var(--brand-primary-rgb), 0.07);
    top: -130px;
    right: -120px;
    pointer-events: none;
    animation: authFloat1 9s ease-in-out infinite;
}

.auth-page::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(var(--brand-primary-rgb), 0.05);
    bottom: -90px;
    left: -90px;
    pointer-events: none;
    animation: authFloat2 11s ease-in-out infinite;
}

@keyframes authFloat1 {
    0%, 100% { transform: translate(0, 0); }
    50%       { transform: translate(14px, -18px); }
}

@keyframes authFloat2 {
    0%, 100% { transform: translate(0, 0); }
    50%       { transform: translate(-10px, 14px); }
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10), 0 2px 12px rgba(var(--brand-primary-rgb), 0.08);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: authFadeUp 0.35s ease both;
}

@keyframes authFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo img {
    max-height: 64px;
    max-width: 160px;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px;
}

.auth-logo-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.auth-logo-powered {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

.auth-separator {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0 24px;
}

.auth-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 5px;
    letter-spacing: -0.2px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 24px;
    line-height: 1.55;
}

/* Password field with toggle */
.auth-input-wrapper {
    position: relative;
}

.auth-input-wrapper .form-control {
    padding-right: 38px;
}

.auth-input-wrapper .pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 140ms;
}

.auth-input-wrapper .pw-toggle:hover {
    color: var(--text-secondary);
}

/* Auth submit button */
.auth-btn {
    display: block;
    width: 100%;
    height: 40px;
    background: var(--brand-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 150ms;
    letter-spacing: 0.01em;
}

.auth-btn:hover  { opacity: 0.88; }
.auth-btn:active { opacity: 0.80; }

/* Auth link */
.auth-link {
    font-size: 13px;
    color: var(--brand-primary);
    text-decoration: none;
    transition: opacity 140ms;
}

.auth-link:hover {
    opacity: 0.75;
    color: var(--brand-primary);
}

@media (max-width: 480px) {
    .auth-card { padding: 28px 20px; border-radius: 12px; }
}

/* ─── Alert tweaks ───────────────────────────────────────────────────────── */
.alert {
    border-radius: 8px;
    font-size: 13px;
}

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination .page-link {
    border-radius: 6px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 4px 10px;
    margin: 0 2px;
}

.pagination .page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.pagination .page-link:hover {
    background: var(--bg-app);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* ─── Responsive — mobile sidebar overlay (< 1024px) ────────────────────── */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }
}

/* ─── Responsive — small screens ────────────────────────────────────────── */
@media (max-width: 640px) {
    .main-content {
        padding: 14px;
    }

    .page-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

/* ─── Notification bell ──────────────────────────────────────────────────── */
.topbar-notification-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s;
}
.topbar-notification-btn:hover {
    background: var(--bg-hover, #F3F4F6);
    color: var(--text-primary);
}

/* ─── Collapsible sidebar sections ──────────────────────────────────────── */
.nav-section-btn {
    width: 100%; background: none; border: none;
    padding: 0 8px; margin-top: 4px;
    height: 34px;
    font-size: 13px; font-weight: 600; letter-spacing: 0;
    text-transform: none; color: var(--text-primary);
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; border-radius: 7px;
    transition: color 140ms, background 140ms;
    user-select: none; -webkit-user-select: none;
}
.nav-section-btn:hover { color: var(--text-primary); background: var(--bg-app); }
.nav-section-btn:focus-visible { outline: 2px solid rgba(107,79,187,0.4); outline-offset: 1px; }
.nav-section-btn:focus:not(:focus-visible) { outline: none; }
.nav-section-chevron {
    font-size: 11px; flex-shrink: 0;
    transition: transform 200ms cubic-bezier(0.4,0,0.2,1);
    transform: rotate(0deg);
}
.nav-section-btn.collapsed .nav-section-chevron { transform: rotate(-90deg); }
