/* ============================================================
   Herconbyte CRM - estilos
   Paleta inspirada en el HTA: oscuro #0a0a12, neon #00f0ff
   ============================================================ */

:root {
    /* Tema oscuro (default) */
    --bg:        #0a0a12;
    --panel:    #13131f;
    --panel-2:  #1f1f2e;
    --card:     #1a1a26;
    --border:   #1f1f2e;
    --text:     #d1d1d1;
    --muted:    #888;
    --neon:     #00f0ff;
    --neon-2:   #0a58ca;
    --danger:   #ff4757;
    --warn:     #ffb946;
    --ok:       #00ff7f;
    --purple:   #7000ff;
    --shadow:   0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-strong: 0 8px 30px rgba(0, 240, 255, 0.12);
}

/* Tema claro */
[data-theme="light"] {
    --bg:        #f4f6fa;
    --panel:    #ffffff;
    --panel-2:  #eef2f7;
    --card:     #ffffff;
    --border:   #d8e0ea;
    --text:     #1a2233;
    --muted:    #6b7787;
    --neon:     #0a58ca;
    --neon-2:   #06b6d4;
    --danger:   #dc2626;
    --warn:     #d97706;
    --ok:       #059669;
    --purple:   #7c3aed;
    --shadow:   0 2px 8px rgba(15, 30, 60, 0.08);
    --shadow-strong: 0 6px 24px rgba(10, 88, 202, 0.12);
}

/* Ajustes especificos del tema claro (sombras, fondos translucidos) */
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .modal-backdrop, [data-theme="light"] .form-modal-backdrop, [data-theme="light"] .nota-modal-backdrop, [data-theme="light"] .trabajo-modal-backdrop { background: rgba(15, 30, 60, 0.45); }
[data-theme="light"] .login-overlay { background: linear-gradient(135deg, #e8edf5, #f4f6fa); }
[data-theme="light"] .login-card { background: #ffffff; border-color: var(--border); color: var(--text); }
[data-theme="light"] .login-card h2 { color: var(--text); }
[data-theme="light"] .barra-facturar { background: linear-gradient(135deg, #ffffff, #f4f6fa); }
[data-theme="light"] .factura-card.facturada { background: #e0f2fe; }
[data-theme="light"] .kpi-row.clickable.active { background: rgba(10, 88, 202, 0.10); }
[data-theme="light"] .ico-btn { background: #f1f5fa; }
[data-theme="light"] .trabajo-card.seleccionado { background: rgba(10, 88, 202, 0.06); }
[data-theme="light"] .nota-card:hover, [data-theme="light"] .kpi-row.clickable:hover { background: rgba(10, 88, 202, 0.06); }
[data-theme="light"] .toast { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); }
[data-theme="light"] .form-modal { box-shadow: 0 8px 40px rgba(15, 30, 60, 0.20); }
[data-theme="light"] .nota-modal, [data-theme="light"] .trabajo-modal { box-shadow: 0 8px 40px rgba(15, 30, 60, 0.20); }

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 15px;
    -webkit-text-size-adjust: 100%;
}
@media (max-width: 999px) { html, body { font-size: 16px; } }
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ============================================================
   Login Overlay
   ============================================================ */
.login-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: linear-gradient(135deg, #0a0a12 0%, #13131f 100%);
    display: flex; justify-content: center; align-items: center; padding: 20px;
}
.login-card {
    background: var(--panel); border: 1px solid var(--neon);
    box-shadow: 0 0 60px rgba(0,240,255,0.15);
    border-radius: 15px; padding: 40px; width: 420px; max-width: 100%;
    text-align: center;
}
.login-logo { height: 70px; border-radius: 8px; margin-bottom: 15px; }
.login-card h2 { color: var(--text); margin: 0 0 5px 0; font-weight: 600; font-size: 22px; }
.login-card h2 span { color: var(--neon); }
.login-tagline { color: var(--muted); margin: 0 0 25px 0; font-size: 14px; }
.login-help { color: var(--text); margin: 0 0 15px 0; font-size: 13px; }
.login-sentto { color: var(--neon); margin: 0 0 15px 0; font-size: 13px; }
.login-msg { color: var(--danger); min-height: 18px; margin: 10px 0 0 0; font-size: 13px; }

.otp-input {
    width: 100%; padding: 14px; background: var(--bg); border: 1px solid var(--panel-2);
    color: var(--text); font-size: 28px; border-radius: 8px; outline: none; text-align: center;
    letter-spacing: 12px; font-weight: bold;
}
.otp-input:focus { border-color: var(--neon); box-shadow: 0 0 15px rgba(0,240,255,0.25); }

.btn-cyan {
    width: 100%; padding: 14px; background: var(--neon); color: var(--bg);
    border: none; border-radius: 8px; font-weight: bold; font-size: 16px;
    cursor: pointer; margin-top: 15px; transition: filter 0.2s;
}
.btn-cyan:hover { filter: brightness(1.1); }
.btn-cyan:disabled { opacity: 0.6; cursor: wait; }
.btn-link {
    width: 100%; padding: 8px; background: transparent; color: var(--muted);
    border: none; font-size: 12px; cursor: pointer; margin-top: 8px;
    text-decoration: underline;
}

/* ============================================================
   App Shell
   ============================================================ */
/* 100dvh (08/10/26): en el navegador del celular 100vh es el alto SIN la barra
   de direcciones, y con la barra a la vista el pie de .app (el panel de
   Soporte acoplado) quedaba debajo del borde. dvh es lo que se ve; en la PC
   vale lo mismo que vh. El primero queda para navegadores sin dvh. */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; position: relative; }

.sidebar {
    position: fixed; top: 0; bottom: 0; left: -260px;
    width: 240px; background: var(--panel); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; flex-shrink: 0;
    z-index: 8500; transition: left 0.25s ease;
}
.sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,0.5); }

/* PINNED: desktop only — sidebar fija, content con margen */
.app.sidebar-pinned .sidebar { left: 0; box-shadow: none; }
.app.sidebar-pinned .sidebar.open { box-shadow: none; }
.app.sidebar-pinned .main { margin-left: 240px; }
.app.sidebar-pinned .sidebar-backdrop { display: none !important; }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 8400;
}
.sidebar.open ~ .sidebar-backdrop { display: block; }
/* Hover-open en desktop: NO mostrar el backdrop oscuro */
.sidebar.open.hover-open ~ .sidebar-backdrop { display: none; }

.pin-btn {
    position: absolute; top: 10px; right: 10px;
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg); border: 1px solid var(--panel-2);
    color: var(--muted); cursor: pointer; font-size: 12px;
    padding: 5px 10px; border-radius: 5px; z-index: 2;
    transition: all 0.2s;
}
.pin-btn:hover { color: var(--neon); border-color: var(--neon); }
.pin-btn .pin-icon { font-size: 13px; transition: transform 0.2s; }
.app.sidebar-pinned .pin-btn { color: var(--neon); border-color: var(--neon); background: rgba(0,240,255,0.08); }
.app.sidebar-pinned .pin-btn .pin-icon { transform: rotate(45deg); }
.sidebar .logo-area {
    text-align: center; padding: 25px 15px 15px; border-bottom: 1px solid var(--border);
}
.sidebar .logo-area img { height: 50px; border-radius: 6px; }
.sidebar .logo-area h2 { margin: 8px 0 0; color: var(--text); font-size: 18px; font-weight: 600; }
.sidebar .logo-area h2 span { color: var(--neon); }
.sidebar .logo-area small { color: var(--muted); font-size: 11px; }

.nav-menu { flex: 1; overflow-y: auto; padding: 15px 0; }
.nav-btn {
    display: block; padding: 12px 22px; color: var(--text); font-size: 14px;
    cursor: pointer; border-left: 3px solid transparent; transition: all 0.15s;
    text-decoration: none;
}
.nav-btn:hover { background: rgba(0,240,255,0.05); color: var(--neon); text-decoration: none; }
.nav-btn.active {
    background: rgba(0,240,255,0.08); color: var(--neon); border-left-color: var(--neon);
}
.sidebar-footer {
    padding: 8px 10px;
    border-top: 1px solid var(--border);
}
/* Botones de acción compactos en el footer (Tema, Sync, Huella, Logout) */
.footer-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.footer-action {
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.footer-action:hover {
    color: var(--neon);
    border-color: var(--neon);
    background: rgba(0, 240, 255, 0.06);
}
.footer-action.danger:hover {
    color: var(--danger);
    border-color: rgba(255, 71, 87, 0.45);
    background: rgba(255, 71, 87, 0.06);
}
.footer-action:focus { outline: none; }
@media (max-width: 700px) {
    .footer-action { padding: 10px 0; font-size: 20px; }
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.topbar {
    display: flex; align-items: center; gap: 20px;
    padding: 14px 25px; background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 8450;     /* arriba del sidebar-backdrop (8400) para que los chips reciban click directo */
}
.search-bar {
    flex: 1; max-width: 480px;
    padding: 10px 14px; background: var(--bg); border: 1px solid var(--panel-2);
    color: var(--text); border-radius: 8px; outline: none; font-size: 14px;
}
/* Botón lupa: solo se ve en mobile (activado vía media query).
   !important porque .topbar-chip (que también lleva) define display:inline-flex más abajo. */
.topbar-search-btn { display: none !important; }

/* Chip de cliente relacionado (en "Te recomendaron") */
.rel-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--border);
    color: var(--neon);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.12s;
}
.rel-chip:hover { background: rgba(0, 240, 255, 0.15); border-color: var(--neon); }
.rel-chip-libre {
    background: var(--panel-2) !important;
    color: var(--muted) !important;
    border-style: dashed !important;
    cursor: default;
}
.rel-chip-libre:hover { background: var(--panel-2) !important; border-color: var(--border) !important; }
.rel-chip-fix {
    background: var(--neon);
    color: var(--bg);
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    font-size: 11px;
    cursor: pointer;
    line-height: 1;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    vertical-align: middle;
}
.rel-chip-fix:hover { transform: scale(1.15); }
.rel-chip-more {
    background: var(--neon) !important;
    color: var(--bg) !important;
    border-color: var(--neon) !important;
    font-weight: 600;
    cursor: pointer;
}

/* Filas clickeables de la tabla de cotización actual (cada tipo abre modal histórico) */
.dolar-row-clickable { transition: background 0.15s; }
.dolar-row-clickable:hover { background: rgba(0, 240, 255, 0.06); }

/* Tabla histórico dólar — expand/collapse mes → día → hora */
.dolar-hist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dolar-hist-table thead tr {
    background: var(--panel-2);
    border-bottom: 2px solid var(--border);
}
.dolar-hist-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
}
.dolar-hist-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.dolar-hist-table .dh-mes { background: rgba(0, 240, 255, 0.04); }
.dolar-hist-table .dh-mes:hover { background: rgba(0, 240, 255, 0.08); }
.dolar-hist-table .dh-dia { background: rgba(255,255,255,0.02); }
.dh-toggle {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--neon);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-right: 8px;
    line-height: 1;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    padding: 0;
}
.dh-toggle:hover { background: var(--panel-2); border-color: var(--neon); }

/* Tabs del modal Dólar (Actual / Histórico) */
.dolar-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
}
.dolar-tab:hover { color: var(--text); }
.dolar-tab.active {
    color: var(--neon);
    border-bottom-color: var(--neon);
}

/* === FAB flotante "Nuevo cliente" — siempre visible en la columna de Clientes === */
.col-master { position: relative; }
.fab-clientes {
    position: absolute;
    bottom: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--neon);
    color: var(--bg);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 240, 255, 0.35);
    z-index: 50;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.15s;
}
.fab-clientes:hover { transform: scale(1.05); }
.fab-clientes:active { transform: scale(0.92); }
[data-theme="light"] .fab-clientes {
    box-shadow: 0 4px 14px rgba(10, 88, 202, 0.30);
}
@media (max-width: 700px) {
    .fab-clientes {
        position: fixed;       /* fixed en mobile — no scrollea con la lista */
        /* arriba del panel de Soporte acoplado (su alto ya trae la franja de gestos) */
        bottom: calc(20px + var(--dock-h, 0px) + var(--sd-safe-b, env(safe-area-inset-bottom, 0px)));
        right: 16px;
    }
}

/* === Modal de búsqueda (mobile) - sheet desde arriba estilo iOS Spotlight === */
.search-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    padding-top: max(50px, env(safe-area-inset-top));
    animation: searchFadeIn 0.15s ease-out;
    /* El velo OSCURECE pero no bloquea: este buscador filtra la lista de atras
       y hay que poder tocar un resultado sin cerrarlo primero. Sin esto el
       click no llegaba a la tarjeta del cliente y parecia que no hacia nada.
       El cierre "al tocar afuera" lo maneja openSearchModal() por JS. */
    pointer-events: none;
}
.search-modal-overlay .search-modal-inner { pointer-events: auto; }

/* ============================================================
   Cajón de clientes: la lista disponible desde cualquier vista.

   z-index 10200: arriba de la barra superior (8450) y del modal de trabajo
   (9000), y DEBAJO del modal de formulario (11000) y de las confirmaciones
   (1800 propio del backdrop), para no tapar nada que se abra desde acá.
   ============================================================ */
.cli-drawer-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10190;
    animation: searchFadeIn .15s ease-out;
}
.cli-drawer {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 340px; max-width: 88vw;
    z-index: 10200;
    background: var(--panel);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    display: flex; flex-direction: column;
    animation: cliDrawerIn .18s ease-out;
}
@keyframes cliDrawerIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.cli-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px;
    padding-top: max(14px, env(safe-area-inset-top));
    color: var(--neon); font-size: 15px;
}
.cli-drawer-input {
    margin: 0 14px 10px;
    padding: 10px 12px;
    background: var(--bg); border: 1px solid var(--panel-2); border-radius: 8px;
    color: var(--text); outline: none; font-size: 16px;   /* 16px: evita el zoom de iOS */
}
.cli-drawer-input:focus { border-color: var(--neon); }
.cli-drawer-select {
    margin: 0 14px 10px;
    padding: 8px 10px;
    background: var(--bg); border: 1px solid var(--panel-2); border-radius: 8px;
    color: var(--text); outline: none; font-size: 13px; cursor: pointer;
}
/* El scroll va acá adentro, no en la página: la lista puede ser larga. */
.cli-drawer-list { flex: 1; overflow-y: auto; padding: 0 10px 8px; }
.cli-drawer-nuevo {
    margin: 8px 14px;
    margin-bottom: max(14px, env(safe-area-inset-bottom));
    padding: 11px;
    background: var(--neon); color: var(--bg);
    border: 0; border-radius: 8px; font-weight: bold; cursor: pointer;
}
.cli-drawer-head .col-count { margin-left: 8px; }
/* El ÚNICO ＋ de alta de cliente (08/10/26): en la cabecera del cajón, solo el símbolo.
   Abre el alta (cargarlo uno o mandar el link); el número son las altas esperando. */
.cli-drawer-mas {
    position: relative;
    width: 34px; height: 34px; margin-left: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--neon); color: var(--bg);
    border: 0; border-radius: 50%;
    font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
}
.cli-drawer-mas:active { transform: scale(0.92); }
.cli-drawer-mas-n {
    position: absolute; top: -5px; right: -7px;
    background: var(--danger); color: #fff;
    border-radius: 10px; padding: 1px 5px; font-size: 10px; font-weight: 700;
}

/* Buscador propio de cada lista (KnowHow, Bóveda, Trabajos).
   Va acá y no en la topbar porque la barra de arriba se oculta abajo de
   1000px, y esas pantallas quedaban sin manera de buscar. Mismo aspecto que el
   del cajón de clientes para que se lean como la misma herramienta.
   16px de fuente: abajo de eso, iOS hace zoom al enfocar el campo. */
.col-search {
    display: block;
    width: calc(100% - 20px);
    margin: 0 10px 10px;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--panel-2);
    border-radius: 8px;
    color: var(--text);
    outline: none;
    font-size: 16px;
}
.col-search:focus { border-color: var(--neon); }
@keyframes searchFadeIn {
    from { opacity: 0 }
    to   { opacity: 1 }
}
.search-modal-inner {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    animation: searchSlideDown 0.22s ease-out;
}
@keyframes searchSlideDown {
    from { transform: translateY(-20px) }
    to   { transform: translateY(0) }
}
.search-modal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 12px;
}
.search-modal-icon {
    font-size: 18px;
    opacity: 0.7;
}
#searchModalInput {
    flex: 1;
    border: none !important;
    background: transparent !important;
    color: var(--text);
    font-size: 17px !important;
    padding: 12px 4px;
    outline: none;
    min-height: 44px;
}
.search-modal-help {
    margin: 10px 4px 0;
    font-size: 12px;
    color: var(--muted);
}
.search-bar:focus { border-color: var(--neon); box-shadow: 0 0 10px rgba(0,240,255,0.2); }
.topbar-title { color: var(--neon); font-size: 16px; font-weight: 600; margin-left: auto; }

.view-container { flex: 1; overflow-y: auto; padding: 25px; }

/* ============================================================
   Panel de Control - estilo dashboard 4 columnas
   ============================================================ */
.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px; margin-bottom: 25px;
}
.kpi-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 18px;
}
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.kpi-value { color: var(--neon); font-size: 26px; font-weight: 700; margin-top: 6px; text-shadow: 0 0 12px rgba(0,240,255,0.4); }
.kpi-value.danger { color: var(--danger); text-shadow: 0 0 12px rgba(255,71,87,0.4); }
.kpi-value.ok    { color: var(--ok); text-shadow: 0 0 12px rgba(0,255,127,0.4); }

/* KPI sticky en el modal de trabajo: queda pegado arriba mientras scrolleás */
.kpi-grid.sticky-top {
    position: sticky;
    top: -1px;
    z-index: 5;
    background: var(--bg);
    /* Sin margen negativo lateral: sobresalía 16px y sumaba scroll horizontal */
    margin: 0 0 14px;
    padding: 10px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    gap: 8px;
}
.kpi-grid.sticky-top .kpi-card {
    padding: 10px 14px;
}
.kpi-grid.sticky-top .kpi-value { font-size: 20px; }
.kpi-grid.sticky-top .kpi-label { font-size: 10px; }
[data-theme="light"] .kpi-grid.sticky-top {
    background: #fff;
    box-shadow: 0 4px 8px rgba(15,30,60,0.06);
}

/* Input dentro de un KPI card — se ve grande como el .kpi-value pero editable */
.kpi-card.editable { border-color: var(--neon); background: rgba(0,240,255,0.04); }
.kpi-value-input {
    background: transparent;
    border: 0;
    border-bottom: 1px dashed rgba(0,240,255,0.4);
    color: var(--neon);
    font-size: 26px;
    font-weight: 700;
    margin-top: 6px;
    text-shadow: 0 0 12px rgba(0,240,255,0.4);
    width: 100%;
    padding: 2px 0;
    font-family: inherit;
    -moz-appearance: textfield;
}
.kpi-value-input::-webkit-outer-spin-button,
.kpi-value-input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}
.kpi-value-input:focus {
    outline: none;
    border-bottom-color: var(--neon);
    border-bottom-style: solid;
}
.kpi-grid.sticky-top .kpi-value-input { font-size: 20px; }

.dashboard-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 999px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 20px;
}
.card h3 { margin: 0 0 15px; color: var(--neon); font-size: 16px; font-weight: 600; }

/* ============================================================
   Listas (clientes, trabajos, etc.)
   ============================================================ */
.list-item {
    display: flex; align-items: center; gap: 15px;
    padding: 12px 15px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); margin-bottom: 8px; cursor: pointer; transition: all 0.15s;
}
.list-item:hover { border-color: var(--neon); transform: translateX(3px); }
.list-avatar {
    width: 44px; height: 44px; border-radius: 50%; background: var(--panel-2);
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    color: var(--neon); font-weight: 700; flex-shrink: 0;
}
.list-main { flex: 1; min-width: 0; }
.list-title { color: var(--text); font-weight: 600; font-size: 15px; }
.list-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.list-right { text-align: right; }
.list-amount { color: var(--neon); font-weight: 700; }
.list-amount.danger { color: var(--danger); }

/* ============================================================
   Trabajo cards (estilo AppSheet)
   ============================================================ */
.trabajo-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 18px; margin-bottom: 12px; cursor: pointer; transition: all 0.15s;
}
.trabajo-card:hover { border-color: var(--neon); }
.trabajo-header {
    color: var(--text); font-weight: 600; font-size: 15px; margin-bottom: 6px;
}
.trabajo-meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.trabajo-desc { color: var(--text); font-size: 13px; line-height: 1.4; margin-bottom: 10px; }
.trabajo-honorarios {
    color: var(--danger); font-weight: 700; font-size: 14px;
    padding-top: 10px; border-top: 1px solid var(--border);
}
.trabajo-honorarios.pagado { color: var(--ok); }
/* «(Pendiente: $x)» / «(Pagado el dd/mm/aa)» al lado del valor: mismo color, más liviano */
.trabajo-honorarios .t-pago { font-weight: 400; font-size: 0.85em; white-space: nowrap; }
.trabajo-actions {
    display: flex; gap: 12px; margin-top: 10px;
}
.trabajo-actions a { font-size: 12px; color: var(--neon); }

/* ============================================================
   Tabla
   ============================================================ */
table {
    width: 100%; border-collapse: collapse;
}
th, td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--neon); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: rgba(0,240,255,0.03); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-neon { color: var(--neon); font-weight: 600; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-ok { color: var(--ok); font-weight: 600; }

/* ============================================================
   Forms / Modales
   ============================================================ */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-row input, .form-row select, .form-row textarea {
    width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--panel-2);
    color: var(--text); border-radius: 6px; font-family: inherit; font-size: 14px; outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--neon); }
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
    padding: 10px 18px; border: none; border-radius: 6px; cursor: pointer;
    font-weight: 600; font-size: 13px; transition: all 0.15s;
}
.btn-primary { background: var(--neon); color: var(--bg); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--panel-2); color: var(--text); }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger); color: #fff; }

