/* ============================================
   Components: buttons, cards, stats, tasks,
   calendar, progress, modal, toast, AI, etc.
   ============================================ */

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: var(--accent-blue);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-color-strong);
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

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

.btn-ghost:hover { color: var(--text-primary); }

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-full { width: 100%; justify-content: center; }

/* Action row buttons on dashboard */
.btn-action { padding: 0.8rem 1.5rem; border-radius: var(--radius-lg); font-size: 0.92rem; }

/* Button loading state */
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    padding: 0;
}

.icon-btn-sm:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.icon-btn-sm.text-red:hover { background: var(--accent-red); color: #fff; }

/* ---------- Action Row ---------- */
.action-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

/* ---------- Stat Cards ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '\f0c9';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: -18px;
    bottom: -24px;
    font-size: 4.5rem;
    color: rgba(255, 255, 255, 0.025);
    pointer-events: none;
    transform: rotate(-12deg);
}

.stat-card:hover {
    border-color: var(--border-color-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--accent-blue-soft); color: #60a5fa; }
.stat-icon.green { background: var(--accent-green-soft); color: #4ade80; }
.stat-icon.orange { background: var(--accent-orange-soft); color: var(--accent-orange); }
.stat-icon.purple { background: var(--accent-purple-soft); color: #a78bfa; }

.stat-data { display: flex; flex-direction: column; min-width: 0; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.stat-label { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.2rem; }

/* ---------- Cards & Widgets ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: border-color 0.25s ease;
}

.card:hover { border-color: var(--border-color-strong); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.card-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-header h2 i { color: var(--accent-blue); font-size: 1rem; }

.card-header-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

/* (decorative select-like chip removed) */

.dashboard-widgets {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.dashboard-widgets.bottom-row {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 0;
}

/* Pro badge removed - no subscription content */

/* Progress bar (Today's Tasks header) */
.progress-track {
    background: var(--bg-input);
    border-radius: 99px;
    height: 8px;
    width: 140px;
    overflow: hidden;
}

.progress-track.slim { height: 6px; }

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), #60a5fa);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.progress-label { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; }

/* ---------- Progress widget (donut) ---------- */
.progress-widget-body {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.progress-ring-wrap { position: relative; width: 120px; height: 120px; flex-shrink: 0; }

.progress-ring-bg { stroke: var(--bg-input); }
.progress-ring-fill {
    stroke: var(--accent-blue);
    transition: stroke-dashoffset 0.6s ease;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
}

.progress-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.progress-percent { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.progress-subtext { font-size: 0.72rem; color: var(--text-secondary); }

.progress-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}

.progress-legend li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    color: var(--text-primary);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.progress-legend li:last-child { border-bottom: none; padding-bottom: 0; }
.progress-legend i { font-size: 0.95rem; }
.legend-green { color: var(--accent-green); }
.legend-blue { color: var(--accent-blue); }
.legend-orange { color: var(--accent-orange); }

.legend-count { margin-left: auto; font-weight: 700; font-size: 0.95rem; }

/* ---------- Quick Calendar ---------- */
.calendar-strip {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.6rem;
    align-items: end;
}

.cal-day-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    padding-bottom: 0.5rem;
    font-weight: 600;
}

.cal-day-btn {
    height: 46px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.cal-day-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: translateY(-2px);
}

.cal-day-btn.today {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.cal-day-btn.today:hover { background: var(--accent-blue-hover); color: #fff; }

/* ---------- Task List ---------- */
.task-list { display: flex; flex-direction: column; gap: 0.65rem; }

.task-list-compact { display: flex; flex-direction: column; gap: 0.5rem; min-height: 160px; justify-content: center; }

.task-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    transition: all 0.2s ease;
}

.task-item:hover {
    border-color: var(--border-color-strong);
    background: var(--bg-card-hover);
}

.task-main { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; flex: 1; }

.task-title {
    font-size: 0.92rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

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

.task-item.completed {
    background: transparent;
    border-style: dashed;
    opacity: 0.85;
}

.task-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* Visible, easy-to-hit Complete button on every task card */
.task-complete-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    background: transparent;
    color: transparent;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.2s ease;
    padding: 0;
}

.task-complete-btn:hover {
    background: var(--accent-blue-soft);
    border-color: var(--accent-blue);
}

.task-complete-btn.done {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}

.task-complete-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Important (star) toggle */
.task-star-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    transition: color 0.2s ease, transform 0.15s ease;
    line-height: 1;
}

.task-star-btn:hover { color: var(--accent-orange); transform: scale(1.15); }
.task-star-btn.starred { color: var(--accent-orange); }
.task-star-btn.starred:hover { color: var(--text-secondary); }

.task-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
}

