﻿/* =============================================
   WORKHIVE – Design System & Styles
   ============================================= */

/* --- Variables (Dark Theme) --- */
:root {
    --bg-base: #0f1117;
    --bg-surface: #1a1d27;
    --bg-elevated: #22263a;
    --bg-hover: #2a2f47;
    --border: #2e3350;
    --border-light: #3a3f5c;

    --text-primary: #e8eaf0;
    --text-secondary: #8b90a7;
    --text-muted: #5a5f7a;

    --accent: #6366f1;
    --accent-hover: #4f52d3;
    --accent-light: rgba(99,102,241,0.15);

    --success: #10b981;
    --success-light: rgba(16,185,129,0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245,158,11,0.15);
    --danger: #ef4444;
    --danger-light: rgba(239,68,68,0.15);
    --info: #06b6d4;
    --info-light: rgba(6,182,212,0.15);

    --sidebar-width: 240px;
    --topbar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, sans-serif;
}

[data-theme="light"] {
    --bg-base: #f0f2f9;
    --bg-surface: #ffffff;
    --bg-elevated: #f7f8fc;
    --bg-hover: #eef0f8;
    --border: #e2e5f1;
    --border-light: #ced3e8;

    --text-primary: #1a1d2e;
    --text-secondary: #5a5f7a;
    --text-muted: #9097b5;

    --accent-light: rgba(99,102,241,0.08);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    transition: background var(--transition), color var(--transition);
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition), background var(--transition);
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.brand-icon .material-symbols-rounded { font-size: 20px; font-variation-settings: 'FILL' 1; }

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    transition: all var(--transition);
    position: relative;
}

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

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-item .material-symbols-rounded {
    font-size: 20px;
    flex-shrink: 0;
    font-variation-settings: 'FILL' 0;
}

.nav-item.active .material-symbols-rounded {
    font-variation-settings: 'FILL' 1;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 13.5px;
    transition: all var(--transition);
    user-select: none;
}

.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.theme-toggle .material-symbols-rounded { font-size: 20px; }

/* --- Main Wrapper --- */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin var(--transition);
}

/* --- Topbar --- */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background var(--transition);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-toggle .material-symbols-rounded { font-size: 22px; display: block; }

.topbar-title h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Page Content --- */
.page-content {
    flex: 1;
    padding: 28px 24px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
}

.btn .material-symbols-rounded { font-size: 18px; }

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); }

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid transparent;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid transparent;
}
.btn-success:hover { background: var(--success); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-sm .material-symbols-rounded { font-size: 16px; }

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* --- Cards --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: background var(--transition), border-color var(--transition);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* --- KPI Cards --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.kpi-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: var(--kpi-color, var(--accent));
}

.kpi-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: var(--kpi-color-light, var(--accent-light));
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}

.kpi-icon .material-symbols-rounded {
    font-size: 22px;
    color: var(--kpi-color, var(--accent));
    font-variation-settings: 'FILL' 1;
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.kpi-label {
    font-size: 12.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13.5px;
    transition: all var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--bg-elevated);
    padding: 11px 14px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
    padding: 12px 14px;
    font-size: 13.5px;
    color: var(--text-primary);
    vertical-align: middle;
}

.td-muted { color: var(--text-secondary); font-size: 12.5px; }

.action-btns {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    gap: 4px;
}

.badge-accent  { background: var(--accent-light);  color: var(--accent); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-muted   { background: var(--bg-elevated);   color: var(--text-secondary); }

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-elevated);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    width: fit-content;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.tab-btn.active {
    background: var(--accent);
    color: #fff;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

.date-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.date-preset-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.date-preset-btn:hover { border-color: var(--accent); color: var(--accent); }
.date-preset-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* --- Charts Grid --- */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-container {
    position: relative;
    height: 260px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .material-symbols-rounded {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    font-variation-settings: 'FILL' 1;
    opacity: 0.4;
}

.empty-state p { font-size: 14px; }

/* --- Color Dot --- */
.color-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* --- Sections --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Hours Display --- */
.hours-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: var(--accent);
    font-size: 13.5px;
}

/* --- Progress Bar --- */
.progress-bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition);
    display: flex;
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body { padding: 18px 20px; }

