/* ============================================================
   RESERVADA v2 — Design System
   Luxury dark theme with glass morphism
   ============================================================ */

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

:root {
    /* Background layers */
    --bg-deep: #05060a;
    --bg-base: #090a10;
    --bg-surface: #0e1017;
    --bg-card: #12141d;
    --bg-card-hover: #171a25;
    --bg-elevated: #1c1f2b;
    --bg-input: #0b0c13;
    --bg-glass: rgba(18, 20, 29, 0.7);

    /* Borders */
    --border: rgba(255,255,255,0.05);
    --border-hover: rgba(255,255,255,0.1);
    --border-focus: #FF1616;
    --border-glass: rgba(255,255,255,0.08);

    /* Text */
    --text-primary: #f2f3f5;
    --text-secondary: #8b8fa0;
    --text-muted: #525669;
    --text-inverse: #05060a;

    /* Brand Colors */
    --primary: #FF1616;
    --primary-dark: #CC1111;
    --primary-light: #FF4444;
    --primary-glow: rgba(255, 22, 22, 0.12);
    --primary-glow-strong: rgba(255, 22, 22, 0.25);

    /* Accent Colors */
    --purple: #8B5CF6;
    --purple-glow: rgba(139, 92, 246, 0.12);
    --blue: #3B82F6;
    --blue-glow: rgba(59, 130, 246, 0.12);
    --amber: #F59E0B;
    --amber-glow: rgba(245, 158, 11, 0.12);
    --red: #EF4444;
    --red-glow: rgba(239, 68, 68, 0.1);
    --cyan: #06B6D4;
    --cyan-glow: rgba(6, 182, 212, 0.12);
    --rose: #F43F5E;
    --rose-glow: rgba(244, 63, 94, 0.12);

    /* Layout */
    --sidebar-w: 270px;
    --sidebar-collapsed: 72px;

    /* Radius */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* Font */
    --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition: 0.2s var(--ease);
    --transition-slow: 0.35s var(--ease);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px rgba(255,22,22,0.08);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-light); }

::selection { background: var(--primary-glow-strong); color: var(--primary-light); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

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

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-base);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar::before {
    content: '';
    position: absolute; top: 0; left: 0; bottom: 0; width: 100%;
    background: linear-gradient(180deg, rgba(255,22,22,0.02) 0%, transparent 40%);
    pointer-events: none;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.sidebar-logo {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    position: relative;
}

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

.sidebar-logo-text {
    font-size: 22px; font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

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

.nav-section { margin-bottom: 28px; }

.nav-section-title {
    font-size: 10px; text-transform: uppercase; letter-spacing: 2px;
    color: var(--text-muted); padding: 0 14px; margin-bottom: 8px;
    font-weight: 700;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius);
    color: var(--text-secondary); font-weight: 500; font-size: 13.5px;
    transition: all var(--transition); cursor: pointer;
    text-decoration: none; margin-bottom: 2px;
    position: relative;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; opacity: 0.7; }
.nav-item:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.nav-item:hover i { opacity: 1; }

.nav-item.active {
    color: var(--primary);
    background: var(--primary-glow);
}
.nav-item.active i { opacity: 1; }
.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-badge {
    margin-left: auto; background: var(--red); color: white;
    font-size: 10px; font-weight: 700; padding: 2px 7px;
    border-radius: 10px; min-width: 20px; text-align: center;
}
.nav-badge-primary {
    margin-left: auto; background: var(--primary-glow); color: var(--primary);
    font-size: 11px; font-weight: 600; padding: 3px 8px;
    border-radius: 8px;
}

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

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: var(--radius);
    transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,0.03); }

.sidebar-user-avatar {
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-glow-strong), var(--primary-glow));
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    border: 1px solid rgba(255,22,22,0.2);
}
.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); }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 32px 36px;
    min-height: 100vh;
    position: relative;
}

/* Subtle grid background */
.main-content::before {
    content: '';
    position: fixed; top: 0; left: var(--sidebar-w); right: 0; bottom: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.015) 1px, transparent 0);
    background-size: 40px 40px;
    pointer-events: none; z-index: 0;
}

