/* ============================================
   FONTS & VARIABLES
   ============================================ */
:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Core Palette */
    --bg-body: #0b0e14;
    --bg-sidebar: #0f1218;
    --bg-main: #0f1319;
    --bg-card: #151a23;
    --bg-card-hover: #1a2030;
    --bg-input: #1a1f2b;
    --bg-input-focus: #1e2536;

    /* Borders */
    --border: #1e2535;
    --border-light: #2a3346;
    --border-focus: #3b82f6;

    /* Text */
    --text-primary: #e8ecf4;
    --text-secondary: #7b849b;
    --text-muted: #4b5468;
    --text-white: #ffffff;

    /* Accent Colors */
    --blue: #3b82f6;
    --blue-dark: #2563eb;
    --blue-glow: rgba(59, 130, 246, 0.15);
    --green: #10b981;
    --green-dark: #059669;
    --green-glow: rgba(16, 185, 129, 0.12);
    --red: #ef4444;
    --red-dark: #dc2626;
    --red-glow: rgba(239, 68, 68, 0.12);
    --amber: #f59e0b;
    --amber-dark: #d97706;
    --amber-glow: rgba(245, 158, 11, 0.12);
    --purple: #8b5cf6;
    --purple-glow: rgba(139, 92, 246, 0.12);
    --cyan: #06b6d4;

    /* Layout */
    --sidebar-w: 260px;
    --header-h: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* Shadows */
    --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);
    --shadow-glow-blue: 0 0 20px rgba(59,130,246,0.2);
    --shadow-glow-green: 0 0 20px rgba(16,185,129,0.15);

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.25s;
}

/* ============================================
   RESET
   ============================================ */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font-main); }
input { font-family: var(--font-main); }

/* ============================================
   SCREEN MANAGEMENT
   ============================================ */
.screen { display: none; }
.screen.active { display: block; }
.section { display: none; }
.section.active { display: block; animation: sectionIn 0.35s var(--ease); }

@keyframes sectionIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   LOGIN
   ============================================ */
#login-screen.active { display: flex; }

.login-bg {
    width: 100%; min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59,130,246,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(139,92,246,0.06) 0%, transparent 60%),
        var(--bg-body);
    padding: 20px;
}

.login-card {
    width: 100%; max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 36px 36px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--blue), var(--purple), var(--blue));
    background-size: 200% 100%;
    animation: gradientSlide 3s ease infinite;
}

@keyframes gradientSlide {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.login-brand {
    text-align: center;
    margin-bottom: 36px;
}

.brand-icon {
    width: 64px; height: 64px; margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: white;
    box-shadow: var(--shadow-glow-blue);
}

.login-brand h1 {
    font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
}

.brand-dot { color: var(--blue); }

.brand-sub {
    font-size: 13px; color: var(--text-secondary);
    margin-top: 4px; letter-spacing: 1px; text-transform: uppercase;
}

.input-group {
    position: relative; margin-bottom: 16px;
}

.input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 14px;
    pointer-events: none; transition: color var(--duration) var(--ease);
    z-index: 1;
}

.input-group input {
    width: 100%; padding: 14px 14px 14px 44px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 14px; outline: none;
    transition: all var(--duration) var(--ease);
}

.input-group input:focus {
    border-color: var(--blue);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--blue-glow);
}

.input-group input:focus ~ .input-icon,
.input-group:focus-within .input-icon {
    color: var(--blue);
}

.input-action {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted);
    font-size: 14px; padding: 6px;
    transition: color var(--duration);
}

.input-action:hover { color: var(--text-primary); }

.login-error {
    color: var(--red); font-size: 13px;
    text-align: center; min-height: 20px; margin-bottom: 4px;
}

.btn-login {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    border: none; border-radius: var(--radius-sm);
    color: white; font-size: 15px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all var(--duration) var(--ease);
    position: relative; overflow: hidden;
}

.btn-login:hover {
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-1px);
}

.btn-login:active { transform: translateY(0); }

