﻿@font-face {
    font-family: 'Helvetica Now Display';
    src: url('/font/HelveticaNowDisplay-Regular.woff2') format('woff2'),
         url('/font/HelveticaNowDisplay-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Helvetica Now Display';
    src: url('/font/HelveticaNowDisplay-Medium.woff2') format('woff2'),
         url('/font/HelveticaNowDisplay-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Helvetica Now Display';
    src: url('/font/HelveticaNowDisplay-Bold.woff2') format('woff2'),
         url('/font/HelveticaNowDisplay-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ===== TEMAS ===== */
:root {
    /* Tema claro = look ORIGINAL. Mantiene los colores hardcodeados previos. */
    --bg-app: #ffffff;
    --bg-surface: #f4f4f4;
    --bg-surface-hover: #ebebeb;
    --text: #111111;
    --text-muted: #666666;
    --text-subtle: #AEAEB2;
    --border: #f0f0f0;
    --accent: #007BFF;
    --accent-on: #ffffff;
    /* Panel oscuro: sidebar, burbuja del chat. En claro son negros con texto blanco. */
    --panel-bg: #000000;
    --panel-fg: #ffffff;
    /* Icono del gato (SVG): rect de fondo y color del trazo. */
    --cat-bg: #ffffff;
    --cat-fg: #000000;

    /* Sombra del texto en splash (fecha/hora) */
    --splash-shadow: 0 2px 12px rgba(0,0,0,0.75), 0 4px 32px rgba(0,0,0,0.55);

    /* Superficies móviles (fondo de página vs. tarjeta) */
    --m-bg: #f2f2f7;
    --m-card: #ffffff;
}

[data-theme="dark"] {
    --bg-app: #0e0f12;
    --bg-surface: #1c1f24;
    --bg-surface-hover: #262a31;
    --text: #f3f4f6;
    --text-muted: #9aa0a6;
    --text-subtle: #6b7280;
    --border: #2a2e35;
    --accent: #60a5fa;
    --accent-on: #0e0f12;
    --panel-bg: #1c1f24;
    --panel-fg: #f3f4f6;
    --cat-bg: #1c1f24;
    --cat-fg: #f3f4f6;
    --splash-shadow: 0 2px 14px rgba(0,0,0,0.9), 0 4px 36px rgba(0,0,0,0.7);
    --m-bg: #0e0f12;
    --m-card: #1c1f24;
    color-scheme: dark;
}

[data-theme="pink"] {
    --bg-app: #fff5f9;
    --bg-surface: #ffe1ec;
    --bg-surface-hover: #ffd1e1;
    --text: #3d1428;
    --text-muted: #8a4566;
    --text-subtle: #b88aa5;
    --border: #ffd1e1;
    --accent: #e891bc;
    --accent-on: #ffffff;
    --panel-bg: #edc6d4;
    --panel-fg: #3d1428;
    --cat-bg: #f1d9e2;
    --cat-fg: #3d1428;
    --splash-shadow: 0 2px 12px rgba(61,20,40,0.8), 0 4px 32px rgba(61,20,40,0.6);
    --m-bg: #ffe1ec;
    --m-card: #ffffff;
}

[data-theme="mint"] {
    --bg-app: #f3faf5;
    --bg-surface: #e1f3e6;
    --bg-surface-hover: #d0eada;
    --text: #14331f;
    --text-muted: #5a7a64;
    --text-subtle: #8aac95;
    --border: #d0eada;
    --accent: #2e8a4d;
    --accent-on: #ffffff;
    --panel-bg: #d0eada;
    --panel-fg: #14331f;
    --cat-bg: #d0eada;
    --cat-fg: #14331f;
    --splash-shadow: 0 2px 12px rgba(20,51,31,0.8), 0 4px 32px rgba(20,51,31,0.6);
    --m-bg: #e1f3e6;
    --m-card: #ffffff;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Helvetica Now Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
    background: var(--bg-app);
    color: var(--text);
    overflow-x: hidden;
    overflow-y: hidden;
}

.hidden {
    display: none !important;
}

.section-empty {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== SPLASH SCREEN ===== */
#splash-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100svh;
    z-index: 210;
    overflow: hidden;
    display: flex;
    background: #fff;
}

#splash-left {
    flex: 0 0 48%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 60px 56px;
    background: #fff;
    gap: 40px;
}

#splash-copy {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#splash-title {
    font-size: clamp(32px, 3.5vw, 52px);
    font-weight: 700;
    color: #0a0a0a;
    line-height: 1;
    letter-spacing: -0.0em;
    padding-bottom: 9px;
}

#splash-subtitle {
       font-size: clamp(14px, 1.3vw, 20px);
    color: #555;
    line-height: 1.3;
    font-family: 'Helvetica Now Display';
    font-weight: 500;
}

#splash-welcome-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#splash-welcome-overlay #splash-welcome-title {
    font-size: clamp(48px, 6vw, 80px);
    font-weight: 400;
    color: #fff;
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin: 0;
    text-shadow: 0 2px 12px rgba(0,0,0,0.55);
}


#splash-welcome-overlay #splash-date {
    position: absolute;
    top: 28px;
    left: 32px;
    font-size: clamp(16px, 1.6vw, 30px);
    font-weight: 400;
    color: #fff;
    margin: 0;
    text-transform: capitalize;
    
}

#splash-welcome-overlay #splash-time {
    position: absolute;
    top: 28px;
    right: 32px;
    font-size: clamp(16px, 1.6vw, 30px);
    font-weight: 400;
    color: #fff;
    margin: 0;
    text-shadow: 0 1px 8px rgba(0,0,0,0.55);
}

#splash-right {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#landscape-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: filter 1.5s ease;
}

#splash-location {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

#splash-location-name {
    font-size: 20px;
    font-weight: 500;
    color: #fff;
    line-height: 1;
}

#splash-location-sub {
    font-size: 14px;
    color: rgba(255,255,255,0.85);
}

.splash-auth {
    display: flex;
    pointer-events: none;
}

.splash-auth.hidden {
    display: none;
}

.splash-auth-card {
    pointer-events: auto;
    width: min(380px, 100%);
}

.splash-auth-card label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

#google-login-btn {
    width: 100%;
    padding: 10px 30px;
    border: none;
    border-radius: 35px;
    background: #007BFF;
    color: #fff;
    font-family: inherit;
    font-weight: 400;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: opacity 0.15s, transform 0.1s;
}

#google-login-btn:hover {
    opacity: 0.9;
    transform: scale(1.01);
}

#google-login-btn:active {
    transform: scale(0.98);
    opacity: 0.85;
}

.splash-auth-error {
    margin-top: 10px;
    font-size: 13px;
    color: #dc2626;
    min-height: 1.2em;
}

/* ===== FOG OVERLAY ===== */
#fog-overlay {
    position: fixed;
    inset: 0;
    z-index: 15;
    background: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease;
}

/* ===== PANTALLA DE ATERRIZAJE (Tareas, tras la bienvenida) ===== */
#tasks-screen {
    opacity: 0;
    transition: opacity 0.6s ease;
}

#tasks-screen.visible {
    opacity: 1;
}

