/* ZenJournal — Stylesheet */

html { min-width: 350px; }

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161922;
    --bg-card: #1c1f2e;
    --bg-card-hover: #242738;
    --text-primary: #e4e4e7;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #60a5fa;
    --accent-dim: rgba(96, 165, 250, 0.15);
    --border: #2a2d3a;
    --radius: 8px;
    --sidebar-width: 320px;
    --header-height: 56px;
    --toolbar-height: 44px;
    --indent-unit: 24px;
    --editor-max-width: 820px;
    --font-size-base: 14px;
    --font-family-base: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;

    --tag-todo: #f59e0b;
    --tag-todo-dim: rgba(245, 158, 11, 0.15);
    --tag-idea: #8b5cf6;
    --tag-idea-dim: rgba(139, 92, 246, 0.15);
    --tag-question: #a855f7;
    --tag-question-dim: rgba(168, 85, 247, 0.15);
    --tag-rule: #ef4444;
    --tag-rule-dim: rgba(239, 68, 68, 0.15);
    --tag-setup: #22c55e;
    --tag-setup-dim: rgba(34, 197, 94, 0.15);

    --highlight-yellow: #fde047;
    --highlight-green: #86efac;
    --highlight-blue: #93c5fd;
    --highlight-pink: #f9a8d4;
    --highlight-orange: #fdba74;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f5;
    --text-primary: #1a1a2e;
    --text-secondary: #555570;
    --text-muted: #888;
    --accent: #3b82f6;
    --accent-dim: rgba(59, 130, 246, 0.12);
    --border: #e0e0e8;
    --tag-todo: #d97706;
    --tag-idea: #7c3aed;
    --tag-question: #9333ea;
    --tag-rule: #dc2626;
    --tag-setup: #16a34a;
    color-scheme: light;
}

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

html, body {
    overflow: hidden;
    height: 100vh;
}

body {
    font-family: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Header ===== */

.header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 100;
    gap: 8px;
}

.logo { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; white-space: nowrap; font-family: inherit; flex-shrink: 0; margin-right: 8px; }
.logo-zen { color: #555555; }
.logo-plan { color: #ffffff; }
[data-theme="light"] .logo-zen { color: #bbbbbb; }
[data-theme="light"] .logo-plan { color: #333333; }

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

.sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 10px;
    gap: 6px;
}
.sidebar-toggle:hover { background: var(--bg-card); color: var(--text-primary); }
.sidebar-toggle.active { background: color-mix(in srgb, var(--accent-dim) 50%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); color: color-mix(in srgb, var(--accent) 60%, var(--text-secondary)); }
.sidebar-toggle-icon { flex-shrink: 0; }
.sidebar-toggle-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ===== Journal Navigation ===== */

.journal-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-right: 4px;
}
.journal-nav-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 28px; height: 36px;
    border-radius: var(--radius);
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    line-height: 1;
}
.journal-nav-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.journal-nav-btn:disabled { opacity: 0.3; cursor: default; }
.journal-nav-btn:disabled:hover { background: none; color: var(--text-secondary); }

/* ===== Journal Selector ===== */

.journal-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.journal-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: none;
    background: none;
    cursor: grab;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    border-radius: 4px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, background 0.15s;
}
.journal-tab:active { cursor: grabbing; }
.journal-tab:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.journal-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}
.journal-tab.dragging { opacity: 0.25; }

.journal-tab-ghost {
    position: fixed;
    pointer-events: none;
    opacity: 0.9;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.journal-tab-drop-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--accent);
    border-radius: 1px;
    pointer-events: none;
    z-index: 50;
}
.journal-tab-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.journal-tab.active .journal-tab-dot {
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 3px currentColor;
}
/* Overflow "more" button — always visible */

/* Overflow "more" dropdown */
.journal-tabs-more-wrap {
    position: relative;
    flex-shrink: 0;
}
.journal-tab-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: 1px solid var(--border);
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    border-radius: 4px;
}
.journal-tab-more:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.journal-tabs-overflow {
    display: none;
    position: fixed;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 200;
    min-width: 160px;
    padding: 4px 0;
}
.journal-tabs-overflow.open { display: block; }

.journal-overflow-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    text-align: left;
}
.journal-overflow-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.journal-overflow-item.active { color: var(--text-primary); }

.journal-overflow-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}


.header-center {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 32px; height: 32px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-btn:hover { background: var(--bg-card-hover); }

.today-btn { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; }

.date-display {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.date-display:hover { background: var(--bg-card-hover); }

.header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    position: relative;
}

/* ===== Header Hamburger Menu ===== */

.header-menu-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.header-menu-toggle:hover { background: var(--bg-card); color: var(--text-primary); }

.header-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 300;
    min-width: 180px;
    padding: 4px;
}
.header-menu-dropdown.open { display: flex; flex-direction: column; }

.header-menu-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.header-menu-item:hover { background: var(--bg-card); color: var(--text-primary); }

.search-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}
.search-btn:hover { background: var(--bg-card); color: var(--text-primary); }

.search-popup {
    display: none;
    position: fixed;
    top: var(--header-height);
    right: 16px;
    z-index: 200;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    flex-direction: column;
    width: 420px;
    max-height: calc(100vh - var(--header-height) - 20px);
}
.search-popup.open { display: flex; }

