/* ==========================================
   Checker App - Main Stylesheet
   ========================================== */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #f1f5f9;
    --text: #1e293b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --header-height: 56px;
    --sidebar-width: 300px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

/* ==========================================
   Auth Pages
   ========================================== */

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-box h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 4px;
    color: var(--primary);
}

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

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.auth-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

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

.header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 100;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    text-decoration: none;
}
.header-title:hover {
    color: var(--primary);
    text-decoration: none;
}

.header-left {
    flex-shrink: 0;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

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

.project-selector {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg);
    min-width: 200px;
    cursor: pointer;
}

.project-selector:focus {
    outline: none;
    border-color: var(--primary);
}

.project-settings-btn {
    margin-left: 8px;
    padding: 6px 10px;
    font-size: 14px;
    color: var(--text-muted);
    border-color: var(--border);
    background: var(--bg);
    transition: all 0.15s;
}

.project-settings-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--bg-sidebar);
}

.user-name {
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s;
}
.user-name:hover {
    color: var(--text);
}

/* ==========================================
   Main Layout
   ========================================== */

.main-content {
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 24px;
    padding-bottom: 300px;
}

/* ==========================================
   Pages Grid (Main Page)
   ========================================== */

.pages-grid {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.new-page-bottom {
    max-width: 900px;
    margin: 24px auto 0;
    display: flex;
    justify-content: center;
}

.new-page-bottom .btn,
.empty-add-task-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    padding: 10px 24px;
    font-size: 14px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.new-page-bottom .btn:hover,
.empty-add-task-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--bg-sidebar);
}

.empty-tasks-bottom {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

/* Collapsed tasks (beyond first 10) in page cards */
.task-item-collapsed {
    display: none;
}

.task-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    color: var(--primary);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s;
}

.task-expand-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.loading-pages, .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    opacity: 0.3;
    margin-bottom: 16px;
}

.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.page-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.page-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}

.page-card-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.burger-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 6px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.burger-btn:hover {
    color: var(--text);
    background: var(--bg-sidebar);
}

.page-card-burger {
    opacity: 0;
    transition: opacity 0.15s;
}

.page-card:hover .page-card-burger {
    opacity: 1;
}

.page-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.page-card-title:hover {
    text-decoration: underline;
}

.page-card-date {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.page-card-preview {
    border-top: 1px solid var(--border);
    padding: 8px 0;
}

.preview-task {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 20px;
    font-size: 14px;
    cursor: default;
}

.preview-task:hover {
    background: rgba(79,70,229,0.03);
}

.preview-task .task-checkbox {
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.preview-task-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.preview-task-text.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-preview-priority {
    color: var(--warning);
    font-size: 11px;
    flex-shrink: 0;
}

.preview-empty {
    padding: 12px 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.preview-more {
    padding: 8px 20px;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    border-top: 1px solid var(--border);
}

/* ==========================================
   Full Page Editor
   ========================================== */

.full-editor {
    max-width: 900px;
    margin: 0 auto;
}

.full-editor-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.full-editor-header h2 {
    flex: 1;
}

.full-editor-body {
    min-height: 300px;
}

.page-title-editable {
    font-size: 24px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    outline: none;
    min-width: 200px;
}

.page-title-editable:focus {
    border-color: var(--primary);
    background: var(--bg-card);
}

.editor-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ==========================================
   Tasks Tree
   ========================================== */

.tasks-container {
    min-height: 200px;
}

.task-item {
    position: relative;
    margin: 2px 0;
    transition: opacity 0.2s;
}

.task-item.dragging {
    opacity: 0.5;
}

.task-item.drag-over {
    border-top: 2px solid var(--primary);
}

.task-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.task-row:hover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.06);
    border-radius: inherit;
    pointer-events: none;
}

.task-row:hover .task-actions {
    opacity: 1;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 0;
    user-select: none;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.menu-checkbox-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 3px;
    background: var(--bg-card);
    color: transparent;
    font-size: 10px;
    flex-shrink: 0;
    box-sizing: border-box;
    vertical-align: middle;
    margin-right: 8px;
}
.menu-checkbox-icon.checked {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.task-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 4px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    margin-top: 2px;
    font-size: 12px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: transparent;
    box-sizing: border-box;
}
.task-checkbox:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}
.task-checkbox.empty {
    /* empty square — no icon */
}
.task-checkbox.checked {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.task-checkbox.custom-status {
    border-color: var(--border);
    color: var(--text-muted);
}

.task-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    min-height: 24px;
    padding: 1px 4px;
    border: 1px solid transparent;
    border-radius: 2px;
    outline: none;
    word-break: break-word;
}

