/*
 * Mesatek — interfaz del punto de venta.
 * Se apoya en Bootstrap 3 (modales y pestañas que usa posgourmet.js) y sobrescribe
 * los estilos en línea que el JS heredado genera para categorías, productos y detalle.
 */

:root {
    /* Marca: azul noche #14213D, ámbar #E8961C, crema #FAF7F2, gris pizarra #4A5468 */
    --pos-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --pos-font-display: "Space Grotesk", var(--pos-font);
    --pos-bg: #faf7f2;
    --pos-surface: #ffffff;
    --pos-surface-2: #f5f0e7;
    --pos-border: #e7e0d4;
    --pos-ink: #14213d;
    --pos-text: #4a5468;
    --pos-muted: #626c80;
    --pos-topbar: #14213d;
    --pos-topbar-2: #24345a;
    --pos-topbar-3: #31436f;
    --pos-topbar-muted: #a9b3c6;
    /* Sobre ámbar el texto va en azul noche: el blanco no alcanza contraste legible */
    --pos-accent: #e8961c;
    --pos-accent-hover: #f2ab42;
    --pos-accent-dark: #a8660c;
    --pos-accent-soft: #fdf1de;
    --pos-success: #1f9d55;
    --pos-danger: #d64545;
    --pos-radius: 12px;
    --pos-radius-sm: 8px;
    --pos-shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 1px 3px rgba(20, 33, 61, .08);
    --pos-ticket-width: 430px;
    --pos-topbar-height: 60px;
}

/* ---------- Base ---------- */
html, body.pos-body { height: 100%; }

body.pos-body {
    margin: 0;
    overflow: hidden;
    background: var(--pos-bg);
    color: var(--pos-text);
    font-family: var(--pos-font);
    font-size: 14px;
}

body.pos-body-login {
    min-height: 100vh;
    font-family: var(--pos-font);
    background: linear-gradient(135deg, var(--pos-topbar) 0%, #2a3d68 100%);
}

body.pos-body-login .pos-app { display: none; }

.pos-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.pos-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--pos-muted);
}

.pos-hint { color: var(--pos-muted); margin: 12px 4px; }

/* ---------- Barra superior ---------- */
.pos-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--pos-topbar-height);
    padding: 0 16px;
    background: var(--pos-topbar);
    color: #fff;
    flex-shrink: 0;
}

.pos-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.pos-brand img { display: block; height: 40px; width: auto; }
.pos-brand-icon { display: none !important; }

.pos-search {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.pos-search .fa {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pos-topbar-muted);
}

.pos-search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 36px;
    border: 1px solid transparent;
    border-radius: 19px;
    background: var(--pos-topbar-2);
    color: #fff;
    outline: none;
    transition: border-color .15s, background .15s;
}

.pos-search input::placeholder { color: var(--pos-topbar-muted); }
.pos-search input:focus { border-color: var(--pos-accent); background: #0d1729; }

.pos-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.pos-chip,
#labelUser,
#labelExchangeRate,
#labelShift {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    margin: 0;
    border-radius: 17px;
    background: var(--pos-topbar-2);
    font-size: 13px !important;
    font-weight: 600;
    white-space: nowrap;
}

.pos-topbar .fa { color: var(--pos-accent); }
.pos-search .fa { color: var(--pos-topbar-muted); }
.pos-icon-btn .fa { color: inherit; }

.pos-chip-select select {
    background: transparent;
    border: 0;
    color: #fff;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    max-width: 150px;
}

.pos-chip-select option { color: var(--pos-text); }

.pos-restaurant-select {
    height: 34px;
    max-width: 180px;
    padding: 0 10px;
    margin: 0;
    border: 0;
    border-radius: 17px;
    background: var(--pos-accent);
    color: var(--pos-ink);
    font-weight: 700;
    cursor: pointer;
}

.pos-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
    padding: 0 6px;
}

.pos-clock #h1_clock {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pos-clock #h3CurrentDate { color: var(--pos-topbar-muted); font-size: 11px; }

.pos-topbar-actions { display: flex; gap: 6px; margin: 0; }

.pos-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--pos-topbar-2);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
}

.pos-icon-btn:hover { background: var(--pos-topbar-3); color: #fff; text-decoration: none; }
.pos-icon-btn.disabled { opacity: .45; cursor: not-allowed; }
.pos-icon-btn-danger:hover { background: var(--pos-danger); }

/* ---------- Distribución principal ---------- */
.pos-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--pos-ticket-width);
    gap: 12px;
    flex: 1;
    min-height: 0;
    padding: 12px;
}

