/**
 * FRONTEND - Hoja de estilos base (aplica identidad visual al frontend).
 *
 * Paleta:
 * verde marca + header/footer oscuros + acentos por categoria de comercio.
 * Todo el layout de home (RUT-26 a futuro toma esta misma base) vive aca.
 */

:root {
    /* Paleta de marca */
    --color-primary: #22c55e;
    --color-primary-dark: #16a34a;
    --color-primary-soft: #eafbf1;

    /* Oscuros (header / footer) */
    --color-dark: #0b0f0d;
    --color-dark-soft: #151a17;

    /* Superficies y texto */
    --color-bg: #f7f6f2;
    --color-surface: #ffffff;
    --color-border: #e6e4de;
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;

    /* Acentos por categoria de comercio */
    --color-restaurante: #ef4444;
    --color-restaurante-bg: #fee2e2;
    --color-panaderia: #f97316;
    --color-panaderia-bg: #ffedd5;
    --color-cafe: #a855f7;
    --color-cafe-bg: #f3e8ff;
    --color-supermercado: #3b82f6;
    --color-supermercado-bg: #dbeafe;
    --color-otros: #6b7280;
    --color-otros-bg: #f3f4f6;

    --color-rating: #f59e0b;

    /* Estados de alerta (auth: RUT-22 a RUT-25) */
    --color-danger: #dc2626;
    --color-danger-bg: #fef2f2;
    --color-warning: #b45309;
    --color-warning-bg: #fffbeb;
    --color-success: var(--color-primary-dark);
    --color-success-bg: var(--color-primary-soft);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', system-ui, sans-serif;
}


body {
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-footer {
    margin-top: auto;
}

[hidden] {
    display: none !important;
}

a {
    color: inherit;
}

/* ============================================================
   HEADER (includes/header.php)
   ============================================================ */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 5%;
    background-color: var(--color-dark);
    color: #ffffff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong {
    font-size: 17px;
    color: var(--color-primary);
    letter-spacing: 0.2px;
}

.brand-text small {
    font-size: 10px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #9ca3af;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.link-ghost {
    font-size: 13px;
    color: #d1d5db;
    text-decoration: none;
}

.link-ghost:hover {
    color: #ffffff;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #06210f;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    color: #ffffff;
}

/* ============================================================
   BARRA DE BUSQUEDA + FILTROS (index.php)
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 5%;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.search-box {
    flex: 1 1 260px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 10px 16px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    width: 100%;
    color: var(--color-text);
}

/* EXPERIMENTO (sin RUT, rama aparte): botón "Buscar cerca mío" dentro
   del mismo .search-box (reusa la píldora), en vez del input de texto
   -- ver assets/js/map.js. */
.search-box-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
}

.search-box-btn .btn-icon {
    color: var(--color-text-muted);
}

/* Selector de radio de "Buscar cerca mío" (RUT-141), a la derecha del
   botón dentro de la misma píldora. */
.search-box-radio {
    flex: 0 0 auto;
    border: none;
    border-left: 1px solid var(--color-border);
    background: transparent;
    padding: 0 0 0 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
}

.search-box-btn.active {
    color: var(--color-primary-dark);
    font-weight: 600;
}

.search-box-btn.active .btn-icon {
    color: var(--color-primary);
}

.local-distancia {
    color: var(--color-primary-dark);
    font-weight: 600;
}

/* .toolbar es flex-wrap: sin esto, el error de geolocalización se
   apretaba al lado del botón en vez de pasar a su propia línea. */
#cercania-error {
    flex-basis: 100%;
    margin: 0;
}

.location-select {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.toolbar-divider {
    width: 1px;
    height: 26px;
    background: var(--color-border);
}

.category-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-pill {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text);
}

.filter-pill.active {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
    background: var(--color-primary-soft);
}

/* ============================================================
   LAYOUT PRINCIPAL: listado (izquierda) + mapa (derecha)
   ============================================================ */
.home-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    align-items: stretch;
    min-height: 70vh;
    margin-bottom: 32px; /* aire entre el mapa y el footer */
}

.locales-panel {
    padding: 24px 5%;
    overflow-y: auto;
}

.locales-panel .intro h2 {
    font-size: 26px;
    margin-bottom: 6px;
}

.locales-panel .intro p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.locales-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.local-card {
    display: flex;
    gap: 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.local-card:hover,
.local-card.is-active {
    border-color: var(--color-primary);
}

.local-card img {
    width: 84px;
    height: 84px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--color-bg);
}

.local-card-body {
    flex: 1;
    min-width: 0;
}

.local-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 6px;
}

.badge-restaurante { color: var(--color-restaurante); background: var(--color-restaurante-bg); }
.badge-panaderia   { color: var(--color-panaderia);   background: var(--color-panaderia-bg); }
.badge-cafe        { color: var(--color-cafe);        background: var(--color-cafe-bg); }
.badge-supermercado{ color: var(--color-supermercado);background: var(--color-supermercado-bg); }
.badge-otros        { color: var(--color-otros);        background: var(--color-otros-bg); }

.rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.rating i { color: var(--color-rating); }
.rating span { color: var(--color-text-muted); font-weight: 400; }

/* Selector de estrellas clickeable (editar mi reseña, cliente/resenas.php) */
.rating-selector {
    display: flex;
    gap: 4px;
    font-size: 18px;
}

.btn-star {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--color-rating);
}

.local-card h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.local-card p {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.local-address {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.locales-empty {
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 30px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

/* ============================================================
   PANEL DEL MAPA
   ============================================================ */
.map-panel {
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 480px;
    background: #dfe6dd;
}

.map-legend {
    position: absolute;
    left: 20px;
    bottom: 20px;
    z-index: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    max-width: 320px;
    box-shadow: var(--shadow-card);
}

.map-legend .icon-shield {
    color: var(--color-primary);
    font-size: 18px;
    margin-top: 2px;
}

.map-legend strong {
    display: block;
    font-size: 13px;
    margin-bottom: 2px;
}

.map-legend p {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* ============================================================
   FOOTER (includes/footer.php)
   ============================================================ */
.site-footer {
    background-color: var(--color-dark);
    color: #d1d5db;
    padding: 24px 5% 14px;
}

.footer-main {
    padding-bottom: 18px;
    /* RUT-142: marca a la izquierda, columnas de links a la derecha;
       en pantallas chicas bajan una abajo de la otra (auto-fit). */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px 40px;
}

.footer-col h4 {
    font-size: 13px;
    font-weight: 600;
    color: #f9fafb;
    margin-bottom: 10px;
}

.footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.footer-col a {
    font-size: 13px;
    color: #9ca3af;
    text-decoration: none;
    overflow-wrap: anywhere; /* el mail largo no desborda en celular */
}

.footer-col a:hover,
.footer-col a:focus-visible {
    color: var(--color-primary);
}

/* Íconos de redes (Instagram / Facebook / TikTok), debajo del mail. */
.footer-redes {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.footer-redes a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-dark-soft);
    font-size: 15px;
}

.footer-redes a:hover,
.footer-redes a:focus-visible {
    background: var(--color-primary);
    color: var(--color-dark);
}

.footer-brand p {
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #9ca3af;
    max-width: 380px;
}

.footer-bottom {
    padding-top: 12px;
    border-top: 1px solid var(--color-dark-soft);
    font-size: 12px;
    color: #6b7280;
}


.dashboard-layout + .site-footer {
    padding: 12px 5%;
}

.dashboard-layout + .site-footer .footer-main {
    padding-bottom: 8px;
}

.dashboard-layout + .site-footer .footer-bottom {
    padding-top: 8px;
}

/* ============================================================
   AUTH (auth/login.php, register.php, forgot-password.php,
   reset-password.php - RUT-17 a RUT-25)
   ============================================================ */
.auth-page {
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 5%;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 32px;
}

.auth-card-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-card-header img {
    margin-bottom: 12px;
}

.auth-card-header h1 {
    font-size: 22px;
    margin-bottom: 6px;
}

.auth-card-header p {
    font-size: 13px;
    color: var(--color-text-muted);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-surface);
}

/* Input de contraseña + botón "ojito" (ver .toggle-password en
   auth/login.php y inicializarTogglePassword en assets/js/auth.js). */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    border: none;
    background: none;
    padding: 8px;
    display: flex;
    align-items: center;
    color: var(--color-text-muted);
    cursor: pointer;
}

.toggle-password:hover {
    color: var(--color-text);
}

.form-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 6px;
}

.form-hint.is-error {
    color: var(--color-danger);
}

/* Botón que se ve como un link, para meter una acción (ej. "Reintentar")
   adentro de un texto de estado -- usado en productos.js, carrito.js. */
.link-inline-btn {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    color: inherit;
    cursor: pointer;
}

.form-error-msg {
    font-size: 12px;
    color: var(--color-danger);
    margin-top: 6px;
    display: none;
}

.form-group.has-error input {
    border-color: var(--color-danger);
}

.form-group.has-error .form-error-msg {
    display: block;
}

.form-row-between {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    font-size: 12px;
}

.link-muted {
    color: var(--color-text-muted);
    text-decoration: none;
}

.link-muted:hover {
    color: var(--color-primary-dark);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px 18px;
    font-size: 14px;
}

.btn-block:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-footer-link {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 22px;
}

.auth-footer-link a {
    color: var(--color-primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: none;
    margin-bottom: 18px;
}

.auth-back-link:hover {
    color: var(--color-primary-dark);
}

/* Alertas dentro de las tarjetas de auth: exito / error de usuario /
   error de servicio (caido) / aviso (ej. cuenta creada pero email no
   se pudo enviar). Mismo componente, distinto color segun el tipo. */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 18px;
}

.alert i {
    margin-top: 2px;
}

.alert-error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.alert-actions {
    margin-top: 8px;
}

.alert-actions button {
    border: none;
    background: none;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    color: inherit;
}

