:root {
    --bg-color: #ffffff;
    --text-primary: #292929;
    --text-secondary: #757575;
    --accent-color: #1a8917;
    --accent-hover: #156d12;
    --border-color: #e6e6e6;
    --danger: #d93025;
    --success: #1a8917;
    --priority-color: #ffc017;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Merriweather', serif;
    --font-size-scale: 1;
    /* Default scale */

    /* Matrix Colors - Light Mode */
    --matrix-line: #999;
    --matrix-urgent-bg: rgba(255, 200, 200, 0.15);
    --matrix-not-urgent-bg: rgba(200, 255, 200, 0.15);
    --matrix-bg-top-left: #fffafa;
    --matrix-bg-top-right: #fafcff;
    --matrix-bg-bottom-left: #fffef5;
    --matrix-bg-bottom-right: #fcfbff;
}

/* Font Size Scales - scale root for rem units */
html.font-small {
    font-size: 14px;
}

html {
    font-size: 16px;
    /* Default */
}

html.font-large {
    font-size: 18px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 4rem;
    overflow-y: auto;
}

/* Main Container */
.app-container {
    width: 70%;
    max-width: 800px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.app-title {
    font-family: var(--font-sans);
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    text-align: center;
}

.counter-display {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
    font-family: var(--font-sans);
    margin-bottom: 2rem;
    text-align: center;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 1rem;
    background: transparent;
    padding: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    margin-bottom: 2rem;
    align-items: center;
    position: relative;
    /* For absolute positioning of members panel */
}

input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    padding: 0.5rem 0;
    font-size: 1.25rem;
    font-family: var(--font-sans);
}

input[type="text"]::placeholder {
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 300;
}

.add-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.add-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent-color);
}

/* Task Lists */
.task-lists-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: visible;
    flex: 1;
}

/* Task Group */
.task-group {
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.task-group.completed {
    opacity: 0.5;
}

/* Task Item */
.task-item {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0;
    display: flex;
    align-items: flex-start;
    /* Align to top for multiline */
    gap: 1rem;
    transition: all 0.2s ease;
    position: relative;
}

.task-item.subtask {
    margin-left: 2rem;
    border-left: 2px solid var(--border-color);
    padding-left: 1rem;
}

.task-item.priority {
    padding-left: 0;
}

.priority-separator {
    height: 2px;
    background-color: var(--priority-color);
    margin: 1rem auto;
    width: 33%;
    border-radius: 2px;
}

.checkbox {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-top: 0.3rem;
    /* Align with first line of text */
}

.checkbox:checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.checkbox:checked::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 5px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
}

.task-content {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: var(--font-sans);
    outline: none;
    min-width: 0;
    resize: none;
    /* Disable manual resize */
    overflow: hidden;
    /* Hide scrollbar */
    line-height: 1.5;
    padding: 0;
}

.task-group.completed .task-content {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.task-item.completed .task-content {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* Actions */
.actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 0.1rem;
    /* Align with text */
}

.task-item:hover .actions {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-sans);
    font-weight: 600;
}

.action-btn i {
    font-size: 1.1rem;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.priority-btn.active {
    color: var(--priority-color);
}

.subtask-btn:hover {
    color: var(--accent-color);
}

.delete-btn:hover {
    color: var(--danger);
}

.drag-handle {
    cursor: grab;
    color: var(--text-secondary);
    padding: 0.25rem;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 0.2rem;
    /* Align with text */
}

.task-item:hover .drag-handle {
    opacity: 1;
}

/* Footer */
.app-footer {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-top: 0.5rem;
}

.version-display {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 300;
    opacity: 0.6;
}

.clear-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.clear-btn:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Footer Separator */
.footer-separator {
    color: var(--text-secondary);
    margin: 0 0.5rem;
}

/* Bin View */
.bin-view {
    width: 100%;
}

.bin-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    transition: color 0.2s;
}

.back-btn:hover {
    color: var(--text-primary);
}

.bin-title {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 700;
    flex: 1;
}

.bin-counter {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.bin-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 2rem;
    font-style: italic;
}

/* Bin Item */
.bin-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.bin-item-content {
    flex: 1;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    text-decoration: line-through;
}