.main-content > * { position: relative; z-index: 1; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 32px; gap: 20px;
}

.page-title {
    font-size: 28px; font-weight: 700; letter-spacing: -0.5px;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 14px; color: var(--text-secondary); margin-top: 4px;
}

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

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px; margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    position: relative; overflow: hidden;
    transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }

.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    opacity: 0.8;
}
.stat-card.emerald::before { background: linear-gradient(90deg, #10B981, #34D399); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), #A78BFA); }
.stat-card.amber::before { background: linear-gradient(90deg, var(--amber), #FBBF24); }
.stat-card.red::before { background: linear-gradient(90deg, var(--red), #F87171); }
.stat-card.blue::before { background: linear-gradient(90deg, var(--blue), #60A5FA); }
.stat-card.cyan::before { background: linear-gradient(90deg, var(--cyan), #22D3EE); }

.stat-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 14px;
}
.stat-icon.emerald { background: rgba(16,185,129,0.12); color: #10B981; }
.stat-icon.purple { background: var(--purple-glow); color: var(--purple); }
.stat-icon.amber { background: var(--amber-glow); color: var(--amber); }
.stat-icon.red { background: var(--red-glow); color: var(--red); }
.stat-icon.blue { background: var(--blue-glow); color: var(--blue); }
.stat-icon.cyan { background: var(--cyan-glow); color: var(--cyan); }

.stat-label {
    font-size: 12px; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 1px; font-weight: 600;
}
.stat-value {
    font-size: 30px; font-weight: 800; margin-top: 6px; line-height: 1;
    letter-spacing: -1px;
}
.stat-value.emerald { color: #10B981; }
.stat-value.purple { color: var(--purple); }
.stat-value.amber { color: var(--amber); }
.stat-value.red { color: var(--red); }
.stat-value.blue { color: var(--blue); }
.stat-value.cyan { color: var(--cyan); }

.stat-change {
    font-size: 12px; color: var(--text-muted); margin-top: 8px;
    display: flex; align-items: center; gap: 4px;
}
.stat-change.up { color: var(--primary); }
.stat-change.down { color: var(--red); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-hover); }

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

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

table.rv-table thead th {
    text-align: left; padding: 14px 18px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-muted); font-weight: 700;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    position: sticky; top: 0; z-index: 2;
    white-space: nowrap;
}

table.rv-table tbody td {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    font-size: 14px; color: var(--text-secondary);
    vertical-align: middle;
}
table.rv-table tbody tr { transition: background var(--transition); }
table.rv-table tbody tr:hover { background: rgba(255,255,255,0.02); }
table.rv-table tbody tr:last-child td { border-bottom: none; }

.table-cell-name {
    display: flex; align-items: center; gap: 12px;
}
.table-cell-avatar {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    flex-shrink: 0;
}

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    white-space: nowrap;
}
.badge-emerald, .badge-confirmed { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.badge-purple { background: var(--purple-glow); color: var(--purple); }
.badge-amber, .badge-pending { background: var(--amber-glow); color: var(--amber); }
.badge-red, .badge-cancelled { background: var(--red-glow); color: var(--red); }
.badge-blue { background: var(--blue-glow); color: var(--blue); }
.badge-cyan { background: var(--cyan-glow); color: var(--cyan); }
.badge-gray { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.badge-rose { background: var(--rose-glow); color: var(--rose); }
.badge-paid { background: var(--primary-glow); color: var(--primary); }
.badge-unpaid { background: var(--red-glow); color: var(--red); }

.badge-dot::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius);
    font-size: 13.5px; font-weight: 600; cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none; line-height: 1.4;
    font-family: var(--font);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 10px rgba(255,22,22,0.2);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white; transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255,22,22,0.3);
}

.btn-secondary {
    background: var(--bg-elevated); color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-card-hover); color: white; }

.btn-danger {
    background: var(--red-glow); color: var(--red);
    border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover { background: var(--red); color: white; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; border-radius: var(--radius-sm); }
.btn-icon i { margin: 0; }

.btn-purple { background: var(--purple); color: white; }
.btn-purple:hover { background: #7C3AED; color: white; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-required { color: var(--red); }

.form-input, .form-select, .form-textarea {
    width: 100%; padding: 11px 16px;
    background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 14px; font-family: var(--font);
    transition: all var(--transition);
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow), 0 0 20px rgba(255,22,22,0.05);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a5d66' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-select option { background: var(--bg-card); }

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

.form-switch {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; font-size: 14px; color: var(--text-secondary);
}
.form-switch input { display: none; }
.form-switch-track {
    width: 42px; height: 24px; border-radius: 12px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    position: relative; transition: all var(--transition);
}
.form-switch-track::after {
    content: ''; width: 18px; height: 18px; border-radius: 50%;
    background: var(--text-muted); position: absolute;
    top: 2px; left: 2px; transition: all var(--transition);
}
.form-switch input:checked + .form-switch-track {
    background: var(--primary-glow); border-color: var(--primary);
}
.form-switch input:checked + .form-switch-track::after {
    background: var(--primary); transform: translateX(18px);
}

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.alert {
    padding: 14px 18px; border-radius: var(--radius);
    font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 20px;
    animation: slideDown 0.3s var(--ease);
}
.alert-success { background: var(--primary-glow); color: var(--primary); border: 1px solid rgba(255,22,22,0.15); }
.alert-error { background: var(--red-glow); color: var(--red); border: 1px solid rgba(239,68,68,0.15); }
.alert-warning { background: var(--amber-glow); color: var(--amber); border: 1px solid rgba(245,158,11,0.15); }
.alert-info { background: var(--blue-glow); color: var(--blue); border: 1px solid rgba(59,130,246,0.15); }

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

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card); border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl); padding: 32px;
    max-width: 600px; width: 92%; max-height: 90vh; overflow-y: auto;
    animation: modalIn 0.25s var(--spring);
    box-shadow: var(--shadow-lg);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px;
}
.modal-title { font-size: 20px; font-weight: 700; }
.modal-close {
    cursor: pointer; color: var(--text-muted); font-size: 20px;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon {
    width: 80px; height: 80px; border-radius: var(--radius-xl);
    background: var(--primary-glow); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 32px; margin-bottom: 20px;
}
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.empty-state-desc { font-size: 14px; color: var(--text-muted); margin-top: 8px; max-width: 400px; margin-inline: auto; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
    display: flex; gap: 4px; padding: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    width: fit-content;
}
.tab {
    padding: 8px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; color: var(--text-muted);
    cursor: pointer; transition: all var(--transition);
    text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
    position: relative; max-width: 320px;
}
.search-bar i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 14px;
}
.search-bar input {
    width: 100%; padding: 10px 14px 10px 40px;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary);
    font-size: 13px; font-family: var(--font);
    transition: all var(--transition); outline: none;
}
.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-bar input::placeholder { color: var(--text-muted); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex; justify-content: center; gap: 4px;
    margin-top: 24px;
}
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; color: var(--text-muted);
    text-decoration: none; transition: all var(--transition);
    border: 1px solid transparent;
}
.pagination a:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.pagination .active {
    background: var(--primary-glow); color: var(--primary);
    border-color: rgba(255,22,22,0.2);
}

/* ============================================================
   CALENDAR (Grid)
   ============================================================ */
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.cal-nav { display: flex; gap: 8px; align-items: center; }
.cal-title { font-size: 18px; font-weight: 700; }

.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
    background: var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.cal-day-header {
    background: var(--bg-surface); padding: 10px;
    text-align: center; font-size: 11px; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted); font-weight: 700;
}
.cal-day {
    background: var(--bg-card); min-height: 120px; padding: 8px;
    transition: background var(--transition); cursor: pointer;
    position: relative;
}
.cal-day:hover { background: var(--bg-card-hover); }
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.cal-day.today .cal-day-num { color: var(--primary); }
.cal-day.other-month { opacity: 0.3; }

.cal-event {
    padding: 3px 6px; border-radius: 4px; font-size: 11px;
    margin-bottom: 2px; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-weight: 500;
}

/* ============================================================
   CODE BOX
   ============================================================ */
.code-box {
    background: var(--bg-deep); border: 1px solid var(--border);
    padding: 14px 18px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 13px;
    color: var(--primary);
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    word-break: break-all;
}

/* ============================================================
   ONBOARDING WIZARD
   ============================================================ */
.wizard-steps { display: flex; gap: 0; margin-bottom: 40px; }
.wizard-step {
    flex: 1; text-align: center; padding: 16px 8px;
    position: relative; cursor: default;
}
.wizard-step::after {
    content: ''; position: absolute; top: 24px; right: -50%;
    width: 100%; height: 2px; background: var(--border);
}
.wizard-step:last-child::after { display: none; }
.wizard-step.active::after, .wizard-step.done::after { background: var(--primary); }

.wizard-step-number {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg-elevated); border: 2px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px; color: var(--text-muted);
    position: relative; z-index: 1;
    transition: all var(--transition);
}
.wizard-step.active .wizard-step-number {
    border-color: var(--primary); color: var(--primary);
    background: var(--primary-glow);
    box-shadow: 0 0 20px rgba(255,22,22,0.15);
}
.wizard-step.done .wizard-step-number {
    border-color: var(--primary); color: white;
    background: var(--primary);
}
.wizard-step-label { font-size: 12px; color: var(--text-muted); margin-top: 10px; font-weight: 500; }
.wizard-step.active .wizard-step-label { color: var(--primary); }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

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

@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

    .mobile-toggle {
        display: flex; align-items: center; justify-content: center;
        position: fixed; top: 16px; left: 16px; z-index: 101;
        background: var(--bg-card); border: 1px solid var(--border);
        border-radius: var(--radius-sm); padding: 10px 12px;
        color: var(--text-primary); cursor: pointer;
        box-shadow: var(--shadow-md);
    }

    .mobile-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99;
    }
    .mobile-overlay.active { display: block; }

    .main-content { margin-left: 0; padding: 20px 16px; padding-top: 64px; }
    .main-content::before { left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .page-actions { width: 100%; }
    .tabs { overflow-x: auto; width: 100%; }
    .cal-day { min-height: 80px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 22px; }
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
    min-height: 100vh; display: flex;
    background: var(--bg-deep);
}