.search-popup-input-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    flex-shrink: 0;
}

.search-popup .search-results {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    border-top: 1px solid var(--border);
    padding: 8px;
}
.search-popup .search-results:empty { display: none; }

.search-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}
.search-close-btn:hover { color: var(--text-primary); }

.header-search {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    flex: 1;
    min-width: 0;
    outline: none;
    font-family: inherit;
}
.header-search::placeholder { color: var(--text-muted); }
.header-search:focus { border-color: var(--accent); }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-card); }

/* ===== Theme Popup ===== */

.theme-popup {
    display: none;
    position: fixed;
    top: var(--header-height);
    right: 16px;
    z-index: 200;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 14px 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    width: fit-content;
}
.theme-popup.open { display: block; }

.theme-popup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.accent-swatches { display: flex; flex-direction: column; gap: 8px; }
.swatch-row { display: flex; gap: 8px; align-items: center; }
.theme-popup-row.color-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}
.theme-popup-row + .theme-popup-row {
    margin-top: 12px;
}

.theme-popup-label {
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}



/* Accent swatches */
.accent-swatch {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s;
}
.accent-swatch:hover { transform: scale(1.2); }
.accent-swatch.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-secondary);
}

/* Font size controls */
.font-size-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
.font-size-btn {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}
.font-size-btn:hover { background: var(--bg-card-hover); }
.font-size-value {
    font-size: 13px;
    color: var(--text-primary);
    min-width: 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Font family selector */
.font-selector {
    display: flex;
    gap: 6px;
}
.font-option {
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.1s, color 0.1s;
}
.font-option:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.font-option.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
.font-option[data-font="mono"] { font-family: ui-monospace, Menlo, monospace; }
.font-option[data-font="sans"] { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.font-option[data-font="serif"] { font-family: Georgia, 'Times New Roman', serif; }

.new-window-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}
.new-window-btn:hover { background: var(--bg-card); }

/* ===== Sidebar Mobile Actions ===== */

.debug-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.debug-toggle:hover { background: var(--bg-card); }
.debug-info {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--bg-main);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.debug-actions {
    display: flex;
    gap: 8px;
}
.debug-actions .modal-btn {
    flex: 1;
}

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

.calendar-dropdown {
    display: none;
    position: absolute;
    top: 42px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    z-index: 200;
    width: 280px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.calendar-dropdown.open { display: block; }

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.cal-nav button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 28px; height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}
.cal-nav button:hover { background: var(--bg-card-hover); }
.cal-month-label { font-size: 13px; font-weight: 600; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
}
.cal-dow {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
    text-transform: uppercase;
}
.cal-day {
    font-size: 12px;
    padding: 6px 0;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}
.cal-day:hover { background: var(--bg-card-hover); }
.cal-day.today { border: 2px solid var(--accent); font-weight: 700; }
.cal-day.selected { background: var(--accent); color: #fff; }
.cal-day.has-entry::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--accent);
}
.cal-day.other-month { color: var(--text-muted); opacity: 0.4; }
.cal-day.empty { cursor: default; }

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

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 90;
    transition: transform 0.2s ease;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.sidebar-tab {
    flex: 1 1 auto;
    min-width: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px 4px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s;
    text-align: center;
    white-space: nowrap;
}
.sidebar-tab:hover { color: var(--text-primary); }
.sidebar-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.tab-badge {
    font-size: 10px;
    background: var(--bg-card);
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 600;
}

.sidebar-filter {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.sidebar-search {
    width: 100%;
    min-width: 0;
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}
.sidebar-search::placeholder { color: var(--text-muted); }
.sidebar-search:focus { border-color: var(--accent); }

.sidebar-filter-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 3px 5px;
    transition: all 0.15s;
    white-space: nowrap;
}
.sidebar-filter-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.sidebar-filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.sidebar-search-btn { flex-shrink: 0; }

.star-icon {
    color: #f5a623;
    font-size: 13px;
    line-height: 1;
    vertical-align: -1px;
}

.sidebar-search-row {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    user-select: none;
    -webkit-user-select: none;
}

.sidebar-item {
    padding: 8px 24px 8px 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.1s;
    position: relative;
}
.sidebar-item:hover { background: var(--bg-card-hover); }

/* Drag-to-reorder styles */
.sidebar-list.custom-sort .sidebar-item { cursor: grab; }
.sidebar-list.custom-sort .sidebar-item:active { cursor: grabbing; }
.sidebar-item.dragging { opacity: 0.25; }

.sidebar-drag-ghost {
    position: fixed;
    pointer-events: none;
    opacity: 0.9;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-primary);
    max-width: 260px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sidebar-drop-indicator {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
    pointer-events: none;
    z-index: 50;
}

/* Unified separator line */
.sidebar-separator-line {
    display: flex;
    align-items: center;
    padding: 4px 8px 4px 4px;
    cursor: grab;
    gap: 0;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}
.sidebar-separator-line:active { cursor: grabbing; }

.sidebar-separator-line .sep-drag-handle {
    font-size: 11px;
    color: transparent;
    cursor: grab;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}
.sidebar-separator-line:hover .sep-drag-handle {
    color: var(--text-muted);
}
.sidebar-separator-line .sep-drag-handle:active { cursor: grabbing; }

