/*
 * Tarefas BY LMS BV
 * © LMS BV — All rights reserved
 */

:root {
    --bg:           #0f0f12;
    --bg-elev:      #17171c;
    --bg-elev-2:    #1f1f26;
    --border:       #2a2a33;
    --text:         #e9e9ee;
    --text-muted:   #9a9aa6;
    --text-faint:   #6c6c78;
    --brand:        #c8102e;        /* LMS BV red */
    --brand-hover:  #e01935;
    --brand-soft:   rgba(200,16,46,.12);
    --success:      #22c55e;
    --warn:         #f59e0b;
    --danger:       #ef4444;
    --radius:       12px;
    --radius-sm:    8px;
    --shadow:       0 10px 30px rgba(0,0,0,.4);
    --font:         system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

.muted { color: var(--text-muted); }
.muted-small { color: var(--text-faint); font-size: 13px; margin-top: 12px; text-align: center; }

/* ====== AUTH SHELL ====== */
.auth-body {
    background:
        radial-gradient(900px 500px at 80% -10%, rgba(200,16,46,.18), transparent 60%),
        radial-gradient(700px 400px at -10% 110%, rgba(200,16,46,.10), transparent 60%),
        var(--bg);
}
.auth-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    gap: 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: var(--shadow);
}
.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}
.auth-brand h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.auth-brand h1 span {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--brand);
    letter-spacing: 0.18em;
    margin-top: 4px;
}
.auth-tagline { color: var(--text-muted); margin: 8px 0 0; font-size: 14px; }
.auth-footer { color: var(--text-faint); font-size: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-links { text-align: center; margin-top: 4px; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.field input {
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    transition: border-color .15s, background .15s;
}
.field input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--bg-elev);
}

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); cursor: pointer; user-select: none; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }

.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    border: 1px solid transparent;
}
.alert-error { background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.35); color: #fecaca; }
.alert-info  { background: rgba(34,197,94,.10);  border-color: rgba(34,197,94,.35);  color: #bbf7d0; }
.alert-warn  { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.35); color: #fde68a; }

/* ====== APP SHELL ====== */
.app-body { background: var(--bg); }
.app-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; }
.brand span { color: var(--brand); font-size: 11px; font-weight: 500; letter-spacing: 0.18em; margin-left: 6px; }
.topnav { display: flex; align-items: center; gap: 10px; }
.user-pill { color: var(--text-muted); font-size: 14px; padding: 6px 10px; background: var(--bg-elev-2); border-radius: 999px; }

.app-main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 80px; }

.hero-card { padding: 8px 0; }
.hero-card h1 { margin: 0 0 4px; font-size: 24px; }
.phase-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
}
@media (min-width: 720px) {
    .phase-grid { grid-template-columns: repeat(3, 1fr); }
}
.phase-tile {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.phase-tile h3 { margin: 0 0 10px; font-size: 15px; letter-spacing: .02em; }
.phase-tile ul { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.phase-tile.done { border-color: rgba(34,197,94,.35); }
.phase-tile.done h3 { color: var(--success); }
.phase-tile.next { border-color: var(--brand); }
.phase-tile.next h3 { color: var(--brand); }
.phase-tile.later h3 { color: var(--text-muted); }

/* ====== INSTALLER ====== */
.install-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px 64px;
    background:
        radial-gradient(900px 500px at 80% -10%, rgba(200,16,46,.18), transparent 60%),
        var(--bg);
}
.install-card {
    width: 100%;
    max-width: 640px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}
.install-steps {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.install-steps .dot {
    flex: 1;
    min-width: 24px;
    height: 6px;
    background: var(--bg-elev-2);
    border-radius: 999px;
}
.install-steps .dot.active { background: var(--brand); }
.install-steps .dot.done   { background: var(--success); }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.check-list li:last-child { border-bottom: none; }
.check-list .ok { color: var(--success); font-weight: 600; }
.check-list .bad { color: var(--danger); font-weight: 600; }
.check-list .warn { color: var(--warn); font-weight: 600; }

.install-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }

.install-card h2 { margin: 0 0 6px; font-size: 22px; }
.install-card .step-desc { color: var(--text-muted); margin: 0 0 20px; font-size: 14px; }

.field-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 540px) {
    .field-row.two { grid-template-columns: 1fr 1fr; }
}

