:root {
    /* Premium Professional Palette */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-glow: rgba(79, 70, 229, 0.15);

    --bg-app: #f8fafc;
    --bg-panel: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.85);
    --bg-layer: #f1f5f9;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    --border-subtle: #e2e8f0;
    --border-active: #cbd5e1;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Elegant Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 44px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-soft: 0 2px 15px rgba(0, 0, 0, 0.05);

    /* Layout Constants */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-main: 'Inter', -apple-system, sans-serif;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
    --blur-xl: blur(24px);

    /* Derived */
    --logo-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}



* {
    box-sizing: border-box;
    outline: none;
}

body {
    margin: 0;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 64px;
    background: var(--bg-header);
    backdrop-filter: var(--blur-xl);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Ensuring center stays centered without absolute overlap */
.header-center {
    flex: 1;
    justify-content: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    background: var(--logo-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.ai-sparkle-btn {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(168, 85, 247, 0.1));
    color: var(--primary) !important;
    position: relative;
    overflow: hidden;
}

.ai-sparkle-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.ai-sparkle-btn:hover::after {
    opacity: 1;
    animation: sparkle-rotate 2s linear infinite;
}

@keyframes sparkle-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.nav-controls {
    display: flex;
    align-items: center;
    background: var(--bg-layer);
    padding: 2px;
    border-radius: var(--radius-full);
}

.primary-light-btn {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.primary-light-btn:hover {
    background: var(--primary);
    color: white;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    background: var(--bg-layer);
    border: 1px solid transparent;
    padding: 8px 12px 8px 36px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    width: 200px;
    transition: var(--transition-base);
}

.search-box input:focus {
    background: var(--bg-panel);
    border-color: var(--primary);
    width: 280px;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-dim);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.year-input {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 600;
    width: 70px;
    text-align: center;
    font-family: inherit;
    outline: none;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    appearance: textfield;
    -moz-appearance: textfield;
}

.year-input::-webkit-outer-spin-button,
.year-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.year-input:hover {
    background: var(--bg-app);
}

.year-input:focus {
    background: var(--bg-app);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.month-select {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.month-select:hover {
    background: var(--bg-app);
}

.month-select:focus {
    background: var(--bg-app);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--bg-panel);
    color: var(--text-main);
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}

.header-filter {
    margin-left: 16px;
    border-left: 1px solid var(--border-subtle);
    padding-left: 16px;
    display: flex;
    align-items: center;
}

.tag-filter-container {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-layer);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 2px 10px;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.tag-filter-container:hover {
    background: var(--bg-panel);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.tag-filter-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.filter-icon {
    color: var(--primary);
    opacity: 0.8;
}

.filter-select {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 4px;
}

.chevron-icon {
    color: var(--text-dim);
    pointer-events: none;
}

.controls-right {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* View Switcher */
.view-switcher {
    display: flex;
    background: var(--bg-layer);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.view-tab {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.view-tab.active {
    background: var(--bg-panel);
    color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.view-tab:hover:not(.active) {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.02);
}

/* Week/Day View Layouts - Professional Upgrade */
.week-view,
.day-view {
    height: calc(100vh - 64px);
    overflow: auto;
    background: var(--bg-panel);
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
}

.timeline-column {
    width: 72px;
    border-right: 1px solid var(--border-subtle);
    background: var(--bg-layer);
    display: flex;
    flex-direction: column;
    position: sticky;
    left: 0;
    z-index: 40;
    /* Above all-day events and grid */
}

.timeline-header-placeholder {
    height: 60px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 41;
    /* Higher than timeline column */
}

.timeline-all-day-placeholder {
    height: 40px;
    background: var(--bg-layer);
    border-bottom: 1px solid var(--border-subtle);
}

.time-slot-label {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid transparent;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-width: 800px;
    /* Ensure 7 cols don't collapse too much */
}

.day-column {
    border-right: 1px solid var(--border-subtle);
    position: relative;
    min-height: 1540px;
    /* 1440px for slots + 60px header + 40px all-day */
    display: flex;
    flex-direction: column;
}

.day-header {
    position: sticky;
    top: 0;
    background: var(--bg-panel);
    z-index: 31;
    /* Above events */
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.all-day-events {
    min-height: 40px;
    padding: 4px;
    background: var(--bg-layer);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 30;
    flex-shrink: 0;
}

.slots-container {
    position: relative;
    flex: 1;
    height: 1440px;
    /* 24 hours * 60px */
}

.all-day-badge {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--evt-bg);
    border-left: 3px solid var(--evt-color);
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-fast);
}

.all-day-badge:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.day-header .day-name {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-header .day-number {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    margin-top: 2px;
    color: var(--text-main);
}

.hour-slot {
    height: 60px;
    border-bottom: 1px solid var(--border-subtle);
}

.hour-slot:hover {
    background: rgba(79, 70, 229, 0.02);
}

/* Red Indicator for Current Time */
.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--danger);
    z-index: 40;
    pointer-events: none;
}

.current-time-line::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

.calendar-event-card {
    position: absolute;
    left: 4px;
    right: 4px;
    background: var(--evt-bg);
    border-left: 3px solid var(--evt-color);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    cursor: pointer;
    z-index: 20;
    /* High enough to be above grid but below header/modals */
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 25px;
}

.modal-select-styled {
    background: var(--bg-layer);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
}

.tag-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--primary-light);
    color: var(--primary);
    margin-top: 4px;
}

.calendar-event-card .card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

/* Rich Text Editor Styling */
.editor-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-layer);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    padding: 4px;
    transition: all 0.2s ease;
}

.editor-container:focus-within {
    border-color: var(--primary);
    background: var(--bg-panel);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.editor-toolbar {
    display: flex;
    gap: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-subtle);
}

.tool-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
}

.tool-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.rich-editor {
    min-height: 80px;
    padding: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    outline: none;
    overflow-y: auto;
    position: relative;
}

.rich-editor[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: var(--text-dim);
    font-style: italic;
    pointer-events: none;
}

.rich-editor a {
    color: var(--primary);
    text-decoration: underline;
}

.rich-editor ul {
    margin: 8px 0;
    padding-left: 20px;
}

.rich-editor li {
    margin-bottom: 4px;
}

/* Financial Card & Payment Modernization */
.financial-card {
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 8px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
}

.card-header-mini {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.financial-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 480px) {
    .financial-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.field-label-mini {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.amount-field-group {
    display: flex;
    align-items: stretch;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    grid-column: span 2;
}

@media (max-width: 480px) {
    .amount-field-group {
        grid-column: span 1;
    }
}

.currency-wrapper {
    background: var(--bg-layer);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 12px;
}

.currency-wrapper select {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
}

#paymentAmount {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    width: 100%;
}

.custom-badge-container {
    position: relative;
    width: fit-content;
}

.badge-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s;
}

/* Status colors */
.badge-select option[value="paid"],
.badge-select[value="paid"] {
    background: #dcfce7;
    color: #166534;
}

.badge-select option[value="unpaid"],
.badge-select[value="unpaid"] {
    background: #fee2e2;
    color: #991b1b;
}

/* Since standard select can't be easily styled like a badge reliably, 
   we handle the select background via JS or keep it simple with a clean border */
.badge-select {
    border: 1px solid var(--border-subtle);
    background: var(--bg-layer);
    color: var(--text-main);
}

.modern-select-inline {
    width: 100%;
    background: var(--bg-layer);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.modern-select-inline:hover {
    border-color: var(--primary);
}

.calendar-event-card:hover {
    transform: translateX(2px);
    box-shadow: var(--shadow-md);
    z-index: 15;
}

.calendar-event-card .card-time {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.7rem;
}

.calendar-event-card .card-title {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Buttons & Inputs */
.btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.01em;
}

.btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px -2px var(--primary);
}

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px var(--primary);
}

