@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #222845;
    --bg-input: #151b2e;
    --border: #2a3150;
    --border-focus: #6366f1;
    --text-primary: #e8ecf4;
    --text-secondary: #8892b0;
    --text-muted: #5a6380;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-bg: rgba(99,102,241,.12);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 48px rgba(0,0,0,.5);
    --transition: all .25s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ========== LOGIN PAGE ========== */
.login-wrapper {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1040 50%, #0a0e1a 100%);
}
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3rem;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeUp .6s ease;
}
.login-box h1 {
    font-size: 1.8rem; font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-align: center; margin-bottom: .5rem;
}
.login-box .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 2rem; font-size: .9rem; }

/* ========== LAYOUT ========== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px; background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100; transition: var(--transition);
}
.sidebar-brand {
    padding: 1.5rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .75rem;
}
.sidebar-brand .logo {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 800; color: #fff;
}
.sidebar-brand h2 { font-size: 1.1rem; font-weight: 700; }
.sidebar-brand span { font-size: .7rem; color: var(--text-muted); display: block; }

.sidebar-nav { flex: 1; padding: 1rem .75rem; overflow-y: auto; }
.nav-section { margin-bottom: 1.5rem; }
.nav-section-title {
    font-size: .65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--text-muted); padding: 0 .75rem; margin-bottom: .5rem;
}
.nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem .75rem; border-radius: var(--radius-sm);
    color: var(--text-secondary); cursor: pointer;
    transition: var(--transition); font-size: .88rem; font-weight: 500;
    text-decoration: none; border: none; background: none; width: 100%;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
    margin-left: auto; background: var(--danger);
    color: #fff; font-size: .65rem; font-weight: 700;
    padding: 2px 7px; border-radius: 10px; min-width: 20px; text-align: center;
}

.sidebar-footer {
    padding: 1rem; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: .75rem;
}
.sidebar-footer .avatar {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; color: #fff;
}
.sidebar-footer .user-info { flex: 1; }
.sidebar-footer .user-name { font-size: .85rem; font-weight: 600; }
.sidebar-footer .user-role { font-size: .7rem; color: var(--text-muted); }

.main-content { margin-left: 260px; flex: 1; padding: 0; min-height: 100vh; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 2rem; background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-left h1 { font-size: 1.25rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }

.page-content { padding: 1.5rem 2rem; }

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .6rem 1.25rem; border-radius: var(--radius-sm);
    font-size: .85rem; font-weight: 600; font-family: inherit;
    cursor: pointer; border: 1px solid transparent;
    transition: var(--transition); text-decoration: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,.4); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: rgba(34,197,94,.15); color: var(--success); border-color: rgba(34,197,94,.3); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-sm { padding: .4rem .75rem; font-size: .78rem; }
.btn-icon { padding: .5rem; border-radius: var(--radius-sm); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

/* ========== FORM ELEMENTS ========== */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .4rem; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: .65rem .85rem;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: .88rem; font-family: inherit;
    transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-color { display: flex; align-items: center; gap: .75rem; }
.form-color input[type="color"] {
    width: 40px; height: 40px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; background: none; padding: 2px;
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
    transition: var(--transition);
}
.card:hover { border-color: rgba(99,102,241,.3); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-title { font-size: 1rem; font-weight: 700; }
.card-subtitle { font-size: .78rem; color: var(--text-muted); }

/* ========== STATS CARDS ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem;
    display: flex; align-items: flex-start; gap: 1rem;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: rgba(99,102,241,.3); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.stat-info { flex: 1; }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

/* ========== CALENDAR ========== */
.calendar-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; flex-wrap: wrap; gap: 1rem;
}
.calendar-nav { display: flex; align-items: center; gap: .5rem; }
.calendar-date { font-size: 1.1rem; font-weight: 700; min-width: 200px; text-align: center; }
.staff-filter { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.staff-chip {
    display: flex; align-items: center; gap: .4rem;
    padding: .35rem .75rem; border-radius: 20px;
    font-size: .78rem; font-weight: 600; cursor: pointer;
    border: 2px solid transparent; transition: var(--transition);
    background: var(--bg-card);
}
.staff-chip.active { border-color: currentColor; }
.staff-chip .dot { width: 8px; height: 8px; border-radius: 50%; }

.calendar-grid {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.calendar-time-header {
    display: grid; grid-template-columns: 70px 1fr;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    font-size: .75rem; font-weight: 600; color: var(--text-muted);
}
.calendar-time-header .time-col { padding: .75rem; text-align: center; border-right: 1px solid var(--border); }
.calendar-time-header .events-col { padding: .75rem; }

.time-slot {
    display: grid; grid-template-columns: 70px 1fr;
    border-bottom: 1px solid rgba(42,49,80,.5);
    min-height: 64px; transition: var(--transition);
}
.time-slot:hover { background: rgba(99,102,241,.03); }
.time-label {
    padding: .5rem; font-size: .75rem; font-weight: 600;
    color: var(--text-muted); text-align: center;
    border-right: 1px solid var(--border);
    display: flex; align-items: flex-start; justify-content: center; padding-top: .6rem;
}
.time-events { padding: .35rem .5rem; display: flex; flex-wrap: wrap; gap: .35rem; position: relative; }

.event-block {
    flex: 1; min-width: 200px;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid;
    cursor: pointer; transition: var(--transition);
    font-size: .8rem; position: relative;
    animation: fadeIn .3s ease;
}
.event-block:hover { transform: scale(1.01); box-shadow: var(--shadow); z-index: 2; }
.event-title { font-weight: 700; margin-bottom: .15rem; display: flex; align-items: center; gap: .4rem; }
.event-meta { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .72rem; color: rgba(255,255,255,.7); }
.event-meta span { display: flex; align-items: center; gap: .2rem; }
.event-status {
    position: absolute; top: .4rem; right: .4rem;
    font-size: .6rem; font-weight: 700; text-transform: uppercase;
    padding: 2px 6px; border-radius: 4px;
}
.event-status.cancelled { background: rgba(239,68,68,.2); color: var(--danger); }
.event-status.postponed { background: rgba(245,158,11,.2); color: var(--warning); }
.event-status.completed { background: rgba(34,197,94,.2); color: var(--success); }

.event-deposit { font-size: .68rem; font-weight: 600; padding: 1px 5px; border-radius: 3px; }
.event-deposit.none { background: rgba(239,68,68,.15); color: var(--danger); }
.event-deposit.partial { background: rgba(245,158,11,.15); color: var(--warning); }
.event-deposit.full { background: rgba(34,197,94,.15); color: var(--success); }

.empty-slot {
    width: 100%; min-height: 48px;
    border: 2px dashed rgba(42,49,80,.5); border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition);
    color: var(--text-muted); font-size: .78rem;
}
.empty-slot:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; width: 95%; max-width: 600px;
    max-height: 90vh; overflow-y: auto;
    transform: scale(.9) translateY(20px);
    transition: var(--transition); box-shadow: var(--shadow-lg);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer; transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.modal-body { padding: 1.5rem; }
.modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: .75rem;
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
}