/* Avisos flotantes (ver mostrarToast en ui-comun.js) -- fijos abajo a la
   derecha para que se vean sin importar cuánto scrolleaste. */
#toast-contenedor {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
}

.toast-flotante {
    margin-bottom: 0;
    box-shadow: var(--shadow-card);
    animation: toast-flotante-entrada 0.25s ease-out;
}

.toast-flotante--saliendo {
    opacity: 0;
    transition: opacity 0.4s ease;
}

@keyframes toast-flotante-entrada {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PANELES POR ROL (cliente/, comerciante/, admin/ - RUT-26 a RUT-28)
   ============================================================ */
.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 420px;
    flex: 1;
}

.dashboard-sidebar {
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 24px 0;
}

.dashboard-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 0 24px;
    margin-bottom: 10px;
}

.dashboard-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dashboard-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.dashboard-nav a i {
    width: 16px;
    text-align: center;
    color: var(--color-text-muted);
}

.dashboard-nav a:hover {
    background: var(--color-bg);
}

.dashboard-nav a.active {
    border-left-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    font-weight: 600;
}

.dashboard-nav a.active i {
    color: var(--color-primary-dark);
}

.dashboard-content {
    padding: 32px 5%;
    min-width: 0; /* así las tablas anchas scrollean dentro de .table-wrap en vez de estirar el panel */
}

.dashboard-content h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.dashboard-content > p.dashboard-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 26px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.dashboard-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

.dashboard-card i {
    font-size: 18px;
    color: var(--color-primary);
    background: var(--color-primary-soft);
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.dashboard-card h3 {
    font-size: 15px;
    margin-bottom: 6px;
}

.dashboard-card p {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.dashboard-card .badge-soon {
    display: inline-block;
    margin-top: 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 3px 9px;
    border-radius: 999px;
}

/* ============================================================
   SUBIR PRODUCTO (comerciante/subir-producto.php)
   maqueta de la ficha de producto para que el
   Comerciante mande un alimento a validación bromatológica.
   ============================================================ */
.product-form-layout,
.two-col-form-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.form-card h2 {
    font-size: 15px;
    margin-bottom: 18px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group textarea {
    width: 100%;
    resize: vertical;
    min-height: 80px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg);
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-surface);
}

.form-group select {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg);
}

/* Zona de arrastrar-y-soltar para la imagen del producto. La clase
   "is-dragover" la agrega assets/js/dropzone.js mientras el usuario
   arrastra un archivo encima. */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 28px 16px;
    background: var(--color-primary-soft);
    cursor: pointer;
}

.dropzone.is-dragover {
    border-color: var(--color-primary);
    background: #d9f7e4;
}

.dropzone i {
    font-size: 26px;
    color: var(--color-primary-dark);
}

.dropzone strong {
    font-size: 13px;
}

.dropzone span {
    font-size: 11px;
    color: var(--color-text-muted);
}

.dropzone input[type="file"] {
    display: none;
}

/* Selector de archivo "en linea" (ej. certificado ANMAT en PDF) */
.file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 13px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    cursor: pointer;
}

.file-picker i {
    color: var(--color-primary-dark);
}