.btn.secondary {
    background: var(--bg-layer);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.btn.secondary:hover {
    background: var(--bg-panel);
    border-color: var(--border-active);
}

.btn.ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn.ghost:hover {
    background: var(--bg-layer);
    color: var(--text-main);
}

.btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid transparent;
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Search */
.search-wrapper {
    position: relative;
}

#searchInput {
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    padding: 10px 16px;
    padding-left: 40px;
    /* Space for icon */
    border-radius: var(--radius-sm);
    color: var(--text-main);
    width: 260px;
    font-family: inherit;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

#searchInput:focus {
    border-color: var(--primary);
    background-color: var(--bg-panel);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Calendar Grid */
.calendar-grid {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 32px;
    padding: 32px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    background: var(--bg-app);
}

.calendar-grid-single {
    flex: 1;
    height: calc(100vh - 64px);
    overflow: hidden;
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
}

.month-card {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    display: flex;
    flex-direction: column;
}

.month-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.month-title {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.month-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.day-header {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    text-align: center;
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    color: var(--text-main);
}

.day-cell:hover:not(.empty) {
    background: var(--bg-layer);
    color: var(--primary);
}

.day-cell.today {
    background: var(--primary);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.day-cell.today:hover {
    background: var(--primary-hover);
    color: white;
}

/* Main App Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-app);
}

.app-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.calendar-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    transition: var(--transition-base);
}

/* AI Sidebar */
.ai-sidebar {
    width: 340px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: var(--transition-base);
    position: relative;
    z-index: 50;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.02);
}

.ai-sidebar.collapsed {
    width: 0;
    transform: translateX(100%);
    border-left-width: 0;
    overflow: hidden;
    pointer-events: none;
}

.debug-info {
    font-size: 0.7rem;
    color: var(--text-dim);
    padding: 8px 12px;
    background: var(--bg-layer);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid var(--primary);
}

/* Mobile Responsiveness Strategy */
@media (max-width: 1024px) {
    .ai-sidebar {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    }
}

@media (max-width: 768px) {
    .app-header {
        height: auto;
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }

    .header-center {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .search-box input {
        width: 100%;
    }

    .search-box input:focus {
        width: 100%;
    }

    .calendar-grid {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 20px;
    }

    .week-grid {
        min-width: 100%;
        grid-template-columns: 1fr;
        /* Stack days on mobile */
    }

    .week-view {
        grid-template-columns: 60px 1fr;
    }
}


.day-cell.has-event {
    position: relative;
    background: var(--evt-bg, rgba(99, 102, 241, 0.05));
    border-bottom: 2px solid var(--evt-color, transparent);
}

.event-dots {
    display: flex;
    gap: 3px;
    position: absolute;
    bottom: 6px;
    justify-content: center;
    width: 100%;
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 2px;
    /* Pill */
    background: var(--bg-dot);
    box-shadow: 0 0 4px var(--bg-dot);
    opacity: 0.8;
}

.day-cell.holiday {
    background: rgba(245, 158, 11, 0.15);
    /* Warning color tint */
    border-bottom: 2px solid var(--warning);
}

.day-cell.holiday::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-main);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 20;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.day-cell.holiday:hover::after {
    opacity: 1;
}

/* Modal - Premium Glassmorphism */
.modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    /* Darker overlay for contrast */
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    width: 500px;
    /* Slightly wider */
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center center;
}

@media (max-width: 640px) {
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-scrollable-area {
        padding: 20px;
    }

    .modal-footer {
        padding: 16px 20px;
        flex-wrap: wrap;
    }
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: rgba(255, 255, 255, 0.5);
    /* Subtle glass header */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--logo-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.close-modal {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

/* Modal Body & Forms */
.modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modern-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.modal-scrollable-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    /* Ensure padding doesn't push content out */
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: 12px;
    /* Matches login fields */
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    background: #ffffff;
    border-color: var(--border-active);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    outline: none;
    transform: translateY(-1px);
}

.modal-footer {
    padding: 24px 32px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    justify-content: flex-end;
}

/* Interactive Color Picker */
.color-picker {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    padding: 4px 0;
}

.color-picker label {
    cursor: pointer;
    position: relative;
    margin: 0;
}

.color-picker span {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-picker input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.color-picker label:hover span {
    transform: scale(1.15);
}

.color-picker input:checked+span {
    transform: scale(1.2);
    border-color: var(--bg-card);
    box-shadow: 0 0 0 2px var(--c), 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Redesigned Modal Classes */
.redesigned-modal {
    padding: 16px 24px 24px 24px;
    border-radius: var(--radius-lg);
}

.modal-top-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.modal-section {
    margin-bottom: 16px;
}

#eventTitle {
    font-size: 1.5rem;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 0;
    width: 100%;
    margin-bottom: 8px;
    transition: border-color 0.2s;
    background: transparent;
}

#eventTitle:focus {
    border-color: var(--primary);
    outline: none;
}

.type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg-layer);
}

