@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #22252f;
    --bg-hover: #2a2d37;
    --bg-input: #1a1d27;
    --border: #2a2d37;
    --border-focus: #f59e0b;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-inverse: #111827;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-soft: rgba(245, 158, 11, 0.12);
    --accent-text: #fbbf24;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --cat-business: #f59e0b;
    --cat-boats: #3b82f6;
    --cat-team: #10b981;
    --cat-personal: #8b5cf6;
    --cat-ideas: #ec4899;
    --cat-financial: #059669;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.15);
    --shadow-xl: 0 16px 40px rgba(0,0,0,0.35), 0 4px 8px rgba(0,0,0,0.15);
    --sidebar-width: 240px;
    --tab-bar-height: 64px;
    --header-height: 60px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

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

h1, h2, h3, h4 {
    font-family: 'Lexend', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; font-weight: 500; }
h3 { font-size: 1.125rem; font-weight: 500; }

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-size: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

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

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== Layout ========== */

.app-layout {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--header-height);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.page-body {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.view-container {
    display: none;
    animation: fadeIn 0.25s ease;
}

.view-container.active {
    display: block;
}

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

/* ========== Sidebar ========== */

.nav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 20px;
}

.sidebar-brand h1 {
    font-size: 1.375rem;
    color: var(--text-primary);
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.nav-link .material-symbols-outlined {
    font-size: 22px;
}

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

.sidebar-footer .nav-link {
    color: var(--text-muted);
}

/* ========== Mobile Tab Bar ========== */

.tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-bar-inner {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: space-around;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 16px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.15s;
    position: relative;
    min-width: 64px;
}

.tab-item .material-symbols-outlined {
    font-size: 24px;
    transition: color 0.15s;
}

.tab-item.active {
    color: var(--accent-text);
}

.tab-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
}

/* ========== Search Bar ========== */

.search-bar {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-bar .material-symbols-outlined {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-bar input {
    width: 100%;
    padding: 8px 14px 8px 40px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    height: 40px;
}

.search-bar input:focus {
    background: var(--bg-card);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}

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

/* ========== Page Title ========== */

.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title-row h2 {
    font-size: 1.5rem;
}

/* ========== Category Pills ========== */

.pill-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pill-row::-webkit-scrollbar { display: none; }

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

.category-pill:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.category-pill.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-text);
}

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

/* ========== Note Cards ========== */

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

.note-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--cat-business);
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
    position: relative;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--bg-hover);
}

.note-card:active {
    transform: translateY(0);
}

.note-card[data-category="boats"] { border-left-color: var(--cat-boats); }
.note-card[data-category="team"] { border-left-color: var(--cat-team); }
.note-card[data-category="personal"] { border-left-color: var(--cat-personal); }
.note-card[data-category="ideas"] { border-left-color: var(--cat-ideas); }
.note-card[data-category="financial"] { border-left-color: var(--cat-financial); }
.note-card[data-category="business"] { border-left-color: var(--cat-business); }

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

.note-card-title {
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.pin-badge {
    color: var(--accent);
    font-size: 18px;
    flex-shrink: 0;
    margin-left: 8px;
}

.note-card-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.note-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========== Full-Page Note Editor ========== */

.note-editor-fullpage {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    animation: editorSlideIn 0.25s ease;
}

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

.note-editor-fullpage.closing {
    animation: editorSlideOut 0.2s ease forwards;
}

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

.editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.editor-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: all 0.15s;
}

.editor-back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.note-editor-title {
    border: none;
    background: transparent;
    font-family: 'Lexend', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    padding: 0 0 16px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    width: 100%;
}

.note-editor-title:focus {
    box-shadow: none;
    border-color: transparent;
}

.note-editor-body {
    border: none;
    background: transparent;
    resize: none;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
    min-height: 60vh;
    padding: 0;
    width: 100%;
}

.note-editor-body:focus {
    box-shadow: none;
    border-color: transparent;
}

.editor-bottombar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.editor-bottombar .pill-row {
    margin-bottom: 0;
    flex: 1;
}

.editor-bottombar .category-pill {
    font-size: 0.75rem;
    padding: 4px 10px;
}

.ai-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--accent-text);
    margin-left: auto;
}

