/* ================================================================
   Todo — app.css v2
   Calm, minimal, focused productivity app
   ================================================================ */

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

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

/* ---- Theme Variables ---- */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', ui-monospace, monospace;

    --color-bg: #fafafa;
    --color-bg-raised: #ffffff;
    --color-bg-hover: #f0f0f0;
    --color-bg-active: #e8e8e8;
    --color-bg-inset: #f3f3f4;

    --color-border: #e2e2e5;
    --color-border-light: #ebebee;

    --color-text: #1a1a1d;
    --color-text-secondary: #6b6b76;
    --color-text-muted: #9b9ba7;

    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-primary-soft: #eef2ff;

    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-danger-soft: #fef2f2;
    --color-warning: #ea580c;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);

    --topbar-h: 52px;
    --sidebar-w: 240px;

    color-scheme: light;
}

html.dark {
    --color-bg: #0e0e10;
    --color-bg-raised: #18181b;
    --color-bg-hover: #222226;
    --color-bg-active: #2a2a2f;
    --color-bg-inset: #141416;

    --color-border: #2a2a2f;
    --color-border-light: #222226;

    --color-text: #e4e4e8;
    --color-text-secondary: #9b9ba7;
    --color-text-muted: #6b6b76;

    --color-primary: #818cf8;
    --color-primary-hover: #6366f1;
    --color-primary-soft: rgba(99,102,241,0.12);

    --color-danger-soft: rgba(220,38,38,0.1);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.4);

    color-scheme: dark;
}

/* ---- Base ---- */
html { height: 100%; }
body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ---- Typography utilities ---- */
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.text-danger { color: var(--color-danger); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.w-full { width: 100%; }

/* ================================================================
   AUTH SCREEN
   ================================================================ */

#auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--color-bg);
}

.auth-container,
.auth-wrapper {
    width: 100%;
    max-width: 380px;
}

.auth-error {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.auth-card {
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.auth-logo {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
    color: var(--color-text);
}

.auth-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--color-text);
}

.auth-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

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

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

.input, select.input {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 150ms ease;
}

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

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 120ms ease;
    white-space: nowrap;
}

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

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

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

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
    flex-shrink: 0;
}
.btn-icon:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}

.btn-tiny {
    width: 30px;
    height: 30px;
}
.btn-tiny .material-symbols-outlined {
    font-size: 18px;
}

.btn-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

/* ================================================================
   APP LAYOUT
   ================================================================ */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
    display: flex;
    align-items: center;
    height: var(--topbar-h);
    padding: 0 12px;
    background: var(--color-bg-raised);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
    z-index: 20;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 120px;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 120px;
    justify-content: flex-end;
}

.search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    max-width: 400px;
    width: 100%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 120ms ease;
}
.search-trigger:hover {
    border-color: var(--color-text-muted);
}
.search-trigger .label { flex: 1; text-align: left; }
.search-trigger kbd {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    padding: 1px 5px;
    background: var(--color-bg-hover);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    color: var(--color-text-muted);
}

/* ---- App body: sidebar + content ---- */
.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--color-bg-raised);
    border-right: 1px solid var(--color-border-light);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    transition: margin-left 200ms ease, opacity 200ms ease;
}

.sidebar.collapsed {
    margin-left: calc(var(--sidebar-w) * -1);
    opacity: 0;
    pointer-events: none;
}

.sidebar-section {
    padding: 4px 8px;
}

.sidebar-projects {
    flex: 1;
    overflow-y: auto;
}

.sidebar-bottom {
    border-top: 1px solid var(--color-border-light);
    margin-top: 4px;
    padding-top: 8px;
}

/* ---- Archived projects section ---- */
.sidebar-archived {
    border-top: 1px solid var(--color-border-light);
    margin-top: 4px;
    padding-top: 4px;
}
.sidebar-archived-toggle {
    cursor: pointer;
    user-select: none;
}
.sidebar-archived-toggle:hover {
    color: var(--color-text);
}
.archived-chevron {
    transition: transform 150ms ease;
}
.sidebar-archived-list.collapsed {
    display: none;
}
.nav-item-archived {
    opacity: 0.6;
}
.nav-item-archived:hover {
    opacity: 1;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}