.login-footer {
    text-align: center; margin-top: 28px;
    font-size: 12px; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 200;
    transition: transform var(--duration) var(--ease);
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex; align-items: center; gap: 12px;
    font-size: 20px; font-weight: 800;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand i {
    font-size: 22px;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1; padding: 16px 12px;
    display: flex; flex-direction: column; gap: 4px;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--blue-glow);
    color: var(--blue);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; background: var(--blue);
    border-radius: 0 4px 4px 0;
}

.nav-item i { width: 20px; text-align: center; font-size: 16px; }

.sidebar-bottom {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 8px; margin-bottom: 10px;
}

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: white;
}

.user-name {
    font-size: 13px; font-weight: 600;
    display: block; max-width: 150px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-role {
    font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}

.btn-logout {
    width: 100%; padding: 10px;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all var(--duration) var(--ease);
}

.btn-logout:hover {
    background: var(--red-glow);
    border-color: rgba(239,68,68,0.3);
    color: var(--red);
}

/* ============================================
   MOBILE HEADER
   ============================================ */
.mobile-header {
    display: none;
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    align-items: center; justify-content: space-between;
    z-index: 150;
}

.mobile-menu-btn, .mobile-add-btn {
    width: 40px; height: 40px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--duration);
}

.mobile-menu-btn:hover, .mobile-add-btn:hover {
    background: var(--bg-card-hover);
}

.mobile-brand {
    font-size: 18px; font-weight: 800;
    display: flex; align-items: center; gap: 8px;
}

.mobile-brand i {
    color: var(--blue);
}

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 190;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active { display: block; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    padding: 32px;
}

.section-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}

.section-title {
    font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
    display: flex; align-items: center; gap: 10px;
}

.section-title i { color: var(--blue); font-size: 24px; }

.section-subtitle {
    font-size: 14px; color: var(--text-secondary); margin-top: 4px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 10px 20px; border: none;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--blue); color: white;
    box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.btn-primary:hover { background: var(--blue-dark); box-shadow: var(--shadow-glow-blue); }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: var(--green-dark); }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: var(--red-dark); }

