/* Tierdo Styles - Minimal & Notepad-inspired */

/* --- Design tokens ---------------------------------------------- */
/* Theme variables (light default, overridden in [data-theme="dark"]) */
:root {
    /* Backgrounds */
    --bg-primary:   #fefefe;
    --bg-secondary: #f5f5f5;
    --hover-bg:     #ebebeb;
    --border-color: #e5e7eb;

    /* Typography */
    --text-primary:   #2c2c2c;
    --text-secondary: #666;
    --text-muted:     #999;

    /* Brand accent */
    --accent-color:       #4a90e2;
    --accent-color-rgb:   74, 144, 226;
    --accent-color-hover: #3a7bc8;

    /* Status */
    --success-color:     #22c55e;
    --success-color-rgb: 34, 197, 94;
    --success-text:      #2e7d32;    /* badge/label text � dark green in light mode */
    --danger-color:      #ef4444;
    --danger-color-rgb:  239, 68, 68;
    --danger-color-hover: #dc2626;
    --danger-text:       #c62828;    /* badge/label text � dark red in light mode */

    /* UI chrome */
    --locked-color:          #ccc;
    --sidebar-bg:            #1e1e1e;
    --overlay-bg:            rgba(0, 0, 0, 0.5);
    --overlay-bg-strong:     rgba(0, 0, 0, 0.6);
    --shadow:                0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg:             0 4px 12px rgba(0,0,0,0.12);
    --tint-subtle:           rgba(0, 0, 0, 0.06);
    --tint-medium:           rgba(0, 0, 0, 0.1);
    --scrollbar-thumb:       rgba(0, 0, 0, 0.15);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.3);

    /* Card / list tints */
    --card-tint:       rgba(250, 251, 255, 0.5);
    --card-tint-hover: rgba(250, 251, 255, 0.8);

    /* Group colour palette */
    --color-red:        #e74c3c;
    --color-orange:     #e67e22;
    --color-yellow:     #f39c12;
    --color-green:      #27ae60;
    --color-blue:       #3498db;
    --color-purple:     #9b59b6;
    --color-purple-rgb: 155, 89, 182;
    --color-pink:       #e91e63;

    /* Accent RGB companions */
    --amber-color-rgb:  255, 193, 7;
    --indigo-color-rgb: 99, 102, 241;

    /* Premium */
    --premium-color:       #b07d1a;
    --premium-color-hover: #d4a017;
    --premium-bg:          #fffbef;
    --premium-bg-to:       #fff8e1;
    --premium-btn-from:       #f5a623;
    --premium-btn-hover-from: #e09518;
    --premium-btn-hover-to:   #b8880f;

    /* Indigo (AI / assistant) */
    --indigo-color:       #5568d3;
    --indigo-color-hover: #4a5bbf;
}

/* Dark mode overrides � shared between all dark themes */
[data-theme="dark"],
[data-theme="dark-navy"],
[data-theme="game-ui"] {
    --success-text:   #4ade80;
    --danger-text:    #f87171;
    --locked-color:   #444;
    --overlay-bg:     rgba(0, 0, 0, 0.65);
    --shadow:         0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg:      0 4px 12px rgba(0,0,0,0.6);
    --tint-subtle:           rgba(255, 255, 255, 0.08);
    --tint-medium:           rgba(255, 255, 255, 0.12);
    --scrollbar-thumb:       rgba(255, 255, 255, 0.15);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
    --card-tint:       rgba(255, 255, 255, 0.04);
    --card-tint-hover: rgba(255, 255, 255, 0.07);
    --premium-bg:    #1c1500;
    --premium-bg-to: #1f1600;
}

/* Dark */
[data-theme="dark"] {
    --bg-primary:     #161616;
    --bg-secondary:   #1e1e1e;
    --hover-bg:       #2a2a2a;
    --border-color:   #2e2e2e;
    --text-primary:   #e8e8e8;
    --text-secondary: #aaa;
    --text-muted:     #666;
    --sidebar-bg:     #0f0f0f;
}

/* Dark Navy */
[data-theme="dark-navy"] {
    --bg-primary:     #0f141b;
    --bg-secondary:   #161b22;
    --hover-bg:       #1c2128;
    --border-color:   #21262d;
    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;
    --sidebar-bg:     #010409;
}

/* Game UI Database */
[data-theme="game-ui"] {
    --bg-primary:         #12101e;
    --bg-secondary:       #1c1930;
    --hover-bg:           #231d38;
    --border-color:       #2d2848;
    --text-primary:       #e4dff8;
    --text-secondary:     #9b93c4;
    --text-muted:         #5e587a;
    --sidebar-bg:         #0d0b18;
    --accent-color:       linear-gradient(-145deg, #FE57A7 -409%, #664ebe 50%);
    --accent-color-rgb:   124, 92, 191;
    --accent-color-hover: #6a4daa;
    --success-text:       #a3e635;
    --locked-color:       #3d3860;
}

/* Animations */
@keyframes toastSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(8px); }
}

.app-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 10px 14px 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
}

.app-toast.app-toast-show {
    opacity: 1;
    animation: toastSlideUp 0.22s ease forwards;
    pointer-events: auto;
}

.app-toast.app-toast-hide {
    animation: toastFadeOut 0.2s ease forwards;
}

.app-toast-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    min-height: unset;
    min-width: unset;
    box-shadow: none;
    flex-shrink: 0;
}

.app-toast-close:hover {
    color: #fff;
    transform: none;
    box-shadow: none;
}

.app-toast-undo {
    background: none;
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 5px;
    padding: 2px 9px;
    cursor: pointer;
    min-height: unset;
    min-width: unset;
    box-shadow: none;
    flex-shrink: 0;
    transition: background 0.15s;
}

.app-toast-undo:hover {
    background: rgba(255,255,255,0.15);
    transform: none;
    box-shadow: none;
}

@keyframes taskSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.task.task-new {
    animation: taskSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    overscroll-behavior-y: none;
    overflow-x: hidden;
}

/* App Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    margin-left: 60px;
    transition: margin-left 0.3s ease;
}

.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 0;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h2 {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.sidebar-logo {
    height: 26px;
    width: auto;
    image-rendering: auto;
    shape-rendering: geometricPrecision;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Mobile top bar - hidden on desktop */
.mobile-topbar {
    display: none;
}

/* Hamburger menu button - mobile only, hidden on desktop */
.btn-hamburger {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    font-size: 20px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-hamburger:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

/* Close sidebar button - hidden on desktop, visible on mobile */
.btn-close-sidebar {
    display: none;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 20px;
}

.btn-close-sidebar:hover {
    background: var(--tint-subtle);
    color: var(--text-primary);
}

.sidebar-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
}

.btn-add-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border: none;
    background: var(--accent-color);
    color: white;
    cursor: pointer;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
}

.btn-add-group:hover {
    background: var(--accent-color-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--accent-color-rgb), 0.3);
}

.btn-add-group i {
    font-size: 14px;
}

.sidebar-header .btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-header .btn-icon:hover {
    background: var(--hover-bg);
    color: var(--accent-color);
}

