/* ============================================
   BRAIN CRM — mont3.ch inspired dark theme
   ============================================ */

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

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

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

:root {
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-hover: #1a1a25;
    --bg-modal: #15151f;
    --border: #2a2a3a;
    --text: #f5f5fa;
    --text-dim: #b4b4c4;
    --text-muted: #a0a0b0;
    /* Accent defaults — overridden per-user by <head> inline script on app pages.
       Kept here so pages without the script (login, signup) still render correctly. */
    --accent: #c8ff00;
    --neon: #c8ff00;
    --accent-faint: rgba(200, 255, 0, 0.06);
    --accent-subtle: rgba(200, 255, 0, 0.1);
    --accent-dim: rgba(200, 255, 0, 0.15);
    --accent-border: rgba(200, 255, 0, 0.2);
    --accent-glow: rgba(200, 255, 0, 0.3);
    --red: #f87171;
    --blue: #4a6fa5;
    --purple: #a78bfa;
    --green: #34d399;
    --orange: #fb923c;
    --pink: #f472b6;
    --cyan: #38bdf8;
    --header-h: 48px;
    --sidebar-w: 300px;
    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 10px;
    --fs-xs: 9px;
    --fs-sm: 11px;
    --fs-base: 12px;
    --fs-md: 13px;
    --fs-lg: 14px;
    --fs-xl: 16px;
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 12px;
    --sp-lg: 16px;
    --sp-xl: 24px;
    --text-secondary: var(--text-dim);
    --surface: var(--bg-card);
    --surface2: var(--bg-hover);
    --surface3: var(--bg-modal);
    --danger: #ff5555;
}

html, body {
    height: 100vh;
    overflow: hidden;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-md);
    line-height: 1.5;
}

/* ============ HEADER ============ */
#header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: relative;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.header-center { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; margin-right: 16px; }
.header-right { display: flex; align-items: center; gap: 8px; min-width: 200px; justify-content: flex-end; }

.points-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius);
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--accent);
    position: relative;
    user-select: none;
}
.points-icon { font-size: var(--fs-lg); }
.points-value { font-variant-numeric: tabular-nums; }

.points-float {
    position: fixed;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    pointer-events: none;
    z-index: 99999;
    text-shadow: 0 0 8px var(--accent-glow);
    animation: pointsFloat 1.2s ease-out forwards;
}

@keyframes pointsFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    60% { opacity: 1; transform: translateY(-40px) scale(1.1); }
    100% { opacity: 0; transform: translateY(-70px) scale(0.8); }
}

.points-bump {
    animation: pointsBump 0.3s ease-out;
}
@keyframes pointsBump {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Urgent task flash: priority 100 + due today — sharp on/off blink */
@keyframes taskFlashAccent {
    0%, 49.99% {
        background: var(--accent);
        box-shadow: 0 0 16px 3px var(--accent-glow);
    }
    50%, 100% {
        background: var(--bg-card);
        box-shadow: none;
    }
}
@keyframes taskFlashAccentTitle {
    0%, 49.99% { color: var(--bg); }
    50%, 100%  { color: var(--accent); }
}
@keyframes pzTaskFlashAccent {
    0%, 49.99% {
        background: var(--accent);
        box-shadow: 0 0 14px 2px var(--accent-glow);
        border-color: var(--accent);
    }
    50%, 100% {
        background: transparent;
        box-shadow: none;
        border-color: var(--accent);
    }
}
.task-item.task-flashing {
    animation: taskFlashAccent 0.8s steps(1, end) infinite;
    border-left-color: var(--accent) !important;
}
.task-item.task-flashing .task-title {
    animation: taskFlashAccentTitle 0.8s steps(1, end) infinite;
    font-weight: 700;
}
.pz-task.pz-task-flashing {
    animation: pzTaskFlashAccent 0.8s steps(1, end) infinite;
}
.pz-task.pz-task-flashing .pz-task-title {
    animation: taskFlashAccentTitle 0.8s steps(1, end) infinite;
    font-weight: 700;
}

.logo {
    font-size: var(--fs-xl);
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.accent { color: var(--accent); }

/* area-tabs replaced by area-dropdown */

.btn-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--accent);
    font-family: inherit;
    font-size: var(--fs-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.btn-small {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* CREATE button + dropdown */
.area-dropdown-wrap {
    position: relative;
}
.area-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    z-index: 1000;
    min-width: 160px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    flex-direction: column;
}
.area-dropdown.open { display: flex; }
.area-dropdown-item {
    padding: 7px 12px;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-base);
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.area-dropdown-item:hover { background: var(--bg-hover); color: var(--accent); }
.area-dropdown-item.active { color: var(--accent); }
.area-dropdown-item .tab-icon { font-size: var(--fs-lg); }
.create-dropdown-wrap {
    position: relative;
}
.canvas-top-btns {
    position: absolute;
    top: 10px;
    right: 14px;
    z-index: 20;
    display: flex;
    gap: 6px;
    pointer-events: auto;
}
.btn-auto {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text-dim);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-auto:hover { border-color: var(--accent); color: var(--accent); }
.btn-auto.active { border-color: var(--accent); color: var(--accent); }

.canvas-dropdown-wrap { position: relative; }
.canvas-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    z-index: 1000;
    min-width: 140px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    flex-direction: column;
}
.canvas-dropdown.open { display: flex; }
.canvas-dropdown-item {
    padding: 7px 12px;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-base);
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
    white-space: nowrap;
}
.canvas-dropdown-item:hover { background: var(--bg-hover); color: var(--accent); }
.canvas-dropdown-item.active { color: var(--accent); }

.focus-cat-wrap { position: relative; }
.focus-cat-btn { display: flex; justify-content: space-between; align-items: center; }
.focus-arrow { font-size: var(--fs-lg); color: var(--text-dim); }
.focus-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    min-width: 120px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    flex-direction: column;
    z-index: 1001;
}
.focus-cat-wrap:hover > .focus-submenu,
.focus-submenu.open { display: flex; }
.focus-submenu .canvas-dropdown-item { font-size: var(--fs-base); }
.focus-collab-item { display: flex; align-items: center; gap: 6px; }
.focus-collab-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Remove-collaborator modal radio options */
.rc-option { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; font-size: 13px; color: var(--text); }
.rc-option input[type="radio"] { accent-color: var(--accent); cursor: pointer; }