.sidebar-empty {
    padding: 8px 10px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.nav-item-add-project {
    color: var(--color-text-muted) !important;
    opacity: 0.7;
    transition: opacity 100ms ease, background 100ms ease;
}
.nav-item-add-project:hover {
    opacity: 1;
}

.nav-add-project-dot {
    background: transparent;
    border: 1.5px solid var(--color-text-muted);
}

/* ---- Nav items ---- */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 450;
    transition: background 100ms ease, color 100ms ease;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}
.nav-item.active {
    background: var(--color-bg-active);
    color: var(--color-text);
    font-weight: 500;
}
.nav-item .material-symbols-outlined {
    font-size: 20px;
    flex-shrink: 0;
}
.nav-item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item-child {
    padding-left: 34px;
}

.nav-badge {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text-muted);
    min-width: 18px;
    text-align: center;
}

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

.project-dot-lg {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-dot-sm {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 3px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ---- Project drag & drop ---- */
.nav-item[data-project-id] {
    position: relative;
}
.nav-item.project-dragging {
    opacity: 0.3;
}
.nav-item.drop-above::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}
.nav-item.drop-below::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}
.nav-item.drop-nest {
    background: var(--color-primary-soft);
    border-radius: var(--radius-md);
}

/* ================================================================
   MAIN CONTENT — Split pane
   ================================================================ */

.main-content {
    flex: 1;
    display: flex;
    min-width: 0;
    background: var(--color-bg);
}

.pane-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid var(--color-border-light);
}

.pane-right {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-raised);
    overflow: hidden;
    transition: width 200ms ease;
    position: relative;
}
.pane-right.collapsed {
    width: 0;
    border: none;
    overflow: hidden;
}

/* ---- Pane resize handle ---- */
.pane-resize-handle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    transition: background 150ms ease;
    position: relative;
    z-index: 5;
}
.pane-resize-handle:hover,
.pane-resize-handle:active {
    background: var(--color-primary);
}
.pane-resize-handle.hidden {
    display: none;
}

/* ---- Pane collapse button ---- */
.pane-collapse-btn {
    position: absolute;
    top: 14px;
    left: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 150ms ease, background 150ms ease;
    padding: 0;
}
.pane-right:hover .pane-collapse-btn,
.pane-collapse-btn:hover {
    opacity: 1;
}
.pane-collapse-btn:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}
.pane-collapse-btn .material-symbols-outlined {
    font-size: 18px;
}

/* ---- Pane header ---- */
.pane-header {
    padding: 20px 24px 12px;
    flex-shrink: 0;
}

.pane-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-text);
    line-height: 1.3;
}

.pane-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.pane-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.archived-badge {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    background: var(--color-bg-hover);
    padding: 2px 8px;
    border-radius: 999px;
    vertical-align: middle;
}

/* ---- Pane body ---- */
.pane-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.pane-body-padded {
    padding: 0 24px 24px;
}

/* ---- Completed toggle ---- */
.completed-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 5px 12px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    transition: all 120ms ease;
    white-space: nowrap;
}
.completed-toggle:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}
.completed-toggle input[type="checkbox"] {
    display: none;
}
.completed-toggle:has(input:checked) {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ================================================================
   QUICK ADD
   ================================================================ */

.quick-add {
    padding: 0 24px 8px;
    flex-shrink: 0;
}

.quick-add-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--color-bg-inset);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: border-color 150ms ease, background 150ms ease;
}
.quick-add-wrapper:focus-within {
    border-color: var(--color-primary);
    background: var(--color-bg-raised);
}
.quick-add-wrapper .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-text-muted);
}

.quick-add-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--color-text);
    outline: none;
}
.quick-add-input:focus {
    outline: none;
    box-shadow: none;
}
.quick-add-input::placeholder {
    color: var(--color-text-muted);
}