.task-date {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.task-date.overdue { color: var(--accent-red); font-weight: 600; }

/* Urgency chips — deadline-driven, computed live */
.urgency-chip {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.urgency-chip.overdue  { background: var(--accent-red); color: #fff; }
.urgency-chip.critical { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.4); }
.urgency-chip.high     { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); border: 1px solid rgba(249, 115, 22, 0.4); }
.urgency-chip.medium   { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.35); }
.urgency-chip.normal   { background: var(--bg-card-hover); color: var(--text-secondary); border: 1px solid var(--border-color); }
.urgency-chip.mini     { font-size: 0.66rem; padding: 0.12rem 0.45rem; margin-left: 0.35rem; }

.task-time-part {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.task-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.badge-priority {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    text-transform: capitalize;
}

.badge-priority.high { background: var(--accent-red); color: #fff; }
.badge-priority.medium { background: var(--accent-orange); color: #fff; }
.badge-priority.low { background: var(--accent-green); color: #fff; }

/* Compact dashboard rows */
.task-item.compact { padding: 0.6rem 0.75rem; }
.task-item.compact .task-sub {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.empty-state-icon {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    background: var(--accent-blue-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-blue);
    margin-bottom: 0.75rem;
    transform: rotate(-4deg);
}

.empty-state-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.empty-state-sub { font-size: 0.85rem; margin: 0 0 1rem; }
.empty-state i { font-size: 2rem; color: var(--text-secondary); }
.empty-state p { margin: 0.5rem 0 0; font-size: 0.9rem; }
.empty-state .btn { margin-top: 0.75rem; }

/* ---------- AI Assistant ---------- */
.ai-desc { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.55; margin: 0 0 1.1rem; }

.ai-input-group {
    display: flex;
    gap: 0.6rem;
}

.ai-input-group input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
}

.ai-input-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-soft);
}

.ai-input-group input::placeholder { color: var(--text-secondary); }

.ai-send-btn { padding: 0.75rem 1.05rem; border-radius: var(--radius-md); }

.ai-loading {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0.75rem 0;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent-blue-soft);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.ai-suggestion-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin: 0 0 0.5rem; }
.ai-suggestion-top p { margin: 0; font-size: 0.88rem; }
.ai-suggestion-desc { margin: 0.5rem 0; font-size: 0.82rem; color: var(--text-secondary); }
.ai-suggestion-steps-label { margin: 0.5rem 0 0.25rem; font-size: 0.85rem; }
.ai-suggestion-steps { margin: 0; padding-left: 1.25rem; color: var(--text-secondary); font-size: 0.82rem; }
.ai-suggestion-steps li { margin-bottom: 0.35rem; }

.ai-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }

/* ---------- Skeleton loaders ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-task { pointer-events: none; }
.skeleton-task .skeleton-text { height: 16px; }

/* ---------- Task filters bar ---------- */
.task-filters-bar {
    display: flex;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 0.9rem;
    height: 44px;
    flex: 1;
    min-width: 220px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-soft); }
.search-box i { color: var(--text-secondary); font-size: 0.85rem; }

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 0;
}

.search-box input::placeholder { color: var(--text-secondary); }

.filter-controls { display: flex; gap: 0.6rem; }

.filter-controls select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0 0.9rem;
    height: 44px;
    font-family: var(--font-family);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-controls select:focus { border-color: var(--accent-blue); }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 18, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.4rem 1.5rem 0;
}

.modal-header h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.05rem;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

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

.modal-body { padding: 1.25rem 1.5rem 0.5rem; }

.form-group { margin-bottom: 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; }

.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }

.form-group input,
.form-group textarea,
.form-group select {
    background: var(--bg-input);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-soft);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-secondary); }

.form-group input[type="date"] { color-scheme: dark; }
body.light-mode .form-group input[type="date"] { color-scheme: light; }

/* Validation state (kept until corrected) */
.form-group input.input-error {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Clear the error state as soon as the user edits the field */
#task-form input.input-error,
#task-form textarea.input-error {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Accessible keyboard focus for all interactive controls */
.btn:focus-visible,
.icon-btn-sm:focus-visible,
.nav-item a:focus-visible,
.close-modal-btn:focus-visible,
.toast-close:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Light-mode polish */
body.light-mode .modal-overlay {
    background: rgba(16, 24, 40, 0.45);
    backdrop-filter: blur(4px);
}

body.light-mode .sidebar-overlay {
    background: rgba(16, 24, 40, 0.35);
}

body.light-mode .stat-card::after {
    color: rgba(16, 24, 40, 0.035);
}

body.light-mode .nav-item.active a {
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}

.form-row { display: flex; gap: 0.9rem; }
.form-row .form-group { flex: 1; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem 1.5rem;
}

/* ---------- Toasts (bottom-right on desktop, bottom on mobile) ---------- */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 300;
    display: flex;
    flex-direction: column-reverse; /* newest toast closest to the corner, older stack upward */
    gap: 0.6rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color-strong);
    border-left: 3px solid var(--accent-blue);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    min-width: 300px;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    font-size: 0.88rem;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.toast.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.toast-exit {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-success { border-left-color: var(--accent-green); }
.toast-error { border-left-color: var(--accent-red); }
.toast-warning { border-left-color: var(--accent-orange); }
.toast-info { border-left-color: var(--accent-blue); }

.toast-icon { font-size: 1.05rem; display: flex; }
.toast-success .toast-icon { color: var(--accent-green); }
.toast-error .toast-icon { color: var(--accent-red); }
.toast-warning .toast-icon { color: var(--accent-orange); }
.toast-info .toast-icon { color: var(--accent-blue); }

.toast-content { flex: 1; line-height: 1.4; }

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem;
}

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

