/* ============================================================
   Omnitrack - Global Design System
   Modern Cinematic Dark/Light Mode with Glassmorphism
   ============================================================ */

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

/* ── CSS Variables ── */
:root {
    /* Dark Mode (Default) */
    --bg-primary:       #0a0e1a;
    --bg-secondary:     #0f1628;
    --bg-tertiary:      #141d35;
    --bg-card:          rgba(20, 29, 53, 0.7);
    --bg-card-hover:    rgba(26, 38, 68, 0.85);
    --bg-input:         rgba(15, 22, 40, 0.8);

    --text-primary:     #e8eaf6;
    --text-secondary:   #8892b0;
    --text-muted:       #4a5568;

    --accent-cyan:      #00d4ff;
    --accent-purple:    #a855f7;
    --accent-emerald:   #10f0a0;
    --accent-amber:     #f59e0b;
    --accent-rose:      #f43f5e;

    --border-color:     rgba(255, 255, 255, 0.08);
    --border-glow:      rgba(0, 212, 255, 0.3);
    --glass-blur:       blur(16px);
    --glass-border:     1px solid rgba(255, 255, 255, 0.1);

    --sidebar-width:    260px;
    --topbar-height:    70px;

    --shadow-card:      0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.05);
    --shadow-glow-cyan: 0 0 20px rgba(0, 212, 255, 0.25);
    --shadow-glow-purple: 0 0 20px rgba(168, 85, 247, 0.25);

    --radius-sm:        8px;
    --radius-md:        12px;
    --radius-lg:        16px;
    --radius-xl:        24px;

    --transition:       all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast:  all 0.15s ease;
}

/* Light Mode Override */
[data-theme="light"] {
    --bg-primary:       #f0f4ff;
    --bg-secondary:     #e8edf8;
    --bg-tertiary:      #dde4f5;
    --bg-card:          rgba(255, 255, 255, 0.85);
    --bg-card-hover:    rgba(255, 255, 255, 0.95);
    --bg-input:         rgba(240, 244, 255, 0.9);

    --text-primary:     #1a1f36;
    --text-secondary:   #4a5568;
    --text-muted:       #9aa5b4;

    --border-color:     rgba(0, 0, 0, 0.08);
    --border-glow:      rgba(0, 150, 200, 0.2);

    --shadow-card:      0 4px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0,0,0,0.04);
    --shadow-glow-cyan: 0 0 20px rgba(0, 150, 200, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

/* Background ambient glow for dark mode */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: -10%;
    width: 50%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(0, 212, 255, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 50%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(168, 85, 247, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] body::before,
[data-theme="light"] body::after {
    display: none;
}

/* ── Layout ── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content {
    padding: 28px 32px;
    flex: 1;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow-cyan);
    flex-shrink: 0;
}

.sidebar-logo h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.sidebar-logo p {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

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

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 8px 8px 4px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: rgba(0, 212, 255, 0.08);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(168, 85, 247, 0.10));
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(to bottom, var(--accent-cyan), var(--accent-purple));
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    margin-bottom: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.user-info .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* ── Top Bar ── */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-greeting h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.desktop-greeting { display: block; }
.mobile-greeting { display: none; }

.topbar-greeting p {
    font-size: 12px;
    color: var(--text-secondary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-date {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 20px;
    border: var(--glass-border);
}

/* ── Theme Toggle ── */
#theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: var(--glass-border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

#theme-toggle:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: var(--shadow-glow-cyan);
}

/* ── Glass Cards ── */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    animation: fadeInUp 0.4s ease both;
}

.card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-card), var(--shadow-glow-cyan);
    transform: translateY(-2px);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

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

.card-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Stat Cards with accent border-top */
.stat-card {
    border-top: 3px solid var(--accent-cyan);
}

.stat-card.purple  { border-top-color: var(--accent-purple); }
.stat-card.emerald { border-top-color: var(--accent-emerald); }
.stat-card.amber   { border-top-color: var(--accent-amber); }
.stat-card.rose    { border-top-color: var(--accent-rose); }

/* ── Grid Layouts ── */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

/* ── Page Header ── */
.page-header {
    margin-bottom: 28px;
    animation: fadeInDown 0.4s ease both;
}

.page-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.page-header-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: var(--glass-border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.25);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
}

/* ── Form Elements ── */
.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
}

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

.form-control:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
    background: var(--bg-card);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Select */
select.form-control {
    cursor: pointer;
}

/* ── Badge ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-cyan    { background: rgba(0,212,255,0.15);   color: var(--accent-cyan);    border: 1px solid rgba(0,212,255,0.3); }
.badge-purple  { background: rgba(168,85,247,0.15);  color: var(--accent-purple);  border: 1px solid rgba(168,85,247,0.3); }
.badge-emerald { background: rgba(16,240,160,0.15);  color: var(--accent-emerald); border: 1px solid rgba(16,240,160,0.3); }
.badge-amber   { background: rgba(245,158,11,0.15);  color: var(--accent-amber);   border: 1px solid rgba(245,158,11,0.3); }
.badge-rose    { background: rgba(244,63,94,0.15);   color: var(--accent-rose);    border: 1px solid rgba(244,63,94,0.3); }

/* ── To-Do List ── */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    animation: fadeInLeft 0.3s ease both;
}

