/* ─────────────────────────────────────────────
   SuperPOS — styles.css
   Organised sections:
     1. Reset & CSS variables
     2. Layout shell
     3. Header & navigation
     4. Main content / cards
     5. Product grid
     6. Sidebar / cart
     7. Tables
     8. Buttons & form controls
     9. Badges & tags
    10. Modals
    11. Toast
    12. Reports / stats
    13. Utility classes
    14. Scrollbars
───────────────────────────────────────────── */

/* ── 1. Reset & CSS variables ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg-page:       #858585;
  --color-bg-surface:    #858585;
  --color-bg-muted:      #858585;
  --color-bg-success:    #858585;
  --color-bg-warning:    #858585;
  --color-bg-danger:     #858585;
  --color-bg-info:       #858585;

  --color-text-primary:  #1a1a18;
  --color-text-secondary:#5f5e5a;
  --color-text-tertiary: #9d9c97;
  --color-text-success:  #0f6e56;
  --color-text-warning:  #854f0b;
  --color-text-danger:   #a32d2d;
  --color-text-info:     #185fa5;

  --color-border-subtle: rgba(0,0,0,.09);
  --color-border-mid:    rgba(0,0,0,.18);
  --color-border-strong: rgba(0,0,0,.28);

  --color-accent:        #1D9E75;
  --color-accent-hover:  #0F6E56;
  --color-accent-text:   #808080;

  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-pill:20px;

  --font-sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --shadow-card: 0 1px 3px rgba(0,0,0,.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-page:       #1a1a18;
    --color-bg-surface:    #252523;
    --color-bg-muted:      #2c2c2a;
    --color-bg-success:    #0a2e22;
    --color-bg-warning:    #2c1f08;
    --color-bg-danger:     #2e1212;
    --color-bg-info:       #0c2240;

    --color-text-primary:  #f0efe9;
    --color-text-secondary:#a8a7a2;
    --color-text-tertiary: #6a6965;
    --color-text-success:  #5dcaa5;
    --color-text-warning:  #ef9f27;
    --color-text-danger:   #f09595;
    --color-text-info:     #85b7eb;

    --color-border-subtle: rgba(255,255,255,.08);
    --color-border-mid:    rgba(255,255,255,.14);
    --color-border-strong: rgba(255,255,255,.22);
    --shadow-card: 0 1px 4px rgba(0,0,0,.4);
  }
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── 2. Layout shell ── */
.pos-wrap {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: 52px 1fr;
  height: 100dvh;
  min-height: 600px;
  overflow: hidden;
}

/* ── 3. Header & navigation ── */
.header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  height: 52px;
  background: var(--color-bg-surface);
  border-bottom: 0.5px solid var(--color-border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.logo .ti {
  font-size: 20px;
  color: var(--color-accent);
}

.nav-tabs {
  display: flex;
  gap: 2px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.tab:hover:not(.active) {
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
}

.tab.active {
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
}

.clock {
  font-size: 12px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* ── 4. Main content / cards ── */
.main {
  overflow-y: auto;
  padding: 1rem;
  background: var(--color-bg-page);
}

.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
}

.card {
  background: var(--color-bg-surface);
  border: 0.5px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

/* ── 5. Product grid ── */
.search-bar {
  position: relative;
  margin-bottom: 0.6rem;
}

.search-bar .ti {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  font-size: 16px;
  pointer-events: none;
}

.search-bar input[type="search"] {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input[type="search"]:focus {
  border-color: var(--color-accent);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 0.75rem;
}

.filter-btn {
  padding: 3px 11px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.filter-btn:hover {
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
}

.filter-btn.active {
  background: var(--color-bg-info);
  color: var(--color-text-info);
  border-color: transparent;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}

.prod-btn {
  position: relative;
  background: var(--color-bg-surface);
  border: 0.5px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.5rem 0.55rem;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
}

.prod-btn:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg-muted);
}

.prod-btn:active {
  transform: scale(0.97);
}

.prod-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.prod-btn .name {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-word;
}

.prod-btn .price {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-info);
}

.stock-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  line-height: 1.4;
}

.badge-ok  { background: var(--color-bg-success); color: var(--color-text-success); }
.badge-low { background: var(--color-bg-warning);  color: var(--color-text-warning); }
.badge-out { background: var(--color-bg-danger);   color: var(--color-text-danger); }

/* ── 6. Sidebar / cart ── */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg-surface);
  border-left: 0.5px solid var(--color-border-subtle);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 0.5px solid var(--color-border-subtle);
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.sidebar-header span:last-child {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0.6rem;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  color: var(--color-text-tertiary);
  font-size: 13px;
}