/* Rituals panel */
#ritualsList { padding: 4px 0; }
.ritual-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-bottom: 1px solid rgba(42, 42, 58, 0.3);
    transition: background 0.15s;
}
.ritual-row:hover { background: var(--accent-faint); }
.ritual-row .ritual-check {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.ritual-row.done .ritual-check {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}
.ritual-row.done .ritual-check::after { content: '✓'; font-size: 11px; font-weight: 700; }
.ritual-row .ritual-text {
    flex: 1;
    font-size: 12px;
    color: var(--text);
    cursor: text;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    outline: none;
}
.ritual-row.done .ritual-text { color: var(--text-dim); }
.ritual-row .ritual-streak {
    font-size: 10px;
    color: var(--text-dim);
    flex-shrink: 0;
    white-space: nowrap;
    cursor: default;
}
.ritual-row .ritual-streak.hot { color: var(--orange); }
.ritual-row .ritual-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.ritual-row:hover .ritual-delete { opacity: 0.6; }
.ritual-row .ritual-delete:hover { opacity: 1; color: var(--red); }
#ritualsAddRow { padding: 6px 16px; border-top: 1px solid rgba(42, 42, 58, 0.3); }
#newRitualText {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 8px;
    font-size: 12px;
    box-sizing: border-box;
}
.rituals-empty {
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
}

/* Task assignee avatars */
.pz-task-assignees {
    display: inline-flex;
    gap: 2px;
    flex-shrink: 0;
    padding-left: 4px;
}
.pz-task-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* Custom confirm dialog */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.confirm-box {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    max-width: 360px;
    width: 90vw;
    text-align: center;
}
.confirm-box p {
    font-size: var(--fs-md);
    color: var(--text);
    margin-bottom: 6px;
}
.confirm-box .confirm-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 18px;
}
.confirm-box .confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.confirm-box .btn-confirm {
    padding: 8px 20px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--bg);
    font-family: inherit;
    font-size: var(--fs-base);
    font-weight: 700;
    cursor: pointer;
}
.confirm-box .btn-confirm:hover { filter: brightness(0.85); }
.confirm-box .btn-cancel {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: var(--fs-base);
    cursor: pointer;
}
.confirm-box .btn-cancel:hover { border-color: var(--text-dim); color: var(--text); }

.btn-create {
    padding: 7px 22px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--bg);
    font-family: inherit;
    font-size: var(--fs-md);
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: 12px;
}
.btn-create:hover {
    filter: brightness(0.85);
}
.btn-create-outline {
    background: transparent;
    color: var(--accent);
    margin-left: 0;
}
.btn-create-outline:hover {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}
.create-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    z-index: 1000;
    min-width: 140px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.create-dropdown.open { display: flex; flex-direction: column; }
.create-opt {
    padding: 7px 12px;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-base);
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
}
.create-opt:hover { background: var(--bg-hover); color: var(--accent); }
.create-opt-small {
    font-size: 10px;
    padding: 5px 12px;
    color: var(--text-dim);
}

.connecting-from {
    outline: 2px solid var(--accent) !important;
    outline-offset: 2px;
    animation: pulse-connect 1s ease-in-out infinite;
}
@keyframes pulse-connect {
    0%, 100% { outline-color: var(--accent); }
    50% { outline-color: transparent; }
}

/* ============ MAIN LAYOUT ============ */
#mainLayout {
    display: flex;
    height: calc(100vh - var(--header-h));
}

/* ============ BRAIN AREA ============ */
#brainAreaWrap {
    flex: 1;
    position: relative;
    min-width: 0;
}
#brainArea {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
#brainArea::-webkit-scrollbar { display: none; }

#brainCanvas {
    min-width: 100%;
    min-height: 100%;
    position: relative;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 8px; }
.empty-state .hint { font-size: var(--fs-sm); }

/* ============ PROJECT ZONES (spatial inside areas) ============ */
.project-zone {
    position: absolute;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 140px;
    min-height: 80px;
    transition: box-shadow 0.2s;
}

.project-zone:hover {
    box-shadow: 0 0 12px var(--accent-faint);
}

.project-zone-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.project-zone-header:active { cursor: grabbing; }

.project-edit-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--fs-md);
    padding: 0 2px;
    opacity: 0;
    transition: opacity 0.15s;
    margin-left: auto;
    flex-shrink: 0;
}
.project-zone:hover .project-edit-btn { opacity: 0.6; }
.project-zone:hover .project-edit-btn:hover { opacity: 1; color: var(--accent); }

.project-zone-name {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--proj-text, var(--text));
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-zone-status {
    font-size: var(--fs-xs);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.project-zone-status[data-status="active"] { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.project-zone-status[data-status="paused"] { background: rgba(251, 146, 60, 0.15); color: var(--orange); }
.project-zone-status[data-status="completed"] { background: rgba(56, 189, 248, 0.15); color: var(--cyan); }
.project-zone-status[data-status="archived"] { background: rgba(106, 106, 122, 0.15); color: var(--text-dim); }
.project-zone-status[data-status="planning"] { background: rgba(167, 139, 250, 0.15); color: var(--purple); }

.project-zone-type {
    font-size: 8px;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.project-zone-type[data-type="client"] { background: rgba(56, 189, 248, 0.12); color: var(--cyan); }
.project-zone-type[data-type="startup"] { background: var(--accent-dim); color: var(--neon); }
.project-zone-type[data-type="lead"] { background: rgba(251, 146, 60, 0.12); color: var(--orange); }
.project-zone-type[data-type="partner"] { background: rgba(167, 139, 250, 0.12); color: var(--purple); }
.project-zone-type[data-type="investment"] { background: rgba(52, 211, 153, 0.12); color: var(--green); }

.project-zone-body {
    flex: 1;
    padding: 8px;
    overflow: auto;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--fs-sm);
}
.project-zone-body::-webkit-scrollbar { display: none; }

.project-zone-desc {
    color: var(--text-dim);
    font-size: 10px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-shrink: 0;
}

.project-zone-goal {
    color: var(--text);
    font-size: 10px;
    margin-top: 2px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-shrink: 0;
    border-left: 2px solid var(--accent);
    padding-left: 6px;
}

.project-zone-tasks {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 1;
    overflow: hidden;
    min-height: 0;
}

.pz-task {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--text);
    padding: 3px 6px;
    margin: 2px 0;
    cursor: pointer;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.pz-task:hover { filter: brightness(1.2); }

.pz-task.pz-task-done { opacity: 0.4; background: rgba(128, 128, 128, 0.05); border-color: transparent; }
.pz-task.pz-task-featured { border-color: #f5c842 !important; background: rgba(245,200,66,0.15) !important; box-shadow: 0 0 6px rgba(245,200,66,0.4), inset 0 0 4px rgba(245,200,66,0.1); border-width: 2px; }

.pz-task-check {
    flex-shrink: 0;
    font-size: 10px;
    width: 12px;
    cursor: pointer;
    opacity: 0.7;
}
.pz-task-check:hover { opacity: 1; }
.pz-task-title { cursor: pointer; }

.pz-task-done .pz-task-title {
    text-decoration: line-through;
    opacity: 0.5;
}

.pz-task-done .pz-task-check { color: var(--neon); }

.pz-task-urgent .pz-task-title { font-weight: 700; }

.pz-task-blocked .pz-task-check { color: var(--red); }
.pz-task-blocked .pz-task-title { color: var(--text-muted); }

.pz-task-blocks {
    font-size: 8px;
    padding: 1px 4px;
    border-radius: var(--radius);
    background: rgba(248,113,113,0.15);
    color: var(--red);
    white-space: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}

.pz-task-recur {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1;
}

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

.pz-task-edit {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 10px;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
    margin-left: auto;
}
.pz-task:hover .pz-task-edit { opacity: 0.6; }
.pz-task:hover .pz-task-edit:hover { opacity: 1; color: var(--accent); }

.pz-links {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.pz-link {
    font-size: var(--fs-base);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.pz-link:hover { opacity: 1; }

.project-zone-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px 6px;
    flex-shrink: 0;
}

.project-add-task-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-md);
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}
.project-add-task-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* Priority slider */
.priority-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    margin: 8px 0;
}
.priority-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--neon);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 0 6px var(--accent-glow);
}
.priority-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--neon);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 0 6px var(--accent-glow);
}
.priority-label {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-left: 6px;
}

