/* MultiMarcas · estilo base */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1f2933;
    --muted: #6b7280;
    --primary: #1f4e79;
    --primary-hover: #163a5c;
    --ok: #2e7d32;
    --error: #c62828;
    --radius: 6px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
    --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.4;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ---------- Navbar ---------- */
.navbar {
    background: #ffffff;
    color: var(--text);
    padding: 0 24px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.07);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .brand a {
    display: inline-flex;
    align-items: center;
    height: 80px;
    padding: 6px 0;
}
.navbar .brand-logo {
    height: 68px;
    width: auto;
    display: block;
    object-fit: contain;
}

.navbar .nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    height: 80px;
}

.navbar .nav-links > li {
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar .nav-links > li > a {
    color: var(--text);
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}

.navbar .nav-links > li > a:hover {
    color: var(--primary);
    background: #eef2f7;
}

.navbar .nav-links > li > a.disabled {
    color: var(--muted);
    cursor: not-allowed;
    pointer-events: none;
}
.navbar .nav-links > li > a.disabled:hover {
    background: transparent;
    color: var(--muted);
}
.navbar .nav-links > li > a.disabled small {
    font-weight: 400;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 6px;
}

.navbar .nav-links > li.home-btn > a {
    font-size: 18px;
    padding: 0 12px;
}

/* ---------- Submenú del navbar ---------- */
.navbar .nav-links .has-submenu {
    position: relative;
}
.navbar .nav-links .has-submenu > a .caret {
    font-size: 9px;
    margin-left: 4px;
    opacity: 0.6;
    transition: transform 0.15s;
    display: inline-block;
}
.navbar .nav-links .has-submenu:hover > a .caret {
    transform: rotate(180deg);
}

.navbar .nav-links .submenu {
    list-style: none;
    margin: 0;
    padding: 5px 0;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.14s, visibility 0.14s, transform 0.14s;
    z-index: 200;
}
.navbar .nav-links .has-submenu:hover .submenu,
.navbar .nav-links .has-submenu:focus-within .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar .nav-links .submenu li {
    list-style: none;
}
.navbar .nav-links .submenu a {
    display: block;
    padding: 8px 16px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    border-radius: 0;
    background: transparent;
}
.navbar .nav-links .submenu a:hover {
    background: #eef2f7;
    color: var(--primary);
}
.navbar .nav-links .submenu a.disabled {
    color: var(--muted);
    cursor: not-allowed;
    pointer-events: none;
}
.navbar .nav-links .submenu a.disabled small {
    font-weight: 400;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 4px;
}

/* ---------- Container ---------- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px 40px;
}

/* ---------- Home / Hero ---------- */
.hero-logo {
    text-align: center;
    margin: 20px 0 12px;
}
.hero-logo img {
    max-width: 320px;
    width: 100%;
    height: auto;
}
.hero h1 {
    margin: 8px 0 4px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
}
.hero .subtitle {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.status-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    margin-bottom: 24px;
}
.hero { text-align: center; }
.hero .modules-grid { text-align: left; margin-top: 12px; }
.status-card .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--muted);
    display: inline-block;
}
.status-card.ok .dot { background: var(--ok); }
.status-card.error .dot { background: var(--error); }
.status-card.error { color: var(--error); border-color: rgba(198,40,40,0.3); }

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 8px;
}

.module-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.module-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(15,23,42,0.08);
}
.module-card h3 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
}
.module-card p {
    margin: 0;
    font-size: 12.5px;
    color: var(--muted);
}

