/* Theme Palette Definitions */
:root, [data-theme="dark"] {
    --bg-dark: #090d16;
    --bg-header: rgba(15, 23, 42, 0.85);
    --bg-card: rgba(18, 26, 43, 0.75);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(30, 41, 59, 0.6);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    --whatsapp-green: #25d366;
    --whatsapp-hover: #20bd5a;
    --whatsapp-glow: rgba(37, 211, 102, 0.35);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --border-subtle: rgba(255, 255, 255, 0.07);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --gradient-bg: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
                   radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.12) 0px, transparent 50%),
                   radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
}

[data-theme="light"], [data-theme="white"] {
    --bg-dark: #f8fafc;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --bg-card-border: #e2e8f0;
    --bg-input: #f1f5f9;
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.25);
    
    --accent-purple: #9333ea;
    --accent-pink: #db2777;
    --accent-cyan: #0284c7;

    --text-main: #0f172a;
    --text-muted: #334155;
    --text-dim: #64748b;
    
    --border-subtle: #e2e8f0;
    --shadow-glass: 0 4px 20px 0 rgba(0, 0, 0, 0.05);
    
    --gradient-bg: none;
}

[data-theme="cyber"] {
    --bg-dark: #050510;
    --bg-header: rgba(13, 13, 30, 0.92);
    --bg-card: rgba(20, 20, 45, 0.82);
    --bg-card-border: rgba(6, 182, 212, 0.25);
    --bg-input: rgba(25, 25, 55, 0.75);
    
    --primary: #06b6d4;
    --primary-hover: #0891b2;
    --primary-glow: rgba(6, 182, 212, 0.45);
    
    --accent-purple: #f43f5e;
    --accent-pink: #e11d48;
    --accent-cyan: #22d3ee;

    --text-main: #f0fdf4;
    --text-muted: #a5f3fc;
    --text-dim: #67e8f9;
    
    --border-subtle: rgba(6, 182, 212, 0.2);
    --shadow-glass: 0 8px 32px 0 rgba(6, 182, 212, 0.15);
    
    --gradient-bg: radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.22) 0px, transparent 50%),
                   radial-gradient(at 100% 0%, rgba(244, 63, 94, 0.18) 0px, transparent 50%),
                   radial-gradient(at 50% 100%, rgba(168, 85, 247, 0.18) 0px, transparent 50%);
}

[data-theme="emerald"] {
    --bg-dark: #021a12;
    --bg-header: rgba(6, 38, 27, 0.92);
    --bg-card: rgba(10, 48, 35, 0.82);
    --bg-card-border: rgba(16, 185, 129, 0.22);
    --bg-input: rgba(16, 60, 44, 0.75);
    
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-glow: rgba(16, 185, 129, 0.4);
    
    --accent-purple: #3b82f6;
    --accent-pink: #f59e0b;
    --accent-cyan: #14b8a6;

    --text-main: #ecfdf5;
    --text-muted: #a7f3d0;
    --text-dim: #6ee7b7;
    
    --border-subtle: rgba(16, 185, 129, 0.18);
    --shadow-glass: 0 8px 32px 0 rgba(16, 185, 129, 0.12);
    
    --gradient-bg: radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.2) 0px, transparent 50%),
                   radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
                   radial-gradient(at 50% 100%, rgba(245, 158, 11, 0.12) 0px, transparent 50%);
}