.sidebar-separator-line .sep-line-left,
.sidebar-separator-line .sep-line-right {
    flex: 1;
    height: 2px;
    background: var(--line-color, var(--accent));
    border-radius: 1px;
}
.sidebar-separator-line .sep-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--line-color, var(--accent));
    white-space: nowrap;
    padding: 0 6px;
    flex-shrink: 0;
}
/* When label is empty, single line fills */
.sidebar-separator-line .sep-label:empty { padding: 0; }
.sidebar-separator-line .sep-label:empty + .sep-line-right { display: none; }

.sidebar-separator-line .sep-edit-icon {
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
    padding: 0 0 0 4px;
    line-height: 1;
}
.sidebar-separator-line:hover .sep-edit-icon {
    opacity: 0.6;
}
.sidebar-separator-line .sep-edit-icon:hover {
    opacity: 1;
}
.sidebar-separator-line.dragging { opacity: 0.25; }

/* Items above planning line get accent border */
.sidebar-item.above-planning-line { border-left-color: var(--accent); }

/* Line editor popover */
.line-editor-popover {
    position: absolute;
    z-index: 100;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.line-editor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.line-editor-row:last-child { margin-bottom: 0; }
.line-editor-row label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 40px;
    flex-shrink: 0;
}
.line-editor-name {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}
.line-editor-name:focus {
    border-color: var(--accent);
}
.line-editor-colors {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}
.line-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.1s;
}
.line-color-swatch:hover { transform: scale(1.15); }
.line-color-swatch.active {
    border-color: var(--text-primary);
}

.sidebar-item-text {
    font-size: var(--font-size-base);
    font-family: var(--font-family-base);
    line-height: 1.4;
    color: var(--text-primary);
    overflow: hidden;
    display: flex;
    align-items: flex-start;
}
.sidebar-item-text > :not(.sidebar-item-check) {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sidebar-item-text.completed {
    text-decoration: line-through;
    opacity: 0.5;
}
.tag-todo > .sidebar-item-text { font-weight: 600; }
.sidebar-item:has(.sidebar-item-star.starred) { background: rgba(253, 224, 71, 0.12); }
[data-theme="light"] .sidebar-item:has(.sidebar-item-star.starred) { background: rgba(202, 170, 0, 0.1); }

.sidebar-item-date {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sidebar-item-note-preview {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    margin-left: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item-due-date {
    font-size: 10px;
    color: #e57373;
    margin-top: 2px;
    margin-left: 24px;
}
.sidebar-item-due-date.overdue {
    color: #ef4444;
    font-weight: 600;
}
[data-theme="light"] .sidebar-item-due-date { color: #c62828; }
[data-theme="light"] .sidebar-item-due-date.overdue { color: #b71c1c; }

.sidebar-item.tag-todo { border-left-color: transparent; }
.sidebar-item.tag-idea { border-left-color: transparent; }
.sidebar-item.tag-question { border-left-color: transparent; }

/* Hashtag list */
.sidebar-hashtag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
}
.sidebar-hashtag:hover { background: var(--bg-hover); }
.sidebar-hashtag.expanded { background: var(--bg-card); }
.hashtag-name { flex: 1; }
.hashtag-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}
.hashtag-items { padding-left: 8px; border-left: 2px solid var(--accent-dim); margin-left: 10px; }
.hashtag-items .sidebar-item { border-left: none; }

.sidebar-item-check {
    display: inline-block;
    width: 14px; height: 14px;
    min-width: 14px;
    border: 2px solid var(--tag-todo);
    border-radius: 3px;
    margin-right: 6px;
    margin-top: 1px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
.sidebar-item-check.checked {
    background: var(--tag-todo);
}
.sidebar-item-check.checked::after {
    content: '\2713';
    position: absolute;
    top: -2px; left: 1px;
    font-size: 11px;
    color: #000;
    font-weight: 700;
}

/* Add-task input row */
.sidebar-add-task-row {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-add-task {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    font-family: inherit;
}
.sidebar-add-task::placeholder { color: var(--text-muted); }
.sidebar-add-task:focus { border-color: var(--accent); }

/* Standalone task delete button */
.sidebar-item-delete {
    display: none;
    position: absolute;
    right: 8px;
    top: 8px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 3px;
}
.sidebar-item-delete:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}
.sidebar-item.standalone-task:hover .sidebar-item-delete {
    display: block;
}

.sidebar-item-star {
    position: absolute;
    right: 22px;
    top: 8px;
    font-size: 16px;
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.1s;
}
.sidebar-item:hover .sidebar-item-star { opacity: 1; }
.sidebar-item-star.starred {
    color: #f5c542;
    opacity: 1;
}
.sidebar-item-star:hover {
    color: var(--text-secondary);
}
.sidebar-item-star.starred:hover {
    color: #f5c542;
}

.sidebar-item-jump {
    position: absolute;
    top: 11px;
    right: 6px;
    font-size: 16px;
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.1s;
}
.sidebar-item:hover .sidebar-item-jump { opacity: 1; }
.sidebar-item-jump:hover { color: var(--accent); }

/* Inline edit input for standalone tasks */
.sidebar-inline-edit {
    width: calc(100% - 24px);
    padding: 2px 4px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    outline: none;
}

.sidebar-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== Main Content ===== */

.main {
    position: fixed;
    left: var(--sidebar-width);
    right: 0;
    top: var(--header-height);
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: left 0.2s ease;
}
body.sidebar-resizing .main { transition: none; }

/* Sidebar resize handle */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 100;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: var(--accent);
    opacity: 0.4;
}
body.sidebar-resizing { cursor: col-resize; user-select: none; }
body.sidebar-resizing .sidebar { transition: none; }

/* Sidebar collapsed state */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main { left: 0; }

/* Notes collapsed — sidebar goes full width */
body.notes-collapsed .sidebar { width: 100%; }
body.notes-collapsed .main { display: none; }

/* ===== Editor Toolbar ===== */

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Page Tabs Bar */
.page-tabs-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.page-tabs {
    display: flex;
    gap: 2px;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}
.page-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    background: none;
    cursor: grab;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    border-radius: 4px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
}
.page-tab:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.page-tab:active { cursor: grabbing; }
.page-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.page-tab.dragging { opacity: 0.25; }
.page-tab-icon { font-size: 12px; }
.page-tab-label { }

.page-tab-ghost {
    position: fixed;
    pointer-events: none;
    opacity: 0.9;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.page-tab-drop-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--accent);
    border-radius: 1px;
    pointer-events: none;
    z-index: 50;
}

/* Page & Notebook Context Menus */
.page-context-menu,
.notebook-context-menu {
    position: fixed;
    z-index: 10000;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    min-width: 140px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.page-context-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 5px;
    text-align: left;
}
.page-context-item:hover { background: var(--bg-card-hover); }
.page-context-item.danger { color: #ef4444; }
.page-context-item.danger:hover { background: rgba(239,68,68,0.12); }
.page-context-item svg { flex-shrink: 0; }

/* Page Delete Confirmation */
.page-delete-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}
.page-delete-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.page-delete-dialog h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: var(--text-primary);
}
.page-delete-dialog p {
    margin: 0 0 20px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}