/* ---------- Notifications ---------- */
.notification-btn { position: relative; }

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-primary);
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 150;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
}

.notification-header h3 { margin: 0; font-size: 0.95rem; font-weight: 700; }

.notification-list { max-height: 340px; overflow-y: auto; }

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover { background: var(--bg-card-hover); }
.notification-item:last-child { border-bottom: none; }
.notification-item.unread { background: var(--accent-blue-soft); }
.notification-item.unread:hover { background: var(--accent-blue-soft); }

.notification-icon { font-size: 1rem; }
.notification-icon.success { color: var(--accent-green); }
.notification-icon.info { color: var(--accent-blue); }
.notification-icon.warning { color: var(--accent-orange); }
.notification-icon.error { color: var(--accent-red); }

.notification-content { flex: 1; min-width: 0; }
.notification-title { font-size: 0.85rem; font-weight: 600; }
.notification-message { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.1rem; }
.notification-time { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.25rem; }

.notification-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.notification-empty i { font-size: 1.5rem; margin-bottom: 0.5rem; display: block; }
.notification-empty p { margin: 0; }

/* ---------- Responsive grids ---------- */
@media (max-width: 1250px) and (min-width: 769px) {
    .header-left h1 { font-size: 1.4rem; }
    .header-left p { font-size: 0.85rem; }
    .btn-action { padding: 0.65rem 1rem; font-size: 0.85rem; }
    .stats-grid { gap: 0.75rem; }
    .stat-card { padding: 1rem 1.1rem; }
    .stat-value { font-size: 1.35rem; }
    .stat-icon { width: 44px; height: 44px; font-size: 1rem; }
    #main-content { padding: 1.5rem 1.75rem; }
}

@media (max-width: 1100px) {
    .dashboard-widgets,
    .dashboard-widgets.bottom-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .stats-grid { grid-template-columns: 1fr; }
    .calendar-strip { gap: 0.35rem; }
    .cal-day-btn { height: 40px; font-size: 0.8rem; }
    .form-row { flex-direction: column; gap: 0; }
    .action-row .btn-action { flex: 1; }

    /* Toasts: bottom of screen with safe margins, full-width-ish */
    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.9rem;
    }
    .toast {
        min-width: 0;
        max-width: none;
        width: 100%;
        font-size: 0.84rem;
    }

    /* Modal becomes a bottom sheet so it is never clipped or hidden */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .modal-content {
        max-width: none;
        max-height: 88vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
    .modal-header, .modal-body { padding-left: 1.1rem; padding-right: 1.1rem; }
    .modal-actions {
        padding: 1rem 1.1rem 1.3rem;
        padding-bottom: max(1.3rem, env(safe-area-inset-bottom));
    }
    .modal-actions .btn { flex: 1; }
}

/* ============================================
   AI Planner
   ============================================ */
.planner-hero,
.planner-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
}

.planner-hero { text-align: center; max-width: 760px; margin: 2rem auto; box-shadow: var(--shadow-md); }
.planner-hero-icon {
    width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: var(--radius-lg);
    background: var(--accent-purple-soft); color: var(--accent-purple);
    display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
}
.planner-hero h1 { margin: 0 0 0.5rem; font-size: 1.6rem; }
.planner-sub { color: var(--text-secondary); max-width: 520px; margin: 0 auto 1.5rem; }
.planner-input-wrap { display: flex; gap: 0.75rem; align-items: flex-end; }
.planner-goal-input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border-color);
    color: var(--text-primary); border-radius: var(--radius-md); padding: 0.85rem 1rem;
    font-size: 1rem; resize: vertical; font-family: inherit;
}
.planner-goal-input:focus { outline: 2px solid var(--accent-blue); border-color: var(--accent-blue); }
.planner-start-btn { padding: 0.85rem 1.5rem; white-space: nowrap; }
.planner-examples { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin: 1.25rem 0 0.75rem; }
.planner-example-chip {
    background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-secondary);
    border-radius: 999px; padding: 0.45rem 0.95rem; cursor: pointer; font-size: 0.85rem; transition: all 0.15s;
}
.planner-example-chip:hover { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-soft); }
.planner-note { color: var(--text-secondary); font-size: 0.8rem; margin-top: 0.75rem; }

