/* =====================================================================
   RefriCool — estilos propios (sobre Bootstrap 5, todo local)
   ===================================================================== */

@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 500; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 700; src: url('../fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 800; src: url('../fonts/inter-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url('../fonts/inter-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url('../fonts/inter-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 700; src: url('../fonts/inter-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }

:root {
    --rc-navy: #0d2438;
    --rc-navy-2: #143450;
    --rc-azul: #0b6fb8;
    --rc-azul-claro: #e6f2fb;
    --rc-hielo: #5cc8e8;
    --rc-fondo: #f3f6fa;
    --rc-borde: #dfe6ee;
    --rc-texto: #1b2a38;
    --rc-suave: #637587;

    --rc-rojo: #d93a3a;     --rc-rojo-bg: #fdecec;
    --rc-naranja: #e8730c;  --rc-naranja-bg: #fff1e4;
    --rc-amarillo: #b98a00; --rc-amarillo-bg: #fff8d9;
    --rc-verde: #1f9a5a;    --rc-verde-bg: #e5f6ec;
    --rc-gris: #6b7785;     --rc-gris-bg: #eef1f4;

    --bs-primary: var(--rc-azul);
    --bs-primary-rgb: 11, 111, 184;
    --bs-body-font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --bs-body-color: var(--rc-texto);
    --bs-body-bg: var(--rc-fondo);
    --bs-border-color: var(--rc-borde);
    --bs-border-radius: .6rem;
    --bs-link-color: var(--rc-azul);
    --bs-link-color-rgb: 11, 111, 184;
}

html { font-size: 16.5px; }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
.text-suave { color: var(--rc-suave) !important; }
.fw-800 { font-weight: 800; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Botones ---------- */
.btn { font-weight: 600; border-radius: .55rem; }
.btn-primary { --bs-btn-bg: var(--rc-azul); --bs-btn-border-color: var(--rc-azul); --bs-btn-hover-bg: #095d9a; --bs-btn-hover-border-color: #095d9a; --bs-btn-active-bg: #084f84; }
.btn-outline-primary { --bs-btn-color: var(--rc-azul); --bs-btn-border-color: var(--rc-azul); --bs-btn-hover-bg: var(--rc-azul); --bs-btn-hover-border-color: var(--rc-azul); }
.btn-wa { background: #1fa855; color: #fff; border-color: #1fa855; }
.btn-wa:hover { background: #178a45; color: #fff; border-color: #178a45; }
.btn-wa.disabled, .btn-wa:disabled { background: #c9d3dc; border-color: #c9d3dc; color: #fff; }

/* ---------- Estructura: barra lateral + contenido ---------- */
.rc-shell { display: flex; min-height: 100vh; }
.rc-sidebar {
    width: 250px; flex: 0 0 250px; background: var(--rc-navy); color: #c7d6e4;
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.rc-marca { display: flex; align-items: center; gap: .65rem; padding: 1.25rem 1.25rem 1rem; color: #fff; text-decoration: none; }
.rc-marca:hover { color: #fff; }
.rc-logo {
    width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--rc-hielo), var(--rc-azul)); color: #fff; font-size: 1.3rem;
}
.rc-marca b { font-size: 1.2rem; letter-spacing: -.01em; display: block; line-height: 1.1; }
.rc-marca small { color: #8fb0cb; font-size: .72rem; font-weight: 500; }

.rc-nav { padding: .5rem .75rem; flex: 1; overflow-y: auto; }
.rc-nav .rc-sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6f8ea8; padding: 1rem .75rem .35rem; font-weight: 600; }
.rc-nav a {
    display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; border-radius: .55rem;
    color: #c7d6e4; text-decoration: none; font-weight: 500; margin-bottom: 2px;
}
.rc-nav a i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.rc-nav a:hover { background: var(--rc-navy-2); color: #fff; }
.rc-nav a.activo { background: var(--rc-azul); color: #fff; }
.rc-nav .contador { margin-left: auto; background: var(--rc-rojo); color: #fff; border-radius: 99px; font-size: .72rem; padding: .1rem .5rem; font-weight: 700; }

.rc-usuario { padding: 1rem 1.25rem; border-top: 1px solid #1d3b57; font-size: .9rem; }
.rc-usuario .nombre { color: #fff; font-weight: 600; }
.rc-usuario .rol { color: #8fb0cb; font-size: .78rem; }

.rc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-topbar { display: none; }
.rc-contenido { padding: 1.75rem 2rem 3rem; max-width: 1400px; width: 100%; }

.rc-titulo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.4rem; }
.rc-titulo h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.rc-titulo .sub { color: var(--rc-suave); margin-top: .15rem; }

@media (max-width: 991.98px) {
    .rc-sidebar { display: none; }
    .rc-topbar {
        display: flex; align-items: center; justify-content: space-between; background: var(--rc-navy);
        padding: .6rem 1rem; position: sticky; top: 0; z-index: 1020;
    }
    .rc-topbar .rc-marca { padding: 0; }
    .rc-contenido { padding: 1.1rem 1rem 3rem; }
    .rc-titulo h1 { font-size: 1.35rem; }
    .offcanvas.rc-off { background: var(--rc-navy); width: 270px; }
    .offcanvas.rc-off .rc-sidebar { display: flex; position: static; width: 100%; height: 100%; }
}

/* ---------- Tarjetas ---------- */
.card { border: 1px solid var(--rc-borde); border-radius: .85rem; box-shadow: 0 1px 2px rgba(16, 40, 64, .04); }
.card-header { background: #fff; border-bottom: 1px solid var(--rc-borde); font-weight: 700; padding: .9rem 1.15rem; border-radius: .85rem .85rem 0 0 !important; }
.card-body { padding: 1.15rem; }

.kpi {
    display: block; text-decoration: none; color: inherit; border-radius: .95rem; padding: 1.2rem 1.3rem;
    background: #fff; border: 1px solid var(--rc-borde); position: relative; overflow: hidden;
    transition: transform .12s ease, box-shadow .12s ease;
}
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16, 40, 64, .09); color: inherit; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--kpi-color); }
.kpi .kpi-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; background: var(--kpi-bg); color: var(--kpi-color); }
.kpi .kpi-num { font-size: 2.5rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; color: var(--kpi-color); margin-top: .9rem; }
.kpi .kpi-num.dinero { font-size: 1.85rem; }
.kpi .kpi-txt { font-weight: 600; margin-top: .35rem; }
.kpi .kpi-sub { font-size: .85rem; color: var(--rc-suave); }
@media (max-width: 575.98px) {
    .kpi { padding: 1rem .95rem; }
    .kpi .kpi-num { font-size: 2.1rem; margin-top: .7rem; }
    .kpi .kpi-num.dinero { font-size: 1.15rem; letter-spacing: -.01em; }
    .kpi .kpi-txt { font-size: .95rem; }
}
.kpi-rojo { --kpi-color: var(--rc-rojo); --kpi-bg: var(--rc-rojo-bg); }
.kpi-naranja { --kpi-color: var(--rc-naranja); --kpi-bg: var(--rc-naranja-bg); }
.kpi-amarillo { --kpi-color: var(--rc-amarillo); --kpi-bg: var(--rc-amarillo-bg); }
.kpi-verde { --kpi-color: var(--rc-verde); --kpi-bg: var(--rc-verde-bg); }

/* ---------- Estados ---------- */
.badge-estado { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 700; padding: .28rem .6rem; border-radius: 99px; white-space: nowrap; }
.estado-atrasado { background: var(--rc-rojo-bg); color: var(--rc-rojo); }
.estado-hoy { background: var(--rc-naranja-bg); color: var(--rc-naranja); }
.estado-proximo { background: var(--rc-amarillo-bg); color: var(--rc-amarillo); }
.estado-aldia { background: var(--rc-verde-bg); color: var(--rc-verde); }
.estado-sindatos { background: var(--rc-gris-bg); color: var(--rc-gris); }
.estado-retirado { background: #e9ecef; color: #495057; }

/* ---------- Tablas ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem .9rem; vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--rc-suave); font-weight: 700; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f5f9fd; }
tr.fila-link { cursor: pointer; }
.fila-retirada td { opacity: .55; }

/* ---------- Grupos de la agenda / panel ---------- */
.grupo-cliente { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; padding: .95rem 1.15rem; border-bottom: 1px solid var(--rc-borde); }
.grupo-cliente:last-child { border-bottom: 0; }
.grupo-cliente .gc-info { flex: 1 1 280px; min-width: 0; }
.grupo-cliente .gc-nombre { font-weight: 700; font-size: 1.05rem; color: var(--rc-texto); text-decoration: none; }
.grupo-cliente .gc-nombre:hover { color: var(--rc-azul); }
.grupo-cliente .gc-meta { color: var(--rc-suave); font-size: .9rem; }
.grupo-cliente .gc-acc { display: flex; flex-wrap: wrap; gap: .4rem; }
.marca-izq { border-left: 5px solid transparent; }
.marca-izq.estado-atrasado { border-left-color: var(--rc-rojo); background: #fff; }
.marca-izq.estado-hoy { border-left-color: var(--rc-naranja); background: #fff; }
.marca-izq.estado-proximo { border-left-color: var(--rc-amarillo); background: #fff; }

.nav-agenda .nav-link { font-weight: 700; color: var(--rc-suave); border-radius: .6rem; padding: .65rem 1rem; }
.nav-agenda .nav-link.active { background: #fff; color: var(--rc-texto); box-shadow: 0 1px 3px rgba(16,40,64,.12); }
.nav-agenda .nav-link .n { display: inline-block; min-width: 1.7rem; padding: .05rem .45rem; border-radius: 99px; font-size: .8rem; margin-left: .35rem; color: #fff; }
.nav-agenda { background: #e7edf3; border-radius: .8rem; padding: .3rem; display: inline-flex; flex-wrap: wrap; }

/* ---------- Árbol de espacios / aires ---------- */
.espacio-box { border: 1px solid var(--rc-borde); border-radius: .8rem; background: #fff; margin-bottom: .75rem; overflow: hidden; }
.espacio-head { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; background: #f8fafc; cursor: pointer; user-select: none; }
.espacio-head .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--rc-azul-claro); color: var(--rc-azul); }
.espacio-head .nom { font-weight: 700; }
.espacio-head .chev { margin-left: auto; transition: transform .15s; color: var(--rc-suave); }
.espacio-head.collapsed .chev { transform: rotate(-90deg); }
.aire-fila { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.25rem; padding: .7rem 1rem .7rem 1.25rem; border-top: 1px solid #edf1f5; }
.aire-fila .af-nom { flex: 1 1 220px; font-weight: 600; }
.aire-fila .af-dato { font-size: .88rem; color: var(--rc-suave); }
.aire-fila .af-dato b { color: var(--rc-texto); font-weight: 600; }

/* ---------- Historial (línea de tiempo) ---------- */
.timeline { position: relative; padding-left: 1.9rem; }
.timeline::before { content: ''; position: absolute; left: .62rem; top: .3rem; bottom: .3rem; width: 2px; background: var(--rc-borde); }
.tl-item { position: relative; margin-bottom: 1rem; }
.tl-item .tl-punto { position: absolute; left: -1.9rem; top: .15rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; color: #fff; background: var(--rc-gris); box-shadow: 0 0 0 3px var(--rc-fondo); }
.tl-item.tl-visita .tl-punto { background: var(--rc-azul); }
.tl-item.tl-nota .tl-punto { background: var(--rc-amarillo); }
.tl-item.tl-aire_retirado .tl-punto { background: var(--rc-rojo); }
.tl-item.tl-aire_agregado .tl-punto, .tl-item.tl-espacio_agregado .tl-punto, .tl-item.tl-cliente_creado .tl-punto { background: var(--rc-verde); }
.tl-fecha { font-size: .82rem; color: var(--rc-suave); }

/* ---------- Formulario de cliente ---------- */
.form-label { font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: .5rem; padding: .55rem .75rem; }
.form-control:focus, .form-select:focus { border-color: var(--rc-hielo); box-shadow: 0 0 0 .2rem rgba(92, 200, 232, .25); }
.paso { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--rc-azul); color: #fff; font-weight: 700; font-size: .9rem; margin-right: .45rem; }
.esp-editor { border: 1px solid var(--rc-borde); border-radius: .85rem; background: #fff; margin-bottom: 1rem; }
.esp-editor > .ee-head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; padding: 1rem; background: #f8fafc; border-bottom: 1px solid var(--rc-borde); border-radius: .85rem .85rem 0 0; }
.esp-editor .ee-aires { padding: .75rem 1rem 1rem; }
.aire-editor { border: 1px dashed #c8d4e0; border-radius: .7rem; padding: .85rem; margin-bottom: .7rem; background: #fcfdfe; }
.aire-editor .ae-titulo { font-weight: 700; font-size: .92rem; display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.btn-quitar { color: var(--rc-rojo); border: 1px solid #f3c9c9; background: #fff; }
.btn-quitar:hover { background: var(--rc-rojo); color: #fff; }

/* ---------- Visita ---------- */
.va-espacio { font-weight: 700; padding: .6rem 1rem; background: #f8fafc; border-top: 1px solid var(--rc-borde); border-bottom: 1px solid var(--rc-borde); }
.va-aire { padding: .75rem 1rem; border-bottom: 1px solid #edf1f5; }
.va-aire.marcado { background: #f2f9ff; }
.va-aire .form-check-input { width: 1.4rem; height: 1.4rem; margin-top: .1rem; cursor: pointer; }
.va-aire .va-detalle { display: none; margin-top: .65rem; }
.va-aire.marcado .va-detalle { display: block; }
.chip { display: inline-block; border: 1px solid var(--rc-borde); background: #fff; border-radius: 99px; padding: .2rem .65rem; font-size: .8rem; margin: 0 .25rem .3rem 0; cursor: pointer; user-select: none; }
.chip.on { background: var(--rc-azul); border-color: var(--rc-azul); color: #fff; }
.total-barra { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--rc-borde); box-shadow: 0 -6px 18px rgba(16,40,64,.06); padding: .9rem 1.15rem; z-index: 5; border-radius: 0 0 .85rem .85rem; }

/* ---------- Login ---------- */
.login-fondo { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(1200px 600px at 10% -10%, #1b4d78 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #0b6fb8 0%, transparent 55%), var(--rc-navy); }
.login-card { width: 100%; max-width: 410px; background: #fff; border-radius: 1.2rem; padding: 2.2rem 2rem; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.login-card .rc-logo { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 15px; }

/* ---------- Varios ---------- */
.vacio { text-align: center; padding: 2.5rem 1rem; color: var(--rc-suave); }
.vacio i { font-size: 2.4rem; display: block; margin-bottom: .5rem; color: #b9c7d4; }
.alert { border-radius: .7rem; }
.dato-lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--rc-suave); font-weight: 600; }
.dato-val { font-weight: 600; }
.pagination { margin-bottom: 0; }
@media print { .rc-sidebar, .rc-topbar, .no-print { display: none !important; } }

/* ---------- Fotos de la visita ---------- */
.va-fotos { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .6rem; }
.va-fotos .btn { cursor: pointer; }
.va-fotos.cargando .js-fotos-lista::after { content: ''; width: 1.2rem; height: 1.2rem; border: 2px solid var(--rc-azul); border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spinner-border .7s linear infinite; }
.d-contents { display: contents; }
.foto-mini { position: relative; display: inline-block; }
.foto-mini img, .foto-ver img { width: 64px; height: 64px; object-fit: cover; border-radius: .5rem; border: 1px solid var(--rc-borde); display: block; }
.foto-quitar { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--rc-rojo); color: #fff; font-size: .7rem; line-height: 22px; padding: 0; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.foto-ver { display: inline-block; }
.foto-ver img { width: 48px; height: 48px; }
.foto-ver:hover img { border-color: var(--rc-azul); }
.fotos-celda { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .3rem; }
#modalFoto .modal-body img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; border-radius: .5rem; }