/* ---------- Módulo page ---------- */
.module-page .page-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.module-page h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}
.muted { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.placeholder {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 16px 0 24px;
}

/* ---------- Utilidades (para los módulos que vienen) ---------- */
table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 13px;
}
table.data th, table.data td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
table.data th {
    background: #eef1f5;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
}
table.data tr:hover td { background: #f9fafc; }
table.data tr.row-link { cursor: pointer; }
table.data tr.row-link:hover td { background: #eef2f7; }
table.data td.right, table.data th.right { text-align: right; }
table.data td.mono, .mono { font-family: 'Consolas', 'Monaco', monospace; font-size: 12.5px; }
table.data td.empty { text-align: center; color: var(--muted); padding: 24px; font-style: italic; }

/* Tablas ordenables (class="sortable" + sortable-table.js) */
th.th-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 18px !important;
}
th.th-sortable:hover { background: #e2e7ee !important; }
th.th-sortable::after {
    content: "";
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-top-color: #b8c0cc;
    border-bottom: none;
    opacity: 0.6;
}
th.th-sortable.th-sort-asc::after {
    border-top: none;
    border-bottom: 4px solid var(--primary);
    opacity: 1;
}
th.th-sortable.th-sort-desc::after {
    border-top: 4px solid var(--primary);
    opacity: 1;
}
table.data td.desc-cell {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Columnas ordenables (click en el header) ---------- */
table.data.sortable th.sortable-col {
    cursor: pointer;
    user-select: none;
    padding-right: 22px;
    position: relative;
    transition: background 0.12s;
}
table.data.sortable th.sortable-col:hover { background: #dbe0e8; }
table.data.sortable th .sort-arrow {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    color: #b4bac4;
    line-height: 1;
}
table.data.sortable th.sort-asc,
table.data.sortable th.sort-desc {
    background: #dbe0e8;
    color: var(--primary);
}
table.data.sortable th.sort-asc .sort-arrow,
table.data.sortable th.sort-desc .sort-arrow {
    color: var(--primary);
    font-size: 10px;
}

/* ---------- Encabezado de página con breadcrumbs ---------- */
.header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}
.breadcrumbs {
    font-size: 12px;
    color: var(--muted);
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { margin: 0 6px; }

/* ---------- Filtros ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.input {
    font-family: var(--font);
    font-size: 13px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    outline: none;
    min-width: 180px;
    height: 32px;
}
.input:focus { border-color: var(--primary); }
.filters .input[type="text"] { flex: 1 1 260px; }
.check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.check input { margin: 0; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    height: 32px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.excel {
    background: #217346;   /* verde Microsoft Excel */
    color: #fff;
    border-color: #217346;
}
.btn.excel:hover { background: #1a5c37; border-color: #1a5c37; color: #fff; }
.btn.pdf {
    background: #b32b2b;   /* rojo tipo Adobe */
    color: #fff;
    border-color: #b32b2b;
}
.btn.pdf:hover { background: #8f1f1f; border-color: #8f1f1f; color: #fff; }
.btn.danger {
    background: #fff;
    color: var(--error);
    border-color: var(--error);
}
.btn.danger:hover { background: var(--error); color: #fff; border-color: var(--error); }

/* ---------- Tabla con scroll ---------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 260px);
}

/* ---------- Card deshabilitada (próximamente) ---------- */
.module-card.disabled {
    opacity: 0.55;
    pointer-events: none;
    cursor: not-allowed;
}

/* =====================================================
   CATÁLOGO
   ===================================================== */

/* Píldoras de selector de precio */
.price-toggle {
    display: inline-flex;
    gap: 4px;
    background: #eef1f5;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid var(--border);
}
.price-toggle .pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    user-select: none;
}
.price-toggle .pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.price-toggle .pill:hover { color: var(--text); }
.price-toggle .pill.active {
    background: var(--primary);
    color: #fff;
}

/* Grilla de tarjetas */
.catalogo-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-top: 12px;
}
/* Artículo fantasma para completar última fila */
.catalogo-grid .cat-phantom {
    visibility: hidden;
    pointer-events: none;
}
@media (max-width: 1400px) { .catalogo-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1100px) { .catalogo-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 850px)  { .catalogo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .catalogo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px)  { .catalogo-grid { grid-template-columns: 1fr; } }

.cat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}
.cat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(15,23,42,0.08);
    border-color: #c5cbd5;
}

.cat-img-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.cat-img-wrap img {
    max-width: 88%;
    max-height: 88%;
    object-fit: contain;
    transition: transform 0.25s ease;
}
.cat-stock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(46, 125, 50, 0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.2px;
    backdrop-filter: blur(2px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.cat-stock-badge.stock-rojo     { background: rgba(198, 40, 40, 0.92); }
.cat-stock-badge.stock-amarillo { background: rgba(245, 124, 0, 0.92); }
.cat-stock-badge.stock-verde    { background: rgba(46, 125, 50, 0.92); }
/* Vendedor: solo el punto de color, sin número */
.cat-stock-badge.solo-color {
    width: 14px;
    height: 14px;
    padding: 0;
    border-radius: 50%;
}
.cat-card:hover .cat-img-wrap img {
    transform: scale(1.04);
}

/* Punto de color de stock, usado en Inventario (sin badge de imagen) */
.stock-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    vertical-align: middle;
}
.stock-dot.stock-rojo     { background: #c62828; }
.stock-dot.stock-amarillo { background: #f57c00; }
.stock-dot.stock-verde    { background: #2e7d32; }

.cat-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.cat-desc {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.35;
    /* 2 líneas máximo con ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

.cat-price {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.3px;
    margin-top: 2px;
}

.cat-meta {
    margin: 6px 0 0;
    padding: 8px 0 0;
    border-top: 1px dashed var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
    font-size: 11.5px;
}
.cat-meta > div { display: flex; gap: 4px; overflow: hidden; }
.cat-meta dt {
    color: var(--muted);
    margin: 0;
    font-weight: 500;
}
.cat-meta dd {
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

/* Paginación */
.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 24px 0 8px;
}
.pager-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface);
    font-size: 13px;
    text-decoration: none;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.pager-btn:hover:not(.disabled) {
    border-color: var(--primary);
    color: var(--primary);
}
.pager-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pager-info {
    font-size: 13px;
    color: var(--muted);
}

/* =====================================================
   CARDS COMO LINKS
   ===================================================== */
.cat-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.cat-card-link:hover { color: inherit; }

/* =====================================================
   DETALLE DE ARTÍCULO
   ===================================================== */

.detalle-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 1.2fr;
    gap: 32px;
    align-items: start;
    margin-top: 12px;
}

@media (max-width: 900px) {
    .detalle-layout {
        grid-template-columns: 1fr;
    }
}

/* ---------- Galería ---------- */
.detalle-galeria {
    position: sticky;
    top: 96px;   /* debajo del navbar sticky */
}

.galeria-principal {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}
.galeria-principal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.25s ease;
}
.galeria-principal:hover img {
    transform: scale(1.02);
}

.galeria-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.galeria-thumbs .thumb {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: border-color 0.12s, transform 0.12s;
    overflow: hidden;
}
.galeria-thumbs .thumb:hover { border-color: var(--primary); }
.galeria-thumbs .thumb.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(31, 78, 121, 0.15);
}
.galeria-thumbs .thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---------- Info ---------- */
.detalle-info {
    min-width: 0;
}

.det-titulo {
    margin: 0 0 12px;
    font-size: 26px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
    letter-spacing: -0.5px;
}

.det-stock {
    margin-bottom: 18px;
}
.stock-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
}
.stock-pill.ok {
    background: rgba(46, 125, 50, 0.1);
    color: var(--ok);
    border: 1px solid rgba(46, 125, 50, 0.25);
}
.stock-pill.zero {
    background: #f5f6f8;
    color: var(--muted);
    border: 1px solid var(--border);
}

.det-meta {
    margin: 0 0 24px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 16px;
    font-size: 13px;
}
.det-meta dt {
    color: var(--muted);
    font-weight: 500;
    margin: 0;
}
.det-meta dd {
    margin: 0;
    color: var(--text);
    word-break: break-word;
}

.det-precios {
    margin: 0 0 24px;
}
.det-precios h3,
.det-stock-almacenes h3 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tabla-precios {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 14px;
}
.tabla-precios th {
    text-align: left;
    padding: 10px 14px;
    background: #eef2f7;
    color: var(--muted);
    font-weight: 500;
    width: 130px;
    border-bottom: 1px solid var(--border);
}
.tabla-precios td {
    text-align: right;
    padding: 10px 14px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
}
.tabla-precios tr:last-child th,
.tabla-precios tr:last-child td { border-bottom: none; }

.det-stock-almacenes {
    margin: 0 0 24px;
}
.det-stock-almacenes .data {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.det-acciones {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* =====================================================
   LOGIN
   ===================================================== */
.login-body {
    background: linear-gradient(135deg, #f5f6f8 0%, #e8ecf1 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-wrap {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.login-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 32px 28px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    width: 100%;
}
.login-logo {
    text-align: center;
    margin-bottom: 20px;
}
.login-logo img {
    max-width: 180px;
    width: 100%;
    height: auto;
}
.login-title {
    margin: 4px 0 4px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}
.login-sub {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.login-form .input {
    height: 38px;
    font-size: 14px;
}
.login-btn {
    margin-top: 6px;
    height: 40px;
    font-size: 14px;
    font-weight: 600;
}
.login-error {
    background: rgba(198, 40, 40, 0.08);
    color: var(--error);
    border: 1px solid rgba(198, 40, 40, 0.25);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
}
.login-footer {
    color: var(--muted);
    font-size: 11px;
    margin: 0;
}

/* =====================================================
   MENÚ DE USUARIO (navbar)
   ===================================================== */
.navbar .user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
    margin-left: 16px;
    position: relative;
}
.navbar .user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 8px;
    border-radius: var(--radius);
    color: var(--text);
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.12s;
}
.navbar .user-btn:hover { background: #eef2f7; }
.navbar .user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.navbar .user-name-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}
.navbar .user-name-wrap strong { font-weight: 600; font-size: 12.5px; }
.navbar .user-name-wrap small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; }

.navbar .user-menu .submenu {
    right: 0;
    left: auto;
    min-width: 170px;
}

/* =====================================================
   SELECTOR DE EMPRESA en navbar
   ===================================================== */
.navbar .empresa-selector {
    display: flex;
    align-items: center;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    list-style: none;
}
.navbar .empresa-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.navbar .empresa-form label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
    margin: 0;
}
.navbar .empresa-input {
    height: 30px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--primary);
    padding: 3px 8px;
    min-width: 160px;
    background: #eef2f7;
    border-color: transparent;
}
.navbar .empresa-input:focus { border-color: var(--primary); background: #fff; }

/* =====================================================
   MÓDULO PEDIDO
   ===================================================== */

.pedido-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
}