/* ================================================================
   TASK LIST
   ================================================================ */

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    min-height: 44px;
    border-bottom: 1px solid var(--color-border-light);
    cursor: default;
    transition: background 80ms ease;
}
.task-item:hover {
    background: var(--color-bg-hover);
}
.task-item.selected {
    background: var(--color-primary-soft);
}
.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--color-text-muted);
}
.task-item.completed .task-checkbox {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.task-item.completed .task-checkbox::after {
    content: '\e5ca';
    font-family: 'Material Symbols Outlined';
    color: #fff;
    font-size: 16px;
    font-weight: 300;
}
.task-item.dragging,
.task-item.sortable-ghost {
    opacity: 0.4;
}
.task-item.sortable-chosen {
    background: var(--color-bg-raised);
}
.task-item.sortable-drag,
.task-item.sortable-fallback {
    background: var(--color-bg-raised);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-radius: 8px;
    opacity: 0.9;
}
.task-item.drop-above {
    box-shadow: inset 0 2px 0 0 var(--color-primary);
}
.task-item.drop-below {
    box-shadow: inset 0 -2px 0 0 var(--color-primary);
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 120ms ease, background 120ms ease;
}
.task-checkbox:hover {
    border-color: var(--color-primary);
}

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

.task-title {
    font-size: 0.95rem;
    font-weight: 450;
    color: var(--color-text);
    word-break: break-word;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.task-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-family: var(--font-sans);
}
.task-meta-item .material-symbols-outlined {
    font-size: 14px;
}
.task-meta-item.overdue {
    color: var(--color-danger);
}
.task-meta-item.due-today {
    color: var(--color-primary);
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 100ms ease;
    flex-shrink: 0;
}
.task-item:hover .task-actions {
    opacity: 1;
    pointer-events: auto;
}

.schedule-chips {
    display: flex;
    align-items: center;
    gap: 3px;
}

.schedule-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg-raised);
    color: var(--color-text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 100ms ease;
    line-height: 1.4;
}
.schedule-chip:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.schedule-chip .material-symbols-outlined {
    font-size: 15px;
}
.chip-muted {
    border-color: transparent;
    background: transparent;
    color: var(--color-text-muted);
}
.chip-muted:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.chip-icon {
    padding: 3px 6px;
    border-color: transparent;
    background: transparent;
    color: var(--color-text-muted);
}
.chip-icon:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}

/* ---- Drag handle (upcoming) ---- */
.drag-handle {
    display: flex;
    align-items: center;
    color: var(--color-text-muted);
    cursor: grab;
    flex-shrink: 0;
    -webkit-touch-callout: none;
    touch-action: none;
}
.drag-handle:active {
    cursor: grabbing;
}
.drag-handle .material-symbols-outlined {
    font-size: 18px;
}

/* ---- Empty state ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--color-text-muted);
    text-align: center;
    gap: 8px;
}
.empty-state .material-symbols-outlined {
    font-size: 36px;
    opacity: 0.5;
}
.empty-state p {
    font-size: 0.9rem;
}

/* ---- Completed section ---- */
.completed-section {
    margin-top: 8px;
    opacity: 0.7;
}

.completed-section-header {
    padding: 8px 24px;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}

/* ---- Load more button ---- */
.load-more-container {
    padding: 16px 24px;
    text-align: center;
}
.load-more-btn {
    width: 100%;
    padding: 10px;
    color: var(--color-text-secondary);
}
.load-more-btn:hover {
    background: var(--color-bg-hover);
}

/* ---- Completed view ---- */
.completed-date-group {
    border-bottom: 1px solid var(--color-border-light);
}
.completed-date-group:last-child {
    border-bottom: none;
}
.completed-date-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 14px 24px 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 2;
}
.completed-date-header .date-group-count {
    margin-left: auto;
}

/* ================================================================
   UPCOMING / SCHEDULE VIEW
   ================================================================ */

.schedule-group {
    margin-bottom: 0;
}
.schedule-group:last-child {
}

