/* =============================================================================
   Tareator - Sistema de diseno minimal y claro.
   Tokens, layout y componentes. Inspirado en Google Tasks + Material 3.
   ============================================================================= */

:root {
    /* --- Colores: light --- */
    --c-bg:           #fafafa;
    --c-surface:      #ffffff;
    --c-surface-2:    #f1f3f4;
    --c-surface-hover:#eaeaea;
    --c-border:       #e3e5e8;
    --c-border-strong:#dadce0;

    --c-text:        #1f1f1f;
    --c-text-muted:  #5f6368;
    --c-text-faint:  #80868b;

    --c-accent:        #1a73e8;
    --c-accent-hover:  #155ab6;
    --c-accent-soft:   #e8f0fe;
    --c-accent-text:   #0b57d0;

    --c-danger:        #d93025;
    --c-danger-soft:   #fce8e6;
    --c-warning:       #f29900;
    --c-warning-soft:  #fef7e0;
    --c-success:       #1e8e3e;
    --c-success-soft:  #e6f4ea;

    --c-star:          #f9ab00;

    /* --- Sombras suaves estilo Material 3 --- */
    --shadow-0: 0 0 0 1px rgba(0,0,0,.04);
    --shadow-1: 0 1px 2px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.06);
    --shadow-2: 0 2px 6px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.06);
    --shadow-3: 0 4px 12px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.08);
    --shadow-4: 0 12px 32px rgba(0,0,0,.12), 0 16px 48px rgba(0,0,0,.10);

    /* --- Espaciado consistente --- */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;

    /* --- Radios --- */
    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-pill: 999px;

    /* --- Layout --- */
    --header-h: 56px;
    --sidebar-w: 256px;

    /* --- Tipografía --- */
    --font-ui: 'Google Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Easing curves */
    --ease-out: cubic-bezier(0.2, 0, 0, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --c-bg:        #131314;
        --c-surface:   #1e1f20;
        --c-surface-2: #2d2e30;
        --c-surface-hover: #383a3c;
        --c-border:    #3c4043;
        --c-border-strong: #5f6368;

        --c-text:       #e3e3e3;
        --c-text-muted: #9aa0a6;
        --c-text-faint: #80868b;

        --c-accent:        #8ab4f8;
        --c-accent-hover:  #aecbfa;
        --c-accent-soft:   #1f3a5f;
        --c-accent-text:   #aecbfa;

        --c-danger:        #f28b82;
        --c-danger-soft:   #5c2b29;
        --c-warning:       #fdd663;
        --c-warning-soft:  #5c4b1b;
        --c-success:       #81c995;
        --c-success-soft:  #1e3a25;
        --c-star:          #fdd663;

        --shadow-0: 0 0 0 1px rgba(0,0,0,.3);
        --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.3);
        --shadow-2: 0 2px 6px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);
        --shadow-3: 0 4px 12px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.4);
        --shadow-4: 0 12px 32px rgba(0,0,0,.6), 0 16px 48px rgba(0,0,0,.4);
    }
}
:root[data-theme="dark"] {
    --c-bg:        #131314;
    --c-surface:   #1e1f20;
    --c-surface-2: #2d2e30;
    --c-surface-hover: #383a3c;
    --c-border:    #3c4043;
    --c-border-strong: #5f6368;
    --c-text:       #e3e3e3;
    --c-text-muted: #9aa0a6;
    --c-text-faint: #80868b;
    --c-accent:        #8ab4f8;
    --c-accent-hover:  #aecbfa;
    --c-accent-soft:   #1f3a5f;
    --c-accent-text:   #aecbfa;
    --c-danger:        #f28b82;
    --c-danger-soft:   #5c2b29;
    --c-warning:       #fdd663;
    --c-warning-soft:  #5c4b1b;
    --c-success:       #81c995;
    --c-success-soft:  #1e3a25;
    --c-star:          #fdd663;
}

* { box-sizing: border-box; }
*:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

html, body {
    margin: 0;
    height: 100%;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body[data-font-size="sm"] { font-size: 13px; }
body[data-font-size="lg"] { font-size: 15px; }

/* Densidad UI (I.4) */
body[data-density="compact"] .task-row { padding: 7px var(--s-2); }
body[data-density="compact"] .add-task { padding: 9px var(--s-2) 9px 56px; }
body[data-density="compact"] .bento-card { padding: var(--s-1) var(--s-2) var(--s-2); }
body[data-density="compact"] .bento-card-body .task-row { padding: 6px var(--s-1) 6px 0; }
body[data-density="spacious"] .task-row { padding: 16px var(--s-2); }
body[data-density="spacious"] .add-task { padding: 18px var(--s-2) 18px 56px; }
body[data-density="spacious"] .bento-card { padding: var(--s-3) var(--s-4) var(--s-4); }
body[data-density="spacious"] .bento-card-body .task-row { padding: 12px var(--s-1) 12px 0; }
body[data-font-size="lg"] .tasks-title,
body[data-font-size="lg"] .bento-title { font-size: 30px; }
body[data-font-size="sm"] .tasks-title,
body[data-font-size="sm"] .bento-title { font-size: 22px; }

button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }
.muted { color: var(--c-text-muted); }
.faint { color: var(--c-text-faint); }