.ped-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}

.ped-card-title {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ped-card-title .muted { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }

.ped-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px 16px;
}
.ped-field-wide { grid-column: span 2; }
.ped-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ped-field label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.ped-field label .muted { font-size: 10px; text-transform: none; letter-spacing: 0; }

.ped-cliente-info {
    background: #eef2f7;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}
.ped-cliente-info b { color: var(--muted); font-weight: 500; }

/* ---------- Autocomplete ---------- */
.autocomplete {
    position: relative;
}
.autocomplete-results {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(15,23,42,0.1);
    z-index: 300;
    max-height: 340px;
    overflow: auto;
    display: none;
}
.autocomplete-results.open { display: block; }
.autocomplete-results .ac-row {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    line-height: 1.35;
}
.autocomplete-results .ac-row:last-child { border-bottom: none; }
.autocomplete-results .ac-row:hover { background: #eef2f7; }
.autocomplete-results .ac-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}
.autocomplete-results .ac-row-main .mono { font-size: 12px; color: var(--muted); min-width: 90px; }
.autocomplete-results .ac-row-main strong { flex: 1; color: var(--text); font-weight: 500; }
.autocomplete-results .ac-row-main .ac-price { color: var(--primary); font-weight: 600; font-size: 13px; }
.autocomplete-results .ac-row-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.autocomplete-results .ac-row-sub b { color: var(--ok); font-weight: 600; }
.autocomplete-results .ac-empty {
    padding: 14px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    font-style: italic;
}

.ped-buscador { font-size: 14px; }

/* ---------- Inputs inline en tabla ---------- */
table.data .input-inline {
    height: 28px;
    font-size: 12px;
    padding: 3px 8px;
    min-width: 0;
    width: 100%;
    background: #fff;
}
table.data .input-inline.right { text-align: right; }

/* ---------- Botón quitar ---------- */
.btn-quitar {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 26px; height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: all 0.12s;
}
.btn-quitar:hover {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
}

/* ---------- Totales ---------- */
.ped-totales-card {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.ped-totales {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 260px;
    font-size: 13px;
}
.ped-totales > div {
    display: flex;
    justify-content: space-between;
    gap: 24px;
}
.ped-totales span { color: var(--muted); }
.ped-totales b {
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--text);
    font-weight: 600;
}
.ped-total-final {
    border-top: 2px solid var(--primary);
    padding-top: 6px;
    margin-top: 6px;
    font-size: 16px;
}
.ped-total-final span { color: var(--text); font-weight: 600; }
.ped-total-final b { color: var(--primary); font-size: 18px; }

.ped-acciones {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ped-debug {
    flex-basis: 100%;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.ped-debug summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 12px;
    padding: 4px 0;
}
.ped-debug pre {
    background: #1f2933;
    color: #dce3ec;
    padding: 12px;
    border-radius: 6px;
    font-size: 11px;
    max-height: 300px;
    overflow: auto;
    margin: 6px 0 0;
}

/* =====================================================
   PEDIDO — TIENDA
   ===================================================== */
.ped-tienda .filters { margin-bottom: 14px; }
.ped-tienda-grid { margin-top: 8px; }

.ped-card-item {
    cursor: pointer;
    position: relative;
}
.ped-card-item .ped-card-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}
.ped-card-item .ped-btn-agregar {
    width: 100%;
    margin-top: 8px;
    height: 30px;
    font-size: 12px;
    pointer-events: none;   /* el click es del card entero */
}
.ped-card-item:hover .ped-btn-agregar {
    background: var(--primary-hover);
}

/* =====================================================
   MODAL AGREGAR AL PEDIDO
   ===================================================== */
.ped-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
/* Fix: el atributo hidden lo tiene que respetar aunque haya display:flex */
.ped-modal[hidden] { display: none !important; }
.ped-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.15s ease;
}
.ped-modal-body {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.25);
    animation: modalPop 0.18s ease;
}
.ped-modal-close {
    position: absolute;
    top: 12px; right: 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    font-size: 14px;
    line-height: 1;
    transition: all 0.12s;
}
.ped-modal-close:hover {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
}

.ped-modal-content {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 0;
    min-height: 380px;
}
@media (max-width: 700px) {
    .ped-modal-content { grid-template-columns: minmax(0, 1fr); }
}

.ped-modal-img {
    background: #f5f6f8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-right: 1px solid var(--border);
    min-width: 0;
}
@media (max-width: 700px) { .ped-modal-img { border-right: none; border-bottom: 1px solid var(--border); } }
.ped-modal-img img {
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
}

.ped-modal-info {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;  /* evita que el contenido interno fuerce ancho */
}
.ped-modal-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    letter-spacing: -0.2px;
    padding-right: 30px;   /* espacio para no chocar con la X */
}
.ped-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 11.5px;
    color: var(--muted);
}
.ped-modal-meta b { color: var(--text); font-weight: 500; }

.ped-modal-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    background: #f9fafc;
    padding: 12px 14px;
    border-radius: 8px;
    min-width: 0;
}
.ped-modal-form .ped-field:first-child {
    grid-column: span 2;
}
.ped-modal-form .ped-field { min-width: 0; }
.ped-modal-form .input,
.ped-modal-form select.input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-overflow: ellipsis;
}
.ped-modal-form .price-toggle { flex-wrap: wrap; }

