/* ═══════════════════════════════════════════════════════════════════
   DOÑA LUISA · Almacén familiar — identidad visual (se carga después de ui.css)
   ═══════════════════════════════════════════════════════════════════ */
:root {
    --px: #8d653c;
    --px-rgb: 141, 101, 60;
    --px-oscuro: #634628;
    --px-vivo: #d7a775;
    --px-suave: #faf5ef;
    --px-noche: #16110b;
    --px-noche2: #281f15;

    --acento: #e1be99;
    --acento-ia: #e3c19d;
    --sb-bg: #1f1810;
    --sb-bg2: #2f2419;
    --sb-texto: #e2d7cc;
    --radio-card: 18px;
    --sombra-suave: 0 1px 2px rgba(51, 35, 20, .05), 0 10px 28px rgba(51, 35, 20, .07);

    --bs-primary: #8d653c;
    --bs-primary-rgb: 141, 101, 60;
    --bs-link-color: #8d653c;
    --bs-link-color-rgb: 141, 101, 60;
    --bs-link-hover-color: #634628;
    --bs-primary-bg-subtle: #faf5ef;
    --bs-primary-text-emphasis: #634628;
}

body { background: #f9f7f5; }
h1, h2, h3, h4, .pag-titulo h2, .px-titulo { font-family: 'Montserrat', 'Segoe UI', Roboto, sans-serif; letter-spacing: -.015em; }

/* ── Botones y controles en marrón kraft ── */
.btn-primary, .btn-celeste {
    --bs-btn-bg: #8d653c; --bs-btn-border-color: #8d653c; --bs-btn-hover-bg: #755330; --bs-btn-hover-border-color: #755330;
    --bs-btn-active-bg: #634628; --bs-btn-active-border-color: #634628; --bs-btn-disabled-bg: #c4a788; --bs-btn-disabled-border-color: #c4a788;
    background: linear-gradient(135deg, #b07a42, #8d653c); border: 0; color: #fff; box-shadow: 0 4px 14px rgba(var(--px-rgb), .28);
}
.btn-primary:hover, .btn-celeste:hover { background: linear-gradient(135deg, #946a3f, #755330); color: #fff; }
.btn-outline-primary { --bs-btn-color: #8d653c; --bs-btn-border-color: #8d653c; --bs-btn-hover-bg: #8d653c; --bs-btn-hover-border-color: #8d653c; --bs-btn-active-bg: #634628; --bs-btn-active-border-color: #634628; }
.text-primary { color: #8d653c !important; }
.bg-primary { background-color: #8d653c !important; }
.border-primary { border-color: #8d653c !important; }
.form-control:focus, .form-select:focus { border-color: #d7a775; box-shadow: 0 0 0 .22rem rgba(var(--px-rgb), .2); }
.form-check-input:checked { background-color: #8d653c; border-color: #8d653c; }
.nav-tabs .nav-link { color: #8d653c; }
.nav-pills { --bs-nav-pills-link-active-bg: #8d653c; }
.pagination { --bs-pagination-active-bg: #8d653c; --bs-pagination-active-border-color: #8d653c; --bs-pagination-color: #8d653c; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: rgba(var(--px-rgb), .055); }
.btn:focus-visible, .sb-link:focus-visible, .sb-icon:focus-visible, a:focus-visible { outline-color: rgba(var(--px-rgb), .55); }
.drop-zona { border-color: #e8d7c5; background: rgba(var(--px-rgb), .035); }
.drop-zona:hover, .drop-zona.arrastrando { border-color: #8d653c; background: rgba(var(--px-rgb), .09); }
.drop-zona .bi { color: #8d653c; }
.resumen-caja > div { background: rgba(var(--px-rgb), .07); }
.pag-titulo .pag-ico { background: linear-gradient(135deg, #d8aa7a, #8d653c); }

/* ── Menú lateral nocturno ── */
.sidebar { background: radial-gradient(120% 60% at 0% 0%, #523b24 0%, var(--sb-bg) 45%, var(--px-noche) 100%); }
.sb-link.activo { background: linear-gradient(90deg, rgba(215, 167, 117, .42), rgba(215, 167, 117, .08)); box-shadow: inset 3px 0 0 #e4c3a1; }
.sb-group { color: #927d67; }
.sb-vender { background: linear-gradient(135deg, #d8aa7a, #9b6e3e); box-shadow: 0 8px 20px rgba(215, 167, 117, .4); }
.topbar { background: linear-gradient(100deg, #43311e, var(--px-noche)); }

.px-marca { display: flex; align-items: center; flex: 1; min-width: 0; text-decoration: none; }
.px-marca .px-logo { width: 150px; max-width: 100%; height: auto; }
.px-marca .px-icono { width: 40px; height: 40px; display: none; }
@media (min-width: 992px) {
    .sb-colapsado .px-marca { flex: 0; }
    .sb-colapsado .px-marca .px-logo { display: none; }
    .sb-colapsado .px-marca .px-icono { display: block; }
}
.topbar-brand .px-logo { height: 28px; width: auto; }

/* ── Sucursal actual / selector ── */
.px-suc { margin: 2px 12px 6px; }
.px-suc-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; color: #fff; border: 1px solid rgba(228, 195, 161, .28);
    background: rgba(215, 167, 117, .14); border-radius: 14px; padding: 9px 11px; line-height: 1.2;
}
button.px-suc-btn:hover { background: rgba(215, 167, 117, .26); }
.px-suc-btn > i:first-child { font-size: 1.15rem; color: #eed9c4; width: 22px; text-align: center; flex-shrink: 0; }
.px-suc-btn small { display: block; font-size: .6rem; letter-spacing: .14em; font-weight: 800; color: #d2bba4; text-transform: uppercase; }
.px-suc-btn strong { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.px-suc .dropdown-menu { width: 224px; min-width: 224px; background: #2f2419; border-radius: 14px; overflow: hidden; }
.px-suc .dropdown-item { color: #f5eee7; display: flex; align-items: center; gap: 9px; padding: .55rem .9rem; }
.px-suc .dropdown-item:hover { background: rgba(215, 167, 117, .25); color: #fff; }
.px-suc .dropdown-item.activa { background: #8d653c; color: #fff; }
@media (min-width: 992px) {
    .sb-colapsado .px-suc { margin: 2px 8px 6px; }
    .sb-colapsado .px-suc-btn { justify-content: center; padding: 9px 0; }
    .sb-colapsado .px-suc-btn > i.bi-chevron-expand { display: none; }
    .sb-colapsado .px-suc .dropdown-menu { width: 250px; }
}
.px-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; padding: .28rem .6rem; border-radius: 999px; background: rgba(215, 167, 117, .25); color: #fff; max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── IA en violeta ── */
.ia-fab, .ia-enviar, .ia-bienvenida .ia-ico { background: linear-gradient(135deg, #d7a775, #8d653c); }
.ia-head { background: linear-gradient(135deg, #563d23, #b07a42); }
.ia-msg.user { background: #8d653c; }
.ia-entrada textarea:focus { border-color: #d7a775; box-shadow: 0 0 0 .2rem rgba(var(--px-rgb), .2); }
/* en el punto de venta el botón de la IA no tapa el título */
@media (min-width: 768px) { body:has(.pos-row) .ia-fab { left: calc(var(--sb-w-chico) + 385px); } }

/* ── Pantalla de inicio ── */
.px-hero {
    position: relative; overflow: hidden; border-radius: 26px; color: #fff; padding: clamp(20px, 3.4vw, 38px);
    background: radial-gradient(90% 140% at 100% 0%, #d7a775 0%, rgba(215, 167, 117, 0) 55%), linear-gradient(120deg, #16110b 0%, #563d23 62%, #8d653c 100%);
    box-shadow: 0 20px 44px rgba(92, 64, 35, .28);
}
.px-hero::after { content: ''; position: absolute; right: -50px; bottom: -70px; width: 270px; height: 270px; background: url('../marca/icono.png') center/contain no-repeat; opacity: .13; transform: rotate(-8deg); pointer-events: none; }
.px-hero h1 { font-weight: 800; font-size: clamp(1.45rem, 3.4vw, 2.35rem); margin: 0; }
.px-hero .px-sub { color: #f1dfcd; font-weight: 500; }
.px-24 { display: inline-flex; align-items: center; gap: 7px; font-size: .72rem; font-weight: 800; letter-spacing: .14em; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; padding: .3rem .75rem; margin-bottom: .8rem; }
.px-punto { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .22); }
.px-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 22px; position: relative; z-index: 1; }
.px-kpis > div { background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .13); border-radius: 18px; padding: 12px 16px; }
.px-kpis small { display: block; font-size: .66rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: #ecd9c6; }
.px-kpis strong { font-family: 'Montserrat', sans-serif; font-size: clamp(1.15rem, 2.2vw, 1.6rem); }

.px-sucursales { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.px-card { background: var(--bs-body-bg, #fff); border-radius: 22px; overflow: hidden; box-shadow: var(--sombra-suave); border: 1px solid rgba(var(--px-rgb), .1); display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s; }
.px-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(92, 64, 35, .15); }
.px-card.elegida { border: 2px solid #8d653c; }
.px-card-top { padding: 18px 20px 14px; background: linear-gradient(135deg, #8d653c, #563d23); color: #fff; }
.px-card-top h3 { font-size: 1.08rem; font-weight: 800; margin: 0; }
.px-card-top small { color: #f2e3d3; }
.px-card-body { padding: 16px 20px; flex: 1; }
.px-venta { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 1.9rem; color: #8d653c; line-height: 1.1; }
.px-datos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; text-align: center; }
.px-datos > div { background: rgba(var(--px-rgb), .07); border-radius: 14px; padding: 8px 4px; }
.px-datos b { display: block; font-size: 1.2rem; }
.px-datos span { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: #7c7166; }
.px-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(34, 197, 94, .13); color: #15803d; border-radius: 999px; padding: .25rem .65rem; font-size: .76rem; font-weight: 700; margin: 0 4px 4px 0; }

.px-acciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.px-accion { display: flex; flex-direction: column; gap: 10px; padding: 20px 18px; border-radius: 20px; background: var(--bs-body-bg, #fff); text-decoration: none; color: inherit; box-shadow: var(--sombra-suave); border: 1px solid rgba(var(--px-rgb), .1); transition: transform .16s, box-shadow .16s; min-height: 130px; }
.px-accion:hover { transform: translateY(-4px); box-shadow: 0 18px 34px rgba(92, 64, 35, .15); color: inherit; }
.px-accion i { width: 46px; height: 46px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--px-suave); color: #8d653c; }
.px-accion strong { font-family: 'Montserrat', sans-serif; font-size: .98rem; }
.px-accion small { color: #7c7166; line-height: 1.25; }
.px-accion.principal { background: linear-gradient(135deg, #d7a775, #815a32); color: #fff; }
.px-accion.principal i { background: rgba(255, 255, 255, .18); color: #fff; }
.px-accion.principal small { color: #f5eade; }
.px-accion.principal:hover { color: #fff; }
.px-seccion { font-size: .72rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; color: #948473; margin: 26px 0 12px; }

/* ── Acceso ── */
.px-login { position: fixed; inset: 0; z-index: 10; overflow: auto; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--bs-body-bg, #fff); }
.px-login-marca { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 34px; padding: 48px; color: #fff; text-align: center;
    background: radial-gradient(70% 60% at 50% 40%, rgba(215, 167, 117, .42), rgba(215, 167, 117, 0) 70%), #0d0a06; }
.px-login-marca img { width: min(440px, 82%); height: auto; filter: drop-shadow(0 0 34px rgba(215, 167, 117, .55)); }
.px-login-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.px-login-chips span { border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: .4rem .85rem; font-size: .8rem; font-weight: 600; color: #f4e7d9; }
.px-login-form { display: flex; align-items: center; justify-content: center; padding: 32px 22px; }
.px-login-form > div { width: 100%; max-width: 380px; }
.px-login-form .form-control { padding: .8rem 1rem; border-radius: 14px; }
@media (max-width: 991.98px) {
    .px-login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .px-login-marca { padding: 34px 20px 26px; gap: 16px; }
    .px-login-marca img { width: min(300px, 80%); }
    .px-login-chips { display: none; }
}

/* ── Modo oscuro ── */
[data-bs-theme="dark"] { --bs-primary-bg-subtle: #3f3021; --bs-primary-text-emphasis: #efdcc8; }
[data-bs-theme="dark"] body { background: #120e09; }
[data-bs-theme="dark"] .sidebar { background: radial-gradient(120% 60% at 0% 0%, #44311d 0%, #1c150d 45%, #0d0a06 100%); }
[data-bs-theme="dark"] .text-primary, [data-bs-theme="dark"] .px-venta { color: #e9ceb2 !important; }
[data-bs-theme="dark"] .nav-tabs .nav-link { color: #e9ceb2; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #e9ceb2; --bs-btn-border-color: #d7a775; --bs-btn-hover-bg: #8d653c; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .px-card, [data-bs-theme="dark"] .px-accion:not(.principal) { background: #221b14; border-color: #403428; }
[data-bs-theme="dark"] .px-accion:not(.principal) i { background: #483726; color: #edd8c2; }
[data-bs-theme="dark"] .px-accion small, [data-bs-theme="dark"] .px-datos span { color: #bfb3a6; }
[data-bs-theme="dark"] .px-chip { color: #6ee7a0; }
@media (prefers-reduced-motion: reduce) { .px-card, .px-accion { transition: none; } }

/* etiquetas suaves sobre el color de marca: texto legible */
.badge.bg-primary.bg-opacity-25.text-dark { color: var(--bs-primary-text-emphasis) !important; }

/* ── Tarjeta de San Jorge Mayorista (otro negocio, con sus colores) ── */
.sj-negocio { border-radius: 22px; overflow: hidden; box-shadow: var(--sombra-suave); border: 1px solid rgba(11, 61, 130, .2); background: var(--bs-body-bg, #fff); }
.sj-negocio-marca { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; background: linear-gradient(120deg, #050e1f, #0b3d82); border-bottom: 4px solid #d3202f; }
.sj-negocio-marca img { height: 46px; max-width: 70%; object-fit: contain; }
.sj-estado { color: #c3d8f7; font-size: .76rem; font-weight: 700; }
.sj-estado.mal { color: #ffd45c; }
.sj-negocio-cuerpo { padding: 16px 20px 18px; }
.sj-datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sj-datos > div { background: rgba(11, 61, 130, .07); border-radius: 14px; padding: 10px 14px; }
.sj-datos small { display: block; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #64748f; }
.sj-datos b { font-family: 'Montserrat', sans-serif; font-size: 1.35rem; }
.sj-btn { background: linear-gradient(135deg, #15539f, #0b3d82); color: #fff; border: 0; }
.sj-btn:hover { background: linear-gradient(135deg, #0d4591, #072f6a); color: #fff; }
.px-suc .dropdown-item.sj-item { color: #cfe0fa; }
.px-suc .dropdown-item.sj-item img { width: 20px; height: 20px; }
[data-bs-theme="dark"] .sj-negocio { border-color: #223350; background: #101b2e; }
[data-bs-theme="dark"] .sj-datos > div { background: rgba(122, 170, 240, .1); }

/* ── Ingreso: elegir cajero y sucursal, o escribir usuario ── */
.px-login [hidden] { display: none !important; }
.ing-modos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: rgba(var(--px-rgb), .08); border-radius: 14px; padding: 5px; margin-bottom: 14px; }
.ing-modos button { border: 0; background: transparent; border-radius: 10px; padding: .6rem .4rem; font-weight: 700; font-size: .9rem; color: #8d653c; }
.ing-modos button.activo { background: #8d653c; color: #fff; box-shadow: 0 4px 12px rgba(var(--px-rgb), .3); }
.ing-paso { display: block; font-weight: 700; font-size: .85rem; margin: 10px 0 8px; }
.ing-opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ing-opciones.ing-una { grid-template-columns: 1fr; }
.ing-opcion { position: relative; cursor: pointer; }
.ing-opcion input { position: absolute; opacity: 0; pointer-events: none; }
.ing-opcion span { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 52px; height: 100%; padding: .55rem .6rem; border: 2px solid rgba(var(--px-rgb), .2); border-radius: 14px; font-weight: 700; font-size: .9rem; line-height: 1.2; transition: background .12s, border-color .12s; }
.ing-opcion:hover span { border-color: rgba(var(--px-rgb), .55); }
.ing-opcion input:checked + span { background: #8d653c; border-color: #8d653c; color: #fff; }
.ing-opcion input:focus-visible + span { outline: 3px solid rgba(var(--px-rgb), .55); outline-offset: 2px; }
.ing-panel #clave_cajero { margin-bottom: .75rem; }
@media (max-width: 991.98px) { .px-login-form { align-items: flex-start; padding-top: 18px; } }
[data-bs-theme="dark"] .ing-modos button { color: #efdcc8; }
[data-bs-theme="dark"] .ing-modos button.activo { color: #fff; }
