/* ==========================================================
   CRM de Propuestas — Estilos base
   ========================================================== */

:root {
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-secondary: #0f172a;
    --color-bg: #f5f6fb;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #1f2937;
    --color-muted: #6b7280;
    --color-success: #059669;
    --color-success-bg: #ecfdf5;
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
    --sidebar-width: 250px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 0.5em; }
p { line-height: 1.5; }
.muted { color: var(--color-muted); }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: #fff; color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: var(--color-error-bg); color: var(--color-error); }
.btn-danger:hover { background: #fde2e2; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Alertas ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.alert-success, .alert-ok { background: var(--color-success-bg); color: var(--color-success); }
.alert-error, .alert-fail { background: var(--color-error-bg); color: var(--color-error); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------- Login / Install ---------- */
.login-body, .install-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #eef0ff 0%, #f5f6fb 60%);
}
.login-card, .install-card {
    background: var(--color-surface);
    padding: 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 420px;
}
.install-card { max-width: 640px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.logo-badge {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.login-form, .install-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
label { font-size: 13px; font-weight: 600; color: var(--color-text); display: flex; flex-direction: column; gap: 6px; }
input, select, textarea {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #fff;
    color: var(--color-text);
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

/* Editor de texto enriquecido (Quill) */
.rich-editor-container { background: #fff; border-radius: 8px; margin-bottom: 4px; }
.rich-editor-container .ql-toolbar { border-color: var(--color-border); border-radius: 8px 8px 0 0; }
.rich-editor-container .ql-container { border-color: var(--color-border); border-radius: 0 0 8px 8px; font-size: 14px; min-height: 120px; }
.rich-editor-container .ql-editor { min-height: 120px; }

/* Salida del contenido HTML enriquecido (mismo contenido, ya renderizado) */
.rich-text-content p { margin: 0 0 12px; line-height: 1.6; }
.rich-text-content p:last-child { margin-bottom: 0; }
.rich-text-content h2 { font-size: 18px; margin: 16px 0 8px; }
.rich-text-content h3 { font-size: 16px; margin: 14px 0 6px; }
.rich-text-content ul, .rich-text-content ol { margin: 0 0 12px; padding-left: 22px; line-height: 1.6; }
.rich-text-content a { color: var(--color-primary); text-decoration: underline; }
.rich-text-content.rich-text-compact p { margin-bottom: 6px; font-size: 13px; }
.rich-text-content.rich-text-compact h2, .rich-text-content.rich-text-compact h3 { font-size: 13px; margin: 4px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 8px; }
.form-grid label { grid-column: span 1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.requirements-list { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 6px; }
.requirements-list li { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.requirements-list li.ok { color: var(--color-success); }
.requirements-list li.fail { color: var(--color-error); }
.req-icon { font-weight: 700; }

/* ---------- Layout del panel ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-secondary);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: #cbd5e1; font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--color-primary); color: #fff; }
.nav-icon { font-size: 16px; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; font-size: 13px; }
.user-info strong { color: #fff; }
.user-info a { color: #94a3b8; font-size: 12px; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 24px; background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 5;
}
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }
.topbar-search { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar-search input { width: 220px; padding: 8px 12px; font-size: 13px; }
.topbar-search button { background: none; border: 1px solid var(--color-border); border-radius: 8px; padding: 7px 10px; cursor: pointer; }
@media (max-width: 700px) { .topbar-search input { width: 130px; } }

.app-content { padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---------- Tarjetas / grid del dashboard ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--color-surface); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--color-border);
}
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-card .stat-label { font-size: 13px; color: var(--color-muted); }

.panel {
    background: var(--color-surface); border-radius: var(--radius);
    border: 1px solid var(--color-border); box-shadow: var(--shadow-sm);
    padding: 20px; margin-bottom: 20px;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.panel-header h2 { font-size: 16px; margin: 0; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th {
    text-align: left; padding: 10px 12px; font-size: 12px; text-transform: uppercase;
    letter-spacing: .03em; color: var(--color-muted); border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
table.data-table td { padding: 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #fafbff; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--color-muted); }

/* ---------- Badges de estado ---------- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #eff6ff; color: #2563eb; }
.badge-indigo { background: #eef2ff; color: #4f46e5; }
.badge-amber { background: #fffbeb; color: #b45309; }
.badge-green { background: #ecfdf5; color: #059669; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-slate { background: #f1f5f9; color: #334155; }

/* ---------- Barra de búsqueda / filtros ---------- */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters-bar input, .filters-bar select { max-width: 220px; }

/* ---------- Paginación ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 12px; border-radius: 8px; border: 1px solid var(--color-border);
    font-size: 13px; color: var(--color-text);
}
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination a:hover { background: #f3f4f6; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.5);
    display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff; border-radius: var(--radius); padding: 24px;
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.modal-box.modal-lg { max-width: 800px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--color-muted); }

/* ---------- Toasts ---------- */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
    background: var(--color-secondary); color: #fff; padding: 12px 18px;
    border-radius: 10px; box-shadow: var(--shadow-md); font-size: 14px;
    animation: toast-in .2s ease;
}
.toast.toast-error { background: var(--color-error); }
.toast.toast-success { background: var(--color-success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Items de propuesta (líneas de precio) ---------- */
.items-table input { padding: 8px; font-size: 13px; }
.item-thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; display: block; }
.items-total-row { font-weight: 700; }
.totals-box { max-width: 320px; margin-left: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.totals-row { display: flex; justify-content: space-between; font-size: 14px; }
.totals-row.grand-total { font-size: 18px; font-weight: 700; border-top: 1px solid var(--color-border); padding-top: 8px; }
.discount-validity { font-size: 12px; color: var(--color-warning); font-weight: 600; }

.public-body .totals-box { max-width: 100%; margin-top: 18px; padding-top: 16px; border-top: 1.5px dashed var(--color-border); }
.public-body .totals-row.grand-total {
    font-size: 22px;
    border-top: none;
    padding: 14px 16px;
    margin-top: 6px;
    border-radius: 14px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 8%, transparent), color-mix(in srgb, var(--color-primary) 4%, transparent));
    color: var(--color-primary);
}

.payment-plan { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.payment-plan-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-primary) 5%, transparent);
    border: 1px solid var(--color-border);
}

/* ---------- Embudo de ventas (kanban-lite, Etapa 3) ---------- */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-column { flex: 0 0 240px; background: #f8fafc; border: 1px solid var(--color-border); border-radius: 12px; display: flex; flex-direction: column; max-height: 72vh; }
.kanban-column-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.kanban-column-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.kanban-empty { font-size: 12px; color: var(--color-muted); text-align: center; padding: 16px 4px; }
.kanban-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.kanban-card-title { font-weight: 700; font-size: 13.5px; }
.kanban-card-sub { font-size: 12px; color: var(--color-muted); }
.kanban-card-amount { font-size: 13px; font-weight: 700; color: var(--color-primary); }
.kanban-card-actions { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kanban-card-actions select { font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--color-border); max-width: 100%; }

/* ---------- Gráfico simple de barras (dashboard) ---------- */
.bars-chart { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 20px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-col .bar { width: 100%; max-width: 40px; border-radius: 6px 6px 0 0; background: var(--color-primary); transition: height .3s ease; }
.bar-col .bar-value { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.bar-col .bar-label { font-size: 11px; color: var(--color-muted); margin-top: 6px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed; left: -260px; top: 0; height: 100vh; z-index: 40;
        transition: left .2s ease; box-shadow: var(--shadow-md);
    }
    .sidebar.open { left: 0; }
    .menu-toggle { display: inline-block; }
    .app-content { padding: 16px; padding-bottom: 76px; }
    .bottom-nav { display: flex; }
}

/* ---------- Barra de navegación inferior (móvil, Etapa 10: PWA) ---------- */
.bottom-nav {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--color-surface); border-top: 1px solid var(--color-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(15,23,42,0.06);
}
.bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; color: var(--color-muted); padding: 4px 0; border-radius: 8px;
}
.bottom-nav a.active { color: var(--color-primary); }
.bottom-nav a .nav-icon { font-size: 19px; }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.kv-list { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.kv-list .kv-row { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--color-border); padding-bottom: 8px; }
.kv-list .kv-row:last-child { border-bottom: none; }
.kv-label { color: var(--color-muted); }

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }

.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline-item { display: flex; gap: 10px; font-size: 13px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); margin-top: 5px; flex-shrink: 0; }
.timeline-time { color: var(--color-muted); min-width: 90px; }

.package-editor-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
    background: #fafbff;
}

/* ---------- Editor de bloques ---------- */
.block-picker { display: flex; flex-wrap: wrap; gap: 8px; }

.block-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}
.block-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: #f8f9fc;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.block-type-label { font-weight: 700; font-size: 14px; }
.block-card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.block-visible-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; }
.block-visible-label input { width: auto; }
.block-card-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.repeater-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.repeater-row { display: flex; gap: 8px; align-items: center; }
.repeater-row input { flex: 1; }
.repeater-row-double input, .repeater-row-triple input { flex: 1; }
.gallery-status { min-width: 80px; font-size: 13px; }
.gallery-file-input { max-width: 200px; }