.sidebar-groups {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.personal-section {
    padding: 12px 0 4px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.tier-section {
    margin-bottom: 24px;
}

.tier-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.tier-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tier-header i {
    font-size: 16px;
}

.btn-tier-add {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
    opacity: 0;
}

.tier-header:hover .btn-tier-add {
    opacity: 1;
}

.btn-tier-add:hover {
    background: var(--hover-bg);
    color: var(--accent-color);
}

.tier-section[data-tier="0"] .tier-header {
    color: var(--color-red);
}

.tier-section[data-tier="1"] .tier-header {
    color: var(--color-yellow);
}

.tier-section[data-tier="2"] .tier-header {
    color: var(--color-purple);
}

.tier-groups {
    min-height: 40px;
}

.sidebar-group {
    padding: 14px 28px;
    margin: 3px 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    user-select: none;
}

body.sidebar-group-dragging .sidebar-group {
    cursor: grabbing;
}

.sidebar-group.sidebar-group-being-dragged {
    opacity: 0.4;
}

.sidebar-group-drop-indicator {
    position: fixed;
    height: 3px;
    border-radius: 2px;
    background: var(--accent-color);
    box-shadow: 0 0 0 1px rgba(var(--accent-color-rgb), 0.25);
    z-index: 100001;
    pointer-events: none;
    display: none;
}

.sidebar-group-drop-indicator::before,
.sidebar-group-drop-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    transform: translateY(-50%);
}

.sidebar-group-drop-indicator::before { left: -4px; }
.sidebar-group-drop-indicator::after { right: -4px; }

.sidebar-group:hover {
    background: var(--hover-bg);
}

.sidebar-group.active {
    background: var(--bg-primary);
    border-left: 4px solid var(--accent-color);
    padding-left: 24px;
}


.sidebar-group.inactive {
    opacity: 0.5;
}

.sidebar-group-content {
    flex: 1;
    min-width: 0;
}

.sidebar-group-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.sidebar-group-count {
    font-size: 13px;
    color: var(--text-muted);
}

.sidebar-group-actions {
    display: none;
    gap: 4px;
}

/* Only reveal actions on real hover (mouse/trackpad). On touch devices the
   first tap would otherwise just show the button rather than select the group. */
@media (hover: hover) {
    .sidebar-group:hover .sidebar-group-actions {
        display: flex;
    }
}

.sidebar-group-actions button {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.sidebar-group-actions button:hover {
    background: var(--border-color);
    color: var(--text-primary);
}


.sidebar-group.uncategorized-group {
    border: 1px dashed var(--border-color);
    margin-top: 12px;
    opacity: 0.8;
}

.sidebar-group.uncategorized-group .sidebar-group-title {
    font-style: italic;
    color: var(--text-muted);
}

.sidebar-group.uncategorized-group:hover,
.sidebar-group.uncategorized-group.active {
    opacity: 1;
}



.main-content {
    flex: 1;
    margin-left: 320px;
    transition: margin-left 0.3s ease;
}

.main-content.full-width {
    margin-left: 0;
}

.sidebar.hidden {
    transform: translateX(-100%);
}


/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--overlay-bg);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.sidebar.hidden ~ .sidebar-overlay {
    opacity: 0;
    visibility: hidden;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 11px;
    border-bottom: 1px dashed var(--border-color);
    margin-bottom: 56px;
}

.logo {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.logo-default {
    height: 25px;
    width: auto;
    image-rendering: auto;
    shape-rendering: geometricPrecision;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.logo-edit-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.logo-group-name {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

/* Breadcrumb navigation when browsing inside tasks */
.logo-breadcrumb-wrapper {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.breadcrumb-link {
    background: none;
    border: none;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--overlay-bg);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
}

.breadcrumb-link:hover {
    background: rgba(var(--color-purple-rgb), 0.08);
    color: var(--accent-color);
}

.breadcrumb-separator {
    font-size: 9px;
    color: var(--text-muted);
    margin: 0 2px;
}

/* Hide tab buttons when browsing inside a task */
.header:has(.logo-breadcrumb-wrapper:not([style*="display: none"])) .tab-buttons {
    display: none;
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-header-view-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    user-select: none;
    white-space: nowrap;
}

.btn-header-view-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-strong, var(--text-muted));
}

.btn-header-view-toggle.active {
    color: var(--accent-color, var(--text-primary));
    border-color: var(--accent-color, var(--border-color));
}

.btn-header-view-toggle.hidden {
    display: none;
}

.view-mode-dropdown-wrap {
    position: relative;
}

.btn-view-options-toggle {
    min-width: 0;
    width: 44px;
    justify-content: center;
    padding: 7px 10px;
}

.view-mode-chevron {
    font-size: 11px;
    opacity: 0.65;
    transition: transform 0.15s;
}

.btn-view-options-toggle.open .view-mode-chevron {
    transform: rotate(180deg);
}

.view-mode-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.12));
    padding: 6px;
    z-index: 500;
    flex-direction: column;
    gap: 2px;
}

.view-mode-dropdown.active {
    display: flex;
}

.view-options-dropdown {
    min-width: 220px;
}

.view-options-checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.view-options-checkbox-row:hover {
    background: var(--tint-subtle);
    color: var(--text-primary);
}

.view-options-checkbox-row input[type="checkbox"] {
    margin: 0;
}


/* Edit Mode Bar - Full height vertical bar */
.edit-mode-bar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 70px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 200;
    box-shadow: 2px 0 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* While dragging inside modal mode, temporarily allow the View Groups bar
   to sit above the inspect overlay backdrop for cross-group drag/drop. */
body.task-dragging-over-modal .edit-mode-bar {
    z-index: 10201;
}

.edit-mode-bar-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    user-select: none;
}

/* Move bar to right edge of sidebar when sidebar is open */
.sidebar:not(.hidden) ~ .app-wrapper .edit-mode-bar,
body:has(.sidebar:not(.hidden)) .edit-mode-bar {
    left: 320px;
    background: var(--bg-secondary);
    border-color: var(--tint-subtle);
    box-shadow: none;
}

/* Change content to show collapse when sidebar is open */
body:has(.sidebar:not(.hidden)) .edit-mode-bar-content {
    color: var(--text-secondary);
}

body:has(.sidebar:not(.hidden)) .edit-mode-bar-content i {
    display: none;
}

body:has(.sidebar:not(.hidden)) .edit-mode-bar-content .edit-word,
body:has(.sidebar:not(.hidden)) .edit-mode-bar-content .tasks-word {
    display: none;
}

body:has(.sidebar:not(.hidden)) .edit-mode-bar-content::after {
    content: '\f053';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 16px;
}

/* Hover effects only on desktop */
@media (min-width: 769px) {
    body:has(.sidebar:not(.hidden)) .edit-mode-bar:hover {
        background: var(--hover-bg);
        border-color: var(--tint-medium);
    }

    body:has(.sidebar:not(.hidden)) .edit-mode-bar:hover .edit-mode-bar-content {
        color: var(--accent-color);
    }

    .edit-mode-bar:hover {
        width: 80px;
        background: var(--hover-bg);
        border-color: var(--accent-color);
    }

    .edit-mode-bar:hover .edit-mode-bar-content {
        color: var(--accent-color);
    }
}

.edit-mode-bar-content i {
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-mode-bar-content .edit-word,
.edit-mode-bar-content .tasks-word {
    letter-spacing: 1.2px;
    text-transform: uppercase;
    line-height: 1;
}

/* User Menu */
.user-menu {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 300;
}

.user-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    color: white;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    box-shadow: var(--shadow);
}

/* Hide group headers when sidebar is visible (edit mode) */
.main-content:not(.full-width) .group-header {
    display: none;
}

.group-header:hover .group-title {
    color: var(--accent-color);
}

.group-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
    transition: color 0.2s;
    flex: 1;
}

.group-title.editable-group-title {
    cursor: pointer;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: 4px;
}

.group-title.editable-group-title:hover {
    color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.05);
}

.group-title-input {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-primary);
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    padding: 4px 8px;
    background: var(--bg-primary);
    width: 100%;
    outline: none;
    font-family: inherit;
}

.group-title-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

.group-actions {
    display: flex;
    align-items: center;
    position: relative;
}

.group-header:hover .group-actions {
    opacity: 1;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--text-primary);
}

.group-tasks {
    padding: 0;
}

/* Add spacing between groups in overview mode only */
.group {
    margin-bottom: 16px;
}

/* Group color variations applied to tasks */
.group[data-color="red"] .task { border-left-color: var(--color-red); }
.group[data-color="orange"] .task { border-left-color: var(--color-orange); }
.group[data-color="yellow"] .task { border-left-color: var(--color-yellow); }
.group[data-color="green"] .task { border-left-color: var(--color-green); }
.group[data-color="blue"] .task { border-left-color: var(--color-blue); }
.group[data-color="purple"] .task { border-left-color: var(--color-purple); }
.group[data-color="pink"] .task { border-left-color: var(--color-pink); }

/* Task */
.task {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    border-left: 4px solid var(--task-color, var(--accent-color));
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

.task.has-children:not(.is-child) {
    margin-top: 10px;
    padding-top: 5px;
    margin-bottom: 10px;
    padding-bottom: 10px;
}

.task-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 16px;
    padding-left: 20px;
    transition: background 0.2s;
    cursor: pointer;
    touch-action: pan-y;
}

/* Parent tasks - more prominent */
.task.has-children > .task-header {
    padding: 2px 16px;
    padding-left: 20px;
}

.task.has-children > .task-header .task-title {
    font-size: 15px;
    font-weight: 500;
}

.task-children {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-left: 28px;
    padding-top: 2px;
    padding-bottom: 2px;
    margin-left: 20px;
}

.task-children > .task {
    width: 100%;
    display: flex;
}

/* Only hide empty task-children when not editing */
.task:not(.editing) .task-children:empty {
    display: none;
}