.pos-workspace,
.pos-ticket {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    box-shadow: var(--pos-shadow);
}

/* ---------- Pestañas ---------- */
.pos-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 8px 0;
    border-bottom: 1px solid var(--pos-border);
    flex-shrink: 0;
}

.pos-tabs > li > a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: var(--pos-radius-sm) var(--pos-radius-sm) 0 0;
    color: var(--pos-muted);
    font-weight: 600;
    border-bottom: 3px solid transparent;
}

.pos-tabs > li > a:hover,
.pos-tabs > li > a:focus { background: var(--pos-surface-2); color: var(--pos-text); }

.pos-tabs > li.active > a,
.pos-tabs > li.active > a:hover {
    color: var(--pos-accent-dark);
    border-bottom-color: var(--pos-accent);
    background: transparent;
}

.pos-badge {
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--pos-accent);
    color: var(--pos-ink);
    font-weight: 700;
    font-size: 11px;
    text-align: center;
}

.pos-tab-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.pos-tab-content > .tab-pane { height: 100%; }
.pos-tab-content > .tab-pane.active { display: flex; flex-direction: column; }

.pos-pane { padding: 16px; overflow-y: auto; }

.pos-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.pos-pane-header h4 { margin: 0; font-weight: 700; }
.pos-pane-header select { max-width: 280px; }

/* ---------- Categorías (botones generados por el JS) ---------- */
.pos-categories {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
    flex-shrink: 0;
    max-height: none !important;
    min-height: 0 !important;
    background: var(--pos-surface) !important;
    border-bottom: 1px solid var(--pos-border);
}

.pos-categories > button,
.pos-categories > button.buttonCategory,
.pos-categories > button.buttonCategoryMobile {
    flex-shrink: 0;
    width: auto !important;
    height: 40px !important;
    padding: 0 18px !important;
    margin: 0 !important;
    border: 1px solid var(--pos-border) !important;
    border-radius: 20px !important;
    background: var(--pos-surface-2) !important;
    color: var(--pos-text) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: .02em;
    white-space: nowrap;
    cursor: pointer;
}

.pos-categories > button:hover { border-color: var(--pos-accent) !important; color: var(--pos-accent-dark) !important; }

.pos-categories > button.clickMenuGroup {
    background: var(--pos-accent) !important;
    border-color: var(--pos-accent) !important;
    color: var(--pos-ink) !important;
}

/* ---------- Productos (botones generados por el JS) ---------- */
.pos-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: 112px;
    gap: 10px;
    flex: 1;
    align-content: start;
    padding: 12px;
    margin: 0 !important;
    overflow-y: auto;
    max-height: none !important;
    min-height: 0 !important;
    background: var(--pos-surface-2) !important;
}

.pos-products > button.btnMenu,
.pos-products > a.btnMenu > div > .btn {
    position: relative;
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 10px 10px 8px !important;
    border: 0 !important;
    border-radius: var(--pos-radius-sm) !important;
    overflow: hidden;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.25;
    text-align: left;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35) !important;
    white-space: normal !important;
    box-shadow: var(--pos-shadow) !important;
    transition: transform .08s ease, box-shadow .15s ease;
}

/* Capa para asegurar contraste sobre el color configurado de cada producto */
.pos-products > button.btnMenu::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .28) 100%);
    pointer-events: none;
}

.pos-products > button.btnMenu::after {
    content: "Bs " attr(price);
    position: relative;
    align-self: flex-end;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    color: var(--pos-text);
    font-size: 12px;
    text-shadow: none;
}

.pos-products > button.btnMenu:hover { box-shadow: 0 6px 14px rgba(20, 33, 61, .18) !important; }
.pos-products > button.btnMenu:active { transform: scale(.97); }

/* Productos con foto: el JS heredado genera <a><div><div.btn><img><span>; se rediseña como tarjeta */
.pos-products > a.btnMenu {
    position: relative;
    display: block !important;
    height: 100%;
    border-radius: var(--pos-radius-sm);
    overflow: hidden;
    box-shadow: var(--pos-shadow);
    text-decoration: none;
    transition: transform .08s ease, box-shadow .15s ease;
}

.pos-products > a.btnMenu:hover { box-shadow: 0 6px 14px rgba(20, 33, 61, .18); }
.pos-products > a.btnMenu:active { transform: scale(.97); }
.pos-products > a.btnMenu > div { display: block !important; width: 100% !important; height: 100%; padding: 0 !important; }