.material-symbols-outlined {
    font-variation-settings: 'opsz' 24, 'wght' 400, 'FILL' 0, 'GRAD' 0;
    font-size: 20px;
    line-height: 1;
    vertical-align: middle;
    user-select: none;
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Botones ----------------------------------------------------- */

.icon-btn {
    background: transparent;
    border: 0;
    color: var(--c-text-muted);
    width: 40px;
    height: 40px;
    border-radius: var(--r-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s var(--ease-out), color .15s var(--ease-out);
}
.icon-btn:hover { background: var(--c-surface-hover); color: var(--c-text); }
.icon-btn.danger:hover { color: var(--c-danger); background: var(--c-danger-soft); }

.primary-btn {
    background: var(--c-accent);
    color: #fff;
    border: 0;
    padding: 10px 22px;
    border-radius: var(--r-pill);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: .2px;
    transition: background .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.primary-btn:hover { background: var(--c-accent-hover); box-shadow: var(--shadow-1); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }

.ghost-btn {
    background: transparent;
    color: var(--c-accent);
    border: 0;
    padding: 8px 16px;
    border-radius: var(--r-pill);
    font-weight: 500;
    font-size: 14px;
    transition: background .15s var(--ease-out);
}
.ghost-btn:hover { background: var(--c-accent-soft); }

.link-btn {
    background: transparent;
    border: 0;
    color: var(--c-accent);
    padding: 4px 8px;
    border-radius: var(--r-xs);
    font-size: 13px;
}
.link-btn:hover { background: var(--c-accent-soft); }

/* ---------- Login / Register / Forgot ---------------------------------- */

.auth-screen {
    min-height: 100%;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, var(--c-bg), var(--c-surface-2));
    padding: var(--s-5);
}
.auth-card {
    background: var(--c-surface);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-3);
    padding: var(--s-6);
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: var(--s-3);
}
.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--c-accent), var(--c-accent-hover));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 22px;
    font-family: var(--font-ui);
    letter-spacing: -0.5px;
    box-shadow: var(--shadow-1);
}
.brand-text {
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.3px;
    font-family: var(--font-ui);
}
.auth-tag {
    margin: 0 0 var(--s-2);
    color: var(--c-text-muted);
    font-size: 14px;
}

.google-btn {
    width: 100%;
    background: var(--c-surface);
    color: var(--c-text);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--r-pill);
    padding: 10px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-3);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: background .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.google-btn:hover { background: var(--c-surface-2); box-shadow: var(--shadow-1); }

.auth-sep {
    display: flex; align-items: center; gap: var(--s-3);
    color: var(--c-text-faint);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: var(--s-2) 0;
}
.auth-sep::before, .auth-sep::after {
    content: ''; flex: 1; height: 1px; background: var(--c-border);
}

.auth-form { display: flex; flex-direction: column; gap: var(--s-3); }
.field { display: flex; flex-direction: column; gap: var(--s-1); }
.field > span {
    font-size: 12px;
    color: var(--c-text-muted);
    font-weight: 500;
}
.field > input {
    background: var(--c-bg);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.field > input:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
}

.auth-actions {
    display: flex;
    gap: var(--s-2);
    justify-content: space-between;
    align-items: center;
    margin-top: var(--s-2);
}
.auth-actions .link-btn { padding: 8px 10px; font-size: 13px; }
.auth-actions .auth-actions-right { display: flex; gap: var(--s-2); align-items: center; }
.auth-error {
    background: var(--c-danger-soft);
    color: var(--c-danger);
    padding: 10px 14px;
    border-radius: var(--r-md);
    font-size: 13px;
}
.auth-success {
    background: var(--c-success-soft);
    color: var(--c-success);
    padding: 10px 14px;
    border-radius: var(--r-md);
    font-size: 13px;
}
.auth-foot {
    color: var(--c-text-faint);
    margin-top: var(--s-4);
    font-size: 12px;
    text-align: center;
}

/* ---------- App shell --------------------------------------------------- */

.app-screen { display: block; height: 100%; }
.app-screen.hidden { display: none; }

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: calc(100vh - var(--header-h));
}

.topbar {
    position: sticky; top: 0; z-index: 20;
    height: var(--header-h);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    padding: 0 var(--s-3);
    gap: var(--s-2);
}
.topbar-menu { display: none; }
.topbar .brand-lockup {
    display: flex; align-items: center; gap: var(--s-2);
    padding-left: var(--s-1);
}
.topbar .brand-mark { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }
.topbar .brand-text { font-size: 18px; font-weight: 500; font-family: var(--font-ui); }
.topbar-spacer { flex: 1; }