.modal-footer {
    padding: 12px 20px 18px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Toasts --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 260px;
    max-width: 360px;
    pointer-events: all;
    animation: slideInToast 0.3s ease;
    font-size: 13.5px;
    font-weight: 500;
}

.toast .material-symbols-rounded {
    font-size: 20px;
    font-variation-settings: 'FILL' 1;
    flex-shrink: 0;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-success .material-symbols-rounded { color: var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-error   .material-symbols-rounded { color: var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }
.toast-info    .material-symbols-rounded { color: var(--accent); }

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

/* --- Loading Spinner --- */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Misc Utilities --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-secondary); }
.w-full { width: 100%; }

/* --- Divider --- */
hr.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* --- Settings Grid --- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    align-items: start;
}

/* --- Report Summary Row --- */
.report-summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.summary-stat {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    text-align: center;
}

.summary-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-stat-label {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 500;
}

/* --- Color Swatch --- */
.color-swatch-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.color-swatch {
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
}

.color-swatch:hover, .color-swatch.selected {
    border-color: var(--text-primary);
    transform: scale(1.2);
}

/* --- Tom Select Overrides --- */
.ts-wrapper.form-control { padding: 0; background: transparent; border: none; }
.ts-control {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    padding: 6px 12px !important;
    font-family: var(--font);
    font-size: 13.5px;
    min-height: 40px;
    display: flex;
    align-items: center;
}
.ts-control.focus { box-shadow: 0 0 0 3px var(--accent-light) !important; border-color: var(--accent) !important; }
.ts-control > input { color: var(--text-primary) !important; font-family: var(--font); font-size: 13.5px; }
.ts-dropdown {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-md) !important;
    font-family: var(--font);
    font-size: 13.5px;
    margin-top: 4px;
}
.ts-dropdown .option { padding: 8px 12px; cursor: pointer; }
.ts-dropdown .active { background: var(--bg-hover) !important; color: var(--text-primary) !important; }
.ts-control .item {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
    padding: 2px 8px !important;
    margin: 2px !important;
    display: inline-flex;
    align-items: center;
}
.ts-wrapper.plugin-remove_button .item .remove {
    border-left: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
    padding: 0 6px !important;
}
.ts-wrapper.plugin-remove_button .item .remove:hover {
    background: var(--danger-light) !important;
    color: var(--danger) !important;
}

/* --- Sidebar User Widget --- */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.sidebar-user-dot {
    width: 30px; height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

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

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.logout-btn .material-symbols-rounded { font-size: 18px; }

/* --- Role Badges --- */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.role-badge.admin    { background: rgba(99,102,241,.15); color: #6366f1; }
.role-badge.employee { background: rgba(16,185,129,.12); color: #10b981; }

/* --- Dept Hours Widget --- */
.dept-hours-widget {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: center;
}

/* Circular ring */
.dept-ring-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.dept-ring-wrap svg {
    transform: rotate(-90deg);
    width: 120px;
    height: 120px;
}

.dept-ring-bg {
    fill: none;
    stroke: var(--bg-elevated);
    stroke-width: 10;
}

.dept-ring-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1),
                stroke 0.4s ease;
}

.dept-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.dept-ring-pct {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.5px;
}

.dept-ring-sub {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Stats side */
.dept-stats-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dept-widget-header {
    margin-bottom: 4px;
}

.dept-widget-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.dept-widget-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 1px;
}

.dept-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dept-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.dept-stat-label .material-symbols-rounded {
    font-size: 14px;
    opacity: 0.7;
}

.dept-stat-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.dept-progress-wrap {
    margin-top: 4px;
}

.dept-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.dept-progress-track {
    height: 7px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
}

.dept-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s;
}