.cart-empty .ti {
  font-size: 30px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 4px;
  border-bottom: 0.5px solid var(--color-border-subtle);
}

.cart-item:last-child {
  border-bottom: none;
}

.ci-info {
  flex: 1;
  min-width: 0;
}

.ci-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ci-unit {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.qty-ctrl {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.qty-btn {
  width: 22px;
  height: 22px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: 5px;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.qty-btn:hover {
  background: var(--color-bg-muted);
}

.qty-num {
  font-size: 13px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
  color: var(--color-text-primary);
}

.ci-total {
  font-size: 13px;
  font-weight: 500;
  min-width: 50px;
  text-align: right;
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.del-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-tertiary);
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.1s;
}

.del-btn:hover {
  color: var(--color-text-danger);
}

.cart-footer {
  padding: 0.75rem 1rem;
  border-top: 0.5px solid var(--color-border-mid);
  flex-shrink: 0;
}

.subtotal-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 3px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 8px 0;
}

.pay-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-accent-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s;
  margin-top: 4px;
}

.pay-btn:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.pay-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.clear-btn {
  width: 100%;
  margin-top: 5px;
  padding: 7px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}

.clear-btn:hover {
  background: var(--color-bg-muted);
}

/* ── 7. Tables ── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 6px 10px;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 0.5px solid var(--color-border-mid);
  white-space: nowrap;
}

tbody td {
  padding: 9px 10px;
  border-bottom: 0.5px solid var(--color-border-subtle);
  color: var(--color-text-primary);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--color-bg-muted);
}

/* ── 8. Buttons & form controls ── */
.action-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}

.btn-sm:hover {
  background: var(--color-bg-muted);
}

.btn-primary {
  background: var(--color-accent) !important;
  color: var(--color-accent-text) !important;
  border-color: var(--color-accent) !important;
}

.btn-primary:hover {
  background: var(--color-accent-hover) !important;
  border-color: var(--color-accent-hover) !important;
}

.btn-danger {
  color: var(--color-text-danger) !important;
}

/* Form elements inside modals */
.form-group {
  margin-bottom: 0.7rem;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 7px 10px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--color-accent);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ── 9. Badges & tags ── */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.tag-ok  { background: var(--color-bg-success); color: var(--color-text-success); }
.tag-low { background: var(--color-bg-warning);  color: var(--color-text-warning); }
.tag-out { background: var(--color-bg-danger);   color: var(--color-text-danger); }

/* ── 10. Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--color-bg-surface);
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 400px;
  max-width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.modal h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 7px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 1rem;
}

.modal-actions .btn-sm {
  flex: 1;
  justify-content: center;
}

/* Receipt lines inside payment modal */
.receipt-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
}

.receipt-divider {
  border: none;
  border-top: 1px dashed var(--color-border-mid);
  margin: 8px 0;
}

.change-info {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.change-ok   { background: var(--color-bg-success); color: var(--color-text-success); }
.change-short{ background: var(--color-bg-danger);  color: var(--color-text-danger); }

/* ── 11. Toast ── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg-surface);
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  padding: 8px 18px;
  font-size: 13px;
  color: var(--color-text-primary);
  z-index: 200;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
}

/* ── 12. Reports / stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 0.75rem;
}

.stat-card {
  background: var(--color-bg-surface);
  border: 0.5px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.stat-val {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.stat-sub {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 3px;
}

/* Transaction history rows */
.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--color-border-subtle);
}

.tx-row:last-child {
  border-bottom: none;
}

.tx-id {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
}

.tx-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.tx-amt {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-success);
  flex-shrink: 0;
}

/* ── 13. Utility classes ── */
.flex-1 { flex: 1; }

/* ── 14. Scrollbars (webkit) ── */
::-webkit-scrollbar        { width: 5px; height: 5px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--color-border-mid); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-strong); }

/* ── 15. History — date groups & clickable rows ── */