.page-delete-dialog strong {
    color: var(--text-primary);
}
.page-delete-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.page-delete-cancel, .page-delete-confirm {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
}
.page-delete-cancel {
    background: var(--bg-card);
    color: var(--text-primary);
}
.page-delete-cancel:hover { background: var(--bg-card-hover); }
.page-delete-confirm {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}
.page-delete-confirm:hover { background: #dc2626; }

.page-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-muted);
    border-radius: 4px;
    flex-shrink: 0;
    font-family: inherit;
}
.page-add-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.page-add-btn.has-label { width: auto; font-size: 11px; font-weight: 600; padding: 0 10px; white-space: nowrap; }

/* Notebook "home" tab in page tabs bar */
.page-tabs-notebook-label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    font-family: inherit;
    border-radius: 4px 4px 0 0;
    flex-shrink: 0;
    margin-right: 2px;
    transition: color 0.15s, background 0.15s;
}
.page-tabs-notebook-label:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.page-tabs-notebook-label.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.page-tabs-notebook-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* Page tabs overflow dropdown */
.page-tabs-more-wrap {
    position: relative;
    flex-shrink: 0;
}
.page-tab-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border: 1px solid var(--border);
    background: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    border-radius: 4px;
    font-family: inherit;
}
.page-tab-more:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.page-tabs-overflow {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 200;
    min-width: 160px;
    padding: 4px 0;
}
.page-tabs-overflow.open { display: block; }
.page-overflow-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    text-align: left;
}
.page-overflow-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.page-overflow-item.active { color: var(--text-primary); }

/* Inline page rename */
.notebook-title-text.editing {
    outline: none;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 2px;
    caret-color: var(--accent);
}

/* Page type popup */
.page-type-popup {
    position: fixed;
    z-index: 300;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    padding: 4px;
    min-width: 180px;
}
.page-type-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    text-align: left;
    color: var(--text-primary);
    font-family: inherit;
}
.page-type-option:hover { background: var(--bg-card-hover); }
.page-type-icon { font-size: 18px; flex-shrink: 0; }
.page-type-label { font-size: 13px; font-weight: 600; }
.page-type-desc { font-size: 11px; color: var(--text-muted); margin-left: auto; }

