/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Dark Theme (default) ─────────────────────────────────────────────────── */
:root {
    --bg: #1C1C24;
    --bg2: #24242E;
    --bg3: #2C2C38;
    --bg4: #343442;
    --border: rgba(255,255,255,.08);
    --border2: rgba(255,255,255,.13);
    --text: #F0F0F8;
    --text2: #B8B8CC;
    --text3: #7878A0;
    --amber: #E8A020;
    --amber2: #F4B840;
    --amber-dim: rgba(232,160,32,0.12);
    --amber-dim2: rgba(232,160,32,0.2);
    --green: #3DB87A;
    --green-dim: rgba(61,184,122,0.12);
    --red: #E85A4F;
    --red-dim: rgba(232,90,79,0.12);
    --blue: #4A9EE8;
    --blue-dim: rgba(74,158,232,0.12);
    --purple: #9B72E8;
    --purple-dim: rgba(155,114,232,0.12);
    --sidebar-w: 240px;
    --sidebar-collapsed-w: 60px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Light Theme ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg: #F4F4F8;
    --bg2: #EBEBF2;
    --bg3: #E0E0EA;
    --bg4: #D4D4E0;
    --border: rgba(0,0,0,.08);
    --border2: rgba(0,0,0,.13);
    --text: #0D0D12;
    --text2: #2A2A38;
    --text3: #55556A;
    --amber: #C47F0A;
    --amber2: #D4920E;
    --amber-dim: rgba(196,127,10,0.10);
    --amber-dim2: rgba(196,127,10,0.18);
    --green: #1E8C57;
    --green-dim: rgba(30,140,87,0.10);
    --red: #C9392F;
    --red-dim: rgba(201,57,47,0.10);
    --blue: #1A78C2;
    --blue-dim: rgba(26,120,194,0.10);
    --purple: #6B46C1;
    --purple-dim: rgba(107,70,193,0.10);
    --shadow: 0 4px 24px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.11);
}

/* ── Theme transition ─────────────────────────────────────────────────────── */
*, *::before, *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.15s ease;
}

    /* ── Reset & Base ─────────────────────────────────────────────────────────── */
    *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow: hidden;
    white-space: nowrap;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

    .sidebar.collapsed {
        width: var(--sidebar-collapsed-w);
    }

/* Brand */
.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

    .sidebar-brand .logo-mark {
        width: 36px;
        height: 36px;
        background: var(--amber);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: var(--font-display);
        font-size: 18px;
        font-weight: 700;
        color: #0D0D0D;
        margin-bottom: 12px;
        flex-shrink: 0;
    }

    .sidebar-brand h1 {
        font-family: var(--font-display);
        font-size: 16px;
        font-weight: 600;
        color: var(--text);
        letter-spacing: 0.02em;
    }

    .sidebar-brand p {
        font-size: 11px;
        color: var(--text3);
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

/* Nav */
.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text3);
    padding: 12px 8px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text2);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    position: relative;
}

    .nav-item:hover {
        background: var(--bg3);
        color: var(--text);
    }

    .nav-item.active {
        background: var(--amber-dim);
        color: var(--amber);
        border: 1px solid rgba(232,160,32,0.2);
    }

        .nav-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 18px;
            background: var(--amber);
            border-radius: 0 2px 2px 0;
        }

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

/* Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text3);
}

/* ── Sidebar collapsed state ──────────────────────────────────────────────── */
.sidebar.collapsed .sidebar-brand {
    align-items: center;
    justify-content: center;
    padding: 16px 0;
}

    .sidebar.collapsed .sidebar-brand h1,
    .sidebar.collapsed .sidebar-brand p {
        display: none !important;
    }

    .sidebar.collapsed .sidebar-brand .logo-mark {
        margin-bottom: 0;
    }

.sidebar.collapsed .nav-section-label {
    display: none !important;
}