/* Subtask input wrapper in task-children */
.task-children .subtask-input-wrapper {
    padding: 8px 0;
    margin-left: 20px;
}

.task-children .subtask-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    user-select: text;
    -webkit-user-select: text;
}

.task-children .subtask-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.task-delete-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    flex-shrink: 0;
    margin-left: auto;
    transition: opacity 0.15s, color 0.15s;
}

/* Show delete button only on direct task hover in edit mode */
.task:hover > .task-header .task-delete-btn {
    opacity: 1;
}

/* Hide parent's delete button when hovering over a child task */
.task:has(.task:hover) > .task-header .task-delete-btn {
    opacity: 0;
}

.task-delete-btn:hover {
    color: var(--danger-color);
}

.task-delete-btn i {
    font-size: 14px;
}

.task:last-child {
    border-bottom: none;
}

/* Child tasks - hide left border color strip */
.task.is-child {
    border-left: none;
    border-bottom: none;
}

.task.is-child .task-title {
    font-size: 14px;
    color: var(--text-primary);
}

.task.is-child:last-child {
    margin-bottom: 0;
}

/* Hover behavior:
   - Child hover: ONLY that child highlights
   - Parent hover: ONLY that parent highlights (not children) */

/* Only enable hover effects in edit mode (when sidebar is visible) */
.main-content:not(.full-width) .task:hover > .task-header {
    background: var(--hover-bg);
}

/* When a child task is hovered, reset the parent's background */
.main-content:not(.full-width) .task:not(.editing):has(.task:hover) > .task-header {
    background: white;
}

.task.completed {
    opacity: 0.5;
}

.task.completed .task-title::after {
    content: ' \2014  tap to archive';
    font-size: 11px;
    text-decoration: none;
    display: inline;
    font-style: italic;
    opacity: 0.7;
}

@keyframes letterWaveFade {
    0%   { opacity: 1; transform: translateY(0); }
    25%  { opacity: 0.9; transform: translateY(-7px); }
    55%  { opacity: 0.4; transform: translateY(3px); }
    100% { opacity: 0; transform: translateY(0); }
}

@keyframes checkboxPop {
    0%   { transform: scale(1)    rotate(0deg); }
    15%  { transform: scale(1.15) rotate(-12deg); }
    30%  { transform: scale(1.25) rotate(10deg); }
    45%  { transform: scale(1.35) rotate(-8deg); }
    60%  { transform: scale(1.45) rotate(5deg); }
    75%  { transform: scale(1.6)  rotate(-3deg); }
    88%  { transform: scale(1.9)  rotate(1deg); }
    100% { transform: scale(0)    rotate(0deg); opacity: 0; }
}

.task.locked {
    opacity: 0.4;
}

.task-checkbox {
    align-self: flex-start;
    margin-top: 2px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--locked-color);
    background: var(--bg-primary);
    transition: all 0.2s;
}

.task-goal-star {
    width: 21px;
    height: 28px;
    font-size: 16px;
    flex-shrink: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Goal rows in expanded-list view */
.overview-row-goal.overview-row-child .overview-row-title,
.overview-row-goal.overview-row-task .overview-row-title {
    font-weight: 700;
}
.overview-row-goal-star {
    font-size: 13px;
    flex-shrink: 0;
    color: var(--text-primary);
    margin-right: 2px;
}

/* Hide checkbox for parent tasks */
.task.has-children > .task-header > .task-checkbox {
    display: none;
}

.task-checkbox:checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.task-checkbox:checked::after {
    content: '\2713';
    display: block;
    text-align: center;
    color: white;
    font-size: 16px;
    line-height: 20px;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 14px;
    word-wrap: break-word;
}

.task-title-input {
    font-size: 16px;
    font-family: inherit;
    font-weight: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    padding: 6px 8px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
    user-select: text;
    -webkit-user-select: text;
}

.task-title-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--indigo-color-rgb), 0.1);
}

.task-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
    word-break: break-word;
}

.task-description a {
    color: var(--accent-color);
    text-decoration: underline;
}

.task-description a:hover {
    text-decoration: none;
}

.task.completed .task-title {
    text-decoration: line-through;
}

.task-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-due-date {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Add Task Section */
.add-task-section {
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    padding: 20px 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.add-task-section.hidden {
    display: none;
}

.add-task-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.add-task-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
    transition: color 0.2s;
    z-index: 2;
}

.input-prefix-wrapper {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    pointer-events: none;
}

/* Enable pointer events when input is focused */
#addTaskForm:has(#newTaskInput:focus) .input-prefix-wrapper,
#inspectDetailAddForm:has(#inspectDetailInput:focus) .input-prefix-wrapper {
    pointer-events: auto;
}

.input-prefix {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-color);
    cursor: default;
    user-select: none;
    display: inline-flex;
    align-items: center;
    padding: 4px 8px 4px 0;
    border-radius: 4px;
    transition: background-color 0.2s, cursor 0.2s;
}

.input-prefix i {
    margin-right: 6px;
    font-size: 18px;
}

/* Only show pointer cursor when input is focused */
#addTaskForm:has(#newTaskInput:focus) .input-prefix,
#inspectDetailAddForm:has(#inspectDetailInput:focus) .input-prefix {
    cursor: pointer;
}

#addTaskForm:has(#newTaskInput:focus) .input-prefix:hover,
#inspectDetailAddForm:has(#inspectDetailInput:focus) .input-prefix:hover {
    background-color: rgba(var(--accent-color-rgb), 0.1);
}

.prefix-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--bg-primary);
    border: 2px solid var(--accent-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    min-width: 160px;
    z-index: 2000;
    pointer-events: auto;
}

/* Modal version always flips above the input (input is always at the bottom of the modal) */
.prefix-dropdown.prefix-dropdown-fixed {
    position: absolute;
    top: auto;
    bottom: calc(100% + 4px);
    left: 0;
    margin-top: 0;
    z-index: 12050;
}

.prefix-dropdown.active {
    display: block;
}

.prefix-group-header {
    padding: 8px 16px 4px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    cursor: default;
    user-select: none;
}

.prefix-group-header:first-child {
    border-top: none;
    border-radius: 4px 4px 0 0;
}

.prefix-option {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.prefix-option i {
    margin-right: 8px;
    font-size: 18px;
}

.prefix-option:hover {
    background-color: rgba(var(--accent-color-rgb), 0.1);
    color: var(--accent-color);
}

.prefix-option:last-child {
    border-radius: 0 0 4px 4px;
}

#newTaskInput {
    width: 100%;
    padding: 18px 52px 18px 44px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    transition: all 0.2s;
    background: var(--bg-primary);
}

#newTaskInput:focus {
    border-color: var(--accent-color);
    /* padding-left will be set dynamically by JavaScript */
}

#addTaskForm:has(#newTaskInput:focus) .input-prefix-wrapper,
#inspectDetailAddForm:has(#inspectDetailInput:focus) .input-prefix-wrapper {
    opacity: 1;
}

#newTaskInput:focus ~ .add-task-icon {
    color: var(--accent-color);
}

#addTaskForm:has(#newTaskInput:focus) .add-task-icon {
    color: var(--accent-color);
}

#newTaskInput:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

#addTaskForm.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-color-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-color-hover);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    animation: fadeIn 0.2s;
    touch-action: none;
    overscroll-behavior: none;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s;
    touch-action: pan-y;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    margin-bottom: 24px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-group select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent-color);
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 14px;
}

.subtask-item input[type="checkbox"] {
    cursor: pointer;
}

.subtask-item .subtask-title {
    flex: 1;
}

.subtask-item .delete-subtask {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    font-size: 16px;
}