.tab-btn.active {
    background: #e0e7ff;
    color: var(--primary);
}

.modal-rows {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.modal-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .modal-row {
        gap: 8px;
    }
}

.row-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
}

.row-content {
    flex: 1;
}

.row-content input,
.row-content textarea {
    border: none !important;
    background: transparent !important;
    padding: 4px 0 !important;
    font-size: 0.95rem;
    color: var(--text-main);
    width: 100%;
}

@media (max-width: 480px) {
    .payment-row-content {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .payment-row-content select,
    .payment-row-content input {
        width: 100% !important;
    }
}

.row-content input:focus,
.row-content textarea:focus {
    box-shadow: none !important;
    outline: none !important;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
}

.btn-text:hover {
    background: var(--bg-layer);
}

.btn-text.secondary {
    color: var(--text-muted);
}

.btn-text.danger {
    color: var(--danger);
}

.color-picker-mini {
    display: flex;
    gap: 10px;
}

.color-picker-mini span {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--c);
    display: block;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.color-picker-mini input {
    position: absolute;
    opacity: 0;
    width: 0;
}

.color-picker-mini input:checked+span {
    transform: scale(1.2);
    border-color: white;
    box-shadow: 0 0 0 1px var(--c);
}

.modal-footer {
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (max-width: 480px) {
    .modal-footer {
        justify-content: center;
        flex-direction: column;
        width: 100%;
    }

    .modal-footer button {
        width: 100%;
    }

    .modal-footer .spacer {
        display: none;
    }
}

.pill-btn {
    border-radius: 99px !important;
    padding: 10px 24px !important;
    font-weight: 600;
}

.spacer {
    flex: 1;
}


/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 200;
}

.toast {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 250px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Search Results - Floating Panel */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    margin-top: 12px;
    z-index: 1000;
}

.search-item {
    padding: 12px 16px;
    transition: background 0.1s;
    border-color: var(--border-subtle);
}

.search-item-title {
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.9rem;
}

.search-item-date {
    color: var(--text-dim);
    font-size: 0.75rem;
}

/* Event Filters */
.event-filters {
    display: flex;
    gap: 12px;

    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
    align-items: center;
    flex-wrap: wrap;
    /* Added for responsiveness */
}

.filter-pill {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-layer);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-pill:hover {
    background: var(--bg-panel);
    color: var(--text-main);
}

.filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.filter-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.modal-content.large {
    width: 600px;
    height: 70vh;
    max-height: 85vh;
    /* Allow for some flexibility */
    display: flex;
    flex-direction: column;
}

.modal-content.large .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Body doesn't scroll, inner list does */
    padding-top: 10px;
}