.task-text:focus {
    border-color: var(--primary);
    background: var(--bg-card);
}

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

.priority-high {
    background: repeating-linear-gradient(
        -45deg,
        #fef2f2 0 10px,
        #fce8e8 10px 20px
    );
}

/* Selection inside priority-high — keep the striped bg visible */
.priority-high ::selection,
.priority-high::selection {
    background: rgba(239, 68, 68, 0.3);
    color: inherit;
}

.task-status-badge {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--bg-sidebar);
    color: var(--text-muted);
    flex-shrink: 0;
    display: none;
}

.task-status-badge.show {
    display: inline;
}

.task-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.task-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 4px;
    font-size: 12px;
    border-radius: 2px;
}

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

.task-children {
    margin-left: 28px;
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.task-row:hover .drag-handle {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

/* ==========================================
   Task Assignee
   ========================================== */

.task-assignee {
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-sidebar);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: background 0.15s;
}

.task-assignee:hover {
    background: var(--border);
}

.task-assignee-empty {
    color: var(--text-muted);
    opacity: 0.5;
}

/* ==========================================
   Icon Select
   ========================================== */

.icon-select {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.icon-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    transition: all 0.15s;
}

.icon-option:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.icon-option.selected {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79,70,229,0.08);
}

.icon-select-sm {
    gap: 3px;
}

.icon-select-sm .icon-option {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-width: 1px;
}

/* ==========================================
   Icon Picker
   ========================================== */

.icon-picker-wrapper {
    position: relative;
    display: inline-block;
}

.icon-picker-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--bg-card);
    font-size: 14px;
    user-select: none;
    transition: border-color 0.15s;
}

.icon-picker-trigger:hover {
    border-color: var(--primary);
}

.icon-picker-trigger .fa-chevron-down {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.15s;
}

.icon-picker-trigger.open .fa-chevron-down {
    transform: rotate(180deg);
}

.icon-picker-dropdown {
    display: none;
    position: fixed;
    z-index: 10000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    width: 280px;
    padding: 8px;
}

.icon-picker-dropdown.open {
    display: block;
}

.icon-picker-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.icon-picker-search:focus {
    border-color: var(--primary);
}

.icon-picker-preview {
    text-align: center;
    padding: 12px;
    font-size: 32px;
    color: var(--primary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.icon-picker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.icon-picker-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    transition: all 0.15s;
}

.icon-picker-item:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79,70,229,0.05);
}

.icon-picker-item.selected {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79,70,229,0.1);
}

/* ==========================================
   Context Menu
   ========================================== */

.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 200px;
    padding: 4px 0;
}

.context-menu-list {
    list-style: none;
}

.context-menu-list li {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.1s;
}

.context-menu-list li:hover {
    background: rgba(79,70,229,0.08);
}

.context-menu-list li.danger {
    color: var(--danger);
}

.context-menu-list li.selected {
    background: rgba(79,70,229,0.12);
    color: var(--primary);
    font-weight: 500;
}

.context-menu-list li.selected i {
    color: var(--primary);
}

.context-menu-list li.danger:hover {
    background: rgba(239,68,68,0.08);
}

.context-menu-list li i {
    width: 16px;
    text-align: center;
    font-size: 12px;
}

.context-menu-list li.divider {
    height: 1px;
    background: var(--border);
    padding: 0;
    margin: 4px 0;
    cursor: default;
}

.context-menu-page-body {
    padding: 16px;
    min-width: 240px;
}

.context-menu-page-body .form-group {
    margin-bottom: 12px;
}

