:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --sidebar: #10251d;
  --sidebar-2: #17362a;
  --accent: #16a34a;
  --accent-dark: #15803d;
  --accent-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  font-size: 15px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.hidden { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(22, 163, 74, 0.28), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(5, 150, 105, 0.25), transparent 55%),
    #0c1f18;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  text-align: center;
}
.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), #065f46);
  color: #fff;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 22px;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.35);
}
.brand-mark.small { width: 40px; height: 40px; font-size: 14px; border-radius: 12px; margin: 0; box-shadow: none; }
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.login-card .field { text-align: left; margin-bottom: 14px; }
.login-card .btn { margin-top: 8px; }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--muted); }
.login-hint b { color: var(--text); }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100dvh; min-height: 100vh; width: 100%; max-width: 100vw; overflow-x: hidden; }
.sidebar {
  width: 240px;
  flex: 0 0 240px;
  min-width: 240px;
  background: linear-gradient(180deg, var(--sidebar), #0c1c16);
  color: #d1fae5;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.sidebar-brand strong { display: block; font-size: 14px; color: #fff; line-height: 1.15; }
.sidebar-brand small { color: #6ee7b7; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #b8d8c8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a svg {
  width: 19px; height: 19px; flex: 0 0 19px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; box-shadow: 0 6px 14px rgba(22, 163, 74, 0.35); }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 14px; margin-top: 14px; display: grid; gap: 10px; }
.sidebar-foot .user-chip { color: #e6fff4; }
.sidebar-foot .user-chip small { color: #7dd3a8; }
.sidebar-foot .btn-ghost { color: #d1fae5; border-color: rgba(255, 255, 255, 0.2); }
.sidebar-foot .btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.app-main { flex: 1 1 auto; min-width: 0; max-width: 100%; display: flex; flex-direction: column; overflow-x: hidden; }
.topbar {
  min-height: 72px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  max-width: 100%;
}
.topbar-title h2 { font-size: 20px; font-weight: 700; }
.topbar-title span { font-size: 12.5px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.view { padding: 24px 28px 40px; flex: 1; min-width: 0; overflow-x: hidden; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-dark { background: #1f2937; color: #fff; }
.btn-dark:hover { background: #111827; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { border-color: var(--border); background: transparent; }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px 8px; font-size: 13px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: #374151; }
.field small { color: var(--muted); font-size: 11.5px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.13);
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { resize: vertical; min-height: 76px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; margin-bottom: 14px; }
.check-row input { width: 17px; height: 17px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; min-width: 130px; }

/* ---------- Cards / layout ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.card-pad { padding: 18px 20px; }
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 18px 20px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head .page-head-info h3 { font-size: 17px; }
.page-head .page-head-info p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stack { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mb-2 { margin-bottom: 8px; }
.divider { height: 1px; background: var(--border); border: 0; margin: 16px 0; }

/* ---------- Stats ---------- */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: grid;
  gap: 6px;
}
.stat .stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.7px; font-weight: 700; color: var(--muted); }
.stat .stat-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.stat .stat-foot { font-size: 12px; color: var(--muted); }
.stat.green .stat-value { color: var(--accent-dark); }
.stat.blue .stat-value { color: var(--info); }
.stat.amber .stat-value { color: var(--warning); }
.stat.red .stat-value { color: var(--danger); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
tbody tr:hover { background: #fafcfb; }
tbody tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.tnum { font-variant-numeric: tabular-nums; }
.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 15px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--accent-soft); color: #166534; }
.badge-red { background: var(--danger-soft); color: #991b1b; }
.badge-amber { background: var(--warning-soft); color: #92400e; }
.badge-blue { background: var(--info-soft); color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ---------- PDV ---------- */
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}
.pos-products {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 132px);
  min-height: calc(100vh - 132px);
}
.scan-wrap { position: relative; z-index: 20; margin-bottom: 14px; }
.scan-bar { display: flex; gap: 10px; }
.scan-bar .scan-input { position: relative; flex: 1; }
.scan-bar input {
  padding-left: 54px;
  padding-right: 64px;
  height: 64px;
  font-size: 19px;
  font-weight: 600;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
}
.scan-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.14);
}
.scan-bar .scan-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; fill: none; stroke: var(--muted); stroke-width: 1.8;
}
.scan-key {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 10.5px; padding: 4px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  font-family: inherit; font-weight: 700;
}
.scan-clear { height: 64px; padding: 0 22px; }
.scan-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  max-height: 340px; overflow-y: auto; z-index: 40;
}
.scan-result {
  width: 100%;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) 120px;
  gap: 14px;
  align-items: center;
  padding: 13px 18px;
  background: none;
  border: 0;
  border-bottom: 1px solid #eef2f5;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.scan-result:last-child { border-bottom: 0; }
.scan-result:hover { background: var(--accent-soft); }
.scan-result.out { opacity: 0.55; }
.sr-code { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sr-name { font-size: 14px; font-weight: 700; display: grid; gap: 2px; }
.sr-name small { font-size: 11px; color: var(--muted); font-weight: 500; }
.sr-price { text-align: right; font-weight: 800; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.scan-empty { padding: 22px 18px; color: var(--muted); font-size: 13px; text-align: center; }

.pos-cart {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.pos-cart-head,
.pos-cart-row {
  display: grid;
  grid-template-columns: 110px minmax(130px, 1fr) 128px 96px 108px 34px;
  gap: 10px;
  align-items: center;
}
.pos-cart-head {
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.pos-cart-items { flex: 1; overflow-y: auto; min-height: 180px; }
.pos-cart-row { padding: 12px 18px; border-bottom: 1px solid #eef2f5; }
.pos-cart-row:hover { background: #f8fafc; }
.pc-code { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pc-name { font-size: 15px; font-weight: 700; display: grid; gap: 1px; line-height: 1.25; }
.pc-name small { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.pc-qty { display: flex; }
.pc-unit, .pc-total { text-align: right; font-variant-numeric: tabular-nums; }
.pc-unit { font-size: 13px; color: var(--muted); }
.pc-total { font-size: 16px; font-weight: 800; }
.pc-remove {
  border: 0; background: var(--danger-soft); color: var(--danger);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  font-size: 18px; line-height: 1;
}
.pc-remove:hover { background: #fecaca; }
.qty-control { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.qty-control button { border: 0; background: var(--surface-2); width: 32px; height: 32px; cursor: pointer; font-weight: 700; color: #374151; font-size: 15px; }
.qty-control button:hover { background: #e8edf2; }
.qty-control input { width: 48px; border: 0; text-align: center; padding: 5px 2px; font-size: 13px; font-weight: 700; -moz-appearance: textfield; background: #fff; }
.qty-control input::-webkit-outer-spin-button, .qty-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pos-cart-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 32px;
  text-align: center;
  color: var(--muted);
}
.pos-cart-empty svg { width: 68px; height: 68px; fill: none; stroke: #cbd5e1; stroke-width: 1.2; }
.pos-cart-empty strong { font-size: 16px; color: #475569; }
.pos-cart-empty span { font-size: 13px; line-height: 1.5; }
.pos-hints { display: flex; gap: 20px; flex-wrap: wrap; padding-top: 12px; font-size: 12px; color: var(--muted); }
kbd {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: #475569;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
}

.cart-panel { position: sticky; top: 90px; display: flex; flex-direction: column; max-height: calc(100dvh - 112px); max-height: calc(100vh - 112px); min-width: 0; }
.cart-summary { border-top: 1px solid var(--border); padding: 14px 16px; display: grid; gap: 10px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.summary-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.discount-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.discount-row input { width: 118px; padding: 8px 10px; text-align: right; }
.customer-row select { padding: 9px 10px; font-size: 12.5px; }

.pos-total-panel { padding: 0; overflow: hidden; }
.pos-total-block {
  background: #0f172a;
  color: #fff;
  padding: 22px 22px 20px;
  display: grid;
  gap: 2px;
}
.pos-total-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 800; }
.pos-total-block strong {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  color: #4ade80;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  word-break: break-word;
}
.pos-total-count { font-size: 13px; color: #cbd5e1; }
.pos-total-panel .cart-summary { border-top: 0; border-radius: 0; padding: 16px; gap: 12px; }
.pos-pay-btn {
  height: 64px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}
.pos-pay-btn kbd { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.4); color: #fff; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.12s ease;
}
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3);
  animation: popIn 0.15s ease;
}
.modal-card.wide { width: min(860px, 100%); }
.modal-card.narrow { width: min(440px, 100%); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h3 { font-size: 17px; }
.modal-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal-close { border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted); }
.modal-close:hover { background: #e8edf2; color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }

/* Payment modal */
.pay-total { text-align: center; background: var(--surface-2); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.pay-total span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; }
.pay-total strong { display: block; font-size: 42px; letter-spacing: -1.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pay-method-field { margin-bottom: 14px; }
.pay-method-input { height: 52px; font-size: 17px; font-weight: 600; }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.pay-method {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 16px 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: grid;
  gap: 5px;
  justify-items: center;
}
.pay-method b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 11px;
  color: var(--muted);
}
.pay-method:hover { border-color: var(--accent); }
.pay-method.active { border-color: var(--accent); background: var(--accent-soft); color: #14532d; }
.pay-method.active b { background: var(--accent); color: #fff; }
.pay-step-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.cash-input { height: 64px; font-size: 34px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.quick-cash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.quick-cash button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 9px;
  padding: 11px 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
}
.quick-cash button:hover { border-color: var(--accent); background: var(--accent-soft); }
.pay-change {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-radius: 10px;
  font-weight: 700;
  color: #166534;
}
.pay-change span { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.pay-change strong { font-size: 26px; font-variant-numeric: tabular-nums; }
.pay-change.negative { background: var(--warning-soft); color: #92400e; }
.pay-other { display: flex; justify-content: space-between; align-items: center; padding: 18px; background: var(--surface-2); border-radius: 10px; font-size: 14px; color: var(--muted); }
.pay-other strong { font-size: 24px; color: var(--text); font-variant-numeric: tabular-nums; }
.pay-note { font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* Receipt */
.receipt {
  width: 320px;
  margin: 0 auto;
  background: #fff;
  color: #000;
  font-family: "Courier New", monospace;
  font-size: 12px;
  padding: 10px;
}
.receipt h4 { text-align: center; font-size: 14px; margin-bottom: 2px; }
.receipt .r-center { text-align: center; }
.receipt .r-line { border-top: 1px dashed #000; margin: 8px 0; }
.receipt .r-row { display: flex; justify-content: space-between; gap: 8px; }
.receipt .r-items { width: 100%; border-collapse: collapse; font-size: 11px; }
.receipt .r-items th, .receipt .r-items td { border: 0; padding: 2px 0; }
.receipt .r-small { font-size: 10px; }
@media print {
  body * { visibility: hidden; }
  #recibo-print, #recibo-print * { visibility: visible; }
  #recibo-print { position: absolute; left: 0; top: 0; width: 100%; }
  .modal-backdrop { position: static; background: none; padding: 0; display: block; }
  .modal-card { box-shadow: none; max-height: none; width: 100%; }
  .modal-head, .modal-foot { display: none; }
  .modal-body { padding: 0; overflow: visible; }
}

/* ---------- Toasts ---------- */
.toast-root { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; }
.toast {
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  max-width: 360px;
  animation: popIn 0.15s ease;
  border-left: 4px solid var(--accent);
}
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }

/* ---------- Misc ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 140px; }
.search-field { position: relative; }
.search-field input { padding-left: 36px; }
.search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.bar-chart { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 110px; align-items: center; gap: 12px; font-size: 12.5px; }
.bar-track { background: #eef2f0; border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #22c55e); border-radius: 6px; }
.movement-type { font-size: 11px; font-weight: 700; text-transform: capitalize; }
.danger-text { color: var(--danger); }
.success-text { color: var(--accent-dark); }
.info-banner {
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--info-soft);
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.progress-line { height: 6px; background: #eef2f0; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress-line span { display: block; height: 100%; background: var(--accent); }

@media (max-width: 1400px) {
  .pos-cart-head, .pos-cart-row { grid-template-columns: minmax(0, 1fr) 120px 96px 32px; }
  .pos-cart-head .pc-code, .pos-cart-row .pc-code,
  .pos-cart-head .pc-unit, .pos-cart-row .pc-unit { display: none; }
}
@media (max-width: 1280px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr) 350px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  html, body { overflow-x: hidden; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex: none; padding: 12px 14px; }
  .sidebar-brand { padding-bottom: 10px; }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; flex-wrap: nowrap; }
  .nav a { flex: 0 0 auto; padding: 8px 11px; }
  .nav a span { display: inline; }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 10px; flex-wrap: wrap; gap: 8px; }
  .sidebar-foot .user-chip small { display: none; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-products { min-height: 0; }
  .pos-cart-items { max-height: 40vh; }
  .cart-panel { position: static; max-height: none; }
  .pos-total-block strong { font-size: clamp(38px, 10vw, 46px); }
  .topbar { padding: 0 12px; height: auto; min-height: 72px; flex-wrap: wrap; gap: 6px; }
  .topbar-right { flex-wrap: wrap; gap: 8px; }
  .view { padding: 12px; overflow-x: hidden; width: 100%; box-sizing: border-box; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .card { overflow-x: auto; max-width: 100%; }
  .table-wrap { overflow-x: auto; max-width: 100%; }
  table { min-width: 520px; }
}
@media (max-width: 700px) {
  .pos-cart-head, .pos-cart-row { grid-template-columns: minmax(0, 1fr) 90px 32px; gap: 6px; padding: 10px 10px; }
  .pos-cart-head .pc-code, .pos-cart-row .pc-code,
  .pos-cart-head .pc-unit, .pos-cart-row .pc-unit,
  .pos-cart-head .pc-qty, .pos-cart-row .pc-qty { display: none; }
  .pc-name { font-size: 13.5px; }
  .pc-total { font-size: 14px; }
  .qty-control button { width: 27px; height: 30px; }
  .qty-control input { width: 36px; font-size: 12px; }
  .scan-bar { flex-wrap: wrap; }
  .scan-bar input { height: 56px; font-size: 15px; padding-left: 46px; }
  .scan-clear { height: 56px; padding: 0 14px; flex: 1 1 100%; }
  .scan-result { grid-template-columns: minmax(0, 1fr) 90px; gap: 8px; padding: 11px 14px; }
  .scan-result .sr-code { display: none; }
  .pos-hints { gap: 10px; font-size: 11px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .btn-group { width: 100%; flex-wrap: wrap; }
  .modal-card { width: 100%; max-height: calc(100dvh - 20px); }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 12px 14px; }
}
@media (max-width: 600px) {
  .grid-4 { grid-template-columns: 1fr; }
  .pay-methods { grid-template-columns: repeat(2, 1fr); }
  .quick-cash { grid-template-columns: repeat(2, 1fr); }
  .topbar { height: 62px; }
  .clock { display: none; }
  .pos-total-block strong { font-size: 42px; }
  .modal-backdrop { padding: 10px; }
}
