/* Extracted from pos.html */

/* =====================================================================
       BASE RESET & LAYOUT SHELL
       ===================================================================== */

    *, *::before, *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html, body {
      height: 100%;
      overflow: hidden;
    }

    body {
      font-family: var(--font-body);
      font-size: var(--text-body);
      font-weight: var(--font-weight-regular);
      background-color: var(--color-bg-base);
      color: var(--color-text-primary);
      display: flex;
      flex-direction: column;
    }

    /* Dot-grid for modern theme */
    [data-theme="modern"] body,
    [data-theme="modern"].pos-shell {
      background-color: var(--color-bg-base);
      background-image: radial-gradient(
        circle,
        var(--dot-grid-color) 1px,
        transparent 1px
      );
      background-size: var(--dot-grid-size) var(--dot-grid-size);
    }

    /* =====================================================================
       STATUS BAR (very top)
       ===================================================================== */

    .status-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 36px;
      padding: 0 var(--space-5);
      background-color: var(--color-surface-3);
      border-bottom: 1px solid var(--color-border);
      font-size: var(--text-caption);
      font-weight: var(--font-weight-semibold);
      letter-spacing: var(--tracking-wider);
      text-transform: uppercase;
      color: var(--color-text-muted);
      flex-shrink: 0;
      z-index: var(--z-sticky);
    }

    [data-theme="industrial"] .status-bar {
      background-color: #111111;
      border-bottom-color: var(--color-primary-muted);
    }

    .status-bar__store {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      color: var(--color-text-accent);
      font-family: var(--font-heading);
      font-weight: var(--heading-weight-primary);
      font-size: 0.8rem;
      letter-spacing: var(--tracking-widest);
    }

    .status-bar__store-dot {
      width: 7px;
      height: 7px;
      background-color: var(--color-success);
      border-radius: var(--radius-full);
      box-shadow: 0 0 6px var(--color-success);
      animation: pulse-dot 2.5s ease-in-out infinite;
    }

    @keyframes pulse-dot {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.4; }
    }

    .status-bar__center {
      display: flex;
      align-items: center;
      gap: var(--space-6);
    }

    .status-bar__right {
      display: flex;
      align-items: center;
      gap: var(--space-4);
    }

    .status-bar__user {
      display: flex;
      align-items: center;
      gap: var(--space-2);
      color: var(--color-text-secondary);
    }

    .status-bar__user-avatar {
      width: 20px;
      height: 20px;
      border-radius: var(--radius-full);
      background-color: var(--color-primary);
      color: var(--color-text-inverse);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.6rem;
      font-weight: var(--font-weight-bold);
    }

    /* =====================================================================
       MAIN CONTENT -- split layout
       ===================================================================== */

    .pos-shell {
      display: flex;
      flex-direction: column;
      flex: 1;
      overflow: hidden;
    }

    .pos-main {
      display: flex;
      flex: 1;
      overflow: hidden;
      gap: 0;
    }

    /* =====================================================================
       LEFT PANEL -- Product Browser (60%)
       ===================================================================== */

    .panel-products {
      display: flex;
      flex-direction: column;
      width: 60%;
      min-width: 0;
      border-right: 1px solid var(--color-border);
      background-color: var(--color-bg-base);
      overflow: hidden;
    }

    [data-theme="modern"] .panel-products {
      background-color: transparent;
    }

    /* Search bar row */
    .search-row {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      padding: var(--space-4) var(--space-5);
      background-color: var(--color-surface-1);
      border-bottom: 1px solid var(--color-border);
      flex-shrink: 0;
    }

    .search-wrap {
      position: relative;
      flex: 1;
    }

    .search-icon {
      position: absolute;
      left: var(--space-4);
      top: 50%;
      transform: translateY(-50%);
      color: var(--color-text-muted);
      pointer-events: none;
    }

    .search-input {
      width: 100%;
      height: 48px;
      padding: 0 var(--space-4) 0 44px;
      background-color: var(--color-bg-overlay);
      border: 1.5px solid var(--color-border);
      border-radius: var(--radius-md);
      font-family: var(--font-body);
      font-size: var(--text-body-lg);
      font-weight: var(--font-weight-regular);
      color: var(--color-text-primary);
      outline: none;
      transition: var(--transition-fast);
    }

    .search-input::placeholder { color: var(--color-text-muted); }

    .search-input:focus {
      border-color: var(--color-border-focus);
      box-shadow: var(--shadow-focus);
      background-color: var(--color-bg-overlay);
    }

    [data-theme="modern"] .search-input {
      border-radius: var(--radius-lg);
      background-color: #fff;
    }

    .btn-scan {
      width: 48px; height: 48px;
      display: flex; align-items: center; justify-content: center;
      background-color: var(--btn-secondary-bg);
      border: 1.5px solid var(--btn-secondary-border);
      border-radius: var(--radius-md);
      color: var(--color-primary);
      cursor: pointer;
      transition: var(--transition-fast);
      flex-shrink: 0;
    }

    .btn-scan:hover {
      background-color: var(--btn-secondary-bg-hover);
      box-shadow: var(--shadow-accent);
    }

    /* Quick category buttons */
    .categories-row {
      display: flex; align-items: center; gap: var(--space-2);
      padding: var(--space-3) var(--space-5);
      border-bottom: 1px solid var(--color-border);
      overflow-x: auto; flex-shrink: 0; scrollbar-width: none;
    }
    .categories-row::-webkit-scrollbar { display: none; }

    .category-label {
      font-size: var(--text-caption);
      font-weight: var(--font-weight-semibold);
      letter-spacing: var(--tracking-wider);
      text-transform: uppercase;
      color: var(--color-text-muted);
      white-space: nowrap;
      margin-right: var(--space-1);
    }

    .cat-btn {
      display: flex; align-items: center; gap: var(--space-2);
      padding: var(--space-2) var(--space-4);
      border: 1.5px solid var(--color-border);
      border-radius: var(--radius-sm);
      background-color: transparent;
      font-family: var(--font-body);
      font-size: var(--text-body-sm);
      font-weight: var(--font-weight-semibold);
      color: var(--color-text-secondary);
      cursor: pointer; white-space: nowrap;
      transition: var(--transition-fast);
    }
    .cat-btn:hover {
      border-color: var(--color-primary); color: var(--color-primary);
      background-color: var(--color-primary-muted);
    }
    .cat-btn.active {
      border-color: var(--color-primary); background-color: var(--color-primary);
      color: var(--color-text-inverse);
    }
    [data-theme="industrial"] .cat-btn.active { color: #000; }
    [data-theme="modern"] .cat-btn { border-radius: var(--radius-full); }

    /* Product grid */
    .product-grid-wrap {
      flex: 1; overflow-y: auto;
      padding: var(--space-4) var(--space-5);
      scrollbar-width: thin;
      scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    }
    .product-grid-wrap::-webkit-scrollbar { width: 6px; }
    .product-grid-wrap::-webkit-scrollbar-track { background: var(--scrollbar-track); }
    .product-grid-wrap::-webkit-scrollbar-thumb { background-color: var(--scrollbar-thumb); border-radius: var(--radius-full); }

    .product-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3);
    }
    @media (max-width: 1100px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }

    /* Product card */
    .product-card {
      position: relative; display: flex; flex-direction: column;
      padding: var(--space-4);
      background-color: var(--color-surface-1);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-md);
      cursor: pointer; transition: var(--transition-fast); overflow: hidden;
    }
    .product-card:hover {
      border-color: var(--color-primary); box-shadow: var(--shadow-md); transform: translateY(-1px);
    }
    .product-card:hover .product-card__add { opacity: 1; transform: scale(1); }

    [data-theme="industrial"] .product-card { background-color: var(--color-surface-1); border-color: #2a2a2a; }
    [data-theme="industrial"] .product-card:hover { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-md); }
    [data-theme="modern"] .product-card { border-radius: var(--radius-lg); background-color: #fff; box-shadow: var(--shadow-sm); }
    [data-theme="modern"] .product-card:hover { box-shadow: var(--shadow-lg); }

    .product-card__category {
      font-size: var(--text-caption); font-weight: var(--font-weight-semibold);
      letter-spacing: var(--tracking-widest); text-transform: uppercase;
      color: var(--color-primary); margin-bottom: var(--space-1);
    }
    .product-card__name {
      font-family: var(--font-heading); font-size: var(--text-body);
      font-weight: var(--heading-weight-primary); line-height: var(--leading-h5);
      color: var(--color-text-primary); margin-bottom: var(--space-1);
    }
    .product-card__oem {
      font-family: var(--font-mono); font-size: var(--text-caption);
      color: var(--color-text-muted); margin-bottom: var(--space-3);
    }
    .product-card__footer {
      display: flex; align-items: flex-end; justify-content: space-between;
      margin-top: auto; gap: var(--space-2);
    }
    .product-card__price {
      font-family: var(--font-mono); font-size: 1.1rem;
      font-weight: var(--font-weight-bold); color: var(--color-text-primary); line-height: 1;
    }
    .product-card__stock { font-size: var(--text-caption); color: var(--color-text-muted); margin-top: 2px; }
    .product-card__stock.low { color: var(--color-warning); }
    .product-card__stock.out { color: var(--color-error); }

    .product-card__add {
      width: 32px; height: 32px; border: none; border-radius: var(--radius-sm);
      background-color: var(--color-primary); color: var(--color-text-inverse);
      font-size: 1.2rem; font-weight: var(--font-weight-bold);
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; opacity: 0.75; transform: scale(0.95);
      transition: var(--transition-fast); flex-shrink: 0;
    }
    .product-card__add:hover { background-color: var(--color-primary-hover); opacity: 1; transform: scale(1.08) !important; }
    [data-theme="industrial"] .product-card__add { color: #000; }
    [data-theme="modern"] .product-card__add { border-radius: var(--radius-md); }

    @keyframes card-flash {
      0%   { background-color: var(--color-primary-muted); }
      100% { background-color: transparent; }
    }
    .product-card.added { animation: card-flash 0.4s ease forwards; }

    /* =====================================================================
       RIGHT PANEL -- Cart / Ticket (40%)
       ===================================================================== */

    .panel-cart {
      display: flex; flex-direction: column; width: 40%; min-width: 320px;
      background-color: var(--color-surface-1); overflow: hidden; position: relative;
    }
    [data-theme="modern"] .panel-cart { background-color: #fff; box-shadow: -4px 0 20px rgba(26,26,46,0.06); }
    [data-theme="industrial"] .panel-cart { background-color: #141414; border-left: 1px solid #2a2a2a; }

    /* Cart header */
    .cart-header {
      padding: var(--space-4) var(--space-5);
      border-bottom: 1px solid var(--color-border);
      flex-shrink: 0; background-color: var(--color-surface-2);
    }
    [data-theme="industrial"] .cart-header { background-color: #1a1a1a; border-bottom-color: var(--color-primary-muted); }

    .cart-header__top {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: var(--space-3);
    }

    .cart-header__sale-id {
      font-family: var(--font-heading); font-size: var(--text-h5);
      font-weight: var(--heading-weight-primary); color: var(--color-text-primary);
      display: flex; align-items: center; gap: var(--space-2);
    }
    .cart-header__sale-id::before {
      content: ''; display: block; width: 4px; height: 20px;
      background-color: var(--color-primary); border-radius: 2px; flex-shrink: 0;
    }

    .cart-header__status {
      font-size: var(--text-caption); font-weight: var(--font-weight-semibold);
      letter-spacing: var(--tracking-wider); text-transform: uppercase;
      color: var(--color-success); background-color: rgba(34,197,94,0.12);
      padding: 3px var(--space-3); border-radius: var(--radius-full);
      border: 1px solid rgba(34,197,94,0.25);
    }

    /* Customer row */
    .customer-row {
      display: flex; align-items: center; gap: var(--space-3);
    }
    .customer-icon {
      width: 34px; height: 34px; border-radius: var(--radius-full);
      background-color: var(--color-primary-muted); border: 1.5px solid var(--color-primary);
      display: flex; align-items: center; justify-content: center;
      color: var(--color-primary); flex-shrink: 0;
    }
    .customer-info { flex: 1; min-width: 0; }
    .customer-info__name {
      font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold);
      color: var(--color-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .customer-info__label { font-size: var(--text-caption); color: var(--color-text-muted); }
    .btn-change-customer {
      padding: var(--space-1) var(--space-3); border: 1px solid var(--color-border);
      border-radius: var(--radius-full); background: transparent;
      font-family: var(--font-body); font-size: var(--text-caption);
      font-weight: var(--font-weight-semibold); color: var(--color-text-muted);
      cursor: pointer; transition: var(--transition-fast); white-space: nowrap;
    }
    .btn-change-customer:hover { border-color: var(--color-primary); color: var(--color-primary); }

    /* Banner Cliente */
    .banner-cliente {
      padding: var(--space-3) var(--space-4);
      border-bottom: 2px solid var(--color-primary);
      background: var(--color-primary-muted);
      display: none;
    }
    .banner-cliente.visible { display: block; }
    .banner-top { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
    .banner-avatar {
      width: 36px; height: 36px; border-radius: var(--radius-full);
      background: var(--color-primary); display: flex; align-items: center; justify-content: center;
      font-family: var(--font-heading); font-size: var(--text-body-sm);
      font-weight: var(--font-weight-bold); color: var(--color-text-inverse); flex-shrink: 0;
    }
    .banner-name-block { flex: 1; min-width: 0; }
    .banner-name {
      font-family: var(--font-heading); font-size: var(--text-body);
      font-weight: var(--heading-weight-primary); color: var(--color-text-primary);
      line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .banner-rfc {
      font-family: var(--font-mono); font-size: var(--text-caption);
      color: var(--color-text-muted); letter-spacing: var(--tracking-wide);
    }
    .banner-close {
      width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
      background: transparent; border: 1px solid var(--color-border);
      border-radius: var(--radius-md); cursor: pointer;
      color: var(--color-text-muted); font-size: 14px; transition: var(--transition-fast); flex-shrink: 0;
    }
    .banner-close:hover { background: var(--color-surface-2); color: var(--color-text-primary); }
    .banner-info {
      display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-2);
    }
    .banner-info-item {
      padding: var(--space-2) var(--space-3); background: var(--color-bg-elevated);
      border: 1px solid var(--color-border); border-radius: var(--radius-md);
    }
    .banner-info-label {
      font-size: 10px; color: var(--color-text-muted); text-transform: uppercase;
      letter-spacing: var(--tracking-widest); font-weight: var(--font-weight-semibold);
    }
    .banner-info-value {
      font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold);
      color: var(--color-text-primary); margin-top: 1px;
    }
    .banner-info-value.credit-ok { color: var(--color-success); }
    .banner-info-value.credit-low { color: var(--color-warning-dark); }
    .banner-info-value.credit-none { color: var(--color-error); }

    /* Cart items list */
    .cart-items {
      flex: 1; overflow-y: auto; padding: var(--space-3) var(--space-4);
      scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    }
    .cart-items::-webkit-scrollbar { width: 4px; }
    .cart-items::-webkit-scrollbar-track { background: transparent; }
    .cart-items::-webkit-scrollbar-thumb { background-color: var(--scrollbar-thumb); border-radius: var(--radius-full); }

    .cart-empty {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      height: 120px; color: var(--color-text-muted); font-size: var(--text-body-sm); gap: var(--space-2); opacity: 0.6;
    }

    .cart-item {
      display: flex; align-items: center; gap: var(--space-3);
      padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--color-border);
      transition: var(--transition-fast);
      animation: item-slide-in 0.2s ease;
    }
    @keyframes item-slide-in {
      from { opacity: 0; transform: translateX(10px); }
      to   { opacity: 1; transform: translateX(0); }
    }
    .cart-item:hover { background-color: var(--color-primary-muted); border-radius: var(--radius-sm); }
    .cart-item:last-child { border-bottom: none; }

    .cart-item__qty-ctrl { display: flex; align-items: center; gap: var(--space-1); flex-shrink: 0; }
    .qty-btn {
      width: 26px; height: 26px; border: 1px solid var(--color-border-strong);
      border-radius: var(--radius-sm); background-color: var(--color-surface-3);
      color: var(--color-text-primary); font-size: 0.9rem; font-weight: var(--font-weight-bold);
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: var(--transition-fast); line-height: 1;
    }
    .qty-btn:hover { border-color: var(--color-primary); background-color: var(--color-primary); color: var(--color-text-inverse); }
    [data-theme="industrial"] .qty-btn:hover { color: #000; }
    .qty-display {
      font-family: var(--font-mono); font-size: var(--text-body-sm);
      font-weight: var(--font-weight-bold); color: var(--color-text-primary); min-width: 24px; text-align: center;
    }

    .cart-item__info { flex: 1; min-width: 0; }
    .cart-item__name {
      font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold);
      color: var(--color-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .cart-item__unit { font-family: var(--font-mono); font-size: var(--text-caption); color: var(--color-text-muted); }
    .cart-item__total {
      font-family: var(--font-mono); font-size: var(--text-body-sm);
      font-weight: var(--font-weight-bold); color: var(--color-text-primary); text-align: right; min-width: 72px;
    }
    .cart-item__remove {
      width: 24px; height: 24px; border: none; border-radius: var(--radius-sm);
      background: transparent; color: var(--color-text-muted); font-size: 1rem;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: var(--transition-fast); flex-shrink: 0; line-height: 1;
    }
    .cart-item__remove:hover { background-color: rgba(239,68,68,0.15); color: var(--color-error); }

    /* Columnas Costo/Margen (hidden by default, visible with permission) */
    .cart-item__cost, .cart-item__margin {
      display: none; font-family: var(--font-mono); font-size: var(--text-caption);
      text-align: right; min-width: 56px; flex-shrink: 0;
    }
    .cart-item__cost { color: var(--color-text-muted); }
    .cart-item__margin { font-weight: var(--font-weight-bold); }
    .cart-item__margin.margin-high { color: var(--color-success); }
    .cart-item__margin.margin-mid  { color: var(--color-warning); }
    .cart-item__margin.margin-low  { color: var(--color-error); }

    body.show-cost-columns .cart-item__cost,
    body.show-cost-columns .cart-item__margin { display: block; }

    .margin-summary {
      display: none; padding: var(--space-2) var(--space-5);
      border-top: 1px dashed var(--color-border);
      font-size: var(--text-caption); color: var(--color-text-muted);
    }
    body.show-cost-columns .margin-summary { display: flex; justify-content: space-between; }
    .margin-summary__value { font-family: var(--font-mono); font-weight: var(--font-weight-bold); }

    .cost-toggle {
      display: flex; align-items: center; gap: var(--space-2);
      padding: var(--space-1) var(--space-3); border: 1px solid var(--color-border);
      border-radius: var(--radius-sm); background: transparent;
      color: var(--color-text-muted); font-size: 10px; font-family: var(--font-body);
      letter-spacing: var(--tracking-wide); text-transform: uppercase;
      cursor: pointer; transition: var(--transition-fast);
    }
    .cost-toggle:hover { border-color: var(--color-primary); color: var(--color-text-accent); }
    .cost-toggle.active { background: var(--color-primary-muted); border-color: var(--color-primary); color: var(--color-text-accent); }

    /* Cart footer (totals + payment) */
    .cart-footer {
      flex-shrink: 0; border-top: 1px solid var(--color-border);
      background-color: var(--color-surface-2);
    }
    [data-theme="industrial"] .cart-footer { background-color: #1a1a1a; border-top-color: var(--color-primary-muted); }

    .totals-block { padding: var(--space-3) var(--space-5) var(--space-2); }
    .totals-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-1) 0; }
    .totals-row__label { font-size: var(--text-body-sm); color: var(--color-text-muted); }
    .totals-row__value { font-family: var(--font-mono); font-size: var(--text-body-sm); color: var(--color-text-secondary); }

    .totals-row--total { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-border); }
    .totals-row--total .totals-row__label {
      font-family: var(--font-heading); font-size: var(--text-body-lg);
      font-weight: var(--heading-weight-primary); color: var(--color-text-primary);
      letter-spacing: var(--tracking-wide); text-transform: uppercase;
    }
    .totals-row--total .totals-row__value {
      font-family: var(--font-mono); font-size: 1.5rem;
      font-weight: var(--font-weight-bold); color: var(--color-primary);
    }

    /* COBRAR Button */
    .btn-cobrar {
      display: flex; align-items: center; justify-content: center; gap: var(--space-3);
      width: calc(100% - var(--space-10)); margin: var(--space-3) var(--space-5);
      height: 56px; background-color: var(--btn-primary-bg); border: none;
      border-radius: var(--radius-md);
      font-family: var(--font-heading); font-size: 1.2rem;
      font-weight: var(--heading-weight-primary);
      letter-spacing: var(--tracking-widest); text-transform: uppercase;
      color: var(--btn-primary-text); cursor: pointer;
      transition: var(--transition-fast); box-shadow: var(--shadow-md);
    }
    .btn-cobrar:hover { background-color: var(--btn-primary-bg-hover); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
    .btn-cobrar:active { background-color: var(--btn-primary-bg-active); transform: translateY(0); }
    .btn-cobrar:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
    [data-theme="industrial"] .btn-cobrar { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%); }
    [data-theme="modern"] .btn-cobrar { border-radius: var(--radius-lg); }

    /* Secondary actions row */
    .secondary-actions {
      display: flex; gap: var(--space-2); padding: 0 var(--space-5) var(--space-4);
    }
    .btn-secondary-action {
      flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-1);
      height: 34px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
      background: transparent; font-family: var(--font-body); font-size: var(--text-caption);
      font-weight: var(--font-weight-semibold); letter-spacing: var(--tracking-wide);
      text-transform: uppercase; color: var(--color-text-muted); cursor: pointer;
      transition: var(--transition-fast);
    }
    .btn-secondary-action:hover { border-color: var(--color-border-strong); color: var(--color-text-secondary); background-color: var(--color-surface-3); }
    .btn-secondary-action.danger:hover { border-color: var(--color-error); color: var(--color-error); background-color: rgba(239,68,68,0.08); }
    [data-theme="modern"] .btn-secondary-action { border-radius: var(--radius-md); }

    /* =====================================================================
       F-KEYS FOOTER BAR
       ===================================================================== */
    .fkeys-footer {
      position: fixed; bottom: 0; left: 0; right: 0;
      background: var(--color-surface-2); border-top: 2px solid var(--color-primary);
      padding: var(--space-2) var(--space-4);
      display: flex; align-items: center; justify-content: center; gap: var(--space-1);
      z-index: var(--z-sticky); box-shadow: var(--shadow-lg);
    }
    .fkey {
      display: flex; align-items: center; gap: var(--space-1);
      padding: var(--space-2) var(--space-3); background: transparent;
      border: 1px solid var(--color-border); border-radius: var(--radius-md);
      cursor: pointer; transition: var(--transition-fast); white-space: nowrap; flex-shrink: 0;
    }
    .fkey:hover { background: var(--color-primary-muted); border-color: var(--color-primary); }
    .fkey:active { background: var(--color-primary); transform: scale(0.96); }
    .fkey:active .fkey-label { color: var(--color-text-inverse); }
    .fkey:active .fkey-key { background: rgba(0,0,0,0.2); color: var(--color-text-inverse); border-color: transparent; }
    .fkey-key {
      display: inline-flex; align-items: center; justify-content: center;
      min-width: 28px; height: 22px; padding: 0 var(--space-2);
      background: var(--color-bg-base); border: 1px solid var(--color-border-strong);
      border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 11px;
      font-weight: var(--font-weight-bold); color: var(--color-text-accent); line-height: 1;
    }
    .fkey-label {
      font-size: var(--text-caption); font-weight: var(--font-weight-semibold);
      color: var(--color-text-secondary);
    }
    .fkey-sep { width: 1px; height: 24px; background: var(--color-border); margin: 0 var(--space-1); flex-shrink: 0; }
    .fkey.highlight {
      background: var(--color-primary-muted); border-color: var(--color-primary);
    }
    .fkey.highlight .fkey-key {
      background: var(--color-primary); color: var(--color-text-inverse); border-color: var(--color-primary);
    }
    .fkey.highlight .fkey-label { color: var(--color-text-accent); font-weight: var(--font-weight-bold); }

    /* =====================================================================
       MODAL DE PAGO
       ===================================================================== */
    .modal-overlay {
      position: fixed; inset: 0;
      background: var(--overlay-backdrop);
      display: flex; align-items: center; justify-content: center;
      z-index: var(--z-modal);
      opacity: 0; pointer-events: none;
      transition: var(--transition-normal);
    }
    .modal-overlay.open { opacity: 1; pointer-events: auto; }

    .modal-pago {
      background: var(--color-bg-elevated); border: 1px solid var(--color-border);
      border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
      width: 560px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
      transform: translateY(20px); transition: var(--transition-normal);
    }
    .modal-overlay.open .modal-pago { transform: translateY(0); }

    .modal-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-border);
    }
    .modal-header h3 {
      font-family: var(--font-heading); font-size: var(--text-h4);
      font-weight: var(--heading-weight-primary); color: var(--color-text-primary);
    }
    .modal-close {
      width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
      background: transparent; border: 1px solid var(--color-border);
      border-radius: var(--radius-md); cursor: pointer;
      color: var(--color-text-muted); font-size: 18px; transition: var(--transition-fast);
    }
    .modal-close:hover { background: var(--color-surface-2); color: var(--color-text-primary); }

    .total-banner {
      background: var(--color-primary-muted); border-bottom: 2px solid var(--color-primary);
      padding: var(--space-4) var(--space-6);
      display: flex; align-items: center; justify-content: space-between;
    }
    .total-label {
      font-size: var(--text-body); font-weight: var(--font-weight-semibold);
      color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: var(--tracking-wide);
    }
    .total-amount {
      font-family: var(--font-mono); font-size: var(--text-h3);
      font-weight: var(--font-weight-bold); color: var(--color-text-accent);
    }

    .items-summary {
      padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--color-border);
      font-size: var(--text-body-sm); color: var(--color-text-muted); display: flex; gap: var(--space-4);
    }

    .pago-tabs {
      display: flex; border-bottom: 2px solid var(--color-border); padding: 0 var(--space-6);
    }
    .pago-tab {
      padding: var(--space-3) var(--space-5); font-family: var(--font-body);
      font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold);
      background: transparent; border: none; color: var(--color-text-muted);
      cursor: pointer; border-bottom: 2px solid transparent;
      margin-bottom: -2px; transition: var(--transition-fast);
      display: flex; align-items: center; gap: var(--space-2);
    }
    .pago-tab:hover { color: var(--color-text-primary); }
    .pago-tab.active { color: var(--color-text-accent); border-bottom-color: var(--color-primary); }

    .tab-content { padding: var(--space-6); display: none; }
    .tab-content.active { display: block; }

    .form-group { margin-bottom: var(--space-4); }
    .form-label {
      display: block; font-size: var(--text-caption); font-weight: var(--font-weight-semibold);
      color: var(--color-text-secondary); margin-bottom: var(--space-2);
      text-transform: uppercase; letter-spacing: var(--tracking-wide);
    }
    .form-input {
      width: 100%; padding: var(--space-3) var(--space-4);
      font-family: var(--font-body); font-size: var(--text-body);
      background: var(--color-bg-base); color: var(--color-text-primary);
      border: 1px solid var(--color-border); border-radius: var(--radius-md);
      transition: var(--transition-fast);
    }
    .form-input:focus { outline: none; border-color: var(--color-border-focus); box-shadow: var(--shadow-focus); }
    .form-input-lg {
      font-family: var(--font-mono); font-size: var(--text-h3);
      font-weight: var(--font-weight-bold); text-align: right;
      padding: var(--space-4) var(--space-5);
    }

    .cambio-display {
      background: var(--color-surface-2); border: 1px solid var(--color-border);
      border-radius: var(--radius-md); padding: var(--space-4) var(--space-5);
      display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-4);
    }
    .cambio-label { font-size: var(--text-body-sm); color: var(--color-text-secondary); font-weight: var(--font-weight-semibold); }
    .cambio-amount { font-family: var(--font-mono); font-size: var(--text-h4); font-weight: var(--font-weight-bold); }
    .cambio-amount.positive { color: var(--color-success); }
    .cambio-amount.negative { color: var(--color-error); }

    .quick-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); margin-top: var(--space-3); }
    .quick-btn {
      padding: var(--space-2) var(--space-3); font-family: var(--font-mono); font-size: var(--text-body-sm);
      font-weight: var(--font-weight-semibold); background: var(--color-surface-2);
      color: var(--color-text-primary); border: 1px solid var(--color-border);
      border-radius: var(--radius-md); cursor: pointer; transition: var(--transition-fast); text-align: center;
    }
    .quick-btn:hover { background: var(--color-primary-muted); border-color: var(--color-primary); }

    .split-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-3); align-items: end; margin-bottom: var(--space-3); }
    .split-method {
      padding: var(--space-2) var(--space-3); font-size: var(--text-body-sm);
      font-weight: var(--font-weight-semibold); background: var(--color-surface-2);
      color: var(--color-text-secondary); border-radius: var(--radius-md);
      text-align: center; border: 1px solid var(--color-border);
    }
    .split-remaining {
      background: var(--color-surface-2); border-radius: var(--radius-md);
      padding: var(--space-3) var(--space-4);
      display: flex; align-items: center; justify-content: space-between;
      font-size: var(--text-body-sm); margin-top: var(--space-3);
    }
    .split-remaining .amount { font-family: var(--font-mono); font-weight: var(--font-weight-bold); color: var(--color-text-accent); }

    .cfdi-check {
      display: flex; align-items: center; gap: var(--space-3);
      padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-border);
      background: var(--color-surface-1);
    }
    .cfdi-check input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--color-primary); cursor: pointer; }
    .cfdi-check label { font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold); color: var(--color-text-secondary); cursor: pointer; }
    .cfdi-check .cfdi-hint { font-size: var(--text-caption); color: var(--color-text-muted); margin-left: auto; }

    .modal-footer {
      padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-border);
      display: flex; gap: var(--space-3); justify-content: flex-end;
    }

    .btn {
      display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
      padding: var(--space-3) var(--space-6); font-family: var(--font-body); font-size: var(--text-body);
      font-weight: var(--font-weight-semibold); line-height: 1;
      border: 2px solid transparent; border-radius: var(--radius-md);
      cursor: pointer; transition: var(--transition-fast); white-space: nowrap;
    }
    .btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
    .btn:active { transform: scale(0.97); }
    .btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); }
    .btn-primary:hover { background: var(--btn-primary-bg-hover); }
    .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
    .btn-ghost { background: transparent; color: var(--color-text-muted); border-color: var(--color-border); }
    .btn-ghost:hover { background: var(--color-surface-2); }
    .btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-body-lg); }

    .ref-field { display: flex; gap: var(--space-3); align-items: end; }
    .ref-field .form-group { flex: 1; }
    .form-hint { font-size: var(--text-caption); color: var(--color-text-muted); margin-top: var(--space-1); }
    .status-indicator {
      display: flex; align-items: center; gap: var(--space-2);
      padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
      font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold);
    }
    .status-indicator.pending { background: var(--color-warning-light); color: var(--color-warning-dark); }
    .status-indicator.confirmed { background: var(--color-success-light); color: var(--color-success-dark); }

    .terminal-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
    .terminal-card {
      padding: var(--space-4); background: var(--color-surface-2); border: 2px solid var(--color-border);
      border-radius: var(--radius-md); cursor: pointer; transition: var(--transition-fast); text-align: center;
    }
    .terminal-card:hover { border-color: var(--color-primary); }
    .terminal-card.selected { border-color: var(--color-primary); background: var(--color-primary-muted); }
    .terminal-card .terminal-name { font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold); color: var(--color-text-primary); }
    .terminal-card .terminal-type { font-size: var(--text-caption); color: var(--color-text-muted); margin-top: var(--space-1); }

    /* =====================================================================
       MODAL CONFIRMACION
       ===================================================================== */
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @keyframes scaleIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
    @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
    @keyframes scaleOut { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -50%) scale(0.92); } }

    .confirm-overlay {
      position: fixed; inset: 0; background: var(--overlay-backdrop);
      z-index: calc(var(--z-modal) + 1); display: none; animation: fadeIn 0.2s ease-out forwards;
    }
    .confirm-overlay.active { display: block; }
    .confirm-overlay.closing { animation: fadeOut 0.2s ease-in forwards; }

    .confirm-dialog {
      position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
      z-index: calc(var(--z-modal) + 2);
      background: var(--color-bg-elevated); border: 1px solid var(--color-border);
      border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
      width: 90%; max-width: 420px; padding: var(--space-6); text-align: center;
      display: none; animation: scaleIn 0.25s ease-out forwards;
    }
    .confirm-dialog.active { display: block; }
    .confirm-dialog.closing { animation: scaleOut 0.2s ease-in forwards; }

    .modal__icon {
      width: 56px; height: 56px; border-radius: var(--radius-full);
      display: flex; align-items: center; justify-content: center;
      font-size: 26px; margin: 0 auto var(--space-4);
    }
    .modal__icon--warning { background: var(--color-warning-light); }
    .modal__title {
      font-family: var(--font-heading); font-size: var(--text-h4);
      font-weight: var(--heading-weight-primary); color: var(--color-text-primary); margin-bottom: var(--space-2);
    }
    .modal__desc {
      font-size: var(--text-body-sm); color: var(--color-text-muted);
      line-height: 1.6; margin-bottom: var(--space-6); padding: 0 var(--space-2);
    }
    .modal__actions { display: flex; gap: var(--space-3); justify-content: center; }
    .modal__btn {
      flex: 1; max-width: 180px; padding: var(--space-3) var(--space-4);
      font-family: var(--font-body); font-size: var(--text-body-sm); font-weight: 600;
      border-radius: var(--radius-md); cursor: pointer; transition: var(--transition-fast);
      border: 1px solid transparent;
    }
    .modal__btn--secondary {
      background: var(--btn-secondary-bg); color: var(--btn-secondary-text); border-color: var(--btn-secondary-border);
    }
    .modal__btn--secondary:hover { background: var(--btn-secondary-bg-hover); }
    .modal__btn--danger {
      background: var(--btn-danger-bg, var(--color-error)); color: var(--btn-danger-text, #fff);
      border-color: var(--btn-danger-bg, var(--color-error));
    }
    .modal__btn--danger:hover { opacity: 0.9; }

    /* =====================================================================
       TICKET TERMICO (hidden, for print)
       ===================================================================== */
    .ticket-print-area { display: none; }

    .ticket {
      background: #ffffff; color: #000000;
      font-family: 'Courier New', 'Consolas', monospace;
      font-size: 11px; line-height: 1.4; padding: 12px; text-align: left;
      border: 1px dashed #ccc;
      box-sizing: border-box;
    }
    .ticket-80 { width: 80mm; max-width: 80mm; }
    .ticket .store-name { font-size: 14px; font-weight: bold; text-align: center; margin-bottom: 2px; }
    .ticket .store-tagline { font-size: 9px; text-align: center; color: #555; margin-bottom: 4px; }
    .ticket .store-info { font-size: 9px; text-align: center; color: #333; margin-bottom: 6px; line-height: 1.3; }
    .ticket .divider { border: none; border-top: 1px dashed #999; margin: 6px 0; }
    .ticket .divider-double { border: none; border-top: 2px solid #333; margin: 6px 0; }
    .ticket .ticket-row { display: flex; justify-content: space-between; }
    .ticket .folio-line { font-size: 10px; font-weight: bold; display: flex; justify-content: space-between; margin-bottom: 4px; }
    .ticket .total-section { margin-top: 4px; }
    .ticket .total-line { display: flex; justify-content: space-between; font-size: 11px; }
    .ticket .total-line.grand { font-size: 14px; font-weight: bold; margin-top: 2px; padding-top: 2px; border-top: 1px solid #333; }
    .ticket .payment-section { margin-top: 4px; font-size: 10px; }
    .ticket .footer-section { text-align: center; margin-top: 8px; font-size: 9px; color: #555; }
    .ticket .footer-section .thanks { font-size: 11px; font-weight: bold; color: #000; margin-bottom: 2px; }
    .ticket-80 .item-line-wide {
      display: grid; grid-template-columns: auto 1fr auto auto;
      gap: 8px; align-items: baseline; font-size: 10px; margin-bottom: 3px;
    }
    .ticket-80 .item-line-wide .qty { font-weight: bold; min-width: 24px; text-align: right; }
    .ticket-80 .item-line-wide .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: break-word; }
    .ticket-80 .item-line-wide .price { text-align: right; min-width: 55px; }
    .ticket-80 .item-line-wide .subtotal { text-align: right; font-weight: bold; min-width: 60px; }
    .ticket-line { page-break-inside: avoid; }

    @media print {
      @page { margin: 0; size: 80mm auto; }
      body * { display: none !important; }
      .ticket-print-area, .ticket-print-area * { display: block !important; }
      .ticket-print-area { position: fixed; top: 0; left: 0; width: 80mm; }
      .ticket, .ticket-80 { width: 80mm !important; max-width: 80mm !important; border: none !important; box-shadow: none !important; padding: 3mm !important; font-size: 9pt !important; }
      .ticket * { word-break: break-word !important; }
      .ticket .item-line-wide { display: grid !important; grid-template-columns: auto 1fr auto auto !important; gap: 2mm !important; font-size: 8pt !important; }
      .ticket .ticket-row, .ticket .folio-line, .ticket .total-line { display: flex !important; }
      .ticket .name { white-space: normal !important; }
    }

    /* =====================================================================
       TOAST NOTIFICATION
       ===================================================================== */
    .toast-container {
      position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
      z-index: var(--z-toast); display: flex; flex-direction: column;
      gap: var(--space-2); pointer-events: none;
    }
    .toast {
      padding: var(--space-3) var(--space-5);
      background-color: var(--color-surface-3); border: 1px solid var(--color-border);
      border-left: 3px solid var(--color-primary); border-radius: var(--radius-md);
      font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold);
      color: var(--color-text-primary); box-shadow: var(--shadow-lg); white-space: nowrap;
      animation: toast-in 0.25s ease, toast-out 0.3s ease 1.7s forwards;
    }
    @keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-6px); } }

    /* =====================================================================
       RESPONSIVE
       ===================================================================== */
    @media (max-width: 900px) {
      .pos-main { flex-direction: column; }
      .panel-products, .panel-cart { width: 100%; min-width: 0; }
      .panel-products { border-right: none; border-bottom: 1px solid var(--color-border); max-height: 55%; }
      .panel-cart { max-height: 45%; }
      .product-grid { grid-template-columns: repeat(2, 1fr); }
      .status-bar__center { display: none; }
      .fkeys-footer { flex-wrap: wrap; }
    }

    @media (max-width: 768px) {
      .fkeys-footer { flex-wrap: wrap; gap: var(--space-1); padding: var(--space-2); }
      .fkey { padding: var(--space-1) var(--space-2); }
      .fkey-label { font-size: 10px; }
      .fkey-key { min-width: 24px; height: 20px; font-size: 10px; }
      .fkey-sep { display: none; }
    }

    .sr-only {
      position: absolute; width: 1px; height: 1px; padding: 0;
      margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
    }

    /* Add padding at bottom so content isn't hidden by fixed fkeys bar */
    body { padding-bottom: 50px; }