.toolbar-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    line-height: 1.4;
}
.toolbar-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.toolbar-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.toolbar-btn[data-action="tag-todo"].active { background: var(--tag-todo-dim); color: var(--tag-todo); border-color: var(--tag-todo); }
.toolbar-btn[data-action="tag-idea"].active { background: var(--tag-idea-dim); color: var(--tag-idea); border-color: var(--tag-idea); }
.toolbar-btn[data-action="tag-question"].active { background: var(--tag-question-dim); color: var(--tag-question); border-color: var(--tag-question); }
.toolbar-btn[data-action="star"] { font-size: 18px; line-height: 1; padding: 2px 8px; }
.toolbar-btn[data-action="star"].active { color: #fde047; }
.toolbar-btn[data-action="image"] { font-size: 18px; line-height: 1; padding: 2px 8px; }
.toolbar-btn[data-action="indent"],
.toolbar-btn[data-action="outdent"] { padding: 2px 6px; display: inline-flex; align-items: center; }

.highlight-icon {
    background: var(--highlight-yellow);
    color: #000;
    padding: 0 3px;
    border-radius: 2px;
    font-weight: 700;
}

.toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.highlight-colors {
    display: flex;
    gap: 4px;
    margin-left: 4px;
}

.color-swatch {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--text-primary); }
.color-swatch-none { background: #1a1a2e !important; border: 2px solid var(--border) !important; }
[data-theme="light"] .color-swatch-none { background: #fff !important; }

.toolbar-edit-journal {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    flex-shrink: 0;
}
[data-theme="light"] .block-star { color: #b8860b; }
[data-theme="light"] .block.starred .bullet-dot { background: #b8860b; }
[data-theme="light"] .sidebar-item-star.starred { color: #b8860b; }
[data-theme="light"] .sidebar-item-star.starred:hover { color: #b8860b; }

/* ===== Block Editor ===== */

.editor-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 100px 24px;
}

.editor-inner {
    max-width: var(--editor-max-width);
    margin: 0 auto;
}

.block {
    display: flex;
    align-items: flex-start;
    gap: 0;
    min-height: 28px;
    position: relative;
}

.block[data-indent="0"] { margin-left: 0; }
.block[data-indent="1"] { margin-left: var(--indent-unit); }
.block[data-indent="2"] { margin-left: calc(var(--indent-unit) * 2); }
.block[data-indent="3"] { margin-left: calc(var(--indent-unit) * 3); }
.block[data-indent="4"] { margin-left: calc(var(--indent-unit) * 4); }
.block[data-indent="5"] { margin-left: calc(var(--indent-unit) * 5); }

.block-bullet {
    flex-shrink: 0;
    width: 20px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 8px;
    user-select: none;
    margin-right: 2px;
}

.bullet-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
}

.block.tag-todo .bullet-dot { background: var(--tag-todo); }
.block.tag-idea .bullet-dot { background: var(--tag-idea); }
.block.tag-question .bullet-dot { background: var(--tag-question); }
.block.starred .bullet-dot { background: #fde047; }

.block-content {
    flex: 1;
    min-height: 28px;
    padding: 4px 4px;
    outline: none;
    font-size: var(--font-size-base);
    font-family: var(--font-family-base);
    line-height: 1.5;
    word-break: break-word;
    border-radius: 3px;
}
.block-content:focus { background: var(--bg-card); }
.block-content b, .block-content strong {
    font-weight: 900;
    color: #fff;
}
[data-theme="light"] .block-content b,
[data-theme="light"] .block-content strong {
    color: #111;
}
.block-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
    cursor: pointer;
}
.block-content a:hover {
    color: var(--accent);
    opacity: 0.8;
}
.block.selected { background: var(--accent-dim); border-radius: 4px; }

.block.sidebar-jump-highlight {
    animation: jumpFlash 2s ease-out;
    border-radius: 4px;
}
@keyframes jumpFlash {
    0%   { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
    30%  { background: var(--accent-dim); box-shadow: 0 0 4px var(--accent); }
    100% { background: transparent; box-shadow: none; }
}
.block-content:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.block-meta {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 28px;
    white-space: nowrap;
    padding-left: 6px;
    flex-shrink: 0;
}

.block-tag {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.block-tag.tag-todo { background: var(--tag-todo-dim); color: var(--tag-todo); }
.block-tag.tag-idea { background: var(--tag-idea-dim); color: var(--tag-idea); }
.block-tag.tag-question { background: var(--tag-question-dim); color: var(--tag-question); }

.block-star {
    color: #fde047;
    font-size: 16px;
    line-height: 1;
}
.block-star-bullet {
    color: #f5a623;
    font-size: 15px;
}
.block-tag.tag-star {
    background: rgba(245, 166, 35, 0.15);
    color: #f5a623;
}

.block-todo-check {
    width: 16px; height: 16px;
    border: 2px solid var(--tag-todo);
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    color: transparent;
    margin-right: 2px;
    margin-top: 6px; /* vertically center within 28px line height */
}
.block-todo-check.checked {
    background: var(--tag-todo);
    color: #000;
}

.block.todo-complete .block-content {
    text-decoration: line-through;
    opacity: 0.5;
}

/* Block images */
.block-images {
    padding-left: 24px;
}
.block-image-wrap {
    position: relative;
    display: inline-block;
    margin: 4px 8px 8px 0;
}
.block-image-wrap img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
    cursor: pointer;
}
.block-image-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
}
.block-image-wrap:hover .block-image-delete {
    opacity: 1;
}
.block-image-delete:hover {
    background: rgba(220,38,38,0.85);
}
.block-image-missing {
    width: 120px;
    height: 80px;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 11px;
}
.block-image-missing::before { content: 'Image unavailable'; }

/* Block artifacts */
.block-artifact {
    padding-left: 24px;
    margin: 2px 0 6px;
}
.artifact-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}
.artifact-preview:hover {
    background: var(--bg-card);
}
.artifact-icon {
    font-size: 11px;
    color: var(--accent);
    flex-shrink: 0;
    opacity: 0.7;
}
.artifact-snippet {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.artifact-toggle {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.block-artifact:not(.collapsed) .artifact-toggle {
    transform: rotate(90deg);
}
.artifact-expanded {
    position: relative;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow: hidden;
}
.artifact-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}
.artifact-expanded:hover .artifact-actions {
    opacity: 1;
}
.artifact-edit,
.artifact-delete {
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-secondary);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
}
.artifact-edit:hover {
    color: var(--accent);
    background: rgba(0, 0, 0, 0.7);
}
.artifact-delete:hover {
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
}
.artifact-text {
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
    font-family: inherit;
}
.artifact-indicator {
    font-size: 10px;
    opacity: 0.45;
    margin-left: 4px;
    color: var(--accent);
}
.modal.artifact-modal-wide {
    width: 95vw;
    max-width: 1100px;
}
.artifact-modal-textarea {
    min-height: 450px;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre;
    tab-size: 4;
}

/* File Attachments */
.block-attachments {
    padding-left: 24px;
    margin: 2px 0 6px;
}
.block-attachment {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    font-size: 12px;
}
.block-attachment:hover {
    background: var(--bg-card);
}
.attachment-icon {
    flex-shrink: 0;
    font-size: 14px;
    opacity: 0.7;
}
.attachment-name {
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.attachment-size {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}
.attachment-download {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}
.block-attachment:hover .attachment-download {
    opacity: 1;
}
.attachment-download:hover {
    color: var(--accent);
}
.attachment-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.block-attachment:hover .attachment-delete {
    opacity: 1;
}
.attachment-delete:hover {
    color: #ef4444;
}

/* Image lightbox */
.image-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    cursor: default;
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.lightbox-close:hover {
    opacity: 1;
}

/* Drag-and-drop visual feedback */
.editor-container.drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: -4px;
    background: var(--accent-dim);
}

/* ===== Hashtag Autocomplete ===== */

.hashtag-autocomplete {
    position: fixed;
    z-index: 100;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    max-height: 180px;
    overflow-y: auto;
    min-width: 140px;
    padding: 4px 0;
}
.hashtag-ac-item {
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--accent);
    font-weight: 500;
}
.hashtag-ac-item:hover, .hashtag-ac-item.selected {
    background: var(--bg-hover);
}
.hashtag-ac-item .hashtag-ac-count {
    float: right;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
}

/* ===== Inline formatting ===== */

mark, mark.highlight-yellow { background: rgba(253, 224, 71, 0.3); color: inherit; border: none; border-radius: 2px; padding: 1px 0; display: inline; }
mark.highlight-green { background: rgba(134, 239, 172, 0.3); color: inherit; }
mark.highlight-blue { background: rgba(147, 197, 253, 0.3); color: inherit; }
mark.highlight-pink { background: rgba(249, 168, 212, 0.3); color: inherit; }
mark.highlight-orange { background: rgba(253, 186, 116, 0.3); color: inherit; }

/* ===== Search Results ===== */

.search-header {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.search-header strong { color: var(--text-primary); }

.search-result-group {
    margin-bottom: 12px;
}

.search-result-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
    cursor: pointer;
}
.search-result-date:hover { text-decoration: underline; }

.search-result-notebook {
    float: right;
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 11px;
}

.search-result-item {
    padding: 6px 10px;
    background: var(--bg-card);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 13px;
    cursor: pointer;
    border-left: 3px solid var(--border);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-item .search-match { background: var(--highlight-yellow); color: #000; border-radius: 2px; padding: 0 1px; }

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

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

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

.modal-title {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
}

.task-modal-star {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 0.1s;
}
.task-modal-star:hover { opacity: 0.8; }
.task-modal-star.starred {
    color: #f5c542;
    opacity: 1;
}
[data-theme="light"] .task-modal-star.starred { color: #b8860b; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.modal-close:hover { background: var(--bg-card); color: var(--text-primary); }

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

.modal-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-bottom: 16px;
}
.modal-input:focus { border-color: var(--accent); }
.modal-input::placeholder { color: var(--text-muted); }

.modal-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.modal-due-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.modal-due-date-row .modal-input {
    flex: 1;
    margin-bottom: 0;
}
.due-date-trigger {
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}
.due-date-trigger.has-date {
    color: var(--text-primary);
}
.due-date-trigger:not(.has-date) {
    color: var(--text-muted);
}
.modal-due-date-clear {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    line-height: 1;
}
.modal-due-date-clear:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* Custom date picker */
.due-date-picker {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
    user-select: none;
}
.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.dp-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.dp-nav {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1;
}
.dp-nav:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 4px;
}
.dp-weekdays span {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 0;
    font-weight: 600;
}
.dp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.dp-day {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 6px 0;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    line-height: 1;
}
.dp-day:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.dp-day.today {
    color: var(--accent);
    font-weight: 700;
}
.dp-day.selected {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.dp-day.selected.today {
    color: #fff;
}
.dp-day.other-month {
    color: var(--text-muted);
    opacity: 0.4;
}
.dp-footer {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}
.dp-today-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
    padding: 3px 12px;
}
.dp-today-btn:hover {
    background: var(--accent-dim);
}

.modal-colors {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.1s;
}
.modal-color-btn:hover { transform: scale(1.15); }
.modal-color-btn.active { border-color: var(--text-primary); }

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

.modal-btn {
    padding: 7px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
}

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

.modal-btn-save {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.modal-btn-save:hover { filter: brightness(1.1); }

.modal-delete-section {
    padding: 0 20px 12px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 12px;
}

.modal-btn-delete-trigger {
    background: transparent;
    color: #e55;
    border-color: transparent;
    font-size: 12px;
    padding: 4px 0;
    cursor: pointer;
}
.modal-btn-delete-trigger:hover { text-decoration: underline; }

.modal-delete-confirm {
    margin-top: 10px;
}

.modal-delete-warning {
    font-size: 12px;
    color: #e55;
    margin: 0 0 8px;
    line-height: 1.5;
}

.modal-delete-input {
    margin-bottom: 8px;
    border-color: #e55;
}
.modal-delete-input:focus { border-color: #e55; box-shadow: 0 0 0 2px rgba(238, 85, 85, 0.2); }

.modal-btn-delete-final {
    background: #e55;
    color: #fff;
    border-color: #e55;
    width: 100%;
    font-weight: 600;
}
.modal-btn-delete-final:hover { filter: brightness(1.1); }
.modal-btn-delete-final:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: none;
}

.modal-btn-delete {
    background: transparent;
    color: #e55;
    border-color: transparent;
}
.modal-btn-delete:hover { background: rgba(238, 85, 85, 0.15); }

/* ===== Journal dropdown edit button ===== */

.journal-dropdown-item { position: relative; }

.journal-edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s;
}
.journal-edit-btn:hover { color: var(--text-primary); background: var(--bg-card); }
.journal-dropdown-item:hover .journal-edit-btn { opacity: 1; }

/* ===== Deleted Journals (Settings) ===== */

.deleted-journals-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.deleted-journals-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.deleted-journal-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.deleted-journal-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.deleted-journal-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.deleted-journal-restore {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    flex-shrink: 0;
}
.deleted-journal-restore:hover { background: var(--accent); color: #fff; }

.deleted-journal-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

.deleted-journal-purge {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    flex-shrink: 0;
}
.deleted-journal-purge:hover { background: #ef4444; color: #fff; }

.deleted-journal-confirm {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
}

.deleted-journal-confirm-text {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}

.deleted-journal-confirm-input {
    width: 100%;
    margin-bottom: 8px;
    font-size: 13px;
}

.deleted-journal-confirm-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.deleted-journal-confirm-cancel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}
.deleted-journal-confirm-cancel:hover { color: var(--text-primary); }

.deleted-journal-confirm-delete {
    background: #ef4444;
    border: 1px solid #ef4444;
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
}
.deleted-journal-confirm-delete:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.deleted-journal-confirm-delete:not(:disabled):hover {
    background: #dc2626;
}

/* ===== Stacked Multi-Day View ===== */

.notebook-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 0 12px 5px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 4px;
}
.notebook-title-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.notebook-title-edit {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 30px; height: 30px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.notebook-title-edit:hover { background: var(--bg-card); color: var(--text-primary); }

.stacked-date-header {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    padding: 18px 10px 8px 5px;
    margin: 8px -10px 0 -5px;
    letter-spacing: -0.2px;
    z-index: 5;
}
.stacked-date-header:first-child {
    margin-top: 0;
    padding-top: 4px;
}

.stacked-day {
    padding: 4px 10px 8px 5px;
    min-height: 36px;
    margin: 0 -10px 0 -5px;
}

.stacked-load-more {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
}
.stacked-load-more:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.stacked-btn { width: auto; padding: 0 10px; font-size: 14px; }
.stacked-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

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

/* ===== View All Mode ===== */

.view-all-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.view-all-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.view-all-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.notes-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 10px;
    gap: 6px;
}
.notes-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.notes-btn.active { background: color-mix(in srgb, var(--accent-dim) 50%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); color: color-mix(in srgb, var(--accent) 60%, var(--text-secondary)); }
.notes-btn-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

body.view-all-mode .main { left: 0; }

/* View-all toolbar */
.view-all-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 8px;
}
.view-all-toolbar-filters,
.view-all-toolbar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.view-all-toolbar-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 10px;
    white-space: nowrap;
}
.view-all-toolbar-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}
.view-all-toolbar-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
.view-all-toolbar-btn .star-icon {
    font-size: 12px;
}