.today-pill {
    background: var(--c-accent-soft);
    color: var(--c-accent-text);
    border: 0;
    padding: 6px 12px;
    border-radius: var(--r-pill);
    display: inline-flex; align-items: center; gap: 6px;
    font-weight: 500; font-size: 13px;
    transition: background .12s var(--ease-out);
}
.today-pill:hover { background: var(--c-accent); color: #fff; }
.today-pill .material-symbols-outlined { font-size: 16px; }
.today-pill.has-overdue { background: var(--c-danger-soft); color: var(--c-danger); }
.today-pill.has-overdue:hover { background: var(--c-danger); color: #fff; }

.user-chip {
    background: transparent;
    border: 0;
    width: 40px; height: 40px;
    border-radius: var(--r-pill);
    display: grid; place-items: center;
    transition: background .15s var(--ease-out);
}
.user-chip:hover { background: var(--c-surface-hover); }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: var(--r-pill);
    background: var(--c-accent);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 500;
    font-size: 13px;
    background-size: cover;
    background-position: center;
}

.user-menu, .popup-menu {
    position: absolute;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
    padding: var(--s-1) 0;
    min-width: 240px;
    z-index: 30;
}
.user-menu { top: calc(var(--header-h) - 4px); right: var(--s-3); }
.user-menu-head {
    padding: 12px 16px;
    display: flex; flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: var(--s-1);
}
.user-menu-head > span:first-child { font-weight: 500; font-size: 14px; }
.user-menu-head > .muted { font-size: 12px; }

.user-menu-item, .popup-item {
    background: transparent; border: 0; width: 100%;
    text-align: left;
    padding: 10px 16px;
    display: flex; align-items: center; gap: var(--s-3);
    color: var(--c-text);
    font-size: 14px;
    text-decoration: none;
    transition: background .12s var(--ease-out);
}
.user-menu-item:hover, .popup-item:hover { background: var(--c-surface-2); }
.popup-item.danger { color: var(--c-danger); }
.popup-item.danger:hover { background: var(--c-danger-soft); }
.popup-item.is-checked { background: var(--c-accent-soft); color: var(--c-accent-text); }
.popup-item.is-checked .material-symbols-outlined { color: var(--c-accent); }
.popup-item .material-symbols-outlined { font-size: 18px; color: var(--c-text-muted); flex-shrink: 0; }
.popup-item.danger .material-symbols-outlined { color: var(--c-danger); }
.popup-sep { height: 1px; background: var(--c-border); margin: var(--s-1) 0; }
.popup-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--c-text-muted);
    padding: 8px 16px 4px;
    font-weight: 600;
}
.popup-menu.floating {
    position: fixed;
    max-height: 80vh;
    overflow-y: auto;
    min-width: 240px;
    z-index: 110;
}
.popup-colors {
    display: flex; flex-wrap: wrap; gap: var(--s-1);
    padding: var(--s-1) var(--s-4) var(--s-2);
}
.color-swatch {
    width: 24px; height: 24px;
    border-radius: var(--r-pill);
    display: grid; place-items: center;
    transition: transform .15s var(--ease-out);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.is-checked { box-shadow: 0 0 0 2px var(--c-bg), 0 0 0 4px var(--c-accent); }

/* ---------- Sidebar de listas ------------------------------------------- */

.sidebar {
    background: var(--c-bg);
    border-right: 1px solid var(--c-border);
    padding: var(--s-3) 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}
.sidebar-overview {
    margin: 0 var(--s-3) var(--s-2) var(--s-4);
    background: transparent;
    border: 0;
    padding: 10px var(--s-3);
    border-radius: var(--r-pill);
    text-align: left;
    color: var(--c-text);
    font-size: 14px;
    font-weight: 500;
    display: flex; align-items: center; gap: var(--s-3);
    transition: background .12s var(--ease-out);
}
.sidebar-overview:hover { background: var(--c-surface-2); }
.sidebar-overview.active {
    background: var(--c-accent-soft);
    color: var(--c-accent-text);
}
.sidebar-overview .material-symbols-outlined { font-size: 20px; }

.sidebar-section { display: flex; flex-direction: column; }
.sidebar-title {
    font-family: var(--font-ui);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-text-muted);
    margin: var(--s-2) var(--s-4) var(--s-1);
    font-weight: 600;
}
.list-nav { list-style: none; margin: 0; padding: 0; }
.list-nav li {
    display: flex; align-items: center; gap: var(--s-3);
    padding: 9px var(--s-3) 9px var(--s-4);
    border-radius: 0 var(--r-pill) var(--r-pill) 0;
    margin-right: var(--s-3);
    color: var(--c-text);
    transition: background .12s var(--ease-out);
    font-size: 14px;
    cursor: pointer;
}
.list-nav li:hover { background: var(--c-surface-2); }
.list-nav li.active {
    background: var(--c-accent-soft);
    color: var(--c-accent-text);
    font-weight: 500;
}
.list-nav .list-icon { font-size: 18px; color: var(--c-text-muted); flex-shrink: 0; }
.list-nav li.active .list-icon { color: var(--c-accent); }
.list-nav .list-name {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.list-nav .list-count {
    font-size: 11px;
    color: var(--c-text-muted);
    background: var(--c-surface-2);
    padding: 2px 8px;
    border-radius: var(--r-pill);
    min-width: 24px;
    text-align: center;
    font-weight: 500;
}
.list-nav li.active .list-count {
    background: rgba(26,115,232,.18);
    color: var(--c-accent-text);
}
.list-nav .list-shared-tag {
    font-size: 10px;
    color: var(--c-text-faint);
    background: var(--c-surface-2);
    padding: 2px 6px;
    border-radius: var(--r-pill);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.sidebar-cta {
    margin: var(--s-2) var(--s-4);
    background: transparent;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--r-pill);
    padding: 8px var(--s-3);
    color: var(--c-accent);
    font-weight: 500;
    font-size: 14px;
    display: inline-flex; align-items: center; gap: var(--s-2);
    align-self: flex-start;
    transition: background .15s var(--ease-out);
}
.sidebar-cta:hover { background: var(--c-accent-soft); }

.sidebar-link {
    margin: 0 var(--s-4);
    background: transparent;
    border: 0;
    padding: 8px var(--s-3);
    border-radius: var(--r-pill);
    color: var(--c-text-muted);
    font-size: 13px;
    display: inline-flex;
    align-items: center; gap: var(--s-2);
    align-self: flex-start;
    transition: background .12s var(--ease-out), color .12s var(--ease-out);
}
.sidebar-link:hover { color: var(--c-text); background: var(--c-surface-2); }
.list-nav li.hidden-list { opacity: 0.55; font-style: italic; }

/* ---------- Panel central de tareas ------------------------------------- */

.tasks-pane {
    overflow-y: auto;
    padding: var(--s-5) clamp(var(--s-4), 6vw, var(--s-8));
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.tasks-head {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-3);
}
.tasks-title {
    font-family: var(--font-ui);
    font-size: 26px;
    font-weight: 500;
    margin: 0;
    flex: 1;
    padding: var(--s-2) 0;
    letter-spacing: -0.4px;
}
.tasks-head-actions { position: relative; display: flex; gap: var(--s-1); }
.tasks-head-actions .popup-menu { top: 44px; right: 0; }

.add-task {
    width: 100%;
    background: var(--c-bg);
    border: 0;
    border-bottom: 1px solid var(--c-border);
    padding: 14px 8px 14px 56px;
    text-align: left;
    color: var(--c-text-muted);
    display: flex; align-items: center; gap: var(--s-2);
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 14px;
    transition: background .12s var(--ease-out), color .12s var(--ease-out);
}
.tasks-pane .add-task { top: -1px; }
.bento-card-body .add-task { position: relative; top: 0; background: transparent; }
.add-task .material-symbols-outlined {
    position: absolute; left: 20px;
    width: 24px; height: 24px;
    border-radius: var(--r-pill);
    background: var(--c-accent);
    color: #fff;
    display: grid; place-items: center;
    font-size: 18px;
    transition: background .12s var(--ease-out);
}
.add-task:hover { background: var(--c-surface-2); color: var(--c-text); }
.add-task:hover .material-symbols-outlined { background: var(--c-accent-hover); }
.add-task.small {
    padding: var(--s-2) var(--s-2) var(--s-2) 44px;
    margin-top: var(--s-1);
    border: 0;
    font-size: 13px;
}
.add-task.small .material-symbols-outlined {
    left: 12px; width: 20px; height: 20px; font-size: 14px;
}

/* ---------- Task rows --------------------------------------------------- */

.task-list { list-style: none; margin: 0; padding: 0; }
.task-list.completed .task-row .task-title {
    color: var(--c-text-faint);
    text-decoration: line-through;
}

.task-row {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: start;
    gap: var(--s-3);
    padding: 12px var(--s-2);
    border-bottom: 1px solid var(--c-border);
    position: relative;
    user-select: none;
    transition: background .12s var(--ease-out);
}
.task-row:hover { background: var(--c-surface-2); }
.task-row.active { background: var(--c-accent-soft); }
.task-row.completing {
    animation: complete-fade .35s var(--ease-out) forwards;
}
@keyframes complete-fade {
    0% { opacity: 1; transform: translateX(0); }
    60% { opacity: 0.4; transform: translateX(6px); }
    100% { opacity: 0; transform: translateX(20px); }
}

.task-check {
    appearance: none;
    width: 20px; height: 20px;
    border: 2px solid var(--c-text-faint);
    border-radius: var(--r-pill);
    margin-top: 2px;
    position: relative;
    transition: all .15s var(--ease-out);
    cursor: pointer;
}
.task-check:hover { border-color: var(--c-accent); transform: scale(1.1); }
.task-check:checked {
    background: var(--c-accent);
    border-color: var(--c-accent);
}
.task-check:checked::after {
    content: '';
    position: absolute; left: 4px; top: 1px;
    width: 5px; height: 9px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.task-body { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.task-title-line { display: flex; align-items: center; gap: var(--s-2); }
.task-title {
    color: var(--c-text);
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    padding: 0;
    min-width: 0;
    line-height: 1.4;
}
.task-meta {
    display: flex; flex-wrap: wrap; gap: var(--s-1);
    font-size: 12px;
    color: var(--c-text-muted);
    margin-top: 2px;
}
.task-meta .chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px var(--s-2);
    border-radius: var(--r-pill);
    background: var(--c-surface-2);
    font-weight: 500;
}
.task-meta .chip .material-symbols-outlined { font-size: 13px; }
.task-meta .chip.overdue { color: var(--c-danger); background: var(--c-danger-soft); }
.task-meta .chip.today { color: var(--c-accent-text); background: var(--c-accent-soft); }
.task-meta .chip.gcal { color: var(--c-success); background: var(--c-success-soft); }

.task-actions {
    display: flex; gap: 2px; align-items: center;
    opacity: 0; transition: opacity .12s var(--ease-out);
}
.task-row:hover .task-actions, .task-row.active .task-actions { opacity: 1; }
.task-star, .task-hide, .task-more {
    background: transparent; border: 0;
    width: 28px; height: 28px; border-radius: var(--r-pill);
    display: grid; place-items: center;
    color: var(--c-text-muted);
    opacity: 0; transition: opacity .12s var(--ease-out), background .12s var(--ease-out);
}
.task-star.on { opacity: 1; color: var(--c-star); }
.task-row:hover .task-star, .task-row:hover .task-more { opacity: 1; }
.task-star:hover, .task-hide:hover, .task-more:hover { background: var(--c-surface-hover); }
.task-row.hidden-task { opacity: 0.55; font-style: italic; }
.task-row.hidden-task .task-hide { opacity: 1; color: var(--c-accent); }
.task-row.nav-focus { outline: 2px solid var(--c-accent); outline-offset: -2px; }

.task-list.nested { margin-left: var(--s-6); }
.task-list.nested .task-row { padding-left: var(--s-1); }

/* Separador "Hoy" */
.task-row.row-divider {
    background: transparent;
    border-bottom: 0;
    padding: var(--s-4) var(--s-2) var(--s-1);
    pointer-events: none;
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-text-muted);
    font-weight: 600;
}

/* ---------- Completadas (colapsable) ------------------------------------ */

.completed-block { margin-top: var(--s-3); }
.completed-toggle {
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--c-border);
    padding: 12px var(--s-2);
    text-align: left;
    color: var(--c-text-muted);
    display: flex; align-items: center; gap: var(--s-2);
    font-size: 13px;
    font-weight: 500;
    transition: background .12s var(--ease-out);
}
.completed-toggle:hover { background: var(--c-surface-2); }
.completed-toggle .chev { transition: transform .2s var(--ease-out); }
.completed-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* ---------- Empty state ------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: var(--s-7) var(--s-4);
    color: var(--c-text-muted);
}
.empty-state .empty-icon {
    width: 84px; height: 84px;
    border-radius: var(--r-pill);
    background: var(--c-accent-soft);
    display: grid; place-items: center;
    margin: 0 auto var(--s-4);
}
.empty-state .empty-icon .material-symbols-outlined {
    font-size: 44px;
    color: var(--c-accent);
}
.empty-state h3 {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 var(--s-2);
    color: var(--c-text);
}
.empty-state p { margin: 0; font-size: 14px; }
.empty-state .empty-cta { margin-top: var(--s-4); }