.modal-backdrop {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(5,5,8,0.7); display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal {
    background: var(--panel); border: 1px solid var(--neon);
    border-radius: 12px; padding: 24px; width: 520px; max-width: 100%;
    max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 18px; color: var(--neon); }

/* ============================================================
   Loading + Toasts
   ============================================================ */
.loading-overlay {
    /* 12900: por ENCIMA de cualquier modal (llegan a 12800) y debajo de los toasts (13000). Estaba en
       11500 y al emitir desde Cobrar/Facturar el «Emitiendo…» quedaba atrás del modal (22/10/26). */
    position: fixed; inset: 0; background: rgba(10,10,18,0.7); z-index: 12900;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.spinner {
    width: 48px; height: 48px; border: 4px solid var(--panel-2);
    border-top-color: var(--neon); border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toasts {
    position: fixed; top: 20px; right: 20px; z-index: 13000;  /* arriba de todo, incluso confirm modal */
    display: flex; flex-direction: column; gap: 10px;
    /* 16/11/26: el aviso de texto no se come los toques. Arriba a la derecha tapaba el ✕ de los cuadros y en el celular
       (abajo, a lo ancho) los botones Enviar / Enviar y finalizar del ticket por 4 s: el toque caía en el cartel. Los que
       traen un link o un botón (Conectando…, Claude Code terminó) siguen tocables. */
    pointer-events: none;
}
.toasts > .toast:has(a, button) { pointer-events: auto; }
.toast {
    background: var(--panel); border-left: 4px solid var(--neon);
    padding: 12px 18px; border-radius: 6px; color: var(--text); min-width: 240px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    animation: slide-in 0.3s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }
@keyframes slide-in { from { transform: translateX(120%); } to { transform: translateX(0); } }

/* === Historial de notificaciones por trabajo (card en detail) === */
.notif-hist-card {
    background: rgba(0,240,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
}
.notif-hist-list {
    display: flex; flex-direction: column; gap: 6px;
}
.notif-row {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 6px 8px; border-radius: 6px;
    background: rgba(255,255,255,0.02);
}
.notif-row:hover { background: rgba(0,240,255,0.06); }
.notif-ico { font-size: 16px; line-height: 1.5; }
.notif-main { flex: 1; min-width: 0; }
.notif-line { color: var(--text); font-size: 13px; word-break: break-all; }
.badge.ok      { background: rgba(0,255,127,0.15); color: var(--ok); }
.badge.danger  { background: rgba(255,71,87,0.15); color: var(--danger); }
.badge.warn    { background: rgba(255,185,70,0.15); color: var(--warn); }

/* === Facturador embebido (iframe modal) ===
   z-index 11200: arriba del form modal (11000) y del backdrop (9000),
   pero abajo del loading (11500) y del confirm (12000). */
.facturador-iframe-backdrop {
    position: fixed; inset: 0; background: rgba(5,5,12,0.85);
    z-index: 11200; display: flex; flex-direction: column;
}
.facturador-iframe-header {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.facturador-iframe-header h3 {
    margin: 0; flex: 1; color: var(--text); font-size: 15px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.facturador-iframe-header .fi-btn {
    background: var(--panel-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px;
    padding: 6px 12px; font-size: 13px; cursor: pointer;
    transition: background .15s;
}
.facturador-iframe-header .fi-btn:hover { background: rgba(0,240,255,0.1); border-color: var(--neon); }
.facturador-iframe-header .fi-btn.back { background: var(--neon); color: #000; border-color: var(--neon); font-weight: 600; }
.facturador-iframe-header .fi-btn.back:hover { background: #00d4e0; }
.facturador-iframe-body {
    flex: 1; background: #fff; overflow: hidden; position: relative;
}
.facturador-iframe-body iframe {
    width: 100%; height: 100%; border: 0; display: block;
}
.facturador-iframe-loader {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 14px; background: rgba(255,255,255,0.95); color: #333;
}

/* Util */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }

.badge {
    display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px;
    background: var(--panel-2); color: var(--muted);
}
.badge.activo { background: rgba(0,255,127,0.15); color: var(--ok); }
.badge.inactivo { background: rgba(255,71,87,0.15); color: var(--danger); }
.badge.venta { background: rgba(255,185,70,0.15); color: var(--warn); }

.empty-state {
    text-align: center; padding: 60px 20px; color: var(--muted);
}

/* ============================================================
   Vista cliente: layout vertical compacto
   - KPIs en fila horizontal arriba
   - Datos contacto en grid responsivo abajo (sin espacio en blanco)
   ============================================================ */
.cli-top-grid { display: block; margin: 12px 0 14px; }

/* === KPIs en fila horizontal (modo kpi-horiz) === */
.kpi-stack.kpi-horiz {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    background: transparent;
    border: none;
    margin: 0 0 10px;
    overflow: visible;
}
.kpi-stack.kpi-horiz .kpi-row {
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--bg);
    gap: 4px;
}
.kpi-stack.kpi-horiz .kpi-row-label { font-size: 11px; }
.kpi-stack.kpi-horiz .kpi-row-value { font-size: 17px; }
.kpi-stack.kpi-horiz .kpi-row.active {
    background: rgba(0, 240, 255, 0.10);
    border-color: var(--neon);
    padding-left: 12px;
    border-left-width: 1px;
}
.kpi-stack.kpi-horiz .kpi-row.kpi-pag.active   { border-color: var(--ok); background: rgba(46, 213, 115, 0.10); }
.kpi-stack.kpi-horiz .kpi-row.kpi-pend.active  { border-color: var(--danger); background: rgba(255, 71, 87, 0.10); }
.kpi-stack.kpi-horiz .kpi-row.kpi-fact.active  { border-color: #00f0ff; background: rgba(0, 240, 255, 0.10); }

/* === Datos contacto en GRID 2 columnas compacto, cada fila en UNA línea
   (label inline + valor + acciones) para ahorrar espacio vertical. === */
.data-list.data-list-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.data-list.data-list-grid .data-row {
    padding: 6px 4px;
    grid-template-columns: 90px 1fr auto;
    grid-template-areas: "label value action";
    align-items: center;
    gap: 8px;
    border-bottom-color: rgba(255,255,255,0.04);
    font-size: 13px;
}
.data-list.data-list-grid .data-label {
    font-size: 11px;
    margin-bottom: 0;
    text-align: left;
    white-space: nowrap;
}
.data-list.data-list-grid .data-value {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-list.data-list-grid .data-action {
    margin-left: 0;
}
.data-list.data-list-grid .data-action .ico-btn {
    width: 28px; height: 28px; font-size: 13px;
}
.data-list.data-list-grid .data-row-wide { grid-column: 1 / -1; }
/* Dirección y "Fue recomendado..." con valores largos: dejarles label arriba */
.data-list.data-list-grid .data-row-wide {
    grid-template-columns: 1fr auto;
    grid-template-areas: "label label" "value action";
}
.data-list.data-list-grid .data-row-wide .data-label { font-size: 11px; }

/* Fila de recomendaciones: "Recomendó a" y "Fue recomendado/a por" van en la
   MISMA línea, que casi siempre son uno o dos chips cada uno y apilados
   desperdiciaban media ficha.

   Va con flex-wrap y no con grid de columnas fijas a propósito: así se acomoda
   solo según el lugar que haya. Con grid hacía falta una regla por cada ancho
   (había dos, y una apilaba justo en el ancho más usado); con `flex: 1 1 170px`
   se ponen al lado cuando entran y se apilan cuando no, sin media queries. */
.data-row-recom {
    display: flex !important;
    flex-wrap: wrap;
    grid-template-areas: none !important;
    gap: 8px 18px !important;
    align-items: flex-start !important;
    padding: 8px 6px !important;
}
.recom-block {
    display: flex; flex-direction: column; gap: 4px;
    flex: 1 1 170px;    /* 170px es el mínimo para que entre un chip con nombre */
    min-width: 0;
}
.recom-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.recom-block .data-label { font-size: 11px; white-space: nowrap; }

@media (max-width: 900px) {
    .data-list.data-list-grid { grid-template-columns: 1fr; gap: 0; }
}

/* ============================================================
   Vista cliente: KPIs apilados verticalmente
   ============================================================ */
.kpi-stack {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    margin: 12px 0 14px; overflow: hidden;
}
.kpi-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; border-bottom: 1px solid var(--border);
}
.kpi-row:last-child { border-bottom: none; }
.kpi-row-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-row-value { font-size: 15px; font-weight: 700; color: var(--neon); }
.kpi-row.clickable { cursor: pointer; transition: background 0.15s; }
.kpi-row.clickable:hover { background: rgba(0, 240, 255, 0.06); }
/* Activo - color depende de la categoria del KPI */
.kpi-row.clickable.active {
    background: rgba(0, 240, 255, 0.10);
    border-left: 3px solid var(--neon);
    padding-left: 11px;
}
/* Colores individuales por tipo de KPI */
.kpi-row.kpi-total .kpi-row-value  { color: var(--neon); }
.kpi-row.kpi-fact  .kpi-row-value  { color: #00f0ff; }
.kpi-row.kpi-pag   .kpi-row-value  { color: var(--ok); }
.kpi-row.kpi-pend  .kpi-row-value  { color: var(--danger); }
.kpi-row.kpi-fact.active  { background: rgba(0, 240, 255, 0.10); border-left-color: #00f0ff; }
.kpi-row.kpi-pag.active   { background: rgba(46, 213, 115, 0.10); border-left-color: var(--ok); }
.kpi-row.kpi-pend.active  { background: rgba(255, 71, 87, 0.10); border-left-color: var(--danger); }
.text-neon { color: var(--neon) !important; }

/* Badges en cards de trabajos */
.t-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-decoration: none;
}
.t-badge.fact {
    background: rgba(0, 240, 255, 0.15);
    color: var(--neon);
    border: 1px solid var(--neon);
}
.t-badge.fact:hover { background: rgba(0, 240, 255, 0.30); }
.t-badge.no-fact {
    background: rgba(136, 136, 136, 0.15);
    color: var(--muted);
    border: 1px solid var(--muted);
}

/* Botonera de fuentes de IPC: los botones van EN LÍNEA y del ancho de su texto.
   Hay que anular dos cosas que vienen de las clases base y rompen el flex:
     .btn-cyan → width:100% + padding 14px + font-size 16px (queda enorme y solo)
     .btn-mini → margin-left:auto (empuja el resto y fuerza el salto de línea) */
.ipc-fuentes-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.ipc-fuentes-btns > .btn-cyan,
.ipc-fuentes-btns > .btn-mini,
.ipc-fuentes-btns > a.btn-mini {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.3;
    border-radius: 5px;
}

/* Botón que reemplaza a la lista de notas cuando la columna es angosta.
   Oculto por defecto: sólo aparece en el layout de 2 columnas. */
.notas-compacto {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.notas-compacto:hover { border-color: var(--neon); background: var(--panel-2); }
.notas-compacto small { color: var(--muted); font-weight: 400; font-size: 11px; }

/* ============================================================
   Divisor arrastrable entre la ficha del cliente y sus trabajos.
   El ancho elegido se guarda en localStorage y se aplica como
   variable CSS sobre .three-cols.cli-view.
   ============================================================ */
.col-resizer {
    display: none;              /* sólo en el layout de 2 columnas */
    position: absolute;
    top: 0;
    bottom: 0;
    width: 11px;
    margin-left: -5px;
    cursor: col-resize;
    z-index: 20;
    touch-action: none;
}
.col-resizer::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: var(--border);
    transition: background 0.15s;
}
.col-resizer:hover::before,
.col-resizer.arrastrando::before { background: var(--neon); }
/* Mientras se arrastra: sin selección de texto ni cursor cambiante */
body.resizing-cols { cursor: col-resize; user-select: none; }
body.resizing-cols iframe { pointer-events: none; }

/* En las tarjetas de equipo/nota dentro de la ficha del cliente el avatar 💻 es
   decorativo y se comía el ancho del dato (marca, modelo, S/N). Prioridad al
   texto: el icono se achica y se saca de la línea principal. */
.t-cell .list-item .list-avatar,
.t-cell .list-item .list-avatar.small {
    width: 22px;
    height: 22px;
    font-size: 12px;
    background: transparent;
    align-self: flex-start;
    margin-top: 1px;
}
.t-cell .list-item.compact {
    align-items: flex-start;
    gap: 7px;
    padding: 7px 8px;
}
.t-cell .list-item .list-main { min-width: 0; }
.t-cell .list-item .list-title { font-size: 13px; line-height: 1.3; }
.t-cell .list-item .list-sub {
    font-size: 11px;
    line-height: 1.4;
    word-break: break-word;   /* S/N largos cortan por caracter, pero sin romper la fila */
}

/* Comentarios del equipo (clave, IP, etc.): sólo un icono en la tarjeta.
   El texto completo va en el modal, así la tarjeta no crece ni se corta.
   Ojo con la especificidad: `.list-item .equipo-edit-btn` pone opacity:0
   (los botones aparecen al hover), y el indicador de comentarios tiene que
   verse SIEMPRE, sin pasar el mouse. */
.list-item .equipo-edit-btn.eq-notas-btn.tiene {
    opacity: 1;
    background: rgba(255, 193, 7, 0.16);
    border-color: rgba(255, 193, 7, 0.75);
    color: var(--text);
}
.list-item .equipo-edit-btn.eq-notas-btn.tiene:hover { background: rgba(255, 193, 7, 0.32); }

/* Los botones no se comprimen: el texto de la tarjeta cede espacio, no ellos */
.list-item .equipo-edit-btn { flex-shrink: 0; }
.list-item.compact .list-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Estado del ticket (abierto / cerrado) — distinto del rojo/verde de pago. */
.t-estado {
    display: inline-block;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 10px;
    margin-right: 6px;
    font-weight: 700;
    letter-spacing: 0.3px;
    vertical-align: middle;
    white-space: nowrap;
}
.t-estado.abierto {
    background: rgba(255, 165, 0, 0.16);
    color: #d98200;
    border: 1px solid rgba(255, 165, 0, 0.55);
}
.t-estado.cerrado {
    background: rgba(136, 136, 136, 0.15);
    color: var(--muted);
    border: 1px solid var(--muted);
}

/* Tarjeta de factura en modal trabajo */
.factura-card { padding: 16px; }
.factura-card.facturada { border-left: 4px solid var(--neon); background: rgba(0, 240, 255, 0.04); }
.factura-card.no-fact   { border-left: 4px solid var(--muted); }
.factura-card h3 { margin-top: 0; }

/* Estado del mail dentro de la card de factura */
.mail-status {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 8px;
}
.mail-status.ok    { background: rgba(46, 213, 115, 0.08); color: var(--ok);    border: 1px solid rgba(46, 213, 115, 0.3); }
.mail-status.err   { background: rgba(255, 71, 87, 0.08);  color: var(--danger); border: 1px solid rgba(255, 71, 87, 0.3); }
.mail-status.warn  { background: rgba(255, 187, 0, 0.08);  color: #ffbb00;       border: 1px solid rgba(255, 187, 0, 0.3); }
.mail-status.muted { background: var(--bg);                color: var(--muted); border: 1px solid var(--border); }

/* Chip filtro "solo facturados" */
.chip-filter.fact { background: rgba(0, 240, 255, 0.15); color: var(--neon); border: 1px solid var(--neon); }

/* ============================================================
   Seleccion multiple de trabajos para facturar AFIP
   ============================================================ */
.trabajo-card.narrow {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    align-items: center;
}
.trab-check {
    display: flex; align-items: center; justify-content: center;
    height: 100%;
}
.trab-check input[type=checkbox] {
    width: 18px; height: 18px;
    accent-color: var(--neon);
    cursor: pointer;
}
.trab-check.disabled { width: 18px; visibility: hidden; }
.trabajo-card.seleccionado {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--neon);
}

/* Barra flotante de facturacion */
.barra-facturar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(13, 13, 22, 0.98), rgba(20, 20, 35, 0.98));
    border-top: 2px solid var(--neon);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;     /* info arriba, botones abajo */
    align-items: stretch;
    gap: 10px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 240, 255, 0.15);
    margin-top: 14px;
    border-radius: 8px;
}
.barra-facturar > span:first-child {
    color: var(--text);
    font-size: 14px;
}
.barra-facturar #bfTotal { color: var(--neon); font-size: 16px; }

/* Fila de acciones: los 5 botones alineados abajo, mismo tamaño */
.bf-actions {
    display: flex;
    gap: 6px;
    align-items: stretch;
    flex-wrap: wrap;            /* en pantallas angostas, bajan a 2da fila */
}
.bf-actions button {
    flex: 1 1 90px;            /* mismo tamaño, mínimo 90px antes de envolver */
    min-width: 0;
    padding: 8px 4px;
    font-size: 12px;
    line-height: 1.15;
    white-space: normal;
    text-align: center;
}

/* ============================================================
   Upload de foto del cliente en el modal de edicion
   ============================================================ */
.foto-upload {
    display: flex;
    gap: 12px;
    align-items: stretch;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.foto-preview {
    width: 80px; height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--panel-2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--border);
}
.foto-preview img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.foto-preview .foto-placeholder {
    color: var(--muted);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: 1px;
}

/* ============================================================
   Vista cliente: data-list con botones de accion
   ============================================================ */
.data-list {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    overflow: hidden; margin-bottom: 14px;
}
.data-list.compact .data-row { padding: 6px 12px; }
.data-list-empty {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px;
    color: var(--muted); font-size: 13px;
    background: rgba(255, 71, 87, 0.04);
    border-color: rgba(255, 71, 87, 0.3);
}
.data-row {
    display: grid;
    /* Layout: LABEL chiquito arriba (titulo) + VALUE abajo en linea con ACTION
       Esto evita que valores largos (mails, direcciones) se aprieten en una columna estrecha */
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "label  label"
        "value  action";
    align-items: center;
    gap: 2px 8px;
    padding: 8px 14px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.data-row:last-child { border-bottom: none; }
.data-label {
    grid-area: label;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1px;
}
.data-value {
    grid-area: value;
    color: var(--text);
    word-break: break-word;
    font-size: 14px;
}
.data-action {
    grid-area: action;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-self: center;
}

.ico-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: var(--panel-2); color: var(--text);
    border: 1px solid transparent; border-radius: 6px;
    cursor: pointer; font-size: 15px;
    text-decoration: none;
    transition: all 0.15s;
}
.ico-btn:hover { border-color: var(--neon); color: var(--neon); text-decoration: none; transform: translateY(-1px); }
.ico-btn.wa:hover { border-color: #25d366; color: #25d366; }

/* ============================================================
   Layout en T (Notas | Equipos) - mas alto en desktop para que se vean bien
   ============================================================ */
.t-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 14px;
    min-height: 340px;
    align-items: start;
}
.t-cell {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    padding: 12px;
    max-height: 60vh;
    overflow-y: auto;
}
.t-cell .col-section-title { margin-top: 0; }

.nota-item {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.nota-item:last-child { border-bottom: none; }
.nota-titulo {
    color: var(--neon); font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 3px;
}
.nota-texto { color: var(--text); line-height: 1.4; }

/* Buscador interno de notas */
.notas-search {
    width: 100%;
    padding: 7px 10px;
    margin-bottom: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
}
.notas-search:focus {
    border-color: var(--neon);
    box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.10);
}
.notas-search::placeholder { color: var(--muted); }

/* Notas como tarjetas clickeables (mismo estilo visual que equipo cards) */
.nota-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.nota-card:hover {
    border-color: var(--neon);
    background: rgba(0, 240, 255, 0.04);
    transform: translateY(-1px);
}
.nota-card .nota-titulo {
    color: var(--neon); font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.nota-card .nota-preview {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Modal de nota: contenido completo */
.nota-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 10500;   /* arriba del trabajo modal (9000) — nota puede abrirse desde adentro */
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.nota-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding: 0;
}
/* Header: título a la izquierda, acciones (editar/eliminar/cerrar) alineadas a la derecha sin solaparse */
.nota-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-shrink: 0;
}
.nota-titulo-full {
    color: var(--neon);
    margin: 0;
    font-size: 18px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nota-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.nota-actions .btn-mini.danger {
    color: var(--danger);
    border-color: rgba(255, 71, 87, 0.3);
}
/* Close: separado visualmente del resto de los botones con un divider y margen */
.nota-modal .modal-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 6px;
    margin-left: 6px;
    border-left: 1px solid var(--border);
    padding-left: 12px;
    border-radius: 0;
}
.nota-modal .modal-close:hover {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.06);
}
.nota-modal .modal-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
}
.nota-full {
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}
.nota-full.rich-text {
    white-space: normal;   /* el rich-text maneja sus propios <br>/<p> */
}
/* Editor Quill dentro del nota-edit */
#notaEditor {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    min-height: 220px;
}
#notaEditor .ql-editor { min-height: 200px; font-size: 14px; line-height: 1.5; }
#notaEditItem {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 15px;
}
@media (max-width: 700px) {
    .nota-header { padding: 10px 14px; }
    .nota-titulo-full { font-size: 15px; }
    .nota-modal .modal-body { padding: 12px; }
    .nota-actions .btn-mini { padding: 4px 6px; font-size: 11px; }
}

/* Chip de filtro activo en titulo de col trabajos */
.chip-filter {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    vertical-align: middle;
}
.chip-filter.ok     { background: rgba(46, 213, 115, 0.15); color: var(--ok); border: 1px solid var(--ok); }
.chip-filter.danger { background: rgba(255, 71, 87, 0.15);  color: var(--danger); border: 1px solid var(--danger); }

/* Boton "Ver todos los trabajos del cliente" cuando hay equipo seleccionado */
.btn-ver-todos {
    display: block;
    width: calc(100% - 24px);
    margin: 10px 12px;
    padding: 8px 12px;
    background: rgba(0, 240, 255, 0.08);
    border: 1px dashed var(--neon);
    border-radius: 8px;
    color: var(--neon);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.btn-ver-todos:hover {
    background: rgba(0, 240, 255, 0.15);
    border-style: solid;
}

/* Segmento de filtro por tipo (Todos / Facturables / Chequeos automáticos) */
.seg-filtro-tipo {
    display: flex;
    gap: 6px;
    margin: 8px 12px 2px;
}
.seg-btn {
    flex: 1;
    padding: 6px 8px;
    background: var(--panel-2, rgba(255,255,255,0.03));
    border: 1px solid var(--border, #1f1f2e);
    border-radius: 8px;
    color: var(--text-dim, #9fb3c8);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.seg-btn:hover { border-color: var(--neon); color: var(--text, #e6edf3); }
.seg-btn.active {
    background: rgba(0, 240, 255, 0.12);
    border-color: var(--neon);
    color: var(--neon);
}
.seg-btn .seg-n {
    display: inline-block;
    min-width: 16px;
    padding: 0 4px;
    border-radius: 7px;
    background: rgba(255,255,255,0.08);
    font-size: 11px;
    font-weight: 700;
}
.seg-btn.active .seg-n { background: rgba(0, 240, 255, 0.22); }

/* Trabajo cards en col derecha (mas angostas) */
.trabajo-card.narrow {
    padding: 10px 12px;
}
.trabajo-card.narrow .trabajo-header { font-size: 13px; margin-bottom: 4px; }
.trabajo-card.narrow .trabajo-meta { font-size: 11px; margin-bottom: 6px; }
.trabajo-card.narrow .trabajo-honorarios { font-size: 13px; padding-top: 6px; }

/* Breadcrumb */
.breadcrumb {
    padding: 8px 14px; margin: -8px -8px 18px -8px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; color: var(--muted);
}
.breadcrumb a {
    color: var(--neon); text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .bc-sep { color: var(--muted); margin: 0 4px; }
.breadcrumb .bc-current { color: var(--text); font-weight: 600; }

/* ============================================================
   Layout 3 columnas (Clientes -> Equipos -> Trabajos)

   OJO con los `calc(100vh - N)` de las vistas de alto completo (estas, la
   agenda, el master-detail): restan `--dock-h`, el alto del panel de Soporte
   acoplado abajo (ver «Panel de SOPORTE acoplado»). Sin eso, con el panel
   abierto las columnas medían la pantalla entera adentro de media pantalla y
   lo de abajo de las listas pegajosas no se alcanzaba nunca. Sin panel vale
   0 y queda todo como antes. Un `100vh` nuevo adentro de una vista: lo mismo.
   ============================================================ */
.three-cols {
    display: grid;
    /* Cliente list | Center | Trabajos del cliente */
    grid-template-columns: 260px minmax(360px, 1.4fr) minmax(380px, 1.7fr);
    gap: 12px;
    height: calc(100vh - var(--dock-h, 0px) - 105px);
}
/* Vista cliente: dar MÁS ancho al center (más datos) y MENOS al right (lista trabajos). */
.three-cols.cli-view {
    grid-template-columns: 260px minmax(400px, 2fr) minmax(340px, 1.2fr);   /* 400 (era 480): la ficha compacta entra, y a 1366 con el menú fijado ya no hay scroll horizontal */
    /* Altura mínima del viewport para que columnas master/right hagan su scroll,
       pero la altura total puede crecer con el contenido del center. */
    height: auto;
    min-height: calc(100vh - var(--dock-h, 0px) - 105px);
    align-items: start;
}
.three-cols .col {
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    display: flex; flex-direction: column;
}
/* En vista cliente: el CENTER crece con el contenido (no scroll interno).
   Los otros (master + right) mantienen su scroll. */
.three-cols.cli-view .col-center {
    overflow-y: visible;
    height: auto;
    max-height: none;
    align-self: start;
}
.three-cols.cli-view .col-master,
.three-cols.cli-view .col-right {
    max-height: calc(100vh - var(--dock-h, 0px) - 105px);
    position: sticky;
    top: 0;
}
.three-cols .col.empty { align-items: center; justify-content: center; }
.col-empty {
    text-align: center; color: var(--muted); opacity: 0.6;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.col-empty .icon { font-size: 48px; opacity: 0.5; }

.col-header {
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.col-header strong { color: var(--text); font-size: 14px; }
.col-header-text { flex: 1; min-width: 0; }
.col-header-text strong { display: block; }
.col-count {
    background: var(--bg); border: 1px solid var(--border);
    color: var(--muted); font-size: 11px; padding: 2px 7px;
    border-radius: 10px; margin-left: auto;
}

.col-section-title {
    color: var(--neon); font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 6px;
    margin: 6px 0 8px 0;
}
.col-body { flex: 1; }
.col .list-item.compact { padding: 8px 10px; margin-bottom: 5px; }
.col .list-item.compact .list-title { font-size: 14px; }
.col .list-item.compact .list-sub { font-size: 11px; }
.col .list-avatar.small { width: 32px; height: 32px; font-size: 12px; }
.col .trabajo-card { padding: 10px 12px; margin-bottom: 6px; }
.col .trabajo-card .trabajo-header { font-size: 13px; }
.col .trabajo-card .trabajo-meta { font-size: 11px; }
.col .trabajo-card .trabajo-honorarios { font-size: 12px; padding-top: 6px; }

.btn-mini {
    background: var(--bg); border: 1px solid var(--panel-2);
    color: var(--text); cursor: pointer; font-size: 12px;
    padding: 3px 8px; border-radius: 4px; margin-left: auto;
    text-decoration: none;
}
.btn-mini:hover { border-color: var(--neon); color: var(--neon); text-decoration: none; }

/* Botón de conectar por soporte remoto: el color ES el estado.
   Antes había un puntito verde al lado; sobraba, porque el dato importa
   justo donde vas a hacer click.

   OJO CON LA ESPECIFICIDAD, acá ya me mordió: `.list-item .equipo-edit-btn`
   (más abajo en este archivo) declara `background: transparent` con los mismos
   dos niveles que tendría `.hcb-conectar.en-linea`, y al estar DESPUÉS ganaba
   y borraba el verde. Por eso estas reglas repiten el prefijo `.list-item
   .equipo-edit-btn`: así ganan por especificidad y no por orden.

   Y va `opacity: 1` forzado porque esa misma regla los deja en `opacity: 0`
   hasta que pasás el mouse. Para un botón normal está bien; para un testigo de
   estado no, porque lo que se busca es ver de un vistazo cuáles están
   prendidas sin recorrer la lista con el mouse.

   Los fondos van en rgba sobre el color del tema y no en un verde/gris fijo,
   para que se lean bien tanto en claro como en oscuro. */
.list-item .equipo-edit-btn.hcb-conectar {
    opacity: 1;
    transition: background .15s ease, border-color .15s ease;
}
/* Verde saturado, no un pastel: tiene que cantar de lejos en una lista larga.
   Con 0.22 de alfa quedaba casi blanco en tema claro. */
.list-item .equipo-edit-btn.hcb-conectar.en-linea {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
}
.list-item .equipo-edit-btn.hcb-conectar.fuera {
    background: var(--panel-2);
    border-color: var(--border);
    opacity: .55;
}
.list-item .equipo-edit-btn.hcb-conectar.desconocido {
    background: rgba(255, 185, 70, 0.18);
    border-color: var(--warn);
    color: var(--text);
}
/* El hover genérico pinta el borde de neón y taparía el estado: acá se mantiene
   el color propio y solo se resalta un poco. */
.list-item .equipo-edit-btn.hcb-conectar.en-linea:hover {
    background: #15803d; border-color: #166534; color: #fff;
}

/* ============================================================
   Acciones de la tarjeta de equipo: siempre a la vista.

   Estaban en opacity:0 hasta pasar el mouse. Eso obliga a barrer la lista con
   el puntero para saber que hay, y desde que el botón de conectar indica si el
   equipo está prendido directamente escondía información.

   El contador de reportes se mudó del texto de la fila al propio botón ✎, que
   es donde realmente se abren. Antes decía "· 📄 2 reportes" en el subtítulo y
   además estaba el ✎ al lado: dos cosas para lo mismo, y en pantalla angosta
   el texto se iba a una segunda línea.
   ============================================================ */
.list-item .equipo-edit-btn { opacity: 1; }
.t-cell-equipos .list-item .equipo-edit-btn { opacity: .75; }
.t-cell-equipos .list-item:hover .equipo-edit-btn,
.t-cell-equipos .list-item.selected .equipo-edit-btn { opacity: 1; }
/* El de conectar nunca se atenúa: es un testigo, no una acción secundaria. */
.t-cell-equipos .list-item .equipo-edit-btn.hcb-conectar { opacity: 1; }

.list-item .equipo-edit-btn.eq-edit { position: relative; }
.list-item .equipo-edit-btn.eq-edit.con-reportes {
    border-color: var(--neon);
    color: var(--neon);
}
.eq-badge {
    display: inline-block;
    margin-left: 3px;
    padding: 0 4px;
    border-radius: 7px;
    background: var(--neon);
    color: var(--bg);
    font-size: 10px;
    font-weight: bold;
    line-height: 14px;
    vertical-align: 1px;
}
.list-item .equipo-edit-btn.hcb-conectar.fuera:hover { opacity: 1; }
.list-item .equipo-edit-btn.hcb-conectar.desconocido:hover {
    background: rgba(255, 185, 70, 0.32); border-color: var(--warn); color: var(--text);
}

.kpi-mini-row {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
    margin: 8px 0;
}
.kpi-mini {
    background: var(--bg); border: 1px solid var(--border);
    padding: 6px 8px; border-radius: 6px; text-align: center;
}
.kpi-mini-label {
    display: block; font-size: 10px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.kpi-mini strong { display: block; font-size: 14px; margin-top: 3px; color: var(--neon); }

.back-mobile { display: none; }

/* ----- Tablet (1100px-): 2 columnas, la 3ra apilada debajo de la 2da ----- */
/* ----- Pantallas medianas (1200-1340px): 3 columnas apretadas ----- */
@media (min-width: 1200px) and (max-width: 1340px) {
    .view-container { padding: 12px; }
    .three-cols {
        grid-template-columns: 200px minmax(280px, 1.15fr) minmax(300px, 1.5fr);
        gap: 10px;
    }
    .three-cols.cli-view {
        grid-template-columns: 200px minmax(280px, 1.15fr) minmax(300px, 1.5fr);
    }
    /* Con el menú fijado se pierden 240px: achicamos aún más para que siga entrando */
    .app.sidebar-pinned .three-cols,
    .app.sidebar-pinned .three-cols.cli-view {
        grid-template-columns: 180px minmax(240px, 1.1fr) minmax(260px, 1.4fr);
        gap: 8px;
    }
    /* Tarjetas más compactas: el título del equipo no debe cortarse en varias líneas */
    .three-cols .list-item.compact { gap: 8px; padding: 8px 10px; }
    .three-cols .list-item .list-title { font-size: 13px; line-height: 1.25; }
    .three-cols .list-item .list-sub   { font-size: 11px; line-height: 1.3; }
}

@media (max-width: 999px) {
    .three-cols {
        grid-template-columns: 260px 1fr;
        grid-template-rows: 1fr;
    }
    .three-cols .col-right {
        grid-column: 2;
        grid-row: 2;
    }
    .three-cols {
        grid-template-rows: auto auto;
        height: auto;
        min-height: calc(100vh - var(--dock-h, 0px) - 105px);
    }
    .three-cols .col-master {
        grid-row: 1 / span 2;
    }
    .three-cols .col-center {
        grid-column: 2; grid-row: 1;
    }
}

/* ============================================================
   MONITOR VERTICAL / pantallas medianas (860-1199px)
   No entran 3 columnas cómodas, así que se muestran las 2 que
   importan — ficha del cliente + sus trabajos — y la LISTA DE
   CLIENTES pasa a ser un panel lateral: queda oculta y se abre
   al pasar el mouse por la pestaña 👥 del borde izquierdo.
   (Un monitor de PC en vertical de 1080px reporta ~946px de ancho
   CSS por el devicePixelRatio, así que cae en este tramo.)
   ============================================================ */
@media (min-width: 860px) and (max-width: 1199px) {
    .view-container { padding: 12px; }

    /* Dos columnas: ficha del cliente | trabajos del cliente.
       --cli-ancho lo setea el divisor arrastrable (JS); si no hay nada guardado
       cae al 44% por defecto. */
    .three-cols.cli-view,
    .three-cols.cli-view[data-level] {
        grid-template-columns: minmax(0, var(--cli-ancho, 44%)) minmax(0, 1fr);
        grid-template-rows: 1fr;
        gap: 10px;
        height: calc(100vh - var(--dock-h, 0px) - 95px);
        min-height: 0;
        position: relative;      /* ancla para el divisor */
    }
    .three-cols.cli-view .col-resizer { display: block; }
    /* El drill-down de tablet NO aplica acá: las dos columnas se ven siempre.
       Ojo: más abajo hay reglas `.three-cols[data-level=N] .col-X { display:none }`
       con la misma especificidad que vienen DESPUÉS en el archivo, así que acá
       hace falta subir la especificidad ([data-level] sobre .cli-view) para
       ganarles. Si no, al abrir un equipo desaparecía la ficha del cliente. */
    .three-cols.cli-view[data-level] .col-center {
        grid-column: 1; grid-row: 1;
        display: flex;
        overflow-y: auto;
        max-height: calc(100vh - var(--dock-h, 0px) - 95px);
        align-self: stretch;
    }
    .three-cols.cli-view[data-level] .col-right {
        grid-column: 2; grid-row: 1;
        display: flex;
        max-height: calc(100vh - var(--dock-h, 0px) - 95px);
    }
    .three-cols.cli-view[data-level] .col-master { display: flex; }

    /* ---- Lista de clientes ----
       El panel deslizante que se abría al pasar el mouse por la pestaña 👥 se
       ELIMINÓ: hacía exactamente lo mismo que el cajón de clientes, que además
       está disponible en todas las pantallas y no solo en esta, y tiene el
       buscador, el orden y el filtro en un lugar. Tener los dos era mantener
       dos listas de clientes con comportamientos distintos.

       Se puede ocultar sin tocar el grid porque en este ancho la grilla ya es
       de dos columnas (col-center y col-right) y este panel estaba fuera de
       flujo, en position:fixed. */
    .three-cols.cli-view .col-master,
    .three-cols.cli-view[data-level] .col-master { display: none !important; }

    /* Con las dos columnas siempre visibles, la navegación de tablet sobra */
    .three-cols.cli-view .back-mobile,
    .three-cols.cli-view .trab-nav-mobile,
    .three-cols.cli-view .cli-ver-trab { display: none !important; }

    /* --- Contenido de la ficha: acá la columna mide ~360px, no el ancho de
       pantalla. Los media queries de abajo miran el VIEWPORT (946px) y por eso
       no se activaban, dejando sub-grids de ~170px donde el mail y el celular
       se partían letra por letra. Los colapsamos a una sola columna. --- */
    .three-cols.cli-view .data-list.data-list-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
    /* `:not(.data-row-wide)` es clave: las filas anchas (dirección, recomendaciones)
       usan su propio template de 2 columnas con la etiqueta arriba. Si les imponés
       estas 3 columnas, el valor cae en la de 84px y el texto se amontona en una
       tira angosta con todo el espacio libre al lado. */
    .three-cols.cli-view .data-list.data-list-grid .data-row:not(.data-row-wide) {
        grid-template-columns: 84px 1fr auto;
    }
    /* La dirección ocupa el ancho completo de la ficha */
    .three-cols.cli-view .data-list.data-list-grid .data-row-wide .data-value {
        min-width: 0;
        word-break: normal;
        overflow-wrap: anywhere;   /* corta sólo si una palabra no entra */
    }
    /* La fila de recomendaciones ya no necesita regla propia acá: se acomoda
       sola con flex-wrap (ver .data-row-recom). Esta la apilaba justo en el
       ancho más usado, que es lo que había que arreglar. */

    /* --- Notas y Equipos apilados: en 2 columnas de ~170px cada una no entraba
       nada, y con `max-height: 60vh` en ambas celdas se pisaban entre sí.
       Solución: los EQUIPOS quedan como lista (es lo que se consulta seguido) y
       las NOTAS pasan a un botón que abre el modal, que ya trae buscador. --- */
    .three-cols.cli-view .t-grid {
        grid-template-columns: 1fr;
        min-height: 0;
        gap: 10px;
    }
    .three-cols.cli-view .t-cell {
        max-height: none;     /* el 60vh de cada celda era lo que las superponía */
        overflow: visible;
    }
    .three-cols.cli-view .t-cell-notas .notas-compacto { display: flex; }
    .three-cols.cli-view .t-cell-notas .notas-search,
    .three-cols.cli-view .t-cell-notas #notasList { display: none; }
    /* Los equipos sí se listan, con scroll propio si son muchos */
    .three-cols.cli-view .t-cell-equipos {
        max-height: 46vh;
        overflow-y: auto;
    }

    /* Los KPI del cliente entran de a dos, no de a cuatro apretados */
    .three-cols.cli-view .col-center .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

/* ----- Mobile (800px-): drill-down, una columna a la vez ----- */
@media (max-width: 800px) {
    .three-cols { grid-template-columns: 1fr; grid-template-rows: 1fr; height: auto; }
    .three-cols .col { grid-column: 1; grid-row: 1; }
    /* data-level controla cual columna se ve */
    .three-cols[data-level="0"] .col-center,
    .three-cols[data-level="0"] .col-right { display: none; }
    .three-cols[data-level="1"] .col-master,
    .three-cols[data-level="1"] .col-right { display: none; }
    .three-cols[data-level="2"] .col-master,
    .three-cols[data-level="2"] .col-center { display: none; }
    .three-cols[data-level="3"] .col-master,
    .three-cols[data-level="3"] .col-center { display: none; }

    .back-mobile {
        display: inline-flex; align-items: center; gap: 4px;
        background: transparent; border: 1px solid var(--panel-2);
        color: var(--text); padding: 5px 10px; border-radius: 5px;
        cursor: pointer; font-size: 12px; margin-right: 6px;
    }
    .back-mobile:hover { border-color: var(--neon); color: var(--neon); }
}

/* ============================================================
   Modal grande de Trabajo
   ============================================================ */
.trabajo-modal-backdrop {
    background: rgba(5,5,8,0.85); backdrop-filter: blur(4px);
    animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.trabajo-modal {
    width: 900px; max-width: 95vw; max-height: 92vh;
    overflow: hidden; display: flex; flex-direction: column;
    position: relative;
    animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.modal-close {
    position: absolute; top: 12px; right: 14px;
    background: transparent; border: none; color: var(--muted);
    font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 12px;
    border-radius: 6px; z-index: 2;
}
.modal-close:hover { color: var(--danger); background: rgba(255,71,87,0.1); }

.modal-breadcrumb {
    padding: 8px 14px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; font-size: 13px; color: var(--muted);
    margin-bottom: 18px; padding-right: 50px;
}
.modal-breadcrumb a { color: var(--neon); text-decoration: none; }
.modal-breadcrumb a:hover { text-decoration: underline; }
.modal-breadcrumb .bc-sep { margin: 0 5px; }
.modal-breadcrumb .bc-current { color: var(--text); font-weight: 600; }

.modal-body { overflow-y: auto; flex: 1; position: relative; }

/* Mini-barra IA + dictado sobre cualquier textarea/input del CRM */
.ai-mini-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 4px 0 4px;
}
.ai-mini-bar .ai-bar-btn {
    font-size: 11px;
    padding: 2px 7px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}
.ai-mini-bar .ai-bar-btn:hover {
    background: var(--panel);
    color: var(--text);
    border-color: var(--neon);
}
.ai-mini-bar .ai-mic-icon { display: inline-block; }

/* Footer sticky con Guardar/Cancelar — siempre visible al final del modal de trabajo */
.trabajo-sticky-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding: 12px 14px;
    margin: 20px -14px -14px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    z-index: 5;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
}
@media (max-width: 600px) {
    .trabajo-sticky-footer { padding: 10px 12px; flex-direction: row-reverse; }
    .trabajo-sticky-footer .btn-cyan { flex: 1; }
}

/* ============================================================
   Mobile real (< 600px) — polish extra
   ============================================================ */
@media (max-width: 600px) {
    .otp-input { font-size: 32px; padding: 16px; letter-spacing: 14px; min-height: 60px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-value { font-size: 20px; }
    .view-container { padding: 12px; }

    /* Modal de trabajo: full-screen en mobile */
    .trabajo-modal-backdrop { padding: 0; }
    .trabajo-modal {
        width: 100%; max-width: 100%; max-height: 100%; height: 100%;
        border-radius: 0; padding: 16px;
        animation: slideUpMobile 0.25s ease-out;
    }
    @keyframes slideUpMobile {
        from { transform: translateY(40px); opacity: 0 }
        to   { transform: translateY(0); opacity: 1 }
    }
    .modal-close { top: 8px; right: 10px; font-size: 32px; padding: 8px 14px; }

    /* Safe areas para iOS notch */
    .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
    .sidebar { padding-top: max(20px, env(safe-area-inset-top)); }

    /* Login full-screen */
    .login-overlay { padding: 16px; }
    .login-card { width: 100%; padding: 30px 24px; }

    /* Sidebar a ancho casi completo en celu chico */
    .sidebar { width: 86vw; max-width: 320px; left: -90vw; }

    /* Tipografia mas grande para legibilidad */
    body { font-size: 16px; }
    .nav-btn { font-size: 16px; padding: 16px 22px; }
}

/* Toques: deshabilitar tap highlight horrible de iOS */
* { -webkit-tap-highlight-color: rgba(0, 240, 255, 0.1); }

/* No subrayar links que parecen botones */
.btn, .btn-cyan, .btn-mini, .btn-link, .nav-btn, .hamburger { text-decoration: none; }

/* Mejor scroll mobile */
@supports (-webkit-touch-callout: none) {
    .view-container, .col, .modal-body { -webkit-overflow-scrolling: touch; }
}

/* ============================================================
   Master-Detail (PC: split | Mobile: detail como modal)
   ============================================================ */
.master-detail {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 1.5fr;
    gap: 18px;
    align-items: start;
    height: calc(100vh - var(--dock-h, 0px) - 110px);
}
.master-detail .master { overflow-y: auto; padding-right: 8px; height: 100%; }
.master-detail .detail {
    overflow-y: auto; height: 100%;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 22px;
}
.master-detail .detail-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: var(--muted); text-align: center; gap: 10px;
}
.master-detail .detail-empty .icon { font-size: 56px; opacity: 0.4; }

/* Selector de orden en el header de la lista */
.col-order-select {
    margin-left: auto;
    padding: 5px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-size: 11px;
    cursor: pointer;
    outline: none;
}
.col-order-select:focus { border-color: var(--neon); }
.col-order-select:hover { border-color: var(--neon); }

/* Item seleccionado (en la master list) */
.list-item.selected, .trabajo-card.selected {
    border-color: var(--neon);
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.2);
    background: rgba(0, 240, 255, 0.06);
}
[data-theme="light"] .list-item.selected,
[data-theme="light"] .trabajo-card.selected {
    background: rgba(10, 88, 202, 0.06);
    box-shadow: 0 2px 8px rgba(10, 88, 202, 0.10);
}

/* Quitar text-shadow neon en tema claro (queda raro) */
[data-theme="light"] .kpi-value { text-shadow: none; }

/* Zona invisible que abre el sidebar al hover (solo desktop, solo cuando NO esta pinned) */
.sidebar-hover-zone {
    position: fixed;
    top: 0; left: 0;
    width: 14px;
    height: 100vh;
    z-index: 998;
    cursor: pointer;
}
.app.sidebar-pinned .sidebar-hover-zone { display: none; } /* si esta fijo, no hace falta */
@media (max-width: 999px) { .sidebar-hover-zone { display: none; } } /* solo desktop */

/* Tema claro - ajustes Quill (los iconos del toolbar se mantienen oscuros) */
[data-theme="light"] .ql-toolbar { background: #f4f6fa; border-color: var(--border) !important; }
[data-theme="light"] .ql-container { border-color: var(--border) !important; }
[data-theme="light"] .ql-editor { background: #ffffff; color: var(--text); }
[data-theme="light"] .ql-snow .ql-stroke { stroke: var(--text); }
[data-theme="light"] .ql-snow .ql-fill { fill: var(--text); }
[data-theme="light"] .ql-snow .ql-picker-label { color: var(--text); }
[data-theme="light"] .ql-snow .ql-picker-options { background: #ffffff; border-color: var(--border); }

/* Tema oscuro - Quill */
.ql-toolbar { background: var(--bg) !important; border-color: var(--border) !important; }
.ql-container { background: var(--bg) !important; border-color: var(--border) !important; }
.ql-editor { background: var(--bg) !important; color: var(--text) !important; min-height: 280px; font-size: 14px; }
.ql-editor.ql-blank::before { color: var(--muted) !important; }
.ql-snow .ql-stroke { stroke: var(--text); }
.ql-snow .ql-fill { fill: var(--text); }
.ql-snow .ql-picker-label { color: var(--text); }
.ql-snow .ql-picker-options { background: var(--panel); border-color: var(--border); }

/* Header de KnowHow con acciones */
.kh-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 14px; flex-wrap: wrap;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.kh-header h3 { font-size: 18px; line-height: 1.3; }
.kh-actions { display: flex; gap: 8px; flex-shrink: 0; }
.kh-content { color: var(--text); line-height: 1.6; }
.kh-content h1, .kh-content h2, .kh-content h3 { color: var(--text); margin: 18px 0 10px; }
.kh-content ul, .kh-content ol { padding-left: 24px; }
.kh-content pre { background: var(--bg); padding: 12px; border-radius: 6px; border: 1px solid var(--border); overflow-x: auto; }
.kh-content blockquote { border-left: 3px solid var(--neon); padding-left: 12px; color: var(--muted); margin: 12px 0; }
.kh-content a { color: var(--neon); }

/* Boton volver — solo se ve en mobile */
.back-btn {
    background: transparent; border: 1px solid var(--panel-2); color: var(--text);
    padding: 9px 16px; border-radius: 6px; cursor: pointer; margin-bottom: 18px;
    display: none; font-size: 13px;
    align-items: center; gap: 6px;
}
.back-btn:hover { border-color: var(--neon); color: var(--neon); }

/* ============================================================
   Tablet / Mobile (< 1024px)
   Activamos: drill-down master-detail, KPIs 2 cols, dashboard 1 col.
   ============================================================ */
@media (max-width: 999px) {
    /* En mobile/tablet: el sidebar SIEMPRE es overlay, ignorar pinned */
    .app.sidebar-pinned .sidebar { left: -260px; }
    .app.sidebar-pinned .sidebar.open { left: 0; }
    .app.sidebar-pinned .main { margin-left: 0; }
    .app.sidebar-pinned .hamburger { display: inline-flex !important; }

    .topbar {
        padding: 8px 10px;
        gap: 4px;
        overflow-x: visible;
        flex-wrap: nowrap;
        align-items: center;
    }
    .topbar > * { flex-shrink: 0; }
    .topbar-title { display: none; }

    /* === Topbar minimalista mobile: solo iconos, no labels === */
    .topbar .tb-lbl { display: none; }
    .topbar .tb-ic { font-size: 20px; line-height: 1; }

    /* Hamburger cuadrado */
    .hamburger {
        padding: 0 !important;
        font-size: 18px !important;
        min-width: 42px;
        min-height: 42px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 10px;
    }

    /* Chips cuadrados con solo emoji */
    .topbar-chip {
        padding: 0 !important;
        min-width: 42px;
        min-height: 42px;
        border-radius: 10px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 0;
        position: relative;
    }

    /* Chip inflación: emoji + número, sin texto "Inflación:" */
    .chip-inflacion {
        padding: 0 12px !important;
        min-height: 42px;
        font-size: 13px !important;
        display: inline-flex !important;
        align-items: center;
        gap: 4px;
    }
    .chip-inflacion .tb-ic { font-size: 16px; }

    /* Mobile: search inline oculto. El botón lupa abre un modal de búsqueda. */
    .search-bar { display: none !important; }
    .topbar-search-btn { display: inline-flex !important; }

    .view-container { padding: 16px; }

    /* KPIs en 2 columnas, no 6 */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .kpi-value { font-size: 22px; }
    .kpi-label { font-size: 11px; }

    /* Dashboard a una columna (no 2 lado a lado) */
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row.two-col { grid-template-columns: 1fr; }

    /* Master-detail: SIEMPRE drill-down debajo de 1024px (no PC) */
    .master-detail {
        display: block;
        height: auto;
    }
    .master-detail .master {
        padding-right: 0;
        overflow: visible;
        height: auto;
    }
    .master-detail .detail {
        position: fixed; inset: 0;
        z-index: 9000;
        border: none; border-radius: 0;
        padding: 18px;
        overflow-y: auto;
    }
    .master-detail:not(.has-detail) .detail { display: none; }
    .master-detail.has-detail .master { display: none; }
    .back-btn { display: inline-flex; }

    /* Three-cols: drill-down de una columna a la vez */
    .three-cols,
    .three-cols.cli-view { grid-template-columns: 1fr; grid-template-rows: 1fr; height: auto; }
    .t-grid { grid-template-columns: 1fr; }
    .data-row { font-size: 14px; }
    .data-row .data-value { font-size: 15px; }
    .three-cols .col { grid-column: 1; grid-row: 1; min-height: calc(100vh - var(--dock-h, 0px) - 130px); }
    .three-cols[data-level="0"] .col-center,
    .three-cols[data-level="0"] .col-right { display: none; }
    .three-cols[data-level="1"] .col-master,
    .three-cols[data-level="1"] .col-right { display: none; }
    .three-cols[data-level="2"] .col-master,
    .three-cols[data-level="2"] .col-center { display: none; }
    .three-cols[data-level="3"] .col-master,
    .three-cols[data-level="3"] .col-center { display: none; }

    .back-mobile {
        display: inline-flex; align-items: center; gap: 4px;
        background: transparent; border: 1px solid var(--panel-2);
        color: var(--text); padding: 7px 12px; border-radius: 6px;
        cursor: pointer; font-size: 14px; margin-right: 8px;
    }
    .back-mobile:hover { border-color: var(--neon); color: var(--neon); }

    /* Tipografia y touch targets */
    .list-item { padding: 14px 14px; min-height: 60px; }
    .list-title { font-size: 16px; }
    .list-sub { font-size: 13px; }
    .list-avatar { width: 48px; height: 48px; }
    .list-amount { font-size: 16px; }
    .trabajo-card { padding: 16px; min-height: 80px; }
    .trabajo-card .trabajo-header { font-size: 15px; }
    .trabajo-card .trabajo-meta { font-size: 12px; }
    .trabajo-card .trabajo-honorarios { font-size: 13px; }
    table th, table td { padding: 10px 10px; font-size: 14px; }
    .login-card { padding: 28px 22px; }
    .nav-btn { padding: 14px 22px; font-size: 16px; }
    .btn { padding: 12px 20px; font-size: 14px; min-height: 44px; }
    .btn-cyan { padding: 16px 18px; font-size: 17px; min-height: 52px; }
    .btn-mini { padding: 7px 12px; min-height: 36px; font-size: 13px; }
}

/* El hamburger SIEMPRE se ve (excepto cuando el sidebar esta pinned en desktop) */
.hamburger {
    display: inline-flex; background: transparent; border: 1px solid var(--panel-2);
    color: var(--text); padding: 8px 14px; border-radius: 6px; cursor: pointer;
    align-items: center; gap: 6px; font-size: 14px; font-weight: 600;
    transition: all 0.2s;
}
.hamburger:hover { border-color: var(--neon); color: var(--neon); }
.app.sidebar-pinned .hamburger {
    color: var(--neon); border-color: var(--neon);
    background: rgba(0,240,255,0.08);
}
@media (min-width: 1000px) {
    .app.sidebar-pinned .hamburger { display: none; }
}

/* ============================================================
   MODAL DE FORMULARIO (Nuevo trabajo/equipo/nota)
   ============================================================ */
.form-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78);
    z-index: 11000;   /* arriba del trabajo modal (9000) y nota modal (10500) — forms anidados */
    display: flex; align-items: flex-start; justify-content: center;
    padding: 30px 20px;
    overflow-y: auto;
}
.form-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 540px;
    width: 100%;
    position: relative;
    padding: 22px 24px 0;             /* sin padding inferior: lo absorbe form-modal-body */
    box-shadow: 0 8px 40px rgba(0, 240, 255, 0.08);
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;                  /* el scroll vive en form-modal-body */
}
.form-modal.wide { max-width: 720px; }
.form-modal .modal-close {
    position: absolute; top: 10px; right: 14px;
    background: transparent; border: none;
    color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1;
}
.form-modal .modal-close:hover { color: var(--danger); }
.form-modal-title {
    color: var(--neon);
    font-size: 18px;
    line-height: 1.25;
    margin: 0 0 14px;
    padding-right: 32px;
}

/* --- Ritmo vertical dentro del modal ---
   El gap de 14px del body ya separa los bloques: los márgenes propios de cada
   pieza se suman a ese gap y terminan dando huecos del doble de lo necesario. */
.form-modal-body > p:first-child { margin-top: 0; }
.form-modal-body > .form-row { margin-bottom: 0; }
.form-modal-body .form-help { margin-top: 5px; line-height: 1.45; }
/* Las tarjetas de ayuda/secundarias respiran, pero sin exagerar */
.form-modal-body .card {
    padding: 12px 14px;
    margin: 2px 0 0;
    border-radius: 8px;
}
.form-modal-body .card h4 { margin: 0 0 6px; font-size: 14px; line-height: 1.3; }
.form-modal-body .card > p:last-of-type { margin-bottom: 10px; }
/* `mt-20` es un helper global de 20px que, sumado al gap, deja demasiado aire acá */
.form-modal-body .card.mt-20 { margin-top: 4px; }
.form-modal-body {
    display: flex; flex-direction: column; gap: 14px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 12px;
}
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-row.two-col > div, .form-row.three-col > div { display: flex; flex-direction: column; gap: 4px; }
.form-label {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex; justify-content: space-between; align-items: center;
}
.form-row input[type=text],
.form-row input[type=number],
.form-row input[type=date],
.form-row input[type=datetime-local],
.form-row input[type=search],
.form-row input:not([type]),
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    border-color: var(--neon);
    box-shadow: 0 0 0 2px rgba(0,240,255,0.10);
}
.form-row textarea { resize: vertical; min-height: 60px; font-family: inherit; }
.form-help { color: var(--muted); font-size: 10px; margin-top: 2px; }
.form-check { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.form-check input { width: 18px; height: 18px; accent-color: var(--neon); cursor: pointer; }
.form-check label { font-size: 13px; cursor: pointer; }
.form-modal-actions {
    display: flex; justify-content: flex-end; gap: 10px; align-items: center;
    /* Antes usaba `margin: 0 -24px` para llegar a los bordes del modal. Como este
       bloque vive DENTRO del <form> (.form-modal-body, con overflow-y:auto), esos
       48px de más generaban scroll horizontal en TODOS los form modals. */
    padding: 12px 0 14px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
    background: var(--card);          /* opaco: el contenido no se ve al scrollear */
    position: sticky;
    bottom: 0;
    z-index: 5;
}
/* El submit es .btn-cyan, que trae width:100% (pensado para formularios de login).
   En la barra de acciones tiene que ocupar sólo lo que necesita. */
.form-modal-actions > .btn-cyan,
.form-modal-actions > .btn-secondary,
.form-modal-actions > .btn-danger,
.form-modal-actions > .btn-danger-outline {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 9px 20px;
    font-size: 14px;
    border-radius: 6px;
}
/* El principal pesa un poco más que el resto, sin comerse la fila */
.form-modal-actions > .btn-cyan { padding: 9px 26px; }

/* .btn-cyan dentro del cuerpo del modal (acciones secundarias en tarjetas):
   tampoco debe ir a ancho completo ni con tipografía de botón principal. */
.form-modal-body .card .btn-cyan,
.form-modal-body .card .btn-mini.btn-cyan {
    width: auto;
    margin: 0;
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 6px;
}
.form-modal-actions button {
    padding: 7px 14px !important;
    font-size: 13px;
}
.form-modal-actions .btn-cyan {
    /* botón principal compacto */
    padding: 7px 18px !important;
}
@media (max-width: 700px) {
    /* Sin margen negativo: generaba scroll horizontal (ver .form-modal-actions) */
    .form-modal-actions { padding: 10px 0 12px; margin: 4px 0 0; }
    .form-modal-actions button { padding: 6px 12px !important; font-size: 12px; }
}
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 9px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--danger); color: var(--danger); }
.btn-danger {
    background: var(--danger);
    color: #fff;
    border: 1px solid var(--danger);
    padding: 9px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
}
.btn-danger:hover { filter: brightness(1.15); }

/* ============================================================
   JERARQUÍA Z-INDEX (de menor a mayor):
     8200  agenda footer toolbar (fixed)
     8400  sidebar-backdrop
     8450  topbar
     8500  sidebar drawer / agenda FABs
     9000  modales principales (trabajo, detalle, agenda-shell, default)
     9100  agenda-sidebar drawer
    10000  Search modal (global)
    10500  Sub-modales (nota, agenda event, equipos, notas ampliado)
    11000  Forms anidados (editar trabajo, alta/edit cliente)
    11500  Loading overlay (spinner)
    12500  Mapa (puede abrirse desde forms — debe tapar todo lo anterior)
    12800  Confirm modal (siempre arriba de mapa)
    13000  Toasts
    99999  Login overlay
   ============================================================ */
/* Modal de confirmacion — SIEMPRE arriba de cualquier otro modal */
.confirm-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 12800;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.confirm-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 460px;
    width: 100%;
    padding: 24px 26px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
[data-theme="light"] .confirm-modal { box-shadow: 0 12px 40px rgba(15, 30, 60, 0.20); }
.btn-inline {
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--neon);
    color: var(--neon);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
}
.btn-inline:hover { background: rgba(0, 240, 255, 0.15); }
@media (max-width: 700px) {
    .form-modal { padding: 20px 18px; }
    .form-row.two-col, .form-row.three-col { grid-template-columns: 1fr; }
}

/* ============================================================
   Vista de ANALISIS (charts)
   ============================================================ */
.analisis-view { display: flex; flex-direction: column; gap: 18px; padding-bottom: 30px; }
.an-controls {
    display: flex; justify-content: space-between; align-items: center;
    gap: 18px; flex-wrap: wrap;
}
.an-presets, .an-range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.an-range label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.an-range input[type=date] {
    padding: 8px 12px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); font-size: 14px;
}
.an-preset { font-size: 13px; padding: 8px 14px; }
.an-preset.active {
    background: var(--neon); color: #fff; border-color: var(--neon);
}
.an-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
@media (max-width: 900px) { .an-charts-grid { grid-template-columns: 1fr; } }
.chart-box {
    height: 280px;
    position: relative;
    margin-top: 10px;
}

/* ============================================================
   Dashboard - eventos Google Calendar
   ============================================================ */
.gcal-event {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--neon);
    border-radius: 6px;
}
.gcal-event-when {
    color: var(--neon);
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
    text-transform: uppercase;
}
.gcal-event-when strong { font-size: 15px; }
.gcal-event-title { color: var(--text); font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.gcal-event-desc { color: var(--muted); font-size: 11px; line-height: 1.3; }

/* ============================================================
   Chip de Inflación en topbar
   ============================================================ */
.chip-inflacion {
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.35);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 12px;
    transition: background 0.15s, border-color 0.15s;
}
.chip-inflacion:hover {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--neon);
}
.chip-inflacion #chipInflacionValue {
    color: var(--neon);
    font-weight: 700;
}
@media (max-width: 700px) {
    .chip-inflacion {
        font-size: 11px;
        padding: 4px 8px;
        margin-left: 6px;
    }
}

/* Diarios de la PC del dueño (diarios.js). El .oculto gana al display:inline-flex !important de la
   barra en celular. Los Diarios no corren en el celular y debajo de 1200 la barra no tiene lugar: se esconden. */
.topbar .chip-diario.oculto { display: none !important; }
.chip-diario { position: relative; margin-left: 6px; }
.chip-diario-hora { color: var(--neon); font-weight: 700; }
.chip-diario-punto { display: none; width: 8px; height: 8px; margin-left: 5px; border-radius: 50%; background: #f5c518; vertical-align: 1px; }
.chip-diario.con-avisos .chip-diario-punto { display: inline-block; }
.chip-diario.atrasado { background: rgba(245, 197, 24, 0.12); border-color: #f5c518; }
.chip-diario.atrasado .chip-diario-hora { color: #d9a900; }
/* Compacto: número arriba de la hora. A 1366 la barra ya venía justa: el título y los rótulos de
   Agenda/Tickets ceden su lugar (los íconos y el menú dicen lo mismo). */
.chip-diario-num { display: none; }
@media (max-width: 1500px) {
    .chip-diario .tb-lbl { display: none; }
    .chip-diario-num { display: inline; font-weight: 700; }
    .chip-diario:not(#chipDiarioPcs) { display: inline-grid; grid-template-columns: auto auto; justify-content: center; column-gap: 3px; padding: 2px 9px; line-height: 1.15; margin-left: 4px; }
    .chip-diario:not(#chipDiarioPcs) .tb-ic { font-size: 12px; }
    .chip-diario-hora { grid-column: 1 / -1; grid-row: 2; font-size: 10px; white-space: nowrap; }
    .chip-diario-punto { position: absolute; top: 3px; right: 5px; width: 7px; height: 7px; margin: 0; }
    #chipDiarioPcs { padding: 4px 7px; margin-left: 4px; }
    .topbar .topbar-title { display: none; }
    .topbar .topbar-chip .tb-lbl { display: none; }
}
@media (max-width: 1199px) { .topbar .chip-diario { display: none !important; } }
.diario-modal { position: relative; }
.diario-modal-cuerpo { color: var(--text); font-size: 14px; line-height: 1.5; }
.diario-aviso { margin: 0 0 12px; color: #d9a900; font-weight: 600; }
.diario-pasos { margin: 0 0 14px; padding-left: 20px; }
.diario-pasos code { font-size: 12px; word-break: break-all; }
.diario-nota { margin: 8px 0; color: var(--muted); font-size: 13px; }
.diario-pcs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.diario-pc { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; }
.diario-pc small { display: block; color: var(--muted); }
.diario-pc em { color: var(--neon); font-style: normal; font-size: 12px; }
.diario-botones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* Chips de acceso rápido en la topbar (Clientes, Soporte, etc.) */
.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.topbar-chip:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--neon);
    color: var(--neon);
    text-decoration: none;
}
/* (Reglas mobile de topbar-chip y chip-inflacion movidas al bloque @media
   principal de mobile arriba, donde se diseñó la topbar minimalista) */

/* ============================================================
   Badge "🔁" para trabajos recurrentes
   ============================================================ */
.badge-rec {
    display: inline-block;
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 6px;
    padding: 1px 5px;
    font-size: 11px;
    margin-right: 6px;
    vertical-align: middle;
}

/* ============================================================
   Card recurrente en detail de trabajo
   ============================================================ */
.recurrente-card.activa {
    border-color: rgba(0, 240, 255, 0.45);
    background: linear-gradient(180deg, rgba(0,240,255,0.04), transparent 60%);
}
.recurrente-card.pasiva {
    opacity: 0.85;
}

/* ============================================================
   Bloque recurrente dentro del modal de nuevo trabajo
   ============================================================ */
.recurrente-block {
    background: rgba(0, 240, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    border: 1px dashed rgba(0, 240, 255, 0.25);
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--neon);
    cursor: pointer;
}

/* ============================================================
   Modal de actualización de precios — preview
   ============================================================ */
.api-preview {
    background: rgba(0, 240, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}
.api-preview-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    font-size: 14px;
}
.api-preview-summary > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.api-preview-summary > div > span {
    font-size: 18px;
    font-weight: 700;
}
@media (max-width: 700px) {
    .api-preview-summary { grid-template-columns: 1fr; }
}

/* Card historial precio */
.precio-historico-card table { width: 100%; border-collapse: collapse; }
.precio-historico-card th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.precio-historico-card td { padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px; }

/* Checkbox no-facturable: estilo distinto para mostrar que sólo sirve para actualizar precio */
.trab-check.non-fact input[type=checkbox] {
    accent-color: #f1c40f;
}
.trab-check.non-fact::after {
    content: '📈';
    font-size: 10px;
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--bg);
    border-radius: 50%;
    padding: 1px 2px;
    border: 1px solid #f1c40f;
}
.trab-check { position: relative; }

/* Botón deshabilitado en la barra */
.barra-facturar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   Trabajo detail — nuevo layout (compacto en factura, prominente en textos)
   ============================================================ */
.trabajo-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.trabajo-detail-actions { display: flex; gap: 8px; }

/* Factura compacta — una sola fila */
.factura-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
    background: var(--panel);
    flex-wrap: wrap;
}
.factura-compact.facturada { border-color: rgba(0, 240, 255, 0.4); background: rgba(0, 240, 255, 0.04); }
.factura-compact.no-fact   { border-color: rgba(255, 71, 87, 0.2); }
.factura-compact .fc-left  { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.factura-compact .fc-icon  { font-size: 22px; }
.factura-compact .fc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.factura-compact .fc-mail-status { width: 100%; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 12px; }

/* Cards de textos prominentes */
.trabajo-textos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
.trabajo-texto-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    min-height: 110px;
}
.trabajo-texto-card h4 {
    margin: 0 0 10px 0;
    color: var(--neon);
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}
.rich-text { color: var(--text); line-height: 1.55; font-size: 14px; }
.rich-text p { margin: 0 0 8px 0; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text ul, .rich-text ol { margin: 6px 0 8px 24px; padding: 0; }
.rich-text li { margin-bottom: 3px; }
.rich-text strong { color: var(--text); font-weight: 700; }
.rich-text em { font-style: italic; }
.rich-text a { color: var(--neon); }
.rich-text blockquote { border-left: 3px solid var(--neon); padding-left: 12px; color: var(--muted); margin: 8px 0; }

@media (max-width: 900px) {
    .trabajo-textos { grid-template-columns: 1fr; }
}

/* ============================================================
   Editor de trabajo — Quill + dictado + IA
   ============================================================ */
/* Edit modal: header fijo, body scrollable, footer sticky */
.trabajo-edit-modal {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 18px 22px 0 !important;
}
.trabajo-edit-modal .form-modal-title { flex-shrink: 0; }
.trabajo-edit-modal .form-modal-body {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 4px;
    /* permitir que el form-modal-actions adentro sea sticky */
    position: relative;
}
.trabajo-edit-modal .form-modal-actions {
    position: sticky;
    bottom: 0;
    background: var(--panel);     /* mismo color que .modal */
    /* Sin margen negativo: sobresalía 44px del contenedor con scroll y dejaba
       una barra horizontal al pie del modal de trabajo. */
    margin: 4px 0 0;
    padding: 8px 0 10px;
    z-index: 5;
}
.trabajo-edit-modal .form-modal-actions button {
    padding: 7px 16px !important;
    font-size: 13px;
}
@media (max-width: 700px) {
    .trabajo-edit-modal { padding: 14px 16px 0 !important; }
    .trabajo-edit-modal .form-modal-actions { margin: 4px 0 0; padding: 6px 0 8px; }
    .trabajo-edit-modal .form-modal-actions button { padding: 6px 12px !important; font-size: 12px; }
}
.trabajo-quill {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    min-height: 140px;
}
.trabajo-quill .ql-editor { min-height: 140px; font-size: 14px; line-height: 1.55; }
.editor-wrap { display: flex; flex-direction: column; gap: 0; }
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
}
.editor-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-mini.ed-act {
    padding: 4px 8px;
    font-size: 11px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-mini.ed-act:hover {
    border-color: var(--neon);
    background: rgba(0, 240, 255, 0.08);
}
.btn-mini.ed-act.ai {
    border-color: rgba(155, 89, 182, 0.4);
    color: #c39bd3;
}
.btn-mini.ed-act.ai:hover {
    background: rgba(155, 89, 182, 0.12);
    border-color: #9b59b6;
}
.btn-mini.ed-act.recording {
    background: #ff4757 !important;
    color: white !important;
    border-color: #ff4757 !important;
    animation: pulseRec 1.2s infinite;
}
@keyframes pulseRec {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.6); }
    50%      { box-shadow: 0 0 0 8px rgba(255, 71, 87, 0); }
}

/* Modal wide para el editor */
.trabajo-edit-modal { max-width: 1000px; width: 95%; }

/* ============================================================
   Fila Fecha de recepción + Agendar + Hora
   ============================================================ */
.fecha-agenda-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) auto minmax(110px, 0.7fr);
    gap: 14px;
    align-items: start;
    padding: 12px;
    background: rgba(0, 240, 255, 0.04);
    border: 1px dashed rgba(0, 240, 255, 0.25);
    border-radius: 8px;
}
/* Variante con 4 columnas: agregamos "Cierre" al final */
.fecha-agenda-row.with-cierre {
    grid-template-columns: minmax(140px, 1fr) auto minmax(110px, 0.7fr) minmax(170px, 1.1fr);
}
/* Variante con "Agendar" a la derecha de todo: Fecha, Hora, luego Agendar */
.fecha-agenda-row.agendar-last {
    grid-template-columns: minmax(140px, 1fr) minmax(110px, 0.7fr) auto;
}
.fecha-agenda-row .fa-cierre input[type=datetime-local] { width: 100%; }

/* Pagos + Factura lado a lado (modal detalle de trabajo) */
.pagos-factura-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
    align-items: start;
}
.pagos-factura-grid .pagos-card { margin: 0; }
.pagos-factura-grid .factura-col .factura-compact { margin: 0; }
@media (max-width: 800px) {
    .pagos-factura-grid { grid-template-columns: 1fr; gap: 12px; }
}

.fecha-agenda-row .fa-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding-top: 24px; /* alinear con los inputs */
}
.fecha-agenda-row .fa-hora { transition: opacity 0.2s; }
.fecha-agenda-row input[type=date],
.fecha-agenda-row input[type=time] {
    width: 100%;
}
@media (max-width: 700px) {
    .fecha-agenda-row,
    .fecha-agenda-row.with-cierre {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .fecha-agenda-row .fa-toggle { padding-top: 4px; }
}

/* ============================================================
   Modal Soporte Herconbyte (iframe a api-soporte.herconbyte.com.ar)
   ============================================================ */
.soporte-modal {
    width: 95vw;
    max-width: 1400px;
    height: 90vh;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.soporte-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-shrink: 0;
}
.soporte-header h3 { margin: 0; color: var(--neon); font-size: 16px; }
.soporte-actions { display: flex; gap: 6px; align-items: center; }
.soporte-actions .modal-close {
    background: transparent; border: none;
    color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1;
    padding: 0 6px;
}
.soporte-actions .modal-close:hover { color: var(--danger); }
.soporte-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: white;
}
.soporte-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}
.soporte-loading {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: var(--bg);
    color: var(--text);
    z-index: 2;
    pointer-events: auto;
}
.soporte-loading p { color: var(--muted); margin-top: 14px; }
@media (max-width: 700px) {
    .soporte-modal { width: 100vw; height: 100vh; max-width: 100vw; border-radius: 0; }
}