.bin-item-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    margin-top: 0.25rem;
}

.bin-item-parent {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    margin-bottom: 0.25rem;
}

.bin-item-subtask {
    color: var(--text-secondary);
    font-family: var(--font-sans);
    text-decoration: line-through;
    padding-left: 0.5rem;
}

.bin-item-actions {
    display: flex;
    gap: 0.5rem;
}

.restore-btn,
.permanent-delete-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.restore-btn {
    color: var(--success);
}

.restore-btn:hover {
    background: rgba(26, 137, 23, 0.1);
}

.permanent-delete-btn {
    color: var(--danger);
}

.permanent-delete-btn:hover {
    background: rgba(217, 48, 37, 0.1);
}

/* Dragging Visuals */
.task-group.dragging {
    opacity: 0.4;
}

.drop-line {
    height: 4rem;
    background: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    margin: 0.5rem 0;
    opacity: 0.5;
}

/* Shorter drop line for subtask reordering */
.drop-line.subtask-drop {
    height: 2rem;
    margin-left: 2rem;
    /* Indent to match subtask indentation */
    border-color: var(--accent-color);
}

/* Mobile Layout */
@media (max-width: 768px) {
    .app-container {
        width: 90%;
        gap: 1rem;
    }

    .app-title {
        font-size: 2.5rem;
        margin-bottom: 0;
    }

    /* Space name display - align right on mobile */
    .space-name-display {
        text-align: right;
        padding-right: 0.5rem;
    }

    .counter-display {
        margin-bottom: 1rem;
    }

    .task-content,
    input[type="text"] {
        font-size: 1rem;
    }

    /* Always show action buttons on mobile */
    .actions {
        opacity: 1;
    }

    /* Hide drag handle in column mode on mobile (obvious on touch) */
    .column-mode .drag-handle {
        display: none;
    }
}

/* Authentication & Views */
.hidden {
    display: none !important;
}

.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
    z-index: 1000;
}

.login-card {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.google-btn {
    background: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.google-btn:hover {
    background-color: #f7f8f8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
}

.header-actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.5rem;
}

.view-mode-btn {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.view-mode-btn:hover {
    color: var(--accent-color);
}

.logout-btn {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.logout-btn:hover {
    color: var(--danger);
}

/* Sticker Input (hidden in column mode) */
.sticker-input-group {
    display: none;
    align-items: center;
    gap: 8px;
}

.sticker-mode .header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.sticker-task-input {
    width: 140px;
    padding: 4px 0;
    border: none;
    border-bottom: 2px solid #666 !important;
    border-radius: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    background: transparent;
    outline: none;
    text-align: right;
    color: #1a1a1a;
}

.sticker-task-input:focus {
    border-color: var(--text-secondary);
}

.sticker-add-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 4px;
}

.sticker-add-btn:hover {
    color: var(--text-primary);
}

/* Sticker Mode - Hide title, counter, column input */
.sticker-mode .app-title,
.sticker-mode .counter-display,
.sticker-mode .column-input-group {
    display: none !important;
}

.sticker-mode .sticker-input-group {
    display: flex !important;
}

.sticker-mode .header-top {
    position: fixed;
    top: 160px;
    right: 20px;
    z-index: 100;
}

.sticker-mode .app-header {
    margin-bottom: 0;
}

/* Sticker Canvas */
.sticker-canvas {
    position: relative;
    width: 100%;
    min-height: 100vh;
    /* Full viewport height */
    padding-bottom: 100vh;
    /* Allow scrolling way down */
    /* Extra scroll space */
}

/* Matrix Mode - Same styles as sticker mode */
.matrix-mode .app-title,
.matrix-mode .counter-display,
.matrix-mode .column-input-group {
    display: none !important;
}

.matrix-mode .sticker-input-group {
    display: flex !important;
}

.matrix-mode .header-top {
    position: fixed;
    top: 150px;
    right: 20px;
    z-index: 100;
}

.matrix-mode .header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.matrix-mode .app-header {
    margin-bottom: 0;
}

/* Space Toggle Button */
.space-toggle {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.space-toggle:hover {
    border-color: var(--primary);
}

.space-toggle i {
    color: var(--text-secondary);
    /* Gray like other nav icons */
    font-size: 16px;
}

/* Space Dropdown */
.space-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    /* 20% opacity white background */
    backdrop-filter: blur(10px);
    /* Add blur effect for better readability */
    /* Fixed: was --card-bg which is undefined */
    border: 1px solid var(--border-color);
    /* Fixed: was --border which is undefined */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 10000 !important;
    /* Very high to block all clicks to elements below */
    pointer-events: auto !important;
    /* Ensure dropdown captures all click events */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
}

/* Force dropdown above all elements in all view modes */
.sticker-mode .space-dropdown,
.matrix-mode .space-dropdown,
.column-mode .space-dropdown {
    z-index: 10000 !important;
    pointer-events: auto !important;
}

/* Fix stacking context issue - header-actions needs z-index because it has transform */
.header-actions {
    z-index: 10000 !important;
    right: 0;
    /* Keep aligned to right */
}

.space-dropdown.hidden {
    display: none;
}

/* Hide scrollbar but keep scroll functionality */
.space-dropdown::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Edge */
}

/* Space List */
.space-list {
    padding: 8px 0;
}

.space-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.space-item:hover {
    background: rgba(0, 0, 0, 0.05);
    /* Fixed: was --hover-bg which is undefined */
}

.space-item.active .space-name {
    font-weight: bold;
}

.space-name {
    flex: 1;
    text-align: left;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.space-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 8px;
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s;
}

.space-delete-btn:hover {
    opacity: 1;
    color: #ff4444;
}

/* Add Space Section */
.space-add-section {
    border-top: 1px solid var(--border);
    padding: 0;
    display: flex;
    gap: 0;
}

.space-add-section input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 10px 12px;
    color: var(--text-secondary);
    font-size: 14px;
    opacity: 0.7;
}