/* Type toggle */
.type-toggle {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    height: 36px;
}
.type-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0 10px;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.type-btn:last-child { border-right: none; }
.type-btn.selected {
    background: var(--neon);
    color: var(--bg);
    font-weight: 600;
}
.type-btn:hover:not(.selected) {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}

/* Budget row */
.budget-row {
    display: flex;
    gap: 4px;
}
.budget-row input {
    flex: 1;
    min-width: 0;
}
.budget-period-select {
    width: 60px;
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 6px 4px;
}

/* Project link buttons */
.project-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    text-decoration: none;
    transition: all 0.15s;
}
.project-link-btn:hover {
    border-color: var(--neon);
    color: var(--neon);
    background: var(--accent-faint);
}

/* Link input row */
.link-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.link-input-row input {
    flex: 1;
    min-width: 0;
}
.link-input-icon {
    font-size: var(--fs-lg);
    flex-shrink: 0;
}

/* Task assignee selector */
.task-assignee-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 4px 0 8px;
    max-height: 160px;
    overflow-y: auto;
    padding: 2px;
}
.assignee-search {
    width: 100%;
    padding: 5px 8px;
    margin: 4px 0 4px;
    font-size: 0.78rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    box-sizing: border-box;
}
.assignee-search:focus {
    outline: none;
    border-color: var(--accent);
}
.task-assignee-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.task-assignee-chip:hover {
    border-color: var(--text-secondary);
}
.task-assignee-chip.selected {
    border-color: var(--chip-color, var(--neon));
    background: var(--accent-faint);
    color: var(--text-primary);
}
.task-blockedby-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 4px 0 8px;
    max-height: 120px;
    overflow-y: auto;
}
.task-blockedby-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.72rem;
    color: var(--text-muted);
    transition: all 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.task-blockedby-chip:hover { border-color: var(--text-secondary); }
.task-blockedby-chip.selected {
    border-color: var(--red);
    background: rgba(248, 113, 113, 0.1);
    color: var(--text);
}
.task-blockedby-prio {
    font-size: 0.65rem;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}
.task-assignee-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
}

.project-zone-collabs {
    display: flex;
}

.collab-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: var(--bg);
    margin-left: -4px;
    border: 2px solid var(--bg-card);
    position: relative;
    z-index: 1;
}

.collab-avatar:first-child { margin-left: 0; }

.project-zone.critical-priority {
    border-color: var(--neon);
    box-shadow: 0 0 8px var(--accent-dim);
}

.project-zone.critical-priority:hover {
    box-shadow: 0 0 16px var(--accent-glow);
}

.project-zone-econ {
    font-size: 10px;
    font-weight: 600;
}

.econ-positive { color: var(--green); }
.econ-deal { color: var(--neon); }
.econ-ownership { color: var(--blue); opacity: 0.8; }
.econ-negative { color: var(--red); }


/* Resize handles for projects — 4 edges + 4 corners */
.project-resize-handle {
    position: absolute;
    z-index: 11;
}
.project-resize-handle.h-n  { top: 0;     left: 12px;  right: 12px; height: 4px; cursor: ns-resize; }
.project-resize-handle.h-s  { bottom: 0;  left: 12px;  right: 12px; height: 4px; cursor: ns-resize; }
.project-resize-handle.h-e  { right: 0;   top: 12px;   bottom: 12px; width: 4px; cursor: ew-resize; }
.project-resize-handle.h-w  { left: 0;    top: 12px;   bottom: 12px; width: 4px; cursor: ew-resize; }
.project-resize-handle.h-ne { top: 0;     right: 0;    width: 12px; height: 12px; cursor: nesw-resize; }
.project-resize-handle.h-nw { top: 0;     left: 0;     width: 12px; height: 12px; cursor: nwse-resize; }
.project-resize-handle.h-se { bottom: 0;  right: 0;    width: 12px; height: 12px; cursor: nwse-resize; }
.project-resize-handle.h-sw { bottom: 0;  left: 0;     width: 12px; height: 12px; cursor: nesw-resize; }

.project-resize-handle.h-se::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s;
}
.project-zone:hover .project-resize-handle.h-se::after { opacity: 1; }

/* Add project button inside area */
/* Collab avatars floating on top of project */
.project-zone-wrapper {
    position: absolute;
}

.project-collabs-top {
    display: flex;
    gap: 2px;
    margin-bottom: -6px;
    padding-left: 8px;
    position: relative;
    z-index: 5;
}

.collab-avatar-top {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: var(--bg);
    border: 2px solid var(--bg);
    cursor: pointer;
    transition: transform 0.15s;
    position: relative;
    z-index: 5;
}

.collab-avatar-top:hover {
    transform: scale(1.3);
    z-index: 10;
}
.collab-avatar-top.owner-avatar {
    border-color: var(--accent);
}

/* Collab selector with roles in project form */
.collab-selector {
    max-height: 200px;
    overflow-y: auto;
    padding: 2px;
}
.collab-chip-role {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
    opacity: 0.5;
}

.collab-chip-role.selected {
    border-color: var(--accent);
    opacity: 1;
    background: var(--accent-dim);
}

.collab-chip-header {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: var(--fs-base);
    color: var(--text);
}

.collab-role-input {
    width: 100%;
    padding: 4px 6px;
    font-size: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
}

.collab-chip-role:not(.selected) .collab-role-input {
    display: none;
}

.add-project-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 18px;
    font-weight: 700;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.add-project-btn:hover {
    opacity: 1;
}

/* ============ FEATURED PANE ============ */
.featured-hint {
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.7;
}