#overview-img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== CHAT PANEL ===== */
#chat-panel {
position: fixed;
    bottom: 40px;
    right: 35px;
    width: 340px;
    height: 460px;
    background: var(--cat-bg);
    color: var(--cat-fg);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    z-index: 100;
    opacity: 0;
    transform: translateY(18px);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

#chat-panel.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

#chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    padding-bottom: 14px;
    padding-left: 18px;
}

/* ===== CHAT ARRASTRABLE (escritorio) ===== */
@media (min-width: 641px) {
    #chat-header { cursor: grab; touch-action: none; }
    #chat-header:active { cursor: grabbing; }
    #close-chat-btn { cursor: pointer; }
    #main-bubble-btn { touch-action: none; }
}
body.chat-dragging { user-select: none; cursor: grabbing !important; }
#chat-panel.dragging,
#chat-bubble-container.dragging { transition: none !important; }

#chat-title {
  font-size: 16px;
    font-weight: 600;
    color: var(--cat-fg);
    letter-spacing: -0.01em;
    height: 0px;
}

#close-chat-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

#close-chat-btn:hover {
    background: var(--bg-surface);
    color: var(--text);
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-right: 51px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 2px;
}

.message {
    max-width: 80%;
    padding: 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.2;
    word-break: break-word;
    position: relative;
    user-select: text;
}

.msg-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    opacity: 1;
    pointer-events: none;
    gap: 8px;
}
.bot-message .msg-actions { flex-direction: row-reverse; }

.msg-time {
    font-size: 10px;
    opacity: 0.45;
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
}

.msg-btns {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.message:hover .msg-btns {
    opacity: 1;
    pointer-events: all;
}

.msg-action-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0px 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
    color: inherit;
    opacity: 0.5;
}
.msg-action-btn:hover { background: rgba(0,0,0,0.08); opacity: 1; }
.user-message .msg-action-btn:hover { background: rgba(255,255,255,0.15); }
.msg-action-btn svg { display: block; }

.msg-selected {
    opacity: 0.55;
    outline: 2px solid #e53e3e44;
    border-radius: 12px;
}

.msg-delete-btn {
    position: fixed;
    background: #e53e3e;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 5px 16px;
    font-size: 12px;
    cursor: pointer;
    z-index: 9999;
    white-space: nowrap;
    animation: fadeInUp 0.15s ease;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.msg-delete-btn:hover { background: #c53030; }

.msg-delete-dismiss {
    position: fixed;
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 6px;
    z-index: 9999;
    line-height: 1;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.message strong { font-weight: 600; }
.message em { font-style: italic; }
.message code {
    background: rgba(0,0,0,0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 13px;
}
.user-message code { background: rgba(255,255,255,0.2); color: #fff; }
.message ul, .message ol { margin: 4px 0; padding-left: 20px; }
.message li { margin: 2px 0; margin-left: 8px;}
.message p { margin: 0; }
.message p + p { margin-top: 6px; }

.bot-message {
    background: var(--bg-surface);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.user-message {
    background: var(--text);
    color: var(--bg-app);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
}

.thinking-indicator span {
    width: 7px;
    height: 7px;
    background: #888;
    border-radius: 50%;
    animation: thinking-bounce 1s infinite;
}

.thinking-indicator span:nth-child(2) { animation-delay: 0.15s; }
.thinking-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinking-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

#hadron-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #111;
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
}

#hadron-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.file-message {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #444;
    background: #f8f8f8;
    border: 1px solid #e8e8e8;
    padding: 8px 14px;
    border-radius: 14px;
    align-self: flex-end;
    max-width: 82%;
}

.file-message span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

#chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    overflow: visible;
}

#chat-text-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 9px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--bg-surface);
    color: var(--text);
    transition: border-color 0.2s, background 0.2s;
    resize: none;
    overflow-y: hidden;
    line-height: 1.45;
    max-height: calc(1.45em * 2 + 18px);
    display: block;
}

#chat-text-input:focus {
    border-color: var(--text);
    background: var(--bg-app);
}

#chat-text-input::placeholder {
    color: #bbb;
}

#send-btn {
    position: absolute;
    right: 0px;
    bottom: 4px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #111;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
    z-index: 3;
}

#send-btn:hover {
    background: #333;
}

#send-btn:active {
    transform: scale(0.92);
}

/* ===== CHAT BUBBLE CONTAINER ===== */
#chat-bubble-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 64px;
    height: 64px;
    z-index: 100;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

#chat-bubble-container.ready {
    visibility: visible;
    opacity: 1;
    pointer-events: all;
    transition: opacity 0.25s ease;
}

#chat-bubble-container.hidden {
    opacity: 0;
    pointer-events: none;
}

/* CTA "Mejora tu plan" dentro del mensaje de límite alcanzado */
.chat-upgrade-cta {
    display: inline-block;
    margin-top: 10px;
    padding: 9px 14px;
    border: none;
    border-radius: 14px;
    background: var(--accent, #1d72f3);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}

.chat-upgrade-cta:hover {
    filter: brightness(1.08);
}

.chat-upgrade-cta:active {
    transform: scale(0.97);
}

/* Avisos: solo la entidad (tarea/proyecto/pago) es un enlace clickeable */
.notice-entity {
    color: var(--accent, #1d72f3);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.notice-entity:hover {
    filter: brightness(1.12);
}

/* Resaltado de la tarea/pago al navegar desde un aviso */
@keyframes entity-focus-flash {
    0%   { box-shadow: 0 0 0 2px var(--accent, #1d72f3), 0 0 14px rgba(29, 114, 243, 0.55); }
    70%  { box-shadow: 0 0 0 2px var(--accent, #1d72f3), 0 0 14px rgba(29, 114, 243, 0.30); }
    100% { box-shadow: 0 0 0 0 rgba(29, 114, 243, 0); }
}

.entity-focus-flash {
    animation: entity-focus-flash 1.9s ease-out;
}

/* ===== MAIN BUBBLE BUTTON ===== */
#main-bubble-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 64px;
    height: 64px;
    border-radius: 32px 32px 32px 0px;
    background: var(--panel-bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    transition: background 0.25s, transform 0.25s, box-shadow 0.25s, opacity 0.2s, width 0.25s, height 0.25s, border-radius 0.25s;
}

#main-bubble-btn svg {
    width: 32px;
    height: 32px;
}

/* ===== CAT ICON ===== */
.cat-icon {
    display: block;
}

#main-bubble-btn svg.cat-icon {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
}

.cat-icon-sm {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

#main-bubble-btn:hover {
    background: #2a2a2a;
    transform: scale(1.00);
}

#main-bubble-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.75);
}

#main-bubble-btn.opening {
    width: 320px;
    height: 420px;
    border-radius: 20px;
    background: #ffffff;
}

#main-bubble-btn.opening svg {
    opacity: 0;
}

/* ===== OPTION BUTTONS ===== */
#bubble-options {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 38px;
    height: 38px;
    pointer-events: none;
}

.chat-actions {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    overflow: visible;
}

.opt-btn {
    position: absolute;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #888;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s;
}

.opt-btn:hover {
    background: #2a2a2a;
}

/* Posiciones de cada botón (relativas a la esquina inferior-derecha del contenedor) */
#opt-mic {
    bottom: 64px;
    right: 0;
}