.auth-left {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px;
}

.auth-right {
    flex: 1;
    background: linear-gradient(135deg, #061210 0%, #090a10 50%, #0a1018 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 60px; position: relative; overflow: hidden;
}
.auth-right::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(255,22,22,0.08) 0%, transparent 60%);
}
.auth-right::after {
    content: ''; position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.02) 1px, transparent 0);
    background-size: 40px 40px;
}

.auth-box { max-width: 420px; width: 100%; }

.auth-logo-img { height: 36px; width: auto; margin-bottom: 24px; }

.auth-tagline {
    color: var(--text-muted); margin-bottom: 36px; font-size: 15px;
}

.auth-promo { position: relative; z-index: 1; max-width: 480px; }
.auth-promo h2 {
    font-size: 40px; font-weight: 800; line-height: 1.15;
    margin-bottom: 20px; letter-spacing: -1px;
}
.auth-promo h2 em { font-style: normal; color: var(--primary); }
.auth-promo p { color: var(--text-secondary); font-size: 16px; line-height: 1.7; }

.auth-features {
    margin-top: 40px; display: flex; flex-direction: column; gap: 16px;
}
.auth-feature {
    display: flex; gap: 14px; align-items: flex-start;
}
.auth-feature-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--primary-glow); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.auth-feature-text h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.auth-feature-text p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