.space-add-section input:focus {
    outline: none;
    border-bottom-color: var(--primary);
    opacity: 1;
}

.space-add-section input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.space-add-section button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.space-add-section button:hover {
    color: var(--primary);
}

/* Hide other action buttons when space dropdown is open */
/* Removed - dropdown is now opaque, no need to hide buttons */
/*
.header-actions.space-dropdown-open .theme-toggle-btn,
.header-actions.space-dropdown-open .view-mode-btn,
.header-actions.space-dropdown-open .clear-completed-btn,
.header-actions.space-dropdown-open .bin-btn,
.header-actions.space-dropdown-open .logout-btn {
    visibility: hidden;
    pointer-events: none;
}
*/


/* Matrix Canvas */
.matrix-canvas {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 200px);
    padding-top: 50vh;
    /* Extra scroll space above */
    padding-bottom: 50vh;
    /* Extra scroll space below */
}


/* Sticker Base */
.sticker {
    position: absolute;
    width: 200px;
    height: 200px;
    background: #ffffff;
    border: 1px solid #cccccc;
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.1);
    padding: 12px;
    padding-bottom: 50px;
    /* Reserve space for action buttons */
    cursor: grab;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    transition: box-shadow 0.2s;
    overflow: hidden;
}

/* Resize Handle */
.sticker-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--border-color) 50%);
    opacity: 0.5;
}

.sticker-resize-handle:hover {
    opacity: 1;
}

.sticker:hover {
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.15);
}

.sticker.dragging {
    cursor: grabbing;
    box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.sticker.priority-red {
    background: #fff5f5;
    border-color: #ffcccc;
}

.sticker.priority-blue {
    background: #f0f7ff;
    border-color: #cce0ff;
}

.sticker.priority-yellow {
    background: #fffdf0;
    border-color: #fff0a0;
}

.sticker.priority-purple {
    background: #f5f0ff;
    border-color: #d4c4ff;
}

.sticker.completed {
    opacity: 0.6;
}

.sticker.completed .sticker-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* Sticker Content */
.sticker-text {
    flex: 1;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    line-height: 1.4;
    color: var(--text-primary);
    cursor: text;
}

.sticker-text-input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.4;
    outline: none;
    padding: 0;
}

.sticker-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.sticker-actions-left,
.sticker-actions-right {
    display: flex;
    gap: 4px;
}

.sticker-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