.planner-card { max-width: 860px; margin: 2rem auto; box-shadow: var(--shadow-sm); }
.planner-card h2 { margin: 0.35rem 0 0.4rem; font-size: 1.25rem; }
.planner-center { text-align: center; }
.planner-muted { color: var(--text-secondary); font-size: 0.9rem; }
.planner-step-label {
    display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 600;
    color: var(--accent-purple); background: var(--accent-purple-soft);
    padding: 0.25rem 0.75rem; border-radius: 999px;
}
.planner-spinner {
    width: 44px; height: 44px; margin: 0 auto 1rem; border-radius: 50%;
    border: 4px solid var(--accent-blue-soft); border-top-color: var(--accent-blue);
    animation: planner-spin 0.9s linear infinite;
}
@keyframes planner-spin { to { transform: rotate(360deg); } }

.planner-error {
    display: flex; align-items: center; gap: 0.6rem; background: rgba(239, 68, 68, 0.12);
    border: 1px solid var(--accent-red); color: var(--accent-red);
    border-radius: var(--radius-md); padding: 0.75rem 1rem; margin: 1rem 0; font-size: 0.9rem;
}
.planner-guest-card { text-align: center; max-width: 480px; margin: 3rem auto; }
.planner-guest-icon { font-size: 2rem; color: var(--accent-blue); margin-bottom: 0.75rem; }
.planner-info-answer { border-left: 3px solid var(--accent-purple); margin-top: 1.5rem; text-align: left; }

/* Questions */
.planner-q-head { margin-bottom: 1rem; }
.planner-question { padding: 1.1rem 0; border-top: 1px solid var(--border-color); }
.planner-question-title { font-weight: 600; margin-bottom: 0.6rem; }
.planner-options { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
.planner-option {
    display: flex; align-items: center; gap: 0.6rem; background: var(--bg-input);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    padding: 0.55rem 0.9rem; cursor: pointer; transition: all 0.15s; font-size: 0.92rem;
}
.planner-option:hover { border-color: var(--accent-blue); }
.planner-option:has(input:checked) { border-color: var(--accent-blue); background: var(--accent-blue-soft); color: var(--text-primary); }
.planner-custom-answer {
    width: 100%; background: transparent; border: 1px dashed var(--border-color-strong);
    color: var(--text-primary); border-radius: var(--radius-md); padding: 0.5rem 0.85rem; font-size: 0.9rem;
}
.planner-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; }

/* Summary */
.planner-summary-table { margin: 1.25rem 0; }
.planner-summary-row {
    display: grid; grid-template-columns: 180px 1fr; gap: 1rem; padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color); font-size: 0.95rem;
}
.planner-summary-label { color: var(--text-secondary); font-weight: 600; }
.planner-assumptions {
    display: flex; gap: 0.6rem; background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.5); color: #f59e0b;
    border-radius: var(--radius-md); padding: 0.75rem 1rem; margin-top: 1rem; font-size: 0.88rem;
}
.planner-assumptions ul { margin: 0.25rem 0 0 1rem; }