.events-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-list-item {
    padding: 12px 16px;
    background: var(--bg-layer);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.event-list-item:hover {
    background: var(--bg-panel);
    border-color: var(--border-active);
    transform: translateX(4px);
}

.evt-date {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    min-width: 90px;
}

.evt-title {
    font-weight: 500;
    color: var(--text-main);
    flex: 1;
    margin: 0 12px;
}

.evt-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.list-section-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 8px 8px 8px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 10px 15px -3px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    background: var(--primary-hover);
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.5);
}

.fab:active {
    transform: scale(0.95) rotate(90deg);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-layer);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-active);
}

/* AI Assistant Sidebar */
.ai-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-subtle);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
    z-index: 300;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-sidebar.ai-hidden {
    transform: translateX(100%);
    pointer-events: none;
}

.ai-sidebar.minimized {
    height: 70px;
    bottom: 20px;
    top: auto;
    width: 300px;
    right: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.ai-sidebar.minimized .ai-chat-window,
.ai-sidebar.minimized .ai-input-area {
    display: none;
}

.ai-sidebar.minimized .sidebar-header {
    border-bottom: none;
    height: 100%;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 85%;
}

.ai-message.system {
    align-self: flex-start;
    background: var(--bg-layer);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.ai-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#aiChatInput {
    flex: 1;
    background: var(--bg-layer);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    max-height: 150px;
}

#aiChatInput:focus {
    outline: none;
    border-color: var(--primary);
}

.ai-sparkle-btn {
    position: relative;
    overflow: hidden;
}

.ai-sparkle-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 180deg at 50% 50%, transparent 0deg, var(--primary-glow) 360deg);
    animation: rotate 4s linear infinite;
    opacity: 0.3;
    z-index: -1;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ai-sparkle-btn svg {
    filter: drop-shadow(0 0 3px var(--primary));
    color: var(--primary);
}

