/* Mis proyectos — tablero personal */
:root {
    color-scheme: dark;
    --bg: #140b18;         /* berenjena */
    --surface: #1e1224;    /* columnas: ciruela */
    --surface-2: #2a1a32;  /* tarjetas */
    --surface-3: #36223f;
    --line: #3a2644;
    --line-strong: #553a62;
    --text: #f6eefa;
    --muted: #c4b2cc;
    --quiet: #8f7a99;
    --primary: #c026d3;    /* magenta */
    --primary-hover: #d946ef;
    --primary-soft: rgba(217, 70, 239, .16);
    --focus: #f0abfc;
    --danger: #ff8f86;
    --danger-bg: #c2373b;
    --ease-out: cubic-bezier(.23, 1, .32, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --topbar-h: 64px;
    --col-w: 300px;
    --chat-w: 400px;
    --ok: #34d399;
    --warn: #fbbf4a;
    --late: #ff9b93;
    --gutter: 16px;
    --shadow: rgba(0, 0, 0, .5);
    font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

/* Modo claro (el oscuro es el predeterminado) */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #faf5fb;
    --surface: #ffffff;
    --surface-2: #f6eef8;
    --surface-3: #eddff1;
    --line: #ead9ee;
    --line-strong: #d2b9d9;
    --text: #1f1024;
    --muted: #5e4766;
    --quiet: #7d6585;
    --primary: #a21caf;
    --primary-hover: #86198f;
    --primary-soft: rgba(162, 28, 175, .1);
    --focus: #a21caf;
    --danger: #c42d31;
    --danger-bg: #c2373b;
    --ok: #047857;
    --warn: #b45309;
    --late: #c42d31;
    --shadow: rgba(30, 25, 20, .14);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;            /* solo el tablero desplaza */
    -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: 0; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

.skip-link {
    position: fixed; top: 8px; left: 8px; z-index: 100;
    padding: 8px 14px; border-radius: 8px; background: var(--primary); color: #fff; text-decoration: none;
    transform: translateY(-160%); transition: transform 160ms var(--ease-out);
}
.skip-link:focus { transform: none; }

/* ---------- Botones ---------- */
.btn {
    min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 0 16px; border: 1px solid transparent; border-radius: 999px;
    font-weight: 600; font-size: .92rem; white-space: nowrap;
    transition: background-color 160ms ease, border-color 160ms ease, transform 120ms var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-bg); color: #fff; }
.btn-danger:hover { background: #d4444a; }
.btn-danger-ghost { background: transparent; color: var(--danger); padding: 0 10px; }
.btn-danger-ghost:hover { background: rgba(255, 143, 134, .1); }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: .86rem; }

.icon-btn {
    width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none;
    border: 0; border-radius: 9px; background: transparent; color: var(--muted);
    transition: background-color 140ms ease, color 140ms ease;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.col-menu-btn svg { fill: currentColor; stroke: none; }

.link-btn {
    padding: 4px 2px; border: 0; background: none; color: var(--muted);
    font-size: .86rem; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); text-decoration-color: currentColor; }

/* ---------- Barra superior ---------- */
.topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 20px;
    padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
    box-sizing: content-box;
    border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.overall { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.overall-ring { width: 30px; height: 30px; transform: rotate(-90deg); }
.overall-ring circle { fill: none; stroke-width: 4; }
.overall-ring__track { stroke: var(--surface-3); }
.overall-ring__fill {
    stroke: var(--primary); stroke-dasharray: 100; stroke-dashoffset: 100;
    transition: stroke-dashoffset 600ms var(--ease-out);
}
.overall-text { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; font-size: .9rem; color: var(--muted); }
.overall-text strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
#overall-count { font-variant-numeric: tabular-nums; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.topbar-actions .btn-primary { margin-right: 4px; }
.topbar-icon { width: 40px; height: 40px; border-radius: 50%; }
.topbar-icon svg { width: 20px; height: 20px; }
.chat-open #chat-fab { background: var(--surface-3); color: var(--text); }
.theme-icon--moon { display: none; }
:root[data-theme="light"] .theme-icon--sun { display: none; }
:root[data-theme="light"] .theme-icon--moon { display: block; }

/* ---------- Tablero ---------- */
.board {
    position: relative;
    height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top) - 1px);
    overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-padding-inline: var(--gutter);
    scrollbar-color: var(--line-strong) transparent;
}
.board:focus { outline: none; }
.columns {
    display: flex; align-items: flex-start; gap: 14px;
    height: 100%;
    width: max-content;
    padding: 20px var(--gutter) 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.columns:empty { display: none; }

/* ---------- Columna ---------- */
.col {
    --c: var(--primary);
    width: var(--col-w);
    max-height: 100%;
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    position: relative;
    scroll-snap-align: start;
}
.col::before {   /* franja superior del color del proyecto */
    content: ""; position: absolute; inset: -1px -1px auto; height: 5px;
    border-radius: 16px 16px 0 0; background: var(--c);
}
.col.is-new { animation: col-in 380ms var(--ease-out); }
@keyframes col-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.col-head { position: relative; padding: 18px 14px 14px 16px; cursor: grab; touch-action: pan-x pan-y; }
.col-title-row { display: flex; align-items: center; gap: 9px; }
.col-grip { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); }
.col-name { flex: 1; min-width: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.col-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 8px 0 8px 19px; }
.col-meta { font-size: .84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Finalización del proyecto: fecha + días restantes */
.deadline {
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
    width: calc(100% - 19px); margin: 12px 0 0 19px; padding: 7px 10px;
    border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
    color: var(--muted); font-size: .82rem; font-weight: 600; text-align: left; line-height: 1.25;
    transition: border-color 140ms ease, background-color 140ms ease;
}
.deadline:hover { border-color: var(--line-strong); }
.deadline svg { width: 15px; height: 15px; color: var(--c); }
.deadline__date { color: var(--text); }
.deadline__left {
    margin-left: auto; padding: 2px 8px; border-radius: 99px;
    background: var(--surface-3); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.deadline__left:empty { display: none; }
.deadline[data-status="soon"] .deadline__left { color: var(--warn); background: rgba(245, 158, 11, .12); }
.deadline[data-status="today"] .deadline__left { color: var(--warn); background: rgba(245, 158, 11, .2); }
.deadline[data-status="overdue"] { border-color: rgba(255, 107, 97, .35); }
.deadline[data-status="overdue"] .deadline__left { color: var(--late); background: rgba(255, 107, 97, .16); }
.deadline[data-status="done"] .deadline__left { color: var(--ok); background: rgba(52, 211, 153, .12); }
.deadline[data-status="none"] { border-style: dashed; background: transparent; }
.deadline[data-status="none"] .deadline__date { color: var(--quiet); font-weight: 500; }
.deadline[data-status="none"] svg { color: var(--quiet); }

/* Pestañas de proyectos: solo en móvil */
.proj-tabs { display: none; }

.col-bar { margin-left: 19px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.col-bar__fill {
    display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c);
    transition: width 520ms var(--ease-out);
}

.col-body {
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
    padding: 2px 10px 12px;
    scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.col-list, .done-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.col-list { min-height: 8px; }   /* zona para soltar en columnas vacías */
.col-hint { display: none; padding: 6px 6px 10px; font-size: .86rem; color: var(--quiet); }
.col.is-clear .col-hint { display: block; }

/* Menú de columna */
.menu {
    position: absolute; top: 46px; right: 10px; z-index: 20;
    min-width: 190px; padding: 6px;
    background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 12px;
    box-shadow: 0 18px 40px var(--shadow);
    animation: pop 160ms var(--ease-out);
    cursor: default;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.menu-item {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: .92rem;
}
.menu-item svg { width: 17px; height: 17px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item--danger, .menu-item--danger svg { color: var(--danger); }

/* ---------- Cards ---------- */
.card {
    position: relative;
    display: flex; align-items: flex-start; gap: 4px;
    padding: 6px 8px 6px 6px;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: 11px;
    box-shadow: inset 3px 0 0 var(--c, var(--primary));
    transition: border-color 140ms ease, background-color 140ms ease, opacity 200ms ease;
}
.card:hover { border-color: var(--line-strong); }
.card.is-pending { opacity: .6; pointer-events: none; }
.card.is-leaving { animation: card-out 260ms var(--ease-out) forwards; }
@keyframes card-out { to { opacity: 0; transform: translateX(10px); } }
.card.is-new { animation: card-in 280ms var(--ease-out); }
@keyframes card-in { from { opacity: 0; transform: translateY(-4px); } }

.card-open {
    flex: 1; min-width: 0; display: grid; gap: 3px;
    padding: 6px 2px 6px 2px; border: 0; background: none; text-align: left; cursor: pointer;
}
.card-title { font-size: .95rem; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.card-notes {
    font-size: .82rem; color: var(--quiet); line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-notes:empty { display: none; }
.card-due { justify-self: start; margin-top: 3px; }

/* Chip de fecha de finalización */
.due {
    display: inline-flex; align-items: center; gap: 5px; width: fit-content;
    padding: 3px 8px 3px 7px; border-radius: 99px;
    background: var(--surface-3); color: var(--muted);
    font-size: .76rem; font-weight: 600; line-height: 1.25; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.due::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; flex: none; }
.due[data-status="overdue"] { color: var(--late); background: rgba(255, 107, 97, .14); }
.due[data-status="today"] { color: var(--warn); background: rgba(245, 158, 11, .14); }
.due[data-status="done"] { color: var(--quiet); background: none; padding-left: 0; }
.due[data-status="done"]::before { display: none; }
.card.is-done .card-due { margin-top: 0; }

/* Checkbox circular */
.check {
    width: 36px; height: 36px; flex: none; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: none; color: var(--c, var(--primary));
    position: relative;
}
.check svg { width: 22px; height: 22px; overflow: visible; }
.check__ring { fill: transparent; stroke: var(--line-strong); stroke-width: 1.8; transition: fill 220ms ease, stroke 220ms ease; }
.check__mark { stroke: #fff; stroke-width: 2.4; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 260ms var(--ease-out) 60ms; }
.check:hover .check__ring { stroke: var(--c, var(--primary)); fill: color-mix(in srgb, var(--c, var(--primary)) 14%, transparent); }
.check::after {   /* destello al terminar */
    content: ""; position: absolute; inset: 7px; border-radius: 50%;
    border: 2px solid var(--c, var(--primary)); opacity: 0; pointer-events: none;
}
.card.is-done .check__ring, .card.is-checking .check__ring { fill: var(--c, var(--primary)); stroke: var(--c, var(--primary)); }
.card.is-done .check__mark, .card.is-checking .check__mark { stroke-dashoffset: 0; }
.card.is-checking .check svg { animation: check-pop 380ms var(--ease-spring); }
.card.is-checking .check::after { animation: check-burst 480ms var(--ease-out); }
@keyframes check-pop { 0% { transform: scale(1); } 40% { transform: scale(.82); } 100% { transform: scale(1); } }
@keyframes check-burst { 0% { opacity: .7; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.7); } }
.card.is-checking .card-title { color: var(--muted); }

/* Terminadas */
.col-done { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 6px; }
.col-done__summary {
    list-style: none; display: flex; align-items: center; gap: 6px;
    padding: 8px 6px; border-radius: 8px; color: var(--muted); font-size: .88rem; font-weight: 600; cursor: pointer;
}
.col-done__summary::-webkit-details-marker { display: none; }
.col-done__summary:hover { color: var(--text); }
.chev { width: 16px; height: 16px; transition: transform 180ms var(--ease-out); }
.col-done[open] .chev { transform: rotate(90deg); }
.done-list { padding-top: 4px; }
.card.is-done { background: transparent; box-shadow: none; border-color: transparent; }
.card.is-done:hover { background: var(--surface-2); }
.card.is-done .card-title { color: var(--quiet); text-decoration: line-through; text-decoration-color: var(--quiet); }
.card.is-done .card-notes { display: none; }
.card.is-done .check { opacity: .75; }

/* Arrastre (SortableJS) */
.sortable-ghost { opacity: .35; }
.sortable-ghost.card { background: var(--primary-soft); border: 1px dashed var(--line-strong); box-shadow: none; }
.sortable-chosen.card { border-color: var(--line-strong); }
.sortable-drag.card, .sortable-fallback.card { box-shadow: 0 16px 34px var(--shadow), inset 3px 0 0 var(--c); transform: rotate(1.5deg); }
.col.sortable-ghost { opacity: .4; }
.col-head:active { cursor: grabbing; }
.col-head, .card { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.is-dragging .card-open, .is-dragging .col-head { cursor: grabbing; }

/* ---------- Añadir tarea ---------- */
.composer { margin-top: 8px; }
.composer-open {
    width: 100%; display: flex; align-items: center; gap: 8px;
    padding: 10px 8px; border: 0; border-radius: 10px; background: none;
    color: var(--muted); font-weight: 500; font-size: .92rem; text-align: left;
    transition: background-color 140ms ease, color 140ms ease;
}
.composer-open svg { width: 17px; height: 17px; color: var(--c); }
.composer-open:hover { background: var(--surface-2); color: var(--text); }
.composer-form {
    display: grid; gap: 8px; padding: 8px;
    background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line-strong);
    animation: pop 160ms var(--ease-out);
}
.composer-title, .composer-notes, .composer-due, .field input, .field textarea, .field select {
    width: 100%; padding: 9px 11px;
    background: var(--bg); border: 1px solid var(--line-strong); border-radius: 9px;
    outline: none; transition: border-color 140ms ease, box-shadow 140ms ease;
}
.composer-title:focus, .composer-notes:focus, .composer-due:focus, .field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--focus); box-shadow: 0 0 0 3px rgba(179, 170, 255, .16);
}
.composer-notes, .field textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-actions__links { display: flex; flex-wrap: wrap; column-gap: 10px; min-width: 0; }
.composer-date { display: flex; align-items: center; gap: 10px; }
.composer-date__label { font-size: .84rem; font-weight: 600; color: var(--muted); }
.composer-due { flex: 1; min-width: 0; padding: 7px 10px; }
.date-row { display: flex; align-items: center; gap: 12px; }
.date-row input { flex: 1; min-width: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; }
.composer-actions__end { display: flex; align-items: center; gap: 4px; margin-left: auto; }
::placeholder { color: var(--quiet); opacity: 1; }

/* ---------- Estados vacíos ---------- */
.empty {
    position: absolute; inset: 0; margin: auto;
    width: min(420px, calc(100% - 2 * var(--gutter))); height: fit-content;
    display: grid; justify-items: center; gap: 12px; text-align: center;
    padding: 32px 24px;
}
.empty h2 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
.empty p { color: var(--muted); max-width: 34ch; }
.empty .btn { margin-top: 8px; }
.empty-swatches { display: flex; margin-bottom: 6px; }
.empty-swatches span {
    width: 38px; height: 54px; margin: 0 -6px; border-radius: 10px;
    background: var(--surface-2); border-top: 5px solid var(--c);
    box-shadow: 0 0 0 3px var(--bg);
}
.empty-swatches span:nth-child(odd) { transform: rotate(-6deg) translateY(3px); }
.empty-swatches span:nth-child(even) { transform: rotate(5deg); }

/* Esqueleto de carga */
.col.is-skeleton { height: 260px; border-color: transparent; background: var(--surface); }
.col.is-skeleton::before { background: var(--surface-3); }
.col.is-skeleton::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .03) 50%, transparent 70%);
    background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ---------- Modales ---------- */
.modal {
    width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
    padding: 0; border: 1px solid var(--line-strong); border-radius: 18px;
    background: var(--surface); color: var(--text);
    box-shadow: 0 30px 80px var(--shadow);
}
.modal--small { width: min(400px, calc(100vw - 24px)); }
.modal[open] { animation: modal-in 220ms var(--ease-out); }
.modal::backdrop { background: rgba(4, 4, 6, .66); backdrop-filter: blur(3px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-body { display: grid; gap: 18px; padding: 22px; }
.modal-head { display: flex; align-items: center; gap: 10px; }
.modal-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--primary)); }
.modal-title { font-size: 1.2rem; font-weight: 700; }
.modal-text { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.modal-actions--split { justify-content: space-between; }
.modal-actions__end { display: flex; gap: 8px; margin-left: auto; }

.field { display: grid; gap: 7px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field-label { padding: 0; font-size: .86rem; font-weight: 600; color: var(--muted); }
.field select { appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b0aba4' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.form-error { color: var(--danger); font-size: .88rem; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span {
    width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
    background: var(--c); cursor: pointer;
    box-shadow: 0 0 0 0 var(--surface), 0 0 0 0 var(--c);
    transition: box-shadow 160ms var(--ease-out), transform 120ms var(--ease-out);
}
.swatch span svg { width: 16px; height: 16px; color: #fff; stroke-width: 3; opacity: 0; transform: scale(.6); transition: opacity 140ms ease, transform 200ms var(--ease-spring); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }
.swatch input:checked + span svg { opacity: 1; transform: none; }
.swatch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 6px; }
.swatch span:active { transform: scale(.92); }

/* ---------- Toasts ---------- */
.toasts {
    position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 60;
    transform: translateX(-50%);
    display: grid; gap: 8px; width: min(420px, calc(100vw - 2 * var(--gutter)));
    pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: 12px;
    background: var(--surface-3); border: 1px solid var(--line-strong);
    box-shadow: 0 14px 34px var(--shadow);
    font-size: .92rem; pointer-events: auto;
    animation: toast-in 240ms var(--ease-out);
}
.toast--error { border-color: rgba(255, 143, 134, .45); }
.toast--error svg { color: var(--danger); }
.toast.is-out { animation: toast-out 200ms ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Resaltado tras un cambio del asistente ---------- */
.card.is-flash { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface-2)); }
.col.is-flash { border-color: color-mix(in srgb, var(--c) 75%, transparent); }
@media (prefers-reduced-motion: no-preference) {
    .card.is-flash { animation: flash-card 1.1s ease-in-out 2; }
    .col.is-flash { animation: flash-col 1.1s ease-in-out 2; }
}
@keyframes flash-card { 50% { box-shadow: inset 3px 0 0 var(--c), 0 0 0 4px color-mix(in srgb, var(--c) 28%, transparent); } }
@keyframes flash-col { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); } }

/* ---------- Chat asistente ---------- */
.chat {
    position: fixed; z-index: 40; top: 0; right: 0; bottom: 0;
    width: var(--chat-w); max-width: 100%;
    display: flex; flex-direction: column;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) 0;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -28px 0 60px var(--shadow);
    transform: translateX(104%); visibility: hidden;
    transition: transform 280ms var(--ease-out), visibility 0s linear 280ms;
}
.chat.is-open { transform: none; visibility: visible; transition: transform 280ms var(--ease-out); }

.chat-head {
    height: var(--topbar-h); flex: none;
    display: flex; align-items: center; gap: 6px;
    padding: 0 10px 0 18px;
    border-bottom: 1px solid var(--line);
}
.chat-title { margin-right: auto; display: flex; align-items: center; gap: 10px; font-size: 1.08rem; font-weight: 700; white-space: nowrap; }
.chat-title::before {
    content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.chat-head .btn-sm { padding: 0 12px; gap: 5px; }
.chat-head .btn-sm svg { width: 15px; height: 15px; }

.chat-scroll {
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    padding: 20px 18px 16px;
    scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.chat-intro { display: grid; gap: 12px; }
.chat-intro__text { color: var(--muted); font-size: .95rem; max-width: 38ch; }
.chat-intro__label { margin-top: 10px; font-size: .84rem; font-weight: 600; color: var(--quiet); }
.chat-suggestions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.chat-suggestion {
    width: 100%; padding: 11px 14px 11px 16px;
    border: 1px solid transparent; border-radius: 11px;
    background: var(--surface-2); box-shadow: inset 3px 0 0 var(--c, var(--primary));
    text-align: left; font-size: .92rem; line-height: 1.35; overflow-wrap: anywhere;
    transition: border-color 140ms ease;
}
.chat-suggestion:hover { border-color: var(--line-strong); }
.chat-suggestions li:nth-child(1) .chat-suggestion { --c: #ec4899; }
.chat-suggestions li:nth-child(2) .chat-suggestion { --c: #3b82f6; }
.chat-suggestions li:nth-child(3) .chat-suggestion { --c: #ef4444; }

.chat-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.msg { min-width: 0; overflow-wrap: anywhere; }
.msg-text { white-space: pre-wrap; font-size: .95rem; line-height: 1.5; }
.msg--user {
    align-self: flex-end; max-width: 86%;
    padding: 9px 13px;
    background: var(--primary-soft); border: 1px solid rgba(217, 70, 239, .3);
    border-radius: 14px 14px 4px 14px;
}
.msg--user.is-failed { border-style: dashed; opacity: .7; }
.msg--assistant { align-self: flex-start; max-width: 94%; }
.msg-actions { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 5px; }
.msg-actions li {
    display: flex; align-items: flex-start; gap: 7px;
    font-size: .84rem; line-height: 1.4; color: var(--muted);
}
.msg-actions svg { width: 15px; height: 15px; margin-top: 1px; color: var(--ok); stroke-width: 2.4; }
.msg--error {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-radius: 12px;
    border: 1px solid rgba(255, 143, 134, .4); background: rgba(255, 143, 134, .07);
}
.msg-icon { color: var(--danger); margin-top: 2px; }
.msg-body { min-width: 0; display: grid; gap: 4px; justify-items: start; }
.msg--error .msg-text { font-size: .9rem; }
.msg-retry { padding: 2px 0; color: var(--text); font-weight: 600; }

.msg--thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.thinking-blocks { display: inline-flex; align-items: flex-end; gap: 3px; height: 16px; }
.thinking-blocks span {
    width: 5px; height: 16px; border-radius: 2px; background: var(--c);
    transform: scaleY(.6); transform-origin: bottom;
}
@media (prefers-reduced-motion: no-preference) {
    .thinking-blocks span { animation: think 1.1s var(--ease-out) infinite; animation-delay: calc(var(--i) * 130ms); }
}
@keyframes think { 0%, 100% { transform: scaleY(.35); opacity: .55; } 40% { transform: scaleY(1); opacity: 1; } }

.chat-form {
    flex: none; display: flex; align-items: flex-end; gap: 8px;
    margin: 0 14px;
    padding: 5px 5px 5px 14px;
    background: var(--bg); border: 1px solid var(--line-strong); border-radius: 16px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}
.chat-form:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(179, 170, 255, .16); }
.chat-input {
    flex: 1; min-width: 0; max-height: 160px;
    padding: 8px 0; border: 0; background: none; resize: none; outline: none;
    font-size: 1rem; line-height: 1.45;
}
.chat-input:focus-visible { outline: none; }
.chat-send {
    width: 38px; height: 38px; flex: none; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: var(--primary); color: #fff;
    transition: background-color 140ms ease, opacity 140ms ease;
}
.chat-send:hover { background: var(--primary-hover); }
.chat-send:disabled { opacity: .45; cursor: default; }
.chat-send:focus-visible { border-radius: 50%; }
.chat-keys { margin: 8px 18px 14px; font-size: .76rem; color: var(--quiet); }

@media (min-width: 760px) {
    /* En pantallas anchas el tablero se recorre para que el panel no lo tape */
    .chat-open .topbar, .chat-open .board { margin-right: var(--chat-w); }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    :root { --topbar-h: 58px; --gutter: 12px; --col-w: calc(100vw - 2 * var(--gutter)); --tabs-h: 0px; }
    body:has(.proj-tabs:not([hidden])) { --tabs-h: 50px; }
    .board {
        height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top) - var(--tabs-h) - 1px);
        scroll-snap-type: x mandatory;
    }
    .columns { gap: var(--gutter); padding-top: 10px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
    .col { scroll-snap-align: center; scroll-snap-stop: always; }

    .proj-tabs:not([hidden]) {
        display: flex; gap: 8px; height: var(--tabs-h); align-items: center;
        padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none;
        border-bottom: 1px solid var(--line);
    }
    .proj-tabs::-webkit-scrollbar { display: none; }
    .proj-tab {
        display: inline-flex; align-items: center; gap: 7px; flex: none; max-width: 70vw;
        min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px;
        background: var(--surface); color: var(--muted); font-size: .86rem; font-weight: 600;
        transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
    }
    .proj-tab__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
    .proj-tab__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .proj-tab__pct { color: var(--quiet); font-weight: 500; font-variant-numeric: tabular-nums; }
    .proj-tab[aria-current="true"] {
        color: var(--text); border-color: var(--c);
        background: color-mix(in srgb, var(--c) 16%, var(--surface));
    }

    /* Toques más cómodos */
    .col-head { padding: 16px 12px 12px 14px; }
    .col-name { font-size: 1.12rem; }
    .card { padding: 8px 10px 8px 6px; }
    .card-title { font-size: 1rem; }
    .check { width: 42px; height: 42px; }
    .check svg { width: 24px; height: 24px; }
    .col-menu-btn { width: 40px; height: 40px; }
    .deadline { padding: 9px 10px; font-size: .86rem; }
    .chat {
        width: 100%; border-left: 0; box-shadow: none;
        padding-left: env(safe-area-inset-left);
        transform: translateY(100%);
    }
    .chat.is-open { transform: none; }
    .chat-head { padding-left: 16px; }
    .chat-scroll { padding: 18px 16px 14px; }
    .chat-form { margin: 0 10px; }
    .topbar { gap: 12px; }
    .topbar-title { font-size: 1.12rem; }
    .overall-text span { display: none; }
    .topbar .btn { padding: 0 13px; }
    .topbar-actions { gap: 2px; }
    .topbar-icon { width: 38px; height: 38px; }
}
@media (max-width: 420px) {
    .hide-narrow { display: none; }
    .overall-text { display: none; }
}
@media (hover: none) {
    .card:hover { border-color: transparent; }
    .chat-keys { display: none; }
    .chat-form { margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        transition-duration: .01ms !important; transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }
}

/* =========================================================
   Rediseño 2026-10: fondo con imagen + superficies de vidrio
   y tarjetas minimalistas. Sobrescribe lo anterior.
   ========================================================= */
:root {
    --bg-img: url("bg-dark.jpg");
    --quiet: #b3a1bc;      /* más claro para leerse sobre el vidrio */
    --glass: rgba(22, 12, 28, .70);
    --glass-line: rgba(255, 255, 255, .08);
    --card-bg: rgba(255, 255, 255, .045);
    --card-bg-hover: rgba(255, 255, 255, .075);
    --card-line: rgba(255, 255, 255, .07);
}
:root[data-theme="light"] {
    --bg-img: url("bg-light.jpg");
    --glass: rgba(246, 238, 248, .6);
    --glass-line: rgba(60, 20, 70, .14);
    --card-bg: rgba(255, 255, 255, .78);
    --card-bg-hover: #fff;
    --card-line: rgba(60, 20, 70, .1);
}

/* Imagen en una capa fija (el body no se desplaza) con un velo encima:
   más oscuro abajo a la derecha, donde la imagen tiene una franja brillante. */
body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        radial-gradient(120% 90% at 85% 95%, color-mix(in srgb, var(--bg) 70%, transparent), transparent 70%),
        linear-gradient(180deg, color-mix(in srgb, var(--bg) 35%, transparent), color-mix(in srgb, var(--bg) 60%, transparent)),
        var(--bg-img);
    background-size: auto, auto, cover;
    background-position: center;
    background-repeat: no-repeat;
}
:root[data-theme="light"] body::before {
    background-image: linear-gradient(180deg, color-mix(in srgb, var(--bg) 25%, transparent), color-mix(in srgb, var(--bg) 40%, transparent)), var(--bg-img);
    background-size: auto, cover;
}

.topbar {
    position: relative; z-index: 5;
    background: color-mix(in srgb, var(--bg) 40%, transparent);
    border-bottom-color: var(--glass-line);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}

/* Columnas: vidrio esmerilado, sin franja gruesa */
.col {
    background: var(--glass);
    border: 1px solid var(--glass-line);
    border-radius: 20px;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 50px -24px var(--shadow);
}
.col::before { display: none; }
.col-head { padding: 20px 16px 14px 18px; }
.col-grip { width: 8px; height: 8px; box-shadow: none; }
.col-name { font-size: 1rem; font-weight: 600; letter-spacing: -.005em; }
.col-sub { margin: 6px 0 10px 17px; }
.col-meta { font-size: .8rem; color: var(--quiet); }
.col-bar { margin-left: 17px; height: 3px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.deadline {
    width: calc(100% - 17px); margin: 14px 0 0 17px; padding: 0;
    border: 0; background: none; font-size: .8rem; font-weight: 500;
}
.deadline:hover { border: 0; color: var(--text); }
.deadline svg { width: 14px; height: 14px; }
.deadline__left { padding: 2px 9px; background: color-mix(in srgb, var(--text) 7%, transparent); font-weight: 500; }
.deadline[data-status="overdue"] { border: 0; }
.deadline[data-status="none"] { border: 0; }

.col-body { padding: 4px 12px 14px; }
.col-list, .done-list { gap: 6px; }

/* Tarjetas minimalistas */
.card {
    align-items: center;
    gap: 2px;
    padding: 4px 12px 4px 4px;
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: 14px;
    box-shadow: none;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms var(--ease-out), opacity 200ms ease;
}
.card:hover { background: var(--card-bg-hover); border-color: var(--card-line); transform: translateY(-1px); }
.card-open { gap: 4px; padding: 9px 0; }
.card-title { font-size: .93rem; font-weight: 450; line-height: 1.4; }
.card-notes { font-size: .8rem; -webkit-line-clamp: 1; }
.card-due { margin-top: 2px; }
.due {
    padding: 0; background: none; font-size: .78rem; font-weight: 500; color: var(--muted);
}
.due::before { width: 5px; height: 5px; }
.due[data-status="overdue"], .due[data-status="today"] { background: none; }
.check { width: 34px; height: 34px; }
.check svg { width: 19px; height: 19px; }
.check__ring { stroke: color-mix(in srgb, var(--text) 28%, transparent); stroke-width: 1.5; }
.card.is-done { background: color-mix(in srgb, var(--bg) 35%, transparent); border-color: transparent; }
.card.is-done:hover { background: var(--card-bg); transform: none; }
.col-done { border-top-color: var(--glass-line); }

.sortable-ghost.card { background: var(--primary-soft); border: 1px dashed var(--line-strong); }
.sortable-drag.card, .sortable-fallback.card { box-shadow: 0 16px 34px var(--shadow); transform: rotate(1.5deg); }
@keyframes flash-card { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 28%, transparent); } }

.composer-open { color: var(--quiet); }
.composer-open:hover { background: var(--card-bg); }
.composer-form { background: var(--card-bg-hover); border-color: var(--card-line); }

.col.is-skeleton { background: var(--glass); }

/* Panel de chat y modales también en vidrio */
.chat {
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.chat-suggestion { background: var(--card-bg); border-color: var(--card-line); box-shadow: none; }
.chat-suggestion:hover { background: var(--card-bg-hover); border-color: var(--card-line); }

@media (max-width: 640px) {
    .proj-tabs:not([hidden]) { border-bottom-color: var(--glass-line); }
    .proj-tab { background: var(--glass); border-color: var(--glass-line); }
    .card { padding: 6px 12px 6px 4px; }
    .check { width: 40px; height: 40px; }
    .check svg { width: 22px; height: 22px; }
    .deadline { padding: 0; }
}
@media (prefers-reduced-transparency: reduce) {
    .col, .topbar, .chat { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
}
:root[data-theme="light"] .card:not(.is-done) { box-shadow: 0 1px 2px rgba(60, 20, 70, .06); }
:root[data-theme="light"] .check__ring { stroke: color-mix(in srgb, var(--text) 35%, transparent); }
:root[data-theme="light"] .col { box-shadow: 0 1px 2px rgba(60, 20, 70, .06), 0 20px 50px -24px var(--shadow); }
.card-open:focus-visible { outline-offset: -2px; border-radius: 10px; }

/* En táctil y pantallas angostas: sin desenfoque (ahorra GPU al desplazar) */
@media (hover: none), (max-width: 640px) {
    .col, .proj-tab { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(22, 12, 28, .82); }
    :root[data-theme="light"] .col, :root[data-theme="light"] .proj-tab { background: rgba(246, 238, 248, .9); }
}