#opt-camera {
    bottom: 101px;
    right: 0;
}

#opt-doc {
    bottom: 138px;
    right: 0;
}

/* Estado visible con entrada escalonada */
.opt-btn.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

#opt-mic.visible    { transition-delay: 0.00s; }
#opt-camera.visible { transition-delay: 0.06s; }
#opt-doc.visible    { transition-delay: 0.12s; }

/* Tooltips */
.opt-btn::after {
    content: attr(aria-label);
    position: absolute;
    right: 52px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 11px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.opt-btn:hover::after {
    opacity: 1;
}

/* Image preview strip */
#chat-image-preview {
    padding: 8px 14px 4px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.image-preview-thumb {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.image-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.image-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

/* Recording state */
#opt-mic.recording {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
    transform-origin: center;
    transition: transform 0.05s linear;
}

/* ===== HIDDEN FILE INPUTS ===== */
#file-camera,
#file-doc {
    display: none;
}

/* ===== APP LAYOUT ===== */
.app-screen {
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

.hidden-screen {
    display: none;
}

.page-label,
.section-label {
    color: #8d8d8d;
    font-size: 14px;
    margin: 12px 20px;
}

.overview-content,
.finance-layout {
    position: relative;
    background: var(--bg-app);
    display: grid;
    grid-template-columns: 230px 1fr 1fr 48px;
    gap: 48px;
    height: 100vh;
    overflow: hidden;
}

.finance-layout {
    grid-template-columns: 230px 1fr 65px;
    align-items: stretch;
}

.sidebar {
    background: var(--panel-bg);
    padding: 64px 32px 32px 64px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.user-block {
    margin-bottom: 40px;
}

.user-name {
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    color: var(--panel-fg);
    margin-bottom: 3px;
}

.user-date {
    font-size: 16px;
    font-weight: 300;
    color: var(--panel-fg);
    line-height: 1;
    margin-bottom: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    color: var(--panel-fg);
    text-decoration: none;
    font-size: 20px;
    font-weight: 200
    ;
}

.nav-item.soon {
    opacity: 0.45;
}

.nav-item:not(.soon) + .nav-item.soon {
    margin-top: 10px;
}

.nav-item.active {
    color: var(--accent);
}

.section-title {
    font-size: 35px;
    font-weight: 500;
    line-height: 1;
    color: var(--text);
    margin-bottom: 8px;
}

.section-sub {
    color: var(--text-subtle);
    font-size: 16px;
    font-weight: 100;
    line-height: 1.2;
    margin-bottom: 15px;
}

.content-section {
    margin-bottom: 20px;
}

.col {
    min-height: 0;
    overflow: hidden;
    padding-top: 64px;
}

.item-list,
.task-list,
.finance-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-list {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 6px;
}

.list-item,
.task-item,
.finance-row {
    background: var(--bg-surface);
    border-radius: 20px;
    min-height: 34px;
    padding: 8px 17px;
    font-size: 20px;
    font-weight: 200;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 15px;
}

.task-item {
    justify-content: space-between;
}

.task-name {
    flex: 1;
}

.task-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.task-dot.small {
    width: 8px;
    height: 8px;
}

.green { background: #22c55e; }
.blue { background: #3b82f6; }
.grey { background: #d4d4d4; }

.task-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #333;
}

.finance-net-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.finance-net-row .finance-amount {
    margin-bottom: 0;
}

.finance-hide-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted, #888);
    padding: 4px;
    display: flex;
    align-items: center;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.finance-hide-btn:hover {
    opacity: 1;
}

.finance-amount {
    font-size: 35px;
    font-weight: 500;
    line-height: 1;
    color: var(--text);
    margin-bottom: 8px;
}

.finance-value {
    font-weight: 400;
}

.finance-period {
    margin-left: auto;
    color: #444;
    font-size: 14px;
    font-family: 'Helvetica Now Display';
    font-weight: 500;
}

.habit-days,
.habit-dots {
    display: inline-flex;
    gap: 6px;
}

.hdot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ececec;
}

.hdot.filled {
    background: #111;
}

.right-icons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-self: start;
}

.icon-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    position: relative;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn svg {
    width: 26px;
    height: 26px;
}

.settings-btn svg {
    width: 26px;
    height: 26px;
}

.right-icons {
    padding-top: 70px;
}

/* ===== BOTÓN CERRAR SESIÓN (en la fila de acciones de Configuración) ===== */
/* Usa la base .btn-secondary; aquí solo el color rojo sólido, a la misma
   altura/jerarquía que Cancelar/Guardar. */
.config-logout-btn {
    background: #ef4444;
    color: white;
}

.config-logout-btn:hover {
    background: #dc2626;
}

/* ===== FINANCE ===== */
.finance-label {
    margin-top: 10px;
}

.finance-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 0;
    overflow: hidden;
    padding-top: 64px;
    padding-bottom: 24px;
}

.finance-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px;
}

.finance-card {
    background: var(--bg-app);
    padding: 0;
}

.budget-bar {
    width: 100%;
    height: 20px;
    border-radius: 10px;
    background: var(--bg-surface);
    overflow: hidden;
}

.budget-progress {
    display: block;
    width: 0%;
    height: 100%;
    background: #06D110;
    border-radius: 18px;
    transition: width 0.35s ease, background 0.5s ease;
}

.budget-progress.warning {
    background: #f97316;
}

.budget-progress.danger {
    background: #ef4444;
}

/* ===== PRESUPUESTO: monto editable + línea de alerta arrastrable ===== */
.budget-bar-wrap {
    position: relative;
    width: 100%;
    margin: 14px 0 6px;
}

.budget-amount {
    cursor: pointer;
    border-bottom: 1px dashed currentColor;
    font-weight: 600;
}

.budget-amount:hover {
    opacity: 0.75;
}