#featuredList {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
#featuredList::-webkit-scrollbar { width: 4px; }
#featuredList::-webkit-scrollbar-track { background: transparent; }
#featuredList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.featured-empty {
    margin: 12px 12px;
    padding: 22px 12px;
    color: var(--text-muted);
    text-align: center;
    font-size: 11px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, color 0.15s;
}

/* Drop-target highlight while a task is being dragged */
#featuredPane.drop-zone-active { outline: 1px dashed var(--border); outline-offset: -4px; }
#featuredPane.drop-zone-active .featured-empty { border-color: var(--text-dim); color: var(--text-dim); }
#featuredPane.drop-target {
    outline: 2px dashed #f5c842;
    outline-offset: -4px;
    background: rgba(245,200,66,0.08);
}
#featuredPane.drop-target .featured-empty { border-color: #f5c842; color: #f5c842; }

/* X button to remove a task from featured */
.featured-task { position: relative; }
.featured-task-remove {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.featured-task:hover .featured-task-remove { opacity: 1; }
.featured-task-remove:hover { color: var(--red, #ff5a5a); background: rgba(255,90,90,0.12); }

/* ============ TODO SIDEBAR ============ */
#sidebarResizeHandle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
    flex-shrink: 0;
}

#sidebarResizeHandle:hover,
#sidebarResizeHandle.dragging {
    background: var(--accent);
}

#todoSidebar {
    width: var(--sidebar-w);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg);
    flex-shrink: 0;
}

.sidebar-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.sidebar-resize-v {
    height: 2px;
    cursor: row-resize;
    background: var(--border);
    transition: background 0.15s;
    flex-shrink: 0;
}
.sidebar-resize-v:hover,
.sidebar-resize-v.dragging {
    background: var(--accent);
}

#calendarPane {
}

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

.sidebar-header h2 {
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text);
}

#taskFilters {
    display: flex;
    padding: 8px 16px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
}

.filter-btn {
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--text-dim); color: var(--text); }
.filter-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
#focusBtn { white-space: nowrap; }
.btn-inline { background: none; border: none; color: var(--accent); font-family: inherit; font-size: 10px; cursor: pointer; padding: 0; margin-left: 6px; }
#focusBtn.active { border-color: var(--red); color: var(--red); background: rgba(248,113,113,0.15); }

/* Focus mode: dim non-critical projects */
.focus-mode .project-zone-wrapper { opacity: 0.12; pointer-events: none; transition: opacity 0.3s; }
.focus-mode .project-zone-wrapper.focus-visible { opacity: 1; pointer-events: auto; }

.task-blocks-badge {
    font-size: var(--fs-xs);
    padding: 2px 6px;
    border-radius: var(--radius);
    background: rgba(248,113,113,0.15);
    color: var(--red);
    white-space: nowrap;
    flex-shrink: 0;
}

.task-recur {
    font-size: var(--fs-sm);
    color: var(--accent);
    margin-left: 4px;
    opacity: 0.7;
}

.due-date-shortcuts {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.btn-tiny {
    font-family: inherit;
    font-size: var(--fs-xs);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-tiny:hover {
    border-color: var(--accent);
    color: var(--accent);
}

#taskList {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

#taskList::-webkit-scrollbar { width: 4px; }
#taskList::-webkit-scrollbar-track { background: transparent; }
#taskList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============ CALENDAR ============ */
.calendar-view-toggle { display: flex; gap: 4px; }

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    border-bottom: 1px solid var(--border);
}

.calendar-nav span {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#calendarContent {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

#calendarContent::-webkit-scrollbar { width: 4px; }
#calendarContent::-webkit-scrollbar-track { background: transparent; }
#calendarContent::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.cal-day-header {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-dim);
    text-align: center;
    padding: 6px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    position: relative;
}

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

.cal-day-num {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1;
    margin-bottom: 2px;
}

.cal-day.today .cal-day-num {
    color: var(--accent);
    font-weight: 700;
}

.cal-day.other-month .cal-day-num { color: var(--border); }

.cal-day-dots {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
}

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

.cal-dot.overdue { background: var(--accent); opacity: 0.35; }
.cal-dot.done { background: var(--accent); opacity: 0.2; }
.cal-dot.event { background: var(--accent); opacity: 0.6; }

/* Day detail modal */
.day-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.day-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 380px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

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

.day-modal-header h3 {
    margin: 0;
    font-size: var(--fs-md);
    color: var(--text);
    font-weight: 600;
}

.day-modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.day-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.day-modal-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.day-modal-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

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

.day-modal-item.done .day-modal-item-title {
    text-decoration: line-through;
    opacity: 0.4;
}

.day-modal-item .task-checkbox {
    width: 16px;
    height: 16px;
    font-size: 9px;
    flex-shrink: 0;
}

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

.day-modal-item-title {
    font-size: var(--fs-sm);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-modal-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.day-modal-item-time {
    font-size: var(--fs-xs);
    color: var(--text-dim);
}

.day-modal-item-project {
    font-size: var(--fs-xs);
    color: var(--accent);
    opacity: 0.8;
}

.day-modal-item .cal-event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue);
    flex-shrink: 0;
}

.day-modal-footer {
    padding: 8px 12px 12px;
    border-top: 1px solid var(--border);
}

.day-modal-add-btn {
    width: 100%;
    padding: 8px;
    background: var(--accent-faint);
    border: 1px dashed var(--accent-border);
    border-radius: var(--radius);
    color: var(--accent);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.day-modal-add-btn:hover {
    background: var(--accent-subtle);
}

.day-modal-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-dim);
    font-size: var(--fs-sm);
}

/* Calendar week view */
.cal-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cal-week-day {
    background: var(--bg-card);
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.cal-week-day.today {
    background: var(--accent-faint);
}

.cal-week-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px 4px;
    cursor: pointer;
    gap: 1px;
}

.cal-week-day-header:hover {
    background: var(--bg-hover);
}

.cal-week-day-name {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-week-day-num {
    font-size: var(--fs-xl);
    font-weight: 300;
    color: var(--text-dim);
}

.cal-week-day-num.today {
    color: var(--accent);
    font-weight: 700;
}

.cal-week-day-items {
    flex: 1;
    padding: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.cal-week-item {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--fs-xs);
    line-height: 1.3;
}

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

.cal-week-item .cal-event-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--blue);
    flex-shrink: 0;
}

.cal-week-item-time {
    color: var(--text-dim);
    font-size: 8px;
    flex-shrink: 0;
}

.cal-week-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.cal-week-item.task .task-checkbox {
    width: 12px;
    height: 12px;
    font-size: 7px;
    flex-shrink: 0;
}

.cal-week-item.done .cal-week-item-title {
    text-decoration: line-through;
    opacity: 0.4;
}

/* Calendar list view */
.cal-list { padding: 4px 0; }