.subtask-item .delete-subtask:hover {
    color: var(--color-red);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state small {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    /* App wrapper - remove left margin on mobile */
    .app-wrapper {
        margin-left: 0;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Container and layout */
    .container {
        padding: 12px;
    }
    
    .header {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 12px;
        margin-bottom: 20px;
    }
    
    .logo {
        font-size: 24px;
    }
    
    /* Edit mode bar - hidden on mobile (replaced by hamburger button) */
    .edit-mode-bar {
        display: none !important;
    }

    /* Mobile top bar */
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 52px;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        padding: 0 12px;
        z-index: 500;
        box-shadow: var(--shadow);
    }

    .mobile-topbar-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
        letter-spacing: -0.5px;
    }

    /* Hide topbar when any modal or full-screen overlay is open */
    body:has(.modal.show) .mobile-topbar,
    body:has(.inspect-detail-overlay.active:not(.inline-mode)) .mobile-topbar {
        display: none;
    }

    /* Show hamburger button on mobile */
    .btn-hamburger {
        display: flex;
        min-height: unset;
        padding: 0;
        flex-shrink: 0;
    }

    /* Hide the logo/group name from the header on mobile � shown in topbar instead */
    .header .logo {
        display: none;
    }

    /* Center tabs in the header on mobile */
    .header {
        justify-content: center;
    }

    /* Reposition user-menu into topbar on mobile */
    .user-menu {
        top: 8px;
        right: 12px;
        z-index: 600;
    }

    /* Show mobile close button on sidebar */
    .btn-close-sidebar {
        display: flex;
    }
    
    /* Sidebar - full screen overlay on mobile, appears instantly */
    .sidebar {
        width: 100vw;
        max-width: 100vw;
        box-shadow: none;
        z-index: 10000;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        transform: none;
    }
    
    .sidebar.hidden {
        transform: none;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    
    /* Backdrop overlay when sidebar is open */
    body:has(.sidebar:not(.hidden))::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--overlay-bg);
        z-index: 9999;
        pointer-events: auto;
        animation: fadeIn 0.2s ease;
    }
    
    /* Main content - full width on mobile, pushed below topbar */
    .main-content {
        margin-left: 0;
        padding-top: 52px;
        padding-bottom: 20px;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .main-content.full-width {
        margin-left: 0;
        padding-top: 52px;
        padding-bottom: 20px;
        max-width: 100vw;
    }
    
    body:has(.sidebar:not(.hidden)) .main-content {
        padding-bottom: 20px;
        padding-right: 0;
        max-width: 100vw;
    }
    
    /* Container - ensure it doesn't overflow */
    .container {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Touch-friendly buttons and inputs */
    button, .btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 16px;
    }

    /* Task-header buttons must NOT inherit the large min-height - they sit
       inside a row and would inflate every task to 44px+ tall */
    .task-header button,
    .task-delete-btn {
        min-height: unset;
        min-width: unset;
        padding: 0;
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    /* Breadcrumb links must also stay compact */
    .breadcrumb-link,
    .browsing-parent-breadcrumbs .breadcrumb-link {
        min-height: unset;
        min-width: unset;
    }
    
    input, textarea, select {
        font-size: 16px;
        padding: 12px;
    }
    
    .task-checkbox {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        aspect-ratio: 1;
    }
    
    /* Group headers more touch-friendly */
    .group-header {
        padding: 16px;
        min-height: 56px;
    }
    
    .group-title {
        font-size: 20px;
    }
    
    .btn-edit-tasks {
        min-height: 44px;
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* Task items - reduce vertical spacing */
    .task-header {
        padding: 4px 12px;
        padding-left: 14px;
        gap: 10px;
    }
    
    .task.has-children > .task-header {
        padding: 6px 12px;
        padding-left: 14px;
    }
    
    /* Reduce nesting indentation to prevent squashing */
    .task-children {
        padding-left: 12px;
        margin-left: 12px;
        padding-top: 0;
        padding-bottom: 0;
    }
    
    .task-title {
        font-size: 16px;
        line-height: 1.5;
    }
    
    /* Modals full screen on mobile */
    .modal-content {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    /* Add task form */
    .add-task-section {
        padding: 12px;
        position: sticky;
        bottom: 0;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        z-index: 100;
    }
    
    body:has(.sidebar:not(.hidden)) .add-task-section {
        bottom: auto;
    }
    
    /* User dropdown */
    .user-dropdown {
        right: 12px;
        left: 12px;
        min-width: auto;
    }
    
    /* Sidebar groups */
    .sidebar-group {
        padding: 14px 16px;
        min-height: 52px;
    }
    
    /* Prevent zoom on input focus */
    input:focus,
    textarea:focus,
    select:focus {
        font-size: 16px;
    }

    /* -- List view mobile fixes -- */

    /* Don't let the global touch-size rule inflate overview row buttons */
    .btn-overview-row-menu,
    .overview-dropdown-item {
        min-height: unset;
        padding: revert;
        font-size: revert;
    }

    /* Menu button: always visible on touch (no hover to reveal it) */
    .btn-overview-row-menu {
        opacity: 1;
        width: 32px;
        height: 32px;
    }

    /* Restore the compact overview checkbox size (overridden by .task-checkbox mobile rule) */
    .overview-task-checkbox {
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
    }

    /* Tighter indentation on narrow screens */
    .overview-task-list-indented {
        padding-left: 24px;
    }

    /* Add breathing room between mobile rows and increase vertical rhythm. */
    .overview-task-list {
        gap: 4px;
    }

    /* Give each row a comfortable tap target without inflating layout */
    .overview-row {
        padding: 12px 12px;
        min-height: 20px;
        border-radius: 10px;
    }

    .overview-row-main {
        gap: 3px;
    }

    .overview-row-title {
        line-height: 1.45;
    }

    .overview-row-desc {
        line-height: 1.4;
    }
}

.user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.user-initial {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    border: 2px solid var(--border-color);
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.user-info {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.user-info strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.user-info small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--hover-bg);
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-divider {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    margin-right: 6px;
    color: var(--text-secondary);
}

.dropdown-item-premium {
    color: var(--premium-color);
    font-weight: 600;
}

.dropdown-item-premium i {
    color: var(--premium-color-hover);
}

.dropdown-item-premium:hover {
    background: var(--premium-bg);
}

/* Mobile-specific enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .task:hover,
    .btn:hover,
    .dropdown-item:hover {
        background: inherit;
        transform: none;
    }
    
    /* Add active/pressed states for touch feedback ? only the tapped row, not ancestors */
    .task > .task-header:active {
        background: var(--hover-bg);
        border-radius: 8px;
    }
    
    .btn:active {
        transform: scale(0.95);
    }
    
    /* Larger touch targets */
    .task-checkbox {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        aspect-ratio: 1;
    }
    
    /* Better tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* Improve scrolling on iOS */
    .sidebar,
    .main-content,
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }

    /* Overview menu button � always visible on touch (no hover to reveal) */
    .btn-overview-row-menu {
        opacity: 1;
    }
}

/* Landscape mode optimizations for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .edit-mode-bar {
        height: 40px;
    }

    .mobile-topbar {
        height: 40px;
    }

    .main-content,
    .main-content.full-width {
        padding-top: 40px;
    }

    .user-menu {
        top: 2px;
    }
    
    .modal-content {
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .header {
        padding: 8px 12px;
    }
}

/* Small screens (phones) */
@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }
    
    .group-title {
        font-size: 18px;
    }
    
    .browsing-parent-title {
        font-size: 22px !important;
    }
    
    .browsing-parent-description {
        font-size: 13px;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: break-word;
        display: -webkit-box;
        line-clamp: 2;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 0 !important;
        padding: 0px 8px !important;
    }
    
    .header-description-input {
        font-size: 14px;
    }
    
    .browsing-parent-content {
        padding: 10px 14px;
        gap: 4px;
    }

    .browsing-parent-breadcrumbs {
        gap: 2px;
        flex-wrap: wrap;
        line-height: 1.2;
    }

    .browsing-parent-breadcrumbs .breadcrumb-link {
        font-size: 11px;
        min-height: unset;
        padding: 2px 4px;
        line-height: 1.2;
    }
    
    .browsing-parent-breadcrumbs .breadcrumb-separator {
        font-size: 9px;
    }
    
    .btn-back-browsing {
        width: 44px;
        font-size: 18px;
    }


    .browsing-parent-content {
        padding: 9px 10px !important;
    }
    
    .input-prefix-wrapper {
        left: 40px;
    }
    
    .input-prefix {
        font-size: 14px;
    }
    
    .task-title {
        font-size: 15px;
    }
    
    .btn-edit-tasks span {
        display: none;
    }
    
    .btn-edit-tasks::after {
        content: 'EDIT';
    }
}
/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .edit-mode-bar {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .add-task-section {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}



/* Back Button */
.btn-back {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: white;
    font-size: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s;
    margin-right: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateX(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.btn-back:active {
    transform: translateX(-1px) scale(0.97);
}

/* Browsing Parent Header (Inspect tab) */
.browsing-parent-header {
    display: flex;
    flex-direction: row;
    padding: 0;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    overflow: visible;
    position: relative;
}

/* Main content area to the right of the back-button strip */
.browsing-header-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top row: breadcrumbs (left) + trash/X (right) */
.browsing-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 0 16px;
    gap: 8px;
}

.browsing-top-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* Bottom row: notes icon pinned to the right */
.browsing-header-bottom {
    display: flex;
    justify-content: flex-end;
    padding: 4px 6px 8px;
}

.btn-browsing-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    width: 36px;
    height: 32px;
    min-height: unset;
    min-width: unset;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.btn-browsing-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

/* Sidebar toggle button in top bar */
.btn-browsing-sidebar {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 11px;
    height: 24px;
    min-height: unset;
    min-width: unset;
    padding: 0 8px 0 6px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: inherit;
    font-weight: 500;
}

.btn-browsing-sidebar i {
    font-size: 11px;
}

.btn-browsing-sidebar:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--text-muted);
    transform: none;
    box-shadow: none;
}