/* ---------- Modal ------------------------------------------------------- */

.modal-root {
    position: fixed; inset: 0;
    display: grid; place-items: center;
    z-index: 100;
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.modal-card {
    position: relative;
    background: var(--c-surface);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-4);
    width: min(92vw, 540px);
    max-height: 90vh;
    overflow: auto;
    display: flex; flex-direction: column;
    animation: modal-in .2s var(--ease-out);
}
@keyframes modal-in {
    from { transform: translateY(12px) scale(.98); opacity: 0; }
    to { transform: none; opacity: 1; }
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--s-4) var(--s-4) var(--s-2) var(--s-5);
}
.modal-head h2 {
    margin: 0;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 18px;
    letter-spacing: -0.2px;
}
.modal-body {
    padding: var(--s-2) var(--s-5) var(--s-3);
    display: flex; flex-direction: column;
    gap: var(--s-3);
}
.modal-foot {
    padding: var(--s-3) var(--s-5) var(--s-5);
    display: flex; justify-content: flex-end; gap: var(--s-2);
}
.modal-body input[type=text], .modal-body input[type=email], .modal-body textarea, .modal-body select {
    width: 100%;
    background: var(--c-bg);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--r-md);
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
}

.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-1); }
.share-list li {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-md);
    background: var(--c-surface-2);
}
.share-list .share-name { flex: 1; min-width: 0; }
.share-list .share-perm select { width: auto; padding: 4px 8px; font-size: 13px; }