.file-picker input[type="file"] {
    display: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.product-form-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================================
   CARRITO (cliente/carrito.php)
   Tarea extra pedida por el equipo de frontend, sin RUT asociado en
   el board original -- carrito agrupado por comercio (ver el porqué
   en el comentario de arriba de carrito.php).
   ============================================================ */
.cart-group {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
    overflow: hidden;
}

.cart-group-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.cart-group-header h2 {
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-group-header i {
    color: var(--color-primary);
}

.cart-items {
    display: flex;
    flex-direction: column;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img,
.cart-item-img-placeholder {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-bg);
    flex-shrink: 0;
}

.cart-item-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Miniatura de producto en las tablas de catálogo (comerciante/productos.php
   y local.php) -- mismo tamaño/criterio que .cart-item img de arriba. */
.product-thumb {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-bg);
    vertical-align: middle;
    margin-right: 8px;
}

.product-thumb--vacio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.cart-item-info strong {
    font-size: 13px;
}

.cart-item-info span {
    font-size: 12px;
    color: var(--color-text-muted);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

.cart-item-qty button {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.cart-item-qty button:hover {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.cart-item-subtotal {
    width: 90px;
    text-align: right;
    font-size: 13px;
    font-weight: 700;
}

.cart-item-remove {
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 6px;
}

.cart-item-remove:hover {
    color: var(--color-danger);
}

.cart-group-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: var(--color-bg);
    font-size: 13px;
}

/* Elegir "Retiro en el local" o "Envío a domicilio" antes de confirmar
   (ver assets/js/carrito.js) -- una por comercio, porque cada uno del
   carrito confirma su pedido por separado. */
.cart-entrega {
    padding: 14px 20px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
    font-size: 13px;
}

.cart-entrega label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.cart-entrega .form-hint {
    margin: 0;
    flex-basis: 100%;
}

.cart-direccion-select {
    flex-basis: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
}

.cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-dark);
    color: #ffffff;
    border-radius: var(--radius-md);
    padding: 18px 24px;
    font-size: 15px;
}

.cart-total strong {
    font-size: 20px;
    color: var(--color-primary);
}

/* ============================================================
   SUMAR COMERCIO (sumar-comercio.php)
   ============================================================ */
.info-hero {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 40px;
    padding: 48px 5% 0;
}

.info-hero i {
    font-size: 30px;
    color: var(--color-primary);
    background: var(--color-primary-soft);
    width: 60px;
    height: 60px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.info-hero h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.info-hero p {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.info-section {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 5% 48px;
}

.info-section h2 {
    font-size: 19px;
    margin-bottom: 20px;
    text-align: center;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 48px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
}

.step-item .step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #06210f;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-item h3 {
    font-size: 15px;
    margin-bottom: 4px;
}

.step-item p {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.step-item .badge-soon {
    display: inline-block;
    margin-top: 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 3px 9px;
    border-radius: 999px;
}

.requisitos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.requisito-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
}

.requisito-item i {
    color: var(--color-primary-dark);
    font-size: 16px;
    margin-top: 2px;
}

.requisito-item h3 {
    font-size: 13px;
    margin-bottom: 3px;
}

.requisito-item p {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.info-cta {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* ============================================================
   PANELES DE GESTIÓN CON TABLA
   (admin/usuarios.php, admin/solicitudes.php, admin/denuncias.php,
   admin/tablas-maestras.php, comerciante/locales.php,
   comerciante/productos.php, comerciante/pedidos.php)

   Tarea extra de frontend: reemplaza las tarjetas "Próximamente" de
   los paneles por un listado real. Mismo criterio que carrito.php /
   subir-producto.php: sin datos hardcodeados, todo sale del backend
   (ver el contrato comentado en cada assets/js/*.js).
   ============================================================ */
.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.panel-toolbar .search-box {
    flex: 1 1 260px;
    max-width: 340px;
}

.table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow-x: auto;
    overflow-y: hidden; /* si no, aparece un scroller vertical fantasma -- ver .panel-tabs */
}

.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--color-bg);
}

.data-table td.text-muted {
    color: var(--color-text-muted);
}

/* Pill de estado generico: cada pantalla decide que tono usar segun
   el enum que este mostrando (estado_usuario, estado_solicitud, etc). */
.status-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.status-pill--success { color: var(--color-success); background: var(--color-success-bg); }
.status-pill--warning  { color: var(--color-warning); background: var(--color-warning-bg); }
.status-pill--danger   { color: var(--color-danger);  background: var(--color-danger-bg); }
.status-pill--info     { color: var(--color-supermercado); background: var(--color-supermercado-bg); }
.status-pill--neutral  { color: var(--color-text-muted); background: var(--color-bg); border: 1px solid var(--color-border); }

.table-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.btn-danger:hover {
    background: var(--color-danger);
    color: #ffffff;
}

.table-loading,
.table-empty,
.table-error {
    padding: 34px 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

.table-error i,
.table-empty i {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--color-text-muted);
}

/* Tabs simples (ej. admin/tablas-maestras.php: Provincias / Localidades / Categorías) */
.panel-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    overflow-y: hidden;
}

.panel-tabs button {
    border: none;
    background: none;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}

.panel-tabs button.active {
    color: var(--color-primary-dark);
    border-bottom-color: var(--color-primary);
}

/* Alta rapida arriba de una tabla maestra (ej. "Nueva provincia") */
.quick-add-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.quick-add-form .form-group {
    margin-bottom: 0;
    flex: 1 1 180px;
}

/* Tarjeta de cada dirección guardada (ver cliente/direcciones.php + assets/js/direcciones.js) */
.direccion-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 16px;
    margin-bottom: 12px;
}

.direccion-card p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.direccion-card-acciones {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-predeterminada {
    color: var(--color-rating);
    background: var(--color-warning-bg);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch span {
    position: absolute;
    inset: 0;
    background: var(--color-border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.toggle-switch span::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.toggle-switch input:checked + span {
    background: var(--color-primary);
}

.toggle-switch input:checked + span::before {
    transform: translateX(16px);
}

/* ============================================================
   FAVORITOS (cliente/favoritos.php) y RESEÑAS (cliente/resenas.php)
   ============================================================ */
.fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.fav-card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-card);
    /* Es un <a> a local.php (ver assets/js/favoritos.js) -- sin esto se
       vería subrayado y con el texto en azul, como cualquier link. */
    display: block;
    text-decoration: none;
    color: inherit;
}

.fav-card img,
.fav-card-img-placeholder {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    margin-bottom: 10px;
}

.fav-card-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 22px;
}

.fav-card h3 {
    font-size: 14px;
    margin-bottom: 4px;
}

.fav-card p {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.fav-card-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.92);
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: var(--color-danger);
    cursor: pointer;
}

.review-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    margin-bottom: 14px;
}

.review-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.review-card h3 {
    font-size: 14px;
}