/* ---- Week navigation bar ---- */
.week-nav {
    display: none;
}
.week-nav-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 100ms ease;
}
.week-nav-day:hover {
    background: var(--color-bg-hover);
}
.week-nav-day.is-today .week-nav-num {
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.week-nav-name {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.week-nav-num {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Overdue section ---- */
.schedule-overdue-section {
    margin-bottom: 0;
}
.schedule-overdue-section .task-item:last-child {
    border-bottom: none;
}
.schedule-overdue-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-danger);
    cursor: pointer;
    user-select: none;
}
.overdue-chevron {
    font-size: 20px;
    transition: transform 150ms ease;
}
.date-group-count {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-bg-hover);
    padding: 1px 8px;
    border-radius: 999px;
}
.overdue-count {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}
.schedule-reschedule-btn {
    margin-left: auto;
    color: var(--color-primary);
    border: none;
    font-weight: 500;
}
.schedule-overdue-tasks.collapsed {
    display: none;
}

/* ---- Inline add task ---- */
.schedule-inline-add {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    min-height: 44px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 100ms ease;
}
.schedule-inline-add:hover {
    color: var(--color-primary);
}
.schedule-inline-add .material-symbols-outlined {
    font-size: 18px;
}
.inline-add-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--color-text);
    outline: none;
    padding: 4px 0;
}

.date-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    width: 100%;
    padding: 16px 24px 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 2;
}
.date-group-primary {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--color-text-muted);
}
.schedule-group-empty .schedule-group-tasks {
    min-height: 0;
}
.schedule-group-empty .schedule-drop-zone {
    margin-top: 0;
    padding: 6px 12px;
    font-size: 0.8rem;
}

.date-group-header.today {
    color: var(--color-primary);
}
.date-group-header.today .date-group-primary {
    color: var(--color-text-muted);
}
.date-group-header.overdue {
    color: var(--color-danger);
}

.schedule-group-tasks {
    min-height: 4px;
}

.schedule-drop-zone {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 24px 8px;
    padding: 8px 12px;
    border: 2px dashed transparent;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: transparent;
    transition: all 150ms ease;
}
.schedule-drop-zone .material-symbols-outlined {
    font-size: 16px;
}
.schedule-drop-zone.drag-over {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

/* ================================================================
   RIGHT PANE — Note editor & Task detail
   ================================================================ */

.note-editor-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}
.note-editor-header h3 {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-save-status {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}
.note-save-status.saving {
    color: var(--color-warning);
}
.note-save-status.saved {
    color: var(--color-success);
}

.note-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.note-editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.note-textarea {
    flex: 1;
    display: block;
    width: 100%;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--color-text);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
}
.note-textarea::placeholder {
    color: var(--color-text-muted);
}

/* Task detail */
.task-detail {
    padding: 16px;
}

.task-detail-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    outline: none;
    border: 1px solid var(--color-border-light);
    transition: border-color 120ms ease;
    margin-bottom: 16px;
    line-height: 1.4;
}
.task-detail-title:focus {
    border-color: var(--color-primary);
}

.task-detail-field {
    margin-bottom: 12px;
}
.task-detail-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}
.task-detail-field select,
.task-detail-field input[type="date"] {
    width: 100%;
    padding: 6px 8px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    outline: none;
}
.task-detail-field select {
    padding-right: 28px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.task-detail-field select:focus,
.task-detail-field input[type="date"]:focus {
    border-color: var(--color-primary);
}

.task-detail-notes {
    margin-bottom: 16px;
}
.task-detail-notes label {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}
.task-detail-notes textarea {
    width: 100%;
    min-height: 120px;
    padding: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    outline: none;
    resize: vertical;
}
.task-detail-notes textarea:focus {
    border-color: var(--color-primary);
}

.task-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}
.task-detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.task-detail-meta-item .material-symbols-outlined {
    font-size: 14px;
}

.task-detail-actions {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border-light);
}

/* ================================================================
   CALENDAR VIEW — Day Notes
   ================================================================ */

.calendar-card {
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-width: 340px;
    margin: 0 auto;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.calendar-month-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
}

.calendar-actions {
    display: flex;
    justify-content: center;
    margin: 12px 0 24px;
}

