/* =====================================================
   DIGY POS — Main Stylesheet
   Mismo sistema de diseño que Digy ERP (colores, tipografía,
   botones, tarjetas, modales, tablas, toasts) + componentes
   propios del terminal de venta (táctil, desktop + iPad) y
   del ticket imprimible.
   ===================================================== */

:root {
  --primary:     #4f46e5;
  --primary-h:   #6366f1;
  --primary-l:   #eef2ff;
  --sidebar-bg:  #0f1117;
  --sidebar-w:   240px;
  --sidebar-w-c: 64px;
  --topbar-h:    60px;
  --bg:          #f3f4f8;
  --surface:     #ffffff;
  --border:      #e5e7eb;
  --text:        #111827;
  --text-muted:  #6b7280;
  --text-light:  #9ca3af;
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --info:        #3b82f6;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --transition:  .18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body.digy-pos-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { display: block; max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
input, textarea, select { font-family: inherit; font-size: .875rem; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

/* =====================================================
   BACKOFFICE — SIDEBAR + TOPBAR (idéntico look & feel al ERP)
   ===================================================== */
body.digy-pos-backoffice { display: flex; min-height: 100vh; overflow: hidden; }

.digy-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: width var(--transition);
  overflow: hidden;
}
.digy-sidebar.collapsed { width: var(--sidebar-w-c); }
.digy-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.07); min-height: 64px;
}
.digy-logo { height: 32px; object-fit: contain; }
.digy-logo-text {
  font-size: .95rem; font-weight: 700; color: #fff; letter-spacing: -.01em; white-space: nowrap; overflow: hidden;
  background: linear-gradient(135deg, var(--primary-h), #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.digy-sidebar-toggle { background: transparent; border: none; color: #6b7280; padding: 4px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.digy-sidebar-toggle svg { width: 18px; height: 18px; }
.digy-sidebar-toggle:hover { color: #fff; }
.sidebar-close-btn { display: none; background: none; border: none; color: #9ca3af; padding: 6px; }

.digy-nav { flex: 1; overflow-y: auto; padding: 8px; }
.nav-group-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #4b5563; padding: 14px 12px 6px; }
.digy-nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #9ca3af;
  font-size: .84rem; font-weight: 500; margin-bottom: 2px; transition: var(--transition); white-space: nowrap;
}
.digy-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.digy-nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.digy-sidebar.collapsed .nav-label,
.digy-sidebar.collapsed .digy-logo-text,
.digy-sidebar.collapsed .nav-group-label { display: none; }

.digy-sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.07); cursor: pointer; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-name { font-size: .8rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: .7rem; color: #6b7280; }
.digy-sidebar.collapsed .user-info { display: none; }
.logout-btn { background: none; border: none; color: #6b7280; padding: 4px; display: flex; }
.logout-btn:hover { color: #fff; }
.logout-btn svg { width: 16px; height: 16px; }

.digy-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left var(--transition); overflow: hidden; }
.digy-main.collapsed { margin-left: var(--sidebar-w-c); }

.digy-topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow);
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text); }
.mobile-menu-btn svg { width: 22px; height: 22px; }

.digy-content { flex: 1; padding: 24px; overflow-y: auto; max-height: calc(100vh - var(--topbar-h)); }

.digy-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 300px; gap: 16px; color: var(--text-muted); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   BOTONES
   ===================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; border: none; cursor: pointer; transition: var(--transition);
  white-space: nowrap; text-decoration: none;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); box-shadow: 0 4px 12px rgba(79,70,229,.3); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-icon { padding: 7px; }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

/* =====================================================
   CARDS / STATS / TABLAS / BADGES / MODALES / FORM / TOAST / TABS
   ===================================================== */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: .9rem; font-weight: 700; }