/* ---------- Detail panel ------------------------------------------------ */

.detail-panel {
    position: fixed;
    top: var(--header-h);
    right: 0;
    width: min(440px, 100vw);
    height: calc(100vh - var(--header-h));
    background: var(--c-surface);
    border-left: 1px solid var(--c-border);
    box-shadow: var(--shadow-3);
    z-index: 25;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .2s var(--ease-out);
}
.detail-panel:not(.hidden) { transform: translateX(0); }
.detail-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--s-1) var(--s-2);
    border-bottom: 1px solid var(--c-border);
}
.detail-head-actions { display: flex; gap: var(--s-1); }
.detail-body {
    padding: var(--s-4) var(--s-5);
    overflow-y: auto;
    display: flex; flex-direction: column;
    gap: var(--s-3);
}
.detail-title {
    font-size: 18px;
    font-family: var(--font-ui);
    font-weight: 500;
    background: transparent;
    border: 0;
    outline: none;
    padding: var(--s-1) 0;
    border-bottom: 1px solid transparent;
    transition: border-color .15s var(--ease-out);
}
.detail-title:focus { border-bottom-color: var(--c-accent); }
.detail-notes {
    background: transparent;
    border: 0;
    outline: none;
    resize: vertical;
    min-height: 80px;
    padding: var(--s-2) 0;
    border-bottom: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    color: var(--c-text);
    line-height: 1.5;
}
.detail-notes:focus { border-bottom-color: var(--c-accent); }
.detail-notes-render {
    background: transparent;
    padding: var(--s-2) 0;
    border-bottom: 1px solid transparent;
    font-size: 14px;
    line-height: 1.6;
    color: var(--c-text);
    cursor: text;
    min-height: 40px;
    word-break: break-word;
}
.detail-notes-render:hover {
    border-bottom-color: var(--c-border);
}
.detail-notes-render code {
    background: var(--c-surface-2);
    padding: 1px 6px;
    border-radius: var(--r-xs);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: .9em;
}
.detail-notes-render strong { font-weight: 600; }
.detail-notes-render em { font-style: italic; }
.detail-notes-render a { color: var(--c-accent); text-decoration: underline; }
.detail-row {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-2) 0;
    border-bottom: 1px solid var(--c-border);
}
.detail-row > .material-symbols-outlined { color: var(--c-text-muted); }
.detail-row input[type=date], .detail-row select, .detail-row input[type=time] {
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    font-size: 14px;
    color: var(--c-text);
    padding: var(--s-1) 0;
}
.time-toggle {
    display: inline-flex; align-items: center; gap: var(--s-1);
    font-size: 12px; color: var(--c-text-muted);
}
.detail-subtasks h3 {
    margin: var(--s-2) 0;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--c-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.detail-meta { font-size: 12px; padding-top: var(--s-3); color: var(--c-text-faint); }

/* ---------- Vista mosaico (bento) --------------------------------------- */

.bento-pane {
    padding: var(--s-5) clamp(var(--s-4), 4vw, var(--s-7)) var(--s-8);
    overflow-y: auto;
}
.bento-head {
    display: flex; align-items: center; gap: var(--s-3);
    margin: 0 0 var(--s-5);
    padding: 0 var(--s-1);
}
.bento-title {
    font-family: var(--font-ui);
    font-size: 28px; font-weight: 500;
    margin: 0; flex: 1;
    letter-spacing: -0.5px;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 60px;
    gap: var(--s-4);
    position: relative;
}

.bento-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    padding: var(--s-1) var(--s-3) var(--s-3);
    display: flex; flex-direction: column;
    overflow: visible;
    transition: box-shadow .15s var(--ease-out), border-color .15s var(--ease-out), transform .15s var(--ease-out);
    min-height: 0;
}
.bento-card:hover {
    box-shadow: var(--shadow-2);
    border-color: var(--c-border-strong);
}
.bento-card.shared {
    border-left: 3px solid var(--c-accent);
}
.bento-card.collapsed .bento-card-body { display: none; }
.bento-card.collapsed { min-height: 0; box-shadow: var(--shadow-0); }
.bento-card.hidden-list { opacity: 0.55; }
.bento-card.hidden-list .bento-card-title { font-style: italic; }