.review-card .rating i {
    color: var(--color-rating);
}

.review-date {
    font-size: 11px;
    color: var(--color-text-muted);
}

.review-comment {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.review-response {
    background: var(--color-bg);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.review-response strong {
    color: var(--color-text);
}

/* ============================================================
   DETALLE DE LOCAL (local.php)
   Usuario: explorar el catálogo de un
   local con precio, stock y verificación ANMAT, dejar una reseña y
   guardarlo en favoritos.
   ============================================================ */
.local-hero {
    display: flex;
    gap: 24px;
    padding: 32px 5%;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.local-hero img,
.local-hero-img-placeholder {
    width: 220px;
    height: 220px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    background: var(--color-bg);
    flex-shrink: 0;
}

.local-hero-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 40px;
}

.local-hero-info {
    flex: 1;
    min-width: 0;
}

.local-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.local-hero-info h1 {
    font-size: 26px;
    margin: 8px 0 6px;
}

.local-hero-info p.local-hero-desc {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.6;
    max-width: 640px;
    margin-bottom: 14px;
}

.btn-fav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-fav:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.btn-fav.is-favorito {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.contact-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.contact-channel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    font-size: 13px;
    text-decoration: none;
    color: var(--color-text);
}

.contact-channel:hover {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.contact-channel i { color: var(--color-primary-dark); }

/* width: 100% hace falta porque el body es flex en columna: con
   "margin: 0 auto" la sección deja de estirarse al ancho de la pantalla
   y toma el ancho de su contenido -- la tabla del catálogo (min-width
   640px) la ensanchaba y en el celu toda la ficha quedaba alejada. */
.local-detail-section {
    width: 100%;
    padding: 28px 5%;
    max-width: 1100px;
    margin: 0 auto;
}

.local-detail-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

/* Franja de "Volver al mapa": mismo ancho y padding que .local-hero, así el
   botón queda alineado a la izquierda con la foto del local (sin el
   max-width de las secciones, que lo dejaba desfasado en pantallas anchas). */
.local-detail-section.local-volver {
    display: flex;
    justify-content: flex-start;
    max-width: none;
    padding: 20px 5% 0;
}

/* "Volver al mapa": pastilla blanca con texto negro, para que resalte
   tanto sobre el fondo gris como sobre la foto de fondo del local. */
.btn-volver {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #ffffff;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, box-shadow 0.15s ease,
                background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Al pasar el mouse o tocarlo (:active cubre el toque en el celular)
   se pone verde marca con el texto en blanco. */
.btn-volver:hover,
.btn-volver:focus-visible,
.btn-volver:active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
    transform: translateX(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.btn-volver:active {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

/* La flecha va en un circulito verde suave, como "chip" del botón */
.btn-volver i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    font-size: 11px;
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.btn-volver:hover i,
.btn-volver:focus-visible i,
.btn-volver:active i {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.btn-volver:hover i {
    transform: translateX(-2px);
}

.anmat-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary-dark);
    text-decoration: none;
}

/* Oferta flash: producto con precio_oferta cargado y un lote por
   vencer -- ver assets/js/local-detalle.js, assets/js/map.js. */
.flash-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 2px;
}

/* Corazón + "Agregar" en la misma línea, con aire entre los dos */
.product-acciones {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.product-fav-btn {
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 8px;
}

.product-fav-btn.is-favorito { color: var(--color-danger); }

/* Selector de estrellas clickeable (dejar una reseña) */
.star-input {
    display: flex;
    gap: 6px;
    font-size: 24px;
    margin-bottom: 6px;
}

.star-input button {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-border);
}

.star-input button.is-active,
.star-input button:hover,
.star-input button:hover ~ button {
    color: var(--color-rating);
}

/* ============================================================
   DIRECCIONES DE ENTREGA (cliente/direcciones.php)
   ============================================================ */
.address-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.address-card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
}

.address-card i.icon-home {
    color: var(--color-primary-dark);
    margin-right: 6px;
}

.address-card p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.address-card-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
}

.address-card-remove:hover { color: var(--color-danger); }

/* ============================================================
   FILTRO GEOGRAFICO EN CASCADA (index.php)
   Reemplaza el "Buenos Aires, CABA" fijo por 3 selects reales
   (provincia -> partido -> localidad).
   ============================================================ */
.geo-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.geo-filter select {
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    max-width: 160px;
}

.geo-filter select:disabled {
    color: var(--color-text-muted);
    cursor: not-allowed;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr;
    }

    #map {
        min-height: 360px;
    }

    /* En el celu se esconde solo "¿Tenés un comercio?". El carrito y
       "Mi panel" quedan como íconos (si no, no hay forma de volver al
       panel), y "Cerrar sesión" pierde el texto para que entre todo. */
    .site-nav {
        gap: 16px;
    }

    .site-nav .link-ghost[data-nav-invitado] {
        display: none;
    }

    .site-nav .link-ghost {
        font-size: 18px;
    }

    .site-nav .nav-label {
        display: none;
    }

    #btn-logout {
        padding: 10px 12px;
    }

    /* minmax(0, 1fr) y no 1fr a secas: "1fr" no deja que la columna sea
       más angosta que su contenido, y la fila de pestañas (nowrap) la
       estiraba a ~1500px -- en el celu toda la página quedaba alejada
       con el header y el footer chiquitos a la izquierda. */
    .dashboard-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .dashboard-nav {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden; /* si no, aparece un scroller vertical fantasma -- ver .panel-tabs */
        padding: 0 12px;
    }

    .dashboard-nav a {
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }

    .dashboard-nav a.active {
        border-left-color: transparent;
        border-bottom-color: var(--color-primary);
    }

    .product-form-layout,
    .two-col-form-layout {
        grid-template-columns: 1fr;
    }

    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .cart-item {
        flex-wrap: wrap;
    }

    .cart-item-subtotal {
        width: auto;
        margin-left: auto;
    }

    .local-hero {
        flex-direction: column;
    }

    .local-hero img,
    .local-hero-img-placeholder {
        width: 100%;
        height: 180px;
    }

    .geo-filter {
        flex-wrap: wrap;
    }

    .geo-filter select {
        max-width: none;
        flex: 1 1 100px;
    }
}