.ai-indicator .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--accent-soft);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 768px) {
    .editor-content {
        padding: 20px 16px;
    }

    .note-editor-title {
        font-size: 1.25rem;
    }

    .editor-topbar {
        padding: 10px 16px;
    }

    .editor-bottombar {
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

/* ========== Task List ========== */

.task-filters {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.task-filter-btn {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.task-filter-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.task-filter-btn.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-text);
}

.task-group {
    margin-bottom: 24px;
}

.task-group-title {
    font-family: 'Lexend', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.task-group-title.overdue {
    color: var(--danger);
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 6px;
    transition: all 0.15s;
    cursor: pointer;
}

.task-item:hover {
    background: var(--bg-hover);
}

.task-item.overdue {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
}

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

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

.task-checkbox {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.task-checkbox input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
    margin: 0;
    padding: 0;
}

.task-checkbox .check-visual {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: transparent;
    font-size: 16px;
}

.task-checkbox input:checked + .check-visual {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
    animation: checkBounce 0.35s ease;
}

@keyframes checkBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.25); }
    50% { transform: scale(0.9); }
    70% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

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

.task-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.priority-dot.high { background: var(--danger); }
.priority-dot.medium { background: var(--warning); }
.priority-dot.low { background: var(--text-muted); }

.task-category {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

/* ========== Calendar ========== */

.calendar-container {
    max-width: 720px;
    margin: 0 auto;
}

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

.calendar-header h2 {
    font-size: 1.25rem;
    min-width: 180px;
    text-align: center;
}

.calendar-nav-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.calendar-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 8px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    padding: 4px;
    min-height: 56px;
}

.calendar-day:hover {
    background: var(--bg-hover);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    background: var(--accent-soft);
}

.calendar-day.today .day-number {
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.calendar-day.selected {
    background: var(--bg-card);
    border: 1px solid var(--accent);
}

.day-number {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.day-dots {
    display: flex;
    gap: 3px;
    height: 6px;
}

.day-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.day-dot.business { background: var(--cat-business); }
.day-dot.boats { background: var(--cat-boats); }
.day-dot.team { background: var(--cat-team); }
.day-dot.personal { background: var(--cat-personal); }
.day-dot.ideas { background: var(--cat-ideas); }
.day-dot.financial { background: var(--cat-financial); }

.day-overflow {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 600;
}

.calendar-day-detail {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.calendar-day-detail h3 {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    padding: 3px;
    border: 1px solid var(--border);
}

.view-toggle button {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.15s;
}

.view-toggle button.active {
    background: var(--accent);
    color: var(--text-inverse);
}

/* ========== FAB ========== */

.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 45;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.fab:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.fab:active {
    transform: scale(0.95);
}

.fab .material-symbols-outlined {
    font-size: 28px;
}

.fab.pulse {
    animation: fabPulse 2s ease-in-out 3;
}

@keyframes fabPulse {
    0%, 100% { box-shadow: var(--shadow-lg); }
    50% { box-shadow: 0 0 0 12px rgba(245, 158, 11, 0.15), var(--shadow-lg); }
}

/* ========== Modal ========== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

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

.modal-panel {
    position: fixed;
    z-index: 101;
    background: var(--bg-secondary);
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Desktop: slide from right */
.modal-panel.side {
    top: 0;
    right: 0;
    width: 480px;
    max-width: 100%;
    height: 100%;
    border-left: 1px solid var(--border);
    transform: translateX(100%);
}

.modal-overlay.open .modal-panel.side {
    transform: translateX(0);
}

/* Mobile: slide from bottom */
.modal-panel.bottom {
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
}

.modal-overlay.open .modal-panel.bottom {
    transform: translateY(0);
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 0;
    display: none;
}

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

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-body {
    padding: 20px 24px;
}

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

/* ========== Buttons ========== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
}

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

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

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

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

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-ghost {
    color: var(--text-secondary);
    padding: 8px 12px;
}

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

/* ========== Form Fields ========== */

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

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

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

.form-row > * {
    flex: 1;
}

.select-wrap {
    position: relative;
}

.select-wrap select {
    width: 100%;
    appearance: none;
    padding-right: 36px;
}

.select-wrap::after {
    content: 'expand_more';
    font-family: 'Material Symbols Outlined';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 20px;
}

/* ========== Empty State ========== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state .material-symbols-outlined {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.95rem;
    max-width: 280px;
    line-height: 1.5;
}

/* ========== Toast ========== */

.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    pointer-events: auto;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    min-width: 240px;
}

.toast.success { border-color: var(--success); }
.toast.success .material-symbols-outlined { color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.error .material-symbols-outlined { color: var(--danger); }

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

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

/* ========== Skeleton Loading ========== */

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

.skeleton-card {
    height: 140px;
    border-radius: var(--radius-lg);
}

.skeleton-task {
    height: 52px;
    margin-bottom: 6px;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-line.short { width: 60%; }

/* ========== Pin Toggle ========== */

.pin-toggle {
    color: var(--text-muted);
    transition: color 0.15s;
    padding: 4px;
}

.pin-toggle:hover, .pin-toggle.pinned {
    color: var(--accent);
}

/* ========== Reminder Options ========== */

.reminder-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.reminder-chip {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.reminder-chip:hover {
    background: var(--bg-hover);
}

.reminder-chip.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-text);
}

/* ========== Login Page ========== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-primary);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: 40px 32px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: loginFadeIn 0.5s ease;
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-icon {
    width: 64px;
    height: 64px;
    background: var(--accent);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--text-inverse);
}

.login-icon .material-symbols-outlined {
    font-size: 36px;
}

.login-card h1 {
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.login-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.pin-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 28px;
}

.pin-digit {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    font-family: 'Lexend', sans-serif;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 2px solid var(--border);
    color: var(--text-primary);
    caret-color: var(--accent);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pin-digit:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--text-inverse);
    transition: background 0.2s;
}

.login-btn:hover {
    background: var(--accent-hover);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Responsive ========== */

@media (max-width: 768px) {
    .nav-sidebar {
        display: none;
    }

    .tab-bar {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom));
    }

    .page-header {
        padding: 12px 16px;
    }

    .page-body {
        padding: 16px;
    }

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

    .fab {
        bottom: calc(var(--tab-bar-height) + 16px + env(safe-area-inset-bottom));
    }

    .modal-panel.side {
        display: none;
    }

    .modal-panel.bottom {
        display: block;
    }

    .modal-handle {
        display: block;
    }

    .toast-container {
        bottom: calc(var(--tab-bar-height) + 16px + env(safe-area-inset-bottom));
    }

    .calendar-day {
        min-height: 44px;
    }

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

    .page-title-row h2 {
        font-size: 1.25rem;
    }

    .search-bar {
        max-width: none;
    }

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

@media (min-width: 769px) {
    .modal-panel.bottom {
        display: none;
    }

    .modal-panel.side {
        display: block;
    }
}

/* ========== Utility ========== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.d-flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