/* Column manager popup */
.va-column-manager {
    position: fixed;
    top: calc(var(--header-height) + 44px);
    right: 16px;
    width: 260px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 200;
    max-height: 400px;
    overflow-y: auto;
}
.va-cm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.va-cm-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.va-cm-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.va-cm-close:hover { color: var(--text-primary); }
.va-cm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    user-select: none;
}
.va-cm-item:hover { background: var(--bg-card-hover); }
.va-cm-item.dragging { opacity: 0.3; }
.va-cm-drag {
    cursor: grab;
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}
.va-cm-drag:hover { color: var(--text-primary); }
.va-cm-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.va-cm-toggle {
    flex-shrink: 0;
    cursor: pointer;
}
.va-cm-toggle input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--accent);
}
.va-cm-drop-indicator {
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
    margin: 0 12px;
}

.view-all-container {
    display: flex;
    gap: 12px;
    padding: 12px;
    overflow-x: auto;
    flex: 1;
    min-height: 0;
    align-items: stretch;
    scroll-behavior: smooth;
    padding-bottom: 20px;
}

/* Horizontal scrollbar for multi-view */
.view-all-container::-webkit-scrollbar {
    height: 8px;
}
.view-all-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}
.view-all-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.view-all-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.view-all-column {
    min-width: 280px;
    max-width: 320px;
    flex: 1 0 280px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-all-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: grab;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
}
.view-all-column-header:hover { background: var(--bg-card-hover); }