/* ============================================================
   Panel de SOPORTE acoplado abajo (02/10/26, pedido del dueño)

   En la PC el 🛟 ya no abre un modal que tapa la ficha: prende un panel en
   la parte de abajo de .main con la libreta de Soporte, y la vista de arriba
   se ACHICA (no queda tapada); cada parte con su scroll. La barra de 30 px es
   la cabecera Y la divisoria: se arrastra para subir o bajar.

   El JS (iniciarSoporteDock en app.js) pone data-estado y el alto, y deja en
   #app la variable --dock-h con el alto REAL del panel (0 si no se ve), que
   restan los calc(100vh - N) de las vistas de alto completo.

   Sin z-index propio a propósito: queda debajo del menú lateral (8500), de
   la barra de arriba (8450) y de todos los modales (9000 en adelante).

   Desde el 08/10/26 también en el celular (ver el bloque de ≤ 700 px más
   abajo). La franja de gestos de Android y la del iPhone van DENTRO del panel
   (padding de abajo), así --dock-h ya las cuenta: lo que va fijo abajo se
   pone a --dock-h y, con el panel a la vista, no vuelve a sumar el inset
   (--sd-safe-b pasa a 0). En la PC el inset es 0: no cambia nada.
   ============================================================ */
.app { --sd-safe-b: env(safe-area-inset-bottom, 0px); }
.app.sd-visible { --sd-safe-b: 0px; }
.soporte-dock {
    display: none;                 /* oculto o todavía sin iniciar */
    flex: 0 0 auto;
    flex-direction: column;
    min-height: 0;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--panel);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.25);
}
.soporte-dock[data-estado="abierto"],
.soporte-dock[data-estado="minimizado"] { display: flex; }
/* Minimizado se esconde SOLO el cuerpo: el iframe sigue en el DOM con su
   página cargada. Sacarlo del DOM o tocarle el src lo recargaría. */