/* ==========================================================
   Vista pública de propuesta (/p/{slug})
   ========================================================== */
.public-body {
    background: var(--color-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
.public-header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 30;
}
.public-header-inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.public-logo { height: 34px; max-width: 170px; object-fit: contain; }
.public-brand { font-weight: 800; letter-spacing: -0.01em; }

.public-main {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px 60px;
}

/* ---------- Héroe ---------- */
.public-hero {
    text-align: center;
    padding: 56px 28px;
    margin: 20px 0 24px;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    background: linear-gradient(135deg, var(--color-primary) 0%, color-mix(in srgb, var(--color-primary) 55%, var(--color-secondary)) 100%);
    color: #fff;
    box-shadow: 0 20px 45px -12px rgba(15,23,42,.35);
    box-shadow: 0 20px 45px -12px color-mix(in srgb, var(--color-primary) 45%, transparent);
}
.public-hero::before, .public-hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    filter: blur(2px);
    z-index: 0;
}
.public-hero::before { width: 220px; height: 220px; top: -90px; right: -60px; }
.public-hero::after { width: 160px; height: 160px; bottom: -70px; left: -40px; background: rgba(255,255,255,0.08); }
.public-hero > * { position: relative; z-index: 1; }
.public-hero h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin: 16px 0 10px; line-height: 1.15; }
.public-hero .public-client { font-size: 16px; opacity: 0.95; }
.public-hero .muted { color: rgba(255,255,255,0.85) !important; }
.public-hero .badge { background: rgba(255,255,255,0.2); color: #fff; backdrop-filter: blur(4px); font-weight: 700; letter-spacing: 0.03em; }
/* Cuando hay imagen de portada personalizada, esta regla (inyectada inline) sobreescribe el degradado de arriba */

.public-card {
    background: var(--color-surface);
    border-radius: 20px;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(15,23,42,.04), 0 12px 24px -12px rgba(15,23,42,.06);
    padding: 26px 24px;
    margin-bottom: 20px;
    transition: box-shadow .25s ease;
}
.public-card h2 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
    color: var(--color-secondary);
}

/* Aparición suave al hacer scroll (se activa vía JS con IntersectionObserver) */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1);
}
.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .reveal-on-scroll { opacity: 1; transform: none; transition: none; }
}

.public-status-card {
    text-align: center;
    padding: 56px 28px;
}
.status-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 60%, var(--color-secondary)));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; margin: 0 auto 20px;
    box-shadow: 0 12px 24px -8px rgba(15,23,42,.35);
    box-shadow: 0 12px 24px -8px color-mix(in srgb, var(--color-primary) 50%, transparent);
}
.status-icon-success { background: linear-gradient(135deg, var(--color-success), #10b981); box-shadow: 0 12px 24px -8px rgba(5,150,105,.5); }
.status-icon-muted { background: linear-gradient(135deg, #94a3b8, #64748b); box-shadow: none; }
.public-status-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }

.public-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.public-actions .btn { padding: 15px 18px; font-size: 15.5px; font-weight: 700; }

/* Botones con más presencia, solo dentro de la vista pública */
.public-body .btn {
    border-radius: 12px;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.public-body .btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: none;
    box-shadow: 0 8px 20px -6px rgba(79,70,229,.5);
    box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--color-primary) 55%, transparent);
}
.public-body .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -6px rgba(79,70,229,.6);
    box-shadow: 0 12px 26px -6px color-mix(in srgb, var(--color-primary) 65%, transparent);
}
.public-body .btn-secondary {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
}
.public-body .btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}
.public-body .btn-danger:hover { transform: translateY(-1px); }

.public-footer { text-align: center; padding-top: 10px; }

.sticky-cta {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 16px rgba(15,23,42,.08);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 20;
    transform: translateY(100%);
    transition: transform .3s ease;
}
.sticky-cta.visible { transform: translateY(0); }
.sticky-cta-text { font-weight: 600; font-size: 14px; }
.sticky-cta .btn { padding: 10px 20px; }
@media (max-width: 480px) {
    .sticky-cta { padding: 10px 14px; gap: 10px; }
    .sticky-cta-text { display: none; }
    .sticky-cta .btn { flex: 1; }
    .public-main { padding-bottom: 80px; }
}

@media (max-width: 480px) {
    .public-hero h1 { font-size: 22px; }
    .public-card { padding: 16px; border-radius: 14px; }
}

.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.package-card {
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 26px 20px;
    text-align: center;
    background: #fafbff;
    transition: transform .2s ease, box-shadow .2s ease;
}
.package-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px -16px rgba(15,23,42,.18); }
.package-card.package-recommended {
    border: 2px solid var(--color-primary);
    background: #fff;
    box-shadow: var(--shadow-md);
    transform: scale(1.02);
}
.package-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 4px 12px;
    border-radius: 999px;
}
.package-card h3 { margin: 6px 0 4px; font-size: 17px; }
.package-price { font-size: 24px; font-weight: 700; margin: 12px 0; color: var(--color-primary); }
.package-features { list-style: none; padding: 0; margin: 0; text-align: left; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }

.block-simple-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }

.block-item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.block-item-card { background: #fafbff; border: 1px solid var(--color-border); border-radius: 10px; padding: 14px; }
.block-item-card h4 { margin: 0 0 6px; font-size: 15px; }
.testimonial-card p { font-style: italic; margin: 0 0 8px; }

.block-faq-list { display: flex; flex-direction: column; gap: 10px; }
.block-faq-item { border-bottom: 1px solid var(--color-border); padding-bottom: 10px; }
.block-faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.block-faq-question {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; text-align: left; background: none; border: none; cursor: pointer;
    font-weight: 700; font-size: 15px; color: var(--color-text); padding: 6px 0;
    font-family: inherit;
}
.block-faq-icon { font-size: 18px; color: var(--color-primary); transition: transform .2s ease; flex-shrink: 0; }
.block-faq-item.open .block-faq-icon { transform: rotate(45deg); }
.block-faq-answer {
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height .3s ease, opacity .3s ease, padding-top .3s ease;
}
.block-faq-item.open .block-faq-answer { max-height: 300px; opacity: 1; padding-top: 6px; }

.block-gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.block-gallery-img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; }

.service-cards-grid { display: flex; flex-direction: column; gap: 18px; margin-bottom: 16px; }
.service-card {
    border: 1px solid var(--color-border); border-radius: 16px; overflow: hidden;
    background: #fafbff; display: flex; flex-direction: row;
    transition: transform .2s ease, box-shadow .2s ease;
}
.service-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px -14px rgba(15,23,42,.18); }
@media (max-width: 640px) {
    .service-card { flex-direction: column; }
}
.service-card-img { width: 260px; flex-shrink: 0; height: auto; min-height: 200px; object-fit: cover; transition: transform .4s ease; }
.service-card:hover .service-card-img { transform: scale(1.05); }