/* ============================================================== */
/* FASE 2A — TASK UI                                                */
/* ============================================================== */

/* topbar layout (3 columns) */
.app-topbar { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-center { display: flex; justify-content: center; }
.topbar-right { justify-content: flex-end; }
@media (max-width: 600px) {
    .app-topbar { grid-template-columns: 1fr auto; row-gap: 8px; }
    .topbar-center { grid-column: 1 / -1; order: 3; }
}

/* Day-progress bar in header */
.day-progress {
    display: flex; align-items: center; gap: 10px;
    min-width: 180px; max-width: 320px; width: 100%;
}
.day-progress-bar {
    flex: 1; height: 6px; background: var(--bg-elev-2); border-radius: 999px; overflow: hidden;
}
.day-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #ff4d6d);
    border-radius: 999px;
    transition: width .35s ease;
}
.day-progress-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.day-progress-text strong { color: var(--text); font-weight: 700; }

/* Streak pill */
.streak-pill {
    background: rgba(245, 158, 11, .12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, .35);
    padding: 4px 10px; border-radius: 999px;
    font-size: 13px; font-weight: 600;
    transition: transform .25s;
}
.streak-pill.bump { animation: streakBump .5s ease; }
@keyframes streakBump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.btn-icon { padding: 8px 10px; }

/* Magic input */
.magic-input {
    display: flex; gap: 8px; margin-bottom: 8px;
}
.magic-input input {
    flex: 1; background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px; color: var(--text);
    font-size: 15px; font-family: inherit;
    transition: border-color .15s, background .15s;
}
.magic-input input:focus { outline: none; border-color: var(--brand); background: var(--bg-elev-2); }
.magic-preview {
    background: rgba(200,16,46,.06);
    border: 1px solid rgba(200,16,46,.25);
    padding: 8px 14px; border-radius: var(--radius-sm); margin-bottom: 16px;
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    font-size: 13px;
}
.prev-title { color: var(--text); font-weight: 500; }
.prev-meta  { color: var(--text-muted); }

/* Topline: workspace pillen + view toggle */
.topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0 18px; flex-wrap: wrap; }
.ws-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.ws-pill {
    --ws-color: var(--brand);
    padding: 6px 14px; border-radius: 999px;
    background: var(--bg-elev); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 13px; font-weight: 500;
    transition: all .15s;
}
.ws-pill:hover { color: var(--text); border-color: var(--ws-color); }
.ws-pill.active {
    background: var(--ws-color);
    color: #fff; border-color: var(--ws-color);
}