.cal-list-date {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    padding: 8px 16px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-list-date.today-label { color: var(--accent); }

.cal-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

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

.cal-list-item .task-checkbox {
    width: 14px;
    height: 14px;
    font-size: 8px;
}

.cal-list-item-title {
    font-size: var(--fs-sm);
    color: var(--text);
    flex: 1;
}

.cal-list-item.done .cal-list-item-title {
    text-decoration: line-through;
    color: var(--text-dim);
}

.cal-list-item-project {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.cal-event-item {
    opacity: 0.9;
    cursor: pointer;
}
.cal-event-item:hover {
    opacity: 1;
    background: rgba(255,255,255,0.05);
}

.cal-event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue);
    flex-shrink: 0;
}

.cal-event-time {
    font-size: var(--fs-xs);
    color: var(--text-dim);
    margin-left: auto;
    flex-shrink: 0;
}

.cal-no-events {
    padding: 20px 16px;
    color: var(--text-muted);
    text-align: center;
    font-size: var(--fs-sm);
}

.task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 4px 8px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 8px;
    background: var(--bg-card);
}

.task-item:hover { filter: brightness(1.15); }

.task-item.done { opacity: 0.75; }
.task-item.task-overdue { border-left-color: var(--red); }
.task-item.task-due-today { border-left-color: var(--orange); }
.task-due.overdue { color: var(--red); font-weight: 600; }
.task-due.due-today { color: var(--orange); font-weight: 600; }
.task-due.due-soon { color: var(--accent); }
.task-meta-project { cursor: pointer; }
.task-meta-project:hover { color: var(--accent); text-decoration: underline; }

.task-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    background: transparent;
    color: transparent;
    font-size: 10px;
}

.task-checkbox:hover { border-color: var(--accent); }
.task-checkbox.checked {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--bg);
}

.task-prio-num {
    font-size: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

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

.task-title {
    font-size: var(--fs-base);
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.task-item.task-urgent .task-title {
    font-weight: 700;
}

.task-item.task-critical-project .task-title {
    color: var(--neon);
}

.sidebar-panel-config { display: flex; flex-direction: column; gap: 4px; }
.sidebar-panel-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); cursor: grab; user-select: none; }
.sidebar-panel-item:active { cursor: grabbing; }
.sidebar-panel-item .drag-handle { color: var(--text-muted); font-size: var(--fs-base); }
.sidebar-panel-item label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: var(--fs-base); flex: 1; }
.sidebar-panel-item.dragging { opacity: 0.4; }
.sidebar-panel-item.drag-over { border-color: var(--accent); }

.pz-note { display: flex; align-items: flex-start; gap: 4px; font-size: 10px; padding: 1px 0; color: var(--text-dim); cursor: pointer; }
.pz-note-icon { font-size: var(--fs-xs); flex-shrink: 0; }
.pz-note-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-zone-notes { margin-top: 4px; padding-top: 4px; border-top: 1px dashed rgba(200,255,0,0.1); }

.note-item { padding: 8px 16px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid rgba(42, 42, 58, 0.3); }
.note-item:hover { background: var(--accent-faint); }
.note-content { font-size: var(--fs-base); color: var(--text); line-height: 1.4; white-space: pre-wrap; }
.note-meta { font-size: 10px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; }

.task-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.task-priority-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.task-assignee-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 700;
    color: #fff;
    margin-right: 2px;
}

/* ============ ZOOM CONTROLS ============ */
.header-zoom {
    display: flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px;
    margin-left: 4px;
}
.zoom-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    font-size: var(--fs-xl);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    font-family: inherit;
}
.zoom-btn:hover {
    background: var(--accent-subtle);
    color: var(--neon);
}
.zoom-level {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 36px;
    text-align: center;
    user-select: none;
}

/* ============ AI CHAT ============ */
.ai-chat {
    position: fixed;
    bottom: 8px;
    left: 8px;
    width: 320px;
    background: var(--bg-modal);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    transition: height 0.25s ease;
}

.ai-chat.collapsed .ai-chat-body { display: none; }
.ai-chat.collapsed { width: auto; }
.ai-chat.collapsed .ai-chat-header-actions { display: none; }
.ai-chat.collapsed .ai-chat-header { border-bottom: none; }

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    user-select: none;
}

.ai-chat-title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text);
}

.ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-settings {
    font-size: var(--fs-lg);
    color: var(--text-dim);
    opacity: 0.6;
    transition: opacity 0.2s;
    cursor: pointer;
    padding: 2px 4px;
    position: relative;
    z-index: 1;
}

.ai-chat-settings:hover {
    opacity: 1;
}

.ai-chat-collapse {
    font-size: 10px;
    color: var(--text-dim);
    transition: transform 0.2s;
}