.pos-products > a.btnMenu > div > .btn {
    display: block !important;
    padding: 0 !important;
    background: var(--pos-topbar-2) !important;
    box-shadow: none !important;
}

/* Degradado para que el nombre se lea sobre cualquier foto */
.pos-products > a.btnMenu > div > .btn::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .78) 100%);
    pointer-events: none;
}

.pos-products > a.btnMenu .col-lg-6 { position: static !important; float: none; width: auto; padding: 0 !important; }

.pos-products > a.btnMenu img {
    position: absolute !important;
    inset: 0;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.pos-products > a.btnMenu span {
    position: absolute !important;
    z-index: 2;
    left: 10px !important;
    right: 10px;
    top: auto !important;
    bottom: 8px;
    color: #fff;
    font-size: 13px !important;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6) !important;
}

.pos-products > a.btnMenu::after {
    content: "Bs " attr(price);
    position: absolute;
    z-index: 3;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    color: var(--pos-text);
    font-size: 12px;
    font-weight: 700;
}

/* ---------- Mesas ---------- */
.pos-diningTables {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    height: auto !important;
}

.pos-diningTables > button {
    width: 100% !important;
    height: 80px !important;
    margin: 0 !important;
    border: 2px dashed #cfc7b8 !important;
    border-radius: var(--pos-radius-sm) !important;
    background: var(--pos-surface-2);
    color: var(--pos-text) !important;
    font-size: 18px !important;
    font-weight: 700;
    white-space: normal !important;
}

.pos-diningTables > button.addPeople { background: var(--pos-surface-2) !important; }
.pos-diningTables > button.increasePeople { border-style: solid !important; border-color: rgba(0, 0, 0, .15) !important; }
.pos-diningTables > button .fa { display: block; font-size: 16px; opacity: .7; margin-bottom: 4px; }

/* ---------- Formularios de caja / domicilio ---------- */
.pos-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }

.pos-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.pos-form-grid > label { font-size: 12px; font-weight: 600; color: var(--pos-muted); margin: 0; }
.pos-form-grid > label > .form-control { margin-top: 4px; color: var(--pos-text); }
.pos-span-2 { grid-column: span 2; }
.pos-span-4 { grid-column: span 4; }

.pos-checks { display: flex; gap: 20px; margin-bottom: 12px; }
.pos-checks label { font-weight: 600; cursor: pointer; }

.pos-table-wrap { border: 1px solid var(--pos-border); border-radius: var(--pos-radius-sm); overflow: hidden; }

/* ---------- Tablas ---------- */
.pos-table { margin: 0; }

.pos-table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px;
    border-bottom: 1px solid var(--pos-border) !important;
    background: var(--pos-surface-2);
    color: var(--pos-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.pos-table > tbody > tr > td { padding: 8px; vertical-align: middle; border-top: 1px solid var(--pos-border) !important; }

/* ---------- Ticket ---------- */
.pos-ticket { overflow: hidden; }

.pos-ticket-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--pos-border);
}

.pos-ticket-head > div:first-child { display: flex; align-items: baseline; gap: 8px; }

.pos-order-number {
    width: 64px;
    border: 0;
    background: transparent;
    font-size: 22px;
    font-weight: 700;
    color: var(--pos-ink);
}

.pos-ticket-head-actions { display: flex; gap: 6px; }

.pos-processing {
    display: none;
    padding: 2px 8px;
    border-radius: 10px;
    background: #fff4d6;
    color: #8a5a00 !important;
    font-size: 11px;
    font-weight: 700;
    animation: pos-pulso 1.2s ease-in-out infinite;
}

@keyframes pos-pulso { 50% { opacity: .45; } }

.pos-customer,
.pos-code {
    display: grid;
    gap: 6px;
    padding: 10px 14px 0;
}

.pos-customer { grid-template-columns: 1.6fr 1fr auto; }
.pos-code { grid-template-columns: 1fr 80px; padding-bottom: 10px; border-bottom: 1px solid var(--pos-border); }

.pos-detail {
    position: relative;
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
}

.pos-detail #tableDetail { font-size: 13px; }

/* filas generadas por listarDetalleVenta() */
#tableDetail > tbody > tr.colorhover { background: transparent; font-weight: 600 !important; }
#tableDetail > tbody > tr.colorhover:hover { background: var(--pos-accent-soft); }
#tableDetail > tbody > tr > td { width: auto !important; padding: 7px 6px !important; }
#tableDetail > tbody > tr > td:nth-child(1) { width: 52px !important; }
#tableDetail > tbody > tr > td:nth-child(3),
#tableDetail > tbody > tr > td:nth-child(4) { width: 70px !important; }
#tableDetail > tbody > tr > td:last-child { width: 1% !important; white-space: nowrap; padding: 4px !important; text-align: right; }
#tableDetail > tbody > tr > td:last-child .btn { padding: 3px 7px; font-size: 11px; border-radius: 6px; }
#tableDetail input[name=noteProduct][type=text] { margin-top: 4px; height: 28px; font-size: 12px; }