.soporte-dock[data-estado="minimizado"] .sd-cuerpo { display: none; }

.sd-barra {
    flex: 0 0 30px;
    height: 30px;
    display: flex; align-items: center; gap: 8px;
    padding: 0 10px 0 16px;
    border-bottom: 1px solid var(--border);   /* separa la barra del panel (en tema claro los dos son blancos) */
    position: relative;
    cursor: row-resize;
    touch-action: none;            /* con el dedo arrastra, no scrollea la página */
    user-select: none; -webkit-user-select: none;
}
/* El asa del medio: avisa que la barra se arrastra */
.sd-barra::before {
    content: '';
    position: absolute; left: 50%; top: 4px;
    transform: translateX(-50%);
    width: 46px; height: 4px; border-radius: 4px;
    background: var(--muted); opacity: .45;
    transition: background .15s, opacity .15s;
    pointer-events: none;
}
.sd-barra:hover::before,
.soporte-dock.arrastrando .sd-barra::before { background: var(--neon); opacity: 1; }/* Minimizado, tocar la barra lo restaura */
.soporte-dock[data-estado="minimizado"] .sd-barra { cursor: pointer; }
.sd-titulo { color: var(--neon); font-weight: 600; font-size: 13px; white-space: nowrap; }
/* 🆕 y 🔔 (07/10/26): los chips de la barra de arriba, mudados acá en la PC.
   Mismo aspecto que .topbar-chip, achicados a los 30 px de la barra; no se
   reusa .topbar-chip porque en tablet (≤ 999 px) lo agranda a 42 px. Se ven
   solo cuando hay algo (el JS les pone display inline). */