/* RUT-93 tarea 48: carrito en pantallas chicas (~400px). Con todo en
   una sola fila (imagen + nombre + cantidad + subtotal + tacho) el
   nombre del producto se quedaba con ~40px de ancho y se cortaba letra
   por letra; acá la imagen y el nombre van arriba, y cantidad/subtotal/
   tacho pasan a una segunda fila. */
@media (max-width: 480px) {
    /* Con los íconos del header (carrito, campanita, panel, salir) no
       entra todo: el nombre se partía en tres renglones y el header
       quedaba altísimo. Se esconde el lema y el nombre va en una línea. */
    .brand-text small {
        display: none;
    }

    .brand-text strong {
        white-space: nowrap;
    }

    .site-nav {
        gap: 12px;
    }

    /* Favoritos (cliente/favoritos.php): con el dedo, 28px es chico para
       tocar el corazón de "quitar" sin abrir el local por error. */
    .fav-card-remove {
        width: 36px;
        height: 36px;
    }

    .cart-item {
        gap: 10px 12px;
        padding: 12px 14px;
    }

    /* 52px de la imagen + 12px de gap + margen de sobra */
    .cart-item-info {
        flex: 1 1 calc(100% - 72px);
    }

    .cart-item-qty {
        margin-right: auto;
    }

    .cart-item-subtotal {
        margin-left: 0;
    }

    .cart-group-header,
    .cart-group-footer,
    .cart-entrega {
        padding-left: 14px;
        padding-right: 14px;
    }

    .cart-group-footer {
        flex-wrap: wrap;
    }

    .cart-group-footer .btn {
        flex: 1 1 100%;
    }

    .cart-total {
        padding: 16px 18px;
    }
}

/* ============================================================
   Campanita de notificaciones (includes/header.php +
   assets/js/notificaciones.js). 
   ============================================================ */
.dropdown {
    position: relative;
}

.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    opacity: 0.9;
}