/* Colour states for ring & bar */
.dept-color-good   { stroke: #10b981; }
.dept-color-warn   { stroke: #f59e0b; }
.dept-color-low    { stroke: #ef4444; }
.dept-color-over   { stroke: #6366f1; }

.dept-bar-good  { background: #10b981; }
.dept-bar-warn  { background: #f59e0b; }
.dept-bar-low   { background: #ef4444; }
.dept-bar-over  { background: var(--accent); }

/* Skeleton loader */
.dept-skeleton {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 24px;
    align-items: center;
}

.skeleton-circle {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: var(--bg-elevated);
    animation: skeletonPulse 1.4s ease-in-out infinite;
}

.skeleton-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: var(--bg-elevated);
    animation: skeletonPulse 1.4s ease-in-out infinite;
}

@keyframes skeletonPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

@media (max-width: 480px) {
    .dept-hours-widget {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
    .dept-stat-row { justify-content: center; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .page-content { padding: 16px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .form-group {
        min-width: 100%;
        margin-bottom: 12px;
    }
    .filter-bar > div {
        width: 100%;
    }
    .filter-bar .btn {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
    .date-presets {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    .date-preset-btn {
        flex-shrink: 0;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .section-header > div {
        width: 100%;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    .section-header > div > .btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }

    .tabs {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    .tab-btn {
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .report-summary-row { grid-template-columns: 1fr 1fr; }
    
    .topbar {
        padding: 0 16px;
    }
    .topbar-title h1 {
        font-size: 15px;
    }
    
    .modal {
        width: 95%;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-row { grid-template-columns: 1fr; }
}

/* ─── Notification System ─────────────────────────────────────────────────── */

/* Wrapper (anchor for dropdown) */
.notif-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Bell button */
.notif-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.notif-btn:hover,
.notif-btn--active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.notif-btn .material-symbols-rounded {
    font-size: 22px;
    font-variation-settings: 'FILL' 0;
    transition: font-variation-settings var(--transition);
}

.notif-btn--active .material-symbols-rounded {
    font-variation-settings: 'FILL' 1;
    color: var(--accent);
}

/* Badge */
.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 10px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--bg-surface);
    pointer-events: none;
    animation: badgePop 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes badgePop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* Dropdown Panel */
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    overflow: hidden;
}

.notif-panel--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Panel Header */
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.notif-panel-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.notif-mark-all {
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.notif-mark-all:hover {
    background: var(--accent-light);
}

/* List container */
.notif-list {
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Empty State */
.notif-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 36px 20px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* Individual Row */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    position: relative;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }

.notif-item--unread {
    background: color-mix(in srgb, var(--accent) 5%, transparent);
    border-left: 3px solid var(--accent);
}

.notif-item--unread:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* Icon */
.notif-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
    background: var(--bg-elevated);
}

.notif-icon .material-symbols-rounded {
    font-size: 18px;
    font-variation-settings: 'FILL' 1;
}

.notif-icon--pending  { background: var(--warning-light); }
.notif-icon--pending  .material-symbols-rounded { color: var(--warning); }
.notif-icon--approved { background: var(--success-light); }
.notif-icon--approved .material-symbols-rounded { color: var(--success); }
.notif-icon--rejected { background: var(--danger-light); }
.notif-icon--rejected .material-symbols-rounded { color: var(--danger); }

/* Content */
.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-body {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Delete button */
.notif-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: all var(--transition);
    margin-top: 2px;
}

.notif-item:hover .notif-delete { opacity: 1; }
.notif-delete:hover { background: var(--danger-light); color: var(--danger); }
.notif-delete .material-symbols-rounded { font-size: 15px; }

/* Responsive: on small screens go full-width */
@media (max-width: 480px) {
    .notif-panel {
        width: calc(100vw - 24px);
        right: -8px;
    }
}