.btn-browsing-sidebar.active {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.08);
}

/* Delete button in the top bar (left of X) */
.btn-browsing-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 17px;
    width: 36px;
    height: 32px;
    min-height: unset;
    min-width: unset;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.btn-browsing-delete:hover {
    color: var(--danger-color);
    opacity: 1;
    transform: none;
    box-shadow: none;
}

.browsing-menu-wrap {
    position: relative;
}

.btn-browsing-goal-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    width: 32px;
    height: 32px;
    min-height: unset;
    min-width: unset;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.btn-browsing-goal-toggle:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.btn-browsing-goal-toggle.active {
    color: var(--text-primary);
}

.btn-browsing-menu {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    width: 32px;
    height: 32px;
    min-height: unset;
    min-width: unset;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.btn-browsing-menu:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.browsing-parent-dropdown {
    display: none;
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    min-width: 200px;
    z-index: 2000;
    overflow: visible;
    padding: 4px 0;
}

.browsing-parent-dropdown.open {
    display: block;
}

.browsing-dropdown-meta {
    padding: 10px 14px 8px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    letter-spacing: 0.01em;
}

.browsing-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.browsing-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    min-height: unset;
    min-width: unset;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s;
    border-radius: 0;
    box-shadow: none;
}

.browsing-dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.browsing-dropdown-item:hover {
    background: var(--hover-bg);
    transform: none;
    box-shadow: none;
}

.browsing-dropdown-danger {
    color: var(--danger-color);
}

.browsing-dropdown-danger i {
    color: var(--danger-color);
}

.browsing-has-submenu {
    position: relative;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

/* Invisible bridge � keeps :hover alive across the 1px border seam */
.browsing-has-submenu::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 0;
    width: 3px;
    height: 100%;
    display: none;
    pointer-events: all;
}

.browsing-has-submenu:hover::after {
    display: block;
}

.browsing-has-submenu.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.browsing-submenu-chevron {
    font-size: 11px !important;
    color: var(--text-muted) !important;
    width: auto !important;
    margin-left: auto;
}

.browsing-submenu {
    display: none;
    position: absolute;
    left: calc(100% + 2px);
    top: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0 8px 8px 8px;
    box-shadow: 4px 4px 16px rgba(0,0,0,0.14);
    min-width: 140px;
    z-index: 100;
    padding: 4px 0;
}

.browsing-has-submenu:hover .browsing-submenu,
.browsing-submenu:hover {
    display: block;
}

.browsing-convert-btn.active {
    color: var(--accent-color);
    font-weight: 600;
}

.browsing-type-section {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
    padding-bottom: 4px;
}

.browsing-type-section.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.browsing-type-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 14px 2px;
}

.browsing-view-btn.active {
    color: var(--accent-color);
}
.browsing-view-btn.active i {
    color: var(--accent-color);
}
.browsing-view-check {
    margin-left: auto;
    width: auto !important;
    font-size: 11px !important;
    color: var(--accent-color) !important;
}

.inspect-problem-icon {
    width: 18px;
    height: 18px;
    font-size: 18px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

/* Pros & Cons list (inside idea inspect view) */
.pros-cons-wrapper {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.pros-cons-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pros-cons-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
    padding: 0 4px;
}

.pros-cons-heading.pros i { color: var(--success-color); }
.pros-cons-heading.cons i { color: var(--danger-color); }
.pros-cons-heading.ideas i { color: var(--accent-color); }

.expanded-type-badge {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.expanded-list-more-row {
    cursor: pointer;
}
.expanded-list-more-label {
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 500;
    padding: 2px 0;
}
.expanded-list-more-row:hover .expanded-list-more-label {
    text-decoration: underline;
}

.pros-cons-item-idea { border-color: rgba(var(--accent-color-rgb), 0.35); cursor: pointer; }
.pros-cons-item-idea:hover { background: var(--hover-bg); }

.pros-cons-add-idea:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.05);
    transform: none;
}

.pros-cons-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.pros-cons-item-title {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.pros-cons-item-title.completed {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.pros-cons-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px 4px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.pros-cons-item:hover .pros-cons-delete-btn {
    opacity: 1;
}

.pros-cons-empty {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 6px 12px;
    font-style: italic;
}

.pros-cons-add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    min-height: unset;
    box-shadow: none;
}
.pros-cons-add-pros:hover {
    border-color: var(--success-color);
    color: var(--success-color);
    background: rgba(var(--success-color-rgb), 0.05);
    transform: none;
}
.pros-cons-add-cons:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: rgba(var(--danger-color-rgb), 0.05);
    transform: none;
}

.pros-cons-inline-input-wrap {
    padding: 2px 0;
}
.pros-cons-inline-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.pros-cons-inline-input:focus {
    border-color: var(--accent-color);
}

.pros-cons-item-pro { border-color: rgba(var(--success-color-rgb), 0.35); }
.pros-cons-item-con { border-color: rgba(var(--danger-color-rgb), 0.35); }

.pros-cons-item-however {
    background: var(--bg-primary);
    font-size: 13px;
}

.pros-cons-inline-icon {
    font-size: 11px;
    flex-shrink: 0;
}
.pros-cons-inline-icon.pro { color: var(--success-color); }
.pros-cons-inline-icon.con { color: var(--danger-color); }

.pros-cons-however-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    font-style: italic;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}
.pros-cons-item:hover .pros-cons-however-btn {
    opacity: 1;
}
.pros-cons-however-btn:hover {
    background: var(--bg-secondary);
}

.pros-cons-chain {
    margin-left: 24px;
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.pros-cons-however-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.pros-cons-however-label {
    font-size: 12px;
    font-style: italic;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.pros-cons-however-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    outline: none;
    color: var(--text-primary);
}

.btn-back-browsing {
    background: var(--accent-color);
    border: none;
    color: white;
    font-size: 20px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: none;
    border-right: 2px solid var(--border-color);
}

.btn-back-browsing:hover {
    background: var(--indigo-color);
    transform: none;
    box-shadow: none;
}

.btn-back-browsing:active {
    transform: none;
    background: var(--indigo-color-hover);
}


.browsing-parent-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 16px 0;
}

.browsing-parent-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.browsing-parent-breadcrumbs .breadcrumb-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.browsing-parent-breadcrumbs .breadcrumb-link:hover {
    color: var(--accent-color);
}

.browsing-parent-breadcrumbs .breadcrumb-separator {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.5;
}

.browsing-parent-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.browsing-parent-title.long-title {
    font-size: 20px;
    line-height: 1.4;
}

.browsing-parent-title.editable-title {
    cursor: pointer;
    transition: color 0.2s;
    border-radius: 4px;
    padding: 4px 8px;
    margin: -4px -8px;
}

.browsing-parent-title.editable-title:hover {
    color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.05);
}

.header-title-input {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    border: 2px solid var(--accent-color);
    border-radius: 6px;
    padding: 4px 8px;
    background: var(--bg-primary);
    width: 100%;
    outline: none;
    font-family: inherit;
}

.header-title-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

.browsing-parent-description {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 8px;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

.browsing-parent-description.editable-description {
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    border-radius: 4px;
    padding: 6px 8px;
    margin: 8px -8px 0 -8px;
    min-height: 32px;
}

.browsing-parent-description.editable-description:hover {
    background: rgba(var(--accent-color-rgb), 0.05);
}

.description-placeholder {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.6;
}

.header-description-input {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-primary);
    border: 2px solid var(--accent-color);
    border-radius: 6px;
    padding: 6px 8px;
    background: var(--bg-primary);
    width: 100%;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 60px;
}

.header-description-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

/* =====================================================================
   Inspect Detail Modal
   Opens as a centred modal when browsing into a goal on the Inspect tab
   ===================================================================== */
.inspect-detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10100;
    background: var(--overlay-bg-strong);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.inspect-detail-overlay.active {
    display: flex;
}