.calendar-grid {
    user-select: none;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.calendar-header-cell {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-text-muted);
    padding: 4px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.calendar-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: background 100ms ease;
}
.calendar-cell:not(.empty):hover {
    background: var(--color-bg-hover);
}
.calendar-cell.empty {
    cursor: default;
}
.calendar-cell.today {
    background: var(--color-primary-soft);
}
.calendar-cell.today .calendar-day-num {
    color: var(--color-primary);
    font-weight: 700;
}
.calendar-cell.has-note .calendar-day-num {
    font-weight: 600;
}
.calendar-cell.selected {
    background: var(--color-primary);
}
.calendar-cell.selected .calendar-day-num {
    color: #fff;
}
.calendar-cell.selected .calendar-note-dot {
    background: rgba(255,255,255,0.8);
}

.calendar-day-num {
    font-size: 0.8rem;
    color: var(--color-text);
    line-height: 1;
}

.calendar-note-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-primary);
    position: absolute;
    bottom: 4px;
}

/* Recent notes list */
.calendar-recent-header {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.calendar-recent-item {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 80ms ease;
    border: 1px solid var(--color-border-light);
    margin-bottom: 6px;
}
.calendar-recent-item:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border);
}

.calendar-recent-date {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
}

.calendar-recent-meta {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ================================================================
   SETTINGS
   ================================================================ */

.settings-section {
    margin-bottom: 28px;
}
.settings-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 10px;
}

.kbd-hints div {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-bg-hover);
    border: 1px solid var(--color-border);
    border-radius: 3px;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.session-item-info {
    flex: 1;
    min-width: 0;
}

.session-item-ip {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-item-current {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-success);
    background: rgba(22, 163, 74, 0.1);
    padding: 1px 6px;
    border-radius: 3px;
}

.session-item-ua {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 1px;
}

.activity-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
}

.activity-action {
    font-weight: 500;
    color: var(--color-text);
}

.activity-detail {
    color: var(--color-text-secondary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-time {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* ================================================================
   SEARCH MODAL
   ================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 16px 16px;
}
html.dark .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.search-modal {
    width: 100%;
    max-width: 520px;
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.search-modal-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border-light);
}
.search-modal-input-wrap .material-symbols-outlined {
    font-size: 20px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.search-modal-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--color-text);
    outline: none;
}
.search-modal-input::placeholder {
    color: var(--color-text-muted);
}

.search-results {
    overflow-y: auto;
    padding: 8px;
}

.search-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.search-results-section {
    margin-bottom: 4px;
}

.search-results-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: 8px 10px 4px;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 80ms ease;
}
.search-result-item:hover {
    background: var(--color-bg-hover);
}
.search-result-item .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-text-muted);
    flex-shrink: 0;
    margin-top: 2px;
}

.search-result-title {
    font-size: 0.85rem;
    font-weight: 450;
    color: var(--color-text);
}

.search-result-snippet {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================================================
   PROJECT MODAL
   ================================================================ */

.modal-card {
    width: 100%;
    max-width: 440px;
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 28px;
}
.modal-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--color-text);
}

/* Color picker */
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 100ms ease, border-color 100ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: transparent;
    padding: 0;
}
.color-swatch:hover {
    transform: scale(1.15);
}
.color-swatch.selected {
    border-color: var(--color-primary);
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--color-primary-soft);
}

.color-swatch-none {
    background: var(--color-bg-hover);
    border-color: var(--color-border);
    color: var(--color-text-muted);
}
.color-swatch-none:hover,
.color-swatch-none.selected {
    color: var(--color-text-muted);
}

/* ---- Accent picker ---- */
.accent-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.accent-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 100ms ease, border-color 100ms ease;
    padding: 0;
}
.accent-swatch:hover {
    transform: scale(1.15);
}
.accent-swatch.selected {
    border-color: var(--color-text);
    transform: scale(1.15);
}

/* ================================================================
   DATE PICKER OVERLAY
   ================================================================ */

.date-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    animation: fadeIn 120ms ease;
}

.date-picker-panel {
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 260px;
    max-width: 320px;
    width: 90vw;
    animation: slideUp 150ms ease;
}