.card-body { padding: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); transition: var(--transition); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.yellow { background: #fef9c3; color: #ca8a04; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: var(--primary-l); color: var(--primary); }
.stat-num { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

.digy-table-wrap { overflow-x: auto; }
.digy-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.digy-table th { text-align: left; padding: 10px 14px; font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--border); background: var(--bg); white-space: nowrap; }
.digy-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.digy-table tr:last-child td { border-bottom: none; }
.digy-table tr:hover td { background: #fafafa; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge-completed, .badge-open { background: #dcfce7; color: #15803d; }
.badge-refund, .badge-refunded { background: #fee2e2; color: #dc2626; }
.badge-closed { background: #f1f5f9; color: #94a3b8; }
.badge-warning { background: #fef9c3; color: #92400e; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 580px; max-height: 90vh; display: flex; flex-direction: column; animation: slideUp .2s ease; }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 960px; }
.modal-sm { max-width: 400px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: .95rem; font-weight: 700; }
.modal-close { background: var(--bg); border: none; border-radius: 8px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1.1rem; transition: var(--transition); }
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }

.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .03em; }
.form-control { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; color: var(--text); background: var(--surface); outline: none; transition: var(--transition); min-height: 42px; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-control::placeholder { color: var(--text-light); }
.form-hint { font-size: .72rem; color: var(--text-muted); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check label { text-transform: none; font-weight: 500; margin: 0; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; transition: var(--transition); cursor: pointer; }
.switch-slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: var(--transition); }
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 56px; height: 56px; margin: 0 auto 16px; color: var(--border); }
.empty-state h3 { font-size: .95rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: .83rem; }
.empty-state .btn { margin-top: 16px; }

.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; pointer-events: none; }
.toast { background: var(--text); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: .83rem; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; pointer-events: auto; animation: toastIn .25s ease; max-width: 340px; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: #1c1917; }
.toast.info { background: var(--info); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { transform: translateX(100%); opacity: 0; } }

.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab-btn { padding: 10px 18px; background: none; border: none; font-size: .84rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.filters-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters-bar .form-control { width: auto; min-width: 160px; }

/* =====================================================
   TERMINAL DE VENTA (pantalla completa, táctil)
   ===================================================== */
body.digy-pos-terminal { min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.pos-topbar {
  height: 56px; background: var(--sidebar-bg); color: #fff; display: flex; align-items: center;
  padding: 0 16px; gap: 12px; flex-shrink: 0; z-index: 50;
}
.pos-topbar-logo { height: 26px; object-fit: contain; }
.pos-topbar-title { font-size: .85rem; font-weight: 700; flex: 1; }
.pos-shift-pill { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); padding: 6px 14px; border-radius: 20px; font-size: .78rem; }
.pos-shift-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.pos-shift-pill.closed .dot { background: var(--text-light); }
.pos-topbar-actions { display: flex; align-items: center; gap: 8px; }
.pos-icon-btn { background: rgba(255,255,255,.08); border: none; color: #fff; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.pos-icon-btn svg { width: 19px; height: 19px; }
.pos-icon-btn:active { background: rgba(255,255,255,.18); }

.pos-body { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* Columna productos */
.pos-catalog { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.pos-catalog-tools { padding: 14px 16px 10px; display: flex; gap: 10px; flex-shrink: 0; }
.pos-search-wrap { position: relative; flex: 1; }
.pos-search-wrap input {
  width: 100%; padding: 14px 16px 14px 44px; border-radius: 12px; border: 1.5px solid var(--border);
  font-size: 1rem; background: var(--surface); outline: none; min-height: 50px;
}
.pos-search-wrap input:focus { border-color: var(--primary); }
.pos-search-wrap svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--text-muted); }
.pos-quicksale-btn { min-height: 50px; padding: 0 18px; border-radius: 12px; }

.pos-categories { display: flex; gap: 8px; padding: 0 16px 12px; overflow-x: auto; flex-shrink: 0; -webkit-overflow-scrolling: touch; }
.pos-cat-chip {
  flex-shrink: 0; padding: 10px 18px; border-radius: 20px; background: var(--surface); border: 1.5px solid var(--border);
  font-size: .82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; min-height: 40px; display: flex; align-items: center;
}
.pos-cat-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.pos-product-grid {
  flex: 1; overflow-y: auto; padding: 4px 16px 20px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.pos-product-card {
  background: var(--surface); border-radius: 14px; border: 1px solid var(--border); overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer; transition: var(--transition); user-select: none;
  min-height: 150px;
}
.pos-product-card:active { transform: scale(.96); box-shadow: var(--shadow-md); }
.pos-product-img { width: 100%; aspect-ratio: 1.3/1; background: var(--primary-l); display: flex; align-items: center; justify-content: center; color: var(--primary); overflow: hidden; }
.pos-product-img img { width: 100%; height: 100%; object-fit: cover; }
.pos-product-img svg { width: 34px; height: 34px; opacity: .5; }
.pos-product-info { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.pos-product-name { font-size: .82rem; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-product-price { font-size: .95rem; font-weight: 800; color: var(--primary); margin-top: auto; }
.pos-product-stock { font-size: .68rem; color: var(--text-muted); }
.pos-product-stock.low { color: var(--warning); font-weight: 700; }
.pos-product-stock.out { color: var(--danger); font-weight: 700; }
.pos-product-card.disabled { opacity: .45; pointer-events: none; }

/* Columna carrito */
.pos-cart { width: 400px; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.pos-cart-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.pos-cart-header h3 { font-size: .95rem; font-weight: 800; }
.pos-cart-clear { background: none; border: none; color: var(--danger); font-size: .78rem; font-weight: 700; }
.pos-cart-items { flex: 1; overflow-y: auto; padding: 8px 12px; -webkit-overflow-scrolling: touch; }
.pos-cart-empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.pos-cart-empty svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: .4; }

.pos-cart-item { display: flex; align-items: center; gap: 10px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.pos-cart-item-info { flex: 1; min-width: 0; }
.pos-cart-item-name { font-size: .83rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-cart-item-price { font-size: .74rem; color: var(--text-muted); }
.pos-qty-stepper { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.pos-qty-stepper button { width: 34px; height: 34px; background: var(--bg); border: none; font-size: 1.1rem; font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: center; }
.pos-qty-stepper button:active { background: var(--border); }
.pos-qty-stepper span { width: 34px; text-align: center; font-size: .85rem; font-weight: 700; }
.pos-cart-item-total { width: 66px; text-align: right; font-size: .85rem; font-weight: 800; flex-shrink: 0; }
.pos-cart-item-remove { background: none; border: none; color: var(--text-light); padding: 4px; flex-shrink: 0; }
.pos-cart-item-remove svg { width: 16px; height: 16px; }
.pos-cart-item-remove:active { color: var(--danger); }

.pos-cart-summary { padding: 14px 18px; border-top: 1px solid var(--border); flex-shrink: 0; }
.pos-summary-row { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-muted); margin-bottom: 6px; }
.pos-summary-row.total { font-size: 1.3rem; font-weight: 800; color: var(--text); margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--border); }
.pos-cart-footer { padding: 14px 18px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); flex-shrink: 0; display: flex; gap: 10px; }
.pos-charge-btn { flex: 1; min-height: 58px; font-size: 1.05rem; border-radius: 14px; }
.pos-hold-btn { min-height: 58px; width: 58px; border-radius: 14px; padding: 0; justify-content: center; }

/* Numpad */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.numpad button { min-height: 54px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: 1.2rem; font-weight: 700; color: var(--text); }
.numpad button:active { background: var(--border); }
.numpad-display { font-size: 2rem; font-weight: 800; text-align: right; padding: 14px 16px; background: var(--bg); border-radius: 12px; margin-bottom: 4px; }

/* Pago mixto */
.payment-methods-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.payment-method-btn { min-height: 64px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--text); }
.payment-method-btn.active { border-color: var(--primary); background: var(--primary-l); color: var(--primary); }
.payment-method-btn svg { width: 20px; height: 20px; }
.payment-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 180px; overflow-y: auto; }
.payment-line { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: .85rem; }
.payment-line strong { flex: 1; }
.payment-line button { background: none; border: none; color: var(--text-light); }
.payment-remaining-box { text-align: center; padding: 16px; border-radius: 12px; background: var(--primary-l); margin-bottom: 14px; }
.payment-remaining-box.paid { background: #dcfce7; }
.payment-remaining-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.payment-remaining-amt { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.payment-remaining-box.paid .payment-remaining-amt { color: var(--success); }

/* Apertura / cierre de caja */
.shift-gate { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.shift-gate-card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 40px; max-width: 420px; width: 100%; text-align: center; }
.shift-gate-card svg { width: 56px; height: 56px; color: var(--primary); margin: 0 auto 16px; }
.shift-gate-card h2 { font-size: 1.2rem; margin-bottom: 8px; }
.shift-gate-card p { color: var(--text-muted); font-size: .88rem; margin-bottom: 24px; }

/* =====================================================
   TICKET (pantalla + impresión)
   ===================================================== */
.ticket-preview-wrap { display: flex; justify-content: center; background: #e5e7eb; padding: 20px; border-radius: 12px; }
.ticket { width: 300px; background: #fff; padding: 16px; font-family: 'Courier New', monospace; font-size: 12px; color: #000; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
.ticket.w58 { width: 220px; font-size: 11px; }
.ticket-center { text-align: center; }
.ticket-logo { max-height: 44px; margin: 0 auto 6px; object-fit: contain; }
.ticket h4 { font-size: 13px; margin-bottom: 2px; }
.ticket .ticket-line { border-top: 1px dashed #000; margin: 8px 0; }
.ticket-row { display: flex; justify-content: space-between; gap: 6px; }
.ticket-item-row { margin-bottom: 4px; }
.ticket-item-name { display: block; }
.ticket-qr { display: flex; justify-content: center; margin: 10px 0; }
.ticket-small { font-size: 10px; color: #444; }
.ticket-hash { font-size: 9px; word-break: break-all; color: #555; text-align: center; margin-top: 6px; }

@media print {
  body * { visibility: hidden; }
  #print-ticket-area, #print-ticket-area * { visibility: visible; }
  #print-ticket-area { position: absolute; top: 0; left: 0; width: 100%; }
  .ticket { box-shadow: none; width: 100% !important; }
  @page { margin: 0; }
}

/* =====================================================
   RESPONSIVE — BACKOFFICE (tablet / móvil)
   ===================================================== */
@media (max-width: 900px) {
  body.digy-pos-backoffice { display: block; overflow-y: auto; }
  .digy-sidebar { width: var(--sidebar-w); transform: translateX(-100%); position: fixed; z-index: 200; transition: transform .28s cubic-bezier(.4,0,.2,1); }
  .sidebar-open .digy-sidebar { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,.5); }
  body.sidebar-open { overflow: hidden; }
  .sidebar-close-btn { display: flex; }
  .digy-sidebar-toggle { display: none; }
  .digy-main { margin-left: 0 !important; display: flex; flex-direction: column; min-height: 100svh; overflow: visible; }
  .digy-content { overflow-y: visible; max-height: none !important; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 40px); }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; }
  .mobile-menu-btn svg { width: 24px; height: 24px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
}
#sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 190; }
.sidebar-open #sidebar-overlay { display: block; }

/* =====================================================
   RESPONSIVE — TERMINAL (iPad / móvil)
   ===================================================== */
@media (max-width: 1024px) {
  .pos-cart { width: 340px; }
}

/* iPad en vertical / pantallas estrechas: el carrito pasa a panel deslizante */
@media (max-width: 860px) {
  .pos-body { position: relative; }
  .pos-cart {
    position: fixed; right: 0; top: 56px; bottom: 0; width: min(400px, 92vw);
    transform: translateX(100%); transition: transform .25s ease; z-index: 80; box-shadow: -8px 0 30px rgba(0,0,0,.2);
  }
  .pos-cart.open { transform: translateX(0); }
  .pos-cart-overlay { display: none; position: fixed; inset: 56px 0 0 0; background: rgba(0,0,0,.35); z-index: 70; }
  .pos-cart.open ~ .pos-cart-overlay, body.pos-cart-open .pos-cart-overlay { display: block; }
  .pos-cart-toggle-btn { display: flex !important; }
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); padding-bottom: 90px; }
}
.pos-cart-toggle-btn { display: none; position: relative; }
.pos-cart-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 800; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

@media (max-width: 560px) {
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 8px; padding: 4px 10px 90px; }
  .pos-catalog-tools { padding: 10px; }
  .pos-quicksale-btn span { display: none; }
  .payment-methods-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Táctil: aumenta targets cuando no hay puntero fino (iPad/touch) */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .pos-cat-chip { min-height: 44px; }
  .pos-qty-stepper button { width: 40px; height: 40px; }
  .digy-nav-item { padding: 13px 12px; }
}

body.dark-mode-unused {} /* reservado */