.sidebar.collapsed .sidebar-footer {
    display: none !important;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
    font-size: 0 !important;
}

    .sidebar.collapsed .nav-item svg,
    .sidebar.collapsed .nav-item .nav-icon {
        width: 20px;
        height: 20px;
        font-size: 16px;
        flex-shrink: 0;
    }

    .sidebar.collapsed .nav-item.active::before {
        display: none;
    }

/* ── Main Layout ──────────────────────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

    .main.collapsed {
        margin-left: var(--sidebar-collapsed-w);
    }

/* Topbar */
.topbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .topbar-left h2 {
        font-family: var(--font-display);
        font-size: 18px;
        font-weight: 600;
    }

    .topbar-left p {
        font-size: 12px;
        color: var(--text3);
    }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-content {
    padding: 32px;
    flex: 1;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

    .card-header h3 {
        font-family: var(--font-display);
        font-size: 16px;
        font-weight: 600;
    }

.card-body {
    padding: 24px;
}

/* ── Stat Cards ───────────────────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition);
}

    .stat-card:hover {
        transform: translateY(-2px);
        border-color: var(--border2);
    }

    .stat-card::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 2px;
    }

    .stat-card.amber::after {
        background: var(--amber);
    }

    .stat-card.green::after {
        background: var(--green);
    }

    .stat-card.blue::after {
        background: var(--blue);
    }

    .stat-card.purple::after {
        background: var(--purple);
    }

.stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 8px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}

.stat-sub {
    font-size: 12px;
    color: var(--text2);
    margin-top: 6px;
}

.stat-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    opacity: 0.08;
    font-size: 40px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--amber);
    color: #0D0D0D;
}

    .btn-primary:hover {
        background: var(--amber2);
        transform: translateY(-1px);
        box-shadow: 0 4px 16px rgba(232,160,32,0.3);
    }

.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border2);
}

    .btn-secondary:hover {
        background: var(--bg4);
    }

.btn-danger {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(232,90,79,0.2);
}

    .btn-danger:hover {
        background: rgba(232,90,79,0.2);
    }

.btn-success {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(61,184,122,0.2);
}

    .btn-success:hover {
        background: rgba(61,184,122,0.2);
    }

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.btn-icon {
    padding: 8px;
    width: 34px;
    height: 34px;
    justify-content: center;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text3);
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

    tbody tr:hover {
        background: rgba(255,255,255,0.02);
    }

    tbody tr:last-child {
        border-bottom: none;
    }

td {
    padding: 12px 16px;
    font-size: 13px;
    vertical-align: middle;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text2);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

    .form-control:focus {
        border-color: var(--amber);
        box-shadow: 0 0 0 3px var(--amber-dim);
    }

    .form-control::placeholder {
        color: var(--text3);
    }

select.form-control option {
    background: var(--bg3);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 11px;
    color: var(--text3);
    margin-top: 4px;
}

.field-error {
    font-size: 11px;
    color: var(--red);
    margin-top: 4px;
}

.validation-summary {
    background: var(--red-dim);
    border: 1px solid rgba(232,90,79,0.2);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

    .validation-summary ul {
        list-style: none;
    }

    .validation-summary li {
        font-size: 13px;
        color: var(--red);
    }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.badge-amber {
    background: var(--amber-dim);
    color: var(--amber);
    border: 1px solid rgba(232,160,32,0.2);
}

.badge-green {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(61,184,122,0.2);
}

.badge-red {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(232,90,79,0.2);
}

.badge-blue {
    background: var(--blue-dim);
    color: var(--blue);
    border: 1px solid rgba(74,158,232,0.2);
}

.badge-purple {
    background: var(--purple-dim);
    color: var(--purple);
    border: 1px solid rgba(155,114,232,0.2);
}

.badge-gray {
    background: rgba(255,255,255,0.06);
    color: var(--text2);
    border: 1px solid var(--border);
}

/* ── Avatar ───────────────────────────────────────────────────────────────── */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    color: #fff;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.avatar-lg {
    width: 52px;
    height: 52px;
    font-size: 18px;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

.alert-success {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(61,184,122,0.2);
}

.alert-error {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(232,90,79,0.2);
}

.alert-info {
    background: var(--blue-dim);
    color: var(--blue);
    border: 1px solid rgba(74,158,232,0.2);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Employee Card Grid ───────────────────────────────────────────────────── */
.emp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.emp-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: all var(--transition);
    position: relative;
}

    .emp-card:hover {
        border-color: var(--border2);
        transform: translateY(-2px);
        box-shadow: var(--shadow);
    }

.emp-card-body {
    flex: 1;
    min-width: 0;
}

.emp-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emp-card-role {
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 10px;
}

.emp-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

/* ── Clock Panel ──────────────────────────────────────────────────────────── */
.clock-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.clock-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.clock-time {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: -1px;
}

.clock-date {
    font-size: 12px;
    color: var(--text2);
    margin-top: 4px;
}

/* ── Progress Bar ─────────────────────────────────────────────────────────── */
.progress-bar {
    height: 4px;
    background: var(--bg4);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--amber);
    transition: width 0.5s ease;
}

    .progress-fill.green {
        background: var(--green);
    }

    .progress-fill.red {
        background: var(--red);
    }