.tx-date-group {
  margin-bottom: 0.5rem;
  border: 0.5px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tx-date-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--color-bg-muted);
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background 0.1s;
}

.tx-date-header:hover {
  background: var(--color-border-subtle);
}

.tx-date-meta {
  font-weight: 400;
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
}

.tx-group-body {
  padding: 0 4px;
}

.tx-row-clickable {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 9px 8px;
  transition: background 0.1s;
}

.tx-row-clickable:hover {
  background: var(--color-bg-muted);
}

.tx-debt-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  background: var(--color-bg-danger);
  color: var(--color-text-danger);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  margin-left: 6px;
}

/* ── 16. Print choice buttons ── */

.print-choice-btns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 1rem;
}

.print-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  text-align: center;
}

.print-choice-btn:hover {
  background: var(--color-bg-muted);
  border-color: var(--color-accent);
}

.print-choice-btn .ti {
  font-size: 22px;
  color: var(--color-accent);
}

.print-choice-btn span {
  font-size: 12px;
  font-weight: 600;
}

.print-choice-btn small {
  font-size: 10px;
  color: var(--color-text-tertiary);
  line-height: 1.3;
}

/* ── 17. Receipt preview ── */

.receipt-preview {
  background: var(--color-bg-muted);
  border: 0.5px dashed var(--color-border-mid);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 12px;
  margin-bottom: 1rem;
  max-height: 260px;
  overflow-y: auto;
}

/* ── 18. Stat card danger variant ── */

.stat-card-danger {
  border-color: var(--color-text-danger) !important;
}

/* ── History sub-tabs ── */
.history-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: 0.5rem;
}

.htab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.htab:hover:not(.active) {
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
}

.htab.active {
  background: var(--color-bg-info);
  color: var(--color-text-info);
  border-color: transparent;
}

/* ── TX date groups ── */
.tx-date-group {
  margin-bottom: .5rem;
  border: 0.5px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tx-date-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--color-bg-muted);
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: background .1s;
}

.tx-date-header:hover { background: var(--color-border-subtle); }

.tx-date-meta {
  font-weight: 400;
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
}

.tx-group-body { padding: 0 4px; }

.tx-row-clickable {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 9px 8px;
  transition: background .1s;
}

.tx-row-clickable:hover { background: var(--color-bg-muted); }

.tx-debt-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  background: var(--color-bg-danger);
  color: var(--color-text-danger);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  margin-left: 6px;
}

.tx-credit-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  background: var(--color-bg-success);
  color: var(--color-text-success);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  margin-left: 6px;
}

/* ── Print choice buttons ── */
.print-choice-btns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 1rem;
}

.print-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background .1s, border-color .1s;
  text-align: center;
}

.print-choice-btn:hover {
  background: var(--color-bg-muted);
  border-color: var(--color-accent);
}

.print-choice-btn .ti { font-size: 22px; color: var(--color-accent); }
.print-choice-btn span { font-size: 12px; font-weight: 600; }
.print-choice-btn small { font-size: 10px; color: var(--color-text-tertiary); }

/* ── Receipt preview ── */
.receipt-preview {
  background: var(--color-bg-muted);
  border: 0.5px dashed var(--color-border-mid);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 12px;
  margin-bottom: 1rem;
  max-height: 260px;
  overflow-y: auto;
}

/* ── Stat card danger ── */
.stat-card-danger { border-color: var(--color-text-danger) !important; }

/* ── 19. Scanner indicator ── */
#scanner-indicator {
  font-size: 14px;
  color: var(--color-text-tertiary);
  transition: color 0.2s, transform 0.1s;
  user-select: none;
}

.scanner-flash {
  color: var(--color-accent) !important;
  transform: scale(1.3);
}

/* ── 20. Batch import modal ── */
.batch-modal {
  overflow-x: auto;
}

.batch-modal table input,
.batch-modal table select {
  padding: 4px 6px;
  font-size: 12px;
}