/* Inline mode: sits in the main content area, no backdrop or card styling */
.inspect-detail-overlay.inline-mode {
    background: var(--bg-primary);
    z-index: 50;
    animation: none;
    overflow-y: auto;
}

.inspect-detail-overlay.inline-mode.active {
    display: block; /* override flex so the overlay itself scrolls */
    left: 0;
}

body:has(.sidebar:not(.hidden)) .inspect-detail-overlay.inline-mode.active {
    left: 320px;
}

.inspect-detail-overlay.inline-mode .inspect-detail-overlay-inner {
    width: 100%;
    max-width: 720px;
    height: auto;
    min-height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding: 28px 20px;
    animation: none;
    margin: 0 auto;
}

/* Let body row and body grow naturally instead of scrolling internally */
.inspect-detail-overlay.inline-mode .inspect-modal-body-row {
    overflow: visible;
    flex: none;
    width: 100%;
}

.inspect-detail-overlay.inline-mode .inspect-detail-overlay-body {
    overflow: visible;
    height: auto;
    flex: 1;
    min-width: 0;
}

/* Body row: holds main content + optional notes sidebar */
.inspect-modal-body-row {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.main-list-host {
    width: 100%;
}

.main-list-host.is-detached {
    display: none;
}

.inspect-detail-overlay-body .main-list-host {
    width: 100%;
    flex: 0 0 auto;
    min-width: 0;
    min-height: auto;
}

.inspect-detail-overlay-body .main-list {
    height: auto;
}


.main-list {
    height:100%;
}


/* Modal card */
.inspect-detail-overlay-inner {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    width: 90vw;
    max-width: 770px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: visible;
    animation: slideUp 0.2s;
    transition: max-width 0.25s ease;
}

.inspect-detail-overlay-inner.sidebar-open {
    max-width: 1080px;
}

.inspect-detail-overlay-inner.idea-notes-mode .smart-notes-editor {
    padding: 20px 24px;
    font-size: 14px;
}

.inspect-detail-overlay-inner.idea-notes-mode .smart-notes-placeholder p:first-child {
    font-size: 15px;
}

/* Notes sidebar panel */
.inspect-notes-sidebar {
    width: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease;
    border-left: 1px solid transparent;
    position: relative;
}

.inspect-detail-overlay-inner.no-transition,
.inspect-detail-overlay-inner.no-transition .inspect-notes-sidebar {
    transition: none !important;
}

.inspect-detail-overlay-inner.sidebar-open .inspect-notes-sidebar {
    width: 300px;
    border-left-color: var(--border-color);
}

.smart-notes-editor {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px;
    outline: none;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-primary);
    font-family: inherit;
    caret-color: var(--accent-color);
    position: relative;
}

.smart-notes-editor:focus {
    outline: none;
}

/* Placeholder shown when editor is empty (contains only <p><br></p>) */
.smart-notes-placeholder {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 23%;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 20px;
    pointer-events: none;
    text-align: center;
    color: var(--text-muted);
}

.smart-notes-placeholder p {
    margin: 0 0 8px;
}

.smart-notes-placeholder p:first-child {
    font-size: 18px;
    font-weight: normal;
    color: var(--text-muted);
}

.smart-notes-placeholder p:last-child {
    font-size: 14px;
    color: var(--text-muted);
}

.smart-notes-editor p   { margin: 0 0 2px; min-height: 1.4em; }
.smart-notes-editor h1  { font-size: 18px; font-weight: 700; margin: 10px 0 4px; color: var(--text-primary); }
.smart-notes-editor h2  { font-size: 15px; font-weight: 700; margin: 8px 0 4px; color: var(--text-primary); }
.smart-notes-editor h3  { font-size: 13px; font-weight: 700; margin: 6px 0 4px; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.04em; }
.smart-notes-editor ul,
.smart-notes-editor ol  { margin: 4px 0; padding-left: 14px; list-style-position: outside; }
.smart-notes-editor li  { margin: 1px 0; font-size: 13px; font-weight: 400; color: var(--text-primary); text-transform: none; letter-spacing: normal; }

/* Slash command menu */
.notes-slash-menu {
    display: none;
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 99999;
    overflow: hidden;
    min-width: 190px;
    padding: 4px 0;
}

.notes-slash-menu.open {
    display: block;
}

.slash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    text-align: left;
    min-height: unset;
    min-width: unset;
    border-radius: 0;
    box-shadow: none;
    transition: background 0.1s;
}

.slash-item:hover,
.slash-item.selected {
    background: var(--hover-bg);
    transform: none;
    box-shadow: none;
}

.slash-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.slash-icon i { font-size: 10px; }

.notes-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 16px;
    color: var(--text-secondary);
    text-align: center;
    flex: 1;
}

.notes-sidebar-empty i {
    font-size: 26px;
    opacity: 0.35;
}

.notes-sidebar-empty p {
    margin: 0;
    font-size: 13px;
}

/* Sticky header inside the card */
.inspect-detail-overlay-header {
    flex-shrink: 0;
    border-radius: 7px 7px 0 0;
    overflow: hidden;
}

/* Home-level modal header (shown when not browsed into a goal) */
.inspect-modal-home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--bg-secondary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.inspect-modal-home-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.inspect-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.2s, background 0.2s;
}

.inspect-modal-close-btn:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

/* Scrollable content body */
.inspect-detail-overlay-body {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 0 24px 0;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.inspect-detail-overlay-body::-webkit-scrollbar {
    width: 4px;
}

.inspect-detail-overlay-body::-webkit-scrollbar-track {
    background: transparent;
}

.inspect-detail-overlay-body::-webkit-scrollbar-button {
    display: none;
    height: 0;
}

.inspect-detail-overlay-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 99px;
}

.inspect-detail-overlay-body::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.inspect-detail-overlay-body input,
.inspect-detail-overlay-body textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* Add-task bar inside the modal card */
.inspect-detail-overlay-footer {
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 0;
    padding-top: 16px;
}

/* Window mode: keep sub-item bar fixed to the bottom of the modal body */
.inspect-detail-overlay:not(.inline-mode) .inspect-detail-overlay-footer {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    z-index: 2;
}

/* Inline mode: keep sub-item bar in normal flow under content */
.inspect-detail-overlay.inline-mode .inspect-detail-overlay-footer {
    position: static;
    bottom: auto;
    margin-top: 16px;
}

.inspect-detail-overlay-footer #inspectDetailInput {
    width: 100%;
    padding: 12px 16px 12px 40px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-sizing: border-box;
}

.inspect-detail-overlay-footer #inspectDetailInput:focus {
    border-color: var(--accent-color);
}

/* Full-screen on mobile */
@media (max-width: 768px) {
    .inspect-detail-overlay-inner {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }
    .inspect-detail-overlay-header {
        border-radius: 0;
    }
    .inspect-detail-overlay-footer {
        border-radius: 0;
    }
    /* Inline mode on mobile: no sidebar offset, account for topbar */
    .inspect-detail-overlay.inline-mode.active,
    body:has(.sidebar:not(.hidden)) .inspect-detail-overlay.inline-mode.active {
        left: 0;
        top: 52px;
    }
}

/* Inline Edit Form Styles */
.task-inline-edit {
    background: transparent;
    padding: 0 16px 12px 58px;
    margin: 0;
    animation: slideDown 0.2s ease-out;
    display: none !important
}

/* Adjust padding for parent tasks without checkboxes */
.task.has-children .task-inline-edit {
    padding-left: 20px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 1000px;
    }
}

.task.editing {
    background: var(--hover-bg) !important;
}

.task.editing > .task-header {
    padding-bottom: 4px;
}

.task.editing .task-description {
    display: none;
}

/* Hide the main "Add a task..." box when editing */
body:has(.task.editing) .add-task-section {
    display: none;
}

.inline-edit-form .form-group {
    margin-bottom: 8px;
}

.inline-edit-form .form-group:first-of-type {
    margin-top: 8px;
}

.inline-edit-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.inline-edit-form input[type="text"],
.inline-edit-form select,
.inline-edit-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.inline-edit-form input[type="text"]:focus,
.inline-edit-form select:focus,
.inline-edit-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.inline-edit-form textarea {
    resize: vertical;
    min-height: 60px;
}

/* Unified list container used by both root and inspect rendering */
.overview-list-view-container {
    display: block;
    padding: 0;
}

.overview-list-view-container .overview-row {
    padding-top: 6px;
    padding-bottom: 6px;
}