.bento-card-head {
    display: flex; align-items: center; gap: var(--s-1);
    padding: var(--s-2) var(--s-1);
    border-radius: var(--r-sm);
    cursor: grab;
    margin-bottom: var(--s-1);
    user-select: none;
    -webkit-user-select: none;
}
.bento-card-head:active { cursor: grabbing; }
.bento-card-head:hover { background: var(--c-surface-2); }
.bento-card-title {
    font-family: var(--font-ui);
    font-size: 15px; font-weight: 500;
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-left: var(--s-1);
    letter-spacing: -0.1px;
}
.bento-card-icon { color: var(--c-text-muted); font-size: 18px; }
.bento-card.shared .bento-card-icon { color: var(--c-accent); }
.bento-card-count {
    font-size: 11px; color: var(--c-text-muted);
    background: var(--c-surface-2);
    padding: 2px var(--s-2); border-radius: var(--r-pill);
    min-width: 24px; text-align: center;
    font-weight: 500;
}
.bento-card.collapsed .bento-card-head .chev { transform: rotate(-90deg); }

.bento-card-avatars {
    display: inline-flex; align-items: center;
    margin-right: var(--s-1);
}
.mini-avatar {
    width: 22px; height: 22px;
    border-radius: var(--r-pill);
    background: var(--c-accent);
    color: #fff;
    display: inline-grid; place-items: center;
    font-size: 10px; font-weight: 600;
    border: 2px solid var(--c-surface);
    background-size: cover; background-position: center;
    margin-left: -6px;
}
.mini-avatar:first-child { margin-left: 0; }
.mini-avatar.more {
    background: var(--c-surface-2);
    color: var(--c-text-muted);
}