.view-all-column-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.view-all-column-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.view-all-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 7px 4px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    text-align: center;
    font-family: inherit;
}
.view-all-tab:hover { color: var(--text-primary); }
.view-all-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.view-all-tab span {
    font-size: 9px;
    background: var(--bg-card);
    padding: 1px 4px;
    border-radius: 6px;
    font-weight: 600;
}

.view-all-column-filter {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    align-items: center;
}

.view-all-filter-input {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 11px;
    outline: none;
    font-family: inherit;
}
.view-all-filter-input::placeholder { color: var(--text-muted); }
.view-all-filter-input:focus { border-color: var(--accent); }

.view-all-all-btn,
.view-all-due-btn,
.view-all-starred-btn,
.view-all-completed-btn,
.view-all-search-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 6px;
    white-space: nowrap;
}
.view-all-all-btn:hover,
.view-all-due-btn:hover,
.view-all-starred-btn:hover,
.view-all-completed-btn:hover,
.view-all-search-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.view-all-all-btn.active,
.view-all-due-btn.active,
.view-all-starred-btn.active,
.view-all-completed-btn.active,
.view-all-search-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.view-all-search-btn { margin-left: auto; }

.view-all-column-search {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.view-all-column-add {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.view-all-add-task {
    width: 100%;
    padding: 5px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 11px;
    outline: none;
    font-family: inherit;
}
.view-all-add-task::placeholder { color: var(--text-muted); }
.view-all-add-task:focus { border-color: var(--accent); }

.view-all-column-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    user-select: none;
    -webkit-user-select: none;
}

/* Column drag */
.view-all-column.dragging { opacity: 0.25; }

.view-all-column-ghost {
    position: fixed;
    pointer-events: none;
    opacity: 0.9;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
}

.view-all-column-drop-indicator {
    position: absolute;
    top: 12px;
    bottom: 20px;
    width: 2px;
    background: var(--accent);
    border-radius: 1px;
    pointer-events: none;
    z-index: 50;
}

.view-all-column-header:active {
    cursor: grabbing;
}

/* Progressive collapse: prioritize tab space */
/* header-center hidden — date buttons removed */

@media (max-width: 768px) {
    .logo { display: none; }
    .header { gap: 4px; padding: 0 6px; }
    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        transform: none;
        display: none;
        z-index: 95;
    }
    body.sidebar-mobile-open .sidebar { display: flex; transform: none; }
    body.sidebar-mobile-open .main { display: none; }
    .main { left: 0; }
    .sidebar-item-star,
    .sidebar-item-jump { opacity: 1; }
    .sidebar-toggle-label { display: none; }
    .notes-btn-label { display: none; }
    .search-popup { right: 6px; left: 6px; width: auto; }
}