/* Priority Dropdown */
.priority-dropdown {
    position: relative;
    display: inline-block;
}

.priority-menu {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px;
    gap: 3px;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10000;
}

.priority-dropdown:hover .priority-menu {
    display: flex;
}

.priority-dropdown:hover {
    z-index: 9999;
}

.sticker:has(.priority-dropdown:hover) {
    z-index: 9998;
}

.sticker-subtask:has(.priority-dropdown:hover) {
    z-index: 9997;
}

.priority-color {
    width: 40px;
    height: 14px;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.1s;
}

.priority-color:hover {
    transform: scale(1.05);
}

.sticker-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.sticker-btn.done-btn.active {
    color: var(--success);
}

.sticker-btn.priority-btn.active {
    color: var(--priority-color);
}

.sticker-btn.delete-btn:hover {
    color: var(--danger);
}

/* Parent Sticker (Sheet with subtasks) */
.sticker-parent {
    width: auto;
    min-width: 220px;
    max-width: 440px;
    min-height: 100px;
    padding-bottom: 50px;
    /* Reserve space for action buttons at bottom */
}

.sticker-parent>.sticker-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.8);
}

.sticker-parent-title {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    padding: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    cursor: text;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.sticker-subtasks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 50px;
    /* Reserve space for action buttons */
    max-height: calc(100% - 60px);
    overflow-y: auto;
    scrollbar-width: none;
}

.sticker-subtasks::-webkit-scrollbar {
    display: none;
}

/* Subtask Sticker (inside parent) */
.sticker-subtask {
    position: relative;
    width: 100px;
    min-height: 120px;
    background: #ffffff;
    border: 1px solid #dddddd;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
    padding: 8px;
    padding-bottom: 45px;
    /* Reserve space for action buttons */
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.1s;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    overflow: hidden;
    /* Prevent overflow */
}

.sticker-subtask.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.sticker-subtask.drag-over {
    border: 2px dashed var(--accent-color);
    transform: scale(1.02);
}

.sticker-subtask.completed {
    opacity: 0.6;
}

.sticker-subtask .sticker-text {
    cursor: text;
}

.sticker-subtask.completed .sticker-text {
    text-decoration: line-through;
}

.sticker-subtask.priority-red {
    background: #fff5f5;
    border-color: #ffcccc;
}

.sticker-subtask.priority-blue {
    background: #f0f7ff;
    border-color: #cce0ff;
}

.sticker-subtask.priority-yellow {
    background: #fffdf0;
    border-color: #fff0a0;
}

.sticker-subtask.priority-purple {
    background: #f5f0ff;
    border-color: #d4c4ff;
}

/* Text editing styles for all sticker types */
.sticker-text-input.subtask-edit,
.sticker-text-input.parent-edit,
.sticker-text-input.simple-edit {
    width: 100%;
    font-family: var(--font-sans);
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    resize: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
}

.sticker-text-input.subtask-edit {
    height: 100%;
    min-height: 60px;
    font-size: 0.8rem;
}

.sticker-text-input.parent-edit,
.sticker-text-input.simple-edit {
    font-size: 0.95rem;
    line-height: 1.4;
}

.sticker-text-input.parent-edit {
    padding: 8px;
    padding-bottom: 8px;
}

.sticker-text-input.simple-edit {
    height: 100%;
}

/* Hide sticker view on mobile */
@media (max-width: 768px) {
    .view-mode-btn {
        display: none;
    }
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --accent-color: #4caf50;
    --accent-hover: #66bb6a;
    --border-color: #2d2d2d;
    --danger: #ef5350;
    --success: #4caf50;
    --priority-color: #ffc107;

    /* Matrix Colors - Dark Mode */
    --matrix-line: #444;
    --matrix-urgent-bg: rgba(255, 100, 100, 0.08);
    /* More transparent for dark mode */
    --matrix-not-urgent-bg: rgba(100, 255, 100, 0.08);
    --matrix-bg-top-left: #1e1e1e;
    --matrix-bg-top-right: #252525;
    --matrix-bg-bottom-left: #202020;
    --matrix-bg-bottom-right: #2a2a2a;
}