.pos-detail-empty {
    position: absolute;
    inset: 40px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #a39c8f;
    pointer-events: none;
}

.pos-detail-empty .fa { font-size: 34px; }
.pos-detail:has(#tbodyDetail tr) .pos-detail-empty { display: none; }

.pos-ticket-foot {
    padding: 10px 14px 14px;
    border-top: 1px solid var(--pos-border);
    background: var(--pos-surface-2);
}

.pos-options { display: flex; gap: 18px; margin-bottom: 8px; }
.pos-options label { margin: 0; font-weight: 600; cursor: pointer; }
.pos-options .fa { color: var(--pos-muted); }

.pos-keypad {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.pos-keypad #qty {
    grid-column: span 6;
    height: 34px;
    font-weight: 700;
    text-align: right;
}

.pos-keypad button {
    height: 36px;
    border: 1px solid var(--pos-border);
    border-radius: 6px;
    background: var(--pos-surface);
    font-size: 15px;
    font-weight: 700;
    color: var(--pos-ink);
}

.pos-keypad button:active { background: var(--pos-accent-soft); }
.pos-keypad .pos-keypad-clear { color: var(--pos-danger); }

.pos-totals {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 10px;
}

.pos-totals input {
    width: 100%;
    border: 0;
    background: transparent;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--pos-ink);
    outline: none;
}

#totalBs { font-size: 30px; line-height: 1.1; }
.pos-total-usd { text-align: right; }
.pos-total-usd input { font-size: 16px; text-align: right; color: var(--pos-muted); }

.pos-btn-invoice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 56px;
    border: 0;
    border-radius: var(--pos-radius-sm);
    background: var(--pos-accent);
    color: var(--pos-ink);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .04em;
    box-shadow: 0 4px 12px rgba(232, 150, 28, .35);
    transition: background .15s;
}

.pos-btn-invoice:hover { background: var(--pos-accent-hover); }
.pos-btn-invoice small { font-size: 11px; opacity: .75; font-weight: 600; }

/* ---------- Modales heredados ---------- */
.modal-content { border-radius: var(--pos-radius); border: 0; box-shadow: 0 20px 50px rgba(20, 33, 61, .3); }

/* ---------- Cobro ---------- */
.pos-checkout .modal-dialog { width: 1040px; max-width: calc(100% - 24px); margin: 24px auto; }
.pos-checkout .modal-content { overflow: hidden; background: var(--pos-bg); }

.pos-checkout-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 22px;
    background: var(--pos-topbar);
    color: #fff;
}