.sd-chip {
    display: inline-flex; align-items: center; gap: 5px;
    flex: 0 0 auto;
    height: 22px;
    padding: 0 4px 0 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--text);
    font-size: 12px; font-weight: 600; line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sd-chip:hover { background: rgba(0, 240, 255, 0.08); border-color: var(--neon); color: var(--neon); }
.sd-chip-ic { font-size: 13px; }
.sd-chip-n { color: #fff; border-radius: 10px; padding: 2px 6px; font-size: 11px; }
.sd-acciones { margin-left: auto; display: flex; align-items: center; gap: 6px; }
/* .btn-mini trae margin-left:auto (y 36 px de alto en tablet): acá van en fila y caben en 30 px */
.sd-acciones .btn-mini {
    margin-left: 0;
    min-height: 0;
    height: 22px;
    padding: 0 8px;
    font-size: 12px;
    white-space: nowrap;
    display: inline-flex; align-items: center;
}
.sd-acciones #sdMin { font-size: 16px; padding: 0 9px; }   /* ▾ / ▴ a 12 px es un punto */
.sd-cuerpo {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: white;             /* igual que el modal de Soporte */
}
.sd-cuerpo .soporte-iframe { position: absolute; inset: 0; }
/* Mientras se arrastra, el iframe (otro dominio) NO recibe el puntero: si se
   lo traga él, la página de arriba no se entera del movimiento ni de que se
   soltó, y la divisoria queda pegada al mouse. */
body.sd-arrastrando { cursor: row-resize; user-select: none; -webkit-user-select: none; }
body.sd-arrastrando iframe { pointer-events: none; }

/* Con el panel en pantalla (PC y celular), la barra de arriba no lleva el 🛟
   ni los chips 🆕 / 🔔: el panel ya está abajo y los chips tienen sus gemelos
   en su barra (pedido del dueño, 07/10/26; en el celular, 08/10/26).
   Le gana al `.topbar-chip { display:inline-flex !important }` del celular
   por especificidad (id + 2 clases).
   !important porque el JS les pone display inline. Va atado a sd-visible y
   no a un ancho: si el panel no está (un index.html viejo en caché, un
   estado raro), vuelven los de arriba y el 🛟 abre el modal como siempre. */
.app.sd-visible #chipSoporte,
.app.sd-visible #chipSopNuevos,
.app.sd-visible #chipSopEspera { display: none !important; }

/* Las celdas de 60vh de la ficha (notas, equipos) no entran en lo que queda
   arriba con el panel abierto: se topean a lo visible, para no tener un
   scroll adentro de otro que no se ve entero. Solo en el ancho de 3 columnas:
   en los más angostos esas celdas ya no tienen tope (y van sin overflow). */
@media (min-width: 1200px) {
    .app.sd-visible .t-cell { max-height: min(60vh, max(120px, calc(100vh - var(--dock-h, 0px) - 130px))); }
}
/* Celular (08/10/26, pedido del dueño: «en el celu no se ve como en la
   compu»): el mismo panel, con la barra a la medida del dedo. 40 px de alto,
   chips y botones de 36: «🛟 Soporte 🆕 🔔» a la izquierda y ▴ / ▾ a la
   derecha. Sin ⬇ (instala un .bat de Windows); ↻ y ↗ (sin «Pestaña») solo
   con el panel abierto: minimizado el iframe todavía no existe. El JS
   arranca minimizado la primera vez y, abierto, usa el 60 % del alto. */
@media (max-width: 700px) {
    .sd-barra { flex-basis: 40px; height: 40px; gap: 5px; padding: 0 4px 0 10px; }
    /* El asa no va en el medio de la barra (ahí caen los chips de 36): pasa a
       ser una pieza más, centrada en el hueco entre los chips y los botones. */
    .sd-barra::before {
        position: static; transform: none;
        order: 1; flex: 0 100 36px; min-width: 0;   /* si no entra todo, se achica él primero */
        margin: 0 auto;
    }
    .sd-acciones { order: 2; margin-left: 0; gap: 4px; }
    /* «Soporte» se corta (…) solo si ni sin el asa entra (360 px con números de
       dos cifras en los chips): encoge casi nada mientras el asa tenga lugar. */
    .sd-titulo { font-size: 14px; flex: 0 0.01 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .sd-chip { height: 36px; min-width: 44px; padding: 0 6px 0 8px; border-radius: 10px; justify-content: center; }
    .sd-chip-ic { font-size: 16px; }
    .sd-chip-n { font-size: 12px; }
    .sd-acciones .btn-mini {
        height: 36px; min-width: 36px;
        padding: 0 8px;
        font-size: 16px;
        justify-content: center;
        border-radius: 8px;
    }
    .sd-acciones #sdMin { font-size: 24px; min-width: 44px; padding: 0 8px; }   /* ▴ / ▾ son chicos de por sí */
    .sd-acciones .sd-lbl,
    .sd-acciones #sdInstalar { display: none; }
    .soporte-dock[data-estado="minimizado"] .sd-solo-abierto { display: none; }
    /* El «¿te aviso cuando vuelva?» (inline en bottom:18px) no tapa la barra */
    .hcb-ofrece { bottom: calc(18px + var(--dock-h, 0px)) !important; }
}
/* Teléfonos de menos de 360 px: el ↗ (abrir en pestaña) es lo que menos se usa */
@media (max-width: 359px) {
    .sd-acciones a.sd-solo-abierto { display: none; }
}
/* 📵 En el teléfono no se conecta a ningún equipo (HCB_ES_TELEFONO en app.js,
   por el aparato y no por el ancho): ni el ⬇ del instalador de Conectar ni
   los 🛟 de los equipos en la ficha de un ticket. */
html.hcb-telefono #sdInstalar,
html.hcb-telefono .tk-eqs { display: none !important; }
/* Ni el panel ni su hueco salen en papel */
@media print {
    .soporte-dock { display: none !important; }
    .app { --dock-h: 0px !important; }
}

/* En sidebar, el botón Soporte usa <button> en vez de <a> — alinear estilo */
/* <button> en la nav: visualmente idéntico a los <a> del menú */
.nav-menu button.nav-btn {
    text-align: left;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: var(--text);
    font-size: 14px;
    /* Reset agresivo de defaults de <button> en webkit y firefox */
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
}
.nav-menu button.nav-btn:focus,
.nav-menu button.nav-btn:active {
    background: rgba(0, 240, 255, 0.05);
    color: var(--neon);
    outline: none;
    border: none;
    border-left: 3px solid var(--neon);
}

/* 🎫 Tickets · configuración (08/10/26): GRUPO del menú lateral. El título es una franja en mayúsculas (no es una
   pantalla) que pliega el grupo; las entradas cuelgan con sangría y una línea guía
   (CIA/Patron_Menu_Lateral_Barra_Personalizable §2). Lo arma index.html (#tkConf) y lo pinta tickets.js. */
.nav-grupo { margin-top: 10px; padding-top: 2px; border-top: 1px solid var(--border); }
.nav-menu .nav-grupo-tit {
    display: flex; align-items: center; gap: 6px; width: 100%; box-sizing: border-box;
    background: none; border: 0; outline: none; box-shadow: none; cursor: pointer; text-align: left;
    -webkit-appearance: none; appearance: none; font-family: inherit;
    color: var(--muted); font-size: 10.5px !important; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    white-space: nowrap; padding: 12px 12px 6px 22px;
}
.nav-menu .nav-grupo-tit:hover, .nav-menu .nav-grupo-tit:focus-visible { color: var(--neon); }
.nav-menu .nav-grupo-tit::after { content: '▾'; margin-left: auto; font-size: 12px; letter-spacing: 0; }
.nav-grupo.plegado .nav-grupo-tit::after { content: '▸'; }
.nav-grupo.plegado .nav-grupo-items { display: none; }
.nav-grupo-items { margin: 0 0 6px 30px; border-left: 2px solid var(--border); }
.nav-menu .nav-grupo-items .nav-btn { padding: 9px 12px !important; min-height: 0; font-size: 13.5px; line-height: 1.3; }
/* «3 aparatos» de 🔔: un subrenglón chico debajo del rótulo (en el ancho del menú de la PC no entra al lado) */
.nav-menu .nav-grupo-items .nav-n { display: block; color: var(--muted); font-size: 11.5px; padding-left: 1.75em; margin-top: 1px; }
@media (max-width: 700px) {
    .nav-menu .nav-grupo-tit { padding: 16px 16px 10px 22px; font-size: 11.5px !important; }
    .nav-menu .nav-grupo-items .nav-n { font-size: 12.5px; }
    .nav-menu .nav-grupo-items .nav-btn { min-height: 46px; padding: 12px 12px !important; }
}

/* Barra de facturar — info con 2 líneas (total a facturar + pendiente neto) */
.barra-facturar .bf-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: auto;
}
.barra-facturar .bf-info .bf-sub small {
    color: var(--muted);
    font-size: 11px;
    cursor: help;
}
.barra-facturar .bf-info .bf-sub small strong {
    color: var(--text);
}

/* ============================================================
   Estado financiero del trabajo — color de borde + barra izquierda
   estado-deuda  (rojo)  | estado-pagado (verde) | estado-favor (azul)
   ============================================================ */
.trabajo-card.narrow {
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: transparent;
    transition: background 0.15s, border-color 0.15s;
}
.trabajo-card.estado-deuda {
    border-left-color: #ff4757;
    background: linear-gradient(90deg, rgba(255,71,87,0.06) 0%, transparent 80%);
}
.trabajo-card.estado-deuda:hover {
    background: linear-gradient(90deg, rgba(255,71,87,0.10) 0%, transparent 80%);
}
.trabajo-card.estado-pagado {
    border-left-color: #2ed573;
    background: linear-gradient(90deg, rgba(46,213,115,0.05) 0%, transparent 80%);
}
.trabajo-card.estado-pagado:hover {
    background: linear-gradient(90deg, rgba(46,213,115,0.10) 0%, transparent 80%);
}
.trabajo-card.estado-favor {
    border-left-color: #1e90ff;
    background: linear-gradient(90deg, rgba(30,144,255,0.07) 0%, transparent 80%);
}
.trabajo-card.estado-favor:hover {
    background: linear-gradient(90deg, rgba(30,144,255,0.12) 0%, transparent 80%);
}

/* Preview del problema reportado dentro de la tarjeta */
.trabajo-prob {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.35;
    margin-top: 4px;
    margin-bottom: 4px;
    padding: 6px 8px;
    background: var(--bg);
    border-radius: 5px;
    border-left: 2px solid var(--panel-2);
    word-break: break-word;
}
.trabajo-prob-icon {
    margin-right: 4px;
    opacity: 0.6;
}

/* Chip pequeño con el tipo de trabajo dentro de la meta line */
.trabajo-meta .t-tipo {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    background: var(--panel-2);
    border-radius: 10px;
    color: var(--muted);
    margin: 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
/* El header del trabajo puede ser largo (problema reportado) — permitir wrap suave */
.trabajo-card.narrow .trabajo-header {
    white-space: normal;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   Botón ✎ en cada tarjeta de equipo (sin que se vea pesado)
   ============================================================ */
.list-item .equipo-edit-btn {
    opacity: 0;                /* invisible por default, aparece al hover */
    transition: opacity 0.15s;
    padding: 3px 8px;
    font-size: 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer;
    margin-left: 4px;
}
.list-item:hover .equipo-edit-btn,
.list-item.selected .equipo-edit-btn { opacity: 1; }
.list-item .equipo-edit-btn:hover {
    color: var(--neon);
    border-color: var(--neon);
    background: rgba(0, 240, 255, 0.06);
}
/* En mobile siempre visible (no hay hover) */
@media (max-width: 700px) {
    .list-item .equipo-edit-btn { opacity: 1; }
}

/* ============================================================
   Modal de Reportes .hta — lista + viewer inline
   ============================================================ */
.reportes-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.75);
    /* Mismo nivel que nota-modal (10500): arriba de trabajo-modal (9000) y sidebar (8500) */
    z-index: 10500;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.reportes-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 95vw;
    max-width: 1400px;
    height: 90vh;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.reportes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-shrink: 0;
}
.reportes-header h3 {
    margin: 0;
    color: var(--neon);
    font-size: 15px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reportes-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.reportes-actions .modal-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 6px;
    border-left: 1px solid var(--border);
    padding-left: 12px;
}
.reportes-actions .modal-close:hover {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.06);
}

.reportes-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}
.reportes-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}
.reportes-loading p { margin-top: 14px; }