.ai-sparkle-btn:hover svg {
    color: #ec4899;
    filter: drop-shadow(0 0 5px #ec4899);
}

/* Smart Add */
.smart-add-wrapper {
    position: relative;
}

.smart-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: -4px;
    margin-bottom: 8px;
    font-style: italic;
    opacity: 0.7;
}

#eventTitle:placeholder-shown+.smart-hint {
    display: block;
}


/* Global Hidden Utility */
.hidden {
    display: none !important;
}

/* Payment Day Indicator - Double Border Animation */
.day-cell.payment-day {
    position: relative;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.day-cell.payment-day.payment-paid {
    border: 2px solid #10b981;
}

.day-cell.payment-day.payment-unpaid {
    border: 2px solid #ef4444;
}

.day-cell.payment-day::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: var(--radius-sm);
    animation: paymentPulse 2s infinite ease-in-out;
    pointer-events: none;
    z-index: 1;
}

.day-cell.payment-paid::after {
    border: 1.5px solid #10b981;
}

.day-cell.payment-unpaid::after {
    border: 1.5px solid #ef4444;
}

@keyframes paymentPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* RGB Border for Multiple Events */
.day-cell.multiple-events-rgb {
    position: relative;
    z-index: 1;
}


/* Day Agenda Styles */
.day-agenda {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 20px;
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agenda-item {
    padding: 12px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    margin-bottom: 0px;
    /* Gap handled by container */
}

.agenda-item:hover {
    background: var(--bg-layer);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.agenda-item-time {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    min-width: 65px;
    font-family: 'Inter', sans-serif;
}

.agenda-item-title {
    flex: 1;
    font-weight: 500;
    color: var(--text-main);
    margin: 0 16px;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-item-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.add-new-container {
    margin-bottom: 24px;
    text-align: right;
}

/* Responsive Modal Adjustments */
@media (max-width: 640px) {

    .modal-content.large,
    .modal-content.redesigned-modal {
        width: 95%;
        margin: 10px;
        padding: 20px;
    }

    .agenda-item {
        padding: 10px 12px;
    }

    .agenda-item-time {
        min-width: 55px;
        font-size: 0.8rem;
    }

    .agenda-item-title {
        margin: 0 10px;
        font-size: 0.9rem;
    }
}

/* Professional Agenda View */
.pro-agenda-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
}

.pro-agenda-overlay.hidden {
    display: none;
}

.pro-agenda-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 32px;
}

/* Pro Header */
.pro-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    margin-bottom: 8px;
}

.pro-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.03em;
    background: var(--logo-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pro-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Controls Bar */
.pro-controls-bar {
    padding: 24px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.search-wrapper.large {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-wrapper.large input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    transition: all 0.2s;
}

.search-wrapper.large input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.filter-group {
    display: flex;
    gap: 12px;
}

.pro-select {
    padding: 12px 36px 12px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    -webkit-appearance: none;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    min-width: 140px;
    transition: all 0.2s;
    box-shadow: var(--shadow-soft);
    font-weight: 500;
}

.pro-select:hover {
    border-color: var(--border-active);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Pro Table */
.pro-table-wrapper {
    flex: 1;
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
}

.pro-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
}

.pro-table th {
    position: sticky;
    top: 0;
    background: rgba(248, 250, 252, 0.95);
    padding: 16px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    backdrop-filter: blur(4px);
}

.pro-table th:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.pro-table th.actions-col {
    width: 80px;
    text-align: center;
    cursor: default;
}

.pro-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.95rem;
    background: transparent;
    /* Let row bg show */
    vertical-align: middle;
}

.pro-table tr {
    transition: background 0.15s;
}

.pro-table tr:last-child td {
    border-bottom: none;
}

.pro-table tr:hover {
    background: rgba(241, 245, 249, 0.5);
}

.pro-table .col-date {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    width: 120px;
}

.pro-table .col-time {
    color: var(--text-muted);
    width: 100px;
}

.pro-table .col-title {
    font-weight: 500;
    min-width: 200px;
}

.pro-table .col-type {
    width: 110px;
}

.pro-table .col-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    width: 120px;
    text-align: right;
}

/* Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.status-pill.event {
    background: #e0e7ff;
    color: #4338ca;
}

.status-pill.task {
    background: #dcfce7;
    color: #15803d;
}

.status-pill.payment {
    background: #ffedd5;
    color: #c2410c;
}

.status-pill.paid {
    background: #dcfce7;
    color: #15803d;
    margin-left: 8px;
}

.status-pill.unpaid {
    background: #fee2e2;
    color: #b91c1c;
    margin-left: 8px;
}

.pro-footer {
    padding: 16px 0 32px 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: right;
    flex-shrink: 0;
}

.action-btn-mini {
    padding: 6px;
    color: var(--text-dim);
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn-mini:hover {
    color: var(--primary);
    background: #e0e7ff;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .pro-agenda-container {
        padding: 0 20px;
    }

    .pro-controls-bar {
        gap: 12px;
    }

    .search-wrapper.large {
        max-width: 300px;
    }

    .filter-group {
        flex-wrap: wrap;
    }

    .pro-select {
        min-width: 120px;
    }
}

/* Responsive - Mobile (Card View) */
@media (max-width: 768px) {
    .pro-agenda-container {
        padding: 0 16px;
    }

    .pro-header {
        height: auto;
        padding: 16px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .pro-header-right {
        position: absolute;
        top: 16px;
        right: 0;
    }

    .pro-controls-bar {
        flex-direction: column;
        align-items: stretch;
        padding-top: 0;
    }

    .search-wrapper.large {
        max-width: none;
    }

    .filter-group {
        width: 100%;
    }

    .pro-select {
        flex: 1;
    }

    #proAddEventBtn {
        width: 100%;
        justify-content: center;
    }


    /* Revert to Table with Scroll for Mobile */
    .pro-table-wrapper {
        margin: 0 -16px;
        /* Bleed to edge */
        border-right: none;
        border-left: none;
        border-radius: 0;
        box-shadow: none;
    }

    .pro-table th,
    .pro-table td {
        padding: 10px 12px;
        white-space: nowrap;
        /* Prevent wrapping */
    }

    .pro-table .col-title {
        min-width: 150px;
        font-size: 0.9rem;
    }

    .pro-table .col-time {
        width: 80px;
    }

    .pro-table .col-date {
        width: 100px;
    }

    .actions-col {
        position: sticky;
        right: 0;
        background: inherit;
        /* Stick action to right on scroll */
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
        z-index: 15;
    }

    .pro-table tr:hover .actions-col {
        background: #f8fafc;
    }
}

.action-btn-mini:hover {
    color: var(--primary);
    background: #e0e7ff;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .pro-agenda-container {
        padding: 0 20px;
    }

    .pro-controls-bar {
        gap: 12px;
    }

    .search-wrapper.large {
        max-width: 300px;
    }

    .filter-group {
        flex-wrap: wrap;
    }

    .pro-select {
        min-width: 120px;
    }
}

/* Responsive - Mobile (Card View) */
@media (max-width: 768px) {
    .pro-agenda-container {
        padding: 0 16px;
    }

    .pro-header {
        height: auto;
        padding: 16px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .pro-header-right {
        position: absolute;
        top: 16px;
        right: 0;
    }

    .pro-controls-bar {
        flex-direction: column;
        align-items: stretch;
        padding-top: 0;
    }

    .search-wrapper.large {
        max-width: none;
    }

    .filter-group {
        width: 100%;
    }

    .pro-select {
        flex: 1;
    }

    #proAddEventBtn {
        width: 100%;
        justify-content: center;
    }


    /* Revert to Table with Scroll for Mobile */
    .pro-table-wrapper {
        margin: 0 -16px;
        /* Bleed to edge */
        border-right: none;
        border-left: none;
        border-radius: 0;
        box-shadow: none;
    }

    .pro-table th,
    .pro-table td {
        padding: 10px 12px;
        white-space: nowrap;
        /* Prevent wrapping */
    }

    .pro-table .col-title {
        min-width: 150px;
        font-size: 0.9rem;
    }

    .pro-table .col-time {
        width: 80px;
    }

    .pro-table .col-date {
        width: 100px;
    }

    .actions-col {
        position: sticky;
        right: 0;
        background: inherit;
        /* Stick action to right on scroll */
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
        z-index: 15;
    }

    .pro-table tr:hover .actions-col {
        background: #f8fafc;
    }
}

/* Login Page - Premium Landing Experience */
.login-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease-out;
    font-family: var(--font-main);
}

.login-page.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Decorations */
.login-decoration-1,
.login-decoration-2 {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    z-index: -1;
}