[data-theme="dark"] body {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

[data-theme="dark"] .sticker {
    background: #242424;
    border-color: #3a3a3a;
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .sticker:hover {
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .sticker.dragging {
    box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .sticker-actions {
    background: rgba(36, 36, 36, 0.95);
    border-top-color: rgba(58, 58, 58, 0.5);
}

[data-theme="dark"] .sticker-subtask {
    background: #2a2a2a;
    border-color: #3a3a3a;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .sticker.priority-red,
[data-theme="dark"] .sticker-subtask.priority-red {
    background: #3d1f1f;
    border-color: #664444;
}

[data-theme="dark"] .sticker.priority-blue,
[data-theme="dark"] .sticker-subtask.priority-blue {
    background: #1f2d3d;
    border-color: #445566;
}

[data-theme="dark"] .sticker.priority-yellow,
[data-theme="dark"] .sticker-subtask.priority-yellow {
    background: #3d3a1f;
    border-color: #666244;
}

[data-theme="dark"] .sticker.priority-purple,
[data-theme="dark"] .sticker-subtask.priority-purple {
    background: #2d1f3d;
    border-color: #544466;
}

[data-theme="dark"] .sticker-parent>.sticker-actions {
    background: rgba(36, 36, 36, 0.9);
}

[data-theme="dark"] .priority-menu {
    background: #2a2a2a;
    border-color: #3a3a3a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .add-btn:hover,
[data-theme="dark"] .action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .sticker-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .google-btn {
    background: #2a2a2a;
    color: #e8e8e8;
    border-color: #3a3a3a;
}

[data-theme="dark"] .google-btn:hover {
    background: #333333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .sticker-task-input {
    color: #e8e8e8;
    border-bottom-color: #666 !important;
}

/* Matrix Quadrant Labels */
.matrix-label {
    position: absolute;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    opacity: 0.6;
    cursor: text;
    z-index: 1;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s;
    background: transparent;
    white-space: nowrap;
}

.matrix-label:hover {
    opacity: 1;
    border-color: var(--border);
    background: var(--card-bg);
}

.matrix-label:focus {
    outline: none;
    opacity: 1;
    border-color: var(--primary);
    background: var(--card-bg);
}

.matrix-label-top-left {
    top: calc(50vh + 20px);
    left: 20px;
}

.matrix-label-top-right {
    top: calc(50vh + 20px);
    right: 20px;
}

.matrix-label-bottom-left {
    bottom: 20px;
    left: 20px;
}


.matrix-label-bottom-right {
    bottom: 20px;
    right: 20px;
}

/* Matrix Grid Styles */
.matrix-grid-background {
    background:
        linear-gradient(to right,
            var(--matrix-urgent-bg) 0%,
            var(--matrix-urgent-bg) calc(50% - 1px),
            var(--matrix-line) calc(50% - 1px),
            var(--matrix-line) calc(50% + 1px),
            var(--matrix-not-urgent-bg) calc(50% + 1px),
            var(--matrix-not-urgent-bg) 100%),
        linear-gradient(to bottom,
            transparent 0%,
            transparent calc(50% - 1px),
            var(--matrix-line) calc(50% - 1px),
            var(--matrix-line) calc(50% + 1px),
            transparent calc(50% + 1px),
            transparent 100%) !important;
}

.matrix-half-top {
    background: linear-gradient(to right, var(--matrix-bg-top-left) 50%, var(--matrix-bg-top-right) 50%) !important;
}

.matrix-half-bottom {
    background: linear-gradient(to right, var(--matrix-bg-bottom-left) 50%, var(--matrix-bg-bottom-right) 50%) !important;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    z-index: 10001;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Space invite button */
.space-invite-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    margin-left: auto;
    margin-right: 4px;
}

.space-invite-btn:hover {
    background: var(--accent-color);
    color: white;
}

.space-invite-btn i {
    font-size: 12px;
}

/* Members Panel */
.members-panel {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0 1rem 0;
    margin-bottom: 1rem;
}

.members-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.members-header i {
    font-size: 0.9rem;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.member-item:last-child {
    border-bottom: none;
}

.member-name {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.member-last-seen {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

@media (max-width: 768px) {
    .members-panel {
        padding: 0.5rem 0;
        margin-bottom: 0.75rem;
    }

    .member-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}