.reportes-lista {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.reporte-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.reporte-item:hover {
    border-color: var(--neon);
    background: rgba(0, 240, 255, 0.04);
    transform: translateX(2px);
}
.reporte-icon { font-size: 24px; }
.reporte-info { flex: 1; min-width: 0; }
.reporte-titulo {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 3px;
    word-break: break-all;
}
.reporte-meta {
    font-size: 12px;
    color: var(--muted);
}
.reporte-arrow {
    color: var(--muted);
    font-size: 18px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.reporte-item:hover .reporte-arrow { color: var(--neon); }

.reporte-viewer {
    flex: 1;
    overflow: hidden;
    background: white;
}
.reporte-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

@media (max-width: 700px) {
    .reportes-modal { width: 100vw; height: 100vh; max-width: 100vw; border-radius: 0; }
    .reportes-header h3 { font-size: 13px; }
}

/* ============================================================
   Botón "Ver trabajos" al lado de cada cliente en la lista
   Visible SOLO en mobile (≤1100px). En desktop el panel derecho ya muestra los trabajos.
   ============================================================ */
.cli-ver-trab {
    display: none;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    margin-left: 8px;
    transition: all 0.15s;
}
.cli-ver-trab:hover, .cli-ver-trab:active {
    background: rgba(0, 240, 255, 0.10);
    border-color: var(--neon);
    color: var(--neon);
}
@media (max-width: 999px) {
    .cli-ver-trab { display: inline-flex; align-items: center; gap: 4px; }
    .list-item.compact { display: flex; align-items: center; gap: 10px; }
}
@media (max-width: 500px) {
    /* En celular muy chico, sólo icono para ahorrar espacio */
    .cli-ver-trab-lbl { display: none; }
    .cli-ver-trab { padding: 8px 10px; font-size: 16px; }
}

/* Nav mobile dentro de col-right (cliente list / ficha cliente) */
.trab-nav-mobile {
    display: none;
    gap: 8px;
    margin-bottom: 10px;
}
.trab-nav-mobile button { flex: 1; padding: 8px 10px; font-size: 13px; }
@media (max-width: 999px) {
    .trab-nav-mobile { display: flex; }
}
.col-subheader {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

/* ============================================================
   Acciones rápidas en el modal Editar equipo
   ============================================================ */
.equipo-quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: rgba(0, 240, 255, 0.04);
    border: 1px dashed rgba(0, 240, 255, 0.25);
    border-radius: 8px;
    margin-bottom: 4px;
}
.equipo-quick-actions .btn-mini {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    font-size: 12px;
}

/* ============================================================
   💳 Cuentas Bancarias - vista
   ============================================================ */
.cuentas-view { padding: 8px 0; }
.cuentas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.cuentas-header h2 { margin: 0; color: var(--text); font-size: 22px; }
.cuentas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.cuenta-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cuenta-card:hover { border-color: var(--neon); box-shadow: 0 2px 10px rgba(0, 240, 255, 0.08); }
.cuenta-card.inactiva { opacity: 0.55; border-style: dashed; }
.cuenta-card .cuenta-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
}
.cuenta-card h3 {
    margin: 0;
    color: var(--neon);
    font-size: 15px;
}

/* Botón notificar en barra flotante: distinguir con tono purple suave */
.barra-facturar button[onclick*="notificarSeleccionados"] {
    background: linear-gradient(135deg, #7000ff 0%, #00f0ff 100%);
}
.barra-facturar button[onclick*="notificarSeleccionados"]:hover { filter: brightness(1.1); }

@media (max-width: 700px) {
    .cuentas-grid { grid-template-columns: 1fr; }
    .cuentas-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Notificación: botones de canal (WA / Email / Copiar)
   ============================================================ */
.canal-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.canal-btn {
    flex: 1;
    min-width: 130px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.canal-btn:hover {
    border-color: var(--neon);
    background: rgba(0, 240, 255, 0.04);
}
.canal-btn.active {
    border-color: var(--neon);
    background: rgba(0, 240, 255, 0.12);
    color: var(--neon);
    box-shadow: 0 0 0 1px var(--neon);
}

/* Cuenta principal: badge + borde destacado */
.badge-principal {
    color: #f1c40f;
    font-size: 14px;
}
.cuenta-card.principal {
    border-color: rgba(241, 196, 15, 0.5);
    box-shadow: 0 2px 12px rgba(241, 196, 15, 0.10);
}
.cuenta-card.principal h3 { color: var(--neon); }

/* ============================================================
   Notas Herconbyte: bloque interno (warn que NUNCA se envía)
   ============================================================ */
.notas-hcb-wrap {
    background: rgba(241, 196, 15, 0.06);
    border: 1px dashed rgba(241, 196, 15, 0.4);
    border-radius: 8px;
    padding: 10px;
}
.notas-hcb-card {
    border-color: rgba(241, 196, 15, 0.35) !important;
    background: rgba(241, 196, 15, 0.04);
}
.notas-hcb-card h3 {
    color: #f1c40f !important;
}

/* ============================================================
   AGENDA — Layout con sidebar de calendarios + vista FullCalendar
   ============================================================ */
.agenda-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    height: calc(100vh - var(--dock-h, 0px) - 105px);
}
.agenda-sidebar {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.agenda-main {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    overflow: hidden;
}
.agenda-h3 {
    color: var(--neon);
    margin: 0 0 14px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.agenda-cal-list { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.agenda-cal-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    font-size: 13px;
}
.agenda-cal-item:hover { background: rgba(0, 240, 255, 0.05); }
.agenda-cal-item input[type=checkbox] {
    width: 16px; height: 16px;
    accent-color: var(--neon);
    cursor: pointer;
}
.agenda-cal-dot {
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.15);
}
.agenda-cal-name {
    flex: 1;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agenda-cal-role {
    font-size: 11px;
    opacity: 0.6;
}
.agenda-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.agenda-actions button { flex: 1; padding: 6px 8px; font-size: 12px; }
.agenda-tips {
    margin-top: 14px;
    padding: 10px;
    background: var(--bg);
    border-radius: 6px;
    border: 1px dashed var(--border);
}

/* FullCalendar — adaptación al tema oscuro/claro */
#agendaCalendarEl { height: 100%; }
.fc {
    color: var(--text);
    font-family: inherit;
    height: 100%;
}
.fc .fc-toolbar-title { font-size: 18px; color: var(--neon); }
.fc .fc-button {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    text-transform: capitalize;
    box-shadow: none;
}
.fc .fc-button:hover { background: rgba(0, 240, 255, 0.08); border-color: var(--neon); color: var(--neon); }
.fc .fc-button-active, .fc .fc-button:focus { background: rgba(0, 240, 255, 0.15) !important; color: var(--neon) !important; border-color: var(--neon) !important; box-shadow: none !important; }
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid {
    border-color: var(--border);
}
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--text); text-decoration: none; }
/* HOY — destacado muy visible: fondo + borde + número resaltado */
.fc .fc-day-today {
    background: rgba(0, 240, 255, 0.14) !important;
    box-shadow: inset 0 0 0 2px var(--neon);
}
.fc .fc-day-today .fc-daygrid-day-number {
    background: var(--neon);
    color: var(--bg) !important;
    font-weight: 700;
    border-radius: 4px;
    padding: 1px 7px;
    margin: 4px;
    display: inline-block;
    text-decoration: none;
}
.fc .fc-day-today .fc-col-header-cell-cushion {
    color: var(--neon) !important;
    font-weight: 700;
}
.fc-timegrid-col.fc-day-today {
    background: rgba(0, 240, 255, 0.08) !important;
}

/* EVENTOS — borde izquierdo grueso del color del calendario para identificarlos */
.fc-event { cursor: pointer; }
.fc-event:hover { filter: brightness(1.12); }
.fc-event.fc-event-cal {
    border-radius: 4px;
    border-left-width: 4px !important;
    border-left-style: solid !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    padding: 1px 4px;
}
/* Eventos VIRTUALES (trabajos arrastrados) — rayado diagonal para distinguirlos */
.fc-event.fc-event-virtual {
    background-image: repeating-linear-gradient(
        45deg,
        transparent 0,
        transparent 4px,
        rgba(255,255,255,0.18) 4px,
        rgba(255,255,255,0.18) 8px
    ) !important;
    opacity: 0.88;
    font-style: italic;
}
.fc-event-time, .fc-event-title { font-size: 12px; }
.fc-event-time { font-weight: 700; opacity: 0.95; }
.fc-daygrid-event { padding: 2px 4px !important; }
.fc-daygrid-event-dot { border-width: 5px !important; }
.fc-list-event:hover td { background: rgba(0, 240, 255, 0.06); }
.fc-list-day-cushion { background: var(--panel-2) !important; }

/* Agenda mobile: sidebar como drawer + FAB para crear, FullCalendar a pantalla completa */
.agenda-sidebar-close { display: none; }
.agenda-sidebar-backdrop { display: none; }
.agenda-fab-cals, .agenda-fab-new, .agenda-fab-menu { display: none; }

@media (max-width: 900px) {
    .agenda-shell {
        display: block;
        height: calc(100vh - var(--dock-h, 0px) - 100px);
        position: relative;
    }
    /* Sidebar como drawer lateral derecho, oculto por defecto */
    .agenda-sidebar {
        position: fixed;
        top: 0; right: -320px; bottom: 0;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        border-radius: 0;
        border: none;
        border-left: 1px solid var(--border);
        box-shadow: -4px 0 20px rgba(0,0,0,0.4);
        transition: right 0.25s ease;
        z-index: 9100;
        padding-top: 50px;
    }
    .agenda-sidebar.open { right: 0; }
    .agenda-sidebar-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.5);
        opacity: 0; pointer-events: none;
        transition: opacity 0.25s;
        z-index: 9050;
    }
    .agenda-sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
    .agenda-sidebar-close {
        display: block;
        position: absolute;
        top: 8px; right: 8px;
        background: var(--panel-2);
        border: 1px solid var(--border);
        color: var(--text);
        width: 32px; height: 32px;
        border-radius: 50%;
        font-size: 18px;
        cursor: pointer;
        line-height: 1;
    }

    /* Calendar ocupa todo el alto disponible (necesario para que dayGridMonth
       no quede en blanco — necesita altura del contenedor). */
    .agenda-main {
        min-height: calc(100vh - var(--dock-h, 0px) - 200px);
        border-radius: 8px;
        padding: 8px;
    }
    #agendaCalendarEl { min-height: 520px; }

    /* FullCalendar mobile: header tipo app nativa (más compacto y aireado) */
    .fc .fc-toolbar.fc-header-toolbar {
        display: grid !important;
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        margin-bottom: 12px !important;
        padding: 4px 2px;
    }
    .fc .fc-toolbar-title {
        font-size: 17px !important;
        font-weight: 700;
        text-align: center;
        color: var(--text) !important;
        text-transform: capitalize;
    }
    .fc .fc-button {
        padding: 8px 12px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
        min-height: 36px;
    }
    .fc .fc-toolbar-chunk { display: flex; gap: 4px; align-items: center; }

    /* Footer toolbar mobile: FIXED al bottom de la pantalla — siempre visible
       sin importar scroll. Respeta safe-area de iPhones con notch. */
    .fc .fc-toolbar.fc-footer-toolbar {
        position: fixed !important;
        bottom: var(--dock-h, 0px);   /* arriba del panel de Soporte acoplado, si se ve */
        left: 0;
        right: 0;
        margin: 0 !important;
        padding: 8px max(8px, env(safe-area-inset-right)) max(8px, var(--sd-safe-b, env(safe-area-inset-bottom))) max(8px, env(safe-area-inset-left));
        background: var(--panel-2);
        border-top: 1px solid var(--border);
        display: flex !important;
        justify-content: center;
        z-index: 8200;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
    }
    /* Espacio inferior para que el contenido no quede tapado por el footer fixed */
    .agenda-shell { padding-bottom: 70px; }
    .fc .fc-footer-toolbar .fc-button-group {
        gap: 4px;
        background: transparent;
        flex: 1;
        max-width: 360px;
        display: flex !important;
    }
    .fc .fc-footer-toolbar .fc-button {
        background: var(--bg) !important;
        border: 1px solid var(--border) !important;
        color: var(--text) !important;
        opacity: 0.7;
        font-weight: 600;
        padding: 12px 14px !important;
        border-radius: 8px !important;
        box-shadow: none !important;
        flex: 1;
        font-size: 13px !important;
        min-height: 42px;
    }
    .fc .fc-footer-toolbar .fc-button:hover,
    .fc .fc-footer-toolbar .fc-button:focus {
        opacity: 0.9;
    }
    .fc .fc-footer-toolbar .fc-button-active {
        background: var(--neon) !important;
        border-color: var(--neon) !important;
        color: var(--bg) !important;
        opacity: 1;
        font-weight: 700;
        box-shadow: 0 2px 6px rgba(0,240,255,0.25) !important;
    }

    /* Mobile: grid mes (dayGridMonth) necesita altura mínima para no quedar
       en blanco con height:'auto'. Tipografía compacta. */
    .fc-view-harness, .fc-view-harness-active > .fc-view {
        min-height: 520px;
    }
    .fc .fc-daygrid-day-frame { min-height: 56px; }
    .fc .fc-daygrid-day-number { font-size: 12px; padding: 2px 4px; }
    .fc .fc-col-header-cell-cushion { font-size: 11px; padding: 6px 2px; }
    .fc .fc-daygrid-event { font-size: 10px !important; padding: 1px 3px !important; }

    /* Lista — más cómoda al toque */
    .fc-list-event-graphic { padding: 12px 6px !important; }
    .fc-list-event-time, .fc-list-event-title { padding: 12px 8px !important; font-size: 14px !important; }
    .fc-list-day-cushion { padding: 10px 8px !important; font-size: 13px !important; }
    .fc-list-empty { padding: 40px 20px !important; color: var(--muted); }

    /* FABs flotantes (visibles solo en mobile) */
    .agenda-fab-cals, .agenda-fab-new {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        width: 52px; height: 52px;
        border-radius: 50%;
        border: none;
        font-size: 22px;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(0,0,0,0.35);
        z-index: 8500;
        transition: transform 0.15s;
    }
    /* + --dock-h: el panel de Soporte acoplado abajo (también en el celular,
       con la franja de gestos adentro: por eso --sd-safe-b) */
    .agenda-fab-cals {
        bottom: calc(74px + var(--dock-h, 0px) + var(--sd-safe-b, env(safe-area-inset-bottom, 0px))); left: 16px;
        background: var(--panel-2);
        color: var(--text);
        border: 1px solid var(--border);
    }
    .agenda-fab-new {
        bottom: calc(74px + var(--dock-h, 0px) + var(--sd-safe-b, env(safe-area-inset-bottom, 0px))); right: 16px;
        background: var(--neon);
        color: var(--bg);
        font-weight: bold;
        font-size: 28px;
    }
    .agenda-fab-cals:active, .agenda-fab-new:active { transform: scale(0.92); }
    .agenda-fab-menu {
        position: fixed;
        bottom: calc(138px + var(--dock-h, 0px) + var(--sd-safe-b, env(safe-area-inset-bottom, 0px))); right: 16px;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 8px;
        flex-direction: column;
        gap: 6px;
        box-shadow: 0 6px 20px rgba(0,0,0,0.4);
        z-index: 8500;
        min-width: 200px;
    }
    .agenda-fab-menu button {
        background: transparent;
        border: none;
        color: var(--text);
        padding: 10px 12px;
        text-align: left;
        font-size: 14px;
        border-radius: 6px;
        cursor: pointer;
    }
    .agenda-fab-menu button:hover, .agenda-fab-menu button:active { background: rgba(0, 240, 255, 0.1); }
}

/* ============================================================
   MOBILE APP POLISH — unificado al final del CSS para no pisar
   reglas previas. Aplica para < 700px (celulares en vertical).
   ============================================================ */
@media (max-width: 700px) {

    /* Anti-zoom de iOS al focusear inputs (iOS hace zoom si font-size < 16px) */
    input, select, textarea, button {
        font-size: 16px !important;
    }
    /* Excepciones donde 16px queda gigante */
    .ai-mini-bar .ai-bar-btn, .btn-mini, .agenda-cal-item, .col-order-select,
    .topbar-chip, .chip-inflacion, .badge-rec, .fc-event-time, .fc-event-title,
    .nav-btn small, .footer-action {
        font-size: 13px !important;
    }

    /* Tap targets mínimos de 44px para botones primarios */
    .btn-cyan, .btn-secondary, .btn-danger {
        min-height: 44px;
        padding: 12px 18px;
    }
    .nav-btn { min-height: 52px; }
    /* topbar-chip min-height definido arriba en el bloque de topbar minimalista */

    /* TODOS los modales: full-screen edge-to-edge en mobile */
    .modal-backdrop, .form-modal-backdrop, .nota-modal-backdrop,
    .trabajo-modal-backdrop, .edit-trabajo-modal-backdrop {
        padding: 0 !important;
        align-items: stretch !important;
    }
    .modal-backdrop > .modal,
    .form-modal-backdrop > .modal,
    .nota-modal-backdrop > .modal,
    .trabajo-modal-backdrop > .modal {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding-top: max(16px, env(safe-area-inset-top)) !important;
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
    }
    /* Confirm modal: que NO ocupe pantalla completa (es un dialogo chico) */
    .confirm-modal-backdrop > .modal {
        width: 92% !important;
        max-width: 480px !important;
        height: auto !important;
        max-height: 80vh !important;
        border-radius: 12px !important;
        margin: auto !important;
    }
    .confirm-modal-backdrop { align-items: center !important; padding: 16px !important; }

    /* Botón cerrar X siempre visible y grande en mobile */
    .modal-close {
        position: sticky !important;
        top: 0;
        right: 0;
        font-size: 28px !important;
        padding: 6px 16px !important;
        background: var(--panel) !important;
        z-index: 10;
        align-self: flex-end;
    }

    /* MASTER-DETAIL en mobile: drill-down nativo */
    .master-detail { display: block !important; height: auto !important; }
    .master-detail .master,
    .master-detail .detail { height: auto !important; padding: 0 !important; }

    /* Formularios: una columna siempre */
    .form-row.two-col, .form-row.three-col, .fecha-agenda-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    .form-row.two-col > *, .form-row.three-col > * { width: 100%; }

    /* KPI cards más compactas */
    .kpi-card { padding: 12px 10px !important; }
    .kpi-value { font-size: 18px !important; }
    .kpi-label { font-size: 10px !important; letter-spacing: 0.3px; }

    /* Tablas: scroll horizontal sin desbordar.
       Excluir explícitamente las tablas internas de FullCalendar y Quill —
       display:block en sus tablas rompe el layout (la vista Mes queda en blanco). */
    .view-container table,
    .modal table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .view-container table th, .view-container table td,
    .modal table th, .modal table td { white-space: nowrap; }
    /* Pero NO aplicar a tablas dentro de FullCalendar ni Quill */
    .fc table, .ql-editor table {
        display: table !important;
        overflow: visible !important;
        white-space: normal !important;
        width: 100% !important;
    }
    .fc table th, .fc table td { white-space: normal !important; display: table-cell !important; }

    /* Toasts a ancho cómodo */
    /* + --dock-h: arriba del panel de Soporte acoplado (app.js lo deja también
       en la raíz: #toasts vive fuera de #app) */
    .toasts { left: 12px !important; right: 12px !important; top: auto !important; bottom: calc(12px + var(--dock-h, 0px)) !important; }
    .toasts > div { width: 100%; }

    /* Cards de trabajos: padding más cómodo */
    .trabajo-card, .list-item { padding: 14px !important; }
    .list-item .list-title { font-size: 15px; }
    .list-item .list-sub { font-size: 12px; }

    /* Buttons inline de notas/pagos: mejor toque */
    .btn-inline { padding: 8px 12px !important; min-height: 36px; }

    /* IA bar más compacta horizontalmente para que entre */
    .ai-mini-bar .ai-bar-btn { padding: 6px 10px !important; min-height: 34px; }

    /* Sticky footer: respetar safe-area abajo */
    .trabajo-sticky-footer {
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }

    /* Editor headers de Quill: que el toolbar AI se vea en 2 líneas si hace falta */
    .editor-header { flex-direction: column !important; align-items: stretch !important; gap: 6px !important; }
    .editor-actions { flex-wrap: wrap; }

    /* Sidebar (menú) - items con más padding para tocar */
    .nav-btn { padding: 14px 22px !important; }

    /* Sidebar drawer: animación más natural */
    .sidebar { transition: left 0.22s cubic-bezier(0.32, 0.72, 0, 1); }

    /* Login: input OTP centrado y grande */
    .otp-input { font-size: 36px !important; min-height: 70px; }
}

/* Pantallas MUY chicas (<360px, ej. iPhone SE viejo) */
@media (max-width: 360px) {
    .topbar-chip { min-width: 38px !important; min-height: 38px !important; }
    .chip-inflacion { font-size: 11px !important; padding: 0 8px !important; min-height: 38px; }
    .topbar .tb-ic { font-size: 18px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .ai-mini-bar .ai-bar-btn { font-size: 10px !important; padding: 4px 7px !important; }
}

/* Transiciones suaves globales (look de app) */
@media (max-width: 700px) {
    .btn-cyan, .btn-secondary, .btn-danger, .btn-mini, .nav-btn, .topbar-chip {
        transition: transform 0.12s ease, background 0.15s, border-color 0.15s;
    }
    .btn-cyan:active, .btn-secondary:active, .btn-danger:active,
    .btn-mini:active, .nav-btn:active, .topbar-chip:active {
        transform: scale(0.97);
    }
}

/* Botones para elegir a qué teléfono del cliente se manda la notificación.
   Solo aparecen si la ficha tiene más de un número cargado. */
.notif-tel.activo, .notif-mail.activo {
    border-color: var(--neon);
    background: rgba(0,240,255,0.12);
    color: var(--neon);
    font-weight: 600;
}

/* Texto FIJO en "Trabajo realizado": la IA no lo reescribe.
   Subrayado punteado y nada más — tiene que verse mientras editás, pero al
   salir a texto plano (WhatsApp, mail, factura) el span desaparece y el
   cliente lee la frase limpia. */
.hcb-fijo {
    border-bottom: 1px dashed var(--neon);
    background: rgba(0, 240, 255, 0.06);
    border-radius: 2px;
}

/* ============================================================
   Vista angosta (celular / ventana chica) — ficha del cliente
   ============================================================ */
/* El acceso a notas vive dentro de la fila de KPI para ocupar el hueco que
   dejan al envolver. En escritorio no va: las notas ya se ven enteras abajo. */
.solo-angosto { display: none; }

.kpi-row.kpi-notas { cursor: pointer; }
.kpi-row.kpi-notas:hover { border-color: var(--neon); }

@media (max-width: 999px) {
    .solo-angosto { display: flex; }

    /* Notas: ya están arriba en la fila de KPI, no repetirlas acá */
    .t-cell-notas { display: none; }

    /* Equipos con todo el ancho y sin scroll propio: en pantalla chica un
       contenedor con scroll adentro de otro con scroll es imposible de usar. */
    .t-grid { grid-template-columns: 1fr; }
    .t-cell-equipos { max-height: none; overflow: visible; }

    /* Cada equipo más alto y legible: el nombre en dos líneas si hace falta
       (antes se cortaba) y el S/N abajo sin apretar. */
    .t-cell-equipos .list-item.compact { padding: 12px 14px; align-items: flex-start; }
    .t-cell-equipos .list-title {
        white-space: normal; line-height: 1.3; font-size: 14px;
    }
    .t-cell-equipos .list-sub {
        white-space: normal; line-height: 1.4; margin-top: 3px;
    }
    .t-cell-equipos .list-avatar.small { margin-top: 2px; }

    /* El reloj se ve COMPLETO tambien en angosto (fecha + hora + segundos).
       Gana por especificidad sobre `.topbar .tb-lbl { display:none }`, que
       oculta las etiquetas del resto de los chips. */
    .topbar .hcb-reloj .tb-lbl { display: inline; }
}

/* Reloj: sin recuadro, discreto y al final de la barra. Es un dato de fondo,
   no una acción — no tiene por qué competir visualmente con los chips.
   Los dígitos van de ancho fijo (tabular-nums): sin eso, cada segundo cambia
   el ancho del texto y se nota como un temblor permanente.

   `margin-left:auto` PROPIO, no heredado del título: en celular
   `.topbar-title` está oculto, y era el único que empujaba hacia la derecha.
   Sin esto el reloj queda pegado al último chip con la mitad de la barra
   vacía a su derecha. */
.topbar .hcb-reloj {
    margin-left: auto;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 999px;
    padding: 4px 12px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    opacity: 1;
}
/* Resaltado del día y la hora (pedido del dueño 17/11/26). */
.topbar .hcb-reloj .rj-hora {
    font-size: 17px;
    font-weight: 800;
    color: var(--neon);
    margin-left: 4px;
}
.hcb-reloj {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
}

/* ============================================================
   Los 4 KPIs del modal de trabajo, en UN solo renglón.
   En 2x2 se comían media pantalla y empujaban abajo del pliegue lo que
   realmente se viene a mirar (tipo de trabajo, equipo, lo que se hizo).
   Va al FINAL del archivo a propósito: los @media de más arriba que los
   ponen en 2 columnas no suman especificidad, así que gana el que se
   escribe último (ver Patron_Tabla_PC_a_Celular).
   ============================================================ */
.kpi-grid.sticky-top { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kpi-grid.sticky-top .kpi-card { padding: 8px 10px; }
.kpi-grid.sticky-top .kpi-value,
.kpi-grid.sticky-top .kpi-value-input { font-size: 17px; margin-top: 2px; }
.kpi-grid.sticky-top .kpi-label { font-size: 9.5px; letter-spacing: .4px; }
/* En celular sí van de a dos: cuatro columnas dejan los importes ilegibles. */
@media (max-width: 560px) {
    .kpi-grid.sticky-top { grid-template-columns: repeat(2, 1fr); }
}


/* ============================================================
   Equipos del cliente: solapas (Equipos / Impresoras) y orden arrastrando
   (17/09/26). Las solapas aparecen solo si hay alguna impresora.
   ============================================================ */
.eq-tabs { display: flex; gap: 6px; margin: 2px 0 10px; flex-wrap: wrap; }
.eq-tab {
    background: transparent; border: 1px solid var(--border); color: var(--muted);
    border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.eq-tab:hover { color: var(--text); }
.eq-tab.activa { background: var(--neon); border-color: var(--neon); color: #0b1220; }
.eq-tab-n { font-weight: 700; opacity: .75; margin-left: 2px; }

/* El renglón se arrastra entero; el asa ⠿ solo avisa que se puede. */
.eq-arrastrable { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.eq-grip {
    position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
    font-size: 12px; line-height: 1; color: var(--muted); opacity: 0; pointer-events: none;
    transition: opacity .15s;
}
.eq-arrastrable:hover .eq-grip { opacity: .6; }
@media (hover: none) { .eq-grip { opacity: .35; } }
.eq-arrastrando { opacity: .35; outline: 2px dashed var(--neon); outline-offset: -2px; }
.eq-fantasma { box-shadow: 0 14px 34px rgba(0,0,0,.35); opacity: .96; cursor: grabbing; }
body.eq-arrastrando-body, body.eq-arrastrando-body * { cursor: grabbing !important; }

/* ============================================================
   Barra de arriba en angosto: se DESLIZA de costado (08/10/26)
   ☰ 👥 ➕ 📅 🎫 🛟 🆕 🔔 📈 💵 ♻️ y el reloj suman ~780 px: en el celular
   (y en una tablet) no entran, y el overflow:hidden de .main los cortaba
   contra el borde — la 🔔 a la mitad y lo demás invisible. Ahora la barra
   se desliza con el dedo, sin barra de scroll a la vista, y el borde del
   lado donde hay más se esfuma: así se nota que sigue. Las clases las pone
   _tbBordes() (app.js) según dónde está el scroll; sin JS, solo se desliza.
   Ningún botón se saca. Va desde 999 px porque ese es el corte donde la
   barra pasa a íconos solos; en la PC no cambia nada.
   Se usa máscara y no un degradé pegado (sticky): en un flex que scrollea,
   un sticky solo acompaña hasta un ancho de pantalla y después se va.
   ============================================================ */
@media (max-width: 999px) {
    .topbar {
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .topbar::-webkit-scrollbar { display: none; }
    .topbar.tb-mas-der {
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
                mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
    }
    .topbar.tb-mas-izq {
        -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 44px), transparent);
                mask-image: linear-gradient(to left, #000 calc(100% - 44px), transparent);
    }
    .topbar.tb-mas-izq.tb-mas-der {
        -webkit-mask-image: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent);
                mask-image: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent);
    }
}

/* ============================================================
   💵 Pago repartido entre varios trabajos (09/10/26)
   Vista previa del reparto: una fila por trabajo, en el orden en que se
   tildaron, con lo que se le aplica y lo que le queda. El borde izquierdo
   dice el estado: saldado (verde) · parcial (ámbar) · sin pago / ya pagado (apagado).
   ============================================================ */
.rpl-lista {
    display: flex; flex-direction: column; gap: 6px;
    max-height: 42vh; overflow-y: auto;
}
.rpl-fila {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: 6px;
}
.rpl-fila.rpl-completo { border-left-color: var(--ok); }
.rpl-fila.rpl-parcial  { border-left-color: var(--warn); }
.rpl-fila.rpl-sin_pago,
.rpl-fila.rpl-ya_pagado { opacity: 0.6; }
.rpl-n {
    flex: 0 0 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--panel-2); color: var(--muted);
    font-size: 11px; font-weight: 700;
}
.rpl-txt { flex: 1 1 auto; min-width: 0; }
.rpl-tit {
    color: var(--text); font-size: 13px; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rpl-txt small, .rpl-montos small { color: var(--muted); font-size: 11px; }
.rpl-montos {
    flex: 0 0 auto; text-align: right;
    display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
}
.rpl-montos strong { color: var(--text); font-size: 14px; }
.rpl-montos .rpl-cero { color: var(--muted); }
.rpl-montos .rpl-ok   { color: var(--ok); }
.rpl-montos .rpl-parc { color: var(--warn); }
.rpl-aviso {
    margin-top: 8px; padding: 8px 10px; border-radius: 6px;
    font-size: 12.5px; line-height: 1.45;
    background: var(--panel-2); color: var(--text);
}
.rpl-aviso.ok    { border-left: 3px solid var(--ok); }
.rpl-aviso.error { border-left: 3px solid var(--danger); background: rgba(255, 71, 87, 0.10); }
.rpl-aviso .btn-mini { margin-left: 6px; }
.rpl-marca { font-size: 10px; color: var(--muted); white-space: nowrap; cursor: help; }
@media (max-width: 700px) {
    .rpl-lista { max-height: none; }
    .rpl-tit { white-space: normal; }
}

/* ============================================================
   💵 Cobrar / Facturar (20/10/26)
   · Tarjetas tildadas con su número de orden: el 1 se salda primero, el último recibe
     lo que queda. Destildar renumera.
   · En el cuadro (21/10/26): arriba, qué se hace —🧾 Solo facturar / 💵 Solo cobrar /
     💵🧾 Cobrar y facturar— y se ve solo lo que sirve para eso (clase cf-m-<modo> en el
     cuadro). El orden del reparto se cambia arrastrando la fila desde ⠿ (mouse y dedo).
   ============================================================ */
.trab-check { flex-direction: column; gap: 3px; }
.trab-orden {
    min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--neon); color: #0a0a12;
    font-size: 11px; font-weight: 800; line-height: 1;
    cursor: help;
}
.trab-orden[hidden] { display: none; }
.cf-orden {
    flex: 0 0 auto;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.cf-agarre {
    width: 34px; height: 30px; box-sizing: border-box;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--panel-2); color: var(--muted);
    font-size: 18px; line-height: 1; cursor: grab;
    touch-action: none;            /* el dedo arrastra la fila, no hace scroll */
    user-select: none; -webkit-user-select: none;
}
.cf-agarre:hover, .cf-agarre:focus-visible { border-color: var(--neon); color: var(--neon); outline: none; }
.fa-row.cf-levantada {
    background: var(--card); border: 1px solid var(--neon) !important; border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); opacity: 0.96; pointer-events: none;
}
.fa-row.cf-levantada .cf-agarre { cursor: grabbing; }
.cf-hueco { border: 2px dashed var(--neon); border-radius: 8px; background: rgba(0, 240, 255, 0.06); box-sizing: border-box; margin: 4px 0; }
body.cf-arrastrando, body.cf-arrastrando * { user-select: none !important; -webkit-user-select: none !important; cursor: grabbing !important; }
.fa-row.cf-parcial  { box-shadow: inset 3px 0 0 var(--warn); }
.fa-row.cf-completo { box-shadow: inset 3px 0 0 var(--ok); }
/* Selector de qué hacer: tres botones grandes (se tocan con el dedo). */
.cf-modos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cf-modo {
    min-height: 56px; padding: 8px 6px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel-2); color: var(--text);
    font-size: 14px; font-weight: 600; line-height: 1.15; text-align: center;
    cursor: pointer; touch-action: manipulation;
}
.cf-modo .cf-modo-ico { font-size: 18px; }
.cf-modo:hover:not(:disabled) { border-color: var(--neon); }
.cf-modo.activo { border: 2px solid var(--neon); background: rgba(0, 240, 255, 0.12); color: var(--neon); }
.cf-modo:disabled { opacity: 0.35; cursor: not-allowed; }
.cf-modo-ayuda { margin-top: 6px; font-size: 12.5px; }
.cf-modo-ayuda .cf-modo-no { color: var(--muted); font-size: 11.5px; }
/* Qué se ve según lo elegido */
.cf-m-cobrar .cf-solo-fact,
.cf-m-facturar .cf-solo-cobro,
.form-modal:not(.cf-m-cobrar) .cf-solo-m-cobrar,
.form-modal:not(.cf-m-facturar) .cf-solo-m-facturar { display: none !important; }
#cf_motivo { margin-top: 10px; }
/* El botón final dice lo elegido («💵🧾 Cobrar y facturar (embebido)»): en celular se parte en
   dos renglones en vez de empujar «Cancelar» fuera del cuadro. */
.cf-m-facturar .form-modal-actions > .btn-cyan,
.cf-m-ambos .form-modal-actions > .btn-cyan { flex: 0 1 auto; min-width: 0; white-space: normal; line-height: 1.25; }
@media (max-width: 700px) {
    .cf-agarre { width: 40px; height: 36px; font-size: 20px; }
    .cf-modo { font-size: 13px; min-height: 60px; }
}
/* (Acá había una «}» de más que el navegador descartaba junto con la regla siguiente: se tragaba
   la primera regla de lo que se agregara abajo. Sacada el 21/10/26.) */

/* 🧾 Facturar a (22/10/26): a quién sale la factura (el cliente u otro CUIT que pagó por él). */
.cf-fa-box { margin-top: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: rgba(0, 240, 255, 0.04); }
.cf-fa-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cf-fa-head strong { font-size: 14px; }
.cf-fa-letra { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--neon); color: var(--neon); }
.cf-fa-letra:empty { display: none; }
.cf-fa-head .cf-fa-cambiar { margin-left: auto; }
.cf-fa-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cf-fa-chips:empty { display: none; }
.cf-fa-chip {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--card); color: var(--text); font-size: 12px; cursor: pointer; text-align: left;
}
.cf-fa-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-fa-chip:hover { border-color: var(--neon); }
.cf-fa-chip.activo { border: 2px solid var(--neon); background: rgba(0, 240, 255, 0.12); color: var(--neon); }
.cf-fa-chip .cf-fa-quitar { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.cf-fa-chip .cf-fa-quitar:hover { color: var(--danger); }
.cf-fa-datos { margin-top: 8px; font-size: 13px; line-height: 1.5; }
.cf-fa-datos .cf-fa-falta { color: var(--danger); }
.cf-fa-otro { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.cf-fa-otro .cf-fa-full { grid-column: 1 / -1; }
.cf-fa-otro label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.cf-fa-otro input[type=text], .cf-fa-otro select {
    width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg); color: var(--text); font-size: 13.5px;
}
.cf-fa-cuit-fila { display: flex; gap: 6px; }
.cf-fa-cuit-fila input { flex: 1 1 auto; min-width: 0; }
.cf-fa-cuit-fila .btn-mini { flex: 0 0 auto; white-space: nowrap; }
.cf-fa-estado { font-size: 12px; min-height: 16px; }
.cf-fa-estado.ok { color: var(--ok); }
.cf-fa-estado.error { color: var(--danger); }
.cf-fa-otro label.cf-fa-guardar { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.cf-fa-guardar input { width: 18px; height: 18px; accent-color: var(--neon); flex: 0 0 auto; }
.cf-fa-nota { margin-top: 6px; font-size: 11.5px; }
.cf-fa-error { margin-top: 8px; white-space: pre-line; }
.cf-fact-alt { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
@media (max-width: 600px) {
    .cf-fa-otro { grid-template-columns: 1fr; }
    .cf-fa-head .cf-fa-cambiar { margin-left: 0; }
}
/* 💳 Facturar por pago (25/11/26): en «Solo facturar», cada pago sin facturar con su tilde y su «Facturar a». */
.fa-q-pagos:empty { display: none; }
.fa-q-pagos { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.cf-pago { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--card); }
.cf-pago.on { border-color: var(--neon); background: rgba(0, 240, 255, 0.06); }
.cf-pago-sel { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; margin: 0; }
.cf-pago-sel input { width: 18px; height: 18px; accent-color: var(--neon); flex: 0 0 auto; margin-top: 1px; }
.cf-pago-nota { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cf-pago-rec { display: flex; gap: 6px; align-items: center; margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.cf-pago-rec select { flex: 1 1 auto; min-width: 0; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 12px; }
.cf-pago:not(.on) .cf-pago-rec { display: none; }
.cf-grupos { margin-top: 8px; padding: 8px 12px; border: 1px dashed var(--neon); border-radius: 8px; font-size: 12.5px; line-height: 1.5; }
.cf-grupos:empty { display: none; }
.cf-grupos ol { margin: 4px 0 0; padding-left: 20px; }
.cf-otro-cuit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.cf-otro-cuit .cf-fa-full { grid-column: 1 / -1; }
.cf-otro-cuit label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.cf-otro-cuit input[type=text], .cf-otro-cuit select {
    width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg); color: var(--text); font-size: 13.5px;
}
.cf-otro-cuit label.cf-fa-guardar { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
@media (max-width: 600px) { .cf-otro-cuit { grid-template-columns: 1fr; } }

/* ============================================================
   🔎 Buscar cliente en la barra (21/10/26) — reemplazó al botón 👥.
   El desplegable vive en <body> (position:fixed, lo ubica app.js): z 8800, arriba de
   la barra (8450) y del contenido, abajo de los modales (9000+). Ver cbCliIniciar().
   ============================================================ */
.cb-cli { position: relative; display: inline-flex; align-items: center; flex: 0 1 240px; min-width: 170px; }
/* El filtro de la vista (a la izquierda) cede lugar antes que la barra se desborde: sin esto
   su ancho mínimo era el intrínseco del <input> (~200 px) y empujaba el reloj fuera de la pantalla. */
.topbar .search-bar { min-width: 120px; }
.cb-cli .cb-cli-btn { display: none !important; }
.cb-cli-input {
    width: 100%; padding: 8px 12px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 18px; outline: none; font-size: 13.5px;
}
.cb-cli-input:focus { border-color: var(--neon); box-shadow: 0 0 10px rgba(0,240,255,0.18); }
.cb-cli-input::-webkit-search-cancel-button { display: none; }
.cb-cli-pend {
    position: absolute; top: -6px; right: -6px; z-index: 1; cursor: pointer;
    background: var(--danger); color: #fff; border-radius: 10px; padding: 1px 6px;
    font-size: 11px; font-weight: 700; line-height: 1.4;
}
.cb-cli-drop {
    position: fixed; z-index: 8800; overflow-y: auto; overscroll-behavior: contain;
    background: var(--panel); border: 1px solid var(--neon); border-radius: 10px;
    box-shadow: var(--shadow); padding: 4px 0;
}
.cb-cli-tit { padding: 6px 12px 2px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cb-cli-op { padding: 8px 12px; cursor: pointer; color: var(--text); }
.cb-cli-op.act, .cb-cli-op:hover { background: rgba(0, 240, 255, 0.10); }
.cb-cli-nom { font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.cb-cli-pendm { color: var(--danger); font-size: 12px; font-weight: 600; white-space: nowrap; }
.cb-cli-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
span.cb-cli-sub { margin-top: 0; }
.cb-cli-info { padding: 8px 12px; font-size: 12.5px; color: var(--muted); }
.cb-cli-pie { border-top: 1px solid var(--border); font-size: 13.5px; font-weight: 600; }
.cb-cli-crear { color: var(--neon); }

/* Celular / tablet: el campo no entra en la barra → se ve el 🔎 (chip como los demás) y
   al tocarlo el campo se despliega a lo ancho, sobre la misma barra. */
@media (max-width: 999px) {
    .cb-cli { flex: 0 0 auto; min-width: 0; }
    .topbar .cb-cli .cb-cli-btn { display: inline-flex !important; }
    .cb-cli-input { display: none; }
    .cb-cli.exp .cb-cli-input {
        display: block; position: fixed; left: 8px; right: 8px; width: auto;
        top: var(--cb-top, 8px); height: 42px; z-index: 8810;
        font-size: 16px;   /* < 16px iOS hace zoom al enfocar */
        background: var(--panel); border-color: var(--neon);
    }
    .cb-cli-pend { top: -4px; right: -4px; }
    .cb-cli.exp .cb-cli-pend { display: none !important; }   /* asomaba por arriba del campo abierto */
}

/* ============================================================
   🤖 Análisis con IA (monitor_ia.php) — modal arriba del 🩺
   ============================================================ */
/* (24/10/26) Casi toda la pantalla, dos columnas (tarjetas | chat) con divisor arrastrable. Alto en dvh: el pie
   del chat tiene que verse a 1366×680 (CIA Patron_Modales §12). */
.ia-modal { width: 98vw; max-width: 1800px; height: 94vh; height: calc(100dvh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; padding: 14px 16px; overflow: hidden; }
.ia-cab { padding-right: 40px; margin-bottom: 8px; flex-shrink: 0; overflow: visible; }
.ia-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ia-tenue { color: var(--muted); }
.ia-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-top: 8px; }
.ia-consumo { font-size: 12.5px; margin: 4px 8px 4px 0; }
.ia-acciones { display: flex; flex-wrap: wrap; align-items: center; }
.ia-acciones > * { margin-left: 6px; margin-top: 4px; }
.ia-hist { max-width: 230px; font-size: 12.5px; padding: 5px 6px; }
.ia-btn { padding: 5px 11px; font-size: 12.5px; }
.ia-btn-mini { white-space: nowrap; }
.ia-aviso { margin-top: 8px; padding: 7px 10px; border-radius: 7px; font-size: 13px; background: rgba(224,168,0,.12); border-left: 4px solid #e0a800; }
.ia-aviso-rojo { background: rgba(255,77,79,.12); border-left-color: #ff4d4f; }
.ia-cols { flex: 1 1 auto; min-height: 0; display: flex; overflow: hidden; }
.ia-cols.arrastrando { user-select: none; cursor: col-resize; }
.ia-izq { flex: 0 0 calc(var(--ia-izq, 50%) - 6px); min-width: 0; overflow-y: auto; padding-right: 6px; }
.ia-div { flex: 0 0 12px; cursor: col-resize; touch-action: none; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.ia-div span { width: 4px; height: 48px; border-radius: 3px; background: var(--border); transition: background .15s; }
.ia-div:hover span, .ia-div.arrastrando span, .ia-div:focus-visible span { background: var(--neon); }
.ia-der { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; padding-left: 6px; overflow: hidden; }
.ia-der-tit { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; flex-shrink: 0; }
.ia-solapas { display: none; flex-shrink: 0; gap: 4px; margin-bottom: 6px; }
.ia-solapa { flex: 1; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: inherit; font-size: 13px; cursor: pointer; }
.ia-solapa.activa { border-color: var(--neon); background: rgba(0,240,255,.10); font-weight: 600; }
.ia-body { min-height: 100px; }
.ia-semaforo { padding: 9px 12px; border-radius: 10px; margin-bottom: 10px; border: 1px solid; }
.ia-sem-l1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14.5px; }
.ia-sem-cont { font-size: 12.5px; color: var(--muted); }
.ia-sem-frase { font-size: 13.5px; margin-top: 3px; line-height: 1.45; }
.ia-vermas { font-size: 12px; white-space: nowrap; }
.ia-plg-cab { cursor: pointer; user-select: text; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; outline: none; }
.ia-plg-cab:focus-visible { box-shadow: 0 0 0 2px var(--neon); border-radius: 4px; }
.ia-flecha { display: inline-block; width: 14px; color: var(--muted); flex-shrink: 0; }
.ia-plegado > .ia-plg-cuerpo { display: none; }
.ia-card > .ia-plg-cab { font-size: 15px; font-weight: 600; }
.ia-card.ia-plegado { padding-top: 10px; padding-bottom: 10px; }
.ia-card > .ia-plg-cuerpo { margin-top: 6px; }
.ia-sec > .ia-plg-cuerpo { padding-left: 14px; }
.ia-chip-urg { font-size: 11.5px; padding: 1px 6px; border-radius: 9px; background: rgba(255,77,79,.15); color: #ff4d4f; font-weight: 600; }
.ia-sel-btn { position: fixed; z-index: 20; padding: 6px 11px; border-radius: 16px; border: 1px solid var(--neon); background: var(--panel); color: inherit; font-size: 13px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.35); white-space: nowrap; }
/* Fondo SÓLIDO al pasar el mouse: con rgba se veía el texto de abajo a través del botón (24/10/26). */
.ia-sel-btn:hover { background: color-mix(in srgb, var(--neon) 14%, var(--panel)); }
.ia-cargando { text-align: center; padding: 30px 10px; color: var(--muted); }
.ia-cargando .spinner { margin: 0 auto 12px; }
.ia-error { padding: 16px; border-radius: 8px; background: rgba(255,77,79,.10); border-left: 4px solid #ff4d4f; line-height: 1.5; }
.ia-resumen { padding: 10px 12px; border-radius: 8px; background: rgba(0,240,255,.07); margin-bottom: 10px; line-height: 1.5; white-space: pre-wrap; }
.ia-card { margin-bottom: 10px; }
.ia-card h3 { margin: 0 0 6px; font-size: 15px; }
.ia-estado { font-size: 12.5px; font-weight: 600; margin-left: 6px; }
.ia-pc-resumen { font-size: 13.5px; margin-bottom: 6px; white-space: pre-wrap; }
.ia-sec { margin: 8px 0; }
.ia-sec-tit { font-weight: 600; font-size: 13.5px; }
.ia-sec ul, .ia-sec ol { margin: 2px 0 0; padding-left: 22px; }
.ia-sec li { margin: 4px 0; line-height: 1.45; font-size: 13.5px; }
.ia-sec-urgente .ia-sec-tit { color: #ff4d4f; }
.ia-fuente { font-size: 11.5px; color: var(--muted); word-break: break-word; }
.ia-chat { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; margin-bottom: 6px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; }
.ia-chat-vacio { margin: auto; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; padding: 16px; }
.ia-cita { display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; margin-bottom: 6px; border-left: 3px solid var(--neon); background: rgba(0,240,255,.07); border-radius: 6px; font-size: 12.5px; flex-shrink: 0; }
.ia-cita[hidden] { display: none; }
.ia-cita-txt { flex: 1; max-height: 4.6em; overflow-y: auto; word-break: break-word; }
.ia-cita-x { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; }
.ia-msg-cita { font-size: 12px; color: var(--muted); border-left: 2px solid var(--neon); padding-left: 6px; margin-bottom: 4px; font-style: italic; }
.ia-md { white-space: normal; }
.ia-md p { margin: 0 0 6px; }
.ia-md ul, .ia-md ol { margin: 2px 0 6px; padding-left: 20px; }
.ia-md li { margin: 2px 0; }
.ia-md code { font-size: 12px; padding: 0 4px; border-radius: 4px; background: rgba(127,127,140,.18); }
.ia-md-h { font-weight: 700; margin: 4px 0; }
.ia-msg { max-width: 85%; padding: 7px 10px; border-radius: 10px; margin: 3px 0; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.ia-msg-yo { align-self: flex-end; background: rgba(0,240,255,.12); }
.ia-msg-ia { align-self: flex-start; background: var(--panel-2); }
.ia-msg-err { background: rgba(255,77,79,.12); }
.ia-msg-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.ia-preguntar { display: flex; align-items: flex-end; flex-shrink: 0; }
.ia-preg-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-right: 8px; }
.ia-preguntar textarea { width: 100%; resize: vertical; min-height: 40px; max-height: 30vh; }
.ia-precios summary { cursor: pointer; font-size: 13px; margin-bottom: 6px; }
.ia-tabla { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 8px; }
.ia-tabla th, .ia-tabla td { border-bottom: 1px solid var(--border); padding: 3px 5px; text-align: left; }
/* Celular: solapas «Análisis | Chat», sin divisor. */
@media (max-width: 759px) {
    .ia-solapas { display: flex; }
    .ia-div { display: none; }
    .ia-izq { flex: 1 1 auto; padding-right: 0; }
    .ia-der { padding-left: 0; }
    .ia-cols[data-ver="analisis"] .ia-der, .ia-cols[data-ver="chat"] .ia-izq { display: none; }
    .ia-der-tit { display: none; }
}
@media (max-width: 600px) {
    .ia-modal { padding: 12px 10px; width: 100vw; height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
    #iaModal.modal-backdrop { padding: 8px 0; }
    #iaModal .ia-barra { margin-top: 4px; }
    #iaModal .ia-consumo { font-size: 11.5px; margin: 2px 0; }
    #iaModal .ia-acciones { width: 100%; }
    #iaModal .ia-acciones > .ia-hist { flex: 1 1 100%; margin-left: 0; }
    #iaModal .ia-acciones > .ia-btn { flex: 1 1 auto; margin-left: 0; margin-right: 4px; padding: 4px 8px; font-size: 12px; min-height: 0; }
    #iaModal .ia-sub { font-size: 11px; }
    .ia-hist { max-width: 100%; }
    .ia-msg { max-width: 95%; }
}

/* ============================================================
   Trabajos del cliente: «Debe $X» primero y pagos/facturas colgando
   (22/10/26, como los cargos del mes del ERP — CIA Patron_Lista_Movimientos §4)
   ============================================================ */
.trabajo-honorarios.tm {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
    color: var(--text); font-weight: 400;
}
.trabajo-card-body { min-width: 0; }
.tm .tm-total  { color: var(--muted); font-size: 11px; white-space: nowrap; }
.tm .tm-estado { font-weight: 800; font-size: 15px; white-space: nowrap; margin-left: auto; text-align: right; }
.tm .tm-estado.debe  { color: var(--danger); }
.tm .tm-estado.ok    { color: var(--ok); font-size: 13px; }
.tm .tm-estado.favor { color: #1e90ff; font-size: 13px; }

.trab-pagos { margin-top: 5px; display: flex; flex-direction: column; gap: 3px; }
.tp-pago, .tp-factura {
    margin-left: 10px; padding: 3px 8px; border-radius: 5px; font-size: 11px; line-height: 1.35;
    border-left: 3px solid #4ade80;
    background: color-mix(in srgb, #4ade80 7%, transparent);
}
.tp-row { display: flex; align-items: baseline; gap: 8px; }
.tp-desc { flex: 1 1 auto; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-monto { flex: 0 0 auto; margin-left: auto; text-align: right; font-weight: 700; white-space: nowrap; color: var(--ok); }
.tp-pago.neg { border-left-color: var(--muted); background: transparent; }
.tp-pago.neg .tp-monto { color: var(--muted); }
.tp-fact { margin-top: 1px; padding-left: 10px; }
.tp-fact-num { color: var(--neon); text-decoration: none; font-size: 11px; white-space: nowrap; }
a.tp-fact-num:hover { text-decoration: underline; }
/* Factura suelta (no cuelga de un pago) y factura esperando pago (ámbar) */
.tp-factura { border-left-color: var(--neon); background: color-mix(in srgb, var(--neon) 5%, transparent); }
.tp-factura .tp-monto { color: var(--muted); font-weight: 600; }
.tp-factura.espera { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.tp-factura.espera .tp-monto { color: var(--warn); font-weight: 700; }
.tp-factura .tp-desc .tp-fact-num { font-weight: 600; }
.tp-mas {
    margin-left: 10px; align-self: flex-start; background: none; border: none; padding: 1px 4px;
    color: var(--muted); font-size: 11px; cursor: pointer; text-decoration: underline dotted;
}
.tp-mas:hover { color: var(--neon); }
/* En el celular todo button va a 16px !important (anti-zoom de iOS): este es un link chico, no un campo. */
.trab-pagos .tp-mas { font-size: 11px !important; min-height: 0; width: auto; }
@media (max-width: 640px) {
    .tp-pago, .tp-factura { margin-left: 4px; }
    .tp-desc { white-space: normal; }
    .tm .tm-estado { font-size: 16px; }
}
.tp-factura .tp-row { flex-wrap: wrap; }
.tp-factura .tp-desc { white-space: normal; }
/* Pago y su factura en el mismo renglón (22/10/26): dos columnas fijas para que queden alineadas
   renglón a renglón; dentro de cada una, rótulo y valor en la misma línea y, si no entra, el valor
   baja debajo del rótulo (flex-wrap). */
.tp-linea { display: flex; gap: 4px; margin-left: 10px; align-items: stretch; }
.tp-linea .tp-pago { margin-left: 0; flex: 0 0 calc(45% - 2px); min-width: 0; }
.tp-linea .tp-pago, .tp-fact-cel {
    display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 0;
}
.tp-linea .tp-pago .tp-monto { margin-left: auto; }
.tp-lbl { color: var(--muted); white-space: nowrap; }
.tp-fact-cel {
    flex: 1 1 55%; min-width: 0; padding: 3px 8px; border-radius: 5px; font-size: 11px; line-height: 1.35;
    border-left: 3px solid #3b82f6; background: color-mix(in srgb, #3b82f6 9%, transparent);
}
.tp-fact-cel .tp-fact-num { color: #3b82f6; font-weight: 600; margin-left: auto; white-space: nowrap; }
@media (max-width: 640px) { .tp-linea { margin-left: 4px; } }


/* ============================================================
   Tarjeta de equipo en la FICHA del cliente (22/10/26, pedido del dueño).
   Lo que más se ve es el ALIAS («Hotel», «Fernanda»): título grande en
   negrita. Marca/modelo + S/N útil en un renglón chico y gris (cortado con …)
   y el estado de conexión con la campanita en UNA línea.
   Los botones van en una fila DEBAJO, repartidos a todo el ancho: antes iban
   a la derecha y el texto se cortaba en 4-5 renglones con espacio muerto
   abajo. Solo cuando la lista es ancha (container query) pasan a la derecha.
   Selectores con `.eq-lista` delante para ganarle por especificidad (y orden)
   a `.three-cols .list-item.compact` y `.t-cell-equipos .list-item.compact`.
   ============================================================ */
.eq-lista { container-type: inline-size; container-name: eqlista; }
.eq-lista .list-item.eq-ficha {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    grid-template-areas: "av main" "av acc";
    column-gap: 8px;
    row-gap: 7px;
    align-items: start;
    padding: 8px 10px 8px 12px;
}
.eq-lista .list-item.eq-ficha > .list-avatar { grid-area: av; }
.eq-lista .list-item.eq-ficha > .list-main   { grid-area: main; min-width: 0; }
.eq-ficha-titulo {
    display: flex; align-items: center; gap: 6px; min-width: 0;
    font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--text);
}
.eq-ficha-alias { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-ficha-titulo .badge { flex-shrink: 0; font-weight: 600; }
.eq-ficha-sub {
    font-size: 11px; line-height: 1.35; color: var(--muted); margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eq-ficha .hcb-visto {
    display: flex; align-items: baseline; gap: 5px; min-width: 0; margin-top: 2px; overflow: hidden;
    font-size: 11px; line-height: 1.35; color: var(--muted); white-space: nowrap;
}
.eq-ficha .hcb-visto strong { color: var(--text); }
/* El estado se lee entero; si no entra, lo que se corta es la campanita. */
.eq-ficha .hcb-visto-txt { flex: 0 0 auto; }
.eq-ficha .hcb-visto-sep { flex: 0 0 auto; opacity: .7; }
.eq-ficha .hcb-visto .hcb-bell { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.eq-ficha-acc { grid-area: acc; display: flex; gap: 5px; min-width: 0; }
.eq-ficha .eq-ficha-acc .equipo-edit-btn {
    flex: 1 1 0; min-width: 0; margin: 0;
    padding: 4px 0; font-size: 14px; line-height: 1.2; text-align: center; white-space: nowrap;
}
@media (max-width: 700px) {
    .eq-ficha .eq-ficha-acc .equipo-edit-btn { padding: 7px 0; }
}
/* Lista ancha (ficha en pantalla grande, celular apaisado): los botones
   entran a la derecha sin apretar el texto. */
@container eqlista (min-width: 480px) {
    .eq-lista .list-item.eq-ficha {
        grid-template-columns: 22px minmax(0, 1fr) auto;
        grid-template-areas: "av main acc";
    }
    .eq-ficha-acc { align-self: center; }
    .eq-ficha .eq-ficha-acc .equipo-edit-btn { flex: 0 0 auto; padding: 4px 9px; }
}
/* El encabezado de la sección (⛶ + 🔄 🤖 Analizar con IA) en la columna angosta
   de 1366 se pasaba del ancho y metía scroll horizontal en toda la lista:
   que baje de renglón lo que no entra. */
.t-cell-equipos .col-section-title { flex-wrap: wrap; row-gap: 6px; }

/* ============================================================
   Contactos del cliente: N teléfonos y N mails con etiqueta (22/10/26)
   ============================================================ */
.cto-editor { display: flex; flex-direction: column; gap: 10px; }
.cto-sec { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.cto-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.cto-lista { display: flex; flex-direction: column; gap: 6px; }
.cto-fila { display: flex; align-items: center; gap: 5px; border-radius: 6px; padding: 2px; }
.cto-fila.es-principal { background: rgba(0, 240, 255, 0.07); }
.cto-fila.arrastrando { opacity: .45; }
.cto-fila .cto-etq { flex: 0 0 34%; min-width: 0; }
.cto-fila .cto-val { flex: 1 1 auto; min-width: 0; }
.cto-drag { cursor: grab; color: var(--muted); font-size: 16px; padding: 0 2px; user-select: none; }
.cto-btn { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 5px;
           min-width: 28px; height: 30px; padding: 0 5px; cursor: pointer; font-size: 12px; flex: 0 0 auto; }
.cto-btn:hover { border-color: var(--neon); }
.cto-star { font-size: 14px; }
.cto-quitar:hover { border-color: var(--danger); color: var(--danger); }
.cto-ayuda { margin-top: 0; }
.cto-hist-btn { color: var(--neon); margin-left: 6px; background: none; border: none; cursor: pointer; text-decoration: underline; font-size: inherit; padding: 0; }
.cto-hist-fila { padding: 7px 0; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
.cto-hist-fila:last-child { border-bottom: 0; }
.cto-hist-cuando { color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
div.cto-hist { max-height: 55vh; overflow-y: auto; }
@media (max-width: 560px) {
    /* En el celular: etiqueta arriba y el dato abajo, los botones a la derecha. */
    .cto-fila { flex-wrap: wrap; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
    .cto-fila .cto-etq { flex: 1 1 calc(100% - 70px); }
    .cto-fila .cto-val { flex: 1 1 calc(100% - 110px); order: 5; }
    .cto-fila .cto-btn:not(.cto-star) { order: 6; }
}
/* La etiqueta de cada teléfono/mail es libre («Mail administración»): puede ocupar dos renglones. */
.data-list.data-list-grid .data-row-cto { grid-template-columns: 112px 1fr auto; }
.data-list.data-list-grid .data-row-cto .data-label { white-space: normal; overflow-wrap: break-word; line-height: 1.25; }
/* A qué mail va la factura (cuando el cliente tiene más de uno). */
.fa-mail-dest { margin: 6px 0 0 44px; max-width: calc(100% - 44px); padding: 6px 10px; border-radius: 6px;
               background: var(--card); color: var(--text); border: 1px solid var(--border); font-size: 13px; }

/* Barras de desplazamiento finas en todo el CRM (pedido del dueño, 24/10/26). */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 70%, transparent); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* ⚙ Configuración de IA: campos con rótulo arriba y a todo el ancho (24/10/26). */
#iaCfgModal .form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
#iaCfgModal .form-group > label, #iaCfgModal .ia-precios > label {
    font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
#iaCfgModal input[type=password], #iaCfgModal input[type=date], #iaCfgModal input[type=number],
#iaCfgModal select, #iaCfgModal textarea {
    width: 100%; box-sizing: border-box; padding: 9px 12px; font-size: 14px; color: var(--text);
    background: var(--panel-2, var(--panel)); border: 1px solid var(--border, #d8dee9); border-radius: 8px;
}
#iaCfgModal input:focus, #iaCfgModal select:focus, #iaCfgModal textarea:focus { outline: none; border-color: var(--neon); }
#iaCfgModal h3 { margin-bottom: 14px; }
.ia-agente-tit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.ia-ayuda { display: inline-block; }
.ia-ayuda[open] { display: block; flex-basis: 100%; }
.ia-ayuda-txt { margin-top: 6px; }
/* La ayuda se abre DENTRO del modal, a todo el ancho (como popover flotante se salía del modal). */
.ia-ayuda > summary { list-style: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 50%; }
.ia-ayuda > summary::-webkit-details-marker { display: none; }
.ia-ayuda[open] > summary { background: color-mix(in srgb, var(--neon) 18%, transparent); }
.ia-ayuda-txt {
    flex-basis: 100%; box-sizing: border-box; padding: 10px 12px;
    font-size: 12.5px; font-weight: 400; line-height: 1.45; color: var(--text);
    background: var(--panel); border: 1px solid var(--border, #d8dee9); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.ia-ayuda-txt code { word-break: break-all; font-size: 11.5px; }

/* ============================================================
   Ficha del cliente compacta (24/10/26, pedido del dueño: «aprovechar
   espacios, sin espacios en blanco al pedo»). Columna izquierda de
   /clientes/:id (renderClienteCentralCol). Antes: 6 KPIs en tarjetas de
   2×3 (~230 px), contactos con alto fijo y la dirección cortada, ~30 px
   muertos antes de Equipos, los botones de Equipos desparramados y la lista
   de equipos con scroll propio adentro del de la columna.
   Lo que depende del ANCHO DE LA FICHA va por container query (clificha), no
   por el de la pantalla: con el menú fijado, a 1366 px la ficha mide ~450 px;
   a 1920, ~800.
     · angosta (< 700): KPIs en dos renglones (--kpi-cols lo pone el JS) o en
       uno desde 600; las notas son un chip más; equipos a todo el ancho.
     · ancha (>= 700): KPIs en un renglón, contactos de a dos columnas,
       Notas | Equipos lado a lado.
   UN solo scroll: la lista de equipos ya no tiene scroll propio (el arrastre
   para ordenar busca el contenedor que scrollea, así que sigue andando). La
   de notas lo conserva solo lado a lado: puede tener decenas y trae buscador.
   `#app` adelante para ganarle a las reglas viejas por ancho de pantalla.
   ============================================================ */
.cli-ficha { container: clificha / inline-size; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#app .cli-ficha > .col-header { margin: 0; padding-bottom: 8px; }
#app .cli-ficha > .data-list { margin: 0; }
#app .cli-ficha > .t-grid { margin: 0; min-height: 0; gap: 8px; grid-template-columns: minmax(0, 1fr); }

/* --- KPIs: chips de un renglón (rótulo chico arriba, monto abajo) --- */
#app .cf-kpis { display: grid; grid-template-columns: repeat(var(--kpi-cols, 3), minmax(0, 1fr)); gap: 6px; }
#app .cf-kpi {
    --c: var(--neon);
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0;
    padding: 5px 9px 6px; margin: 0;
    background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
    font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s;
}
#app .cf-kpi:hover { border-color: var(--c); }
#app .cf-kpi.kpi-fact  { --c: #00f0ff; }
#app .cf-kpi.kpi-pag,
#app .cf-kpi.kpi-saldo { --c: var(--ok); }
#app .cf-kpi.kpi-pend  { --c: var(--danger); }
#app .cf-kpi.cf-kpi-notas { --c: var(--text); }
.cf-kpi-lbl {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 10px; line-height: 1.3; letter-spacing: .4px; text-transform: uppercase; color: var(--muted);
}
.cf-kpi-val {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--c);
}
#app .cf-kpi.kpi-pend .cf-kpi-val.cero { color: var(--ok); }
.cf-kpi-ok { color: var(--c); font-weight: 800; }
/* Filtro puesto: lleno de color + ✓ + sombra (CIA Patron_UI_Compacta §1.4). */
#app .cf-kpi.active {
    border-color: var(--c);
    background: color-mix(in srgb, var(--c) 15%, var(--bg));
    box-shadow: 0 2px 10px color-mix(in srgb, var(--c) 28%, transparent);
}
#app .cf-kpi.active .cf-kpi-lbl { color: var(--text); }

/* --- Contactos: alto natural, rótulo angosto, botones juntos a la derecha --- */
#app .cf-datos {
    display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 18px;
    padding: 2px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.cf-row {
    display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; grid-template-areas: "lbl val acc";
    align-items: center; gap: 2px 8px; padding: 5px 0; min-height: 30px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.cf-lbl { grid-area: lbl; font-size: 10px; line-height: 1.25; letter-spacing: .4px; text-transform: uppercase;
          color: var(--muted); overflow-wrap: anywhere; }
.cf-val { grid-area: val; min-width: 0; font-size: 13px; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.cf-acc { grid-area: acc; display: flex; gap: 4px; }
#app .cf-acc .ico-btn { width: 28px; height: 28px; font-size: 13px; }
.cf-datos > :last-child { border-bottom: 0; }
#app .cf-datos.plegado .cf-extra { display: none; }
.cf-mas { justify-self: start; background: none; border: 0; padding: 5px 0; color: var(--neon);
          font-size: 12px; font-weight: 600; cursor: pointer; }
.cf-mas:hover { text-decoration: underline; }
#app .cf-datos .cf-recom { padding: 6px 0 !important; border-bottom: 0; }

/* --- Secciones Notas / Equipos: título a la izquierda, botones juntos a la derecha --- */
#app .cli-ficha .t-cell { padding: 10px; }
#app .cli-ficha .t-cell.t-cell-equipos { max-height: none; overflow: visible; container: eqcelda / inline-size; }
#app .cli-ficha .cf-sec-head { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; margin: 0 0 8px; min-width: 0; }
.cf-sec-tit { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-sec-btns { display: flex; flex: 0 0 auto; gap: 4px; }
#app .cf-sec-btns .btn-mini { margin-left: 0; padding: 3px 7px; line-height: 1.35; text-transform: none; letter-spacing: 0; }
#app .cli-ficha .eq-tabs { margin: 0 0 8px; }
@container eqcelda (max-width: 370px) {
    .cf-ia-largo { display: none; }   /* «🤖 IA»; el title dice «Analizar con IA…» */
}

/* --- Ficha angosta --- */
@container clificha (max-width: 699.98px) {
    #app .cli-ficha .t-cell-notas { display: none; }
}
@container clificha (min-width: 600px) {
    #app .cf-kpis { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
}
/* Celular: el rótulo arriba del dato, así el mail tiene todo el ancho. */
@container clificha (max-width: 400px) {
    .cf-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "lbl acc" "val acc"; padding: 6px 0; }
    #app .cf-kpi { padding: 5px 7px 6px; }
    .cf-kpi-val { font-size: 14px; }
}
/* --- Ficha ancha --- */
@container clificha (min-width: 700px) {
    #app .cf-kpi-notas { display: none; }
    #app .cli-ficha > .t-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    #app .cli-ficha .t-cell.t-cell-notas { max-height: 60vh; overflow-y: auto; }
    #app .cf-datos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #app .cf-datos > .cf-dir, #app .cf-datos > .cf-recom, #app .cf-datos > .cf-mas { grid-column: 1 / -1; }
}
/* Seis chips en un renglón (ficha de 600-700): que «🧾 Facturado» entre sin cortarse. */
@container clificha (min-width: 600px) and (max-width: 699.98px) {
    #app .cf-kpi { padding: 5px 7px 6px; }
    .cf-kpi-lbl { letter-spacing: 0; }
}

/* Tarjeta de equipo sin la columna del ícono (era espacio muerto a la izquierda) y con el modelo
   al lado del nombre, chico y gris (24/10/26). */
.eq-lista .list-item.eq-ficha > .list-avatar { display: none; }
.eq-lista .list-item.eq-ficha { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "acc"; padding-left: 12px; }
@container eqlista (min-width: 480px) {
    .eq-lista .list-item.eq-ficha { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main acc"; }
}
.eq-ficha-titulo { align-items: baseline; }
.eq-ficha-alias { flex: 0 1 auto; }
.eq-ficha-mod { flex: 1 1 auto; min-width: 0; font-size: 11px; font-weight: 400; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   💻 Ficha de la PC (26/10/26): todo lo de UN equipo en un modal con solapas
   (Resumen · Alertas · Salud · Chequeos · Reportes · Análisis IA · Historial).
   Alto FIJO (no salta al cambiar de solapa) y en dvh: el pie y el visor entran en 1366×680.
   ============================================================ */
.fp-modal { max-width: 980px; width: 96vw; height: 92vh; height: calc(100dvh - 40px); max-height: 940px;
    display: flex; flex-direction: column; overflow: hidden; padding: 18px 20px 14px; }
.fp-cab { padding-right: 40px; margin-bottom: 6px; flex-shrink: 0; min-width: 0; }
.fp-cab h3 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.fp-tabs { display: flex; gap: 2px; flex-shrink: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.fp-tabs::-webkit-scrollbar { display: none; }
.fp-tab { flex: 0 0 auto; background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted);
    padding: 7px 11px; font-size: 13px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.fp-tab:hover { color: var(--text); }
.fp-tab.activa { color: var(--neon); border-bottom-color: var(--neon); font-weight: 600; }
.fp-tab-n { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 8px; background: rgba(127,127,140,.22);
    font-size: 11px; line-height: 16px; text-align: center; }
.fp-body { flex: 1; min-height: 0; overflow-y: auto; }
.fp-body.fp-body-visor { overflow: hidden; display: flex; flex-direction: column; }
.fp-cargando { text-align: center; padding: 24px; color: var(--muted); }
.fp-estado-gris { padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; border: 1px solid var(--border); background: rgba(127,127,140,.08); }
.fp-estado-gris .list-sub { margin-top: 6px !important; text-align: left !important; }
.fp-ia-linea { font-size: 13px; margin: -2px 0 10px; line-height: 1.45; }
.fp-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.fp-bloque { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: rgba(127,127,140,.04); }
.fp-bloque-tit { font-weight: bold; font-size: 13px; margin-bottom: 6px; }
.fp-al-fila { display: flex; gap: 8px; align-items: baseline; padding: 5px 8px; border-left: 3px solid; border-radius: 4px;
    margin: 3px 0; color: var(--text); text-decoration: none; }
.fp-al-fila:hover { background: rgba(127,127,140,.12); }
.fp-al-tit { flex: 1; min-width: 0; word-break: break-word; }
.fp-al-f { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.fp-mas { display: inline-block; margin-top: 4px; font-size: 12.5px; }
.fp-rep-ult { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.fp-chip { font-size: 12px; margin-left: 4px; white-space: nowrap; font-weight: normal; }
.fp-rep-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: 6px; cursor: pointer; }
.fp-rep-item:hover { border-color: var(--neon); }
.fp-rep-ic { font-size: 20px; }
.fp-rep-info { flex: 1; min-width: 0; }
.fp-rep-tit { font-weight: 600; }
.fp-rep-meta { font-size: 12px; color: var(--muted); word-break: break-word; }
.fp-rep-flecha { color: var(--muted); }
.fp-visor { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.fp-visor-barra { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.fp-visor-tit { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-visor-iframe { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #050508; }
.fp-ia-cab { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.fp-ia ul, .fp-ia ol { margin: 4px 0 4px 18px; padding: 0; }
.fp-ia li { margin: 5px 0; }
.fp-ia-sec { margin: 10px 0; }
.ia-fuente-lnk { color: var(--neon); text-decoration: underline dotted; text-underline-offset: 2px; }
.fp-hist-barra { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.fp-hist-barra .ia-tenue { margin-right: auto; font-size: 12px; }
.fp-destello { animation: fpDestello 2.4s ease-out; }
@keyframes fpDestello { 0%, 35% { box-shadow: 0 0 0 3px var(--neon); } 100% { box-shadow: 0 0 0 0 transparent; } }
/* 🧩 Completar datos */
.fp-datos-modal { max-width: 620px; width: 96vw; max-height: 90vh; max-height: calc(100dvh - 24px); display: flex; flex-direction: column; overflow: hidden; }
.fp-datos-modal h3 { margin: 0 40px 2px 0; }
.fp-datos-cuerpo { flex: 1; min-height: 0; overflow-y: auto; margin: 10px 0; }
.fp-datos-pie { display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
.fp-datos-vacio { padding: 14px; border: 1px dashed var(--border); border-radius: 10px; line-height: 1.5; }
.fp-datos-ayuda { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.fp-datos-todos { display: flex; gap: 6px; align-items: center; font-size: 12.5px; margin-bottom: 6px; cursor: pointer; }
.fp-dato-fila { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: 6px; cursor: pointer; }
.fp-dato-fila input { margin-top: 3px; flex-shrink: 0; width: 18px; height: 18px; }
.fp-dato-txt { flex: 1; min-width: 0; }
.fp-dato-campo { font-weight: 600; font-size: 13px; }
.fp-dato-cambio { font-size: 13px; word-break: break-word; }
.fp-dato-actual { color: var(--muted); text-decoration: line-through; }
@media (max-width: 640px) {
    .fp-modal { padding: 12px 12px 8px !important; }
    .fp-tab { padding: 7px 9px; font-size: 12.5px; }
    .fp-acciones .btn { flex: 1 1 auto; }
}