.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.date-picker-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--color-text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 80ms ease;
}
.date-picker-opt:hover {
    background: var(--color-bg-hover);
}
.date-picker-opt .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-text-secondary);
}
.date-picker-opt .text-muted {
    margin-left: auto;
}
.date-picker-remove {
    color: var(--color-text-muted);
}

.date-picker-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 4px 0;
}

.date-picker-input {
    width: 100%;
    padding: 6px 10px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    outline: none;
    box-sizing: border-box;
}

/* ================================================================
   SYNC INDICATOR
   ================================================================ */

.sync-indicator {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border-light);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 200ms ease, transform 200ms ease;
    pointer-events: none;
    z-index: 1000;
}
.sync-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}
.sync-icon {
    font-size: 14px;
}
.sync-syncing .sync-icon {
    color: var(--color-primary);
}
.sync-synced .sync-icon {
    color: var(--color-success);
}
.sync-synced .sync-label {
    color: var(--color-success);
}
.sync-syncing .sync-label {
    color: var(--color-primary);
}
.sync-error .sync-icon {
    color: var(--color-danger);
}
.sync-error .sync-label {
    color: var(--color-danger);
}

/* ================================================================
   RESPONSIVE — Mobile
   ================================================================ */

/* ---- Topbar brand ---- */
.topbar-brand {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
    color: var(--color-text);
    margin-left: 2px;
}

/* ---- Mobile search button (hidden on desktop) ---- */
.topbar-search-mobile {
    display: none;
}

/* ---- Sidebar overlay ---- */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    top: var(--topbar-h);
    background: rgba(0, 0, 0, 0.4);
    z-index: 29;
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
}
.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
html.dark .sidebar-overlay.visible {
    background: rgba(0, 0, 0, 0.6);
}

