/* ══════════════════════════════════════════════════════════════
   LifeOS — Design System & Styles
   ══════════════════════════════════════════════════════════════ */

/* ─── CSS VARIABLES ─── */
:root {
    /* Core palette — deep space aesthetic */
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-tertiary: #1a1a3e;
    --bg-card: rgba(20, 20, 50, 0.6);

    /* Accent colors */
    --accent-primary: #6c5ce7;
    --accent-primary-glow: rgba(108, 92, 231, 0.3);
    --accent-secondary: #a29bfe;
    --accent-success: #00cec9;
    --accent-warning: #fdcb6e;
    --accent-danger: #ff7675;
    --accent-info: #74b9ff;

    /* ACRA colors */
    --acra-attract: #fd79a8;
    --acra-convert: #6c5ce7;
    --acra-retain: #00cec9;
    --acra-ascend: #fdcb6e;

    /* Text colors */
    --text-primary: #f0f0f8;
    --text-secondary: rgba(240, 240, 248, 0.65);
    --text-muted: rgba(240, 240, 248, 0.35);

    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 16px;

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius: 12px;
    --radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px var(--accent-primary-glow);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ─── UTILITY CLASSES ─── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

.muted {
    color: var(--text-muted);
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-base);
}

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

.logo-circle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.logo-version {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--glass-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.nav-section {
    padding: 16px 12px 8px;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1.2px;
    padding: 0 8px;
    margin-bottom: 6px;
    display: block;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-family: inherit;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary-glow);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(108, 92, 231, 0.3);
}

.nav-icon {
    font-size: 16px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-danger);
}