/* Tasks section below regular tasks */
.overview-tasks-separator {
    margin-top: 2px;
    margin-bottom: 2px;
    width: 100%;
}

.overview-tasks-separator span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.overview-list-view-container .overview-tasks-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 25px 14px 4px;
    margin: 0;
}

.overview-list-view-container .overview-tasks-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.inspect-idea-icon {
    width: 18px;
    height: 18px;
    font-size: 20px;
    flex-shrink: 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.inspect-procon-input-wrapper {
    margin-bottom: 8px;
}

.inspect-procon-input-wrapper.inspect-pro-item {
    background: rgba(var(--success-color-rgb), 0.1);
    border-color: rgba(var(--success-color-rgb), 0.3);
}

.inspect-procon-input-wrapper.inspect-con-item {
    background: rgba(var(--danger-color-rgb), 0.1);
    border-color: rgba(var(--danger-color-rgb), 0.3);
}

.inspect-procon-input-wrapper .inspect-procon-content {
    flex: 1;
}

.inspect-procon-input-wrapper .inspect-procon-actions {
    opacity: 1; /* Always show cancel button */
}

.inspect-procon-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    padding: 0;
}

.inspect-procon-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.inspect-procon-input-cancel {
    background: var(--tint-subtle);
    border: none;
    color: var(--text-muted);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s;
    flex-shrink: 0;
}

.inspect-procon-input-cancel:hover {
    background: var(--tint-medium);
    color: var(--text-primary);
}


/* Ideas Box Styling */
.inspect-idea-box {
    background: var(--bg-primary);
    border: 1px solid rgba(var(--amber-color-rgb), 0.25);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
}

.inspect-idea-box:hover {
    border-color: rgba(var(--amber-color-rgb), 0.4);
    box-shadow: 0 2px 8px rgba(var(--amber-color-rgb), 0.12);
}

.inspect-idea-proscons {
    padding: 12px 16px 16px 16px;
}

.inspect-idea-proscons:empty {
    padding: 0;
}

/* Pros/Cons inside idea boxes */
.inspect-procon-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 12px;
    transition: all 0.2s;
    border: 1px solid transparent;
    position: relative;
}

.inspect-procon-item:last-child {
    margin-bottom: 0;
}

/* Nested container for rebuttals */
.inspect-procon-nested {
    display: block;
    flex-basis: 100%;
    margin-top: 8px;
    margin-left: 0;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
}

.inspect-pro-item {
    background: rgba(var(--success-color-rgb), 0.06);
    border-color: rgba(var(--success-color-rgb), 0.15);
}

.inspect-pro-item::before {
    content: 'Pro';
    color: var(--success-text);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: rgba(var(--success-color-rgb), 0.2);
    padding: 4px 9px;
    border-radius: 5px;
    line-height: 1;
    flex-shrink: 0;
}

.inspect-pro-item:hover {
    background: rgba(var(--success-color-rgb), 0.1);
    border-color: rgba(var(--success-color-rgb), 0.25);
}

.inspect-con-item {
    background: rgba(var(--danger-color-rgb), 0.06);
    border-color: rgba(var(--danger-color-rgb), 0.15);
}

.inspect-con-item::before {
    content: 'Con';
    color: var(--danger-text);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: rgba(var(--danger-color-rgb), 0.2);
    padding: 4px 9px;
    border-radius: 5px;
    line-height: 1;
    flex-shrink: 0;
}

.inspect-con-item:hover {
    background: rgba(var(--danger-color-rgb), 0.1);
    border-color: rgba(var(--danger-color-rgb), 0.25);
}

.inspect-procon-content {
    flex: 1;
    min-width: 0;
}

.inspect-procon-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.inspect-procon-item:hover .inspect-procon-actions {
    opacity: 1;
}

    .btn-back {
        margin-right: 12px;
    }
    
    .context-prefix {
        font-size: 16px;
    }
    
    .context-textarea {
        min-height: 80px;
        font-size: 15px;
    }



/* ========================================
   MAIN LIST VIEW
   ======================================== */

.overview-task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.overview-task-list-indented {
    padding-left: 42px;
}

.overview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 14px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: background 0.15s;
}

.overview-row.is-want {
    cursor: pointer;
}

.overview-row:hover {
    background: var(--card-tint-hover);
}


.overview-row-star {
    font-size: 14px;
    flex-shrink: 0;
}

.overview-row-child .overview-row-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.overview-row-task .overview-row-title {
    font-weight: 400;
    font-size: 14px;
    color: var(--text-secondary);
}

.overview-row-chevron {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.overview-task-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: 999px;
    padding: 1px 7px;
    flex-shrink: 0;
    min-width: 20px;
    text-align: center;
}

.overview-row-idea-indicator {
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.7;
}

/* --- Overview row "..." menu --- */
.overview-row-menu-wrap {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.btn-overview-row-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.12s, background 0.12s;
}

.overview-row:hover .btn-overview-row-menu,
.overview-row-menu-wrap:has(.overview-row-dropdown.active) .btn-overview-row-menu {
    opacity: 1;
}

.btn-overview-row-menu:hover {
    background: var(--tint-subtle);
    color: var(--text-primary);
}

.overview-row-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 130px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 200;
    padding: 4px;
    overflow: hidden;
}

.overview-row-dropdown.active {
    display: block;
}

.overview-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 5px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}

.overview-dropdown-item:hover {
    background: var(--tint-subtle);
}

.overview-dropdown-danger {
    color: var(--danger-color);
}

.overview-dropdown-danger:hover {
    background: rgba(var(--danger-color-rgb), 0.07);
}

.overview-row.done .overview-row-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Shrink checkbox in overview so task rows match parent row height */
.overview-task-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    margin-top: 0;
    align-self: center;
    flex-shrink: 0;
}

.overview-task-checkbox:checked::after {
    font-size: 11px;
    line-height: 14px;
}

.overview-list-view-container .inspect-idea-icon,
.overview-list-view-container .inspect-problem-icon {
    width: 16px;
    height: 16px;
    font-size: 14px;
    align-self: center;
}

.overview-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.overview-row-title {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.4;
    font-weight: 700;
}

.overview-row-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===================== Mindfulness Tool ===================== */

.mindfulness-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    opacity: 0.45;
    transition: opacity 0.2s, background 0.2s;
    min-height: unset;
    min-width: unset;
    box-shadow: none;
}

.mindfulness-btn:hover {
    opacity: 1;
    background: var(--tint-subtle);
    transform: none;
    box-shadow: none;
}

.mindfulness-btn img {
    width: 16px;
    height: 16px;
    display: block;
    filter: brightness(0);
}

/* -- Settings Modal ----------------------------------------- */
.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10200;
    background: var(--overlay-bg);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.18s;
}

.settings-overlay.active {
    display: flex;
}

.settings-modal {
    display: flex;
    width: min(860px, 94vw);
    height: min(580px, 90vh);
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    overflow: hidden;
    position: relative;
}

.settings-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 2;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.settings-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.settings-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 28px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 18px 14px;
}

.settings-tab-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 0;
    transition: background 0.15s;
    font-weight: 500;
}

.settings-tab-btn i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.settings-tab-btn:hover {
    background: var(--hover-bg);
}

.settings-tab-btn.active {
    background: var(--bg-primary);
    color: var(--accent-color);
    font-weight: 600;
}

.settings-tab-btn.active i {
    color: var(--accent-color);
}

.settings-tab-premium-btn i {
    color: var(--premium-color-hover);
}

.settings-tab-premium-btn.active i {
    color: var(--premium-color-hover);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 36px 40px;
}

.settings-pane {
    display: none;
}

.settings-pane.active {
    display: block;
}

.settings-pane-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 28px;
}

.settings-field {
    margin-bottom: 22px;
}

.settings-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.settings-input {
    width: 100%;
    max-width: 380px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    outline: none;
    transition: border-color 0.15s;
}

.settings-input:focus {
    border-color: var(--accent-color);
}

.settings-input[readonly] {
    opacity: 0.55;
    cursor: default;
}

.settings-btn {
    padding: 9px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}

.settings-btn:hover {
    background: var(--hover-bg);
    border-color: var(--locked-color);
}

.settings-btn-premium {
    background: linear-gradient(135deg, var(--premium-btn-from), var(--premium-color-hover));
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
}

.settings-btn-premium:hover {
    background: linear-gradient(135deg, var(--premium-btn-hover-from), var(--premium-btn-hover-to));
    border: none;
}