[data-theme="sunset"] {
    --bg-dark: #17081e;
    --bg-header: rgba(35, 15, 45, 0.92);
    --bg-card: rgba(45, 18, 58, 0.82);
    --bg-card-border: rgba(236, 72, 153, 0.22);
    --bg-input: rgba(58, 24, 75, 0.75);
    
    --primary: #ec4899;
    --primary-hover: #db2777;
    --primary-glow: rgba(236, 72, 153, 0.4);
    
    --accent-purple: #f97316;
    --accent-pink: #ef4444;
    --accent-cyan: #a855f7;

    --text-main: #fff1f2;
    --text-muted: #fbcfe8;
    --text-dim: #f472b6;
    
    --border-subtle: rgba(236, 72, 153, 0.18);
    --shadow-glass: 0 8px 32px 0 rgba(236, 72, 153, 0.15);
    
    --gradient-bg: radial-gradient(at 0% 0%, rgba(236, 72, 153, 0.22) 0px, transparent 50%),
                   radial-gradient(at 100% 0%, rgba(249, 115, 22, 0.18) 0px, transparent 50%),
                   radial-gradient(at 50% 100%, rgba(168, 85, 247, 0.18) 0px, transparent 50%);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    background-image: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    padding-bottom: 3rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header & Navbar */
.app-header {
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.live-clock-badge {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.live-clock-badge span {
    color: var(--primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    box-shadow: 0 4px 14px var(--whatsapp-glow);
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--border-subtle);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.825rem;
    border-radius: 6px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

/* Layout Grid & Sidebar */
.app-layout {
    display: flex;
    min-height: calc(100vh - 75px);
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Sidebar Component */
.app-sidebar {
    width: 250px;
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s ease;
    flex-shrink: 0;
    z-index: 90;
}

/* Collapsed Sidebar State */
.app-sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-title {
    font-size: 0.725rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    white-space: nowrap;
}

.app-sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar-collapse-icon-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem;
    transition: var(--transition);
}

.sidebar-collapse-icon-btn:hover {
    color: white;
}

.app-sidebar.collapsed .sidebar-collapse-icon-btn {
    transform: rotate(180deg);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 0.75rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}

.nav-item:hover, .nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: white;
}

.nav-item.active {
    border-left: 3px solid var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.nav-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-text {
    transition: opacity 0.2s ease;
}

.app-sidebar.collapsed .nav-text {
    display: none;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0.75rem 0;
}

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

.sidebar-user-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    flex-shrink: 0;
}

.app-sidebar.collapsed .sidebar-user-badge .nav-text {
    display: none;
}

/* Layout Grid */
.main-wrapper {
    flex: 1;
    min-width: 0;
    max-width: 1400px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
    display: block;
}

.calendar-only-wrapper {
    display: block;
}

.full-calendar-card {
    width: 100%;
    min-height: 750px;
}

.calendar-day {
    min-height: 110px;
    background: rgba(30, 41, 59, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 0.65rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.modal-box.modal-lg {
    max-width: 680px;
}

.day-details-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 0.5rem;
}

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

/* Card Containers */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

/* Today's Dashboard Column */
.today-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.today-title-group h2 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.today-date-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.today-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.whatsapp-banner {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.12), rgba(18, 140, 126, 0.08));
    border: 1px solid rgba(37, 211, 102, 0.25);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.whatsapp-banner-info p {
    font-size: 0.85rem;
    color: #e2e8f0;
    margin-top: 2px;
}

.whatsapp-banner-info strong {
    font-size: 0.95rem;
    color: #4ade80;
}

/* Notes List */
.notes-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: 650px;
    overflow-y: auto;
    padding-right: 4px;
}

.notes-container::-webkit-scrollbar {
    width: 5px;
}

.notes-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.note-item {
    background: rgba(30, 41, 59, 0.45);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: var(--transition);
    position: relative;
}

.note-item:hover {
    background: rgba(30, 41, 59, 0.75);
    transform: translateX(4px);
    border-color: rgba(255, 255, 255, 0.15);
}

.note-item.completed {
    opacity: 0.65;
    border-left-color: #10b981;
}

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

.note-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.note-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.note-item.completed .custom-checkbox {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.note-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
}

.note-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0.75rem 1.85rem;
    line-height: 1.45;
}

.note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.meta-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-priority-high { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.tag-priority-medium { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-priority-low { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }

.time-slot {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #38bdf8;
    font-weight: 500;
}

.note-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.action-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.action-btn.wa-share:hover {
    color: #25d366;
    background: rgba(37, 211, 102, 0.15);
}

.action-btn.delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-dim);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* Right Section: Calendar Grid & Tools */
.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.month-picker {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.month-title {
    font-size: 1.4rem;
    font-weight: 700;
    min-width: 200px;
}

.nav-btn {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--bg-card-border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

.calendar-filters {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.select-input, .search-input {
    background: var(--bg-input);
    border: 1px solid var(--bg-card-border);
    color: var(--text-main);
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.select-input option, .form-control option {
    background: var(--bg-card);
    color: var(--text-main);
}

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

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.day-name {
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.5rem 0;
}

.day-name-short {
    display: none;
}

.calendar-day {
    min-height: 100px;
    background: rgba(30, 41, 59, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.calendar-day:hover {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.calendar-day.other-month {
    opacity: 0.25;
    background: rgba(15, 23, 42, 0.2);
}

.calendar-day.today {
    background: rgba(99, 102, 241, 0.12);
    border: 1.5px solid var(--primary);
}

.calendar-day.selected {
    box-shadow: 0 0 0 2px var(--accent-purple);
}

.day-number-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.day-number {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.calendar-day.today .day-number {
    color: #818cf8;
}

.day-event-count {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 5px;
    border-radius: 10px;
    color: var(--text-muted);
}

.day-events-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
    overflow: hidden;
}

.mini-event-pill {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid var(--primary);
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mini-event-pill.completed {
    opacity: 0.5;
    text-decoration: line-through;
}

/* Modal Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 13, 22, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-close:hover { color: white; }

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

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

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    color: var(--text-main);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

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

/* ==========================================================================
   Mobile & Tablet Optimization (Responsive Queries)
   ========================================================================== */

@media (max-width: 768px) {
    body {
        padding-bottom: 2rem;
    }

    .app-header {
        padding: 0.75rem 1rem;
    }

    .header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .brand {
        justify-content: center;
        font-size: 1.2rem;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }

    .header-right {
        justify-content: space-between;
        width: 100%;
        gap: 0.5rem;
    }

    .live-clock-badge {
        padding: 0.4rem 0.65rem;
        font-size: 0.8rem;
    }

    .btn {
        padding: 0.55rem 0.9rem;
        font-size: 0.85rem;
    }

    /* Mobile Off-Canvas Sidebar Drawer */
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -260px;
        width: 250px !important;
        z-index: 1050;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .app-sidebar.mobile-open {
        left: 0;
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Layout */
    .main-wrapper {
        margin: 1rem auto 0;
        padding: 0 0.75rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .glass-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    /* WhatsApp Banner on Mobile */
    .whatsapp-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .whatsapp-banner .btn {
        width: 100%;
    }

    /* Calendar Controls & Filter Bar */
    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .month-picker {
        justify-content: space-between;
        width: 100%;
    }

    .month-title {
        font-size: 1.15rem;
        min-width: auto;
        text-align: center;
    }

    .calendar-filters {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .select-input, .search-input {
        width: 100%;
    }

    /* Calendar Grid for Mobile */
    .calendar-grid {
        gap: 4px;
    }

    .day-name {
        font-size: 0.7rem;
        padding: 0.35rem 0;
        letter-spacing: 0;
    }

    .calendar-day {
        min-height: 62px;
        padding: 0.35rem;
        border-radius: var(--radius-sm);
    }

    .day-number {
        font-size: 0.8rem;
    }

    .day-event-count {
        font-size: 0.65rem;
        padding: 0px 4px;
    }

    .mini-event-pill {
        font-size: 0.65rem;
        padding: 1px 4px;
        border-left-width: 2px;
    }

    /* Modal Mobile Formatting */
    .modal-box {
        max-width: 95%;
        margin: 0 0.5rem;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
        gap: 0.85rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .modal-footer {
        padding: 0.85rem 1rem;
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* Toast Container on Mobile */
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .brand span {
        font-size: 1.1rem;
    }

    .day-name-full {
        display: none;
    }

    .day-name-short {
        display: inline;
    }

    .live-clock-badge span:first-child {
        display: none; /* Hide label, keep time */
    }

    .calendar-day {
        min-height: 52px;
        padding: 3px;
    }

    .day-number {
        font-size: 0.75rem;
    }

    .mini-event-pill {
        font-size: 0.6rem;
        line-height: 1.2;
    }

    .note-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .note-actions {
        align-self: flex-end;
        margin-top: 0.35rem;
    }
}

/* Sidebar Badges */
.sidebar-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    transition: var(--transition);
}

.sidebar-badge.badge-primary {
    background: var(--primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.app-sidebar.collapsed .sidebar-badge {
    display: none;
}

/* View Header Banner */
.view-header-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.banner-title-area h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.banner-title-area .subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.banner-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Stat Widgets Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    background: var(--bg-input);
    border-color: var(--primary);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.icon-blue { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.icon-green { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.icon-amber { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.icon-rose { background: rgba(244, 63, 94, 0.18); color: #fb7185; }
.icon-purple { background: rgba(168, 85, 247, 0.18); color: #c084fc; }
.icon-cyan { background: rgba(6, 182, 212, 0.18); color: #22d3ee; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Toolbars */
.section-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.toolbar-search {
    min-width: 240px;
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.flex-grow { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* Overall Notes Layouts */
.notes-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.overall-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    transition: var(--transition);
}

.overall-card:hover {
    transform: translateY(-3px);
    background: var(--bg-input);
    border-color: var(--primary);
    box-shadow: var(--shadow-glass);
}

.overall-card-date {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    width: fit-content;
}

.overall-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.overall-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.overall-table th {
    background: var(--bg-input);
    padding: 0.85rem 1rem;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.overall-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    color: var(--text-main);
}

.overall-table tr:hover td {
    background: var(--bg-input);
}

/* Theme Modal & Cards Grid */
.theme-intro-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
}

.theme-card {
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.theme-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background: var(--bg-input);
}

.theme-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    background: var(--bg-input);
}

.theme-preview {
    height: 65px;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.preview-dark { background: #090d16; border: 1px solid rgba(255, 255, 255, 0.1); }
.preview-light { background: #ffffff; border: 1px solid rgba(0, 0, 0, 0.15); }
.preview-cyber { background: #050510; border: 1px solid rgba(6, 182, 212, 0.3); }
.preview-emerald { background: #021a12; border: 1px solid rgba(16, 185, 129, 0.3); }
.preview-sunset { background: #17081e; border: 1px solid rgba(236, 72, 153, 0.3); }

.preview-header {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}
.preview-light .preview-header { background: rgba(0, 0, 0, 0.15); }

.preview-body {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.p-indigo { background: #6366f1; }
.p-purple { background: #a855f7; }
.p-cyan { background: #06b6d4; }
.p-pink { background: #ec4899; }
.p-emerald { background: #10b981; }
.p-teal { background: #14b8a6; }
.p-gold { background: #f59e0b; }
.p-orange { background: #f97316; }

.theme-details {
    display: flex;
    flex-direction: column;
}

.theme-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-main);
}

.theme-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Mobile Adjustments for Sections & Controls */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.85rem;
        gap: 0.75rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .section-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.85rem;
        gap: 0.75rem;
    }

    .toolbar-filters {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .toolbar-filters .select-input {
        width: 100%;
    }

    .view-header-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
    }

    .banner-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }

    .banner-actions .btn {
        width: 100%;
    }

    .notes-grid-layout {
        grid-template-columns: 1fr;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

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

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