kbd {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-xs);
    padding: 1px 6px;
    font-size: 11px;
    font-family: monospace;
    font-weight: 600;
    color: var(--c-text);
}

.bento-icon-btn {
    background: transparent; border: 0;
    width: 28px; height: 28px; border-radius: var(--r-pill);
    display: grid; place-items: center;
    color: var(--c-text-muted);
    flex-shrink: 0;
    transition: background .12s var(--ease-out);
}
.bento-icon-btn:hover { background: var(--c-surface-hover); color: var(--c-text); }
.bento-icon-btn .chev { transition: transform .2s var(--ease-out); }

.bento-card-body {
    flex: 1;
    overflow: visible;
    margin: 0 -10px;
    padding: 0 10px;
}
.bento-card-body .add-task {
    padding: 10px var(--s-2) 10px 40px;
    font-size: 13px;
    border-bottom: 1px solid var(--c-border);
}
.bento-card-body .add-task .material-symbols-outlined {
    left: 8px; width: 22px; height: 22px; font-size: 14px;
}
.bento-card-body .task-row {
    padding: 9px var(--s-1) 9px 0;
    font-size: 13px;
}
.bento-card-body .task-row .task-check { width: 18px; height: 18px; }
.bento-card-body .completed-toggle {
    padding: 8px var(--s-1);
    font-size: 12px;
}
.bento-card-body .empty-state, .bento-card-body p.muted { font-size: 12px; padding: var(--s-2) var(--s-1); }

.bento-card.dragging { opacity: 0.35; transform: scale(0.98); }
.bento-card.drop-target {
    outline: 2px dashed var(--c-accent);
    outline-offset: -2px;
}
.bento-card.drop-into-tasks {
    background: var(--c-accent-soft);
    outline: 2px dashed var(--c-accent);
    outline-offset: -2px;
}
.bento-card.drop-edge-top    { box-shadow: inset 0 4px 0 var(--c-accent), var(--shadow-1); }
.bento-card.drop-edge-bottom { box-shadow: inset 0 -4px 0 var(--c-accent), var(--shadow-1); }
.bento-card.drop-edge-left   { box-shadow: inset 4px 0 0 var(--c-accent), var(--shadow-1); }
.bento-card.drop-edge-right  { box-shadow: inset -4px 0 0 var(--c-accent), var(--shadow-1); }

.bento-more { list-style: none; padding: 0; margin: var(--s-1) 0 0; }
.bento-more button {
    width: 100%;
    background: transparent;
    border: 0;
    border-top: 1px dashed var(--c-border);
    padding: var(--s-2) 0;
    color: var(--c-accent);
    font-size: 12px;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    font-weight: 500;
    transition: background .12s var(--ease-out);
}
.bento-more button:hover { background: var(--c-accent-soft); }

/* ---------- Vista calendario semanal (B.9) ---------------------------- */