.pos-checkout-head .pos-label { color: var(--pos-topbar-muted); }
.pos-checkout-total { font-size: 18px; font-weight: 700; color: var(--pos-topbar-muted); line-height: 1.1; }
.pos-checkout-total strong { font-size: 38px; font-weight: 800; color: var(--pos-accent); font-variant-numeric: tabular-nums; }
.pos-checkout-total-usd { color: var(--pos-topbar-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.pos-checkout-head-info { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }
.pos-checkout-service-type {
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--pos-topbar-2);
    font-weight: 700;
    text-transform: uppercase;
}
.pos-checkout-literal { max-width: 360px; color: #c7cfdd; font-size: 13px; text-transform: uppercase; }

.pos-checkout-body {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    gap: 14px;
    padding: 16px;
}

.pos-checkout-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: var(--pos-radius);
    background: var(--pos-surface);
    box-shadow: var(--pos-shadow);
}

.pos-checkout-amount {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0 12px;
    border: 2px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    background: var(--pos-surface-2);
    cursor: pointer;
}
.pos-checkout-amount:has(input[type=radio]:checked) { border-color: var(--pos-accent); background: #fff; }
.pos-checkout-amount input[type=radio] { margin: 0; accent-color: var(--pos-accent); }
.pos-checkout-amount span { width: 34px; font-weight: 700; color: var(--pos-muted); }
.pos-checkout-amount input[type=text] {
    flex: 1;
    min-width: 0;
    height: 50px;
    border: 0;
    background: transparent;
    font-size: 24px;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
    outline: none;
}

.pos-checkout-billetes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.pos-checkout-billetes button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    padding: 3px;
    border: 1px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    background: #fff;
    transition: transform .1s, box-shadow .1s;
}
.pos-checkout-billetes button:hover { box-shadow: var(--pos-shadow); border-color: var(--pos-accent); }
.pos-checkout-billetes button:active { transform: scale(.96); }
.pos-checkout-billetes img { max-width: 100%; max-height: 100%; border-radius: 3px; }
.pos-checkout-billetes .is-currency img { height: 44px; border-radius: 50%; }
.pos-checkout-billetes .pos-checkout-exact { background: var(--pos-accent-soft); color: var(--pos-accent-dark); font-weight: 700; }

.pos-checkout-keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pos-checkout-keypad button {
    height: 50px;
    border: 1px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    background: var(--pos-surface-2);
    font-size: 20px;
    font-weight: 700;
}
.pos-checkout-keypad button:hover { background: #fff; border-color: var(--pos-accent); }
.pos-checkout-keypad button:active { background: var(--pos-accent-soft); }
.pos-checkout-keypad .pos-checkout-clear { grid-column: span 3; height: 40px; font-size: 14px; color: var(--pos-danger); }

.pos-checkout-change { container-type: inline-size; margin-top: auto; padding: 12px 14px; border-radius: var(--pos-radius-sm); background: #e3f6ec; }
.pos-checkout-change .pos-label { color: var(--pos-success); }
/* Una fila por moneda: esta columna es angosta y el monto en Bs debe verse completo */
.pos-checkout-change-montos { display: flex; flex-direction: column; gap: 2px; }
.pos-checkout-change-montos label { display: flex; align-items: baseline; gap: 6px; margin: 0; color: var(--pos-muted); font-weight: 600; }
.pos-checkout-change-montos input {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--pos-success);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    outline: none;
}
.pos-checkout-change-montos input { min-width: 0; text-align: right; }
/* "Bs" sube a la fila del título para dejar todo el ancho al número; el tamaño se adapta a la caja */
.pos-checkout-change-montos label:first-child { flex-direction: column; align-items: flex-end; gap: 0; margin-top: -18px; }
.pos-checkout-change-montos label:first-child input { font-size: min(32px, 17.5cqw); line-height: 1.15; }
.pos-checkout-change-montos label:last-child input { font-size: 16px; }
.pos-checkout-change.is-missing { background: #fde8e8; }
.pos-checkout-change.is-missing .pos-label,
.pos-checkout-change.is-missing input { color: var(--pos-danger); }

.pos-checkout-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pos-checkout-option-name {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px;
    border: 2px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    background: var(--pos-surface-2);
    font-weight: 600;
    cursor: pointer;
}
.pos-checkout-option-name:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pos-checkout-option-name input { position: absolute; opacity: 0; pointer-events: none; }
.pos-checkout-option-name .fa { color: var(--pos-muted); }
.pos-checkout-option-name:has(input:checked) { border-color: var(--pos-accent); background: var(--pos-accent-soft); color: var(--pos-accent-dark); }
.pos-checkout-option-name:has(input:checked) .fa { color: var(--pos-accent); }

.pos-checkout-col .form-control { height: 38px; border-color: var(--pos-border); border-radius: var(--pos-radius-sm); box-shadow: none; }
.pos-checkout-field { margin: 0; font-weight: normal; }
.pos-checkout-field .pos-label { margin-bottom: 4px; }
.pos-checkout-field small { text-transform: none; letter-spacing: 0; font-weight: normal; }

.pos-checkout-foot {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 16px 16px;
}
.pos-checkout-volver {
    height: 56px;
    padding: 0 24px;
    border: 1px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    background: #fff;
    font-weight: 700;
    color: var(--pos-muted);
}
.pos-checkout-volver:hover { color: var(--pos-text); }
.pos-checkout-confirmar { width: auto; flex: 0 0 340px; }
.pos-checkout-confirmar[disabled] { opacity: .6; cursor: wait; }

@media (max-width: 900px) {
    .pos-checkout .modal-dialog { margin: 8px auto; }
    .pos-checkout-head { flex-wrap: wrap; }
    .pos-checkout-head-info { align-items: flex-start; text-align: left; }
    .pos-checkout-body { grid-template-columns: 1fr; }
    .pos-checkout-confirmar { flex: 1; }
}

/* ---------- Histórico de ventas ---------- */
.pos-history .modal-dialog { width: auto; height: calc(100vh - 32px); margin: 16px; }
.pos-history .modal-content { display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--pos-bg); }

.pos-hist-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--pos-topbar);
    color: #fff;
    flex-shrink: 0;
}