@media (max-width: 900px) {
    .auth-right { display: none; }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   LOADING / SKELETON
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   COLOR PICKER (small inline)
   ============================================================ */
.color-picker {
    display: flex; gap: 6px; align-items: center;
}
.color-swatch {
    width: 28px; height: 28px; border-radius: var(--radius-xs);
    border: 2px solid var(--border); cursor: pointer;
    transition: all var(--transition);
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-deep); }

/* ============================================================
   LIGHT THEME
   ============================================================ */
[data-theme="light"] {
    --bg-deep: #f5f6fa;
    --bg-base: #f0f1f6;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fc;
    --bg-elevated: #ffffff;
    --bg-input: #f5f6fa;
    --bg-glass: rgba(255, 255, 255, 0.85);

    --border: rgba(0,0,0,0.06);
    --border-hover: rgba(0,0,0,0.1);
    --border-focus: #FF1616;
    --border-glass: rgba(0,0,0,0.06);

    --text-primary: #1a1d2e;
    --text-secondary: #64688a;
    --text-muted: #9ca0b8;
    --text-inverse: #ffffff;

    --primary-glow: rgba(255, 22, 22, 0.08);
    --primary-glow-strong: rgba(255, 22, 22, 0.15);

    --purple-glow: rgba(139, 92, 246, 0.08);
    --blue-glow: rgba(59, 130, 246, 0.08);
    --amber-glow: rgba(245, 158, 11, 0.08);
    --red-glow: rgba(239, 68, 68, 0.06);
    --cyan-glow: rgba(6, 182, 212, 0.08);
    --rose-glow: rgba(244, 63, 94, 0.08);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --shadow-glow: 0 0 40px rgba(255,22,22,0.04);

    color-scheme: light;
}

