/* Second Brain — Custom Styles */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e1b4b;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0c0a1d;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* Global form element styling */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--text-light);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    color: var(--text);
}

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

a:hover {
    text-decoration: underline;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s;
    z-index: 50;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.sidebar-header .logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

/* Hide hamburger on desktop */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }
}

.sidebar-header h1 {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header h1,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title { display: none; }

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

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.35);
    padding: 16px 12px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item .badge {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-details {
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.sidebar.collapsed .sidebar-footer .user-details,
.sidebar.collapsed .sidebar-footer .btn-logout { display: none; }

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.top-bar {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-shrink: 0;
}

.top-bar .page-title {
    font-size: 18px;
    font-weight: 700;
}

.search-global {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-global input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

.search-global input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-global .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-global .shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--text-light);
    background: var(--bg);
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px 56px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-icon {
    padding: 8px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg);
    color: var(--text);
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

/* Style native inputs inside modals */
.modal-dialog input[type="text"],
.modal-dialog input[type="date"],
.modal-dialog input[type="time"],
.modal-dialog input[type="datetime-local"],
.modal-dialog select,
.modal-dialog textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s;
}

.modal-dialog input:focus,
.modal-dialog select:focus,
.modal-dialog textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal-dialog input[type="color"] {
    width: 50px;
    height: 40px;
    padding: 2px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

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

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.tags-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    min-height: 42px;
    cursor: text;
}

.tags-input:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.tag-badge .tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: none;
    background: rgba(67, 56, 202, 0.15);
    color: #4338ca;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

.tag-badge .tag-remove:hover {
    background: rgba(67, 56, 202, 0.3);
}

.tag-input {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 4px 0 !important;
    font-size: 14px;
    flex: 1;
    min-width: 80px;
    background: transparent !important;
}

/* Priority badges */
.priority-urgent { color: #ef4444; }
.priority-high { color: #f97316; }
.priority-medium { color: #6366f1; }
.priority-low { color: #22c55e; }

.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.priority-dot.urgent { background: #ef4444; }
.priority-dot.high { background: #f97316; }
.priority-dot.medium { background: #6366f1; }
.priority-dot.low { background: #22c55e; }

/* Task filters */
/* Tasks toolbar */
.tasks-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.tasks-filters {
    display: flex;
    gap: 8px;
}

.tasks-filters button {
    padding: 8px 20px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
    font-family: inherit;
}

.tasks-filters button:hover {
    background: #eef2ff;
    color: #6366f1;
    border-color: #c7d2fe;
}

.tasks-filters button.active {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Show completed toggle */
.toggle-completed-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #64748b;
    user-select: none;
}

.toggle-completed-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 36px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 10px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-completed-label input:checked + .toggle-slider {
    background: #6366f1;
}

.toggle-completed-label input:checked + .toggle-slider::after {
    left: 18px;
}

.toggle-text {
    font-weight: 500;
}

/* Task done state on Tasks page */
.task-item.task-done {
    opacity: 0.5;
}

.task-item.task-done .task-title {
    text-decoration: line-through;
    color: #94a3b8;
}

/* Task sections (grouped view) */
.task-section {
    margin-bottom: 28px;
}

.task-section:last-child {
    margin-bottom: 0;
}

.task-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.task-section-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-section-header h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.task-section-overdue .task-section-header h3 {
    color: #ef4444;
}

.task-section-today .task-section-header h3 {
    color: #6366f1;
}

.task-section-nodate .task-section-header h3 {
    color: #94a3b8;
}

.task-section-upcoming .task-section-header h3 {
    color: #22c55e;
}

.task-section-count {
    font-size: 12px;
    font-weight: 600;
    background: var(--border);
    color: var(--text-muted);
    padding: 1px 8px;
    border-radius: 10px;
}

/* Overdue task styling */
.task-item.task-overdue {
    border-left: 3px solid #ef4444;
}

.task-due-overdue {
    color: #ef4444 !important;
    font-weight: 600;
}

.task-due-none {
    color: #cbd5e1;
    font-style: italic;
}

/* Task list */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s;
}

.task-item:hover {
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #6366f1;
    margin: 0;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-content h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
    line-height: 1.4;
}

.task-title.completed {
    text-decoration: line-through;
    color: #94a3b8;
}

.task-description {
    font-size: 13px;
    color: #64748b;
    margin: 4px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: #eef2ff;
    color: #6366f1;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #64748b;
    flex-shrink: 0;
    white-space: nowrap;
}

.task-due {
    color: #64748b;
}

.task-priority {
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-priority.priority-urgent { background: #fef2f2; color: #ef4444; }
.task-priority.priority-high { background: #fff7ed; color: #f97316; }
.task-priority.priority-medium { background: #eef2ff; color: #6366f1; }
.task-priority.priority-low { background: #f0fdf4; color: #22c55e; }

.task-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-item:hover .task-actions {
    opacity: 1;
}

.task-actions .btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.task-actions .btn-icon:hover {
    background: #f1f5f9;
    color: #6366f1;
}

.task-actions .btn-icon:last-child:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* Note cards */
.note-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.note-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.note-card.pinned {
    border-color: rgba(245, 158, 11, 0.35);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.04), var(--bg-card) 60%);
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.06);
}

.note-card.pinned:hover {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.pin-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
    z-index: 2;
}

.note-card .pin {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--warning);
    font-size: 14px;
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.note-card-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.note-card:hover .note-card-actions {
    opacity: 1;
}

.note-card-actions .btn-icon {
    padding: 4px;
    border-radius: 6px;
}

.note-card-actions .btn-icon.pin-active {
    color: var(--warning);
}

.note-excerpt {
    font-size: 13px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.note-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.note-card .excerpt {
    font-size: 13px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card .note-meta {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.notes-toolbar {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notes-toolbar .search-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

/* Tag filter bar */
.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tag-pill:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}

.tag-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.tag-pill.active:hover {
    background: var(--primary-dark, #4f46e5);
    color: #fff;
}

.tag-pill-count {
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.tag-pill.active .tag-pill-count {
    background: rgba(255, 255, 255, 0.25);
}

.notes-toolbar .search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-card);
    transition: border-color 0.15s;
}

.notes-toolbar .search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Modal - structure: div.modal > div.modal-backdrop + div.modal-dialog */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal.modal-visible {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-dialog {
    position: relative;
    background: var(--bg-card, #fff);
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    transform: translateY(20px);
    transition: transform 0.2s;
    z-index: 1;
}

.modal.modal-visible .modal-dialog {
    transform: translateY(0);
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    line-height: 1;
    transition: all 0.15s ease;
}

.modal-close:hover {
    color: #64748b;
    background: rgba(0, 0, 0, 0.05);
}

.modal-body { padding: 24px; }

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

/* Settings tabs */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
}

.settings-tabs .settings-tab {
    padding: 8px 20px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
    font-family: inherit;
}

.settings-tabs .settings-tab:hover {
    background: #eef2ff;
    color: #6366f1;
    border-color: #c7d2fe;
}

.settings-tabs .settings-tab.active {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

.settings-form {
    max-width: 560px;
}

.settings-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #1e293b;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: #64748b;
}

.stat-row strong {
    color: #1e293b;
}

.form-separator {
    height: 1px;
    background: #e2e8f0;
    margin: 24px 0;
}

.form-actions {
    margin-top: 24px;
}

/* Chat */
/* ── Chat Layout ── */
.chat-layout {
    display: flex;
    height: calc(100vh - 80px);
    background: #f8fafc;
    overflow: hidden;
}

/* ── Chat Sidebar ── */
.chat-sidebar {
    width: 300px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    flex-shrink: 0;
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.chat-sidebar-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    letter-spacing: -0.02em;
}

.chat-new-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.chat-new-btn:hover {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-sidebar-empty {
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.6;
}

/* ── Conversation Items ── */
.conversation-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 4px;
    position: relative;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.conversation-item.active {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: #c7d2fe;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.1);
}

.conversation-item.active .conversation-item-title {
    color: #4338ca;
    font-weight: 600;
}

.conversation-item.active .conversation-item-time {
    color: #6366f1;
}

.conversation-item-content {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.conversation-item-title {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
    line-height: 1.3;
}

.conversation-item-time {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 400;
}

.conversation-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.conversation-item:hover .conversation-delete-btn {
    opacity: 0.7;
}

.conversation-item:hover .conversation-delete-btn:hover {
    opacity: 1;
    background: #fee2e2;
    color: #ef4444;
}

/* ── Chat Main Area ── */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #ffffff;
}

.chat-header {
    padding: 18px 28px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    background: #ffffff;
}

.chat-header-left h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: linear-gradient(180deg, #fafbfd 0%, #ffffff 50%);
}

/* ── Welcome / Empty State ── */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 20px;
}

.chat-welcome-icon {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #c7d2fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
}

.chat-welcome h3 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}

.chat-welcome p {
    font-size: 15px;
    color: #64748b;
    max-width: 440px;
    line-height: 1.7;
    margin: 0 0 36px;
}

/* ── Suggestion Chips ── */
.chat-suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 500px;
    width: 100%;
}

.suggestion-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #475569;
    font-family: inherit;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.suggestion-chip svg {
    flex-shrink: 0;
    color: #6366f1;
    width: 16px;
    height: 16px;
}

.suggestion-chip:hover {
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    color: #4338ca;
    border-color: #a5b4fc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* ── Chat Messages ── */
.chat-msg {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: flex-start;
    animation: msgFadeIn 0.3s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg-user {
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-msg-user .chat-msg-avatar {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.chat-msg-assistant .chat-msg-avatar {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #6366f1;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.08);
}

.chat-msg-bubble {
    max-width: 70%;
    min-width: 60px;
}

.chat-msg-text {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
}

.chat-msg-user .chat-msg-text {
    white-space: pre-wrap;
}

.chat-msg-user .chat-msg-text {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.chat-msg-assistant .chat-msg-text {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 6px;
    border: 1px solid #e2e8f0;
}

.chat-msg-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    padding: 0 6px;
    font-weight: 400;
}

.chat-msg-user .chat-msg-meta {
    text-align: right;
}

/* ── Markdown in chat messages ── */
.chat-msg-text strong {
    font-weight: 700;
}

.chat-msg-text em {
    font-style: italic;
}

.chat-msg-text ol.chat-list,
.chat-msg-text ul.chat-list {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-msg-text ol.chat-list li,
.chat-msg-text ul.chat-list li {
    margin-bottom: 4px;
    line-height: 1.6;
}

.chat-msg-text code.chat-inline-code {
    background: rgba(99, 102, 241, 0.08);
    color: #4338ca;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

.chat-msg-assistant .chat-msg-text code.chat-inline-code {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
}

.chat-msg-user .chat-msg-text code.chat-inline-code {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.chat-msg-text pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px 16px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.5;
}

.chat-msg-text pre code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: none;
    color: inherit;
    padding: 0;
}

/* ── Typing Indicator ── */
.chat-typing-dots {
    display: flex;
    gap: 5px;
    padding: 16px 20px;
    background: #f1f5f9;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    border: 1px solid #e2e8f0;
}

.chat-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: chatBounce 1.4s infinite ease-in-out both;
}

.chat-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes chatBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Chat Input ── */
.chat-input-area {
    padding: 18px 28px 24px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 14px 22px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 14px;
    background: #f8fafc;
    color: #1e293b;
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
}

.chat-input-wrapper input:focus {
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.chat-input-wrapper input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
}

.chat-input-wrapper button#chatSendBtn,
.chat-input-wrapper button[id="chatSendBtn"] {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.chat-input-wrapper button#chatSendBtn:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transform: scale(1.05);
}

.chat-input-wrapper button#chatSendBtn:disabled,
.chat-input-wrapper button[id="chatSendBtn"]:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ── Chat Mobile Responsive ── */
@media (max-width: 768px) {
    .chat-layout {
        flex-direction: column;
        height: calc(100vh - 52px);
    }
    .chat-sidebar {
        width: 100%;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        flex-shrink: 0;
    }
    .chat-main {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .chat-header {
        padding: 12px 16px;
        min-height: 44px;
        flex-shrink: 0;
    }
    .chat-messages {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
    }
    .chat-input-area {
        flex-shrink: 0;
    }
    .chat-suggestions {
        grid-template-columns: 1fr;
    }
    .chat-msg-bubble {
        max-width: 85%;
    }
}

/* Calendar overrides */
#calendar {
    flex: 1;
    min-height: 0;
}
.fc { font-size: 13px; }
.fc .fc-toolbar-title { font-size: 18px !important; font-weight: 700 !important; }
.fc .fc-button-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}
.fc .fc-daygrid-day-top { padding: 4px; }
.fc .fc-event { border-radius: 4px; padding: 1px 4px; }

/* Calendar: Tasks vs Events distinction */
/* Events — neutral dark text instead of all-blue */
.fc .fc-event:not(.calendar-task) {
    border-radius: 6px;
    font-weight: 500;
    border: none;
    background: rgba(99, 102, 241, 0.12) !important;
    color: #1e293b !important;
}
.fc .fc-event:not(.calendar-task) .fc-event-main {
    color: #1e293b !important;
}
/* Dot indicators in month view — keep them purple */
.fc .fc-daygrid-event-dot {
    border-color: var(--primary) !important;
}
/* List view event text — dark gray */
.fc .fc-list-event:not(.calendar-task) .fc-list-event-title a {
    color: #1e293b !important;
}
.fc .fc-list-event:not(.calendar-task) .fc-list-event-time {
    color: #64748b !important;
}

/* Tasks — outlined style with dashed border */
.fc .calendar-task {
    border: 1.5px dashed !important;
    border-radius: 6px !important;
    font-weight: 600;
    font-size: 0.92em;
}

.fc .calendar-task .fc-event-main {
    padding-left: 2px;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Completed tasks on calendar — faded + strikethrough */
.fc .calendar-task-done {
    opacity: 0.45 !important;
}

.fc .calendar-task-done .fc-event-title {
    text-decoration: line-through;
}

/* List view task rows */
.fc .fc-list-event.calendar-task {
    border: none !important;
    background: transparent !important;
}

.fc .fc-list-event.calendar-task td {
    background: rgba(99, 102, 241, 0.03);
}

.cal-task-check {
    transition: all 0.15s ease;
}

.cal-task-check:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ── Now indicator (current time line) ── */
.fc .fc-now-indicator.fc-now-indicator-line {
    border-color: #ef4444;
    border-width: 2px;
    z-index: 4;
}
/* Red dot at the left edge of the line */
.fc .fc-now-indicator.fc-now-indicator-line::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -5px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}
/* Arrow on the now-indicator */
.fc .fc-now-indicator.fc-now-indicator-arrow {
    border-color: #ef4444;
    border-top-color: transparent;
    border-bottom-color: transparent;
}
/* Subtle highlight for current day column in week/day views */
.fc .fc-day-today {
    background: rgba(99, 102, 241, 0.03) !important;
}

/* Quill editor */
.ql-container { font-size: 15px; position: relative; overflow: hidden; }
.ql-editor { min-height: 200px; max-height: 300px; overflow-y: auto; line-height: 1.8; }
.ql-toolbar { border-radius: 8px 8px 0 0; background: var(--bg); }
.ql-container { border-radius: 0 0 8px 8px; }
.ql-clipboard { position: absolute !important; left: -9999px !important; height: 1px !important; overflow: hidden !important; }
.ql-tooltip { z-index: 10; }
.modal-body .modal-actions { position: relative; z-index: 2; }

/* Search page */
.search-page {
    max-width: 800px;
    margin: 0 auto;
}

.global-search {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.global-search:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-results {
    margin-top: 20px;
}

.search-section {
    margin-bottom: 24px;
}

.search-section h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    padding: 0 4px 10px;
    border-bottom: 1px solid #f1f5f9;
    margin: 0 0 8px;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
    border: 1px solid #f1f5f9;
    margin-bottom: 8px;
    transition: all 0.15s;
}

.search-result-item:hover {
    border-color: #c7d2fe;
    background: #fafafe;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}

.search-result-item .icon {
    flex-shrink: 0;
    margin-top: 3px;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    padding: 7px;
    background: #f1f5f9;
    border-radius: 8px;
}

.search-result-item[data-type="note"] .icon { background: #eef2ff; color: #6366f1; stroke: #6366f1; }
.search-result-item[data-type="task"] .icon { background: #ecfdf5; color: #10b981; stroke: #10b981; }
.search-result-item[data-type="event"] .icon { background: #fef3c7; color: #f59e0b; stroke: #f59e0b; }

.result-content {
    flex: 1;
    min-width: 0;
}

.result-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 3px;
}

.result-content p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-date {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Dashboard stats */
/* Dashboard hero header */
.dash-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.dash-hero-text {
    flex: 1;
}

.dash-hero .btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.dash-hero h1 {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #1e293b 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
}

.dash-hero p {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 500;
}

/* ===== Smart Briefing Widget ===== */
.dash-card-briefing {
    background: linear-gradient(135deg, #f0f0ff 0%, #faf9ff 40%, #fff 100%);
    border: 1px solid rgba(99, 102, 241, 0.18);
    position: relative;
    overflow: hidden;
}

.dash-card-briefing::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.dash-card-briefing .dash-card-header {
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.briefing-phase-icon {
    font-size: 20px;
    line-height: 1;
}

.briefing-text {
    font-size: 15px;
    line-height: 1.75;
    color: #1e293b;
    padding: 4px 0;
}

.briefing-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 14px;
    border-top: 1px solid rgba(99, 102, 241, 0.08);
    position: relative;
    z-index: 1;
}

.briefing-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.briefing-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #64748b;
    background: rgba(99, 102, 241, 0.06);
    padding: 4px 10px;
    border-radius: 20px;
}

.briefing-pill strong {
    color: #1e293b;
    font-weight: 700;
}

.briefing-pill-warn {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.briefing-pill-warn strong {
    color: #dc2626;
}

.briefing-pill-done {
    background: rgba(34, 197, 94, 0.08);
    color: #16a34a;
}

.briefing-pill-done strong {
    color: #16a34a;
}

.briefing-cached {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.btn-icon-small {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}

.btn-icon-small:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.btn-icon-small.spinning svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Skeleton loading animation */
.briefing-skeleton {
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

.skeleton-line-long { width: 100%; }
.skeleton-line-medium { width: 75%; }
.skeleton-line-short { width: 45%; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Goals Widget ===== */
.dash-card-goals {
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.dash-card-goals .dash-card-header {
    border-bottom: 1px solid rgba(139, 92, 246, 0.08);
}

.goals-empty {
    text-align: center;
    padding: 20px 16px;
    color: #94a3b8;
}

.goals-empty p {
    margin-bottom: 12px;
    font-size: 14px;
}

.goals-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.goals-tier-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.goals-tier-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8b5cf6;
    padding: 0 2px;
}

.goal-item {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.03), transparent);
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    padding: 12px 14px;
    transition: all 0.2s;
}

.goal-item:hover {
    border-color: rgba(139, 92, 246, 0.25);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
}

.goal-item.goal-complete {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), transparent);
    border-color: rgba(34, 197, 94, 0.2);
}

.goal-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.goal-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.goal-edit-btn {
    background: none;
    border: none;
    color: #c4b5fd;
    cursor: pointer;
    padding: 3px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
    opacity: 0;
}

.goal-item:hover .goal-edit-btn {
    opacity: 1;
}

.goal-edit-btn:hover {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.goal-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.goal-fraction {
    font-size: 13px;
    font-weight: 700;
    color: #8b5cf6;
    font-variant-numeric: tabular-nums;
}

.goal-complete .goal-fraction {
    color: #16a34a;
}

.goal-progress {
    width: 100%;
    height: 6px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.goal-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 3px;
    transition: width 0.4s ease;
    min-width: 0;
}

.goal-complete .goal-progress {
    background: rgba(34, 197, 94, 0.1);
}

.goal-complete .goal-progress-bar {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
}

.stat-card-notes::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.stat-card-tasks::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.stat-card-overdue::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-card-events::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

a.stat-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    cursor: pointer;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.stat-card-notes .stat-icon { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.stat-card-tasks .stat-icon { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.stat-card-overdue .stat-icon { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.stat-card-events .stat-icon { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Legacy alias */
.stat-card .stat-number {
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
}

/* Dashboard sections */
.dashboard-sections {
    display: grid;
    gap: 20px;
    margin-top: 8px;
}

.dash-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dash-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s ease;
}

.dash-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);
}

.dash-card-warning {
    border-color: #fecaca;
    background: linear-gradient(135deg, #fff5f5, #fff);
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.dash-card-warning .dash-card-header {
    border-bottom-color: #fecaca;
}

.dash-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-card-title svg {
    padding: 5px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 8px;
    flex-shrink: 0;
}

.dash-card-warning .dash-card-title svg {
    background: rgba(239, 68, 68, 0.08);
}

.dash-card-title h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.dash-card-warning .dash-card-title h3 { color: #dc2626; }

.dash-card-link {
    font-size: 13px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.dash-card-link:hover { color: #4f46e5; gap: 6px; }

.dash-badge-warn {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

.dash-card-body {
    padding: 8px 16px;
}

/* Dashboard task items */
.dash-task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-radius: 10px;
    transition: all 0.15s;
    border-bottom: 1px solid #f8fafc;
}

.dash-task-item:last-child { border-bottom: none; }
.dash-task-item:hover {
    background: #f8fafc;
    cursor: pointer;
}

.dash-task-done { opacity: 0.45; }
.dash-task-done .dash-task-name { text-decoration: line-through; }

.dash-task-check {
    width: 22px;
    height: 22px;
    border: 2px solid #6366f1;
    border-radius: 7px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    cursor: pointer;
}

.dash-task-check:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.dash-task-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-task-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-task-time {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    font-weight: 500;
}

.dash-task-priority {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Dashboard note items */
.dash-note-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid #f8fafc;
}

.dash-note-item:last-child { border-bottom: none; }
.dash-note-item:hover {
    background: #f8fafc;
    transform: translateX(2px);
}

.dash-note-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.dash-note-content {
    flex: 1;
    min-width: 0;
}

.dash-note-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-note-content p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.dash-note-date {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
    margin-top: 2px;
}

/* Dashboard event items */
.dash-event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-radius: 10px;
    transition: all 0.15s;
    border-bottom: 1px solid #f8fafc;
}

.dash-event-item:last-child { border-bottom: none; }
.dash-event-item:hover {
    background: #f8fafc;
    transform: translateX(2px);
}

.dash-event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.dash-event-info {
    flex: 1;
    min-width: 0;
}

.dash-event-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-event-loc {
    font-size: 12px;
    color: #94a3b8;
    display: block;
}

.dash-event-time {
    font-size: 13px;
    font-weight: 700;
    color: #6366f1;
    white-space: nowrap;
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.06);
    padding: 4px 10px;
    border-radius: 8px;
}

/* Dashboard empty states */
.dash-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 10px;
}

.dash-empty svg {
    opacity: 0.4;
}

.dash-empty p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
    font-weight: 500;
}

/* ── Mobile Dashboard Responsive ── */
@media (max-width: 768px) {
    .dash-two-col {
        grid-template-columns: 1fr;
    }

    .dash-hero {
        margin-bottom: 16px;
    }

    .dash-hero h1 {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 16px 12px;
        border-radius: 14px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        margin-bottom: 8px;
    }

    .stat-icon svg {
        width: 18px;
        height: 18px;
    }

    .stat-card .stat-value {
        font-size: 24px;
    }

    .stat-card .stat-label {
        font-size: 11px;
    }

    /* Quick capture mobile */
    .quick-capture {
        padding: 18px 16px;
        border-radius: 14px;
        margin-bottom: 20px;
    }

    .quick-capture h3 {
        font-size: 15px;
    }

    .quick-capture-input {
        padding: 3px 3px 3px 12px;
        border-radius: 10px;
    }

    .quick-capture-input input {
        font-size: 14px;
        padding: 10px 6px;
    }

    .quick-capture-input .btn-primary {
        padding: 10px 14px;
        font-size: 13px;
    }

    .example-chip {
        padding: 5px 10px;
        font-size: 11px;
    }

    /* Dash cards mobile */
    .dashboard-sections {
        gap: 14px;
    }

    .dash-card {
        border-radius: 14px;
    }

    .dash-card-header {
        padding: 14px 16px;
    }

    .dash-card-title h3 {
        font-size: 14px;
    }

    .dash-card-title svg {
        width: 16px;
        height: 16px;
        padding: 4px;
    }

    .dash-card-body {
        padding: 6px 12px;
    }

    /* Task items mobile */
    .dash-task-item {
        padding: 11px 6px;
        gap: 10px;
    }

    .dash-task-name {
        font-size: 13px;
    }

    .dash-task-priority {
        font-size: 9px;
        padding: 2px 8px;
    }

    /* Note items mobile */
    .dash-note-item {
        padding: 10px 6px;
        gap: 10px;
    }

    .dash-note-icon {
        width: 30px;
        height: 30px;
    }

    .dash-note-content h4 {
        font-size: 13px;
    }

    .dash-note-content p {
        font-size: 12px;
    }

    /* Event items mobile */
    .dash-event-item {
        padding: 10px 6px;
        gap: 10px;
    }

    .dash-event-name {
        font-size: 13px;
    }

    .dash-event-time {
        font-size: 12px;
        padding: 3px 8px;
    }
}

/* Page header */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p,
.page-header .subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Integration cards */
.integration-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}

.integration-card.connected {
    border-color: rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.03), transparent);
}

.integration-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.integration-icon {
    width: 48px;
    height: 48px;
    background: var(--bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.integration-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }

.integration-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.integration-badge.connected {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.integration-badge.disconnected {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.integration-details {
    background: var(--bg);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.integration-details .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.integration-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.integration-info-text {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.integration-info-text p { margin-bottom: 8px; }

.integration-features {
    margin-bottom: 24px;
}

.integration-features h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.integration-features ul {
    list-style: none;
    padding: 0;
}

.integration-features li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    font-size: 14px;
    color: var(--text);
}

.integration-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.integration-setup-notice {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
}

.integration-setup-notice ol {
    padding-left: 20px;
    margin-top: 8px;
}

.integration-setup-notice li {
    padding: 4px 0;
    font-size: 13px;
}

.integration-setup-notice code {
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: rgba(239, 68, 68, 0.08); }

/* Quick capture */
.quick-capture {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 24px;
    margin-bottom: 24px;
}

.quick-capture h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.quick-capture-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.quick-capture-input {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 4px 4px 4px 14px;
    transition: border-color 0.2s;
}

.quick-capture-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.capture-icon-area {
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
}

.quick-capture-input input {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text);
    outline: none;
}

.quick-capture-input .btn-primary {
    flex-shrink: 0;
    padding: 10px 20px;
    border-radius: 8px;
}

.quick-capture-examples {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.example-chip {
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 100px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.example-chip:hover {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.25);
}

.capture-result {
    margin-top: 16px;
}

.capture-thinking {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.capture-success {
    padding: 14px 16px;
    background: var(--bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease;
}

.capture-success-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.capture-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.capture-type-badge svg { stroke: #fff; }

.capture-success-header strong {
    font-size: 15px;
}

.capture-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.capture-detail {
    font-size: 13px;
    color: var(--text-muted);
}

.capture-success-message {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

.capture-error {
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.05);
    border-left: 4px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    font-size: 14px;
}

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

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

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

/* Loading */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
}

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 48px;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Mobile header bar */
.mobile-header {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-sidebar);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.mobile-header .mobile-menu-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
}

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

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    /* Fix mobile viewport: app-container must account for the mobile-header height */
    .app-container {
        height: calc(100vh - 52px);
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 200;
        transition: left 0.3s;
    }

    .sidebar.open { left: 0; }

    .mobile-only {
        display: flex;
    }

    .page-content {
        padding: 20px 12px;
    }

    /* Hide desktop top-bar on mobile */
    .top-bar {
        display: none;
    }

    /* Calendar: fill available viewport on mobile */
    #calendar .fc-toolbar.fc-header-toolbar {
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 8px !important;
    }
    #calendar .fc-toolbar-title {
        font-size: 16px !important;
    }
    #calendar .fc-button {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }
    /* Week/day time-grid views: show full day without scrolling */
    #calendar .fc-timegrid {
        min-height: 600px;
    }
    /* Month view: let rows breathe */
    #calendar .fc-daygrid-body {
        min-height: 400px;
    }
    /* List view: full height */
    #calendar .fc-list {
        min-height: 500px;
    }

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

    .modal-dialog {
        width: 95%;
        max-height: 95vh;
    }
}

/* Tab styles for settings */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    transition: all 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 160px;
    z-index: 50;
    display: none;
    padding: 4px;
}

.dropdown-menu.open { display: block; }

.dropdown-item {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }

/* AI suggestions */
.ai-suggestions {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 8px;
    font-size: 13px;
}

.ai-suggestions .suggestion-label {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Typing indicator for AI */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* =====================================================
   FOCUS WINDOW — Dashboard Widget
   ===================================================== */
.dash-card-focus {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.06) 0%, rgba(168, 85, 247, 0.02) 100%);
    border: 1px solid rgba(168, 85, 247, 0.15);
}

.greeting-focus-sub {
    font-size: 13px;
    color: var(--text-muted);
}
.greeting-focus-sub.focus-active {
    color: #a855f7;
    font-weight: 600;
}

.focus-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(168, 85, 247, 0.1);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #a855f7;
}
.focus-badge-active {
    background: rgba(168, 85, 247, 0.2);
    color: #7c3aed;
    animation: focusPulse 2s ease-in-out infinite;
}
.focus-badge-done {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

@keyframes focusPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(168, 85, 247, 0); }
}

/* Focus Timeline */
.focus-timeline {
    position: relative;
    margin-bottom: 16px;
    padding-bottom: 20px;
}
.focus-timeline-bar {
    position: relative;
    height: 12px;
    background: rgba(168, 85, 247, 0.08);
    border-radius: 6px;
    overflow: visible;
}
.focus-timeline-event {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(168, 85, 247, 0.35);
    border-radius: 4px;
    min-width: 4px;
}
.focus-timeline-now {
    position: absolute;
    top: -4px;
    width: 3px;
    height: 20px;
    background: #a855f7;
    border-radius: 2px;
    z-index: 2;
}
.focus-timeline-now::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 9px;
    height: 9px;
    background: #a855f7;
    border-radius: 50%;
}
.focus-timeline-labels {
    position: relative;
    height: 16px;
    margin-top: 4px;
}
.focus-timeline-labels span {
    position: absolute;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Focus Stats */
.focus-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.focus-stat {
    text-align: center;
    padding: 10px 8px;
    background: rgba(168, 85, 247, 0.04);
    border-radius: 8px;
    border: 1px solid rgba(168, 85, 247, 0.08);
}
.focus-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #a855f7;
}
.focus-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =====================================================
   FOCUS WINDOW — Calendar Slot Styling
   ===================================================== */
.focus-window-label {
    position: absolute;
    top: -1px;
    right: 8px;
    z-index: 5;
    pointer-events: none;
}
.focus-window-label span {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
    font-size: 10px;
    font-weight: 600;
    border-radius: 0 0 4px 4px;
    letter-spacing: 0.02em;
}

/* =====================================================
   GOALS PAGE
   ===================================================== */
.goals-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Summary cards */
.goals-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.goals-summary-card {
    text-align: center;
    padding: 16px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.goals-summary-value {
    font-size: 28px;
    font-weight: 700;
    color: #8b5cf6;
}
.goals-summary-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tier tabs */
.goals-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
}
.goals-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.goals-tab:hover {
    color: var(--text);
}
.goals-tab.active {
    color: #8b5cf6;
    border-bottom-color: #8b5cf6;
}

/* Goal rows */
.goals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.goal-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr auto;
    gap: 20px;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s;
}
.goal-row:hover {
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.06);
}
.goal-row-complete {
    background: rgba(34, 197, 94, 0.03);
    border-color: rgba(34, 197, 94, 0.2);
}
.goal-row-complete:hover {
    border-color: rgba(34, 197, 94, 0.4);
}

.goal-row-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.goal-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.goal-row-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.goal-tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.goal-tier-daily { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }
.goal-tier-weekly { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.goal-tier-monthly { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }

.goal-tracking-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.goal-tracking-badge.manual { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }
.goal-tracking-badge.auto { background: rgba(34, 197, 94, 0.1); color: #16a34a; }

.goal-row-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}
.goal-streak-badge {
    font-size: 12px;
    color: #f59e0b;
    font-weight: 600;
}
.goal-completions-badge {
    font-size: 12px;
    color: var(--text-muted);
}

.goal-row-middle {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.goal-progress-large {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.goal-progress-bar-large {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a855f7);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.goal-progress-bar-large.complete {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}
.goal-progress-text {
    font-size: 12px;
    color: var(--text-muted);
}

.goal-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.btn-icon-action {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-icon-action:hover {
    background: rgba(139, 92, 246, 0.08);
    color: #8b5cf6;
    border-color: rgba(139, 92, 246, 0.3);
}
.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Goals empty state */
.goals-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.goals-empty p {
    font-size: 18px;
    font-weight: 600;
    margin-top: 12px;
}
.goals-empty-sub {
    font-size: 14px !important;
    font-weight: 400 !important;
    color: var(--text-muted);
}

/* Goals page mobile */
@media (max-width: 768px) {
    .goals-summary-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .goals-summary-card { padding: 12px 8px; }
    .goals-summary-value { font-size: 22px; }

    .goals-tabs { overflow-x: auto; }
    .goals-tab { padding: 8px 14px; font-size: 13px; white-space: nowrap; }

    .goal-row {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px 16px;
    }
    .goal-row-actions {
        justify-content: flex-start;
    }

    /* Focus widget mobile */
    .dash-card-focus .dash-card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .focus-badge {
        font-size: 11px;
        padding: 3px 10px;
    }

    /* Timeline mobile: compact but readable */
    .focus-timeline {
        margin-bottom: 14px;
        padding-bottom: 18px;
    }
    .focus-timeline-bar {
        height: 10px;
    }
    .focus-timeline-now {
        height: 18px;
        top: -4px;
    }
    .focus-timeline-now::before {
        width: 8px;
        height: 8px;
        left: -2.5px;
        top: -3px;
    }
    .focus-timeline-labels span {
        font-size: 9px;
    }

    /* Stats: horizontal row with equal columns */
    .focus-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .focus-stat {
        padding: 10px 6px;
    }
    .focus-stat-value {
        font-size: 18px;
    }
    .focus-stat-label {
        font-size: 10px;
    }
}