.pos-hist-title { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.pos-hist-title > .fa { font-size: 22px; color: var(--pos-accent); }
.pos-hist-title h4 { margin: 0; font-size: 18px; font-weight: 700; }
.pos-hist-title small { color: var(--pos-topbar-muted); font-size: 12px; }

.pos-hist-date { width: 190px; }
.pos-hist-date .input-group-addon,
.pos-hist-date .form-control { height: 38px; border-color: var(--pos-topbar-2); }
.pos-hist-date .input-group-addon { background: var(--pos-topbar-2); color: #fff; border-radius: var(--pos-radius-sm) 0 0 var(--pos-radius-sm); }
.pos-hist-date .form-control { border-radius: 0 var(--pos-radius-sm) var(--pos-radius-sm) 0; font-weight: 600; cursor: pointer; }

.pos-hist-actions { display: flex; gap: 8px; }

.pos-hist-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--pos-radius-sm);
    font-weight: 600;
    color: #fff;
}

.pos-hist-btn-closing { background: var(--pos-accent); color: var(--pos-ink); }
.pos-hist-btn-closing:hover { background: var(--pos-accent-hover); }
.pos-hist-btn-volver { background: var(--pos-topbar-2); }
.pos-hist-btn-volver:hover { background: var(--pos-topbar-3); }

.pos-hist-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 16px 0;
    flex-shrink: 0;
}

.pos-hist-stat {
    padding: 10px 14px;
    border-left: 4px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    background: var(--pos-surface);
    box-shadow: var(--pos-shadow);
}

.pos-hist-stat strong { display: block; font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pos-hist-stat.is-ok { border-left-color: var(--pos-success); }
.pos-hist-stat.is-bad { border-left-color: var(--pos-danger); }
.pos-hist-stat.is-total { border-left-color: var(--pos-accent); }
.pos-hist-stat.is-total strong { color: var(--pos-accent-dark); }

.pos-hist-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 12px;
    flex: 1;
    min-height: 0;
    padding: 12px 16px 16px;
}

.pos-hist-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: var(--pos-radius);
    background: var(--pos-surface);
    box-shadow: var(--pos-shadow);
    overflow: hidden;
}

.pos-hist-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--pos-border);
    flex-shrink: 0;
}