/* ── 21. RTL support ── */
[dir="rtl"] .header {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-tabs {
  flex-direction: row-reverse;
}

[dir="rtl"] .tab .ti,
[dir="rtl"] .btn-sm .ti {
  margin-left: 4px;
  margin-right: 0;
}

[dir="rtl"] .search-bar .ti {
  left: auto;
  right: 10px;
}

[dir="rtl"] .search-bar input[type="search"] {
  padding: 8px 34px 8px 12px;
}

[dir="rtl"] .sidebar {
  border-left: none;
  border-right: 0.5px solid var(--color-border-subtle);
}

[dir="rtl"] .tx-debt-badge,
[dir="rtl"] .tx-credit-badge {
  margin-left: 0;
  margin-right: 6px;
}

[dir="rtl"] .modal-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .form-row {
  direction: rtl;
}

[dir="rtl"] .receipt-line {
  flex-direction: row-reverse;
}

/* ── 22. Debit info box ── */
.debit-info-box {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.debit-info-box .ti {
  flex-shrink: 0;
  margin-top: 2px;
}

/* ══════════════════════════════════════════
   NEW: Copyright footer
══════════════════════════════════════════ */
.copyright-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10.5px;
  color: var(--color-text-tertiary);
  padding: 3px 0 5px;
  background: var(--color-bg-surface);
  border-top: 0.5px solid var(--color-border-subtle);
  z-index: 20;
  pointer-events: none;
  letter-spacing: .03em;
}
/* Push content above footer */
.main    { padding-bottom: calc(1rem + 24px) !important; }
.sidebar { padding-bottom: 24px !important; }

/* ══════════════════════════════════════════
   NEW: License lock screen
══════════════════════════════════════════ */
#license-lock-screen {
  position: fixed;
  inset: 0;
  background: var(--color-bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
.lock-box {
  max-width: 460px;
  width: 92%;
  text-align: center;
  padding: 2.5rem 2rem 2rem;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-mid);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
}
.lock-emoji {
  font-size: 58px;
  margin-bottom: .75rem;
  display: block;
  animation: lock-pulse 2.4s ease-in-out infinite;
}
@keyframes lock-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}
.lock-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--color-text-danger);
  margin-bottom: .65rem;
}
.lock-body {
  font-size: 13.5px;
  color: var(--color-text-secondary);
  line-height: 1.75;
  margin-bottom: 1.25rem;
}
.lock-expiry-badge {
  display: inline-block;
  background: var(--color-bg-danger);
  color: var(--color-text-danger);
  border-radius: var(--radius-pill);
  padding: 3px 14px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.lock-footer {
  font-size: 11px;
  color: var(--color-text-tertiary);
  border-top: 0.5px solid var(--color-border-subtle);
  padding-top: .85rem;
  margin-top: .5rem;
}

/* ══════════════════════════════════════════
   NEW: Customer payment history modal
══════════════════════════════════════════ */
.debtor-history-table td {
  font-size: 12px;
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--color-border-subtle);
  vertical-align: top;
}
.debtor-history-table tr:last-child td { border-bottom: none; }
.debt-type-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.debt-type-purchase    { background: var(--color-bg-warning); color: var(--color-text-warning); }
.debt-type-payment     { background: var(--color-bg-success); color: var(--color-text-success); }
.debt-type-settled     { background: var(--color-bg-success); color: var(--color-text-success); }
.debt-type-overpayment { background: var(--color-bg-info);    color: var(--color-text-info); }

/* ══════════════════════════════════════════════════════
   MG POS PRO — ENHANCED UI ADDITIONS
══════════════════════════════════════════════════════ */