.week-pane {
    padding: var(--s-5) clamp(var(--s-4), 4vw, var(--s-7)) var(--s-8);
    overflow-y: auto;
    display: flex; flex-direction: column;
}
.week-head {
    display: flex; align-items: center; gap: var(--s-2);
    margin-bottom: var(--s-4);
}
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--s-2);
    min-height: 60vh;
}
.week-col {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    display: flex; flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.week-col.is-today { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.week-col.is-weekend { background: var(--c-bg); }
.week-col-head {
    padding: var(--s-2) var(--s-2);
    border-bottom: 1px solid var(--c-border);
    display: flex; flex-direction: column;
    gap: 2px;
    text-align: center;
}
.week-col-day { font-size: 11px; text-transform: uppercase; color: var(--c-text-muted); letter-spacing: .5px; font-weight: 600; }
.week-col-date { font-size: 20px; font-weight: 500; font-family: var(--font-ui); }
.week-col.is-today .week-col-date { color: var(--c-accent); }
.week-col-body {
    flex: 1;
    padding: var(--s-1);
    display: flex; flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}
.week-task {
    background: var(--c-surface-2);
    border-radius: var(--r-sm);
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.3;
    cursor: grab;
    border-left: 3px solid var(--c-accent);
    display: flex; flex-direction: column; gap: 2px;
    transition: background .12s var(--ease-out);
}
.week-task:hover { background: var(--c-surface-hover); }
.week-task.completed { opacity: 0.5; text-decoration: line-through; }
.week-task.starred { border-left-color: var(--c-star); }
.week-task.dragging { opacity: 0.4; }
.week-task .week-task-time { font-size: 10px; color: var(--c-text-muted); }
.week-task .week-task-list { font-size: 10px; color: var(--c-text-muted); }
.week-col.drag-over { background: var(--c-accent-soft); }
@media (max-width: 720px) {
    .week-grid { grid-template-columns: repeat(7, minmax(140px, 1fr)); overflow-x: auto; }
}

/* Skeleton loader para cards mientras cargan los snapshots */
.bento-skeleton {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: var(--s-3);
    grid-row: span 3;
    display: flex; flex-direction: column; gap: var(--s-2);
}
.bento-skeleton .skel-line {
    height: 12px;
    background: linear-gradient(90deg, var(--c-surface-2) 0%, var(--c-surface-hover) 50%, var(--c-surface-2) 100%);
    background-size: 200% 100%;
    border-radius: var(--r-pill);
    animation: skel-shimmer 1.5s linear infinite;
}
.bento-skeleton .skel-line.wide { width: 70%; }
.bento-skeleton .skel-line.short { width: 40%; }
@keyframes skel-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.bento-cell-ghost {
    position: absolute;
    background: var(--c-accent-soft);
    border: 2px dashed var(--c-accent);
    border-radius: var(--r-lg);
    pointer-events: none;
    z-index: 5;
    transition: left .1s var(--ease-out), top .1s var(--ease-out);
}

/* ---------- Drag & drop tareas ----------------------------------------- */

.task-row .drag-handle {
    position: absolute;
    left: -18px; top: 14px;
    width: 16px; height: 16px;
    opacity: 0;
    color: var(--c-text-faint);
    transition: opacity .12s var(--ease-out);
}
.task-row:hover .drag-handle { opacity: 1; cursor: grab; }
.task-row.dragging { opacity: 0.35; }
.task-row.drop-before { box-shadow: inset 0 2px 0 var(--c-accent); }
.task-row.drop-after { box-shadow: inset 0 -2px 0 var(--c-accent); }
.task-row.drop-child {
    background: var(--c-accent-soft);
    outline: 2px dashed var(--c-accent);
    outline-offset: -2px;
}
.list-nav li.dragging { opacity: 0.4; }
.list-nav li.drop-before { box-shadow: inset 0 2px 0 var(--c-accent); }
.list-nav li.drop-after { box-shadow: inset 0 -2px 0 var(--c-accent); }

/* ---------- Parse preview chip ----------------------------------------- */

.parse-chip {
    display: inline-flex; align-items: center; gap: var(--s-1);
    background: var(--c-accent-soft);
    color: var(--c-accent-text);
    padding: 4px 10px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 500;
}
.parse-chip button {
    background: transparent; border: 0; padding: 0;
    color: inherit;
    display: grid; place-items: center;
    width: 16px; height: 16px; border-radius: var(--r-pill);
}
.parse-chip button:hover { background: rgba(0,0,0,.08); }
.parse-preview { margin: 6px 0 0; padding-left: 0; }

/* ---------- Toast ------------------------------------------------------- */

.toast {
    position: fixed;
    bottom: var(--s-5); left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: #fff;
    padding: 12px var(--s-4);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-3);
    z-index: 200;
    font-size: 14px;
    max-width: 90vw;
    display: inline-flex; align-items: center; gap: var(--s-3);
    animation: toast-in .2s var(--ease-out);
}
@keyframes toast-in {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translateX(-50%); opacity: 1; }
}
.toast.error { background: var(--c-danger); }
.toast.success { background: var(--c-success); color: #fff; }
.toast .toast-action {
    background: transparent; border: 0;
    color: #8ab4f8; cursor: pointer;
    font-weight: 600; padding: 4px var(--s-2);
    border-radius: var(--r-xs);
    text-transform: uppercase;
    font-size: 12px; letter-spacing: .5px;
}
.toast.success .toast-action { color: #fff; }
.toast .toast-action:hover { background: rgba(255,255,255,.1); }

/* ---------- Omnibar (Ctrl+K) ------------------------------------------- */

.omnibar {
    position: fixed; inset: 0; z-index: 200;
    display: grid; place-items: start center;
    padding-top: 12vh;
    animation: omnibar-fade .15s var(--ease-out);
}
@keyframes omnibar-fade { from { opacity: 0; } to { opacity: 1; } }
.omnibar-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); }
.omnibar-box {
    position: relative;
    background: var(--c-surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-4);
    width: min(620px, 92vw);
    padding: var(--s-3) var(--s-4) var(--s-4);
    display: flex; flex-direction: column; gap: var(--s-2);
    animation: modal-in .2s var(--ease-out);
}
.omnibar-row { display: flex; align-items: center; gap: var(--s-3); }
.omnibar-row > .material-symbols-outlined { color: var(--c-text-muted); }
.omnibar input, .omnibar select {
    flex: 1; background: transparent; border: 0; outline: 0;
    font-size: 16px; color: var(--c-text); padding: var(--s-1) 0;
}
.omnibar input { border-bottom: 2px solid var(--c-accent); font-weight: 500; }
.omnibar select { font-size: 13px; color: var(--c-text-muted); }
.omnibar-hint { color: var(--c-text-faint); font-size: 11px; margin-left: auto; }
.omnibar-preview { padding: var(--s-1) 0 0; }

/* ---------- Responsive ------------------------------------------------- */

@media (max-width: 720px) {
    .topbar-menu { display: inline-flex; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        z-index: 30;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform .2s var(--ease-out);
        box-shadow: var(--shadow-3);
        background: var(--c-surface);
    }
    .sidebar.open { transform: translateX(0); }
    .tasks-pane { padding: var(--s-4); }
    .detail-panel { width: 100vw; }
    .bento-pane { padding: var(--s-4); }
    .bento-grid { grid-template-columns: 1fr; }
}