.budget-amount-empty {
    color: var(--accent, #1d72f3);
    border-bottom-color: var(--accent, #1d72f3);
}

.budget-amount-input {
    width: 120px;
    font: inherit;
    padding: 2px 8px;
    border: 1px solid var(--accent, #1d72f3);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text);
}

/* Línea vertical de umbral de alerta, sobresale un poco de la barra */
.budget-alert-line {
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: 80%;
    width: 3px;
    margin-left: -1.5px;
    padding: 0;
    border: none;
    background: var(--text);
    border-radius: 2px;
    cursor: ew-resize;
    touch-action: none;
    z-index: 3;
}

.budget-alert-line::before {
    /* área de agarre ampliada para mouse/touch */
    content: '';
    position: absolute;
    inset: -8px -9px;
}

.budget-alert-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 9px;
    padding: 2px 7px;
    background: var(--text);
    color: var(--bg-app);
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.budget-alert-line:hover .budget-alert-label,
.budget-alert-line.dragging .budget-alert-label {
    opacity: 1;
}

/* Selector de tema */
.theme-picker {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.theme-swatch {
    flex: 1 1 0;
    min-width: 0;
    background: transparent;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: border-color 0.15s, transform 0.1s;
}

.theme-swatch:hover {
    border-color: #888;
}

.theme-swatch.active {
    border-color: #fff;
}

.theme-swatch-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #111;
    display: block;
}

.theme-swatch-label {
    font-size: 11px;
    color: #ccc;
    letter-spacing: 0.02em;
}

/* Slider de alerta en config modal */
.budget-meta {
    margin-top: 7px;
    display: flex;
    justify-content: space-between;
    color: var(--text);
    font-size: 15px;
    font-weight: 400;
}

.payments-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    margin-top: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.payments-list {
    gap: 12px;
}

.payment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0px 16px;
    background: var(--bg-surface);
    border-radius: 18px;
    min-height: 36px;
    transition: opacity 0.33s;
}

.payment-row.paid {
    opacity: 0.4;
}

.payment-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    opacity: 0.25;
    transition: opacity 0.2s;
}

.payment-row:hover .payment-toggle,
.payment-row.paid .payment-toggle {
    opacity: 1;
}

.payment-name {
    flex: 1;
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payment-row.paid .payment-name {
    text-decoration: line-through;
    color: #aaa;
}

.payment-row.overdue .payment-name {
    color: #fb0000;
}

.payment-amount {
    font-size: 14px;
    font-weight: bold;
    color: var(--text);
    flex-shrink: 0;
}

.payment-overdue-badge {
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ff3b30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.finance-movements {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.finance-movements-title {
    font-size: 35px;
    font-weight: 500;
    line-height: 1;
}

.chips-strip-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.chips-scroll-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}

.chips-scroll-btn:hover {
    background: var(--bg-surface-hover);
}

.finance-filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 22px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    min-width: 0;
    flex: 1;
}

.finance-filters::-webkit-scrollbar { display: none; }

.chips-strip-wrap.finance-chips-wrap {
    margin-bottom: 22px;
}

.chips-strip-wrap.finance-chips-wrap .finance-filters {
    margin-bottom: 0;
}

.chip {
    border: none;
    background: var(--bg-surface);
    color: var(--text);
    border-radius: 20px;
    height: 32px;
    padding: 2px 15px;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.chip.active {
    background: var(--text);
    color: var(--bg-app);
}

.chip-add {
    width: 36px;
    padding: 0;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    border: 1.5px dashed var(--border);
    transition: color 0.15s, border-color 0.15s;
}

.chip-add:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.chip-add.editing {
    width: auto;
    padding: 0 22px;
    background: var(--bg-surface);
    border: none;
    color: var(--text);
}

.movements-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.movements-table th:nth-child(1),
.movements-table td:nth-child(1) {
    width: 50%;
}

.movements-table th:nth-child(2),
.movements-table td:nth-child(2) {
    width: 15%;
}

.movements-table th:nth-child(3),
.movements-table td:nth-child(3) {
    width: 8%;
}

.movements-table th:nth-child(4),
.movements-table td:nth-child(4) {
    width: 10%;
}

.movements-table th:nth-child(5),
.movements-table td:nth-child(5) {
    width: 8%;
    text-align: center;
}

.movements-table-wrap {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0px;
}

.movements-table th,
.movements-table td {
    text-align: left;
    padding: 9px 12px;
}

.movements-table th {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-surface);
}

.movements-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.movements-table th[data-sort]::after {
    content: '↕';
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    opacity: 0.35;
}

.movements-table th[data-sort].sort-asc::after {
    content: '▲';
    opacity: 1;
}

.movements-table th[data-sort].sort-desc::after {
    content: '▼';
    opacity: 1;
}

.movements-table td {
    color: var(--text);
    font-size: 16px;
    font-weight: 400;
    border-bottom: none;
}

.movements-table .pos {
    color: #06D110;
    font-weight: 400;
}

.movements-table .neg {
    color: #ff0d00;
    font-weight: 500;
}

.movement-delete-cell {
    padding: 4px 0 !important;
}

.movement-delete-btn {
    background: none;
    border: none;
    color: #bbb;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.movement-delete-btn:hover {
    color: #ef4444;
}

/* ===== MOVEMENT NEW ROW ===== */
.movement-new-tbody {
    position: sticky;
    top: 38px;
    z-index: 1;
    background: var(--bg-surface);
}

.movement-new-row td {
    padding: 8px 4px;
    border-bottom: 1px solid #ececec;
}

/* ===== PREV-MONTH SECTION ===== */
#prev-month-tfoot td,
.prev-month-section-header td {
    padding: 0;
}

.prev-month-load-btn,
.prev-month-section-btn {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted, #888);
    font-size: 12px;
    padding: 12px 9px;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: left;
    gap: 6px;
    font-weight: 600;
}

.prev-month-load-btn:hover,
.prev-month-section-btn:hover {

}

.prev-month-section-rows td {
    opacity: 0.75;
}

.prev-month-month-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #888);
    padding: 6px 4px 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-top: 1px solid var(--border, #e5e5e5);
}

.movement-new-input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    padding: 2px 8px;
}

.movement-new-input::placeholder {
    color: var(--text-muted);
}

.movement-new-amount {
    text-align: left;
    transition: color 0.15s ease;
}

.movement-new-amount.neg {
    color: #FF3B30;
}

.movement-new-amount.pos {
    color: #06D110;
}

.movement-new-cat-wrap {
    position: relative;
}

.movement-new-cat-btn {
    width: 100%;
    background: transparent;
    border: none;
    padding: 2px 0;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-align: left;
}

.movement-new-cat-btn svg {
    color: #888;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.movement-new-cat-btn.open svg {
    transform: rotate(180deg);
}

.movement-new-cat-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: bold;
    font-size: 14px;
}

.movement-new-cat-label.placeholder {
    color: var(--text-muted);
}

.movement-new-cat-menu {
    position: fixed;
    z-index: 9000;
    min-width: 100px;
    max-height: 161px;
    overflow-y: auto;
    background: var(--bg-app);
    padding: 8px 0;
    padding-right: 28px;
}

.movement-new-cat-option {
    display: block;
    width: 100%;
    padding: 4px 10px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.movement-new-cat-option:hover {
    background: var(--bg-surface);
}

.movement-new-cat-empty {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.movement-new-cat-sep {

}

.movement-new-cat-new {
    font-weight: 600;
    color: var(--accent, #3b82f6);
}

.movement-new-cat-input {
    display: block;
    width: calc(100% - 16px);
    margin: 4px 8px;
    padding: 6px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--accent, #3b82f6);
    border-radius: 6px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    outline: none;
    box-sizing: border-box;
}

.movement-new-date-pill,
.movement-date-pill {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    padding: 4px 10px;
}

.movement-new-date-pill input[type="date"],
.movement-date-pill input[type="date"] {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    padding: 0;
    width: 140px;
}

.movement-new-add-btn {
    background: #000;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, opacity 0.15s ease;
    padding: 0;
}

.movement-new-add-btn:hover {
    background: #333;
}

.movement-new-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== INLINE EDIT EN MOVIMIENTOS GUARDADOS ===== */
.movement-edit-input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
    padding: 0;
}

.movements-table tbody#movements-tbody td {
    cursor: text;
}

.movements-table tbody#movements-tbody td.movement-delete-cell {
    cursor: default;
}