/* ============================================================
   Cloud Sync Indicator
   ============================================================ */

.sync-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.sync-toggle:hover { color: var(--text-primary); background: var(--bg-card); }
.sync-toggle.sync-logged-out { width: auto; height: 36px; padding: 0 12px; gap: 5px; font-size: 12px; background: rgba(245, 166, 35, 0.15); color: #f5a623; border-color: rgba(245, 166, 35, 0.4); white-space: nowrap; flex-shrink: 0; }
.sync-toggle.sync-logged-out:hover { background: rgba(245, 166, 35, 0.25); border-color: rgba(245, 166, 35, 0.6); color: #f5a623; }
.sync-login-label { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; }
.sync-toggle.sync-logged-out .sync-status { color: #f5a623; }
.sync-toggle.sync-logged-out .sync-status::after { display: none; }
[data-theme="light"] .sync-toggle.sync-logged-out { background: rgba(180, 120, 0, 0.1); color: #9a6b00; border-color: rgba(180, 120, 0, 0.3); }
[data-theme="light"] .sync-toggle.sync-logged-out:hover { background: rgba(180, 120, 0, 0.18); border-color: rgba(180, 120, 0, 0.5); }
[data-theme="light"] .sync-toggle.sync-logged-out .sync-status { color: #9a6b00; }

.sync-status { transition: color 0.3s; display: inline-flex; align-items: center; gap: 4px; position: relative; color: var(--text-secondary); }
.sync-status::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid var(--bg-secondary);
    background: var(--text-muted);
    transition: background 0.3s;
}
.sync-status[data-status="connected"]::after { background: #22c55e; }
.sync-status[data-status="syncing"]::after { background: #f59e0b; }
.sync-status[data-status="offline"]::after { background: var(--text-muted); }

/* Auth modal specifics */
.auth-error {
    color: #ef4444;
    font-size: 13px;
    margin-top: 8px;
    min-height: 18px;
}

/* Hashtag chips */
.hashtag-chip {
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.92em;
}

/* Settings modal sections */
.settings-actions {
    margin-bottom: 16px;
}
.settings-actions .modal-btn {
    width: 100%;
}
.debug-code-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 8px;
}
.debug-code-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    text-align: center;
    letter-spacing: 4px;
}
.debug-code-input:focus { border-color: var(--accent); }
.debug-admin-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Sync info in modal */
.sync-info {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 8px 0;
}