[data-theme="light"] .sidebar {
    background: #ffffff;
    border-right: 1px solid rgba(0,0,0,0.06);
    box-shadow: 2px 0 12px rgba(0,0,0,0.04);
}
[data-theme="light"] .sidebar-logo-img { /* keep original red logo */ }
[data-theme="light"] .nav-item { color: #64688a; }
[data-theme="light"] .nav-item:hover,
[data-theme="light"] .nav-item.active { background: rgba(255,22,22,0.06); color: #FF1616; }
[data-theme="light"] .nav-section-title { color: #9ca0b8; }
[data-theme="light"] .sidebar-user { border-top-color: rgba(0,0,0,0.06); }
[data-theme="light"] .sidebar-user-avatar { background: linear-gradient(135deg,#FF1616,#FF4444); color: #fff; }

[data-theme="light"] .card,
[data-theme="light"] .stat-card { background: #ffffff; border-color: rgba(0,0,0,0.06); box-shadow: 0 1px 4px rgba(0,0,0,0.04); }

[data-theme="light"] .form-control,
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea { background: #f5f6fa; border-color: rgba(0,0,0,0.1); color: #1a1d2e; }
[data-theme="light"] .form-control:focus,
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus { background: #ffffff; border-color: #FF1616; }

[data-theme="light"] .table th { background: #f5f6fa; color: #64688a; border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .table td { border-color: rgba(0,0,0,0.04); }
[data-theme="light"] .table tr:hover td { background: #f8f9fc; }

[data-theme="light"] .btn-ghost { color: #64688a; }
[data-theme="light"] .btn-ghost:hover { background: rgba(0,0,0,0.04); color: #1a1d2e; }
[data-theme="light"] .badge { border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .tab { color: #64688a; }
[data-theme="light"] .tab.active,
[data-theme="light"] .tab:hover { color: #FF1616; border-color: #FF1616; }
[data-theme="light"] .modal-content { background: #ffffff; border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .alert { border-color: rgba(0,0,0,0.08); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

[data-theme="light"] .stat-value.emerald { color: #059669; }
[data-theme="light"] .stat-value.purple { color: #7C3AED; }
[data-theme="light"] .stat-value.amber { color: #D97706; }
[data-theme="light"] .stat-value.cyan { color: #0891B2; }
[data-theme="light"] .stat-icon.emerald { background: rgba(5,150,105,0.08); color: #059669; }
[data-theme="light"] .stat-icon.purple { background: rgba(124,58,237,0.08); color: #7C3AED; }
[data-theme="light"] .stat-icon.amber { background: rgba(217,119,6,0.08); color: #D97706; }
[data-theme="light"] .stat-icon.cyan { background: rgba(8,145,178,0.08); color: #0891B2; }

.theme-toggle-sidebar {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all var(--transition);
    flex-shrink: 0;
}
.theme-toggle-sidebar:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(20deg);
}