/* El video ocupa el mismo lugar que la foto (en vez de tenerlos por separado) */
.service-card-media { flex-shrink: 0; }
.service-card-media-video {
    position: relative;
    width: 220px;
    padding-top: 177.78%; /* respaldo 9:16 para navegadores sin soporte de aspect-ratio */
    background: #000;
}
@supports (aspect-ratio: 9 / 16) {
    .service-card-media-video { padding-top: 0; aspect-ratio: 9 / 16; height: auto; }
}
.service-card-media-video iframe,
.service-card-media-video video {
    position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover;
}
@media (max-width: 640px) {
    .service-card-media-video { width: 100%; max-width: 280px; margin: 0 auto; }
}
.service-card-body { padding: 22px; flex: 1; min-width: 0; }
.service-card-body h4 { margin: 0 0 8px; font-size: 18px; }
.service-card-features { list-style: none; padding: 0; margin: 10px 0; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.service-card-features li { color: var(--color-text); }
.service-card-price { font-weight: 800; font-size: 18px; color: var(--color-primary); margin-top: 10px; }
@media (max-width: 640px) {
    .service-card-img { width: 100%; min-height: 170px; }
}

.block-video-wrap { position: relative; width: 100%; padding-top: 56.25%; border-radius: 12px; overflow: hidden; }
.block-video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.catalog-card {
    border: 1px solid var(--color-border); border-radius: 12px; overflow: hidden;
    background: #fff; display: flex; flex-direction: column;
}
.catalog-card-img { width: 100%; height: 130px; object-fit: cover; }
.catalog-card-body { padding: 14px; flex: 1; }
.catalog-card-body h3 { margin: 0 0 4px; font-size: 15px; }
.catalog-card-features { list-style: none; padding: 0; margin: 6px 0; font-size: 12px; color: var(--color-muted); display: flex; flex-direction: column; gap: 3px; }
.catalog-card-price { font-weight: 700; color: var(--color-primary); margin-top: 6px; }
.catalog-card-actions { display: flex; gap: 8px; padding: 0 14px 14px; }

.catalog-picker-item {
    display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--color-border);
    border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s ease;
}
.catalog-picker-item:hover { border-color: var(--color-primary); background: #fafbff; }
.catalog-picker-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #f1f5f9; }
.catalog-picker-info { flex: 1; }
.catalog-picker-info strong { display: block; font-size: 14px; }
.catalog-picker-info span { font-size: 12px; color: var(--color-muted); }

/* ==========================================================
   Versión móvil tipo app (≤ 900px)
   ========================================================== */
@media (max-width: 900px) {
    html, body { -webkit-tap-highlight-color: transparent; }
    body.app-body { padding-top: env(safe-area-inset-top, 0px); }

    /* Barra superior compacta */
    .topbar { padding: 10px 14px; gap: 10px; }
    .page-title { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .menu-toggle { font-size: 22px; padding: 6px 8px; min-width: 40px; min-height: 40px; }
    .topbar-search { display: none; }
    .topbar-bell { margin-left: 0 !important; min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }

    /* Contenido a ancho completo, panels sin "caja" pesada */
    .app-content { padding: 12px; padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
    .panel { padding: 14px; border-radius: 16px; margin-bottom: 14px; }
    .panel-header { flex-direction: row; }
    .panel-header .btn { white-space: nowrap; }
    .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
    .stat-card { padding: 14px; border-radius: 16px; }
    .stat-card .stat-value { font-size: 20px; word-break: break-word; }

    /* Controles cómodos para el dedo; 16px evita el zoom automático de iOS */
    input, select, textarea { font-size: 16px !important; min-height: 44px; }
    .btn { min-height: 44px; padding-left: 16px; padding-right: 16px; border-radius: 12px; }
    .btn-sm { min-height: 40px; }
    .filters-bar { flex-direction: column; }
    .filters-bar input, .filters-bar select, .filters-bar .btn { max-width: none; width: 100%; }

    /* Menú lateral como panel deslizable con fondo oscuro */
    .sidebar { width: 280px; left: -300px; padding-top: env(safe-area-inset-top, 0px); overflow-y: auto; }
    body.sidebar-open::after {
        content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 35;
    }

    /* Modales como "bottom sheet" */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-box, .modal-box.modal-lg {
        max-width: none; width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0;
        padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
        animation: sheetUp .22s ease-out;
    }
    @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
    .modal-close { font-size: 24px; min-width: 40px; min-height: 40px; }
    .form-grid { grid-template-columns: 1fr; }

    /* Tablas → tarjetas apiladas */
    .table-wrap { overflow: visible; }
    table.data-table, table.data-table tbody, table.data-table tr, table.data-table td { display: block; width: 100%; }
    table.data-table thead { display: none; }
    table.data-table tr {
        background: var(--color-surface); border: 1px solid var(--color-border);
        border-radius: 14px; padding: 6px 12px; margin-bottom: 10px;
    }
    table.data-table tr:hover td { background: transparent; }
    table.data-table td {
        display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
        padding: 9px 0; border-bottom: 1px solid var(--color-border); text-align: right; font-size: 14px;
    }
    table.data-table td:last-child { border-bottom: none; }
    table.data-table td::before {
        content: attr(data-label); font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
        color: var(--color-muted); font-weight: 600; text-align: left; flex: 0 0 38%; padding-top: 2px;
    }
    table.data-table td:not([data-label])::before, table.data-table td[data-label=""]::before { display: none; }
    table.data-table td.actions-row { justify-content: flex-end; flex-wrap: wrap; }
    table.data-table td.empty-state { display: block; text-align: center; }
    table.data-table td.empty-state::before { display: none; }
    table.data-table td select { max-width: 60%; }

    /* Embudo / tareas: columnas deslizables con snap */
    .kanban-board { scroll-snap-type: x mandatory; gap: 10px; margin: 0 -14px; padding: 0 14px 8px; -webkit-overflow-scrolling: touch; }
    .kanban-column { flex: 0 0 84%; scroll-snap-align: center; max-height: none; }

    /* Gráficos */
    .bars-chart { gap: 8px; overflow-x: auto; }
    .bar-col .bar-value { font-size: 10px; }

    /* Paginación grande y táctil */
    .pagination a, .pagination span { padding: 10px 14px; }

    /* Barra inferior estilo app */
    .bottom-nav { display: flex; padding-top: 4px; border-radius: 18px 18px 0 0; background: var(--color-surface); }
    .bottom-nav a, .bottom-nav button {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
        font-size: 11px; color: var(--color-muted); padding: 6px 0; border-radius: 12px;
        background: none; border: none; font-family: inherit; cursor: pointer; min-height: 52px;
    }
    .bottom-nav a.active { color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 10%, transparent); font-weight: 700; }
    .bottom-nav .nav-icon { font-size: 21px; }
}

/* ==========================================================
   Visitas: historial de seguimiento
   ========================================================== */
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }

.visit-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.chips { display: flex; gap: 8px; overflow-x: auto; flex: 1 1 100%; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.chip {
    flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
    background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text); white-space: nowrap;
}
.chip.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.chip-count { opacity: .7; margin-left: 4px; font-weight: 700; }
.visit-search { flex: 1 1 200px; }
.visit-search input { width: 100%; }

.visit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.visit-card {
    background: var(--color-surface); border: 1px solid var(--color-border); border-left: 5px solid #f59e0b;
    border-radius: 14px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
    box-shadow: var(--shadow-sm);
}
.visit-card.result-vendido { border-left-color: #059669; }
.visit-card.result-no_vendido { border-left-color: #dc2626; opacity: .85; }
.visit-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.visit-card-title { font-size: 16px; font-weight: 700; color: var(--color-text); }
.visit-card-sub { font-size: 13px; color: var(--color-muted); }
.visit-card-notes { font-size: 13px; color: var(--color-text); background: #f8fafc; border-radius: 10px; padding: 8px 10px; }
.visit-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.when { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.when-late { background: #fef2f2; color: #dc2626; }
.when-today { background: #fff7ed; color: #c2410c; }
.when-soon { background: #fffbeb; color: #b45309; }
.when-ok { background: #eff6ff; color: #2563eb; }
.when-muted { background: #f1f5f9; color: #64748b; }

.visit-head { border-left: 5px solid #f59e0b; }
.visit-head.result-vendido { border-left-color: #059669; }
.visit-head.result-no_vendido { border-left-color: #dc2626; }
.visit-head-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.visit-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.visit-facts div { background: #f8fafc; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.visit-facts strong { font-size: 15px; }
.visit-result-note { background: #f8fafc; border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.visit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.visit-decision { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--color-border); }
.timeline li { position: relative; padding: 0 0 18px 14px; }
.timeline li::before {
    content: ""; position: absolute; left: -25px; top: 3px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--color-primary); border: 2px solid var(--color-surface);
}
.tl-date { font-size: 12px; font-weight: 700; color: var(--color-muted); text-transform: uppercase; letter-spacing: .03em; }
.tl-body { margin-top: 4px; font-size: 14px; line-height: 1.5; }
.tl-next { margin-top: 4px; font-size: 12px; font-weight: 700; color: #b45309; }

@media (max-width: 900px) {
    .visit-list { grid-template-columns: 1fr; }
    .visit-new {
        position: fixed; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); z-index: 45;
        border-radius: 999px; padding: 14px 20px; box-shadow: 0 8px 24px rgba(79,70,229,.45); font-weight: 700;
    }
    .visit-search { flex: 1 1 100%; }
    .visit-decision { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--color-bg); padding: 8px 0; grid-template-columns: 1fr 1fr; }
    .visit-decision .btn-primary { grid-column: 1 / -1; }
    .visit-actions .btn { flex: 1; }

    /* Botón principal de cada lista como botón flotante (estilo app) */
    .panel-header > button.btn-primary,
    .panel-header .actions-row > button.btn-primary {
        position: fixed; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); z-index: 45;
        border-radius: 999px; padding: 14px 20px; box-shadow: 0 8px 24px rgba(79,70,229,.45); font-weight: 700;
    }
}

/* Capas en móvil: barra inferior < fondo del menú < menú < formularios */
@media (max-width: 900px) {
    .bottom-nav { z-index: 40; }
    .sidebar { z-index: 70; }
    body.sidebar-open::after { z-index: 60; }
    .modal-overlay { z-index: 80; }
    .visit-new, .panel-header > button.btn-primary, .panel-header .actions-row > button.btn-primary { z-index: 39; }
    .visit-decision { z-index: 38; }
    .visit-actions .btn { white-space: nowrap; padding-left: 10px; padding-right: 10px; justify-content: center; }
}

/* ===== Listas móviles (tarjetas compactas) y dashboard ===== */
.mobile-only { display: none; }
.desktop-only { display: block; }
.m-list { display: flex; flex-direction: column; gap: 10px; }
.m-item { background: var(--color-surface, #fff); border: 1px solid var(--color-border, #e5e7eb); border-radius: 14px; padding: 12px 14px; display: block; color: inherit; text-decoration: none; }
.m-link:active, .today-item:active { background: rgba(0,0,0,.04); }
.m-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.m-main { min-width: 0; flex: 1; }
.m-title { font-weight: 700; font-size: 15px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.m-title a { color: inherit; text-decoration: none; }
.m-sub { font-size: 13px; color: var(--color-muted, #6b7280); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; font-size: 14px; flex-shrink: 0; }
.m-meta { font-size: 12px; color: var(--color-muted, #6b7280); margin-top: 8px; }
.m-meta b.late, b.late { color: #dc2626; }
.m-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.m-actions .btn { flex: 1; min-width: 90px; justify-content: center; text-align: center; }
.m-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--color-primary, #4f46e5); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.m-row.has-avatar { align-items: center; }

/* Dashboard */
.dash-hello { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 14px; }
.dash-hello h2 { margin: 0; }
.dash-today { border-left: 5px solid #f59e0b; }
.today-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--color-border, #e5e7eb); border-radius: 12px; color: inherit; text-decoration: none; background: var(--color-surface, #fff); }
.today-item.is-late { border-color: #fca5a5; background: #fef2f2; }
.today-icon { font-size: 22px; flex-shrink: 0; }
.today-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.today-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-main small { color: var(--color-muted, #6b7280); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-when { font-size: 12px; font-weight: 700; flex-shrink: 0; padding: 4px 8px; border-radius: 999px; }
.today-when.now { background: #fef3c7; color: #92400e; }
.today-when.late { background: #fee2e2; color: #b91c1c; }
.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.dash-stats .stat-card { display: block; color: inherit; text-decoration: none; min-width: 0; }
.dash-stats .stat-sub { font-size: 12px; color: var(--color-muted, #6b7280); margin-top: 2px; }
.dash-stats .stat-money { font-size: 20px; }
@media (min-width: 901px) { .dash-today .m-list { display: grid; grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1100px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 900px) {
  .mobile-only { display: block; }
  .desktop-only { display: none !important; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-stats .stat-card { padding: 12px; }
  .dash-stats .stat-label { font-size: 12px; }
  .dash-stats .stat-value { font-size: 22px; }
  .dash-stats .stat-money { font-size: 16px; }
  .detail-grid { grid-template-columns: 1fr !important; }
  .bars-chart { overflow-x: auto; }
  .filters-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters-bar input[type=search], .filters-bar input[type=text] { grid-column: 1 / -1; }
  .filters-bar .btn { width: 100%; }
}
@media (max-width: 900px) {
  .m-list.mobile-only { display: flex; }
  .filters-bar > .btn, .filters-bar > button { width: 100%; }
}

/* ===== Tareas (móvil): lista tipo to-do ===== */
.task-chips { margin-bottom: 12px; }
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--color-surface, #fff); border: 1px solid var(--color-border, #e5e7eb); border-radius: 14px; }
.task-check { width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid #9ca3af; background: transparent; color: #fff; font-weight: 800; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.task-row.is-done .task-check { background: #16a34a; border-color: #16a34a; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--color-muted, #6b7280); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; font-size: 12px; }
.when-pill { padding: 2px 8px; border-radius: 999px; background: #f3f4f6; color: #4b5563; font-weight: 600; }
.when-pill.late { background: #fee2e2; color: #b91c1c; }
.when-pill.today { background: #fef3c7; color: #92400e; }
.when-pill.soon { background: #dbeafe; color: #1d4ed8; }
.prio { padding: 2px 8px; border-radius: 999px; font-weight: 600; background: #f3f4f6; color: #4b5563; }
.prio-alta { background: #fee2e2; color: #b91c1c; }
.prio-media { background: #dbeafe; color: #1d4ed8; }
.task-client { color: var(--color-muted, #6b7280); }

/* Tareas: resumen ampliado + hoja de detalle */
.task-row { cursor: pointer; }
.task-check { cursor: default; font-size: 15px; color: #f59e0b; }
.task-row.is-done .task-check { color: #fff; }
.task-desc { font-size: 13px; color: var(--color-muted, #6b7280); margin-top: 3px; line-height: 1.35; }
.task-people { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12px; color: var(--color-muted, #6b7280); }
.task-chev { color: #9ca3af; font-size: 22px; flex-shrink: 0; }
.task-detail .td-desc { background: #f9fafb; border-radius: 10px; padding: 12px; font-size: 14px; line-height: 1.45; margin-bottom: 12px; }
.td-facts { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; margin: 0 0 14px; font-size: 14px; }
.td-facts dt { color: var(--color-muted, #6b7280); }
.td-facts dd { margin: 0; font-weight: 600; text-transform: none; }
.task-detail-actions { display: flex; flex-direction: column; gap: 8px; }
.task-detail-actions .btn { width: 100%; justify-content: center; }

/* ==========================================================
   MÓVIL — rediseño visual "command deck"
   Base oscura (tinta) + acento eléctrico índigo→aqua, tipografía
   grande, tarjetas sin borde con sombra suave y dock flotante.
   ========================================================== */
@media (max-width: 900px) {
  :root {
    --ink: #0b1026;
    --ink-2: #151c3d;
    --canvas: #edf0f9;
    --electric: #5b5bf5;
    --aqua: #22d3ee;
    --grad: linear-gradient(135deg, #5b5bf5 0%, #3b82f6 55%, #22d3ee 120%);
    --color-primary: #5b5bf5;
    --color-primary-dark: #4747dd;
    --color-bg: var(--canvas);
    --color-text: #0e1530;
    --color-muted: #5f6a8a;
    --color-border: #e1e5f3;
    --shadow-card: 0 1px 2px rgba(11,16,38,.05), 0 10px 28px rgba(50,60,140,.09);
  }
  html, body { font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 17px; letter-spacing: -.005em; }
  body { background: var(--canvas); }
  input, select, textarea, button { font-family: inherit; }

  /* Barra superior oscura */
  .topbar { background: var(--ink); color: #fff; border: 0; padding: 12px 16px; box-shadow: 0 6px 24px rgba(11,16,38,.25); position: sticky; top: 0; z-index: 30; }
  .page-title { color: #fff; font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
  .menu-toggle, .topbar-bell { background: rgba(255,255,255,.1); color: #fff; border-radius: 14px; width: 46px; height: 46px; min-width: 46px; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
  .menu-toggle { font-size: 22px; }

  /* Contenido */
  .app-content { padding: 16px 14px calc(110px + env(safe-area-inset-bottom, 0px)); }
  .panel { background: #fff; border: 0; border-radius: 22px; box-shadow: var(--shadow-card); padding: 18px 16px; margin-bottom: 16px; }
  .panel-header h2, .panel h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
  .muted { color: var(--color-muted); }

  /* Botones */
  .btn { min-height: 50px; border-radius: 16px; font-size: 16px; font-weight: 700; padding: 12px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
  .btn-sm { min-height: 44px; font-size: 15px; padding: 10px 16px; border-radius: 14px; }
  .btn-primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 20px rgba(91,91,245,.35); }
  .btn-secondary { background: #f3f5fc; border: 0; color: var(--color-text); }
  .btn-danger { background: #fff1f3; color: #e11d48; border: 0; }
  .btn-success { background: linear-gradient(135deg,#059669,#10b981); color: #fff; border: 0; box-shadow: 0 8px 18px rgba(16,185,129,.3); }
  .btn:active { transform: scale(.98); }

  /* Formularios */
  label { font-size: 15px; font-weight: 700; color: var(--color-text); }
  input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=search], input[type=password], select, textarea {
    font-size: 17px; min-height: 54px; border-radius: 16px; border: 1.5px solid #dfe3f3; background: #f7f8fd; padding: 12px 16px; font-weight: 500;
  }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--electric); background: #fff; box-shadow: 0 0 0 4px rgba(91,91,245,.15); }

  /* Badges y chips */
  .badge { font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
  .chips { gap: 10px; }
  .chip { min-height: 46px; padding: 0 18px; font-size: 16px; font-weight: 700; border-radius: 999px; background: #fff; border: 0; box-shadow: var(--shadow-card); color: var(--color-text); display: inline-flex; align-items: center; white-space: nowrap; }
  .chip.active { background: var(--ink); color: #fff; }
  .chip.active .chip-count { color: var(--aqua); opacity: 1; }

  /* Tarjetas de lista */
  .m-item, .visit-card, .task-row, .today-item { background: #fff; border: 0; border-radius: 20px; box-shadow: var(--shadow-card); padding: 16px; }
  .m-title, .task-title, .visit-card-title { font-size: 18px; font-weight: 800; letter-spacing: -.015em; color: var(--color-text); }
  .m-sub, .task-desc, .visit-card-sub { font-size: 15px; }
  .m-meta, .task-people, .task-meta { font-size: 14px; }
  .m-side strong { font-size: 18px; font-weight: 800; }
  .m-avatar { width: 48px; height: 48px; border-radius: 16px; background: var(--grad); font-size: 19px; }
  .m-actions .btn { min-height: 46px; }
  .when-pill, .prio { font-size: 13px; padding: 4px 11px; font-weight: 700; }
  .task-check { width: 32px; height: 32px; border-width: 2.5px; border-color: #b5bdd8; }
  .task-row.is-done .task-check { background: linear-gradient(135deg,#059669,#10b981); border-color: transparent; }
  .task-row.st-en_progreso .task-check { border-color: var(--electric); color: var(--electric); }
  .today-item { gap: 14px; }
  .today-item.is-late { background: #fff5f6; box-shadow: 0 0 0 1.5px #fecdd3, var(--shadow-card); }
  .today-icon { width: 46px; height: 46px; border-radius: 14px; background: #f1f3fb; display: flex; align-items: center; justify-content: center; font-size: 22px; }
  .today-main strong { font-size: 17px; font-weight: 800; }
  .today-main small { font-size: 14px; }
  .today-when { font-size: 13px; }

  /* Dashboard: bloque héroe oscuro + métricas grandes */
  .dash-hello { background: var(--ink); background-image: radial-gradient(120% 140% at 100% 0%, rgba(91,91,245,.55) 0%, rgba(34,211,238,.18) 45%, transparent 70%); color: #fff; border-radius: 26px; padding: 22px 20px; margin-bottom: 16px; flex-direction: column; gap: 6px; box-shadow: 0 14px 34px rgba(11,16,38,.35); }
  .dash-hello h2 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; color: #fff; }
  .dash-hello .muted { color: rgba(255,255,255,.7); font-size: 15px; }
  .dash-today { border-left: 0; }
  .dash-stats { gap: 12px; }
  .dash-stats .stat-card { background: #fff; border: 0; border-radius: 22px; box-shadow: var(--shadow-card); padding: 16px; }
  .dash-stats .stat-label { font-size: 14px; font-weight: 600; color: var(--color-muted); }
  .dash-stats .stat-value { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
  .dash-stats .stat-money { font-size: 22px; }
  .dash-stats .stat-sub { font-size: 13px; }

  /* Dock inferior flotante */
  .bottom-nav { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); width: auto; border: 0; border-radius: 28px; background: rgba(11,16,38,.94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 14px 34px rgba(11,16,38,.45); padding: 8px; gap: 4px; }
  .bottom-nav a, .bottom-nav button { color: rgba(255,255,255,.6); font-size: 12px; font-weight: 700; border-radius: 20px; min-height: 58px; gap: 3px; justify-content: center; }
  .bottom-nav a.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(91,91,245,.5); }
  .bottom-nav .nav-icon { display: flex; font-size: 0; }
  .nav-svg { width: 24px; height: 24px; }

  /* Botón flotante de acción */
  .panel-header > button.btn-primary, .panel-header .actions-row > button.btn-primary, .visit-new {
    bottom: calc(100px + env(safe-area-inset-bottom, 0px)); right: 16px; min-height: 56px; padding: 0 24px; font-size: 17px; border-radius: 999px; background: var(--grad); box-shadow: 0 12px 28px rgba(91,91,245,.5);
  }

  /* Hojas modales */
  .modal-box { border-radius: 30px 30px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .modal-box::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: #d5d9ea; margin: 4px auto 14px; }
  .modal-header h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
  .modal-close { width: 42px; height: 42px; border-radius: 50%; background: #f1f3fb; border: 0; font-size: 18px; }

  /* Menú lateral */
  .sidebar { background: var(--ink); }
  .sidebar-nav a { font-size: 17px; font-weight: 600; min-height: 52px; border-radius: 16px; }
  .sidebar-nav a.active { background: var(--grad); color: #fff; }

  /* Visitas / seguimiento */
  .visit-facts dt, .td-facts dt { font-size: 14px; }
  .td-facts { font-size: 16px; }
  .td-facts dd { font-weight: 700; }
  .timeline-item, .tl-body { font-size: 16px; }
  .toast { font-size: 16px; border-radius: 16px; }
}
@media (max-width: 900px) {
  .today-item { flex-wrap: wrap; row-gap: 8px; }
  .today-main strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .today-main small { white-space: normal; }
  .today-when { flex-basis: auto; margin-left: 60px; }
  .dash-hello h2 { font-size: 25px; }
}
@media (max-width: 900px) {
  .today-main { flex: 1 1 calc(100% - 70px); min-width: 0; }
  .today-when { flex: 0 0 auto; }
}

/* ==========================================================
   MÓVIL — legibilidad a pleno sol y sin desplazamiento lateral
   ========================================================== */
@media (max-width: 900px) {
  :root { --color-muted: #3f4a6b; --color-border: #cfd5ea; }
  /* overflow-x:hidden en html Y body rompe el scroll táctil en Android; clip solo en body */
  html { max-width: 100%; }
  body { overflow-x: clip; max-width: 100%; }
  .app-main, .app-content, .panel, .m-item, .visit-card, .task-row, .today-item { max-width: 100%; min-width: 0; }
  .app-content * { overflow-wrap: anywhere; }
  .app-content img, .app-content video, .app-content canvas { max-width: 100%; height: auto; }
  .app-content table { max-width: 100%; }
  .table-wrap { overflow-x: visible; }
  .kanban-board { overflow-x: visible; }
  .bars-chart { overflow-x: visible; gap: 4px; }
  .bars-chart .bar-col { min-width: 0; flex: 1; }
  .bars-chart .bar-label { font-size: 10px; word-break: break-word; text-align: center; }
  .form-grid { grid-template-columns: 1fr !important; }
  .m-sub { white-space: normal; }
  .m-actions .btn, .visit-card-actions .btn { flex: 1 1 calc(50% - 8px); min-width: 0; }
  pre, code { white-space: pre-wrap; }

  /* Textos con más contraste */
  .m-sub, .task-desc, .visit-card-sub, .m-meta, .task-people, .today-main small, .dash-stats .stat-label, .dash-stats .stat-sub { color: #364061; }
  .m-sub, .task-desc, .visit-card-sub, .today-main small { font-size: 15px; }
  .chip { color: #0b1026; font-weight: 800; box-shadow: 0 0 0 1.5px #c3cae3; }
  .chip.active { box-shadow: none; }
  .badge, .when-pill, .prio { font-weight: 800; }

  /* Dock inferior: blanco puro sobre tinta, bien visible a plena luz */
  .bottom-nav { background: #060a1c; }
  .bottom-nav a, .bottom-nav button { color: #ffffff; font-size: 13px; font-weight: 800; opacity: 1; }
  .nav-svg { width: 28px; height: 28px; stroke-width: 2.4; color: #ffffff; }
  .bottom-nav a.active { background: var(--grad); color: #fff; }
  .bottom-nav a:not(.active):active, .bottom-nav button:active { background: rgba(255,255,255,.16); }
  .page-title, .topbar .menu-toggle, .topbar-bell { color: #fff; }
}
@media (max-width: 900px) {
  .filters-bar label { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 6px !important; min-width: 0; }
  .filters-bar input, .filters-bar select { width: 100%; min-width: 0; max-width: 100%; }
  input[type=date] { -webkit-appearance: none; appearance: none; width: 100%; max-width: 100%; }
}
@media (max-width: 900px) {
  .chips { flex-wrap: wrap; overflow-x: visible; }
  .chip { min-height: 44px; padding: 0 14px; font-size: 15px; }
}
.agenda-switch { flex: 0 0 auto; gap: 6px; }
.agenda-switch .chip { min-height: 38px; padding: 0 14px; font-size: 14px; }

/* Iconos SVG del menú lateral (también en escritorio) */
.nav-item .nav-svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item .nav-icon { display: inline-flex; font-size: 0; }

/* MÓVIL: menú lateral desde la derecha, en cuadrícula */
@media (max-width: 900px) {
  .sidebar { left: auto !important; right: -110%; width: min(88vw, 380px); transition: right .28s ease; background: var(--ink); box-shadow: -20px 0 50px rgba(0,0,0,.4); border-radius: 28px 0 0 28px; padding: 6px 0 0; }
  .sidebar.open { right: 0; left: auto !important; }
  .sidebar-brand { padding: 22px 20px 12px; }
  .brand-name { font-size: 20px; font-weight: 800; }
  .sidebar-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 16px 16px; flex: none; }
  .sidebar-nav a.nav-item { flex-direction: column; justify-content: center; align-items: center; gap: 10px; min-height: 104px; padding: 14px 8px; text-align: center; background: rgba(255,255,255,.08); color: #fff; border-radius: 20px; font-size: 15px; font-weight: 700; }
  .sidebar-nav a.nav-item .nav-svg { width: 30px; height: 30px; stroke-width: 2.2; }
  .sidebar-nav a.nav-item:active { background: rgba(255,255,255,.18); }
  .sidebar-nav a.nav-item.active { background: var(--grad); box-shadow: 0 8px 20px rgba(91,91,245,.45); }
  .sidebar-footer { padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .sidebar-footer .user-info, .sidebar-footer a { color: #fff; font-size: 15px; }
}

/* Ventas: filas de productos */
.sale-row { background: #f5f7fd; border-radius: 18px; padding: 12px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; }
.sale-row-top { display: flex; gap: 8px; align-items: center; }
.sale-row-top select { flex: 1; min-width: 0; }
.sr-remove { width: 44px; height: 44px; flex-shrink: 0; border-radius: 14px; border: 0; background: #fff1f3; color: #e11d48; font-size: 16px; font-weight: 800; cursor: pointer; }
.sale-row-nums { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.sale-row-nums label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sale-line { text-align: right; font-size: 14px; color: var(--color-muted); }
.sale-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--color-secondary, #0b1026); color: #fff; margin: 14px 0; font-size: 16px; }
.sale-total strong { font-size: 22px; }
.sale-detail-items { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.sdi { display: flex; justify-content: space-between; gap: 10px; padding: 12px; background: #f5f7fd; border-radius: 14px; align-items: center; }
.sdi small { display: block; color: var(--color-muted); }
.prod-item { cursor: pointer; }
.prod-item.is-off { opacity: .6; }
@media (min-width: 901px) { .mobile-only { display: none; } .prod-list { display: grid; grid-template-columns: repeat(2, 1fr); } }

/* Login: ojito de contraseña y recordar sesión */
.pw-field { position: relative; display: block; }
.pw-field input { width: 100%; padding-right: 54px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: transparent; color: #4b5563; cursor: pointer; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.pw-toggle svg { width: 24px; height: 24px; }
.pw-toggle .eye-off { display: none; }
.pw-toggle.is-visible .eye-on { display: none; }
.pw-toggle.is-visible .eye-off { display: block; }
.pw-toggle:hover { background: rgba(0,0,0,.05); }
.remember-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.remember-row input { width: 22px; height: 22px; min-height: 0; flex-shrink: 0; accent-color: var(--color-primary); }

/* Configuración: icono de la app e instalación */
.app-icon-box { border-top: 1px solid var(--color-border); padding-top: 16px; margin-top: 8px; }
.app-icon-box h3 { margin: 0 0 6px; font-size: 17px; }
.app-icon-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 12px 0; }
.app-icon-preview { width: 84px; height: 84px; border-radius: 20px; object-fit: cover; box-shadow: 0 6px 18px rgba(11,16,38,.2); background: #fff; }
.app-icon-actions { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.check-line { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-weight: 600; }
.ios-steps { padding-left: 22px; line-height: 1.7; font-size: 16px; }
.ios-steps li { margin-bottom: 8px; }
.pwa-tile { background: none; border: 0; font-family: inherit; cursor: pointer; width: 100%; }
@media (max-width: 900px) {
  .pwa-tile { grid-column: 1 / -1; }
  .login-body { font-family: "Plus Jakarta Sans", -apple-system, "Segoe UI", sans-serif; font-size: 17px; }
  .login-form input[type=email], .login-form input[type=password], .login-form input[type=text] { min-height: 56px; font-size: 17px; border-radius: 16px; }
  .login-form .btn { min-height: 56px; font-size: 17px; border-radius: 16px; }
}
.check-line input[type=checkbox] { width: 22px; height: 22px; min-height: 0; padding: 0; flex-shrink: 0; accent-color: var(--color-primary); }

/* ==========================================================
   ESCRITORIO — mismo lenguaje visual que el móvil
   (tinta oscura + acento eléctrico, tarjetas sin borde, tipografía grande)
   ========================================================== */
@media (min-width: 901px) {
  :root {
    --ink: #0b1026;
    --canvas: #edf0f9;
    --electric: #5b5bf5;
    --aqua: #22d3ee;
    --grad: linear-gradient(135deg, #5b5bf5 0%, #3b82f6 55%, #22d3ee 120%);
    --color-primary: #5b5bf5;
    --color-primary-dark: #4747dd;
    --color-bg: var(--canvas);
    --color-text: #0e1530;
    --color-muted: #4a5578;
    --color-border: #dde2f2;
    --shadow-card: 0 1px 2px rgba(11,16,38,.05), 0 10px 28px rgba(50,60,140,.09);
    --sidebar-width: 272px;
  }
  html, body { font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; letter-spacing: -.005em; }
  body { background: var(--canvas); }
  input, select, textarea, button { font-family: inherit; }

  /* Menú lateral */
  .sidebar { background: var(--ink); background-image: radial-gradient(130% 55% at 0% 0%, rgba(91,91,245,.38) 0%, transparent 60%); }
  .sidebar-brand { padding: 26px 22px 18px; }
  .sidebar-brand .logo-badge { width: 42px; height: 42px; border-radius: 14px; background: var(--grad); font-size: 19px; }
  .brand-name { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
  .sidebar-nav { padding: 8px 14px; gap: 4px; overflow-y: auto; }
  .nav-item { padding: 12px 14px; border-radius: 14px; font-size: 15.5px; font-weight: 600; color: #c9d1ec; gap: 14px; }
  .nav-item .nav-svg { width: 22px; height: 22px; }
  .nav-item:hover { background: rgba(255,255,255,.09); color: #fff; }
  .nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(91,91,245,.4); }
  .sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding: 16px 18px; }
  .user-avatar { background: var(--grad); }
  .user-info strong { color: #fff; font-size: 15px; }
  .user-info a { color: #aeb9de; font-size: 13px; }
  .pwa-tile { color: #c9d1ec; text-align: left; }

  /* Barra superior oscura */
  .topbar { background: var(--ink); color: #fff; border: 0; padding: 14px 32px; box-shadow: 0 6px 24px rgba(11,16,38,.22); }
  .page-title { color: #fff; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
  .topbar-search input { width: 300px; background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.14); color: #fff; border-radius: 14px; min-height: 44px; padding: 0 16px; font-size: 15px; }
  .topbar-search input::placeholder { color: rgba(255,255,255,.65); }
  .topbar-search input:focus { background: rgba(255,255,255,.18); border-color: var(--aqua); box-shadow: none; }
  .topbar-search button { background: rgba(255,255,255,.1); border: 0; border-radius: 14px; width: 44px; height: 44px; color: #fff; }
  .topbar-bell { width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,.1); display: inline-flex; align-items: center; justify-content: center; margin-left: 4px !important; }

  /* Contenido */
  .app-content { max-width: 1320px; padding: 28px 32px 48px; }
  .panel { border: 0; border-radius: 22px; box-shadow: var(--shadow-card); padding: 24px; margin-bottom: 22px; }
  .panel-header h2, .panel h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
  .stat-card { border: 0; border-radius: 22px; box-shadow: var(--shadow-card); padding: 20px; }
  .stat-card .stat-value { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
  .stat-card .stat-label { font-size: 14px; font-weight: 600; color: var(--color-muted); }
  .cards-grid { gap: 18px; }

  /* Botones */
  .btn { min-height: 46px; border-radius: 14px; font-size: 15px; font-weight: 700; padding: 10px 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease, box-shadow .12s ease, background .12s; }
  .btn-sm { min-height: 40px; font-size: 14px; padding: 8px 16px; border-radius: 12px; }
  .btn-primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 20px rgba(91,91,245,.32); }
  .btn-primary:hover { background: var(--grad); filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 12px 24px rgba(91,91,245,.4); }
  .btn-secondary { background: #f1f3fb; border: 0; color: var(--color-text); }
  .btn-secondary:hover { background: #e5e9f8; }
  .btn-danger { background: #fff1f3; color: #e11d48; border: 0; }
  .btn-danger:hover { background: #ffe1e6; }
  .btn-success { background: linear-gradient(135deg,#059669,#10b981); color: #fff; border: 0; }

  /* Formularios */
  label { font-weight: 700; font-size: 14.5px; color: var(--color-text); }
  input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=search], input[type=password], select, textarea {
    font-size: 15.5px; min-height: 48px; border-radius: 14px; border: 1.5px solid #dbe0f1; background: #f7f8fd; padding: 10px 14px; font-weight: 500;
  }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--electric); background: #fff; box-shadow: 0 0 0 4px rgba(91,91,245,.15); }
  .filters-bar input, .filters-bar select { max-width: 260px; }
  .filters-bar .btn { min-height: 48px; }

  /* Etiquetas */
  .badge { font-size: 13px; font-weight: 700; padding: 5px 12px; }

  /* Tablas */
  table.data-table { font-size: 15px; }
  table.data-table th { font-size: 12.5px; font-weight: 800; color: var(--color-muted); background: #f5f7fd; border-bottom: 0; padding: 12px 14px; }
  table.data-table th:first-child { border-radius: 12px 0 0 12px; }
  table.data-table th:last-child { border-radius: 0 12px 12px 0; }
  table.data-table td { padding: 15px 14px; border-bottom: 1px solid #e8ebf6; }
  table.data-table tr:hover td { background: #f7f8ff; }
  table.data-table td.actions-row { display: table-cell; white-space: nowrap; }
  table.data-table td.actions-row > * { margin-right: 6px; vertical-align: middle; }
  table.data-table td.actions-row select { min-height: 40px; padding: 4px 10px; display: inline-block; width: auto; }

  /* Tablero (kanban) */
  .kanban-column { background: #e6eaf7; border: 0; border-radius: 22px; flex: 0 0 280px; }
  .kanban-column-header { border-bottom: 0; padding: 14px 16px; font-size: 15px; }
  .kanban-card { border: 0; border-radius: 16px; box-shadow: var(--shadow-card); padding: 14px; }
  .kanban-card-title { font-size: 15px; font-weight: 800; }
  .kanban-card-sub { font-size: 13px; color: var(--color-muted); }
  .kanban-card-amount { font-size: 15px; }

  /* Dashboard: bloque héroe + agenda */
  .dash-hello { background: var(--ink); background-image: radial-gradient(90% 180% at 100% 0%, rgba(91,91,245,.6) 0%, rgba(34,211,238,.2) 45%, transparent 70%); color: #fff; border-radius: 26px; padding: 28px 32px; margin-bottom: 22px; box-shadow: 0 14px 34px rgba(11,16,38,.3); align-items: center; }
  .dash-hello h2 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; color: #fff; }
  .dash-hello .muted { color: rgba(255,255,255,.75); font-size: 16px; }
  .dash-today { border-left: 0; }
  .today-item { border: 0; background: #f7f8fd; border-radius: 18px; padding: 14px 16px; gap: 14px; box-shadow: none; }
  .today-item:hover { background: #eef1fc; }
  .today-item.is-late { background: #fff3f5; box-shadow: 0 0 0 1.5px #fecdd3; }
  .today-icon { width: 46px; height: 46px; border-radius: 14px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; box-shadow: var(--shadow-card); }
  .today-main strong { font-size: 16px; font-weight: 800; }
  .today-main small { font-size: 14px; color: var(--color-muted); }
  .today-when { font-size: 13px; }
  .dash-stats .stat-card { transition: transform .15s ease; }
  .dash-stats .stat-card:hover { transform: translateY(-3px); }
  .agenda-switch .chip { min-height: 38px; padding: 0 16px; font-size: 14px; }

  /* Filtros tipo píldora */
  .chip { min-height: 42px; padding: 0 18px; font-size: 15px; font-weight: 800; border-radius: 999px; background: #fff; border: 0; box-shadow: 0 0 0 1.5px #c9d0e8; color: #0b1026; display: inline-flex; align-items: center; }
  .chip.active { background: var(--ink); color: #fff; box-shadow: none; }
  .chip.active .chip-count { color: var(--aqua); opacity: 1; }

  /* Tarjetas de lista (visitas, productos, etc.) */
  .m-item, .visit-card { background: #fff; border: 0; border-radius: 20px; box-shadow: var(--shadow-card); padding: 18px; }
  .m-title, .visit-card-title { font-size: 17px; font-weight: 800; }
  .visit-card-sub, .m-sub { font-size: 14.5px; color: var(--color-muted); }

  /* Modales */
  .modal-box { border-radius: 28px; padding: 28px; box-shadow: 0 30px 80px rgba(11,16,38,.35); }
  .modal-header h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
  .modal-close { width: 40px; height: 40px; border-radius: 50%; background: #f1f3fb; border: 0; font-size: 16px; }
  .modal-overlay { background: rgba(11,16,38,.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

  /* Paginación y avisos */
  .pagination a, .pagination span { border-radius: 12px; padding: 9px 15px; font-weight: 700; border: 0; background: #fff; box-shadow: 0 0 0 1.5px #dbe0f1; }
  .pagination .current { background: var(--ink); color: #fff; box-shadow: none; }
  .alert { border-radius: 16px; font-size: 15px; padding: 14px 18px; }
  .toast { border-radius: 16px; font-size: 15px; }

  /* Login */
  .login-body { background: var(--ink); background-image: radial-gradient(80% 70% at 85% 5%, rgba(91,91,245,.55) 0%, transparent 60%), radial-gradient(60% 60% at 5% 100%, rgba(34,211,238,.25) 0%, transparent 60%); }
  .login-card { border-radius: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.5); padding: 40px; }
  .login-logo h1 { font-weight: 800; letter-spacing: -.02em; }
  .login-form .btn { min-height: 52px; font-size: 16px; }
}
@media (min-width: 901px) {
  .topbar-search input[type=text] { background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.14); color: #fff; min-height: 44px; width: 300px; }
  .topbar-search input[type=text]::placeholder { color: rgba(255,255,255,.65); }
  .topbar-search input[type=text]:focus { background: rgba(255,255,255,.18); border-color: var(--aqua); box-shadow: none; }
  .kanban-board.desktop-only { display: flex; }
  .badge { white-space: nowrap; }
  .user-info .muted { color: #aeb9de; font-size: 12.5px !important; }
  table.data-table td.actions-row .btn { padding: 8px 12px; }
  table.data-table td { padding: 14px 12px; }
}
@media (min-width: 901px) {
  input[type=color] { min-height: 48px; padding: 4px; width: 100%; border-radius: 14px; cursor: pointer; }
}

/* Historial de actividad */
.act-feed { display: flex; flex-direction: column; gap: 4px; }
.act-day { margin: 18px 0 6px; font-weight: 800; font-size: 15px; color: var(--color-muted); letter-spacing: -.01em; }
.act-day:first-child { margin-top: 4px; }
.act-item { display: flex; gap: 14px; padding: 12px 8px; border-radius: 16px; align-items: flex-start; }
.act-item:hover { background: #f5f7fd; }
.act-icon { width: 42px; height: 42px; border-radius: 14px; background: #eef1fb; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.act-body { flex: 1; min-width: 0; }
.act-line { font-size: 15.5px; line-height: 1.45; overflow-wrap: anywhere; }
.act-line strong { font-weight: 800; }
.act-client { color: #0e7490; }
.act-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.act-chips span { font-size: 13px; background: #f1f3fb; border-radius: 999px; padding: 3px 10px; color: #28324f; max-width: 100%; overflow-wrap: anywhere; }
.act-chips em { font-style: normal; color: var(--color-muted); font-weight: 600; }
.act-time, .act-when { font-size: 13px; color: var(--color-muted); font-weight: 600; flex-shrink: 0; }
.act-when { display: block; margin-top: 4px; }
.act-compact .act-item { padding: 10px 4px; }
.act-compact .act-icon { width: 36px; height: 36px; font-size: 17px; border-radius: 12px; }
.act-compact .act-line { font-size: 14.5px; }
.act-compact .act-chips span { font-size: 12px; }
.activity-filters { align-items: flex-end; }
.activity-filters .af-date { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
@media (max-width: 900px) {
  .activity-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .activity-filters select, .activity-filters input[type=search], .activity-filters > .btn { grid-column: 1 / -1; }
  .act-item { padding: 12px 4px; }
  .act-time { align-self: flex-start; }
  .act-line { font-size: 16px; }
}
.act-filter-box { margin-bottom: 14px; }
.act-filter-box > summary { cursor: pointer; font-weight: 800; padding: 12px 16px; background: #f1f3fb; border-radius: 14px; list-style: none; display: block; }
.act-filter-box > summary::-webkit-details-marker { display: none; }
.act-filter-box[open] > summary { margin-bottom: 12px; }
@media (min-width: 901px) { .act-filter-box > summary { display: none; } }

/* ---- Abonos de ventas ---- */
.pay-line { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.m-item .pay-line { margin: 8px 0 0; }
.pay-chip { display: inline-block; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #eef0ff; color: #3a3fd8; white-space: nowrap; }
.pay-chip.ok { background: #dcfce7; color: #166534; }
.pay-chip.soon { background: #e0f7fb; color: #0e6a7d; }
.pay-chip.late { background: #fee2e2; color: #b91c1c; }
.pay-box { border: 2px solid #e3e6f5; border-radius: 18px; padding: 14px; margin: 14px 0; background: #f8f9ff; }
.pay-box-title { font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.pay-box .pay-balance { margin: 10px 0; }
.pay-summary { margin: 14px 0; padding: 14px; border-radius: 18px; background: #f8f9ff; border: 2px solid #e3e6f5; }
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.pay-grid small { display: block; font-size: 12px; font-weight: 700; color: #5b6388; }
.pay-grid b { display: block; font-size: 15px; margin-top: 2px; word-break: break-word; }
.pay-grid b.ok { color: #15803d; }
.pay-grid b.due { color: #b91c1c; }
.pay-bar { height: 10px; border-radius: 999px; background: #e3e6f5; margin: 12px 0 4px; overflow: hidden; }
.pay-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5b5bf5, #22d3ee); }
.pay-next { margin-top: 8px; font-size: 14px; padding: 8px 12px; border-radius: 12px; background: #e0f7fb; color: #0e6a7d; }
.pay-next.late { background: #fee2e2; color: #b91c1c; }
.pay-hist h4 { margin: 14px 0 6px; font-size: 14px; }
.pay-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #e8eaf6; }
.pay-row small { display: block; color: #5b6388; font-size: 12px; }
.pay-del { border: 0; background: #fee2e2; color: #b91c1c; width: 32px; height: 32px; border-radius: 10px; font-weight: 800; cursor: pointer; flex: none; }

/* ---- Confirmación de pagos ---- */
.pay-chip.wait { background: #fef3c7; color: #92400e; }
.pay-next.wait { background: #fef3c7; color: #92400e; }
.check-row { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 2px solid #e3e6f5; font-weight: 700; font-size: 14px; }
.check-row input { width: 22px !important; height: 22px; flex: none; margin: 0; accent-color: #5b5bf5; }
.pay-confirm { margin-top: 8px; }
.pay-undo { display: block; margin-top: 6px; border: 0; background: none; color: #5b6388; font-size: 12px; font-weight: 700; text-decoration: underline; padding: 0; cursor: pointer; }

/* ---- Cliente como dato principal en listados ---- */
.task-client { font-weight: 800; font-size: 16px; color: var(--color-text, #0b1026); line-height: 1.25; margin-bottom: 2px; }
.task-row .task-title { font-weight: 600; }

/* ---- Bloque Características (imagen + título + descripción) ---- */
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.feature-card { border: 1px solid var(--color-border, #e5e7eb); border-radius: 16px; overflow: hidden; background: #fff; display: flex; flex-direction: column; transition: transform .25s ease, box-shadow .25s ease; }
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15,23,42,.12); }
.feature-card-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.feature-card-body { padding: 16px 18px 18px; }
.feature-card-body h4 { margin: 0 0 6px; font-size: 17px; }
.feature-card-body p { margin: 0; line-height: 1.55; }
/* Editor */
.repeater-row-features { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--color-border, #e5e7eb); border-radius: 12px; margin-bottom: 10px; }
.feature-img-col { display: flex; flex-direction: column; gap: 6px; }
.feature-img-preview { display: flex; align-items: center; justify-content: center; width: 130px; height: 90px; border-radius: 10px; background: #f1f3fb; overflow: hidden; font-size: 12px; color: #6b7280; text-align: center; }
.feature-img-preview img { width: 100%; height: 100%; object-fit: cover; }
.feature-img-col input[type=file] { width: 130px; font-size: 11px; }
.feature-text-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.feature-text-col input, .feature-text-col textarea { width: 100%; }
@media (max-width: 640px) {
  .repeater-row-features { grid-template-columns: 1fr; }
  .feature-img-preview, .feature-img-col input[type=file] { width: 100%; }
  .feature-grid { gap: 10px; }
  .feature-card-body { padding: 10px 12px 14px; }
  .feature-card-body h4 { font-size: 15px; }
  .feature-card-body p { font-size: 13px; line-height: 1.45; }
}