/* ── Quick-amount numpad ── */
.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: .5rem;
}
.numpad-btn {
  padding: 10px 4px;
  border: 0.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .1s, transform .08s;
  text-align: center;
}
.numpad-btn:hover  { background: var(--color-accent); color: #fff; }
.numpad-btn:active { transform: scale(.95); }
.numpad-btn.wide   { grid-column: span 2; }
.numpad-btn.danger { background: var(--color-bg-danger); color: var(--color-text-danger); }
.numpad-btn.go     { background: var(--color-accent); color: #fff; }

/* ── Keyboard shortcut hints ── */
.kbd {
  display: inline-block;
  background: var(--color-bg-muted);
  border: 0.5px solid var(--color-border-mid);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-secondary);
  font-family: monospace;
  margin-left: 4px;
}

/* ── Today's summary ribbon (below header on Sell tab) ── */
.today-ribbon {
  display: flex;
  gap: 12px;
  padding: 6px 1rem;
  background: var(--color-bg-surface);
  border-bottom: 0.5px solid var(--color-border-subtle);
  font-size: 11px;
  color: var(--color-text-secondary);
  overflow-x: auto;
  white-space: nowrap;
}
.today-ribbon strong { color: var(--color-text-primary); }
.today-ribbon .sep   { color: var(--color-border-mid); }

/* ── Stock low pulse badge ── */
@keyframes pulse-danger {
  0%,100% { box-shadow: 0 0 0 0 rgba(163,45,45,.5); }
  50%      { box-shadow: 0 0 0 5px rgba(163,45,45,0); }
}
.pulse-danger { animation: pulse-danger 1.8s infinite; }

/* ── Cart item swipe-hint ── */
.cart-item { position: relative; overflow: hidden; }

/* ── Product card enhancements ── */
.prod-btn { position: relative; }
.prod-btn .stock-num {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  color: var(--color-text-tertiary);
}

/* ── Search clear button ── */
.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-tertiary);
  font-size: 13px;
  padding: 2px 4px;
  display: none;
}
.search-bar:has(input:not(:placeholder-shown)) .search-clear { display: block; }
.search-bar { position: relative; }

/* ── Debtor summary card ── */
.debtor-summary-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-bg-danger);
  border: 0.5px solid var(--color-text-danger);
  border-radius: var(--radius-md);
  margin-bottom: .75rem;
  font-size: 12px;
  color: var(--color-text-danger);
}

/* ── Stat card hover ── */
.stat-card {
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-mid); border-radius: 10px; }

/* ── Copyright footer ── */
.copyright-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10.5px;
  color: var(--color-text-tertiary);
  padding: 3px 0 5px;
  background: var(--color-bg-surface);
  border-top: 0.5px solid var(--color-border-subtle);
  z-index: 20;
  pointer-events: none;
  letter-spacing: .03em;
}
.main    { padding-bottom: calc(1rem + 24px) !important; }
.sidebar { padding-bottom: 24px !important; }

/* ── License lock screen ── */
#license-lock-screen {
  position: fixed;
  inset: 0;
  background: var(--color-bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
.lock-box {
  max-width: 460px;
  width: 92%;
  text-align: center;
  padding: 2.5rem 2rem 2rem;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-mid);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
}
.lock-emoji {
  font-size: 58px;
  margin-bottom: .75rem;
  display: block;
  animation: lock-pulse 2.4s ease-in-out infinite;
}
@keyframes lock-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}
.lock-title {
  font-size: 21px; font-weight: 700;
  color: var(--color-text-danger); margin-bottom: .65rem;
}
.lock-body {
  font-size: 13.5px; color: var(--color-text-secondary);
  line-height: 1.75; margin-bottom: 1.25rem;
}
.lock-expiry-badge {
  display: inline-block;
  background: var(--color-bg-danger); color: var(--color-text-danger);
  border-radius: var(--radius-pill); padding: 3px 14px;
  font-size: 12px; font-weight: 600; margin-bottom: 1.25rem;
}
.lock-footer {
  font-size: 11px; color: var(--color-text-tertiary);
  border-top: 0.5px solid var(--color-border-subtle);
  padding-top: .85rem; margin-top: .5rem;
}

/* ── Customer history badges ── */
.debtor-history-table td {
  font-size: 12px; padding: 6px 8px;
  border-bottom: 0.5px solid var(--color-border-subtle);
  vertical-align: top;
}
.debtor-history-table tr:last-child td { border-bottom: none; }
.debt-type-badge {
  display: inline-block; padding: 1px 8px;
  border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; white-space: nowrap;
}
.debt-type-purchase    { background: var(--color-bg-warning); color: var(--color-text-warning); }
.debt-type-payment     { background: var(--color-bg-success); color: var(--color-text-success); }
.debt-type-settled     { background: var(--color-bg-success); color: var(--color-text-success); }
.debt-type-overpayment { background: var(--color-bg-info);    color: var(--color-text-info); }

/* ── Quick-access floating button (mobile) ── */
@media (max-width: 700px) {
  .pos-wrap {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none !important;
  }
}

/* ── Print styles ── */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: fixed; top: 0; left: 0; width: 100%; }
}

/* ── Tooltip ── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.82);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 100;
}
[data-tip]:hover::after { opacity: 1; }