.notif-bell:hover {
    opacity: 1;
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    padding: 1px 4px;
    border-radius: 999px;
    background: var(--color-danger);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 60;
    min-width: 320px;
    max-width: 360px;
    max-height: 420px;
    overflow-y: auto;
    padding-top: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.dropdown-menu.show {
    display: block;
}

.notif-item {
    position: relative;
    border-bottom: 1px solid var(--color-border);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item.no-leida {
    background: var(--color-primary-soft);
}

.notif-contenido {
    display: block;
    width: 100%;
    padding: 10px 34px 10px 16px; /* espacio a la derecha para no chocar con la cruz */
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}

.notif-eliminar {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: none;
    color: var(--color-text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.notif-eliminar:hover {
    background: var(--color-bg);
    color: var(--color-danger);
}

.notif-item h4 {
    margin: 0 0 3px;
    font-size: 13px;
    color: var(--color-text);
}

.notif-item p {
    margin: 0 0 4px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.notif-item time {
    font-size: 11px;
    color: var(--color-text-muted);
}

.notif-vacio {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* ---------- Estadísticas del admin (admin/estadisticas.php) ---------- */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.stats-header .dashboard-subtitle {
    margin-bottom: 0;
}

.stats-rango {
    display: inline-flex;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 3px;
}

.stats-rango-btn {
    border: none;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
}

.stats-rango-btn.active {
    background: var(--color-primary);
    color: #ffffff;
}

.stats-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stats-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
    color: inherit;
    text-decoration: none;
}

a.stats-kpi:hover {
    border-color: var(--color-primary);
}

.stats-kpi > i {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.stats-kpi--atencion > i {
    color: var(--color-warning);
    background: var(--color-warning-bg);
}

.stats-kpi--atencion {
    border-color: var(--color-warning);
}

.stats-kpi-texto {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stats-kpi-titulo {
    font-size: 12px;
    color: var(--color-text-muted);
}

.stats-kpi-valor {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.stats-kpi-detalle {
    font-size: 11px;
    color: var(--color-text-muted);
}

.stats-graficos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.stats-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
    min-width: 0; /* deja que el canvas se achique dentro de la grilla */
}

.stats-card--ancho {
    grid-column: 1 / -1;
}

.stats-card h3 {
    font-size: 15px;
    margin-bottom: 2px;
}

.stats-card-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 14px;
}

.stats-canvas-wrap {
    position: relative;
    height: 280px;
}

.stats-ranking {
    list-style: none;
    margin: 0;
    padding: 0;
}

.stats-ranking li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

.stats-ranking li:last-child {
    border-bottom: none;
}

.stats-ranking-nombre {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-ranking-nota {
    flex: none;
    font-weight: 600;
}

.stats-ranking-nota i {
    color: var(--color-rating);
}

.stats-ranking-nota small {
    color: var(--color-text-muted);
    font-weight: 400;
}

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

@media (max-width: 480px) {
    .stats-canvas-wrap {
        height: 240px;
    }

    .stats-kpi-valor {
        font-size: 22px;
    }
}

/* Vista previa de la imagen elegida dentro de una .dropzone
   (ver inicializarVistaPrevia en assets/js/dropzone.js). */
.dropzone--compacta {
    padding: 14px 12px;
    gap: 6px;
}

.dropzone-preview {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.dropzone--compacta .dropzone-preview {
    max-height: 130px;
}

.dropzone.tiene-preview {
    background: var(--color-surface);
    border-style: solid;
    border-color: var(--color-primary);
}

.dropzone.tiene-preview > i,
.dropzone.tiene-preview > strong {
    display: none;
}

/* Selectores de estado dentro de las tablas del panel (productos y
   pedidos del comerciante): fuera de un .form-group no heredaban ningún
   estilo y se veían como el selector por defecto del navegador. Mismo
   aspecto que .form-group select, en tamaño compacto para una fila. */
.select-estado-producto,
.select-estado-pedido {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg);
    cursor: pointer;
}

.select-estado-producto:focus,
.select-estado-pedido:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-surface);
}

.select-estado-producto:disabled,
.select-estado-pedido:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ============================================================
   CARRUSEL DE RESEÑAS (local.php, ver renderizarResenas en
   assets/js/local-detalle.js)
   Las reseñas van en una fila que se desliza en vez de una debajo de
   otra. .review-card se comparte con cliente/resenas.php (lista
   vertical), por eso acá solo se pisa dentro de .resenas-pista.
   ============================================================ */
.resenas-carrusel {
    position: relative;
}

.resenas-pista {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden; /* si no, aparece un scroller vertical fantasma -- ver .panel-tabs */
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    /* Aire alrededor para que el overflow no recorte la sombra de las
       tarjetas; el margen negativo compensa para que queden alineadas
       con el resto de la sección. */
    padding: 4px 4px 14px;
    margin: -4px -4px 0;
}

.resenas-pista:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

.resenas-pista .review-card {
    flex: 0 0 min(340px, 85%);
    margin-bottom: 0;
    scroll-snap-align: start;
}

.resenas-flecha {
    position: absolute;
    top: calc(50% - 7px);
    transform: translateY(-50%);
    z-index: 2;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.resenas-flecha:hover:not(:disabled) {
    color: var(--color-primary-dark);
    border-color: var(--color-primary);
}

.resenas-flecha:disabled {
    opacity: 0.35;
    cursor: default;
}

/* display:inline-flex de arriba le gana al atributo hidden del navegador */
.resenas-flecha[hidden] {
    display: none;
}

.resenas-flecha--anterior {
    left: -14px;
}

.resenas-flecha--siguiente {
    right: -14px;
}

/* En el celular se desliza con el dedo; las flechas solo estorbarían. */
@media (max-width: 600px) {
    .resenas-flecha {
        display: none;
    }
}

/* Celus muy angostos (320-360px): achicar logo, nombre y separaciones del
   header para que entre en una línea sin desbordar la página. */
@media (max-width: 360px) {
    .site-header {
        gap: 12px;
    }

    .brand {
        gap: 8px;
    }

    .brand-icon img {
        width: 28px;
        height: 28px;
    }

    .brand-text strong {
        font-size: 15px;
    }

    .site-nav {
        gap: 10px;
    }

    .site-nav .link-ghost {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .resenas-pista {
        scroll-behavior: auto;
    }
}

/* ============================================================
   FONDO CON LA FOTO DEL LOCAL (local.php, ver aplicarFondoDelLocal en
   assets/js/local-detalle.js)
   La clase local-con-fondo la agrega el JS al <body> SOLO si la foto del
   local cargó bien; sin ella la página queda como siempre.
   ============================================================ */

/* La foto va en una capa fija detrás de todo: no se mueve al scrollear. Se
   la desenfoca un poco porque las fotos de los locales suelen ser chicas y
   estiradas a pantalla completa se verían pixeladas; el inset negativo
   evita que el borde difuminado deje ver una franja clara. El color de
   abajo es un respaldo por si la imagen tarda en pintarse. */
body.local-con-fondo::before {
    content: '';
    position: fixed;
    inset: -24px;
    z-index: -1;
    background:
        linear-gradient(rgba(10, 12, 16, 0.62), rgba(10, 12, 16, 0.62)),
        var(--local-fondo) center / cover no-repeat,
        #1f2937;
    filter: blur(6px);
}

/* Encabezado del local: sin su fondo blanco sólido (taparía la foto) y con
   los textos claros. La foto cuadrada, los chips de contacto, el corazón y
   las tarjetas de más abajo conservan su fondo propio, así que se leen igual. */
body.local-con-fondo .local-hero {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

body.local-con-fondo .local-hero img {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

body.local-con-fondo .local-hero-info h1 {
    color: #ffffff;
}

body.local-con-fondo .local-hero-info p.local-hero-desc,
body.local-con-fondo .local-hero .local-address,
body.local-con-fondo .local-hero .rating span {
    color: rgba(255, 255, 255, 0.88);
}

/* Títulos de sección: van directo sobre el fondo. El ">" es a propósito:
   "Dejá tu reseña" también es un h2 de esta sección, pero está adentro de
   una tarjeta blanca y tiene que seguir oscuro. ("Volver al mapa" es una
   pastilla blanca, .btn-volver, así que no necesita ajuste acá.) */
body.local-con-fondo .local-detail-section > h2 {
    color: #ffffff;
}

/* Avisos de "todavía no hay reseñas" / "no pudimos cargar": no están
   adentro de ninguna tarjeta, quedan sobre el fondo. */
body.local-con-fondo #local-resenas > .table-empty,
body.local-con-fondo #local-resenas > .table-error,
body.local-con-fondo #local-resenas > .table-empty i,
body.local-con-fondo #local-resenas > .table-error i {
    color: rgba(255, 255, 255, 0.88);
}

/* ============================================================
   HOME: ALTO FIJO Y LISTA DE LOCALES CON SCROLL PROPIO (index.php)
   Antes el panel crecía con cada local nuevo y el mapa, que acompaña el
   alto de la fila, se estiraba con él. Ahora el bloque (lista + mapa)
   mide siempre lo mismo y solo se desplaza la lista; el título de arriba
   queda fijo. Va después de .home-layout / .locales-panel / .locales-list
   de más arriba porque las pisa.
   ============================================================ */

/* Con la lista acotada, las tarjetas no se pueden achicar para entrar:
   que se desplacen en vez de comprimirse. */
.locales-list > * {
    flex-shrink: 0;
}

@media (min-width: 901px) {
    .home-layout {
        height: clamp(520px, 75vh, 860px);
        min-height: 0;
        grid-template-rows: minmax(0, 1fr);
    }

    .locales-panel {
        display: flex;
        flex-direction: column;
        min-height: 0; /* sin esto un hijo flex no puede ser más chico que su contenido */
        overflow: hidden; /* el que se desplaza es .locales-list, no todo el panel */
    }

    .locales-panel .intro {
        flex-shrink: 0;
    }

    .locales-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        scrollbar-width: thin;
        /* Aire para que el overflow no recorte la sombra de las tarjetas y
           para que la barra de scroll no quede encima de ellas; el margen
           izquierdo compensa para que sigan alineadas con el título. */
        padding: 4px 10px 8px 4px;
        margin-left: -4px;
    }
}

/* En el celu la lista va arriba del mapa: sin tope, con muchos locales el
   mapa quedaría muy abajo. */
@media (max-width: 900px) {
    .locales-list {
        max-height: 70vh;
        overflow-y: auto;
        scrollbar-width: thin;
        padding: 4px 6px 8px 4px;
        margin-left: -4px;
    }
}

/* ============================================================
   FICHA DEL LOCAL EN EL CELULAR: LA FOTO COMPLETA
   En pantallas chicas el encabezado apila la foto arriba del texto y la
   dejaba en un banner de alto fijo (100% de ancho x 180px): una foto vertical
   o cuadrada quedaba cortada arriba y abajo. Ahora conserva su proporción
   (alto automático, hasta 320px) y se ve entera.
   ============================================================ */
@media (max-width: 900px) {
    .local-hero img {
        width: 100%;
        height: auto;
        max-height: 320px;
        object-fit: contain;
    }
}

/* ============================================================
   BOTÓN "×" PARA QUITAR LA IMAGEN ELEGIDA (ver inicializarVistaPrevia en
   assets/js/dropzone.js). Aparece en la esquina de la zona mientras haya un
   archivo elegido.
   ============================================================ */
.dropzone {
    position: relative;
}

.dropzone-quitar {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-card);
    font: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.dropzone-quitar:hover,
.dropzone-quitar:focus-visible {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* display:inline-flex de arriba le gana al atributo hidden del navegador */
.dropzone-quitar[hidden] {
    display: none;
}