.modal-qty {
    display: flex;
    align-items: stretch;
    gap: 4px;
}
.modal-qty button {
    width: 34px;
    background: #eef2f7;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    transition: background 0.12s;
}
.modal-qty button:hover { background: #dce4ee; }
.modal-qty input { text-align: center; }

.ped-modal-subtotal {
    grid-column: span 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px dashed var(--border);
}
.ped-modal-subtotal span { color: var(--muted); font-size: 13px; }
.ped-modal-subtotal b {
    color: var(--primary);
    font-size: 22px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
}

.ped-modal-acciones {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 8px;
}

@keyframes modalPop {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =====================================================
   BOTÓN FLOTANTE del carrito (FAB)
   ===================================================== */
.ped-carrito-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 14px 22px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(31, 78, 121, 0.35);
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    z-index: 400;
    transition: transform 0.15s, box-shadow 0.15s;
}
.ped-carrito-fab:hover {
    background: var(--primary-hover);
    box-shadow: 0 10px 28px rgba(31, 78, 121, 0.45);
    transform: translateY(-2px);
}
.ped-carrito-fab.bump { animation: bump 0.4s ease; }
/* Cuando el banner "Instala la app" está visible (bottom:0, ancho completo),
   el botón flotante del carrito debe subir para no quedar tapado detrás. */
body.pwa-banner-visible .ped-carrito-fab {
    bottom: 88px;
}
@keyframes bump {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}
.ped-fab-icon { font-size: 16px; }
.ped-fab-count {
    background: #ffffff;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}
.ped-fab-total {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

/* =====================================================
   HOME · LANDING PROFESIONAL
   ===================================================== */

.home-landing {
    padding-bottom: 40px;
}

/* ---------- HERO ---------- */
.hero {
    position: relative;
    padding: 90px 40px 100px;
    background: linear-gradient(135deg, #1F4E79 0%, #163a5c 65%, #0f2a44 100%);
    color: #fff;
    text-align: center;
    overflow: hidden;
    /* Truco para full-width dentro de un .container con max-width */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-top: -20px;
}
.hero-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.06) 0, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.05) 0, transparent 45%),
        repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 24px);
    pointer-events: none;
}
.hero-inner {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    z-index: 1;
}
.hero-badge {
    display: inline-block;
    padding: 5px 14px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 22px;
    backdrop-filter: blur(4px);
}
.hero-title {
    font-size: 52px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1px;
    margin: 0 0 20px;
    color: #fff;
}
.hero-title-accent {
    background: linear-gradient(90deg, #7db3e0 0%, #a5cff0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-sub {
    font-size: 18px;
    color: rgba(255,255,255,0.82);
    max-width: 640px;
    margin: 0 auto 34px;
    line-height: 1.55;
}
.hero-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    height: auto;
}
.hero-cta .btn.ghost {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.35);
}
.hero-cta .btn.ghost:hover { background: rgba(255,255,255,0.12); border-color: #fff; }
.hero-empresa-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    padding: 6px 14px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    margin-top: 12px;
}
.hero-empresa-tag .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
    animation: pulse 2s infinite;
}
.hero-empresa-tag b { color: #fff; font-weight: 600; }

@keyframes pulse {
    0%,100% { opacity: 1; }
    50%     { opacity: 0.5; }
}

/* ---------- STATS BAR ---------- */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 1100px;
    margin: -60px auto 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.10);
    padding: 26px 20px;
    position: relative;
    z-index: 2;
}
.stats-bar .stat {
    text-align: center;
    padding: 0 20px;
    border-right: 1px solid var(--border);
    position: relative;
}
.stats-bar .stat:last-child { border-right: none; }
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(31, 78, 121, 0.08);
    color: var(--primary);
    margin-bottom: 10px;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
}

@media (max-width: 800px) {
    .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 20px 0; }
    .stats-bar .stat:nth-child(2) { border-right: none; }
}

/* ---------- SECTION HEADER (comun) ---------- */
.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 40px;
}
.section-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 12px;
}
.section-title {
    font-size: 34px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    margin: 0 0 12px;
    line-height: 1.2;
}
.section-sub {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.55;
    margin: 0;
}

/* ---------- MÓDULOS ---------- */
.modulos-section {
    max-width: 1200px;
    margin: 80px auto 0;
    padding: 0 40px;
}
.modulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}
.modulo-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px 28px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    position: relative;
    overflow: hidden;
}
.modulo-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}
.modulo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.10);
    border-color: transparent;
}
.modulo-card:hover::before { transform: scaleX(1); }
.modulo-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(31, 78, 121, 0.08);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}
.modulo-icon svg { width: 28px; height: 28px; }
.modulo-icon-ventas    { background: rgba(31, 78, 121, 0.10);  color: #1F4E79; }
.modulo-icon-cobranzas { background: rgba(46, 125, 50, 0.10);  color: #2E7D32; }
.modulo-icon-dashboard { background: rgba(179, 43, 43, 0.10);  color: #b32b2b; }

.modulo-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--text);
    letter-spacing: -0.3px;
}
.modulo-desc {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 18px;
}
.modulo-features {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    font-size: 13px;
}
.modulo-features li {
    color: var(--text);
    padding: 4px 0 4px 22px;
    position: relative;
}
.modulo-features li::before {
    content: "✓";
    position: absolute;
    left: 0; top: 4px;
    color: var(--ok);
    font-weight: 700;
}
.modulo-cta {
    margin-top: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.2px;
}
.modulo-cta-soon { color: var(--muted); }

/* ---------- FEATURES ---------- */
.features-section {
    max-width: 1100px;
    margin: 90px auto 0;
    padding: 60px 40px;
    background: #f5f6f8;
    border-radius: 20px;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}
.feature {
    text-align: left;
}
.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fff;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text);
    letter-spacing: -0.2px;
}
.feature p {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.55;
    margin: 0;
}

/* ---------- CONEXIÓN STATUS (discretos) ---------- */
.conexion-status-wrap {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 40px auto 0;
}
.conexion-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
}
.conexion-badge .conexion-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--ok);
}
.conexion-badge.error .conexion-dot { background: var(--error); }
.conexion-badge.error { color: var(--error); border-color: rgba(198,40,40,0.25); }

/* ---------- Responsive hero ---------- */
@media (max-width: 700px) {
    .hero-title { font-size: 34px; }
    .hero-sub { font-size: 15px; }
    .section-title { font-size: 26px; }
    .modulos-section, .features-section { padding: 40px 24px; }
    .features-section { margin-top: 60px; }
}

/* =====================================================
   VENTAS · DASHBOARD (landing del módulo)
   ===================================================== */

.ventas-dashboard { padding-top: 8px; }

/* Hero del módulo */
.ventas-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 0 26px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 26px;
}
.ventas-hero h1 {
    margin: 4px 0 4px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.6px;
    color: var(--text);
}
.ventas-hero-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--primary);
}
.ventas-hero .muted { font-size: 14px; margin: 0; }
.ventas-hero-actions {
    display: flex;
    gap: 8px;
}

/* Título de sección interno */
.section-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 30px 0 14px;
}

/* --------- KPI GRID --------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 4px;
}
.kpi {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}
.kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15,23,42,0.06);
}
.kpi::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--kpi-accent, var(--primary));
}
.kpi-blue    { --kpi-accent: #1F4E79; --kpi-bg: rgba(31, 78, 121, 0.09); }
.kpi-green   { --kpi-accent: #2E7D32; --kpi-bg: rgba(46, 125, 50, 0.10); }
.kpi-purple  { --kpi-accent: #6d3aad; --kpi-bg: rgba(109, 58, 173, 0.10); }
.kpi-orange  { --kpi-accent: #cc6600; --kpi-bg: rgba(204, 102, 0, 0.10); }

.kpi-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.kpi-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: var(--kpi-bg);
    color: var(--kpi-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.4px;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-bottom: 4px;
}
.kpi-currency {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    margin-right: 2px;
    font-family: var(--font);
}
.kpi-sub {
    font-size: 11.5px;
    color: var(--muted);
}

/* --------- MÓDULOS (cards horizontales) --------- */
.ventas-modulos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
    margin-bottom: 6px;
}
.v-modulo-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.v-modulo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(15,23,42,0.08);
    border-color: transparent;
}
.v-modulo-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.v-modulo-icon svg { width: 22px; height: 22px; }
.v-modulo-card h3 {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
}
.v-modulo-card p {
    margin: 0;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.4;
}
.v-modulo-arrow {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--muted);
    font-size: 20px;
    transition: transform 0.15s, color 0.15s;
}
.v-modulo-card:hover .v-modulo-arrow {
    color: var(--primary);
    transform: translateX(4px);
}