.settings-row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-row-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.settings-row-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Toggle switch */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.settings-toggle input { opacity: 0; width: 0; height: 0; }
.settings-toggle-track {
    position: absolute;
    inset: 0;
    background: var(--border-color);
    border-radius: 24px;
    transition: background 0.2s;
    cursor: pointer;
}
.settings-toggle-track::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.settings-toggle input:checked + .settings-toggle-track { background: var(--accent-color); }
.settings-toggle input:checked + .settings-toggle-track::before { transform: translateX(20px); }

.settings-premium-card {
    background: linear-gradient(145deg, var(--premium-bg), var(--premium-bg-to));
    border: 1px solid var(--premium-color-hover);
    border-radius: 14px;
    padding: 36px 32px;
    text-align: center;
    max-width: 460px;
}

.settings-premium-icon {
    font-size: 36px;
    color: var(--premium-color-hover);
    margin-bottom: 16px;
    display: block;
}

.settings-premium-heading {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.settings-premium-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 22px;
    line-height: 1.5;
}

.settings-premium-features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
    text-align: left;
    display: inline-block;
}

.settings-premium-features li {
    font-size: 14px;
    color: var(--text-primary);
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-premium-features li i {
    color: var(--success-color);
    font-size: 13px;
}

/* Theme picker */
.theme-picker {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 4px;
}
.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.15s;
    width: 96px;
}
.theme-card:hover { border-color: var(--text-muted); }
.theme-card.active { border-color: var(--accent-color); }
.theme-card-preview {
    width: 72px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
/* Preview swatches � literal colours, decorative */
.theme-preview-light { background: #fefefe; }
.theme-preview-light::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 14px;
    background: #f5f5f5; border-bottom: 1px solid #e5e7eb;
}
.theme-preview-light::after {
    content: ''; position: absolute;
    top: 20px; left: 8px; right: 8px; height: 5px;
    background: #e5e7eb; border-radius: 3px;
}
.theme-preview-dark { background: #141414; }
.theme-preview-dark::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 14px;
    background: #1e1e1e; border-bottom: 1px solid #2e2e2e;
}
.theme-preview-dark::after {
    content: ''; position: absolute;
    top: 20px; left: 8px; right: 8px; height: 5px;
    background: #2e2e2e; border-radius: 3px;
}
.theme-preview-navy { background: #0d1117; }
.theme-preview-navy::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 14px;
    background: #161b22; border-bottom: 1px solid #21262d;
}
.theme-preview-navy::after {
    content: ''; position: absolute;
    top: 20px; left: 8px; right: 8px; height: 5px;
    background: #21262d; border-radius: 3px;
}
.theme-preview-gameui { background: #12101e; }
.theme-preview-gameui::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 14px;
    background: #1c1930; border-bottom: 1px solid #2d2848;
}
.theme-preview-gameui::after {
    content: ''; position: absolute;
    top: 20px; left: 8px; right: 8px; height: 5px;
    background: #7c5cbf; border-radius: 3px;
}
.theme-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
.theme-card.active .theme-card-label { color: var(--accent-color); }

/* -- Settings Modal ----------------------------------------- */
.mindfulness-overlay {
    display: none;
    position: fixed;
    z-index: 10300;
    inset: 0;
    background: var(--overlay-bg);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.mindfulness-overlay.active {
    display: flex;
}

.mindfulness-panel {
    display: none;
}

.mindfulness-panel.active {
    display: block;
}

.mindfulness-modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    width: 92vw;
    max-width: 660px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    position: relative;
}

.mindfulness-modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    min-height: unset;
    min-width: unset;
    box-shadow: none;
}

.mindfulness-modal-close:hover {
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.mindfulness-modal-back {
    position: absolute;
    top: 14px;
    left: 18px;
    background: none;
    border: none;
    font-size: 15px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    min-height: unset;
    min-width: unset;
    box-shadow: none;
}

.mindfulness-modal-back:hover {
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.mindfulness-breadcrumb {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-right: 24px;
}

.mindfulness-task-name {
    font-size: 25px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 28px;
    padding-right: 24px;
    line-height: 1.3;
}

.mindfulness-input-type {
    font-size: 21px;
    font-weight: 400;
    color: var(--accent-color);
    margin-bottom: 27px;
    line-height: 1.4;
}

/* Input panel: larger title, snug against the hint label */
.mindfulness-input-content .mindfulness-task-name {
    font-size: 32px;
    margin-bottom: 0px;
}

.mindfulness-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}

.mindfulness-option-btn {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 26px 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    min-height: unset;
    box-shadow: none;
    width: 100%;
}

.mindfulness-option-btn:hover {
    background: rgba(var(--accent-color-rgb), 0.08);
    border-color: rgba(var(--accent-color-rgb), 0.35);
    color: var(--accent-color);
    transform: none;
    box-shadow: none;
}

.mindfulness-option-btn i {
    font-size: 32px;
    flex-shrink: 0;
    color: var(--accent-color);
    align-self: flex-start;
    margin-top: 2px;
}

.mindfulness-option-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mindfulness-option-title {
    font-size: 22px;
    font-weight: 600;
    color: inherit;
}

.mindfulness-option-desc {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 4px;
}

.mindfulness-input-content {
    max-width: 860px;
    width: 92vw;
}

.mindfulness-single-input {
    width: 100%;
    font-size: 28px;
    line-height: 1.4;
    padding: 20px 22px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-secondary);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
    display: block;
}

.mindfulness-single-input:focus {
    border-color: var(--accent-color);
    background: var(--bg-primary);
}

.mindfulness-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}

.mindfulness-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 20px;
    color: var(--text-primary);
}

.mindfulness-list-item span {
    flex: 1;
    line-height: 1.4;
}

.mindfulness-list-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    min-height: unset;
    min-width: unset;
    box-shadow: none;
    flex-shrink: 0;
}

.mindfulness-list-remove:hover {
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.mindfulness-input-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.mindfulness-done-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 14px 36px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: none;
    min-height: unset;
}

.mindfulness-done-btn:hover {
    background: var(--accent-color-hover);
    transform: none;
    box-shadow: none;
}




/* === Task drag-and-drop (Notion-style) ============================ */
body.task-dragging {
    cursor: grabbing !important;
    user-select: none;
}
body.task-dragging * {
    cursor: grabbing !important;
}

.overview-row {
    /* Hint that rows are draggable without changing the existing interaction. */
    cursor: grab;
}
body.task-dragging .overview-row { cursor: grabbing; }

.overview-row.task-being-dragged {
    opacity: 0.35;
}

/* Mobile long-press drag affordance: fill left->right while hold is arming drag. */
.overview-row.task-drag-hold {
    background-image: linear-gradient(
        90deg,
        rgba(var(--accent-color-rgb), 0.20) 0%,
        rgba(var(--accent-color-rgb), 0.34) 100%
    );
    background-repeat: no-repeat;
    background-size: var(--drag-hold-progress, 0%) 100%;
}

/* While dragging, collapse the source subtree to a single row by hiding
   the dragged item's child block in the live list. The ghost still shows
   all the nested children. */
.overview-task-list-indented.task-being-dragged {
    display: none !important;
}

/* Floating clone that follows the cursor. */
.task-drag-ghost {
    position: fixed !important;
    pointer-events: none;
    z-index: 99999;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 6px 8px;
    opacity: 0.92;
    transform: rotate(-0.5deg);
    max-height: 60vh;
    overflow: hidden;
}
.task-drag-ghost .overview-task-list,
.task-drag-ghost .overview-task-list-indented {
    list-style: none;
    margin: 0;
}
.task-drag-ghost .overview-task-count,
.task-drag-ghost .expanded-type-badge { display: none; }

/* Blue line indicator for insert-before / insert-after. */
.task-drop-indicator {
    position: fixed;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px;
    z-index: 99998;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(var(--accent-color-rgb), 0.25);
    display: none;
}
.task-drop-indicator::before,
.task-drop-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    transform: translateY(-50%);
}
.task-drop-indicator::before { left: -4px; }
.task-drop-indicator::after  { right: -4px; }

/* Blue highlight when dropping onto a row to nest. */
.overview-row.task-drop-nest {
    background: rgba(var(--accent-color-rgb), 0.18) !important;
    box-shadow: inset 0 0 0 2px var(--accent-color);
    border-radius: 6px;
}

/* Blue highlight when dragging a task over a sidebar group as a drop target. */
.sidebar-group.task-drop-group {
    background: rgba(var(--accent-color-rgb), 0.18) !important;
    box-shadow: inset 0 0 0 2px var(--accent-color);
}