/* ---- Safe area padding for notched devices ---- */
@supports (padding: env(safe-area-inset-bottom)) {
    .topbar {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .pane-body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .sync-indicator {
        bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* ---- Touch-friendly task improvements ---- */
@media (hover: none) and (pointer: coarse) {
    .task-item {
        min-height: 48px;
    }
    .task-checkbox {
        width: 26px;
        height: 26px;
    }
    .task-actions {
        opacity: 1;
        pointer-events: auto;
    }
    .schedule-chips {
        display: none;
    }
    .btn-icon {
        width: 40px;
        height: 40px;
    }
    .nav-item {
        padding: 10px 12px;
    }
}

/* ---- Tablet breakpoint ---- */
@media (max-width: 1024px) {
    .pane-right {
        width: 320px;
    }
}

/* ---- Mobile breakpoint ---- */
@media (max-width: 768px) {
    .topbar-center {
        display: none;
    }
    .topbar-left {
        flex: 1;
    }
    .topbar-search-mobile {
        display: inline-flex;
    }

    /* Sidebar as overlay drawer */
    .sidebar {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        bottom: 0;
        z-index: 30;
        box-shadow: var(--shadow-lg);
        transition: transform 200ms ease;
        width: min(var(--sidebar-w), 80vw);
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
        margin-left: 0;
        opacity: 1;
    }

    /* Right pane as full-screen overlay */
    .pane-right {
        position: fixed;
        top: var(--topbar-h);
        right: 0;
        bottom: 0;
        width: 100% !important;
        z-index: 25;
        transform: translateX(100%);
        transition: transform 200ms ease;
    }
    .pane-right.mobile-visible {
        transform: translateX(0);
    }
    .pane-right.collapsed {
        width: 100% !important;
        transform: translateX(100%);
    }
    .pane-right.collapsed.mobile-visible {
        transform: translateX(0);
    }

    .pane-left {
        border-right: none;
    }

    .pane-header {
        padding: 16px 16px 8px;
    }
    .quick-add {
        padding: 0 16px 8px;
    }
    .task-item {
        padding: 12px 16px;
    }
    .task-actions {
        opacity: 1;
        pointer-events: auto;
    }
    .schedule-chips {
        display: none;
    }
    .completed-section-header {
        padding: 8px 16px;
    }
    .date-group-header {
        padding: 14px 16px 8px;
    }
    .schedule-drop-zone {
        margin: 2px 16px 8px;
    }
    .schedule-inline-add {
        padding: 6px 16px;
    }
    .schedule-overdue-header {
        padding: 12px 16px 8px;
    }
    .schedule-later-header {
        padding: 12px 16px 8px;
    }
    .schedule-later-month-label {
        padding: 10px 16px 4px;
    }
    .today-section-header {
        padding: 12px 16px 6px;
    }
    .pane-body-padded {
        padding: 0 16px 16px;
    }
    .pane-resize-handle {
        display: none;
    }
    .pane-collapse-btn {
        display: none;
    }
    .week-nav {
        overflow-x: auto;
    }

    /* Modal adjustments */
    .modal-overlay {
        padding: 60px 12px 12px;
        align-items: flex-start;
    }
    .modal-card {
        max-width: 100%;
    }
    .search-modal {
        max-width: 100%;
        max-height: 80vh;
    }

    /* Calendar grid touch targets */
    .calendar-cell {
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    .search-trigger {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .modal-overlay {
        padding: 16px 8px;
    }

    .modal-card {
        padding: 20px;
    }

    /* Tighter padding on very small screens */
    .pane-header {
        padding: 12px 12px 6px;
    }
    .quick-add {
        padding: 0 12px 6px;
    }
    .task-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .auth-card {
        padding: 24px;
    }

    .day-note-completed {
        padding: 8px 12px 12px;
    }

    .day-completed-item {
        padding: 3px 0;
        font-size: 0.8rem;
    }
}

/* ================================================================
   TODAY VIEW — RANGE TOGGLES
   ================================================================ */

.today-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.today-section {
    border-bottom: 1px solid var(--color-border-light);
}

.today-section:last-child {
    border-bottom: none;
}

.today-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 2;
}

.today-section-header .date-group-count {
    margin-left: auto;
}

.today-section-header.yesterday {
    color: var(--color-text-muted);
}

.today-section-header.today-current {
    color: var(--color-primary);
}

.today-section-header.tomorrow {
    color: var(--color-text-secondary);
}

/* ================================================================
   SCHEDULE — RANGE BUTTONS
   ================================================================ */

.schedule-range-btns {
    display: flex;
    gap: 4px;
}

/* ================================================================
   SCHEDULE — LATER SECTION
   ================================================================ */

.schedule-later-section {
    border-top: 1px solid var(--color-border-light);
    margin-top: 4px;
}

.schedule-later-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
}

.later-chevron {
    font-size: 20px;
    transition: transform 150ms ease;
}

.later-count {
    font-size: 0.72rem;
    font-weight: 500;
    background: var(--color-bg-hover);
    color: var(--color-text-secondary);
    padding: 1px 8px;
    border-radius: 999px;
}

.schedule-later-tasks.collapsed {
    display: none;
}

.schedule-later-month {
    margin-bottom: 8px;
}

.schedule-later-month-label {
    padding: 10px 24px 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* ================================================================
   DAY NOTE — COMPLETED TASKS
   ================================================================ */

.day-note-completed {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border-light);
}

.day-completed-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.day-completed-header .date-group-count {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--color-bg-hover);
    padding: 1px 6px;
    border-radius: 999px;
}

.day-completed-list {
    padding: 0 16px 12px;
}

.day-completed-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.day-completed-check {
    font-size: 14px;
    color: var(--color-success);
    flex-shrink: 0;
}

.day-completed-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-completed-project {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.day-completed-time {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* ================================================================
   SCROLLBAR STYLING
   ================================================================ */

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

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

/* ================================================================
   SELECTION & FOCUS
   ================================================================ */

::selection {
    background: var(--color-primary-soft);
    color: var(--color-text);
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Remove focus outline from inputs that have parent focus styles */
.quick-add-input:focus-visible,
.inline-add-input:focus-visible,
.search-modal-input:focus-visible,
.note-textarea:focus-visible,
.input:focus-visible,
.task-detail-title:focus-visible {
    outline: none;
}