/* ── Tip Rows ─────────────────────────────────────────────────────────────── */
.tip-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

    .tip-row:last-child {
        border-bottom: none;
    }

.tip-bar {
    flex: 1;
    height: 6px;
    background: var(--bg4);
    border-radius: 3px;
    overflow: hidden;
}

.tip-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--amber);
}

.tip-amount {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--amber);
    min-width: 64px;
    text-align: right;
}

/* ── Calendar ─────────────────────────────────────────────────────────────── */
#calendar {
    background: var(--bg2);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.fc {
    color: var(--text);
    font-family: var(--font-body);
}

    .fc .fc-toolbar-title {
        font-family: var(--font-display);
        font-size: 20px;
        font-weight: 600;
    }

    .fc .fc-button {
        background: var(--bg3);
        border: 1px solid var(--border2);
        color: var(--text);
        font-family: var(--font-body);
        font-size: 12px;
    }

        .fc .fc-button:hover {
            background: var(--bg4);
        }

    .fc .fc-button-primary:not(:disabled).fc-button-active {
        background: var(--amber);
        border-color: var(--amber);
        color: #0D0D0D;
    }

    .fc .fc-daygrid-day:hover {
        background: rgba(255,255,255,0.02);
    }

    .fc th {
        background: var(--bg3);
        border-color: var(--border);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--text2);
    }

    .fc td {
        border-color: var(--border);
    }

    .fc .fc-event {
        border-radius: 5px;
        border: none;
        font-size: 11px;
        padding: 2px 5px;
    }

    .fc .fc-daygrid-day-number {
        color: var(--text2);
        font-size: 12px;
    }

    .fc .fc-day-today {
        background: rgba(232,160,32,0.05) !important;
    }

        .fc .fc-day-today .fc-daygrid-day-number {
            color: var(--amber);
            font-weight: 600;
        }

/* ── Active dot ───────────────────────────────────────────────────────────── */
.active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%,100% {
        opacity: 1;
        transform: scale(1)
    }

    50% {
        opacity: 0.6;
        transform: scale(0.85)
    }
}

/* ── Payroll ──────────────────────────────────────────────────────────────── */
.payroll-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.payroll-total {
    background: linear-gradient(135deg, rgba(232,160,32,0.15) 0%, rgba(232,160,32,0.05) 100%);
    border: 1px solid rgba(232,160,32,0.25);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.payroll-total-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 8px;
}

.payroll-total-value {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 700;
    color: var(--amber);
}

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

.section-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.section-sub {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 24px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text3);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h4 {
    font-size: 16px;
    color: var(--text2);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

    .filter-bar .form-control {
        width: auto;
        min-width: 160px;
    }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--bg4);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text3);
    }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .main {
        margin-left: 0;
    }

    .form-grid, .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .clock-panel {
        grid-template-columns: 1fr;
    }

    .payroll-header {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 16px;
    }
}