.movement-cell-editable {
    border-radius: 4px;
    transition: background 0.12s ease;
    position: relative;
}

.movement-cell-editable:hover {
    background: var(--bg-surface-hover);
}

/* ===== TASKS LAYOUT ===== */
.tasks-layout {
    position: relative;
    background: var(--bg-app);
    display: grid;
    grid-template-columns: 230px 1fr 65px;
    height: 100vh;
    overflow: hidden;
}

.tasks-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding-top: 64px;
    padding-left: 48px;
    padding-right: 16px;
}

.tasks-header {
    margin-bottom: 24px;
    flex-shrink: 0;
}

.tasks-page-title {
    font-size: 40px;
    font-weight: 500;
    line-height: 1;
    margin-bottom: 15px;
}

.area-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    min-width: 0;
    flex: 1;
}

.area-chips::-webkit-scrollbar { display: none; }

.tasks-content {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 40px;
    overflow: hidden;
}

.tasks-right {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 32px;
    overflow: hidden;
}

.tasks-body {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Fija la altura de las filas del grid al contenedor (no al contenido) para que
   las columnas hagan scroll interno de forma consistente en TODOS los navegadores.
   Sin esto, navegadores que no respetan min-height:0 hacen crecer la fila auto
   hasta el contenido y, con overflow:hidden del ancestro, el contenido se corta
   SIN scroll. Mismo bug latente en las pantallas grid a 100vh (tareas, finanzas,
   overview, soon). Solo escritorio: en móvil (≤640px) el layout pasa a flujo vertical. */
@media (min-width: 641px) {
    .tasks-layout,
    .finance-layout,
    .overview-content,
    .soon-layout { grid-template-rows: minmax(0, 1fr); }

    .tasks-body { grid-template-rows: minmax(0, 1fr); }
}

.today-route-wrapper {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow: hidden;
    width: 320px;
    flex-shrink: 0;
}

.today-route-header {
    flex-shrink: 0;
}

.today-route-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    background: var(--accent, #1d72f3);
    color: #fff;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 300;
    cursor: default;
    text-align: center;
    letter-spacing: 0.01em;
}

.today-route-sub {
   font-size: 20px;
    color: var(--text-muted);
    margin-top: 14px;
    text-align: center;
}

.today-route-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

.today-payment-icon {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tasks-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    overflow: hidden;
}

.tasks-list-col {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}

.tasks-detail-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.tasks-detail-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.quick-add-panel.quick-add-detail {
    display: none;
}

.quick-add-detail {
    flex-shrink: 0;
    justify-content: center;
    min-height: 40px;
}

.quick-add-detail.visible {
    display: flex;
    margin-bottom: 12px;
}

.quick-add-detail .quick-add-circle {

}

.quick-add-detail.activated {
    justify-content: flex-start;
}

.quick-add-detail.activated .quick-add-circle {
    margin: 0;
}

/* ===== QUICK-ADD PANEL ===== */
.quick-add-panel.hidden {
    display: none;
}

.quick-add-panel {
   flex-shrink: 0;
    padding: 14px 14px;
    max-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    overflow: hidden;
}

.quick-add-circle {
    width: 25px;
    height: 25px;
    border-radius: 40%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    opacity: 1;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.25s ease, color 0.15s;
}

/* Dashed ring — rotates independently during save */
.quick-add-circle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px dashed #ccc;
    transition: border-color 0.15s;
    pointer-events: none;
}

/* Plus sign — stays fixed, never rotates */
.quick-add-circle::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(currentColor, currentColor) center / 2px 10px no-repeat,
        linear-gradient(currentColor, currentColor) center / 10px 2px no-repeat;
    pointer-events: none;
}

.quick-add-circle:hover {
    opacity: 0.8;
}

.quick-add-circle:hover::before {
    border-color: #999;
}

.quick-add-circle.qa-project {
    color: #60a5fa;
}

.quick-add-circle.qa-project::before {
    border-color: #60a5fa;
}

.quick-add-circle.qa-task {
   
}

.quick-add-circle.qa-task::before {
    border-color: #111;
}

[data-theme="dark"] .quick-add-circle.qa-task {
    color: #9aa0a6;
}

[data-theme="dark"] .quick-add-circle.qa-task::before {
    border-color: #9aa0a6;
}

.quick-add-circle.fade-out {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

.quick-add-circle.selected {
    opacity: 1;
}

/* Spinning — only the dashed ring rotates, + stays still */
@keyframes qa-spin-border {
    to { transform: rotate(360deg); }
}

.quick-add-circle.spinning {
    opacity: 1;
}

.quick-add-circle.spinning::before {
    animation: qa-spin-border 1.6s linear infinite;
}

/* ===== QUICK-ADD INPUT ===== */
.quick-add-input {
    display: none;
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    min-width: 0;
}

.quick-add-panel.activated {
    justify-content: flex-start;
    gap: 10px;
}

.quick-add-input::placeholder {
    color: #999;
}

/* ===== INLINE EDIT ===== */
.inline-edit-input {
    font: inherit;
    font-size: 16px;
    color: inherit;
    border: none;
    border-bottom: 2px solid #3b82f6;
    background: rgba(59, 130, 246, 0.06);
    outline: none;
    width: 100%;
    padding: 1px 4px;
    margin: -1px 0;
    border-radius: 3px;
}

.chip .inline-edit-input {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text);
    min-width: 60px;
}

/* ===== ORPHAN SECTION TITLE ===== */
.orphan-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #888;
    padding: 12px 14px 4px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* ===== COMPLETED SECTION (colapsable) ===== */
.completed-section {
    margin-top: 12px;
}

.completed-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.completed-section-header:hover {
    background: var(--bg-surface-hover);
}

.completed-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.completed-chevron.open {
    transform: rotate(180deg);
}

.completed-section-label {
    font-size: 16px;
    color: var(--text);
    flex: 1;
}

.completed-section-badge {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-app);
    border-radius: 10px;
    padding: 2px 10px;
    min-width: 24px;
    text-align: center;
}

.completed-section-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-left: 0;
}

/* ===== DETAIL COMPLETED DIVIDER ===== */
.detail-completed-header {
    display: flex;
    align-items: center;
    gap: 2px;
    border-radius: 15px;
    padding: 10px 30%;
    cursor: pointer;
    transition: background 0.4s;
    -webkit-tap-highlight-color: transparent;
    margin-top: -16px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.detail-completed-header:hover {
}

.detail-completed-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.detail-completed-chevron.open {
    transform: rotate(180deg);
}

.detail-completed-label {
    font-size: 12px;
    color: var(--text);
    flex: 1;
}

.detail-completed-badge {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-app);
    border-radius: 10px;
    padding: 2px 10px;
    min-width: 24px;
    text-align: center;
}

/* Tareas completadas colapsables (con animación) */
.completed-tasks-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    max-height: 4000px;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease, padding 0.25s ease;
    margin-top: 4px;
    min-width: 0;
}

