﻿/* ============================================================================
   SitioPresupuestos / Cotizaciones — estilos base
   Barra lateral con color de marca (--tenant-color, por defecto verde #3DAE2B),
   responsive (móvil/tablet/desktop), tarjetas, tablas, formularios y badges.
   El color del tenant se inyecta desde la página maestra.
   ========================================================================== */

:root {
    --tenant-color: #3DAE2B;
    --tenant-color-dark: #35991f;
    --sidebar-bg: #1A1A1A;
    --gris-fondo: #f9fafb;
    --gris-borde: #e5e7eb;
    --gris-texto: #374151;
    --gris-suave: #6b7280;
    --gris-input: #d1d5db;
    --radio: 8px;
    --sidebar-ancho: 240px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: #171717;
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ─── Estructura general ─────────────────────────────────────────────────── */

.layout { display: flex; min-height: 100vh; }

/* ─── Barra lateral ──────────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-ancho);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar-logo {
    height: 64px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-logo .caja-logo {
    background: #fff;
    border-radius: var(--radio);
    padding: 8px 12px;
    width: 100%;
    max-width: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-logo img { max-height: 36px; width: auto; object-fit: contain; }

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 12px;
    overflow-y: auto;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radio);
    color: rgba(255,255,255,.8);
    font-size: 14px;
    margin-bottom: 4px;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.activo { background: var(--tenant-color); color: #fff; font-weight: 600; }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.1);
}
.usuario-info { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; min-width: 0; }
.usuario-avatar {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
    flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255,255,255,.2);
}
.usuario-avatar-inicial {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--tenant-color);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.usuario-datos { min-width: 0; }
.usuario-datos .nombre { font-size: 14px; font-weight: 500; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-datos .rol { font-size: 12px; color: #9ca3af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer .acciones { display: flex; align-items: center; gap: 8px; }
.sidebar-footer a, .sidebar-footer .btn-logout {
    font-size: 12px; color: #9ca3af; background: none; border: none; cursor: pointer; padding: 0;
}
.sidebar-footer a:hover, .sidebar-footer .btn-logout:hover { color: #fff; }
.sidebar-footer .sep { color: rgba(255,255,255,.2); user-select: none; }

/* ─── Barra superior móvil ───────────────────────────────────────────────── */

.topbar-movil {
    display: none;
    height: 56px;
    background: var(--sidebar-bg);
    color: #fff;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 30;
}
.topbar-movil .caja-logo { background: #fff; border-radius: 6px; padding: 4px 8px; max-height: 40px; display: flex; align-items: center; }
.topbar-movil .caja-logo img { max-height: 28px; }
.btn-menu {
    background: none; border: none; color: #fff; cursor: pointer;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
}
.btn-menu svg { width: 24px; height: 24px; }

/* Fondo oscuro al abrir el menú en móvil */
.overlay-menu {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35;
}

/* ─── Contenido principal ────────────────────────────────────────────────── */

.contenido {
    margin-left: var(--sidebar-ancho);
    flex: 1;
    background: var(--gris-fondo);
    min-height: 100vh;
}
.contenido-inner { padding: 24px; max-width: 1200px; }

/* Banner de mora */
.banner-mora {
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.banner-mora svg { width: 20px; height: 20px; color: #f59e0b; flex-shrink: 0; margin-top: 2px; }
.banner-mora .titulo { font-size: 14px; font-weight: 600; color: #92400e; margin: 0; }
.banner-mora .detalle { font-size: 12px; color: #b45309; margin: 2px 0 0; }

/* ─── Encabezado de página ───────────────────────────────────────────────── */

.pagina-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.pagina-titulo { font-size: 24px; font-weight: 700; color: #111827; margin: 0; }
.pagina-subtitulo { font-size: 14px; color: var(--gris-suave); margin: 4px 0 0; }

/* ─── Tarjetas ───────────────────────────────────────────────────────────── */

.card {
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card + .card { margin-top: 16px; }

/* ─── Botones ────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 16px; border-radius: var(--radio); font-size: 14px; font-weight: 500;
    border: 1px solid transparent; cursor: pointer; transition: background .15s, border .15s, color .15s;
    line-height: 1.4;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primario { background: var(--tenant-color); color: #fff; }
.btn-primario:hover { background: var(--tenant-color-dark); }
.btn-secundario { background: #fff; color: var(--gris-texto); border-color: var(--gris-input); }
.btn-secundario:hover { background: #f9fafb; }
.btn-peligro { background: #dc2626; color: #fff; }
.btn-peligro:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

/* ─── Formularios ────────────────────────────────────────────────────────── */

.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: 13px; font-weight: 600; color: var(--gris-texto); margin-bottom: 6px; }
.form-control, input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    border: 1px solid var(--gris-input);
    border-radius: var(--radio);
    background: #fff;
}
textarea.form-control, textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; }
.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--tenant-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--tenant-color) 25%, transparent);
}
.form-fila { display: flex; gap: 16px; flex-wrap: wrap; }
.form-fila > .campo { flex: 1; min-width: 200px; }
.texto-error { color: #dc2626; font-size: 13px; margin-top: 6px; }
.texto-ayuda { color: var(--gris-suave); font-size: 12px; margin-top: 4px; }

/* ─── Tablas ─────────────────────────────────────────────────────────────── */

.tabla-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th {
    text-align: left; font-size: 13px; color: #4b5563; font-weight: 500;
    padding: 12px 16px; border-bottom: 1px solid var(--gris-borde);
    background: #f9fafb; white-space: nowrap;
}
.tabla td { padding: 12px 16px; border-bottom: 1px solid #f3f4f6; color: var(--gris-texto); vertical-align: middle; }
.tabla tr:hover td { background: #fafafa; }
.tabla .num { text-align: right; }

/* ─── Badges de estado ───────────────────────────────────────────────────── */

.badge {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-borrador  { background: #f3f4f6; color: #4b5563; }
.badge-enviado   { background: #dbeafe; color: #1d4ed8; }
.badge-aceptado  { background: #dcfce7; color: #166534; }
.badge-rechazado { background: #fee2e2; color: #b91c1c; }
.badge-expirado  { background: #fef3c7; color: #92400e; }
.badge-facturado { background: #ede9fe; color: #6d28d9; }
.badge-parcial   { background: #fef3c7; color: #b45309; }
.badge-admin     { background: #e0e7ff; color: #4338ca; }
.filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.filtros .campo { margin: 0; }
.paginacion { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; font-size: 14px; color: var(--gris-suave); }

/* Botones de color adicionales */
.btn-azul { background: #2563eb; color: #fff; }
.btn-azul:hover { background: #1d4ed8; }
.btn-morado { background: #7c3aed; color: #fff; }
.btn-morado:hover { background: #6d28d9; }
.btn-outline-azul { background: #fff; color: #2563eb; border-color: #93c5fd; }
.btn-outline-azul:hover { background: #eff6ff; }
.btn-outline-morado { background: #fff; color: #7c3aed; border-color: #ddd6fe; }
.btn-outline-rojo { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn-outline-rojo:hover { background: #fef2f2; }

/* Detalle de cotización */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.info-dl { font-size: 14px; }
.info-dl .fila { display: flex; gap: 8px; padding: 3px 0; }
.info-dl .et { color: var(--gris-suave); width: 96px; flex-shrink: 0; }
.totales { font-size: 14px; max-width: 340px; margin-left: auto; }
.totales .fila { display: flex; justify-content: space-between; padding: 4px 0; }
.totales .fila.desc { color: #dc2626; }
.totales .total { display: flex; justify-content: space-between; border-top: 1px solid var(--gris-borde); padding-top: 8px; margin-top: 4px; font-weight: 700; font-size: 16px; }
.totales .mini { font-size: 12px; color: #9ca3af; }
.desc-item p { margin: 0; line-height: 1.35; }
.desc-item strong { font-weight: 600; }
.desc-item ul { list-style: disc; padding-left: 18px; margin: 2px 0; }
.desc-item ol { list-style: decimal; padding-left: 18px; margin: 2px 0; }

/* Línea de tiempo (historial) */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--gris-borde); margin-left: 8px; }
.timeline li { position: relative; margin-left: 22px; padding: 6px 0; }
.timeline .punto { position: absolute; left: -30px; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid var(--gris-borde); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.timeline .cont { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; }
.timeline .desc { font-size: 14px; color: #374151; }
.timeline .meta { font-size: 12px; color: #9ca3af; }
.versiones { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip-version { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; border: 1px solid var(--gris-borde); color: var(--gris-suave); }
.chip-version.actual { border-color: #9ca3af; background: #f9fafb; color: #1f2937; font-weight: 700; }

/* Página pública de aceptación */
.aceptar-header { padding: 24px 16px; color: #fff; }
.aceptar-header .inner { max-width: 900px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.aceptar-header h1 { margin: 0; font-size: 20px; font-weight: 700; }
.aceptar-header .num { text-align: right; }
.aceptar-header .num .et { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; opacity: .8; margin: 0; }
.aceptar-header .num .val { font-size: 18px; font-weight: 700; margin: 0; }
.aceptar-cont { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.aceptar-msg { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; background: var(--gris-fondo); }
.aceptar-msg h1 { font-size: 24px; font-weight: 700; margin: 0 0 8px; }
.aceptar-acciones { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* Pestañas (configuración) */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--gris-borde); margin-bottom: 20px; }
.tab-btn { padding: 10px 16px; border: none; background: none; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--gris-suave); border-bottom: 2px solid transparent; }
.tab-btn:hover { color: var(--gris-texto); }
.tab-btn.activo { color: var(--tenant-color); border-bottom-color: var(--tenant-color); }
.tab-panel { display: none; }
.tab-panel.activo { display: block; }
.logo-preview { max-height: 60px; max-width: 200px; border: 1px solid var(--gris-borde); border-radius: 6px; padding: 6px; background: #fff; }
.avatar-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.color-swatch { width: 42px; height: 38px; border: 1px solid var(--gris-borde); border-radius: 6px; padding: 2px; cursor: pointer; background: #fff; }

/* Configuración → General: layout de 2 columnas + títulos de sección en mayúscula */
.config-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .config-grid { grid-template-columns: 1fr; } }
.config-grid > div > .card { margin-bottom: 20px; }
.config-grid > div > .card:last-child { margin-bottom: 0; }
.seccion-mini { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .03em; margin: 0 0 14px; }

/* Estrella "por defecto" (tipos de unidad) */
.estrella { color: #e5e7eb; display: inline-flex; cursor: pointer; }
.estrella:hover { color: #fcd34d; }
.estrella-def, .estrella-def:hover { color: #fbbf24; }
.badge-defecto { margin-left: 8px; font-size: 11px; font-weight: 500; background: #fffbeb; color: #b45309; border: 1px solid #fde68a; padding: 2px 8px; border-radius: 999px; }

/* Dashboard */
.saludo { font-size: 22px; font-weight: 700; color: #111827; margin: 0; }
.saludo-sub { font-size: 14px; color: var(--gris-suave); margin: 2px 0 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }
.stat-card { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--gris-borde); border-radius: 12px; padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.stat-ico { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-ico svg { width: 22px; height: 22px; }
.stat-card .lbl { font-size: 12px; font-weight: 600; color: var(--gris-suave); text-transform: uppercase; letter-spacing: .03em; }
.stat-card .val { font-size: 22px; font-weight: 700; color: #111827; margin-top: 2px; }
.acciones-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
@media (max-width: 768px) { .acciones-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.accion-rapida { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--gris-borde); border-radius: 12px; padding: 12px 16px; text-decoration: none; transition: box-shadow .15s, border-color .15s; }
.accion-rapida:hover { box-shadow: 0 1px 3px rgba(0,0,0,.08); border-color: #9ca3af; }
.accion-ico { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.accion-txt { font-size: 14px; font-weight: 500; color: #374151; }

/* Pendientes de facturar — grilla de tarjetas */
.pend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .pend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pend-grid { grid-template-columns: 1fr; } }
.pend-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--gris-borde); border-right: 1px solid var(--gris-borde); text-decoration: none; transition: background .15s; }
.pend-item:hover { background: #f9fafb; }
.pend-num { font-size: 12px; font-family: monospace; color: #9ca3af; margin: 0; }
.pend-emp { font-size: 14px; font-weight: 500; color: #374151; margin: 2px 0 0; }
.pend-total { font-size: 14px; font-weight: 600; color: #374151; flex-shrink: 0; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .dash-cols { grid-template-columns: 1fr; } }

/* Mini tarjetas de estadística (detalle de empresa) — 4 en fila */
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 640px) { .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mini-card { background: #fff; border: 1px solid var(--gris-borde); border-radius: 12px; padding: 16px 20px; }
.mini-card .num { font-size: 24px; font-weight: 700; color: #111827; margin: 0; }
.mini-card .sub { font-size: 12px; color: #6b7280; margin: 2px 0 0; }
.mini-card .top { font-size: 12px; color: #9ca3af; margin: 0 0 2px; }
.mini-card .txt { font-size: 14px; font-weight: 600; color: #374151; margin: 0; }

/* Filtros de cotizaciones — chips de estado */
.filtros-cot { margin-bottom: 16px; }
.filtros-cot > div { margin-bottom: 10px; }
.filtros-cot > div:last-child { margin-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--gris-input); background: #fff; color: #4b5563; cursor: pointer; text-decoration: none; }
.chip:hover { border-color: #9ca3af; color: #4b5563; }
.chip-activo, .chip-activo:hover { background: var(--tenant-color); color: #fff; border-color: var(--tenant-color); }

/* Validación de RUT en vivo */
.input-error { border-color: #f87171 !important; }
.rut-error { color: #ef4444; font-size: 12px; margin: 4px 0 0; }

/* Celda de usuario con avatar de inicial */
.usuario-cel { display: flex; align-items: center; gap: 10px; }
.avatar-ini { width: 32px; height: 32px; border-radius: 50%; background: color-mix(in srgb, var(--tenant-color) 12%, #fff); color: var(--tenant-color); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }

/* Ayuda (FAQ) */
.faq-buscar { max-width: 440px; margin-bottom: 20px; }
.faq-seccion { margin-bottom: 16px; }
.faq-seccion > h2 { font-size: 15px; font-weight: 700; color: #111827; margin: 0 0 6px; display: flex; align-items: center; }
.faq-badge-admin { font-size: 11px; font-weight: 600; background: #e0e7ff; color: #4338ca; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.faq-item { border-bottom: 1px solid #f3f4f6; }
.faq-item summary { cursor: pointer; padding: 14px 4px; font-size: 14px; font-weight: 500; color: #374151; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '\25be'; color: #9ca3af; }
.faq-item[open] summary::after { content: '\25b4'; }
.faq-resp { padding: 0 4px 14px; font-size: 14px; color: #6b7280; line-height: 1.6; white-space: pre-line; }

/* Documento legal (políticas) */
.legal-wrap { min-height: 100vh; background: var(--gris-fondo); padding: 40px 16px; }
.legal-doc { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--gris-borde); border-radius: 12px; padding: 40px; }
.legal-head { text-align: center; margin-bottom: 32px; }
.legal-head img { height: 48px; margin-bottom: 16px; }
.legal-doc h1 { font-size: 24px; text-align: center; margin: 0 0 4px; color: #111827; }
.legal-doc h2 { font-size: 16px; font-weight: 700; color: #374151; border-bottom: 1px solid #f3f4f6; padding-bottom: 8px; margin: 26px 0 12px; }
.legal-doc h3 { font-size: 14px; font-weight: 600; color: var(--tenant-color); margin: 14px 0 4px; }
.legal-doc p, .legal-doc li { font-size: 14px; color: #4b5563; line-height: 1.65; }
.legal-doc ul { padding-left: 20px; }
.legal-pie { border-top: 1px solid #f3f4f6; padding-top: 20px; text-align: center; font-size: 12px; color: #9ca3af; margin-top: 28px; }

/* ─── Mensajes ───────────────────────────────────────────────────────────── */

.alerta { padding: 12px 16px; border-radius: var(--radio); font-size: 14px; margin-bottom: 16px; }
.alerta-ok    { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alerta-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alerta-info  { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.vacio { text-align: center; padding: 48px 16px; color: var(--gris-suave); }

/* ─── Utilidades ─────────────────────────────────────────────────────────── */

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-right { text-align: right; }
.text-muted { color: var(--gris-suave); }
.w-full { width: 100%; }
.oculto { display: none; }
.link { color: var(--tenant-color); font-weight: 600; }
.link:hover { text-decoration: underline; }
.link-azul { color: #2563eb; }
.link-rojo { color: #dc2626; }
.link-azul:hover, .link-rojo:hover { text-decoration: underline; }
.acciones-fila { display: flex; gap: 12px; white-space: nowrap; }

/* Modal genérico */
.modal-fondo { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-caja { background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); width: 100%; max-width: 460px; padding: 24px; }
.modal-titulo { font-size: 16px; font-weight: 600; color: #111827; margin: 0 0 18px; }
.seccion-titulo { font-size: 14px; font-weight: 600; color: #374151; margin: 0 0 12px; }

/* Input de teléfono con selector de país (bandera + código) */
.tel-wrap { display: flex; align-items: stretch; }
.tel-wrap .tel-cc { flex-shrink: 0; width: auto; max-width: 96px; border-right: none; border-top-right-radius: 0; border-bottom-right-radius: 0; background: #f9fafb; padding-left: 8px; padding-right: 6px; font-size: 14px; cursor: pointer; }
.tel-wrap .js-tel { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gris-borde); }
.card-header h2 { font-size: 14px; font-weight: 600; color: var(--gris-texto); margin: 0; }
.contador { margin-left: 8px; font-size: 12px; color: var(--gris-suave); background: #f3f4f6; padding: 2px 8px; border-radius: 999px; }
.card-pie { padding: 20px; border-top: 1px solid var(--gris-borde); background: #f9fafb; }

/* Constructor de cotización */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 4px; align-items: center; }
.editor-toolbar button { border: 1px solid var(--gris-input); background: #fff; border-radius: 4px; min-width: 26px; height: 24px; font-size: 12px; cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; color: #374151; }
.editor-toolbar button:hover { background: #f3f4f6; }
.editor-toolbar .tb-sep { width: 1px; height: 18px; background: var(--gris-borde); margin: 0 2px; }
.editor-toolbar .tb-sel { height: 24px; border: 1px solid var(--gris-input); border-radius: 4px; font-size: 12px; background: #fff; cursor: pointer; padding: 0 2px; color: #374151; }
.editor-toolbar .tb-color { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--gris-input); border-radius: 4px; height: 24px; padding: 0 4px; font-size: 12px; font-weight: 700; cursor: pointer; position: relative; }
.editor-toolbar .tb-color input[type=color] { width: 16px; height: 16px; border: none; padding: 0; background: none; cursor: pointer; }
.editor-toolbar .tb-hl span { background: #ffe600; padding: 0 2px; border-radius: 2px; }
.editor-rico { min-height: 58px; border: 1px solid var(--gris-input); border-radius: 6px; padding: 6px 8px; font-size: 13px; background: #fff; }
.editor-rico:focus { outline: none; border-color: var(--tenant-color); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tenant-color) 25%, transparent); }
.editor-rico ul, .editor-rico ol { margin: 2px 0; padding-left: 18px; }
.editor-rico h3 { font-size: 16px; font-weight: 700; margin: 4px 0; }
.editor-rico h4 { font-size: 14px; font-weight: 700; margin: 4px 0; }
.editor-rico table, .desc-item table, .item-desc table { border-collapse: collapse; width: 100%; margin: 6px 0; }
.editor-rico table td, .desc-item table td, .item-desc table td { border: 1px solid #d1d5db; padding: 4px 6px; vertical-align: top; }
/* Encabezados enriquecidos también en detalle/aceptación */
.desc-item h3, .item-desc h3 { font-size: 15px; font-weight: 700; margin: 4px 0; }
.desc-item h4, .item-desc h4 { font-size: 13px; font-weight: 700; margin: 4px 0; }
.anexo-tit { margin: 0 0 4px; }
.btn-anexo { display: inline-flex; align-items: center; gap: 6px; }
.tabla-items { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla-items th { background: #f9fafb; border: 1px solid var(--gris-borde); padding: 8px; text-align: left; font-size: 12px; color: var(--gris-suave); }
.tabla-items td { border: 1px solid #f3f4f6; padding: 8px; vertical-align: top; }
.tabla-items input, .tabla-items select { width: 100%; }
.tabla-items .col-sub { text-align: right; font-weight: 600; white-space: nowrap; }
.resumen-fila { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; color: var(--gris-texto); }
.resumen-fila.desc { color: #dc2626; }
.resumen-total { display: flex; justify-content: space-between; border-top: 1px solid var(--gris-borde); padding-top: 10px; margin-top: 6px; font-weight: 700; font-size: 16px; }
.paso-titulo { font-size: 14px; font-weight: 600; color: var(--gris-texto); margin: 0 0 16px; }
.link-agregar { color: var(--tenant-color); font-weight: 600; background: none; border: none; cursor: pointer; font-size: 14px; padding: 0; }
.link-agregar:hover { text-decoration: underline; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1023px) {
    .sidebar { transform: translateX(-100%); box-shadow: 2px 0 12px rgba(0,0,0,.2); }
    .sidebar.abierto { transform: translateX(0); }
    .sidebar.abierto + .overlay-menu { display: block; }
    .topbar-movil { display: flex; }
    .contenido { margin-left: 0; padding-top: 56px; }
    .contenido-inner { padding: 16px; }
    .pagina-titulo { font-size: 20px; }
}

@media (min-width: 1024px) {
    .topbar-movil, .overlay-menu { display: none !important; }
}

/* Grilla de pagos (superadmin): historial 2/3 + formulario 1/3 */
.pagos-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) {
    .pagos-grid { grid-template-columns: 1fr; }
}

/* Tablas que se convierten en tarjetas apiladas en móvil */
@media (max-width: 640px) {
    .tabla-cards thead { display: none; }
    .tabla-cards, .tabla-cards tbody, .tabla-cards tr, .tabla-cards td { display: block; width: 100%; }
    .tabla-cards tr { border: 1px solid var(--gris-borde); border-radius: 8px; margin-bottom: 10px; padding: 4px 0; background: #fff; }
    .tabla-cards tr:hover td { background: transparent; }
    .tabla-cards td { border: none; padding: 8px 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: right; }
    .tabla-cards td::before { content: attr(data-label); font-weight: 600; color: var(--gris-suave); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; flex-shrink: 0; }
    .tabla-cards td:empty { display: none; }
    .form-fila { flex-direction: column; gap: 0; }
    .form-fila > .campo { min-width: 0; }
    .grid-2, .dash-cols { grid-template-columns: 1fr; }
}

/* ─── Páginas de autenticación (sin barra lateral) ───────────────────────── */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f4f4;
    padding: 16px;
}
.auth-card {
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    width: 100%;
    max-width: 400px;
    padding: 32px;
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { height: 56px; }
.auth-titulo { font-size: 18px; font-weight: 700; color: #111827; margin: 0 0 6px; text-align: center; }
.auth-sub { font-size: 14px; color: var(--gris-suave); margin: 0 0 24px; text-align: center; line-height: 1.5; }
.auth-ok { background: #f0faee; border: 1px solid var(--tenant-color); border-radius: 6px; padding: 16px; text-align: center; color: #2a7a1e; font-size: 14px; line-height: 1.6; }
.caja-rechazo { background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 20px; }
.auth-link { text-align: center; margin-top: 20px; font-size: 13px; color: var(--gris-suave); }
.auth-link a { color: var(--tenant-color); }
.auth-link a:hover { text-decoration: underline; }
.auth-pie { text-align: center; font-size: 12px; color: #9ca3af; margin-top: 28px; }
.check-ok { width: 48px; height: 48px; border-radius: 50%; background: #dcfce7; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.check-ok svg { width: 24px; height: 24px; color: #16a34a; }
.checkbox-fila { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
.checkbox-fila input[type=checkbox] { width: auto; height: auto; margin-top: 2px; accent-color: var(--tenant-color); cursor: pointer; }
.checkbox-fila label { font-size: 12px; color: var(--gris-suave); font-weight: 400; cursor: pointer; line-height: 1.5; margin: 0; }