/* --------- Últimas cotizaciones --------- */
.ventas-tabla-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 20px 12px;
    margin-top: 20px;
}
.ventas-tabla-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 4px;
}
.ventas-tabla-header h2 { margin-top: 20px; }
.ventas-tabla-header .muted { font-size: 12px; margin: 0 0 12px; }
.ventas-tabla-wrap .table-wrap { border: none; margin: 0; }
.ventas-tabla-wrap table.data { margin: 0; border: none; }
.ventas-tabla-wrap table.data th {
    background: transparent;
    border-bottom: 2px solid var(--border);
    color: var(--muted);
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.5px;
}
.ventas-tabla-wrap table.data td { padding: 10px 12px; }

/* --------- Responsive --------- */
@media (max-width: 700px) {
    .ventas-hero { flex-direction: column; align-items: flex-start; }
    .ventas-hero h1 { font-size: 26px; }
    .kpi-value { font-size: 22px; }
    .v-modulo-card { flex-wrap: wrap; }
}

/* =====================================================
   MÓDULO COBRANZAS
   ===================================================== */

/* ---------- Aging bars ---------- */
.aging-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.aging-row {
    display: grid;
    grid-template-columns: 160px 1fr 130px 60px;
    gap: 14px;
    align-items: center;
    font-size: 13px;
}
.aging-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 500;
}
.aging-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.aging-bar-wrap {
    background: #f0f2f5;
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
    position: relative;
}
.aging-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.4s ease;
    min-width: 2px;
}
/* Colores del aging */
.aging-ok    { background: #2E7D32; }
.aging-warn1 { background: #d4a017; }
.aging-warn2 { background: #cc7a00; }
.aging-warn3 { background: #d95d00; }
.aging-err   { background: #c62828; }

.aging-value {
    text-align: right;
    font-family: 'Consolas','Monaco',monospace;
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
}
.aging-pct {
    text-align: right;
    color: var(--muted);
    font-size: 11.5px;
    font-family: 'Consolas','Monaco',monospace;
}

@media (max-width: 700px) {
    .aging-row { grid-template-columns: 1fr 60px; grid-template-areas: "label pct" "bar bar" "value value"; gap: 4px; }
    .aging-label { grid-area: label; }
    .aging-bar-wrap { grid-area: bar; }
    .aging-value { grid-area: value; text-align: left; }
    .aging-pct { grid-area: pct; }
}

/* ---------- Tabla clientes ---------- */
.cob-clientes-tabla tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}
.cob-clientes-tabla tbody tr:hover {
    background: #f4f6fa;
}

/* ---------- Badges (estado y tipos) ---------- */
.cob-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.cob-badge-ok    { background: #e8f5e9; color: #2E7D32; }
.cob-badge-warn1 { background: #fff8e1; color: #b28900; }
.cob-badge-warn2 { background: #fff3e0; color: #a55a00; }
.cob-badge-warn3 { background: #ffede0; color: #b34400; }
.cob-badge-err   { background: #ffebee; color: #c62828; }

/* ---------- Tipo de documento ---------- */
.cob-tipo {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    font-family: 'Consolas','Monaco',monospace;
}
.cob-tipo-fact  { background: rgba(31, 78, 121, 0.10); color: #1F4E79; }
.cob-tipo-ndb   { background: rgba(204, 102, 0, 0.10); color: #cc6600; }
.cob-tipo-ncr   { background: rgba(46, 125, 50, 0.10); color: #2E7D32; }
.cob-tipo-adel  { background: rgba(109, 58, 173, 0.10); color: #6d3aad; }

/* ---------- Detalle del cliente ---------- */
.breadcrumb {
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--muted); }

.cob-cliente-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.cob-cliente-header h1 {
    margin: 4px 0 10px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}
.cob-cliente-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    font-size: 13px;
    color: var(--muted);
    max-width: 900px;
}
.cob-cliente-meta b { color: var(--text); font-weight: 500; }
.cob-cliente-meta .mono { font-family: 'Consolas','Monaco',monospace; }

.cob-docs-tabla { font-size: 12.5px; }
.cob-docs-tabla th { font-size: 10.5px; }

/* =====================================================
   DISEÑO RESPONSIVE — SISTEMA COMPLETO
   Breakpoints:
     xs  <  480px  (móvil)
     sm  ≥  480px  (móvil grande)
     md  ≥  768px  (tablet)
     lg  ≥ 1024px  (laptop)
     xl  ≥ 1440px  (desktop)
     xxl ≥ 1920px  (pantalla grande / 24"+)
   ===================================================== */

/* ---------- Container fluido con tope amplio ---------- */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 24px 40px;
}

/* Pantallas grandes: aprovechar el ancho pero sin exagerar */
@media (min-width: 1600px) {
    .container { max-width: 1560px; padding-left: 32px; padding-right: 32px; }
}
@media (min-width: 1920px) {
    .container { max-width: 1720px; padding-left: 40px; padding-right: 40px; }
    body { font-size: 15px; }
    .hero-title { font-size: 60px; }
    .section-title { font-size: 38px; }
}

/* ---------- Botón hamburguesa ---------- */
.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    z-index: 101;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform-origin: center;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Navbar responsive ---------- */
@media (max-width: 900px) {
    .navbar {
        position: relative;
        flex-wrap: nowrap;
        padding: 10px 16px;
    }
    .nav-toggle { display: flex; }

    .nav-links {
        position: fixed;
        top: 0; right: 0;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        background: #fff;
        box-shadow: -6px 0 22px rgba(15, 23, 42, 0.12);
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 70px 16px 24px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.22s ease;
        z-index: 100;
    }
    .nav-links.open { transform: translateX(0); }

    /* Overlay detrás del menú */
    body.nav-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.35);
        z-index: 99;
    }

    .nav-links > li {
        width: 100%;
    }
    .nav-links > li > a,
    .nav-links > li > .user-btn {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 12px 14px;
        border-radius: 8px;
        font-size: 15px;
    }
    .nav-links > li > a:hover {
        background: #f4f6fa;
    }

    /* Submenús en móvil: colapsados por defecto (acordeón), se expanden
       con la clase .submenu-open que agrega el JS al tocar el título.
       El menú de usuario (avatar) queda fuera de esta regla — sigue
       mostrando sus opciones siempre visibles como antes. */
    .has-submenu:not(.user-menu) .submenu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: transparent;
        border: none;
        min-width: 0;
        pointer-events: auto;
        display: block;
        max-height: 0;
        overflow: hidden;
        padding: 0 0 0 14px;
        transition: max-height 0.2s ease;
    }
    .has-submenu.submenu-open:not(.user-menu) .submenu {
        max-height: 400px;
        padding: 4px 0 8px 14px;
    }
    .has-submenu .submenu li a {
        padding: 8px 12px;
        font-size: 13.5px;
        border-radius: 6px;
    }
    .has-submenu .submenu li a:hover { background: #f4f6fa; }
    .has-submenu:not(.user-menu) > a .caret {
        display: inline-block;
        margin-left: auto;
        transition: transform 0.2s ease;
    }
    .has-submenu.submenu-open:not(.user-menu) > a .caret {
        transform: rotate(180deg);
    }
    .user-btn .caret { display: none; }

    /* Empresa selector en móvil */
    .empresa-selector {
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        padding: 12px 0 !important;
        margin: 12px 0;
    }
    .empresa-form {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 0 14px;
    }
    .empresa-form label {
        font-size: 10.5px;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.6px;
    }
    .empresa-input {
        width: 100%;
        min-width: 0;
    }

    /* User menu en móvil */
    .user-menu {
        border-top: 1px solid var(--border);
        padding-top: 12px;
        margin-top: 12px;
    }
    .user-btn {
        background: transparent;
        border: none;
        text-align: left;
    }
}

/* ---------- Home / Hero ---------- */
@media (max-width: 900px) {
    .hero { padding: 60px 24px 80px; }
    .hero-title { font-size: 38px; line-height: 1.15; }
    .hero-sub { font-size: 15px; }
    .hero-cta { flex-direction: column; }
    .hero-cta .btn { width: 100%; }
    .btn-lg { padding: 12px 20px; font-size: 14px; }
}
@media (max-width: 500px) {
    .hero { padding: 50px 20px 70px; }
    .hero-title { font-size: 30px; }
    .hero-badge { font-size: 10px; padding: 4px 10px; margin-bottom: 16px; }
}

/* ---------- Stats bar ---------- */
@media (max-width: 900px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px 0;
        margin: -40px 20px 0;
        padding: 20px 8px;
    }
    .stats-bar .stat:nth-child(2) { border-right: none; }
    .stat-value { font-size: 26px; }
}
@media (max-width: 500px) {
    .stats-bar {
        grid-template-columns: 1fr;
        margin: -30px 16px 0;
    }
    .stats-bar .stat { border-right: none !important; }
}

/* ---------- Módulos/Features ---------- */
@media (max-width: 900px) {
    .modulos-section, .features-section {
        padding: 40px 20px;
        margin-top: 50px;
    }
    .modulo-card { padding: 24px 22px; }
    .section-title { font-size: 26px; }
    .section-header { margin-bottom: 30px; }
}

/* ---------- Módulo Ventas (dashboard) ---------- */
@media (max-width: 900px) {
    .ventas-hero {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 18px;
    }
    .ventas-hero h1 { font-size: 24px; }
    .ventas-hero-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .ventas-hero-actions .btn { width: 100%; text-align: center; }

    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi { padding: 14px 16px; }
    .kpi-value { font-size: 22px; }
    .kpi-label { font-size: 11px; }
    .kpi-sub { font-size: 11px; }
}
@media (max-width: 500px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .ventas-hero-actions { grid-template-columns: 1fr; }
    .v-modulo-card { padding: 14px 16px; }
}

/* ---------- Tabla data ---------- */
@media (max-width: 700px) {
    .table-wrap {
        margin-left: -16px;
        margin-right: -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    table.data th, table.data td {
        padding: 8px 10px;
        font-size: 12px;
    }
    table.data th { font-size: 10px; }
}

/* ---------- Carrito de pedido ---------- */
@media (max-width: 900px) {
    .ped-datos-grid {
        grid-template-columns: 1fr !important;
    }
    .ped-acciones {
        flex-direction: column;
        gap: 8px;
    }
    .ped-acciones .btn { width: 100%; }
    .ped-total-final { font-size: 18px; }
}

/* ---------- Tienda (grid catálogo) ---------- */
@media (max-width: 700px) {
    .cat-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 10px;
    }
    .cat-card { padding: 10px; }
}
@media (max-width: 400px) {
    .cat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ---------- Filtros del inventario/catálogo ---------- */
@media (max-width: 900px) {
    .filtros-row,
    .filtros-grid {
        grid-template-columns: 1fr !important;
        flex-direction: column;
    }
    .filtros-row > *,
    .filtros-grid > * {
        width: 100%;
    }
}

/* ---------- FAB carrito ---------- */
@media (max-width: 500px) {
    .ped-carrito-fab {
        right: 12px !important;
        bottom: 12px !important;
        padding: 12px 16px !important;
        font-size: 13px !important;
    }
    .ped-fab-total { display: none; }
    /* El banner "Instala la app" ocupa todo el ancho abajo en móvil —
       sin esto, el !important de arriba lo dejaba tapado detrás. */
    body.pwa-banner-visible .ped-carrito-fab {
        bottom: 80px !important;
    }
}

/* ---------- Modal en móvil (full-height) ---------- */
@media (max-width: 600px) {
    .ped-modal { padding: 0; }
    .ped-modal-body {
        max-width: 100%;
        max-height: 100vh;
        min-height: 100vh;
        border-radius: 0;
    }
}

/* ---------- Cobranzas ---------- */
@media (max-width: 900px) {
    .cob-cliente-header { flex-direction: column; }
    .aging-wrap { padding: 14px 16px; }
    .aging-row {
        grid-template-columns: 1fr 60px;
        grid-template-areas:
            "label pct"
            "bar bar"
            "value value";
        gap: 4px 0;
        padding: 8px 0;
        border-bottom: 1px dashed var(--border);
    }
    .aging-row:last-child { border-bottom: none; }
    .aging-label { grid-area: label; }
    .aging-bar-wrap { grid-area: bar; margin-top: 4px; }
    .aging-value { grid-area: value; text-align: left; font-size: 14px; }
    .aging-pct { grid-area: pct; }
}

/* ---------- Login ---------- */
@media (max-width: 500px) {
    .login-card {
        margin: 20px 16px;
        padding: 24px 20px !important;
    }
}

/* ---------- Ajustes finos para touch ---------- */
@media (hover: none) and (pointer: coarse) {
    /* En dispositivos táctiles, agrandar los targets */
    .btn { min-height: 40px; }
    .input, select.input { min-height: 40px; font-size: 14px; }
    table.data td { padding: 12px 10px; }

    /* Los submenús flotantes de hover no funcionan bien en touch —
       en móvil ya se despliegan inline; en tablet vertical (600-900px)
       usamos también el toggle */
}

/* ---------- Modo pantalla grande (24"+) ---------- */
@media (min-width: 1920px) {
    /* Aprovechar más columnas en grids */
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
    .modulos-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
    .features-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
    .cat-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important; }
}

/* =====================================================
   MÓDULO DASHBOARD
   ===================================================== */

.dash-page { padding-top: 8px; }

/* ---------- KPI grid del dashboard (7 tarjetas en 24") ---------- */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.dash-kpi-grid .kpi { padding: 14px 16px; }
.dash-kpi-grid .kpi-value { font-size: 20px; }
.dash-kpi-grid .kpi-label { font-size: 10.5px; }
.dash-kpi-grid .kpi-sub { font-size: 10.5px; }
.dash-kpi-grid .kpi-icon { width: 30px; height: 30px; }
.dash-kpi-grid .kpi-icon svg { width: 15px; height: 15px; }
.dash-kpi-grid .kpi-head { gap: 6px; margin-bottom: 8px; }

@media (max-width: 1400px) {
    .dash-kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
    .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .dash-kpi-grid { grid-template-columns: 1fr; }
}

/* ---------- Cards de gráficas ---------- */
.dash-chart-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 18px;
}
.dash-chart-head {
    margin-bottom: 12px;
}
.dash-chart-head .muted { font-size: 12px; margin: 2px 0 0; }
.dash-chart-body {
    position: relative;
    height: 320px;   /* alto fijo para los charts */
}
@media (max-width: 700px) {
    .dash-chart-body { height: 260px; }
    .dash-chart-card { padding: 16px 14px; }
}

/* ---------- Dos columnas: Top vendedores + Top clientes ---------- */
.dash-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}
.dash-two-col .dash-chart-card { margin-bottom: 0; padding-bottom: 8px; }
.dash-two-col table.data.compact { margin: 0; border: none; }
.dash-two-col table.data.compact th {
    background: transparent;
    border-bottom: 2px solid var(--border);
    color: var(--muted);
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.5px;
    padding: 8px 10px;
}
.dash-two-col table.data.compact td { padding: 8px 10px; font-size: 12.5px; }

@media (max-width: 900px) {
    .dash-two-col { grid-template-columns: 1fr; }
}

/* =====================================================
   GALERÍA MODAL — FLECHAS DE NAVEGACIÓN
   ===================================================== */
.modal-img-nav {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    transition: background 0.15s, opacity 0.15s;
    z-index: 2;
    padding: 0;
}
.modal-nav-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.modal-nav-btn[hidden] { display: none !important; }
#modal-img-prev { left: 0; }
#modal-img-next { right: 0; }

/* =====================================================
   GALERÍA MODAL — IMAGEN GRANDE + MINIATURAS
   ===================================================== */
.ped-modal-img {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: #f5f6f8;
    border-right: 1px solid var(--border);
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.modal-img-principal {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    background: #f5f6f8;
}
.modal-img-principal img {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

/* Flechas sobre la imagen grande */
.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.95);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.15s;
    z-index: 2;
    padding: 0;
}
.modal-nav-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.modal-nav-btn[hidden] { display: none !important; }
#modal-img-prev { left: 4px; }
#modal-img-next { right: 4px; }

/* Miniaturas debajo de la imagen principal */
.modal-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    padding: 4px 0;
}
.modal-gallery img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    border: 2px solid var(--border);
    cursor: pointer;
    background: #fff;
    padding: 3px;
    transition: border-color 0.15s, transform 0.12s;
}
.modal-gallery img:hover { transform: scale(1.08); }
.modal-gallery img.activa { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(31,78,121,0.18); }

/* Imagen principal más grande, sin miniaturas */
.modal-img-principal img {
    max-height: 380px !important;
}
.ped-modal-content {
    grid-template-columns: 300px minmax(0, 1fr) !important;
}
.modal-img-contador {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-top: 6px;
    font-family: 'Consolas', monospace;
    letter-spacing: 0.5px;
}

/* ── KPI badge YoY ── */
.kpi-yoy {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-top: 6px;
    letter-spacing: 0.2px;
}
.kpi-yoy.up   { background: rgba(46,125,50,0.12); color: #2E7D32; }
.kpi-yoy.down { background: rgba(198,40,40,0.10); color: #C62828; }

/* ═══════════════════════════════════════════
   KPI CARDS — Estilo Dashboard (SalgeGroup)
   ═══════════════════════════════════════════ */

.kpi-cards-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
@media (max-width: 1400px) { .kpi-cards-row { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .kpi-cards-row { grid-template-columns: repeat(2, 1fr); } }

.kpi-card-new {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none !important;
    color: var(--text);
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.kpi-card-new::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}
.kpi-card-blue::before   { background: #1F4E79; }
.kpi-card-orange::before { background: #c2410c; }
.kpi-card-green::before  { background: #15803d; }
.kpi-card-new:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.10); }

.kpi-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.kpi-card-icon-wrap {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kpi-card-icon-wrap svg { width: 16px; height: 16px; }
.kpi-icon-blue   { background: rgba(31,78,121,0.10);  color: #1F4E79; }
.kpi-icon-orange { background: rgba(194,65,12,0.10);  color: #c2410c; }
.kpi-icon-green  { background: rgba(21,128,61,0.10);  color: #15803d; }

.kpi-card-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    line-height: 1.2;
}
.kpi-card-periodo {
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 2px;
    font-style: italic;
}
.kpi-card-value {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: var(--text);
}
.kpi-value-count {
    font-size: 26px;
    color: var(--text);
}
.kpi-card-blue  .kpi-card-value { color: #1F4E79; }
.kpi-card-green .kpi-card-value { color: #15803d; }

.kpi-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.kpi-card-prev {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.kpi-prev-label {
    font-size: 9px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kpi-prev-valor {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.kpi-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.kpi-badge-up   { background: rgba(21,128,61,0.12);  color: #15803d; }
.kpi-badge-down { background: rgba(185,28,28,0.10);  color: #b91c1c; }

/* KPI cards más altas */
.kpi-card-new {
    min-height: 148px;
    padding: 18px 18px 16px;
    gap: 6px;
}
.kpi-card-top    { margin-bottom: 4px; }
.kpi-card-periodo { margin-bottom: 4px; font-size: 11px; }
.kpi-card-value  { font-size: 20px; margin: 4px 0; }
.kpi-value-count { font-size: 28px; }
.kpi-card-bottom { margin-top: 10px; padding-top: 8px; }
.kpi-prev-label  { font-size: 10px; }
.kpi-prev-valor  { font-size: 12px; }
.kpi-badge       { font-size: 11.5px; padding: 4px 9px; }

/* ── Gestión de usuarios ── */
.badge            { display:inline-block;padding:2px 10px;border-radius:999px;font-size:11px;font-weight:700; }
.badge-admin      { background:rgba(31,78,121,0.12);color:#1F4E79; }
.badge-user       { background:rgba(100,116,139,0.12);color:#475569; }
.form-card        { background:#fff;border:1px solid var(--border);border-radius:10px;padding:24px;margin-bottom:0; }
.form-section     { margin-bottom:20px; }
.form-section-title { font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:0.8px;color:var(--muted);margin-bottom:14px; }
.required         { color:var(--error); }
.alert-ok         { background:rgba(46,125,50,0.10);border:1px solid rgba(46,125,50,0.25);color:#2E7D32;padding:10px 16px;border-radius:8px;font-size:14px; }
.alert-err        { background:rgba(198,40,40,0.08);border:1px solid rgba(198,40,40,0.20);color:#C62828;padding:10px 16px;border-radius:8px;font-size:14px; }

/* ── Autocomplete cobros ── */
.autocomplete-results { position:absolute;top:100%;left:0;right:0;z-index:200;
    background:#fff;border:1px solid var(--border);border-radius:8px;
    box-shadow:0 4px 16px rgba(0,0,0,0.10);max-height:240px;overflow-y:auto; }
.autocomplete-item { padding:9px 14px;cursor:pointer;font-size:13px;border-bottom:1px solid #f1f5f9; }
.autocomplete-item:last-child { border-bottom:none; }
.autocomplete-item:hover { background:#f0f4f8; }
.cli-info-badge { margin-top:6px;font-size:12px;color:var(--primary);
    background:rgba(31,78,121,0.08);padding:4px 10px;border-radius:6px;display:inline-block; }

/* ── Mini barras top productos ── */
.mini-bar { height:3px;background:#e2e8f0;border-radius:2px;margin-top:3px;min-width:40px }
.mini-bar-fill { height:3px;border-radius:2px;width:0;transition:width 0.4s ease }
.mini-bar-fill.blue  { background:#1F4E79 }
.mini-bar-fill.green { background:#15803d }

/* ═══════════════════════════════════════════════════
   RESPONSIVE — Pantallas nuevas
   Breakpoints: 900px (tablet) · 600px (móvil)
   ═══════════════════════════════════════════════════ */

/* ── Navbar ── */
@media (max-width: 900px) {
    .navbar { height: auto; min-height: 60px; flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
    .navbar .brand-logo { height: 44px; }
    .navbar .nav-links { height: auto; flex-wrap: wrap; gap: 4px; }
    .navbar .nav-links > li > a { font-size: 13px; padding: 6px 10px; height: auto; }
    .empresa-selector { max-width: 180px; }
    .empresa-input { font-size: 12px; }
}
@media (max-width: 600px) {
    .navbar .nav-links { display: none; }
    .navbar .brand-logo { height: 36px; }
}

/* ── Dashboard KPI cards ── */
@media (max-width: 600px) {
    .kpi-cards-row { grid-template-columns: 1fr 1fr !important; gap: 8px; }
    .kpi-card-value { font-size: 15px; }
    .kpi-card-new { padding: 12px; min-height: 120px; }
}
@media (max-width: 400px) {
    .kpi-cards-row { grid-template-columns: 1fr !important; }
}

/* ── Dashboard gráficas ── */
@media (max-width: 900px) {
    .dash-two-col { grid-template-columns: 1fr !important; }
    .dash-chart-head { flex-direction: column; gap: 8px; }
    .dash-chart-head > div:last-child { flex-wrap: wrap; }
}

/* ── Filtros del dashboard ── */
@media (max-width: 900px) {
    .ventas-hero { flex-direction: column; gap: 12px; }
    .ventas-hero-actions { flex-wrap: wrap; gap: 6px; }
}

/* ── Tablas — scroll horizontal en móvil ── */
@media (max-width: 900px) {
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data th, .data td { white-space: nowrap; }
}

/* ── Formularios ── */
@media (max-width: 700px) {
    .form-card { padding: 16px; }
    .ped-field { min-width: 0; }
    /* Grids de 2 columnas → 1 columna */
    .form-card [style*="grid-template-columns:1fr 1fr"],
    .form-card [style*="grid-template-columns: 1fr 1fr"] {
        display: block !important;
    }
    .form-card [style*="grid-template-columns:1fr 1fr"] > *,
    .form-card [style*="grid-template-columns: 1fr 1fr"] > * {
        margin-bottom: 12px;
    }
}

/* ── Módulo Usuarios ── */
@media (max-width: 900px) {
    .module-page[style*="max-width:560px"],
    .module-page[style*="max-width:660px"],
    .module-page[style*="max-width: 560px"],
    .module-page[style*="max-width: 660px"] {
        max-width: 100% !important;
        padding: 0 8px;
    }
}

/* ── Cobros reportados — filtros ── */
@media (max-width: 900px) {
    #filtro-texto { min-width: 0; width: 100%; }
    .ventas-tabla-wrap { padding: 12px; }
}

/* ── Módulo Cobranzas — KPI grid ── */
@media (max-width: 700px) {
    .kpi-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 420px) {
    .kpi-grid { grid-template-columns: 1fr !important; }
}

/* ── Detalle tipo / Detalle KPI ── */
@media (max-width: 700px) {
    .ventas-hero h1 { font-size: 22px; }
    .ventas-hero-eyebrow { font-size: 10px; }
    .breadcrumb { font-size: 12px; }
}

/* ── Modales ── */
@media (max-width: 600px) {
    .ped-modal-body { max-width: 95vw !important; margin: 16px; }
    #modal-imagen .ped-modal-body { max-width: 95vw !important; }
}

/* ── Reportar cobro — autocomplete ── */
@media (max-width: 600px) {
    #cli-results { font-size: 13px; }
}

/* ── Top productos toggle ── */
@media (max-width: 700px) {
    #btn-monto, #btn-uds,
    #btn-comp-ventas, #btn-comp-cobros, #btn-comp-ambos {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }
}

/* ── Gestión de empresas — tabla ── */
@media (max-width: 900px) {
    .empresas-tabla th:nth-child(5),
    .empresas-tabla td:nth-child(5),
    .empresas-tabla th:nth-child(6),
    .empresas-tabla td:nth-child(6) { display: none; }
}

/* ── Nombres de cliente — wrap máx 2 líneas ── */
.cli-nombre-cell {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.4;
    white-space: normal;
}



/* ═══════════════════════════════════════
   PWA — Optimizaciones móvil
   ═══════════════════════════════════════ */

/* Safe area para notch/barra inferior en iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body { padding-bottom: env(safe-area-inset-bottom); }
    #pwa-banner { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* En modo standalone (instalada como app) ocultar ciertas cosas de escritorio */
@media (display-mode: standalone) {
    .navbar { padding-top: env(safe-area-inset-top, 0); }
}

/* Botones más grandes en táctil */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; }
    .input, select.input { min-height: 44px; font-size: 16px !important; }
    textarea.input { font-size: 16px !important; }
    /* Evitar zoom al enfocar inputs en iOS */
    input[type="text"], input[type="search"],
    input[type="email"], input[type="date"],
    input[type="datetime-local"], select, textarea {
        font-size: 16px !important;
    }
}

/* Formulario de visitas — tarjetas de resultado más grandes en móvil */
@media (max-width: 600px) {
    .res-radio ~ div { font-size: 15px; }
    label:has(.res-radio) { padding: 14px 12px; }
    .ped-field label { font-size: 14px; font-weight: 600; }
}

/* Carrito / tienda en móvil */
@media (max-width: 600px) {
    .ped-fab { bottom: calc(16px + env(safe-area-inset-bottom, 0)); }
}