.task-item:hover {
    border-color: rgba(0, 212, 255, 0.2);
    background: var(--bg-card);
}

.task-item.completed {
    opacity: 0.6;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.task-checkbox.checked {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border-color: transparent;
}

.task-checkbox.checked::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.task-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
}

.task-item.completed .task-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.task-item:hover .task-actions {
    opacity: 1;
}

/* ── Add Task Input ── */
.add-task-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.add-task-row .form-control {
    flex: 1;
}

/* ── Progress / Radial ── */
.radial-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* ── Divider ── */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

/* ── Section spacing ── */
.section {
    margin-bottom: 24px;
}

/* ── Table ── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-bottom: var(--glass-border);
}

tbody td {
    padding: 13px 16px;
    border-bottom: var(--glass-border);
    color: var(--text-primary);
    vertical-align: middle;
}

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

tbody tr:hover td {
    background: rgba(0, 212, 255, 0.03);
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-danger  { background: rgba(244,63,94,0.1);   border: 1px solid rgba(244,63,94,0.3);  color: var(--accent-rose); }
.alert-success { background: rgba(16,240,160,0.1);  border: 1px solid rgba(16,240,160,0.3); color: var(--accent-emerald); }
.alert-info    { background: rgba(0,212,255,0.1);   border: 1px solid rgba(0,212,255,0.3);  color: var(--accent-cyan); }

/* ── Heatmap Calendar ── */
.heatmap-container {
    overflow-x: auto;
    padding-bottom: 8px;
}

.heatmap-grid {
    display: flex;
    gap: 3px;
}

.heatmap-week {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-day {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

.heatmap-day:hover {
    transform: scale(1.4);
    z-index: 1;
    position: relative;
}

.heatmap-day.level-1 { background: rgba(0,212,255,0.2); border-color: rgba(0,212,255,0.3); }
.heatmap-day.level-2 { background: rgba(0,212,255,0.4); border-color: rgba(0,212,255,0.5); }
.heatmap-day.level-3 { background: rgba(0,212,255,0.65); border-color: rgba(0,212,255,0.7); }
.heatmap-day.level-4 { background: rgba(0,212,255,0.9); border-color: var(--accent-cyan); box-shadow: 0 0 6px rgba(0,212,255,0.5); }

.heatmap-labels {
    display: flex;
    gap: 3px;
    margin-bottom: 4px;
    padding-left: 20px;
}

.heatmap-month-label {
    font-size: 10px;
    color: var(--text-muted);
}

.heatmap-day-labels {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-right: 4px;
    justify-content: space-around;
}

.heatmap-day-label {
    font-size: 9px;
    color: var(--text-muted);
    height: 12px;
    line-height: 12px;
}

/* ── Vocabulary Card ── */
.vocab-card {
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    animation: fadeInLeft 0.3s ease both;
}

.vocab-card:hover {
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: var(--shadow-glow-purple);
}

.vocab-word {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 4px;
}

.vocab-meaning {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.vocab-example {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    border-left: 2px solid var(--accent-purple);
    padding-left: 8px;
}

/* ── Practice Checklist ── */
.practice-check-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: var(--transition);
}

.practice-check-row:hover {
    border-color: rgba(16,240,160,0.2);
}

.practice-check-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Financial ── */
.finance-type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.type-btn {
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.type-btn.income.active {
    background: rgba(16,240,160,0.15);
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

.type-btn.expense.active {
    background: rgba(244,63,94,0.15);
    border-color: var(--accent-rose);
    color: var(--accent-rose);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* ── Animations ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-15px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-15px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(0,212,255,0.3); }
    50%       { box-shadow: 0 0 20px rgba(0,212,255,0.6); }
}

/* Stagger animation for grid items */
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }

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

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

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

/* ── Tooltip ── */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    border: var(--glass-border);
    pointer-events: none;
    z-index: 999;
}

/* ── Loading spinner ── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ── Responsive ── */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-2-1 { grid-template-columns: 1fr; }
    .grid-1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 0px; }
    .sidebar { transform: translateX(-260px); }
    .sidebar.open { transform: translateX(0); width: 260px; z-index: 1001; }
    .main-content { margin-left: 0; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .page-content { padding: 16px 12px; }
    .topbar { padding: 0 12px; }
    
    #menu-toggle { display: block !important; }
    .desktop-greeting { display: none; }
    .mobile-greeting { display: block; font-size: 15px !important; }
    .topbar-actions input[type="date"] { width: 125px !important; font-size: 12px; padding: 6px 8px; }
}

@media (max-width: 600px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 18px; }
    .card { padding: 16px; }
    .topbar-greeting p { font-size: 11px; }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