/* Preview */
.planner-preview-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.planner-title-input {
    width: 100%; font-size: 1.25rem; font-weight: 700; background: transparent; border: none;
    color: var(--text-primary); border-bottom: 1px solid transparent; padding: 0.25rem 0; font-family: inherit;
}
.planner-title-input:hover, .planner-title-input:focus { border-bottom-color: var(--accent-blue); outline: none; }
.planner-desc-input {
    width: 100%; font-size: 0.9rem; background: transparent; border: none; color: var(--text-secondary);
    border-bottom: 1px solid transparent; padding: 0.25rem 0; font-family: inherit;
}
.planner-desc-input:hover, .planner-desc-input:focus { border-bottom-color: var(--accent-blue); outline: none; }
.planner-preview-stats { display: flex; gap: 1rem; color: var(--text-secondary); font-size: 0.85rem; white-space: nowrap; }
.plan-section {
    background: var(--bg-elevated); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 1rem; margin-bottom: 0.9rem;
}
.plan-section-head { display: flex; align-items: center; gap: 0.6rem; }
.plan-folder-icon { color: #f59e0b; }
.plan-section-title {
    flex: 1; background: transparent; border: none; color: var(--text-primary);
    font-weight: 700; font-size: 1rem; padding: 0.25rem 0.4rem; border-radius: var(--radius-sm); font-family: inherit;
}
.plan-section-title:hover, .plan-section-title:focus { background: var(--bg-input); outline: none; }
.plan-section-desc { color: var(--text-secondary); font-size: 0.85rem; margin: 0.35rem 0 0 1.6rem; }
.plan-row-actions { display: flex; gap: 0.3rem; }
.plan-icon-btn {
    background: transparent; border: 1px solid transparent; color: var(--text-secondary);
    width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s;
}
.plan-icon-btn:hover { background: var(--bg-card-hover); color: var(--accent-blue); }
.plan-tasks { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.plan-empty-tasks { color: var(--text-secondary); font-size: 0.85rem; font-style: italic; padding: 0.35rem 0 0.35rem 1.6rem; }
.plan-task { padding-left: calc(var(--depth, 0) * 1.4rem); }
.plan-task-row {
    display: flex; align-items: center; gap: 0.6rem; background: var(--bg-card);
    border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.5rem 0.75rem;
}
.plan-task-icon { color: var(--accent-blue); font-size: 0.7rem; }
.plan-task-main { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.plan-task-title, .plan-task-desc {
    background: transparent; border: none; color: var(--text-primary); padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm); font-family: inherit; font-size: 0.92rem;
}
.plan-task-desc { color: var(--text-secondary); font-size: 0.82rem; }
.plan-task-title:hover, .plan-task-desc:hover { background: var(--bg-input); outline: none; }
.plan-task-controls { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.plan-task-priority, .ptree-priority {
    background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary);
    border-radius: var(--radius-sm); padding: 0.25rem 0.35rem; font-size: 0.8rem; cursor: pointer;
}
.plan-task-due, .plan-task-due-time, .ptree-due-date, .ptree-due-time {
    background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary);
    border-radius: var(--radius-sm); padding: 0.25rem 0.35rem; font-size: 0.8rem;
    color-scheme: dark;
}
body.light-mode .plan-task-due, body.light-mode .plan-task-due-time,
body.light-mode .ptree-due-date, body.light-mode .ptree-due-time { color-scheme: light; }
.plan-task-deps { color: var(--text-secondary); font-size: 0.78rem; padding: 0.15rem 0 0 1.6rem; }
.plan-subtasks { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.4rem; }
.planner-dashed-add { width: 100%; border: 1px dashed var(--border-color-strong); justify-content: center; }
.planner-sticky-actions { border-top: 1px solid var(--border-color); padding-top: 1rem; }

/* Saved project - folder tree */
.project-detail { max-width: 1100px; margin: 0 auto; }
.project-detail-head { margin-bottom: 1.25rem; }
.project-back-btn { margin-bottom: 0.75rem; }
.project-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.project-title { margin: 0; font-size: 1.5rem; }
.btn-danger-text { color: var(--accent-red); }
.btn-danger-text:hover { background: rgba(239, 68, 68, 0.12); }
.project-grid { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .project-grid { grid-template-columns: 1fr; } }

.ptree-section { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); margin-bottom: 0.9rem; overflow: hidden; }
.ptree-section-head {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem;
    background: var(--bg-elevated); cursor: pointer; user-select: none;
}
.ptree-chevron { color: var(--text-secondary); font-size: 0.8rem; transition: transform 0.15s; }
.ptree-folder { color: #f59e0b; }
.ptree-section-title {
    flex-shrink: 0; width: 180px; background: transparent; border: none; color: var(--text-primary);
    font-weight: 700; padding: 0.2rem 0.4rem; border-radius: var(--radius-sm); font-family: inherit; font-size: 0.95rem;
}
.ptree-section-title:hover, .ptree-section-title:focus { background: var(--bg-input); outline: none; }
.ptree-section-progress-label { color: var(--text-secondary); font-size: 0.8rem; white-space: nowrap; }
.ptree-section-bar { flex: 1; min-width: 60px; }
.ptree-section-body { padding: 0.75rem 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; }
.ptree-section-body.collapsed { display: none; }
.ptree-task { padding-left: calc(var(--depth, 0) * 1.4rem); }
.ptree-task-row {
    display: flex; align-items: center; gap: 0.6rem; background: var(--bg-elevated);
    border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.5rem 0.75rem;
}
.ptree-task.done .ptree-title { text-decoration: line-through; opacity: 0.6; }
.ptree-check { width: 18px; height: 18px; accent-color: var(--accent-green); cursor: pointer; flex-shrink: 0; }
.ptree-task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.ptree-title, .ptree-desc {
    background: transparent; border: none; color: var(--text-primary); padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm); font-family: inherit; font-size: 0.92rem;
}
.ptree-desc { color: var(--text-secondary); font-size: 0.82rem; }
.ptree-title:hover, .ptree-desc:hover { background: var(--bg-input); outline: none; }
.ptree-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding-left: 0.4rem; font-size: 0.75rem; color: var(--text-secondary); }
.ptree-task-controls { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.ptree-subtasks { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.4rem; }
.ptree-subcount { color: var(--accent-purple); }

.urgency-chip {
    padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}
.urgency-overdue { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.urgency-critical { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.urgency-high { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.urgency-medium { background: var(--accent-blue-soft); color: var(--accent-blue); }
.urgency-normal { background: var(--bg-input); color: var(--text-secondary); }

/* Progress */
.planner-progress-track {
    height: 8px; border-radius: 999px; background: var(--bg-input); overflow: hidden; width: 100%;
}
.planner-progress-track.small { height: 6px; }
.planner-progress-fill {
    height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    transition: width 0.3s ease;
}

.project-side-card { position: sticky; top: 1rem; }
.project-side-card h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.project-progress-big { font-size: 2rem; font-weight: 800; color: var(--accent-green); margin-bottom: 0.5rem; }
.project-side-stats { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.project-side-stats li { display: flex; justify-content: space-between; font-size: 0.88rem; }
.project-side-stats li span { color: var(--text-secondary); }
.project-section-progress { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; margin-top: 0.6rem; font-size: 0.8rem; }
.project-section-pct { color: var(--text-secondary); }

/* Projects list */
.projects-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.projects-list-head h2 { margin: 0; font-size: 1.4rem; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.project-card {
    text-align: left; background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; cursor: pointer; transition: all 0.15s;
    color: var(--text-primary); font-family: inherit; box-shadow: var(--shadow-sm);
}
.project-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.project-card-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.35rem; display: flex; align-items: center; gap: 0.5rem; }
.project-card-title i { color: #f59e0b; }
.project-card-desc { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.75rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.project-card-meta { display: flex; justify-content: space-between; color: var(--text-secondary); font-size: 0.78rem; margin-top: 0.5rem; }
.projects-empty { max-width: 480px; grid-column: 1 / -1; margin: 2rem auto; }
.projects-empty-icon { font-size: 2rem; color: var(--accent-blue); margin-bottom: 0.5rem; }

@media (max-width: 768px) {
    .planner-input-wrap { flex-direction: column; }
    .planner-start-btn { width: 100%; }
    .plan-task-row, .ptree-task-row { flex-wrap: wrap; }
    .plan-task-controls, .ptree-task-controls { width: 100%; justify-content: flex-end; }
    .planner-summary-row { grid-template-columns: 1fr; gap: 0.2rem; }
    .ptree-section-title { width: 110px; }
}

/* ===================== Custom Categories ===================== */

/* Sidebar: header row with + button */
.sidebar-cats-head { display: flex; align-items: center; justify-content: space-between; padding-right: 0.6rem; }
.sidebar-add-cat-btn {
    background: transparent; border: 1px dashed var(--border-color); color: var(--text-secondary);
    width: 22px; height: 22px; border-radius: 6px; cursor: pointer; font-size: 0.65rem;
    display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.sidebar-add-cat-btn:hover { color: var(--accent-blue); border-color: var(--accent-blue); background: var(--accent-blue-soft); }
#sidebar.collapsed .sidebar-add-cat-btn { display: none; }

/* Scrollable category list */
.category-nav-scroll { max-height: 240px; overflow-y: auto; scrollbar-width: thin; }
.category-nav-scroll::-webkit-scrollbar { width: 5px; }
.category-nav-scroll::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; }

.category-nav-item .cat-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-nav-item .cat-menu-btn {
    background: transparent; border: none; color: var(--text-secondary); cursor: pointer;
    font-size: 0.7rem; padding: 0.15rem 0.25rem; border-radius: 6px; opacity: 0; transition: opacity 0.15s;
}
.category-nav-item:hover .cat-menu-btn, .category-nav-item .cat-menu-btn.open { opacity: 1; }
.category-nav-item .cat-menu-btn:hover { color: var(--accent-blue); background: var(--bg-card-hover); }
#sidebar.collapsed .cat-menu-btn { display: none; }

.cat-menu {
    position: fixed; z-index: 2200; min-width: 130px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 0.35rem;
    display: flex; flex-direction: column; gap: 2px;
}
.cat-menu-item {
    display: flex; align-items: center; gap: 0.5rem; width: 100%;
    background: transparent; border: none; color: var(--text-primary);
    font-size: 0.8rem; padding: 0.45rem 0.6rem; border-radius: var(--radius-sm);
    cursor: pointer; text-align: left;
}
.cat-menu-item:hover { background: var(--bg-card-hover); }
.cat-menu-item.cat-menu-danger:hover { background: rgba(239, 68, 68, 0.15); color: var(--danger-red, #ef4444); }

/* Icon color variants */
.cat-color-green { color: #10b981; }
.cat-color-yellow { color: #f59e0b; }
.cat-color-purple { color: #a78bfa; }
.cat-color-red { color: #ef4444; }
.cat-color-blue { color: var(--accent-blue, #3b82f6); }

/* Empty state */
.category-empty-state { padding: 0.6rem 0.9rem 0.2rem; }
.category-empty-state p { font-size: 0.75rem; color: var(--text-secondary); margin: 0 0 0.5rem; }
.category-empty-state .btn { width: 100%; }
#sidebar.collapsed .category-empty-state { display: none !important; }

/* Category modal */
.category-delete-warning {
    display: flex; gap: 0.7rem; align-items: flex-start;
    background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md); padding: 0.8rem; margin-bottom: 1rem;
}
.category-delete-warning i { color: #ef4444; margin-top: 0.15rem; }
.category-delete-warning p { margin: 0; font-size: 0.85rem; color: var(--text-primary); }
.btn-danger-solid { background: #ef4444 !important; border-color: #ef4444 !important; color: #fff !important; }
.btn-danger-solid:hover { background: #dc2626 !important; }
.btn-danger-text { color: #ef4444; }

/* Category overview view */
.category-overview { display: flex; flex-direction: column; gap: 1.2rem; }
.category-overview-head { display: flex; flex-direction: column; gap: 0.8rem; }
.category-head-card { display: flex; align-items: center; gap: 1rem; }
.category-head-icon {
    width: 56px; height: 56px; border-radius: var(--radius-lg); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
    background: var(--accent-blue-soft);
}
.category-head-card h2 { margin: 0 0 0.15rem; font-size: 1.35rem; }
.category-head-card p { margin: 0 0 0.4rem; font-size: 0.85rem; }
.category-head-actions { display: flex; gap: 0.4rem; }

.category-stats-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.7rem;
}
.category-stat {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md);
    padding: 0.8rem; display: flex; flex-direction: column; gap: 0.2rem; text-align: center;
    font-size: 0.75rem; color: var(--text-secondary);
}
.category-stat-num { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.category-stat-num.cat-green { color: #10b981; }
.category-stat-num.cat-red { color: #ef4444; }

.category-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.category-sections h3 { font-size: 0.95rem; margin: 0 0 0.7rem; display: flex; align-items: center; gap: 0.5rem; }
.category-sections h3 i { color: var(--accent-blue); font-size: 0.85rem; }
#category-tasks-list .task-item { cursor: default; }

/* Planner preview category row */
.plan-category-row {
    display: flex; align-items: center; gap: 0.6rem; margin: 0.6rem 0 0.2rem;
}
.plan-category-row label { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; }
.plan-category-row select { max-width: 260px; }

@media (max-width: 900px) {
    .category-sections { grid-template-columns: 1fr; }
}

/* ===================== Project folder navigation & suggestions ===================== */

/* Colored category dots (shared: sidebar, project cards, category preview) */
.cat-dot {
    width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0;
    background: var(--accent-blue, #3b82f6);
}
.cat-dot-blue { background: var(--accent-blue, #3b82f6); }
.cat-dot-green { background: #10b981; }
.cat-dot-yellow { background: #f59e0b; }
.cat-dot-purple { background: #a78bfa; }
.cat-dot-red { background: #ef4444; }

/* Priority dots — red high, yellow medium, green low (color is never the only cue: tooltip + aria-label) */
.prio-dot {
    width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; margin-top: 0.35rem;
}
.prio-dot.prio-high { background: #ef4444; }
.prio-dot.prio-medium { background: #f59e0b; }
.prio-dot.prio-low { background: #10b981; }

/* Projects header: three creation methods */
.projects-list-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.projects-create-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.projects-list-head h2 { margin: 0; }

/* Project overview folder cards */
.project-folder-card { align-items: stretch; text-align: left; position: relative; }
.project-folder-icon { font-size: 1.4rem; color: #f59e0b; margin-bottom: 0.4rem; }
.project-card-pct { font-weight: 700; color: var(--text-primary); }
.project-card-cat {
    display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem;
    font-size: 0.75rem; color: var(--text-secondary);
}

/* Method B: paste structure */
.planner-paste-card h2 { margin: 0.2rem 0 0.4rem; }
.paste-structure-input {
    width: 100%; min-height: 320px; resize: vertical; font-family: ui-monospace, Consolas, monospace;
    font-size: 0.9rem; line-height: 1.55; padding: 0.9rem; border-radius: var(--radius-md);
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary);
}
.paste-structure-input:focus { outline: 2px solid var(--accent-blue); border-color: transparent; }
.paste-hints { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0.6rem 0 0; }
.paste-hint { font-size: 0.75rem; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 0.35rem; }
.paste-hint i { color: var(--accent-blue); }

/* Breadcrumbs */
.project-breadcrumbs {
    display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
    padding: 0.55rem 0.8rem; margin-bottom: 1rem; border-radius: var(--radius-md);
    background: var(--bg-card); border: 1px solid var(--border-color);
}
.crumb {
    background: none; border: none; color: var(--text-secondary); cursor: pointer;
    font-size: 0.85rem; padding: 0.15rem 0.3rem; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; gap: 0.35rem;
}
button.crumb:hover { color: var(--accent-blue); background: var(--accent-blue-soft); }
.crumb-root { font-weight: 600; color: var(--text-primary); }
.crumb-current { color: var(--accent-blue); font-weight: 600; cursor: default; }
.crumb-sep { font-size: 0.6rem; color: var(--text-secondary); opacity: 0.6; }

/* Section folder cards */
.folder-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.8rem; margin-bottom: 0.8rem;
}
.folder-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md);
    padding: 0.9rem; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 0.35rem;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.folder-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); }
.folder-card-icon { color: #f59e0b; font-size: 1.15rem; }
.folder-card-name { font-weight: 600; font-size: 0.92rem; color: var(--text-primary); }
.folder-card-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-secondary); }
.folder-card-pct { font-weight: 700; color: var(--text-primary); }

/* Folder (section/task) view */
.folder-view-head {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem;
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.6rem 0.8rem;
}
.folder-view-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; flex: 1; }
.folder-view-title i { color: #f59e0b; }
.folder-rename { flex: 1; min-width: 140px; font-weight: 600; }

/* Compact task rows */
.ptask-list { display: flex; flex-direction: column; gap: 0.4rem; }
.ptask-row {
    display: flex; align-items: flex-start; gap: 0.55rem;
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md);
    padding: 0.55rem 0.7rem;
}
.ptask-row.done { opacity: 0.65; }
.ptask-row.done .ptask-title { text-decoration: line-through; }
.ptask-row.folder-root { border-left: 3px solid var(--accent-blue); }
.ptask-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.ptask-title { font-size: 0.92rem; color: var(--text-primary); overflow-wrap: anywhere; }
.ptask-meta { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-secondary); }
.ptask-date { display: inline-flex; align-items: center; gap: 0.3rem; }
.ptask-date.overdue { color: #ef4444; font-weight: 600; }
.ptask-open {
    background: none; border: none; color: var(--accent-blue); cursor: pointer; font-size: 0.75rem;
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.35rem; border-radius: var(--radius-sm);
}
.ptask-open:hover { background: var(--accent-blue-soft); }
.ptask-open i { font-size: 0.6rem; }
.ptask-actions { display: flex; gap: 0.15rem; align-items: center; }

/* Inline editor inside a task row */
.ptask-editor {
    display: flex; flex-direction: column; gap: 0.4rem; width: 100%; margin-top: 0.4rem;
    padding-top: 0.5rem; border-top: 1px dashed var(--border-color);
}
.ptask-editor .ptree-title, .ptask-editor .ptree-desc {
    width: 100%; padding: 0.4rem 0.6rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border-color); background: var(--bg-input); color: var(--text-primary); font-size: 0.85rem;
}
.ptask-editor-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ptask-editor-controls select, .ptask-editor-controls input[type="date"], .ptask-editor-controls input[type="time"] {
    padding: 0.35rem 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
    background: var(--bg-card); color: var(--text-primary); font-size: 0.8rem;
}

/* Side-by-side layout: workspace primary, suggestions secondary */
.project-grid-folder { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.2rem; align-items: start; }

/* AI Project Suggestions panel */
.project-suggestions-card { border: 1px solid rgba(139, 92, 246, 0.35); }
.project-suggestions-card.collapsed .sugg-body { display: none; }
.sugg-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.sugg-head h3 { margin: 0; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; }
.sugg-head h3 i { color: #a78bfa; }
.sugg-body { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.6rem; }
.sugg-intro { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }
.sugg-loading { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; color: var(--text-secondary); }
.sugg-error { font-size: 0.8rem; color: #ef4444; }
.sugg-complete { font-size: 0.82rem; color: #10b981; display: flex; gap: 0.4rem; align-items: flex-start; margin: 0; }
.sugg-item { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.6rem 0.7rem; background: rgba(139, 92, 246, 0.05); }
.sugg-item-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.sugg-title { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); }
.sugg-prio { font-size: 0.68rem; padding: 0.1rem 0.45rem; border-radius: 999px; text-transform: capitalize; }
.sugg-prio.prio-high { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.sugg-prio.prio-medium { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.sugg-prio.prio-low { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.sugg-desc { font-size: 0.78rem; color: var(--text-primary); margin: 0.3rem 0 0; }
.sugg-why { font-size: 0.75rem; color: var(--text-secondary); margin: 0.25rem 0 0; display: flex; gap: 0.35rem; }
.sugg-why i { color: #f59e0b; margin-top: 0.15rem; }
.sugg-dest { font-size: 0.72rem; color: var(--text-secondary); margin: 0.25rem 0 0; }
.sugg-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.sugg-added { font-size: 0.78rem; color: #10b981; font-weight: 600; display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.5rem; }
.sugg-choose { margin-top: 0.5rem; font-size: 0.78rem; color: var(--text-secondary); }
.sugg-choose-btns { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.35rem; }
.planner-spinner.small { width: 18px; height: 18px; border-width: 2px; }

/* Category modal live preview */
.category-preview-row {
    display: flex; align-items: center; gap: 0.6rem; margin-top: 0.8rem;
    padding: 0.6rem 0.8rem; border-radius: var(--radius-md);
    background: var(--bg-card); border: 1px solid var(--border-color);
}
.category-preview-name { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; }
#category-preview-icon { color: var(--accent-blue); }

/* Responsive: suggestions panel collapses below the workspace on small screens */
@media (max-width: 1000px) {
    .project-grid-folder { grid-template-columns: 1fr; }
    .project-side-col { order: 2; }
    .projects-create-actions { width: 100%; }
}
@media (max-width: 640px) {
    .folder-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .ptask-actions { flex-direction: column; }
    .ptask-row { flex-wrap: wrap; }
    .ptask-editor { width: 100%; }
}