.status-dot.online {
    background: var(--accent-success);
    box-shadow: 0 0 8px rgba(0, 206, 201, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ═══ MOBILE HEADER ═══ */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 16px;
    align-items: center;
    gap: 12px;
    z-index: 90;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: var(--transition-fast);
}

.mobile-title {
    font-size: 16px;
    font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    max-width: 1200px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.page-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

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

.day-type-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.day-type-badge.full_work {
    background: rgba(108, 92, 231, 0.2);
    color: var(--accent-secondary);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.day-type-badge.homeschool {
    background: rgba(253, 203, 110, 0.15);
    color: var(--accent-warning);
    border: 1px solid rgba(253, 203, 110, 0.25);
}

.day-type-badge.planning_only {
    background: rgba(0, 206, 201, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(0, 206, 201, 0.25);
}

/* ─── TIME PROGRESS BAR ─── */
.time-bar-container {
    margin-bottom: 28px;
}

.time-bar {
    position: relative;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: visible;
}

.time-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 1s ease;
}

.time-bar-marker {
    position: absolute;
    top: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 3px solid var(--bg-primary);
    box-shadow: var(--shadow-glow);
    transform: translateX(-50%);
    transition: left 1s ease;
}

.time-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ─── STATS GRID ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    padding: 20px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.stat-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* ─── CURRENT BLOCK ─── */
.current-block {
    padding: 24px;
    margin-bottom: 28px;
    border-left: 3px solid var(--accent-primary);
}

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

.block-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    color: var(--accent-secondary);
}

.block-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

.block-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.block-suggestion {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ─── SCHEDULE TIMELINE ─── */
.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.schedule-timeline {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 28px;
}

.schedule-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: var(--transition-fast);
}

.schedule-block:hover {
    background: rgba(255, 255, 255, 0.03);
}

.schedule-block.active {
    background: var(--accent-primary-glow);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.schedule-block.past {
    opacity: 0.4;
}

.schedule-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    width: 110px;
    flex-shrink: 0;
}

.schedule-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.schedule-label {
    font-weight: 500;
}

/* ─── QUICK ACTIONS ─── */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.action-icon {
    font-size: 24px;
}

/* ══════════════════════════════════════════════════════════════
   MORNING / EVENING RITUAL
   ══════════════════════════════════════════════════════════════ */
.ritual-container {
    max-width: 640px;
}

.ritual-step {
    display: flex;
    gap: 16px;
    padding: 20px;
    margin-bottom: 16px;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.step-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.ritual-input,
.ritual-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.ritual-input:focus,
.ritual-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.ritual-input::placeholder {
    color: var(--text-muted);
}

.ritual-input.small {
    max-width: 300px;
}

.ritual-textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.ritual-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.ritual-textarea::placeholder {
    color: var(--text-muted);
}

.ritual-textarea.small {
    min-height: 60px;
}

.energy-selector {
    display: flex;
    gap: 10px;
}

.energy-btn {
    padding: 10px 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.energy-btn:hover {
    border-color: var(--accent-primary);
}

.energy-btn.active {
    background: var(--accent-primary-glow);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.secondary-task-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.secondary-task-row .ritual-select {
    max-width: 180px;
}

/* ─── SATISFACTION SLIDER ─── */
.satisfaction-slider {
    display: flex;
    align-items: center;
    gap: 16px;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: var(--shadow-glow);
}

.slider-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-secondary);
    min-width: 36px;
    text-align: center;
}

/* ─── BUTTONS ─── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--accent-primary), #a855f7);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    margin-top: 8px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-small {
    padding: 8px 16px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-small:hover {
    background: #7c6cf0;
}

/* ══════════════════════════════════════════════════════════════
   TASKS PAGE
   ══════════════════════════════════════════════════════════════ */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 6px 14px;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-chip:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--accent-primary-glow);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.task-item:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

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

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

.task-checkbox:hover {
    border-color: var(--accent-success);
}

.task-checkbox.checked {
    background: var(--accent-success);
    border-color: var(--accent-success);
    color: white;
}

.task-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.task-title.done {
    text-decoration: line-through;
    opacity: 0.6;
}

.task-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.task-category-tag {
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--glass-bg);
    font-size: 11px;
}

.task-hours {
    font-family: 'JetBrains Mono', monospace;
}

/* ══════════════════════════════════════════════════════════════
   CHAT PAGE
   ══════════════════════════════════════════════════════════════ */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.chat-message.agent {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background: var(--bg-tertiary);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.chat-message.agent .message-bubble {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-bubble {
    background: var(--accent-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble ul {
    margin: 8px 0;
    padding-left: 18px;
}

.message-bubble li {
    margin: 4px 0;
}

.chat-input-bar {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
}

.chat-input:focus {
    border-color: var(--accent-primary);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send:hover {
    background: #7c6cf0;
    transform: scale(1.05);
}

/* ══════════════════════════════════════════════════════════════
   ANALYTICS PAGE
   ══════════════════════════════════════════════════════════════ */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.analytics-card {
    padding: 24px;
}

.analytics-card.wide {
    grid-column: 1 / -1;
}

.analytics-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* Week bars */
.week-bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 120px;
    gap: 8px;
}

.week-day-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.week-bar-container {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.week-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(to top, var(--accent-primary), var(--accent-secondary));
    transition: height 0.6s ease;
    min-height: 4px;
}

.week-day-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ACRA bars */
.acra-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.acra-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.acra-label {
    font-size: 12px;
    font-weight: 500;
    width: 60px;
    color: var(--text-secondary);
}

.acra-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.acra-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}

.acra-bar.attract {
    background: var(--acra-attract);
}

.acra-bar.convert {
    background: var(--acra-convert);
}

.acra-bar.retain {
    background: var(--acra-retain);
}

.acra-bar.ascend {
    background: var(--acra-ascend);
}

.acra-pct {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    width: 32px;
    text-align: right;
}

/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    width: 90%;
    max-width: 520px;
    padding: 28px;
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

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

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

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

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* ══════════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    max-width: 360px;
}

.toast.success {
    background: rgba(0, 206, 201, 0.9);
}

.toast.error {
    background: rgba(255, 118, 117, 0.9);
}

.toast.info {
    background: rgba(108, 92, 231, 0.9);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 80px 16px 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 22px;
    }

    .chat-container {
        height: calc(100vh - 200px);
    }

    .chat-message {
        max-width: 90%;
    }

    .form-row {
        flex-direction: column;
    }
}