.btn-warning { background: var(--amber); color: #1a1a1a; }
.btn-warning:hover { background: var(--amber-dark); }

.btn-ghost {
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 14px; }

.btn-icon {
    width: 34px; height: 34px; padding: 0;
    border-radius: var(--radius-xs);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex; align-items: center; gap: 16px;
    transition: all var(--duration) var(--ease);
    position: relative; overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-total-cost::after { background: linear-gradient(90deg, var(--blue), var(--purple)); }
.stat-events::after { background: var(--cyan); }
.stat-attended::after { background: var(--green); }
.stat-cancelled::after { background: var(--red); }
.stat-pending-card::after { background: var(--amber); }
.stat-saved::after { background: var(--purple); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}

.stat-total-cost .stat-icon { background: var(--blue-glow); color: var(--blue); }
.stat-events .stat-icon     { background: rgba(6,182,212,0.12); color: var(--cyan); }
.stat-attended .stat-icon   { background: var(--green-glow); color: var(--green); }
.stat-cancelled .stat-icon  { background: var(--red-glow); color: var(--red); }
.stat-pending-card .stat-icon { background: var(--amber-glow); color: var(--amber); }
.stat-saved .stat-icon      { background: var(--purple-glow); color: var(--purple); }

.stat-value {
    display: block;
    font-size: 24px; font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: -0.5px;
}

.stat-label {
    display: block;
    font-size: 12px; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ============================================
   DASHBOARD PANELS
   ============================================ */
.dashboard-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 14px; font-weight: 700;
    display: flex; align-items: center; gap: 8px;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px;
}

.panel-header h3 i { color: var(--blue); font-size: 14px; }

.panel-body {
    padding: 8px;
    max-height: 340px;
    overflow-y: auto;
}

.panel-empty {
    text-align: center; padding: 40px 20px;
    color: var(--text-muted); font-size: 13px;
}

.panel-event-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    transition: background var(--duration);
}

.panel-event-row:hover { background: var(--bg-card-hover); }

.panel-event-date {
    width: 48px; height: 48px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    flex-shrink: 0;
}

.panel-event-date .p-month {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; color: var(--blue);
    letter-spacing: 0.5px; line-height: 1;
}

.panel-event-date .p-day {
    font-size: 18px; font-weight: 800; line-height: 1.1;
}

.panel-event-info { flex: 1; min-width: 0; }

.panel-event-info .p-name {
    font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.panel-event-info .p-detail {
    font-size: 11px; color: var(--text-muted);
}

.panel-event-cost {
    font-family: var(--font-mono);
    font-size: 14px; font-weight: 600;
    color: var(--green);
}

/* Summary bar items */
.summary-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.summary-row:last-child { border-bottom: none; }

.summary-row .s-label {
    font-size: 13px; color: var(--text-secondary);
    display: flex; align-items: center; gap: 8px;
}

.summary-row .s-label i { width: 16px; text-align: center; }

.summary-row .s-value {
    font-family: var(--font-mono);
    font-size: 14px; font-weight: 700;
}

/* ============================================
   FILTER CHIPS
   ============================================ */
.filter-group {
    display: flex; gap: 6px; flex-wrap: wrap;
}

.filter-chip {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 6px;
    transition: all var(--duration) var(--ease);
}

.filter-chip:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
}

/* ============================================
   SCHEDULE (MyRacePass-style)
   ============================================ */
.schedule-container {
    display: flex; flex-direction: column; gap: 32px;
}

.schedule-loading {
    text-align: center; padding: 60px;
    color: var(--text-muted); font-size: 15px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}

.schedule-empty {
    text-align: center; padding: 80px 20px;
    color: var(--text-muted);
}

.schedule-empty i { font-size: 56px; margin-bottom: 16px; display: block; color: var(--border-light); }
.schedule-empty h3 { font-size: 20px; color: var(--text-primary); margin-bottom: 8px; }
.schedule-empty p { margin-bottom: 20px; }

/* Month group */
.month-group { }

.month-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.month-header h2 {
    font-size: 20px; font-weight: 800;
    letter-spacing: -0.3px;
}

.month-header .month-count {
    padding: 3px 10px;
    background: var(--bg-input);
    border-radius: 12px;
    font-size: 11px; font-weight: 700;
    color: var(--text-secondary);
}

/* Event Row — Race-Pass style */
.schedule-event {
    display: grid;
    grid-template-columns: 72px 1fr auto auto;
    align-items: center; gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: all var(--duration) var(--ease);
    position: relative;
}

.schedule-event:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}

.schedule-event.ev-attended {
    border-left: 3px solid var(--green);
}

.schedule-event.ev-cancelled {
    border-left: 3px solid var(--red);
    opacity: 0.65;
}

.schedule-event.ev-pending {
    border-left: 3px solid var(--amber);
}

/* Date cell */
.ev-date-cell {
    text-align: center;
}

.ev-weekday {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.ev-day {
    font-size: 28px; font-weight: 900;
    line-height: 1; margin: 2px 0;
    letter-spacing: -1px;
}

.ev-month-sm {
    font-size: 11px; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.ev-pending .ev-day { color: var(--amber); }
.ev-attended .ev-day { color: var(--green); }
.ev-cancelled .ev-day { color: var(--red); }

/* Info cell */
.ev-info { min-width: 0; }

.ev-name {
    font-size: 16px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 4px;
}

.ev-cancelled .ev-name {
    text-decoration: line-through;
    opacity: 0.6;
}

.ev-details {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
}

.ev-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    display: inline-flex; align-items: center; gap: 5px;
}

.badge-pending  { background: var(--amber-glow); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.badge-attended { background: var(--green-glow); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.badge-cancelled{ background: var(--red-glow); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }

.ev-cost-display {
    font-family: var(--font-mono);
    font-size: 12px; color: var(--text-secondary);
    display: flex; align-items: center; gap: 4px;
}

/* Cost cell */
.ev-cost-cell {
    text-align: right;
    padding-right: 8px;
}

.ev-cost-amount {
    font-family: var(--font-mono);
    font-size: 22px; font-weight: 800;
    letter-spacing: -0.5px;
}

.ev-attended .ev-cost-amount { color: var(--green); }
.ev-cancelled .ev-cost-amount { color: var(--red); text-decoration: line-through; }
.ev-pending .ev-cost-amount { color: var(--amber); }

/* Actions cell */
.ev-actions {
    display: flex; gap: 6px; flex-wrap: wrap;
    justify-content: flex-end;
}

/* ============================================
   ADD / EDIT FORM
   ============================================ */
.form-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 720px;
    position: relative;
    overflow: hidden;
}

.form-panel::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--blue);
}