.login-decoration-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #4f46e5;
}

.login-decoration-2 {
    bottom: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: #ec4899;
}

.login-clock-container {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 10;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#loginTime {
    font-size: 6rem;
    font-weight: 200;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: -0.05em;
    line-height: 1;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#loginDate {
    font-size: 1.2rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.05em;
    margin-top: 8px;
    text-transform: uppercase;
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    text-align: center;
    transform-style: preserve-3d;
    animation: floatCard 6s ease-in-out infinite;
}

@keyframes floatCard {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.login-logo.large {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-tagline {
    font-size: 1rem;
    color: #64748b;
    font-weight: 500;
    margin: 0 0 24px 0;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    color: #334155;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    color: #0f172a;
    transition: all 0.2s;
}

.login-form input:focus {
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    outline: none;
}

.login-btn {
    margin-top: 8px;
    padding: 14px;
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.login-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.login-footer p {
    margin: 4px 0;
}

@media (max-width: 480px) {
    .login-card {
        padding: 24px;
    }

    .login-logo.large {
        font-size: 2rem;
    }
}

/* Analytics Page - Professional Full View */
.analytics-page {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    z-index: 500;
    overflow-y: auto;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.analytics-page.hidden {
    opacity: 0;
    pointer-events: none;
}

.analytics-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 32px 48px;
    box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.08);
}

.analytics-title-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 16px 0 8px 0;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.analytics-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateX(-4px);
}

.analytics-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 28px;
    margin-bottom: 48px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow:
        0 8px 32px -8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow:
        0 16px 48px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.stat-icon.income {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.stat-icon.expense {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.stat-icon.tile-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
}

.tile-teal {
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
}

.tile-orange {
    color: white;
}

.stat-icon.tasks {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.stat-card h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 12px;
}

.stat-card:nth-child(1) .stat-value {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card:nth-child(2) .stat-value {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card:nth-child(3) .stat-value {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-change {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.negative {
    color: #ef4444;
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 32px;
}

.chart-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    padding: 0;
    box-shadow:
        0 8px 32px -8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    overflow: hidden;
    transition: all 0.3s;
}

.chart-card:hover {
    box-shadow:
        0 16px 48px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.chart-card-header {
    padding: 28px 32px 20px 32px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(248, 250, 252, 0.5) 100%);
}

.chart-card-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-main);
}

.chart-card-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.chart-container {
    padding: 32px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1200px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .analytics-header {
        padding: 24px;
    }

    .analytics-title-section h1 {
        font-size: 2rem;
    }

    .analytics-content {
        padding: 24px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .chart-container {
        padding: 24px;
        min-height: 300px;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    box-shadow:
        0 8px 32px -8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 12px 48px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card:nth-child(1) .stat-value {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card:nth-child(2) .stat-value {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card:nth-child(3) .stat-value {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-success {
    color: #10b981;
}

.text-danger {
    color: #ef4444;
}

.text-primary {
    color: var(--primary);
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 32px;
}

.chart-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 32px 28px;
    min-height: 350px;
    box-shadow:
        0 8px 32px -8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.3s;
}

.chart-container:hover {
    box-shadow:
        0 12px 48px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 32px;
    }

    .stat-card {
        padding: 24px 20px;
    }

    .stat-value {
        font-size: 2rem;
    }

    .charts-row {
        gap: 24px;
    }

    .chart-container {
        padding: 24px 20px;
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .modal-content.large {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }

    .stat-value {
        font-size: 1.75rem;
    }
}

/* Focus Timer Widget */
.focus-timer-widget {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 24px 20px;
    margin-top: 24px;
    box-shadow:
        0 8px 32px -8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.timer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.timer-header svg {
    color: var(--primary);
}

.timer-display {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.timer-circle {
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: url(#timerGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.3s linear;
}

.timer-time {
    position: absolute;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.timer-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.timer-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.timer-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.timer-btn:hover {
    transform: scale(1.1);
}

.timer-btn.primary:hover {
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.timer-presets {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.preset-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    background: white;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.preset-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* SVG Gradient Definition (add to HTML if needed) */

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Weather Indicator - Beautiful Compact Design */
.weather-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-soft);
    z-index: 5;
    pointer-events: none;
    transition: all 0.2s ease;
}

.day-cell:hover .weather-indicator {
    transform: scale(1.08);
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}

.weather-icon {
    font-size: 1rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.weather-temp {
    color: #1e293b;
    font-variant-numeric: tabular-nums;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

/* Interactive Location Features */
.action-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-mini {
    background: var(--bg-layer);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-icon-mini:hover {
    background: var(--primary-glow) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.mini-map {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin: 8px 0;
    z-index: 1;
}

#miniMapContainer.modal-row {
    padding-top: 0;
    margin-top: -12px;
}

#miniMapContainer .row-icon {
    visibility: hidden;
}

/* Ensure Leaflet controls don't mess with modal layout */
.leaflet-container {
    font-family: inherit;
}

/* Windows 8 Metro UI Landing Page */
.landing-page {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--primary), #3730a3);
    z-index: 500;
    padding: 60px 80px;
    display: flex;
    flex-direction: column;
    color: white;
    overflow-y: auto;
    font-family: var(--font-main);
}

.metro-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 60px;
}

.metro-header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -2px;
}

.metro-clock {
    font-size: 3rem;
    font-weight: 300;
}

.metro-weather {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    cursor: pointer;
}

.metro-weather:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.metro-weather .weather-icon {
    font-size: 1.8rem;
}

.metro-weather .weather-temp {
    font-size: 1.5rem;
    font-weight: 500;
}

.metro-weather.hidden {
    opacity: 0;
    pointer-events: none;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-rows: 160px;
    gap: 12px;
    width: 100%;
    max-width: 1000px;
}

.tile {
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);

    /* Animation initial state */
    opacity: 0;
    transform: translateY(30px);
}

.landing-page.active .tile {
    animation: tileEntrance 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tile:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        inset 0 0 0 2px rgba(255, 255, 255, 0.3);
    z-index: 2;
}

.tile:active {
    transform: translateY(-2px) scale(0.98);
    transition: all 0.1s;
}

/* Staggered Delays */
.tile:nth-child(1) {
    animation-delay: 0.1s;
}

.tile:nth-child(2) {
    animation-delay: 0.15s;
}

.tile:nth-child(3) {
    animation-delay: 0.2s;
}

.tile:nth-child(4) {
    animation-delay: 0.25s;
}

.tile:nth-child(5) {
    animation-delay: 0.3s;
}

.tile:nth-child(6) {
    animation-delay: 0.35s;
}

.tile-large {
    grid-column: span 2;
    grid-row: span 2;
}

.tile-medium {
    grid-column: span 2;
    grid-row: span 1;
}

.tile-small {
    grid-column: span 1;
    grid-row: span 1;
}

/* Colors */
.tile-blue {
    background-color: var(--primary);
}

.tile-green {
    background-color: #059669;
}

.tile-purple {
    background-color: #7c3aed;
}

.tile-orange {
    background-color: #ea580c;
}

.tile-red {
    background-color: #dc2626;
}

.tile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    height: 100%;
}

.tile-label {
    position: absolute;
    bottom: 12px;
    left: 12px;
    font-size: 0.9rem;
    font-weight: 400;
}

.tile-large .tile-label {
    font-size: 1.2rem;
}

.tile-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
}

.coming-soon-card {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    max-width: 500px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.coming-soon-card h2 {
    color: var(--primary);
    margin-top: 0;
}

/* Back to Home Button override for modular feel */
#backToHomeBtn {
    margin-right: 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

#backToHomeBtn:hover {
    background: var(--primary);
    color: white;
}

@media (max-width: 900px) {
    .landing-page {
        padding: 40px;
    }

    .metro-header h1 {
        font-size: 2.5rem;
    }

    .metro-header {
        margin-bottom: 40px;
    }

    .metro-clock {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .landing-page {
        padding: 24px 20px;
    }

    .metro-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 32px;
    }

    .metro-header h1 {
        font-size: 2rem;
    }

    .metro-clock {
        font-size: 1.5rem;
    }

    .tile-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(140px, auto);
        max-width: 100%;
        gap: 16px;
    }

    /* Reset spans for single column mobile view */
    .tile-large,
    .tile-medium,
    .tile-small {
        grid-column: auto;
        grid-row: auto;
        min-height: 140px;
    }

    /* Make large tiles slightly taller on mobile */
    .tile-large {
        min-height: 180px;
    }
}

@keyframes tileEntrance {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
        filter: blur(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}