.ai-chat-body {
    display: flex;
    flex-direction: column;
    height: 450px;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.ai-chat-msg {
    font-size: var(--fs-base);
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: var(--radius);
    max-width: 90%;
    word-wrap: break-word;
}

.ai-chat-msg.user {
    background: var(--accent-dim);
    color: var(--accent);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-chat-msg.ai {
    background: var(--bg-hover);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.ai-chat-msg.ai.typing {
    color: var(--text-dim);
    font-style: italic;
}

.ai-chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ai-chat-option-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 6px;
    padding: 4px 10px;
    font-family: inherit;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ai-chat-option-btn:hover {
    background: var(--accent);
    color: var(--bg);
}

.ai-chat-option-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.due-quick-select {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.due-quick-btn {
    padding: 4px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    font-size: var(--fs-base);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.due-quick-btn:hover {
    background: var(--surface3);
    color: var(--text);
}
.due-quick-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
}

.ai-chat-input-row {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
}

.ai-chat-input-row input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: var(--fs-base);
    color: var(--text);
    outline: none;
}

.ai-chat-input-row input:focus { border-color: var(--accent); }

.ai-chat-input-row .btn-icon {
    width: 30px;
    height: 30px;
    font-size: var(--fs-lg);
}

/* ============ ARCHIVE DROP ============ */
.archive-drop {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    border: 1.5px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    opacity: 0.4;
    transition: all 0.2s;
    z-index: 5;
    cursor: default;
}
.archive-drop .archive-icon { font-size: 20px; line-height: 1; }
.archive-drop .archive-label { font-size: 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.archive-drop.drag-hover {
    opacity: 1;
    border-color: var(--neon);
    background: var(--accent-faint);
    transform: scale(1.15);
    box-shadow: 0 0 20px var(--accent-dim);
}

.area-zone.area-drop-target {
    outline: 2px dashed var(--neon);
    outline-offset: -2px;
    background: var(--accent-faint);
}

/* ============ ANNOTATIONS ============ */
.annotation {
    position: absolute;
    cursor: grab;
    user-select: none;
    z-index: 100;
    white-space: nowrap;
    font-family: inherit;
}
.annotation:hover .annotation-delete,
.annotation:hover .annotation-resize {
    opacity: 1;
}
.annotation-content {
    outline: none;
    min-width: 20px;
    display: inline-block;
    cursor: text;
}
.annotation-content:focus {
    cursor: text;
    border-bottom: 1px solid currentColor;
    opacity: 1;
}
.annotation-delete {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--red);
    font-size: var(--fs-base);
    cursor: pointer;
    margin-left: 4px;
    padding: 0 2px;
    vertical-align: top;
    transition: opacity 0.15s;
}
.annotation-resize {
    opacity: 0;
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 10px;
    height: 10px;
    cursor: nwse-resize;
    background: currentColor;
    border-radius: 2px;
    transition: opacity 0.15s;
}
.btn-small.active-mode {
    background: var(--neon);
    color: var(--bg);
}

/* Annotation toolbar (color picker on hover) */
.annotation-toolbar {
    display: none;
    position: absolute;
    top: 100%;
    left: -4px;
    padding-top: 6px;
    z-index: 20;
}
.annotation-toolbar-dots {
    display: flex;
    gap: 4px;
    padding: 5px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.annotation:hover .annotation-toolbar {
    display: block;
}
.annot-color-opt {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: transform 0.1s;
    flex-shrink: 0;
}
.annot-color-opt:hover {
    transform: scale(1.3);
    border-color: rgba(255,255,255,0.4);
}

/* Emoji picker */
.emoji-picker {
    position: fixed;
    display: none;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 1000;
    max-width: 240px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.emoji-option {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    transition: all 0.1s;
}
.emoji-option:hover {
    background: var(--accent-subtle);
}
.emoji-option.selected {
    border-color: var(--neon);
    background: var(--accent-subtle);
}

/* ============ MODALS ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
    display: none;
    width: 400px;
    max-height: 80vh;
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    flex-direction: column;
}

.modal.show { display: flex; }

.modal-wide { width: 780px; max-width: 90vw; height: 80vh; }

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

.modal-header h3 {
    font-size: var(--fs-lg);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
}
.modal-body::-webkit-scrollbar { display: none; }

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

label {
    font-size: var(--fs-sm);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-base);
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236a6a7a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

select option { background: var(--bg-modal); }

.btn-primary {
    padding: 7px 16px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--bg);
    font-family: inherit;
    font-size: var(--fs-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover { filter: brightness(0.85); }

.btn-secondary {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: var(--fs-base);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover { border-color: var(--text-dim); color: var(--text); }

.btn-danger {
    padding: 7px 16px;
    border: 1px solid var(--red);
    border-radius: var(--radius);
    background: transparent;
    color: var(--red);
    font-family: inherit;
    font-size: var(--fs-base);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover { background: rgba(248, 113, 113, 0.15); }

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

.form-col { flex: 1; display: flex; flex-direction: column; gap: 4px; }

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

.icon-option {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: var(--fs-xl);
    transition: all 0.2s;
}

.icon-option:hover, .icon-option.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-option:hover { transform: scale(1.15); }
.color-option.selected { border-color: var(--text); transform: scale(1.15); }

/* Collab selector */
.collab-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.collab-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dim);
}

.collab-chip:hover { border-color: var(--text-dim); }
.collab-chip.selected { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.collab-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}


/* Settings */
.settings-grid {
    margin-top: 8px;
}
.settings-grid-header {
    display: grid;
    grid-template-columns: 1fr 50px 50px;
    gap: 8px;
    padding: 4px 10px;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.settings-grid-header span:not(:first-child) {
    text-align: center;
}
.settings-grid-row {
    display: grid;
    grid-template-columns: 1fr 50px 50px;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: var(--fs-base);
    color: var(--text);
    transition: border-color 0.15s;
}
.settings-grid-row:hover { border-color: var(--text-dim); }
.proactive-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: var(--fs-base);
}
.proactive-item:hover { border-color: var(--text-dim); }
.proactive-item-info { flex: 1; min-width: 0; }
.proactive-item-prompt { display: block; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proactive-item-meta { display: block; font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.proactive-item-actions { display: flex; gap: 2px; flex-shrink: 0; }
.proactive-templates { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.proactive-tpl {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: var(--fs-base);
}
.proactive-tpl:hover { border-color: var(--text-dim); }
.proactive-tpl-active { border-style: solid; opacity: 0.5; }
.proactive-tpl-text { flex: 1; color: var(--text); min-width: 0; }
.proactive-tpl-meta { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.proactive-tpl-badge { font-size: var(--fs-xs); color: var(--neon); text-transform: uppercase; letter-spacing: 0.5px; }
.proactive-add-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.proactive-add-form input[type="text"] { min-width: 0; }
.settings-grid-row input[type="checkbox"] {
    justify-self: center;
}
.settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.setting-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    font-size: var(--fs-base);
    color: var(--text);
}

.setting-toggle:hover { border-color: var(--text-dim); }

.setting-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.setting-toggle input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

/* Settings tabs */
.settings-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.settings-tabs {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    padding: 8px 0;
    flex-shrink: 0;
    width: 140px;
}

.settings-tab {
    background: none;
    border: none;
    padding: 10px 16px;
    font-family: inherit;
    font-size: var(--fs-md);
    color: var(--text-dim);
    cursor: pointer;
    border-left: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.15s;
    text-transform: lowercase;
    text-align: left;
}

.settings-tab:hover { color: var(--text); background: var(--bg-hover); }

.settings-tab.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-dim);
}

.settings-page { display: none; }
.settings-page.active { display: block; }

.api-key-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.api-key-row input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: var(--fs-base);
    color: var(--text);
    outline: none;
}

.api-key-row input:focus { border-color: var(--accent); }

.api-key-status {
    font-size: var(--fs-sm);
    color: var(--neon);
    margin-top: 8px;
}

.calendar-connect-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.calendar-status {
    font-size: var(--fs-base);
    color: var(--text-dim);
}

.collab-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.collab-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.collab-list-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #000;
    flex-shrink: 0;
}

.collab-list-info {
    flex: 1;
    min-width: 0;
}

.collab-list-name {
    font-size: var(--fs-base);
    color: var(--text);
    font-weight: 500;
}

.collab-list-email {
    font-size: 10px;
    color: var(--text-dim);
}

.collab-list-delete {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: var(--fs-lg);
    padding: 4px;
    transition: color 0.15s;
}

.collab-list-delete:hover { color: var(--red); }

.collab-list-item { cursor: pointer; transition: border-color 0.15s; }
.collab-list-item:hover { border-color: var(--text-dim); }
.collab-list-item.editing { border-color: var(--accent); }

.collab-add-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.collab-add-title {
    font-size: var(--fs-sm);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.settings-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: var(--fs-base);
    color: var(--text);
    outline: none;
    margin-top: 4px;
}

.settings-input:focus { border-color: var(--accent); }

.settings-zoom-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.settings-hint {
    font-size: var(--fs-sm);
    color: var(--text-dim);
    margin-top: 8px;
    line-height: 1.5;
}

.tg-step {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.tg-step:last-of-type { border-bottom: none; }

.tg-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    font-size: var(--fs-base);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tg-step-content {
    flex: 1;
    min-width: 0;
}
.tg-step-content label {
    font-size: var(--fs-base);
    font-weight: 600;
    margin-bottom: 2px;
}
.tg-step-content .settings-hint {
    margin-top: 2px;
}
.tg-step-content code {
    background: var(--surface);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
}

.setting-toggle input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -1px;
    left: 2px;
    font-size: 10px;
    color: var(--bg);
    font-weight: 700;
}

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

/* The modal body becomes a two-column flex row.
   Both columns scroll independently and fill the full height. */
#projectDetailModal .modal-body {
    padding: 0;
    overflow: hidden;
}
#projectDetailModal .modal-body .pd-wrap {
    display: flex;
    gap: 0;
    height: calc(80vh - 110px); /* modal 80vh minus header+footer */
}
.pd-left {
    width: 300px;
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 16px;
    border-right: 1px solid var(--border);
}
.pd-right {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 16px;
}
@media (max-width: 700px) {
    #projectDetailModal .modal-body .pd-wrap { flex-direction: column; height: auto; }
    .pd-left { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
}

/* Left column content */
.pd-desc {
    color: var(--text-dim);
    font-size: var(--fs-base);
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 10px 12px;
    border-left: 3px solid var(--accent);
    background: var(--accent-dim);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.pd-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}
.pd-stat {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}
.pd-stat-val {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text);
    text-transform: capitalize;
}
.pd-stat-label {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 2px;
}
.pd-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.pd-section-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pd-collabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pd-collab {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--fs-base);
}
.pd-progress {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-left: 8px;
}
.pd-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s;
}