.completed-collapsed .completed-tasks-wrap {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

/* ===== LIST COMPLETED DIVIDER ===== */
.list-completed-divider {
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 20px;
    padding: 10px 90px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    margin-top: 10px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.list-completed-divider:hover {
}

.list-completed-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.list-completed-chevron.open {
    transform: rotate(180deg);
}

.list-completed-label {
    font-size: 12px;
    color: var(--text);
    flex: 1;
}

.list-completed-badge {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-app);
    border-radius: 10px;
    padding: 2px 10px;
    min-width: 24px;
    text-align: center;
}

/* Terminados colapsables (con animación). Expandido tiene SU PROPIO scroll
   (overflow-y:auto) con alto acotado a viewport, para que los proyectos/tareas
   terminados sean siempre alcanzables aunque haya muchos. Los activos scrollean
   aparte vía la columna (.tasks-list-col). Antes: max-height:100px + overflow
   hidden → recortaba los terminados sin scroll. */
.completed-items-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 35vh;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease, padding 0.25s ease;
    margin-top: 4px;
    flex-shrink: 1;
    min-height: 0;
}

.list-completed-collapsed .completed-items-wrap {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ===== PROJECT ROW ===== */
.project-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border-radius: 15px;
    padding: 9px 10px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.project-row:hover {
    background: var(--bg-surface-hover);
}

.project-row.active {
    background: var(--bg-surface-hover);
}

.project-row-name {
    font-size: 16px;
    color: var(--text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== PROGRESS RING (PIE CHART) ===== */
.progress-ring {
    flex-shrink: 0;
}

.progress-ring .progress-fill {
    transition: opacity 0.4s ease;
}

/* ===== DRAG AND DROP ===== */
.task-drag-handle {
    position: absolute;
    right: 0;
    top: 0;
    width: 32px;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.task-drag-handle:active {
    cursor: grabbing;
}

.task-row.task-dragging {
    opacity: 0.4;
}

.task-row.task-drop-above {
    box-shadow: 0 -2px 0 0 var(--accent, #3b82f6);
}

.task-row.task-drop-below {
    box-shadow: 0 2px 0 0 var(--accent, #3b82f6);
}

/* ===== TASK ROW ===== */
.task-row {
        position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    background: var(--bg-surface);
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.15s, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 0px;
    font-size: 20px;
    font-weight: lighter;

}

.task-row:hover {
    background: var(--bg-surface-hover);
}

.task-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    background: transparent;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    padding: 0;
}

.task-circle.completed {
    background: var(--text);
    border-color: var(--text);
}

@keyframes task-circle-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.45); }
    100% { transform: scale(1); }
}

.task-circle.pop {
    animation: task-circle-pop 0.58s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.task-row-name {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
    flex: 1;
}

.task-row-name.done {
    color: #aaa;
    text-decoration: line-through;
}

.task-duration {
    font-size: 12px;
    font-weight: bold;
    color: var(--text);
    flex-shrink: 0;
}

.task-date {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

.project-duration {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

.task-note-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 2px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}


.due-alert {
       font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ef4444;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ===== TASK DETAIL ===== */
.tasks-detail {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap:6px;
}

.detail-project-name {
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: var(--text);
    flex-shrink: 0;
}

.detail-project-note {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.5;
    background: none;
    border: none;
    padding: 0px;
    width: 100%;
    resize: none;
    font-family: inherit;
    outline: none;
    overflow: hidden;
    display: block;
    box-sizing: border-box;
}

.detail-project-note:focus {
    color: var(--text);
}

.detail-project-note::placeholder {
    color: var(--text-subtle);
    opacity: 1;
}

/* ===== PROYECTO TERMINADO (todas las tareas cerradas) ===== */
.project-done-alert {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 24px;
    margin-bottom: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    animation: project-done-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.project-done-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 197, 94, 0.14);
    color: #22c55e;
    margin-bottom: 4px;
}

.project-done-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.project-done-sub {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.4;
}

@keyframes project-done-pop {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== TASK NOTE AREA ===== */
.task-note-area {
    width: 100%;
    grid-column: 1 / -1;
    background: var(--bg-surface);
    color: var(--text);
    border-radius: 5px;
    padding: 10px 8px;
    position: relative;
    flex-shrink: 0;
    animation: noteSlideIn 0.40s ease;
    overflow: hidden;
}

.task-note-area.closing {
    animation: noteSlideOut 0.2s ease forwards;
}

@keyframes noteSlideIn {
    from { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
    to { opacity: 1; max-height: 300px; padding-top: 9px; padding-bottom: 9px; }
}

@keyframes noteSlideOut {
    from { opacity: 1; max-height: 300px; padding-top: 9px; padding-bottom: 9px; }
    to { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
}

.task-note-area .note-close-btn {
   position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    transition: opacity 0.2s;
}

.task-note-area .note-close-btn:hover {
    opacity: 0.7;
}

.task-note-area .task-note-title {
    width: 94%;
    margin: 0 0 8px;
    padding-right: 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    opacity: 0.75;
    white-space: normal;
    word-break: break-word;
}

.task-note-area textarea {
    width: 94%;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 10px 12px;
    margin-top: 0px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    background: var(--bg-app);
    color: var(--text);
    transition: border-color 0.2s;
}

.task-note-area textarea:focus {
    border-color: var(--accent);
    background: var(--bg-app);
}

/* ===== TASK NOTE DISPLAY (READ-ONLY) ===== */
.task-note-display {
    width: 90%;
    padding: 11px;
    padding-top: 2px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    white-space: pre-wrap;
    cursor: pointer;
    user-select: none;
}

/* ===== NOTE META (DATE + DURATION) ===== */
.note-meta {
    display: flex;
    gap: 5px;
    margin-top: 0px;
}

.note-meta-item {
    font-size: 14px;
    color: var(--text);
    background: var(--bg-app);
    padding: 3px 10px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.note-meta-item:hover {
    opacity: 0.8;
}

/* ===== MOBILE HEADER (oculto en desktop) ===== */
.mobile-header {
    display: none;
    padding: 18px 12px;
}

.mobile-greeting {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.mobile-header-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== MOBILE BOTTOM NAV ===== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--m-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 200;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-subtle);
    font-size: 9px;
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: color 0.18s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item span {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-nav-item svg {
    transition: transform 0.18s;
    stroke-width: 1.75;
    flex-shrink: 0;
}

.mobile-nav-item.active {
    color: var(--text);
}

.mobile-nav-item.active svg {
    transform: scale(1.08);
}

/* ===== SOON SCREEN ===== */
.soon-layout {
    position: relative;
    background: var(--bg-app);
    display: grid;
    grid-template-columns: 230px 1fr 48px;
    gap: 48px;
    height: 100vh;
    overflow: hidden;
}

.soon-content {
    display: flex;
    flex-direction: column;
    justify-content: start;
    min-height: 0;
    padding-top: 64px;
}

.soon-tag {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    margin-bottom: 10px;
}

.soon-title {
    font-size: 40px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 12px;
}

.soon-sub {
    font-size: 15px;
    color: var(--text-muted);
}

/* ===== LAPTOP / VENTANA MEDIANA (≤ 1080px) ===== */
/* Mantiene el layout PC pero comprime espacios, paneles y tipografía
   para que no se desborde ni quede apretado en pantallas chicas. */
@media (max-width: 1080px) {
    .sidebar {
        padding: 40px 20px 24px 32px;
    }

    .overview-content {
        grid-template-columns: 168px 1fr 1fr 40px;
        gap: 28px;
    }

    .finance-layout,
    .tasks-layout,
    .soon-layout {
        grid-template-columns: 168px 1fr 52px;
    }

    .finance-layout,
    .soon-layout {
        gap: 28px;
    }

    .user-block {
        margin-bottom: 28px;
    }

    .col,
    .soon-content {
        padding-top: 40px;
    }

    .finance-main {
        padding-top: 40px;
        gap: 18px;
    }

    .finance-top {
        gap: 20px;
    }

    .tasks-main {
        padding-top: 40px;
        padding-left: 28px;
    }

    .tasks-header {
        margin-bottom: 18px;
    }

    .tasks-content {
        gap: 28px;
    }

    .tasks-body {
        grid-template-columns: 240px 1fr;
        gap: 20px;
    }

    .today-route-wrapper {
        width: 240px;
    }

    /* Tipografía: titulares más contenidos */
    .section-title,
    .finance-movements-title {
        font-size: 26px;
    }

    .finance-amount {
        font-size: 28px;
    }

    .tasks-page-title,
    .soon-title {
        font-size: 30px;
    }

    .today-route-btn {
        font-size: 18px;
    }

    .today-route-sub {
        font-size: 16px;
    }

    .list-item,
    .task-item,
    .finance-row {
        font-size: 17px;
    }

    .nav-item {
        font-size: 16px;
    }

    .chip {
        font-size: 14px;
        height: 30px;
    }
}

/* ===== VENTANA PC ESTRECHA (≤ 900px) ===== */
/* Por debajo de esto el panel de 3 columnas de Tareas no cabe:
   se oculta la "Ruta de hoy" (panel auxiliar de pantallas grandes). */
@media (max-width: 900px) {
    .today-route-wrapper {
        display: none;
    }

    .tasks-body {
        grid-template-columns: 220px 1fr;
    }

    .overview-content {
        gap: 22px;
    }

    .section-title,
    .finance-movements-title {
        font-size: 23px;
    }

    .tasks-page-title,
    .soon-title {
        font-size: 26px;
    }
}

/* ===== MOBILE (≤ 640px) ===== */
@media (max-width: 640px) {
    body {
        background: var(--m-bg);
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Splash */
    #splash-screen {
        flex-direction: column;
    }

    #splash-left {
        flex: 0 0 auto;
        padding: 48px 32px 36px;
        order: 2;
    }

    #splash-right {
        flex: 0 0 45svh;
        order: 1;
    }

    #splash-title {
        font-size: 28px;
    }

    #splash-subtitle {
        font-size: 14px;
    }

    /* Screens */
    .app-screen {
        height: auto;
        min-height: 100svh;
        overflow: visible;
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    /* Mobile header visible */
    .mobile-header {
        display: block;
    }

    /* Grid → sin grid, scroll libre */
    .overview-content,
    .finance-layout {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        background: var(--m-bg);
        height: auto;
        min-height: 100svh;
        overflow: visible;
        padding: 0 14px 16px;
        gap: 8px;
    }

    /* Sidebar oculto en móvil (nav inferior lo reemplaza) */
    .sidebar {
        display: none;
    }

    /* Acciones (config / notificaciones / salir): cluster fijo arriba a la derecha */
    .right-icons {
        display: flex;
        flex-direction: row;
        gap: 6px;
        position: fixed;
        top: calc(env(safe-area-inset-top) + 12px);
        right: 12px;
        padding-top: 0;
        z-index: 150;
    }

    .right-icons .icon-btn {
        width: 38px;
        height: 38px;
        background: var(--m-card);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }

    .right-icons .icon-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Sections como cards iOS */
    .content-section {
        background: var(--m-card);
        border-radius: 16px;
        padding: 14px;
        margin-bottom: 0;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    .finance-card {
        background: var(--m-card);
        border-radius: 14px;
        padding: 14px;
        min-width: 0;
        width: 100%;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    /* Separar las tarjetas apiladas dentro de cada columna del overview */
    .col {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* Desbloquear overflow */
    .col,
    .finance-main,
    .finance-movements,
    .tasks-main,
    .soon-content {
        overflow: visible;
        padding-top: 0;
    }

    .finance-main {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-width: 0;
        gap: 8px;
    }

    .chips-strip-wrap {
        width: 100%;
        min-width: 0;
    }

    .task-list {
        max-height: none;
    }

    .movements-table-wrap {
        max-height: 320px;
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Ajustar columnas en móvil: sin Concepto, Categoría más ancha */
    .movements-table th:nth-child(1),
    .movements-table td:nth-child(1) {
        display: none;
    }
    /* Mantener visible el concepto en la fila de entrada manual */
    .movement-new-tbody td:nth-child(1) {
        display: table-cell;
    }
    .movements-table th:nth-child(2),
    .movements-table td:nth-child(2) {
        width: 38%;
    }
    .movements-table th:nth-child(3),
    .movements-table td:nth-child(3) {
        width: 20%;
    }
    .movements-table th:nth-child(4),
    .movements-table td:nth-child(4) {
        width: 32%;
    }
    .movements-table th:nth-child(5),
    .movements-table td:nth-child(5) {
        width: 10%;
    }

    /* Finance top: stack */
    .finance-top {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-width: 0;
        width: 100%;
    }

    /* Tipografía */
    .section-title {
        font-size: 16px;
        margin-bottom: 2px;
    }

    .finance-movements-title {
        font-size: 16px;
    }

    .section-sub {
        font-size: 12px;
        color: var(--text-muted);
        margin-bottom: 8px;
    }

    .finance-amount {
        font-size: 28px;
    }

    /* Finance row */
    .finance-row {
        border-radius: 12px;
    }

    /* Chat panel → bottom sheet */
    #chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 88svh;
        border-radius: 20px 20px 0 0;
        transform-origin: bottom center;
        opacity: 1;
        transform: translateY(100%);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease;
    }

    #chat-panel.open {
        opacity: 1;
        transform: translateY(0);
        z-index: 210;
    }

    /* Burbuja sobre bottom nav */
    #chat-bubble-container {
        bottom: 76px;
        right: 16px;
    }

    /* Toast sobre bottom nav */
    #hadron-toast {
        bottom: calc(78px + env(safe-area-inset-bottom));
    }

    /* Bottom nav visible */
    .mobile-bottom-nav {
        display: flex;
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Ocultar nav durante splash */
    body.splash-active .mobile-bottom-nav {
        display: none !important;
    }

    /* Chips */
    .chip {
        font-size: 12px;
        padding: 6px 11px;
        height: 28px;
        border-radius: 14px;
        white-space: nowrap;
    }

    .chips-scroll-btn {
        width: 22px;
        height: 22px;
    }

    /* Budget bar */
    .budget-bar {
        height: 8px;
    }

    /* Tasks mobile */
    .tasks-layout {
        display: flex;
        flex-direction: column;
        background: var(--m-bg);
        height: auto;
        min-height: 100svh;
        overflow: visible;
        padding: 0 14px calc(16px + env(safe-area-inset-bottom));
        gap: 0;
    }

    .tasks-content {
        flex-direction: column;
        overflow: visible;
        gap: 16px;
    }

    .tasks-right {
        overflow: visible;
        gap: 12px;
    }

    .tasks-body {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .today-route-wrapper {
        display: none;
    }

    .tasks-list-wrapper {
        gap: 6px;
        overflow: visible;
    }

    .tasks-detail-wrapper {
        width: auto;
        max-width: none;
        overflow: visible;
    }

    .tasks-detail-col {
        display: block;
        min-height: unset;
        overflow: visible;
    }

    .tasks-list-col {
        overflow: visible;
    }

    .task-row {
        min-height: 44px;
    }

    .quick-add-panel {
        min-height: 44px;
    }

    #tasks-detail-panel {
        display: block;
        overflow: visible;
    }

    .tasks-page-title {
        font-size: 22px;
    }

    /* Soon screen mobile */
    .soon-layout {
        display: flex;
        flex-direction: column;
        background: var(--m-bg);
        height: auto;
        min-height: 100svh;
        overflow: visible;
        padding: 0 14px 16px;
        gap: 12px;
    }

    .soon-content {
        background: var(--m-card);
        border-radius: 16px;
        padding: 40px 20px;
        justify-content: flex-start;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    .soon-title {
        font-size: 32px;
    }
}

/* SOON SCREEN: ver estilos en sección "APP LAYOUT", antes de la media query móvil */

/* ===== CONFIG MODAL ===== */
.config-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.config-modal-content {
    background: #2a2a2a;
    color: white;
    border-radius: 16px;
    padding: 24px;
    width: min(400px, 90%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.config-modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.config-modal-content label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 8px;
}

.config-modal-content select {
    background: #1a1a1a;
    border: 1px solid #444;
    color: white;
}

.greeting-editable {
    width: 100%;
    min-height: 20px;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 8px;
    background: #2a2a2a;
    color: white;
    font-size: 14px;
    font-family: inherit;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    outline: none;
}

.greeting-editable:focus {
    border-color: #666;
}

.greeting-editable:empty::before {
    content: attr(data-placeholder);
    color: #888;
}

.greeting-editable .greeting-token {
    display: inline-block;
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border-radius: 5px;
    padding: 1px 6px;
    margin: 0 1px;
    user-select: none;
    white-space: nowrap;
}

.config-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.config-modal-actions .btn-primary,
.config-modal-actions .btn-secondary {
    flex: 1;
}

.btn-primary,
.btn-secondary {
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #444;
    color: white;
}

.btn-secondary:hover {
    background: #555;
}

/* ===== CONFIRM MODAL ===== */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.confirm-modal-content {
    background: #2a2a2a;
    color: white;
    border-radius: 16px;
    padding: 24px;
    width: min(360px, 90%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.confirm-modal-content p {
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 20px 0;
    color: rgba(255, 255, 255, 0.9);
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ===== GATE SCREEN (pricing + promo) ===== */
/* Siempre a pantalla completa, sin sidebar: es una página de checkout/planes,
   no otra vista más del dashboard. */
#gate-screen {
    background: var(--bg-app);
    color: var(--text);
    height: 100vh;
    overflow-y: auto;
    position: relative;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#gate-screen.visible {
    opacity: 1;
}

.gate-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 32px;
}

.gate-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
}

.gate-back-link:hover {
    color: var(--text);
}

.gate-header {
    text-align: center;
    margin-bottom: 48px;
}

.gate-logo {
    font-size: 48px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    margin-bottom: 30px;
}

.gate-tagline {
    font-size: 18px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Pricing Grid */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.pricing-card {
    background: var(--bg-surface);
    color: var(--text);
    border-radius: 20px;
    padding: 28px;
    border: 2px solid transparent;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pricing-card:hover {
    background: var(--bg-surface-hover);
}

.pricing-card.featured {
    border-color: var(--accent);
}

.pricing-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--accent-on);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 16px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.pricing-card-header {
    text-align: center;
    margin-bottom: 24px;
}

.plan-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    margin-bottom: 8px;
}

.plan-currency {
    font-size: 24px;
    font-weight: 500;
    color: var(--text);
}

.plan-amount {
    font-size: 56px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.03em;
}

.plan-period {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 400;
}

.plan-desc {
    font-size: 14px;
    color: var(--text-muted);
}

.plan-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--text);
}

/* Promo Section */
.promo-section {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
}

.promo-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.promo-divider::before,
.promo-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.promo-divider span {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
}

.promo-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.promo-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-size: 16px;
    font-family: 'Helvetica Now Display', -apple-system, sans-serif;
    letter-spacing: 0.04em;
    color: var(--text);
    background: var(--bg-app);
    outline: none;
    transition: border-color 0.2s;
    text-transform: uppercase;
}

.promo-input:focus {
    border-color: var(--text);
}

.promo-input::placeholder {
    letter-spacing: 0.02em;
    color: var(--text-muted);
}

.promo-btn {
    padding: 14px 28px;
    background: var(--text);
    color: var(--bg-app);
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
}

.promo-btn:hover {
    opacity: 0.85;
}

.promo-btn:active {
    transform: scale(0.97);
}

.promo-btn:disabled {
    background: var(--text-subtle);
    cursor: not-allowed;
}

.promo-error {
    color: #ef4444;
    font-size: 14px;
    margin-top: 12px;
    min-height: 1.2em;
}

.promo-success {
    color: #22c55e;
    font-size: 14px;
    margin-top: 12px;
    font-weight: 500;
}

/* Gate Footer */
.gate-footer {
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.gate-footer-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.gate-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
}

.gate-footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.gate-footer-link:hover {
    color: var(--text);
    text-decoration: underline;
}

.gate-footer-sep {
    color: var(--border);
}

/* ===== TERMS MODAL ===== */
.terms-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.terms-modal-content {
    background: var(--bg-app);
    color: var(--text);
    border-radius: 20px;
    width: min(700px, 92%);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.terms-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.terms-modal-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.terms-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}

.terms-close-btn:hover {
    background: var(--bg-surface);
    color: var(--text);
}

.terms-modal-body {
    padding: 24px 28px 32px;
    overflow-y: auto;
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
}

.terms-modal-body h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 8px;
}

.terms-modal-body h3:first-of-type {
    margin-top: 12px;
}

.terms-modal-body p {
    margin: 0 0 10px;
}

/* ===== MOBILE: Pricing ===== */
@media (max-width: 768px) {
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Espacio para que el badge "Popular" no toque la tarjeta anterior */
    .pricing-card.featured {
        margin-top: 6px;
    }

    .gate-container {
        padding: 32px 16px 24px;
    }

    .gate-logo {
        font-size: 36px;
    }

    .gate-header {
        margin-bottom: 32px;
    }

    .plan-amount {
        font-size: 44px;
    }

    .promo-form {
        flex-direction: column;
        gap: 10px;
    }

    .promo-btn {
        width: 100%;
    }

    .terms-modal-content {
        width: 94%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        align-self: flex-end;
    }
}