.view-toggle { display: flex; gap: 2px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.view-btn {
    padding: 6px 12px; border-radius: 999px; color: var(--text-muted); font-size: 14px;
    transition: all .15s;
}
.view-btn:hover { color: var(--text); }
.view-btn.active { background: var(--brand); color: #fff; }

/* Task list sections */
.task-sections { display: flex; flex-direction: column; gap: 22px; }
.task-section h3 {
    font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
    color: var(--text-muted); font-weight: 600; margin: 0 0 10px;
    display: flex; align-items: center; gap: 8px;
}
.task-section .count {
    background: var(--bg-elev-2); color: var(--text-faint);
    padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
    letter-spacing: 0;
}
.section-today h3 .count { background: var(--brand-soft); color: var(--brand); }
.task-list { display: flex; flex-direction: column; gap: 6px; }
.empty { padding: 14px 0; font-style: italic; font-size: 14px; }

/* Task card */
.task {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: transform .2s ease, opacity .2s ease, background .15s, border-color .15s;
    position: relative;
    touch-action: pan-y;
    user-select: none;
}
.task:hover { background: var(--bg-elev-2); border-color: #353541; }

.task[data-urgency="urgent"] { border-left: 3px solid #ef4444; }
.task[data-urgency="high"]   { border-left: 3px solid #f59e0b; }
.task[data-urgency="low"]    { border-left: 3px solid #6c6c78; }

.task-check {
    width: 22px; height: 22px; flex: 0 0 22px;
    border-radius: 50%; border: 2px solid var(--text-faint);
    background: transparent; cursor: pointer;
    margin-top: 1px;
    transition: all .15s;
    position: relative;
}
.task-check:hover { border-color: var(--brand); }
.task-check::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: var(--brand);
    transform: scale(0); transition: transform .2s ease;
}
.task.completing .task-check::after { transform: scale(1); }
.task.completing .task-check::before {
    content: '✓'; position: absolute; inset: 0; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    z-index: 1;
}
.task.completing { opacity: 0; transform: translateX(40px); }

.task-body { flex: 1; min-width: 0; }
.task-title-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.task-title { color: var(--text); font-size: 15px; cursor: text; word-break: break-word; }
.task-title:hover { color: #fff; }
.inline-edit {
    background: var(--bg-elev-2); border: 1px solid var(--brand);
    border-radius: 6px; padding: 4px 8px; color: var(--text); font: inherit;
    width: 100%; max-width: 480px;
}

.urgency-chip {
    font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
}
.urgency-urgent { background: rgba(239,68,68,.15); color: #fca5a5; }
.urgency-high   { background: rgba(245,158,11,.15); color: #fbbf24; }
.urgency-low    { background: rgba(108,108,120,.20); color: var(--text-muted); }

.task-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; }
.task-due { color: var(--text-muted); }
.task-due.today    { color: var(--brand); font-weight: 600; }
.task-due.overdue  { color: #ef4444; font-weight: 600; }
.task-label { color: var(--text-muted); background: var(--bg-elev-2); padding: 1px 7px; border-radius: 4px; }

.task-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.task:hover .task-actions { opacity: 1; }
.task-actions button {
    background: transparent; border: none; color: var(--text-faint); cursor: pointer;
    padding: 4px 8px; border-radius: 6px; font-size: 14px;
}
.task-actions button:hover { background: var(--bg-elev-2); color: var(--text); }
.task-delete:hover { color: var(--danger) !important; }

/* Swipe affordance */
.task.swiping { transition: none; }
.task.swipe-right { background: rgba(34,197,94,.18); }
.task.swipe-left  { background: rgba(245,158,11,.18); }

/* FAB (mobile) */
.fab {
    position: fixed; bottom: 22px; right: 22px;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--brand); color: #fff; border: none;
    font-size: 28px; line-height: 56px;
    box-shadow: 0 10px 30px rgba(200,16,46,.45);
    cursor: pointer; z-index: 50;
    transition: transform .15s;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(0.95); }
@media (min-width: 720px) { .fab { display: none; } }

/* Snooze sheet */
.sheet[hidden] { display: none !important; }
.sheet {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100;
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; transition: opacity .2s;
    pointer-events: none;
}
.sheet.open { opacity: 1; pointer-events: auto; }
.sheet-card {
    width: 100%; max-width: 480px;
    background: var(--bg-elev); border: 1px solid var(--border); border-bottom: none;
    border-radius: 16px 16px 0 0; padding: 20px;
    transform: translateY(100%); transition: transform .25s ease;
    display: flex; flex-direction: column; gap: 8px;
}
.sheet.open .sheet-card { transform: translateY(0); }
@media (min-width: 720px) {
    .sheet { align-items: center; }
    .sheet-card { border-radius: 16px; border-bottom: 1px solid var(--border); }
}
.sheet h3 { margin: 0 0 8px; font-size: 16px; }
.snooze-opt {
    background: var(--bg-elev-2); border: 1px solid var(--border);
    color: var(--text); padding: 14px 16px; border-radius: var(--radius-sm);
    font-size: 15px; cursor: pointer; text-align: left; font-family: inherit;
    transition: all .15s;
}
.snooze-opt:hover { border-color: var(--brand); background: var(--bg-elev); }

/* Kanban */
.kanban {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px; align-items: flex-start;
}
@media (max-width: 720px) {
    .kanban { grid-template-columns: 1fr; }
}
.kb-col {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px;
    min-height: 120px;
}
.kb-col-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
    color: var(--text-muted); font-weight: 600; margin-bottom: 12px;
}
.kb-count { background: var(--bg-elev-2); padding: 2px 8px; border-radius: 999px; color: var(--text-faint); font-size: 11px; }
.kb-col-body { display: flex; flex-direction: column; gap: 6px; }
.kb-empty { padding: 8px 0; font-size: 13px; }

/* Focus mode */
.focus-zone {
    text-align: center; padding: 60px 20px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.focus-eyebrow { color: var(--brand); text-transform: uppercase; letter-spacing: .2em; font-size: 11px; font-weight: 700; margin: 0 0 8px; }
.focus-title { font-size: 32px; font-weight: 700; margin: 0 0 12px; line-height: 1.2; }
.focus-desc  { color: var(--text-muted); max-width: 600px; margin: 0 auto 20px; line-height: 1.5; }
.focus-meta  { display: flex; gap: 10px; justify-content: center; margin-bottom: 32px; }
.focus-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.focus-empty { color: var(--text-muted); font-size: 18px; padding: 40px 0; }
.btn-large { padding: 14px 28px; font-size: 16px; }

/* Pulse helper (reserved) */
.pulse { animation: pulseAnim .4s ease; }
@keyframes pulseAnim {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* ============================================================== */
/* TASK MODAL (create + edit)                                      */
/* ============================================================== */

.modal[hidden] { display: none !important; }
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    opacity: 0; transition: opacity .2s;
    pointer-events: none;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(4px);
}
.modal-card {
    position: relative;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%; max-width: 560px;
    max-height: calc(100dvh - 32px);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow);
    transform: translateY(12px) scale(.98);
    transition: transform .2s ease;
}
.modal.open .modal-card { transform: translateY(0) scale(1); }

.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 16px;
}
.modal-close:hover { background: var(--bg-elev-2); color: var(--text); }

.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-body select,
.modal-body textarea {
    background: var(--bg-elev-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text);
    font-family: inherit; font-size: 15px; resize: vertical;
}
.modal-body select:focus,
.modal-body textarea:focus { outline: none; border-color: var(--brand); background: var(--bg-elev); }

.modal-footer {
    display: flex; gap: 10px; justify-content: flex-end;
    padding-top: 8px; border-top: 1px solid var(--border); margin-top: 6px;
    padding: 14px 0 0;
    flex-wrap: wrap;
}
.btn-danger { background: rgba(239, 68, 68, .15); color: #fca5a5; border: 1px solid rgba(239,68,68,.35); }
.btn-danger:hover { background: rgba(239, 68, 68, .25); color: #fff; }

/* On mobile, modal becomes bottom sheet */
@media (max-width: 600px) {
    .modal { align-items: flex-end; padding: 0; }
    .modal-card {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 92dvh;
    }
    .modal.open .modal-card { transform: translateY(0); }
    .modal:not(.open) .modal-card { transform: translateY(100%); }
}

/* Detail-add button next to magic input — show on desktop only */
.btn-add-detailed { white-space: nowrap; }
@media (max-width: 600px) {
    .btn-add-detailed { display: none; }
}

/* On desktop the "+ Detail" button replaces the FAB */
@media (min-width: 720px) {
    .fab { display: none; }
}

/* Edit button styling */
.task-edit:hover { color: var(--brand) !important; }

/* ============================================================== */
/* FASE 2B — additional UI                                          */
/* ============================================================== */

.brand-link { text-decoration: none; }
.brand-link:hover .brand { color: #fff; }

.topbar-icon {
    color: var(--text-muted); font-size: 18px;
    padding: 6px 8px; border-radius: 6px;
    transition: all .15s; line-height: 1;
}
.topbar-icon:hover { color: var(--text); background: var(--bg-elev-2); }

/* Drag handle */
.drag-handle {
    color: var(--text-faint);
    cursor: grab; user-select: none;
    font-size: 16px; line-height: 1;
    padding: 0 4px; opacity: 0;
    transition: opacity .15s;
}
.task:hover .drag-handle { opacity: .6; }
.drag-handle:active { cursor: grabbing; }
@media (max-width: 600px) {
    .drag-handle { opacity: .4; } /* always visible on touch */
}

.sortable-ghost { opacity: .35; background: var(--brand-soft) !important; }
.sortable-chosen { background: var(--bg-elev-2); }

/* Project pills */
.proj-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.proj-pill {
    --proj-color: var(--text-muted);
    padding: 4px 10px; border-radius: 999px;
    background: var(--bg-elev); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 12px; font-weight: 500;
    transition: all .15s;
    border-left: 3px solid var(--proj-color);
}
.proj-pill:hover { color: var(--text); border-color: var(--proj-color); }
.proj-pill.active { background: var(--proj-color); color: #fff; border-color: var(--proj-color); }

/* AI toggle in magic input */
.ai-toggle {
    display: flex; align-items: center; gap: 6px;
    padding: 0 12px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    color: var(--text-muted); font-size: 13px; user-select: none;
    transition: all .15s;
}
.ai-toggle:has(input:checked) {
    background: rgba(168, 85, 247, .12);
    border-color: rgba(168, 85, 247, .35);
    color: #d8b4fe;
}
.ai-toggle input { accent-color: #a855f7; }

/* AI dagplan */
.ai-plan-btn {
    background: linear-gradient(135deg, rgba(168,85,247,.15), rgba(200,16,46,.10));
    border: 1px solid rgba(168, 85, 247, .35);
    color: #d8b4fe; padding: 10px 16px;
    border-radius: var(--radius-sm); cursor: pointer;
    font-size: 14px; font-weight: 500; font-family: inherit;
    margin-bottom: 18px; width: 100%;
    transition: all .15s;
}
.ai-plan-btn:hover { background: linear-gradient(135deg, rgba(168,85,247,.25), rgba(200,16,46,.15)); }
.ai-plan-btn:disabled { opacity: .6; cursor: wait; }
.ai-plan-result {
    background: var(--bg-elev); border: 1px solid rgba(168, 85, 247, .25);
    padding: 14px 18px; border-radius: var(--radius-sm);
    margin-bottom: 18px;
}
.ai-plan-result ol { margin: 8px 0 0 0; padding-left: 22px; line-height: 1.7; }
.ai-highlight { box-shadow: 0 0 0 2px rgba(168, 85, 247, .5); transition: box-shadow .3s; }

/* Subtasks */
.subtasks-toggle {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 12px; padding: 2px 6px;
    border-radius: 4px;
}
.subtasks-toggle:hover { background: var(--bg-elev-2); color: var(--text); }
.subtasks {
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed var(--border);
    display: flex; flex-direction: column; gap: 4px;
}
.subtask {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 0; font-size: 14px;
}
.subtask.done .subtask-title { text-decoration: line-through; color: var(--text-faint); }
.task-check-sm { width: 16px; height: 16px; flex-basis: 16px; border-width: 2px; }
.subtask.done .task-check-sm::after { transform: scale(1); }
.subtask.done .task-check-sm::before {
    content: '✓'; position: absolute; inset: 0; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; z-index: 1;
}
.subtask-title { flex: 1; color: var(--text); }
.subtask-delete {
    background: transparent; border: none; color: var(--text-faint);
    cursor: pointer; opacity: 0; transition: opacity .15s;
    padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
.subtask:hover .subtask-delete { opacity: 1; }
.subtask-delete:hover { color: var(--danger); }

.subtask-add input {
    width: 100%; background: transparent; border: none;
    color: var(--text-muted); padding: 6px 0;
    font-family: inherit; font-size: 13px;
    border-bottom: 1px dashed transparent;
}
.subtask-add input:focus {
    outline: none; color: var(--text);
    border-bottom-color: var(--brand);
}

/* Task action buttons - new "add subtask" button */
.task-add-sub:hover { color: var(--brand) !important; }

/* Label colors via custom properties */
.task-label {
    --lbl-color: var(--text-muted);
    color: var(--lbl-color); background: transparent;
    border: 1px solid currentColor;
    padding: 1px 7px; border-radius: 4px;
    opacity: .85;
}

/* Win popup */
.win-popup {
    position: fixed; inset: 0; z-index: 300;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(4px);
    opacity: 0; transition: opacity .3s;
}
.win-popup.show { opacity: 1; }
.win-card {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 32px 28px;
    max-width: 380px; width: 100%; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    transform: scale(.95);
    transition: transform .3s ease;
}
.win-popup.show .win-card { transform: scale(1); }
.win-emoji { font-size: 48px; margin-bottom: 12px; }
.win-card h3 { margin: 0 0 8px; font-size: 22px; }
.win-card p { color: var(--text-muted); margin: 4px 0; }
.win-card strong { color: var(--text); }
.win-streak { color: #fbbf24 !important; }

/* ============================================================== */
/* SETTINGS PAGE                                                    */
/* ============================================================== */

.settings-shell, .review-shell { max-width: 800px; margin: 0 auto; }
.settings-title { margin: 0 0 24px; font-size: 24px; }

.settings-tabs {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin-bottom: 24px; border-bottom: 1px solid var(--border);
}
.settings-tab {
    padding: 10px 16px; color: var(--text-muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    font-size: 14px; font-weight: 500;
    transition: all .15s;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.settings-body { padding: 0; }
.settings-form {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    display: flex; flex-direction: column; gap: 14px;
    max-width: 540px;
}
.settings-form h2, .settings-form h3 { margin: 0 0 6px; font-size: 18px; }
.settings-form select {
    background: var(--bg-elev-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text);
    font-family: inherit; font-size: 15px;
}
.settings-form select:focus { outline: none; border-color: var(--brand); background: var(--bg-elev); }

.settings-list { display: flex; flex-direction: column; gap: 8px; }
.settings-row {
    display: flex; gap: 8px; align-items: center;
    padding: 10px 12px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.settings-row input[type="text"] { flex: 1; min-width: 150px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); font: inherit; font-size: 14px; }
.settings-row select { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); font: inherit; font-size: 13px; }
.color-input { width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); background: transparent; border-radius: 6px; cursor: pointer; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

/* ============================================================== */
/* REVIEW PAGE                                                      */
/* ============================================================== */

.review-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 24px 0;
}
@media (min-width: 720px) {
    .review-stats { grid-template-columns: repeat(4, 1fr); }
}
.stat-card {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
    text-align: center;
}
.stat-num { font-size: 32px; font-weight: 700; color: var(--text); }
.stat-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; margin-top: 4px; }

.review-section { margin: 32px 0; }
.review-section h2 { font-size: 16px; color: var(--text); margin: 0 0 16px; font-weight: 600; }

.bar-chart {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 8px; height: 180px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
}
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.bar-track { flex: 1; width: 100%; max-width: 36px; display: flex; align-items: flex-end; }
.bar-fill {
    width: 100%; min-height: 4px;
    background: linear-gradient(180deg, var(--brand), #ff4d6d);
    border-radius: 4px 4px 0 0;
    transition: height .4s ease;
}
.bar-num  { font-size: 12px; color: var(--text); font-weight: 600; }
.bar-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; }

.top-labels { display: flex; flex-wrap: wrap; gap: 10px; }
.top-label {
    --lbl-color: var(--text-muted);
    background: var(--bg-elev); border: 1px solid var(--border);
    border-left: 3px solid var(--lbl-color);
    padding: 8px 14px; border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 10px;
}
.top-label span { color: var(--text); }
.top-label strong { color: var(--brand); }