.context-menu-page-body label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.context-menu-page-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.context-menu-username-body {
    padding: 16px;
    min-width: 220px;
}

.context-menu-username-body .form-group {
    margin-bottom: 12px;
}

.context-menu-username-body label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.context-menu-username-actions {
    display: flex;
    justify-content: flex-end;
}

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

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-sm {
    max-width: 420px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
}

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

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

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

.modal-editable {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    min-height: 40px;
    font-size: 15px;
    outline: none;
}

.modal-editable:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.modal-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}

.modal-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

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

.form-row .form-group {
    flex: 1;
}
.form-row .form-group:last-child {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.form-row .form-group:last-child .checkbox-label {
    padding: 0;
}

/* ==========================================
   Custom Select (Status dropdown with icons)
   ========================================== */

.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    background: var(--bg-card);
    user-select: none;
    box-sizing: border-box;
}

.custom-select-trigger:hover {
    border-color: var(--primary);
}

.custom-select-trigger .fa-chevron-down {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.15s;
}

.custom-select-trigger.open .fa-chevron-down {
    transform: rotate(180deg);
}

.custom-select-trigger-text {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.custom-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.custom-select-dropdown.open {
    display: block;
}

.custom-select-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.custom-select-item:hover {
    background: var(--bg-hover);
}

.custom-select-item.selected {
    background: var(--bg-hover);
    font-weight: 500;
}

.custom-select-item .menu-checkbox-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.custom-select-item .menu-checkbox-icon.empty {
    border: 1.5px solid var(--border);
    border-radius: 2px;
}

.custom-select-item .menu-checkbox-icon.checked {
    border: 1.5px solid var(--primary);
    background: var(--primary);
    border-radius: 2px;
    color: #fff;
    font-size: 10px;
}

.custom-select-item i {
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    color: var(--text-muted);
}

.form-select, .form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
}

.form-select:focus, .form-input:focus {
    border-color: var(--primary);
}

/* ==========================================
   Buttons
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-secondary {
    background: var(--bg-sidebar);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    background: var(--bg-sidebar);
    color: var(--text);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: #fef2f2;
    border-color: var(--danger);
    color: var(--danger);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: #fff;
    border: none;
}

.btn-success:hover {
    background: #059669;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ==========================================
   Tabs
   ========================================== */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.15s;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==========================================
   Input Row
   ========================================== */

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-row .form-input {
    flex: 1;
}

.input-row .icon-select {
    flex-shrink: 0;
}

/* ==========================================
   Form Message
   ========================================== */

.form-message {
    margin-top: 8px;
    font-size: 13px;
    min-height: 20px;
}

.form-message.success {
    color: var(--success);
}

.form-message.error {
    color: var(--danger);
}

/* ==========================================
   User List
   ========================================== */

.user-list {
    list-style: none;
    margin-top: 8px;
}

.user-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 14px;
}

.user-list .user-list-empty {
    color: var(--text-muted);
    font-style: italic;
    justify-content: center;
    border-color: transparent;
}

.user-list .user-email {
    color: var(--text-muted);
    font-size: 12px;
}

.user-list .btn-sm {
    font-size: 12px;
    padding: 2px 8px;
    white-space: nowrap;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ==========================================
   Toast notifications
   ========================================== */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--text);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   Status List (in settings)
   ========================================== */

.status-list {
    list-style: none;
    margin-top: 8px;
}

.status-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 14px;
    gap: 8px;
}

.status-list .status-list-empty {
    color: var(--text-muted);
    font-style: italic;
    justify-content: center;
    border-color: transparent;
}

.status-list .status-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.status-list .status-name-input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    background: transparent;
}

.status-list .status-name-input:focus {
    border-color: var(--primary);
}

.status-list .status-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.status-list .status-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    color: var(--text-muted);
}

.status-list .status-actions button:hover {
    color: var(--text);
    background: var(--bg-sidebar);
}

.status-list .status-actions .status-delete-btn:hover {
    color: var(--danger);
    background: #fef2f2;
}

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

.modal-lg {
    max-width: 640px;
}

/* ==========================================
   Alerts
   ========================================== */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