.form-panel.editing::before {
    background: var(--amber);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.form-field.full-width { grid-column: 1 / -1; }

.form-field label {
    display: block;
    font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}

.form-field label i { color: var(--blue); font-size: 12px; }

.form-field input {
    width: 100%; padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px; outline: none;
    transition: all var(--duration) var(--ease);
}

.form-field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-glow);
    background: var(--bg-input-focus);
}

.form-field input::placeholder { color: var(--text-muted); }

.cost-input-wrap {
    position: relative;
}

.cost-prefix {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-weight: 700; font-size: 15px;
}

.cost-input-wrap input { padding-left: 32px; }

.field-hint {
    display: block;
    font-size: 12px; color: var(--green);
    margin-top: 6px; min-height: 18px;
    font-weight: 500;
}

.field-hint.error { color: var(--red); }

.form-footer {
    display: flex; gap: 12px;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    display: none; align-items: center; justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.modal-overlay.active { display: flex; }

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px;
    width: 100%; max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s var(--ease);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
    width: 56px; height: 56px; margin: 0 auto 16px;
    background: var(--red-glow);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: var(--red);
}

.modal-card h3 {
    font-size: 18px; font-weight: 700; margin-bottom: 8px;
}

.modal-card p {
    font-size: 14px; color: var(--text-secondary);
    margin-bottom: 24px; line-height: 1.6;
}

.modal-btns {
    display: flex; gap: 10px; justify-content: center;
}

.modal-btns .btn { flex: 1; justify-content: center; }

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 2000;
    display: flex; flex-direction: column-reverse; gap: 8px;
}

.toast-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.4s var(--ease);
    max-width: 380px;
    border: 1px solid rgba(255,255,255,0.08);
}

.toast-item.removing {
    animation: toastOut 0.3s var(--ease) forwards;
}

.toast-item i { font-size: 16px; flex-shrink: 0; }

.toast-success { background: #065f46; border-color: rgba(16,185,129,0.3); }
.toast-error   { background: #7f1d1d; border-color: rgba(239,68,68,0.3); }
.toast-info    { background: #1e3a5f; border-color: rgba(59,130,246,0.3); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100px); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-panels { grid-template-columns: 1fr; }

    .schedule-event {
        grid-template-columns: 60px 1fr auto;
        gap: 12px;
    }
    .ev-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }

    .mobile-header { display: flex; }

    .main {
        margin-left: 0;
        padding: 16px;
        padding-top: calc(var(--header-h) + 16px);
    }

    .section-header { flex-direction: column; }
    .header-actions { width: 100%; }
    .filter-group { width: 100%; }

    .stats-grid { grid-template-columns: 1fr 1fr; }

    .stat-card { padding: 16px; }
    .stat-value { font-size: 20px; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; }

    .schedule-event {
        grid-template-columns: 56px 1fr;
        gap: 10px; padding: 14px;
    }
    .ev-cost-cell { grid-column: 2; text-align: left; }
    .ev-cost-amount { font-size: 18px; }
    .ev-actions { grid-column: 1 / -1; }

    .form-grid { grid-template-columns: 1fr; }
    .form-panel { padding: 24px 20px; }

    .section-title { font-size: 22px; }

    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast-item { max-width: 100%; }

    .modal-card { margin: 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .filter-chip { flex: 1; justify-content: center; }
    .ev-name { font-size: 14px; }
}