/* Right column content — task and note list */
.pd-task {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius);
    font-size: var(--fs-base);
    cursor: pointer;
    transition: background 0.1s;
}
.pd-task:hover { background: var(--bg-hover); }
.pd-task.done { opacity: 0.6; }
.pd-task.done .pd-task-title { text-decoration: line-through; color: var(--text-muted); }
.pd-task-title { flex: 1; min-width: 0; word-break: break-word; }
.pd-task .task-checkbox { flex-shrink: 0; margin-top: 1px; }
.pd-task .task-assignee-dot { flex-shrink: 0; }
.pd-date-sep {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 8px 2px;
    margin-top: 4px;
}
.pd-date-group:first-child .pd-date-sep { margin-top: 0; }
.pd-done-divider {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 8px 2px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}
.pd-note {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.1s;
    font-size: var(--fs-base);
    margin-bottom: 6px;
}
.pd-note:hover { background: var(--bg-hover); }
.pd-note-text { color: var(--text); line-height: 1.5; }
.pd-note-date { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }

/* Legacy detail classes (keep for backwards compat) */
.detail-section { margin-bottom: 14px; }
.detail-section h4 { font-size: var(--fs-sm); text-transform: uppercase; color: var(--text-dim); letter-spacing: 0.5px; margin-bottom: 6px; }
.detail-section p, .detail-section span { font-size: var(--fs-base); }
.detail-tasks { display: flex; flex-direction: column; gap: 4px; }
.detail-task { display: flex; align-items: center; gap: 6px; font-size: var(--fs-base); padding: 4px 0; }
.detail-task.done { color: var(--text-muted); text-decoration: line-through; }