.pos-hist-search { position: relative; flex: 0 1 320px; }
.pos-hist-search .fa { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--pos-muted); }
.pos-hist-search input {
    width: 100%;
    height: 34px;
    padding: 0 12px 0 32px;
    border: 1px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    background: var(--pos-surface-2);
    outline: none;
}
.pos-hist-search input:focus { border-color: var(--pos-accent); background: #fff; }

.pos-hist-list .dataTables_wrapper { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pos-hist-list .dataTables_scroll { flex: 1; min-height: 0; }
.pos-hist-list table.dataTable { margin: 0 !important; border-collapse: collapse !important; }

.pos-history table.table > thead > tr > th {
    padding: 9px 12px;
    border-bottom: 1px solid var(--pos-border);
    background: var(--pos-surface-2);
    color: var(--pos-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.pos-history table.table > tbody > tr > td {
    padding: 9px 12px;
    border-top: 1px solid #f1ece3;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

#tableHistory > tbody > tr { cursor: pointer; background: transparent; }
#tableHistory > tbody > tr:hover { background: var(--pos-surface-2); }
#tableHistory > tbody > tr.is-selected,
#tableHistory > tbody > tr.is-selected:hover { background: var(--pos-accent-soft); box-shadow: inset 3px 0 0 var(--pos-accent); }
#tableHistory > tbody > tr.is-voided > td { color: var(--pos-muted); }
#tableHistory > tbody > tr.is-voided > td:nth-child(7) { text-decoration: line-through; }
#tableHistory > tbody > tr > td.dataTables_empty { padding: 48px 12px; color: var(--pos-muted); text-align: center; cursor: default; }

.pos-hist-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.pos-hist-badge.is-ok { background: #e3f6ec; color: var(--pos-success); }
.pos-hist-badge.is-bad { background: #fde8e8; color: var(--pos-danger); }

.pos-hist-action {
    height: 28px;
    padding: 0 12px;
    border: 1px solid currentColor;
    border-radius: 6px;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
}
.pos-hist-action.is-void { color: var(--pos-danger); }
.pos-hist-action.is-void:hover { background: var(--pos-danger); border-color: var(--pos-danger); color: #fff; }
.pos-hist-action.is-activate { color: var(--pos-success); }
.pos-hist-action.is-activate:hover { background: var(--pos-success); border-color: var(--pos-success); color: #fff; }

.pos-hist-info { padding: 8px 14px; border-top: 1px solid var(--pos-border); flex-shrink: 0; }
.pos-hist-info .dataTables_info { padding: 0; color: var(--pos-muted); font-size: 12px; }

.pos-hist-time { color: var(--pos-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.pos-hist-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 12px 14px;
    flex-shrink: 0;
}
.pos-hist-fields label { margin: 0; font-weight: normal; }
.pos-hist-fields .pos-label { margin-bottom: 4px; }
.pos-hist-fields .form-control { height: 34px; border-color: var(--pos-border); border-radius: 6px; box-shadow: none; }
.pos-hist-fields .form-control[readonly] { background: var(--pos-surface-2); cursor: default; }

.pos-hist-items { flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--pos-border); }
.pos-hist-items .table { margin: 0; }
.pos-hist-items thead th { position: sticky; top: 0; z-index: 1; }
.pos-hist-items td:first-child { width: 60px; font-weight: 600; }
.pos-hist-items td:last-child { width: 90px; }
.pos-hist-items tr.pos-hist-empty > td { padding: 40px 14px !important; color: var(--pos-muted); text-align: center; border: 0 !important; }

.pos-hist-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--pos-topbar);
    color: #fff;
    flex-shrink: 0;
}
.pos-hist-total span { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--pos-topbar-muted); }
.pos-hist-total strong { font-size: 24px; color: var(--pos-accent); font-variant-numeric: tabular-nums; }

@media (max-width: 1280px) {
    .pos-hist-body { grid-template-columns: minmax(0, 1fr) 340px; }
    .pos-hist-title small { display: none; }
}

@media (max-width: 900px) {
    .pos-history .modal-dialog { height: auto; margin: 8px; }
    .pos-history .modal-content { height: auto; }
    .pos-hist-head { flex-wrap: wrap; }
    .pos-hist-title { flex-basis: 100%; }
    .pos-hist-date { flex: 1; width: auto; }
    .pos-hist-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-hist-body { grid-template-columns: 1fr; }
    .pos-hist-list { height: 60vh; }
    .pos-hist-detail { height: 70vh; }
}

/* ---------- Notificaciones (toastr / alertify) fuera de la zona del botón COBRAR ---------- */
#toast-container.toast-bottom-center {
    left: 24px;
    right: auto;
    bottom: 24px;
    width: auto;
}

#toast-container.toast-bottom-center > div { width: 260px; margin: 6px 0 0; border-radius: var(--pos-radius-sm); }

.alertify-notifier.ajs-bottom { bottom: auto !important; top: calc(var(--pos-topbar-height) + 12px); }
.alertify-notifier.ajs-right { right: calc(var(--pos-ticket-width) + 28px) !important; }
.alertify-notifier .ajs-message { border-radius: var(--pos-radius-sm); }

/* ---------- Pantallas medianas y tablets ---------- */
@media (max-width: 1280px) {
    :root { --pos-ticket-width: 360px; }
    .pos-brand-logo { display: none !important; }
    .pos-brand-icon { display: block !important; }
    .pos-clock #h3CurrentDate { display: none; }
    .pos-tabs > li > a { padding: 10px; }
}

@media (max-width: 1100px) {
    :root { --pos-ticket-width: 330px; }
    .pos-search { max-width: 260px; }
    .pos-chip, #labelUser, #labelExchangeRate, #labelShift { padding: 0 9px; }
    .pos-products { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .pos-keypad button { height: 32px; }
    #tableDetail th:nth-child(3),
    #tableDetail > tbody > tr > td:nth-child(3) { display: none; }
}

@media (max-width: 900px) {
    .alertify-notifier.ajs-right { right: 12px !important; }
    body.pos-body { overflow: auto; }
    .pos-app { height: auto; min-height: 100vh; }
    .pos-topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; }
    .pos-search { order: 3; flex-basis: 100%; max-width: none; }
    .pos-chips { flex-wrap: wrap; }
    .pos-main { grid-template-columns: 1fr; }
    .pos-workspace { height: 55vh; }
    .pos-ticket { min-height: 75vh; }
    .pos-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .pos-tabs > li > a { white-space: nowrap; }
    .pos-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-span-4 { grid-column: span 2; }
}

/* ---------- Tipografía de títulos y cifras ---------- */
.pos-body h1, .pos-body h2, .pos-body h3, .pos-body h4, .pos-body h5,
.modal-title,
.ajs-header,
#totalBs,
.pos-order-number,
.pos-clock #h1_clock,
.pos-checkout-total strong,
.pos-hist-stat strong,
.pos-hist-total strong {
    font-family: var(--pos-font-display);
}

.pos-body h1, .pos-body h2, .pos-body h3, .pos-body h4, .pos-body h5,
.modal-title,
.pos-hist-stat strong { color: var(--pos-ink); }

.pos-hist-title h4 { color: #fff; }

/* ---------- Componentes de Bootstrap 3 con los colores de la marca ---------- */
a { color: var(--pos-accent-dark); }
a:hover, a:focus { color: var(--pos-ink); }

.btn-link { color: var(--pos-accent-dark); }
.btn-link:hover, .btn-link:focus { color: var(--pos-ink); }

input[type=checkbox], input[type=radio] { accent-color: var(--pos-accent); }

.form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { background-color: var(--pos-surface-2); }

/* El contorno queda para el teclado; con mouse o pantalla táctil basta el subrayado */
.pos-tabs > li > a:focus:not(:focus-visible) { outline: 0; }

.form-control:focus {
    border-color: var(--pos-accent);
    box-shadow: 0 0 0 3px rgba(232, 150, 28, .2);
}

.btn { font-weight: 600; }

.btn-primary { background-color: var(--pos-ink); border-color: var(--pos-ink); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active,
.btn-primary[disabled], .btn-primary[disabled]:hover {
    background-color: var(--pos-topbar-2);
    border-color: var(--pos-topbar-2);
    color: #fff;
}

.btn-warning { background-color: var(--pos-accent); border-color: var(--pos-accent); color: var(--pos-ink); }
.btn-warning:hover, .btn-warning:focus, .btn-warning:active, .btn-warning.active,
.btn-warning[disabled], .btn-warning[disabled]:hover {
    background-color: var(--pos-accent-hover);
    border-color: var(--pos-accent-hover);
    color: var(--pos-ink);
}

.btn-info { background-color: var(--pos-text); border-color: var(--pos-text); color: #fff; }
.btn-info:hover, .btn-info:focus, .btn-info:active, .btn-info.active,
.btn-info[disabled], .btn-info[disabled]:hover {
    background-color: var(--pos-ink);
    border-color: var(--pos-ink);
    color: #fff;
}

.btn-success { background-color: var(--pos-success); border-color: var(--pos-success); }
.btn-danger { background-color: var(--pos-danger); border-color: var(--pos-danger); }

.pagination > .active > a,
.pagination > .active > a:hover,
.pagination > .active > span {
    background-color: var(--pos-ink);
    border-color: var(--pos-ink);
}

.pagination > li > a { color: var(--pos-ink); }

.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td.active.active {
    background: var(--pos-accent) !important;
    color: var(--pos-ink) !important;
    text-shadow: none;
}
/* ---------- Ingreso ---------- */
body.pos-body-login .modal-backdrop.in { opacity: .15; }

.pos-login .modal-dialog { width: 400px; max-width: calc(100% - 24px); margin: 8vh auto; }
.pos-login .modal-content { overflow: hidden; }

/* El fondo debe ser el mismo crema del logo (--pos-bg) */
.pos-login-head {
    padding: 28px 28px 20px;
    background: var(--pos-bg);
    border-bottom: 1px solid var(--pos-border);
    text-align: center;
}

.pos-login-head img { width: 280px; max-width: 100%; height: auto; }
.pos-login-head h1 { margin: 0 0 14px; line-height: 0; }
.pos-login-head p { margin: 0; color: var(--pos-muted); font-size: 13px; }

.pos-login-body { padding: 24px 28px 28px; }
.pos-login-body .pos-label { margin-bottom: 6px; }

.pos-login-field { position: relative; margin-bottom: 16px; }
.pos-login-field > .fa { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--pos-muted); }

.pos-login-field input {
    width: 100%;
    height: 46px;
    padding: 0 14px 0 40px;
    border: 1px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    background: var(--pos-surface-2);
    font-size: 15px;
    outline: none;
}

.pos-login-field input:focus { border-color: var(--pos-accent); background: #fff; }
.pos-login-field input[readonly] { color: var(--pos-muted); }

.pos-login-tc {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--pos-accent-dark);
    font-size: 12px;
    font-weight: 600;
}

.pos-login-tc:hover { background: var(--pos-accent-soft); }

.pos-login .pos-btn-invoice { height: 50px; font-size: 17px; margin-top: 6px; }