/* ==========================================
   Scrollbar
   ========================================== */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================
   Utilities
   ========================================== */

.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
}

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

@media (max-width: 768px) {
    /* ---- Header ---- */
    .header {
        padding: 0 12px;
        gap: 8px;
    }

    .header-title {
        font-size: 16px;
    }

    .project-selector {
        min-width: 120px;
        max-width: 160px;
        font-size: 13px;
        padding: 4px 8px;
    }

    .user-name {
        font-size: 13px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
    }

    .header-right .btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    /* ---- Pages Grid (Main Page) ---- */
    .pages-grid {
        max-width: 100%;
        padding: 0 8px;
        gap: 12px;
    }

    .new-page-bottom {
        max-width: 100%;
        padding: 0 8px;
    }

    .page-card-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .page-card-burger {
        opacity: 1;
    }

    .page-card-title {
        font-size: 16px;
    }

    .page-card-date {
        font-size: 12px;
    }

    .preview-task {
        padding: 4px 14px;
        font-size: 13px;
    }

    .preview-empty,
    .preview-more {
        padding: 8px 14px;
    }

    /* ---- Full Page Editor ---- */
    .full-editor {
        max-width: 100%;
        padding: 0 8px;
    }

    .full-editor-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .full-editor-header h2 {
        font-size: 18px;
    }

    .page-title-editable {
        font-size: 18px;
        min-width: 120px;
    }

    .editor-actions .btn {
        font-size: 12px;
        padding: 4px 8px;
    }

    /* ---- Tasks ---- */
    .task-row {
        padding: 6px 4px;
        gap: 4px;
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    /* Drag handle on mobile — always visible */
    .drag-handle {
        opacity: 1;
        font-size: 12px;
        padding: 2px 4px;
    }

    /* Hide status badge on mobile */
    .task-status-badge.show {
        display: none !important;
    }

    /* Task text — allow wrapping properly */
    .task-text {
        font-size: 14px;
        line-height: 1.5;
        min-height: 22px;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Task actions always visible on mobile */
    .task-actions {
        opacity: 1;
    }

    .task-actions button {
        padding: 4px 6px;
        font-size: 13px;
    }

    /* Hide delete button (cross) on mobile */
    .delete-task-btn {
        display: none !important;
    }

    /* Task assignee — compact */
    .task-assignee {
        font-size: 11px;
        padding: 1px 4px;
    }

    /* Task children indent reduced */
    .task-children {
        margin-left: 20px;
    }

    /* ---- Checkbox label word-break ---- */
    .checkbox-label {
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        word-break: break-all;
    }

    /* ---- Modal ---- */
    .modal {
        max-width: 100%;
        margin: 0 8px;
        max-height: 90vh;
    }

    .modal-header {
        padding: 16px 16px 0;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 8px;
    }

    /* ---- Context menus on mobile ---- */
    .context-menu {
        min-width: 160px;
        font-size: 13px;
    }

    /* ---- Main content padding ---- */
    .main-content {
        padding: 12px;
        padding-bottom: 300px;
    }
}

@media (max-width: 480px) {
    /* ---- Header extra small ---- */
    .header {
        padding: 0 8px;
        gap: 4px;
    }

    .header-title {
        font-size: 14px;
    }

    .project-selector {
        min-width: 80px;
        max-width: 120px;
        font-size: 12px;
        padding: 3px 6px;
    }

    .header-right .btn {
        padding: 3px 6px;
        font-size: 11px;
    }

    /* ---- Pages Grid ---- */
    .pages-grid {
        gap: 8px;
    }

    .page-card-header {
        padding: 10px 12px;
    }

    .page-card-title {
        font-size: 15px;
    }

    /* ---- Tasks ---- */
    .task-row {
        padding: 4px 2px;
        gap: 3px;
    }

    .task-text {
        font-size: 13px;
    }

    .task-checkbox {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .task-children {
        margin-left: 16px;
    }

    /* ---- Main content ---- */
    .main-content {
        padding: 8px;
        padding-bottom: 300px;
    }

    /* ---- Full editor ---- */
    .page-title-editable {
        font-size: 16px;
        min-width: 80px;
    }
}