.detail-econ-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.detail-econ-item {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.detail-econ-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-econ-value {
    font-size: var(--fs-xl);
    font-weight: 600;
    margin-top: 2px;
}

/* ============ AREA ZONES (spatial, draggable, resizable) ============ */
.area-zone {
    position: absolute;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(18, 18, 26, 0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
    min-width: 220px;
    min-height: 160px;
}

.area-zone:hover {
    box-shadow: 0 0 20px var(--accent-faint);
}

.area-zone-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.area-zone-header:active { cursor: grabbing; }

.area-zone-icon { font-size: var(--fs-xl); }

.area-zone-name {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
}

.area-zone-count {
    font-size: 10px;
    color: var(--text-muted);
}

.area-zone-private {
    font-size: 10px;
    opacity: 0.5;
}

.area-private-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: var(--fs-base);
    color: var(--text-secondary);
    cursor: pointer;
}
.area-private-label input { margin: 0; }

.area-zone-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.area-zone:hover .area-zone-actions { opacity: 1; }

.area-zone-actions button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: var(--fs-xl);
    padding: 4px 8px;
    font-family: inherit;
    border-radius: var(--radius-sm);
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.area-zone-actions button:hover { color: var(--text); background: var(--bg-hover); }

.area-zone-body {
    flex: 1;
    position: relative;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.area-zone-body::-webkit-scrollbar { width: 4px; height: 4px; }
.area-zone-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Resize handles for areas — 4 edges + 4 corners */
.area-resize-handle {
    position: absolute;
    z-index: 11;
}
.area-resize-handle.h-n  { top: 0;     left: 16px;  right: 16px; height: 6px; cursor: ns-resize; }
.area-resize-handle.h-s  { bottom: 0;  left: 16px;  right: 16px; height: 6px; cursor: ns-resize; }
.area-resize-handle.h-e  { right: 0;   top: 16px;   bottom: 16px; width: 6px; cursor: ew-resize; }
.area-resize-handle.h-w  { left: 0;    top: 16px;   bottom: 16px; width: 6px; cursor: ew-resize; }
.area-resize-handle.h-ne { top: 0;     right: 0;    width: 16px; height: 16px; cursor: nesw-resize; }
.area-resize-handle.h-nw { top: 0;     left: 0;     width: 16px; height: 16px; cursor: nwse-resize; }
.area-resize-handle.h-se { bottom: 0;  right: 0;    width: 16px; height: 16px; cursor: nwse-resize; }
.area-resize-handle.h-sw { bottom: 0;  left: 0;     width: 16px; height: 16px; cursor: nesw-resize; }

.area-resize-handle.h-se::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s;
}
.area-zone:hover .area-resize-handle.h-se::after { opacity: 1; }


/* Loading states */
@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.loading { animation: pulse 1.5s infinite; }

@keyframes pulse-highlight {
    0%, 100% { box-shadow: 0 0 4px var(--accent, #c8ff00); }
    50% { box-shadow: 0 0 16px var(--accent, #c8ff00), 0 0 24px var(--accent, #c8ff00); }
}

/* Glow effect on accent elements */
.accent-glow {
    text-shadow: 0 0 10px var(--accent-glow);
}

/* Telegram Chat */
.tg-msg { max-width: 75%; padding: 8px 12px; border-radius: var(--radius-lg); font-size: var(--fs-md); line-height: 1.4; }
.tg-msg-in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.tg-msg-out { align-self: flex-end; background: var(--accent-dim); border: 1px solid var(--accent)30; }
.tg-msg-sender { display: block; font-size: 10px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.tg-msg-text { display: block; color: var(--text); }
.tg-msg-time { display: block; font-size: var(--fs-xs); color: var(--text-dim); text-align: right; margin-top: 2px; }

/* Read-only mode — hide all edit/add/delete controls */
.read-only-mode .add-project-btn,
.read-only-mode #addAreaBtn,
.read-only-mode #addTaskBtn,
.read-only-mode #addNoteBtn,
.read-only-mode #addAnnotationBtn,
.read-only-mode #addEmojiBtn,
.read-only-mode #addCollabBtn,
.read-only-mode #settingsBtn,
.read-only-mode .area-dropdown-wrap,
.read-only-mode .task-check,
.read-only-mode .ai-chat-container,
.read-only-mode #focusBtn { display: none; }
.read-only-mode .project-card { cursor: default; }
body[data-viewing-perm]::after {
    content: attr(data-viewing-label);
    position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
    background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent);
    padding: 4px 16px; border-radius: var(--radius); font-size: var(--fs-sm); font-family: inherit;
    z-index: 9999;
}

/* ============ VAULT TAB (settings modal) ============ */
.vault-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    background: var(--bg-card, transparent);
}
.vault-row:hover {
    border-color: var(--accent);
}
.vault-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.vault-row-name {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vault-row-name:hover {
    color: var(--accent);
}
.vault-row-count {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}
.vault-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.vault-owner-chip {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.vault-owner-chip.self {
    border-color: var(--accent);
    color: var(--accent);
}
.vault-role-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid var(--border);
}
.vault-role-badge.role-admin   { border-color: var(--accent); color: var(--accent); }
.vault-role-badge.role-editor  { border-color: var(--text-dim); color: var(--text-dim); }
.vault-role-badge.role-viewer  { border-color: var(--border); color: var(--text-muted); }
.vault-del-btn {
    color: var(--text-muted);
}
.vault-del-btn:hover {
    color: var(--danger, #ff5555);
}

/* Theme toggle buttons (highlight active) */
.theme-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}
html.theme-light .theme-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.project-zone-wrapper.task-drop-target .project-zone {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
}

/* Area header: colored background (both themes) with white title */
.area-zone-header {
    background: var(--area-c, transparent);
    border-bottom: 1px solid rgba(0,0,0,0.15);
}
.area-zone-header .area-zone-name { color: var(--area-text, #ffffff); text-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.area-zone-header .area-zone-icon,
.area-zone-header .area-zone-count { color: var(--area-text, #ffffff); }
.area-zone-header .area-zone-actions button { color: var(--area-text, #ffffff); opacity: 0.75; }
.area-zone-header .area-zone-actions button:hover { opacity: 1; }

/* ============ LIGHT THEME ============
   Enabled via html.theme-light — overrides only CSS variables
   plus a handful of spots that hard-code colors. Uses
   the mont3.ch light palette.
   ============================================ */
html.theme-light {
    --bg: #f5f3f0;               /* cream page bg */
    --bg-card: #ffffff;          /* card */
    --bg-hover: #eae7e2;         /* hover */
    --bg-modal: #ffffff;         /* modal */
    --border: rgba(26, 26, 46, 0.14);
    --text: #1a1a2e;             /* dark navy body text */
    --text-dim: rgba(26, 26, 46, 0.60);
    --text-muted: rgba(26, 26, 46, 0.42);
    /* Accent vars handled by <head> script + _applyActiveAccent() — not set here */
    --red: #c33a3a;
    --blue: #4a6fa5;
    --purple: #7c3aed;
    --green: #16a34a;
    --orange: #ea580c;
    --pink: #db2777;
    --cyan: #0284c7;

    background: var(--bg);
    color: var(--text);
    color-scheme: light;
}

/* Hard-coded spots that must flip for readability */
html.theme-light .confirm-box .btn-confirm,
html.theme-light .confirm-box .btn-confirm:hover { color: #fff; background: var(--accent); }
html.theme-light .points-animation { color: var(--accent); }
html.theme-light .btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
html.theme-light .btn-primary:hover { background: #3a5a8a; border-color: #3a5a8a; }
html.theme-light .task-assignee-avatar,
html.theme-light .collab-avatar { color: #fff; }
html.theme-light .modal,
html.theme-light .modal-body,
html.theme-light .modal-body textarea,
html.theme-light .modal-body input,
html.theme-light .modal-body select { background: var(--bg-modal); color: var(--text); }
html.theme-light input[type="text"],
html.theme-light input[type="email"],
html.theme-light input[type="password"],
html.theme-light input[type="number"],
html.theme-light input[type="date"],
html.theme-light input[type="file"],
html.theme-light textarea,
html.theme-light select {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}
html.theme-light ::placeholder { color: var(--text-muted); }

/* Canvas / areas / projects */
html.theme-light #canvas { background: var(--bg); }
html.theme-light .area-zone {
    background: color-mix(in srgb, var(--area-c, #cccccc) 6%, #ffffff);
    color: var(--text);
    border: 1px solid var(--area-c, var(--border)) !important;
}
html.theme-light .project-card { background: #ffffff; color: var(--text); border-color: var(--border); }
html.theme-light .project-card:hover { background: #f6f4f0; }

/* Sidebar panes */
html.theme-light #todoSidebar,
html.theme-light #leftSidebar,
html.theme-light .sidebar-pane,
html.theme-light #header { background: var(--bg); color: var(--text); }
html.theme-light .task-item { background: var(--bg-card); border-color: var(--border); opacity: 0.9; }
html.theme-light .task-item:hover { background: var(--bg-hover); opacity: 1; }
html.theme-light .task-item[style*="background"] { background-blend-mode: multiply; }

/* AI chat in light theme */
html.theme-light .ai-chat { background: #f8f8fc; border-color: #ddd; }
html.theme-light .ai-chat-messages { background: #fff; }
html.theme-light .ai-chat-input-row input { background: #fff; border-color: #ddd; color: #1a1a2e; }
html.theme-light .ai-chat-msg.ai { background: #f0f0f5; }
html.theme-light .ai-chat-msg.user { background: var(--accent-dim); }

/* Scrollbars */
html.theme-light * { scrollbar-color: rgba(26,26,46,0.3) transparent; }

/* ============ MOBILE RESPONSIVE ============ */

/* Mobile styles in mobile.css */