/* ========== TABLE ========== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    padding: .75rem 1rem; font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); text-align: left;
    border-bottom: 1px solid var(--border); background: var(--bg-secondary);
}
tbody td {
    padding: .75rem 1rem; font-size: .85rem;
    border-bottom: 1px solid rgba(42,49,80,.4);
    vertical-align: middle;
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-card-hover); }

.badge {
    display: inline-flex; align-items: center; padding: .2rem .6rem;
    border-radius: 6px; font-size: .72rem; font-weight: 600;
}
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-info { background: rgba(6,182,212,.15); color: var(--info); }

.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* ========== CHARTS ========== */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.chart-container { position: relative; height: 260px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding: 0 .5rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar {
    width: 100%; border-radius: 4px 4px 0 0; min-height: 4px;
    transition: height .6s cubic-bezier(.4,0,.2,1);
    position: relative;
}
.bar:hover { opacity: .85; }
.bar-label { font-size: .65rem; color: var(--text-muted); font-weight: 600; }
.bar-value { font-size: .65rem; color: var(--text-secondary); font-weight: 700; }

/* Progress bars for category distribution */
.progress-list { display: flex; flex-direction: column; gap: .75rem; }
.progress-item { }
.progress-header { display: flex; justify-content: space-between; margin-bottom: .35rem; }
.progress-name { font-size: .82rem; font-weight: 600; }
.progress-count { font-size: .78rem; color: var(--text-muted); }
.progress-bar-bg { height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width .8s cubic-bezier(.4,0,.2,1); }

/* ========== NOTIFICATIONS ========== */
.notif-list { display: flex; flex-direction: column; gap: .5rem; }
.notif-item {
    display: flex; gap: .75rem; padding: .75rem;
    border-radius: var(--radius-sm); transition: var(--transition);
    border: 1px solid transparent;
}
.notif-item.unread { background: var(--accent-bg); border-color: rgba(99,102,241,.2); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notif-content { flex: 1; }
.notif-text { font-size: .84rem; }
.notif-time { font-size: .72rem; color: var(--text-muted); margin-top: .2rem; }

/* ========== ACTIVITY LOG ========== */
.activity-list { display: flex; flex-direction: column; gap: .25rem; }
.activity-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .5rem 0; font-size: .82rem;
}
.activity-item .time { font-size: .72rem; color: var(--text-muted); white-space: nowrap; min-width: 60px; }
.activity-item .user { font-weight: 600; color: var(--accent); }

/* ========== TOAST ========== */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
    padding: .85rem 1.25rem; border-radius: var(--radius-sm);
    font-size: .85rem; font-weight: 500;
    display: flex; align-items: center; gap: .5rem;
    animation: slideIn .3s ease; min-width: 300px;
    box-shadow: var(--shadow-lg);
}
.toast-success { background: #065f46; color: #a7f3d0; border: 1px solid #059669; }
.toast-error { background: #7f1d1d; color: #fca5a5; border: 1px solid #dc2626; }
.toast-info { background: #1e3a5f; color: #a5d8ff; border: 1px solid #0ea5e9; }

/* ========== ANIMATIONS ========== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }

/* ========== SEARCH ========== */
.search-box {
    position: relative; max-width: 300px;
}
.search-box input {
    width: 100%; padding: .55rem 1rem .55rem 2.5rem;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: .85rem; font-family: inherit; transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.search-box svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; }

/* ========== RESPONSIVE ========== */
.mobile-toggle { display: none; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: flex; }
    .topbar { padding: .75rem 1rem; }
    .page-content { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .calendar-header { flex-direction: column; align-items: flex-start; }
    .event-block { min-width: 140px; }
    .modal { width: 98%; max-height: 95vh; }
}

/* ========== TABS ========== */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab {
    padding: .65rem 1.25rem; font-size: .85rem; font-weight: 600;
    color: var(--text-secondary); cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition); background: none; border-top: none; border-left: none; border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ========== LOADING ========== */
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .8s linear infinite;
    margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    position: fixed; inset: 0; background: rgba(10,14,26,.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 9998;
}
