/* ==========================================================================
   HUMTTO UI
   Green/white brand identity, layered surfaces, logical properties so the
   Kurdish (RTL) layout is properly designed rather than only mirrored.
   ========================================================================== */

:root{
  /* brand */
  --brand:#15803d;
  --brand-strong:#166534;
  --brand-ink:#0f3a22;
  --brand-50:#f2fbf5;
  --brand-100:#dcfce7;
  --brand-200:#bbf0cd;

  /* surfaces */
  --bg:#f4f7f5;
  --bg-tint:radial-gradient(1200px 420px at 50% -140px, #e8f5ed 0%, rgba(232,245,237,0) 70%);
  --surface:#ffffff;
  --surface-2:#fafcfb;
  --line:#e3e9e5;
  --line-soft:#eef2ef;

  /* text */
  --text:#132019;
  --text-2:#3c4c43;
  --muted:#6d7d74;

  /* status */
  --danger:#dc2626;
  --danger-soft:#fee2e2;
  --danger-ink:#991b1b;
  --warn:#c2740a;
  --warn-soft:#fef3c7;
  --warn-ink:#8a5108;

  /* shape + depth */
  --r-sm:9px;
  --r:13px;
  --r-lg:18px;
  --pill:999px;
  --sh-1:0 1px 2px rgba(14,32,22,.05), 0 1px 3px rgba(14,32,22,.04);
  --sh-2:0 2px 6px rgba(14,32,22,.05), 0 10px 24px rgba(14,32,22,.06);
  --sh-3:0 8px 20px rgba(14,32,22,.10), 0 24px 48px rgba(14,32,22,.10);
  --ring:0 0 0 3px rgba(21,128,61,.18);

  --nav-h:60px;
  --bottomnav-h:64px;
}

*{box-sizing:border-box}

html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  padding:0;
  background:var(--bg);
  background-image:var(--bg-tint);
  background-repeat:no-repeat;
  color:var(--text);
  font-family:"Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",Arial,sans-serif;
  font-size:14.5px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
/* Arabic-script faces render Kurdish far better than the Latin stack. */
body.rtl{
  font-family:"Segoe UI","Noto Naskh Arabic","Noto Kufi Arabic",Tahoma,"Times New Roman",sans-serif;
  line-height:1.75;
}

a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:underline}

h1,h2,h3,h4{margin:0 0 .6em;letter-spacing:-.01em;color:var(--text);font-weight:700}
h1{font-size:1.6rem;line-height:1.25}
h2{font-size:1.3rem}
h3{font-size:1.02rem}
h4{font-size:.95rem}
body.rtl h1,body.rtl h2,body.rtl h3,body.rtl h4{letter-spacing:0}

.container{max-width:1280px;margin:26px auto 40px;padding:0 18px;min-height:40vh}

/* numbers stay column-aligned in both scripts */
.num,.stat .value,.order-total b,td.right,th.right{font-variant-numeric:tabular-nums}

/* --------------------------------------------------------------- top bar */
.topbar{
  position:sticky;
  top:0;
  z-index:60;
  display:flex;
  align-items:center;
  gap:16px;
  min-height:var(--nav-h);
  padding:0 18px;
  background:linear-gradient(180deg,#1a6b3c 0%,var(--brand-ink) 100%);
  color:#fff;
  box-shadow:0 1px 0 rgba(255,255,255,.06) inset, 0 6px 20px rgba(15,58,34,.22);
}
.topbar .brand a{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  font-size:1.15rem;
  letter-spacing:.06em;
  color:#fff;
}
.topbar .brand a::before{
  content:"";
  width:9px;height:9px;
  border-radius:50%;
  background:#8ee7ad;
  box-shadow:0 0 0 4px rgba(142,231,173,.22);
}
.topbar .brand a:hover{text-decoration:none;opacity:.92}

.nav-panel{display:flex;flex:1;align-items:center;gap:16px;justify-content:space-between;min-width:0}
.nav-panel-head{display:none}

.mainnav{display:flex;align-items:center;gap:2px;flex-wrap:wrap;min-width:0}
.mainnav a{
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:8px 12px;
  border-radius:var(--pill);
  color:#dff1e6;
  font-size:13.5px;
  font-weight:600;
  white-space:nowrap;
  transition:background .15s ease,color .15s ease;
}
.mainnav a:hover{background:rgba(255,255,255,.12);color:#fff;text-decoration:none}
.mainnav a.is-active{background:rgba(255,255,255,.17);color:#fff;box-shadow:inset 0 0 0 1px rgba(255,255,255,.14)}
.ic{width:17px;height:17px;flex:none}

.topright{display:flex;align-items:center;gap:10px}
.who{display:inline-flex;align-items:center;gap:8px;color:#e8f5ee}
.who-avatar{
  width:30px;height:30px;
  display:grid;place-items:center;
  border-radius:50%;
  background:rgba(255,255,255,.16);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.2);
  font-weight:800;font-size:13px;color:#fff;
}
.who-text{display:flex;flex-direction:column;line-height:1.15}
.who-text b{font-size:13px;font-weight:700}
.who-text small{font-size:11px;color:#b9e0c8}

.lang{
  display:inline-flex;align-items:center;gap:6px;
  padding:6px 12px;
  border:1px solid rgba(255,255,255,.32);
  border-radius:var(--pill);
  color:#fff;font-size:13px;font-weight:600;
}
.lang:hover{background:rgba(255,255,255,.14);text-decoration:none}

.nav-toggle,.nav-close{
  display:none;
  align-items:center;justify-content:center;
  width:40px;height:40px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:11px;
  background:rgba(255,255,255,.08);
  color:#fff;cursor:pointer;
}
.nav-toggle .ic,.nav-close .ic{width:20px;height:20px}
.nav-scrim{display:none}

/* iOS Safari turns a tap-and-hold on UI chrome into a text-selection
   gesture (blue handles + Copy/Look Up popup), which also eats the tap
   that should have registered as a click - a link can look like it did
   nothing, or the drawer can appear to "close" as the selection popup is
   dismissed. Keep chrome controls non-selectable; data users actually
   want to copy (tables, receipts, inputs) is left untouched. */
.topbar,.bottomnav,.nav-panel,.nav-scrim,
.btn,.btn-primary,.btn-ghost,.btn-danger,.btn-warn,
.chip,.pager-btn,.cart-fab{
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
}

/* Removes the ~300ms tap delay / double-tap-zoom ambiguity so links and
   buttons respond immediately on iOS. */
a,button{touch-action:manipulation}

/* ---------------------------------------------------------------- buttons */
.btn,.btn-primary,.btn-ghost,.btn-danger,.btn-warn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-height:38px;
  padding:8px 15px;
  border-radius:var(--pill);
  border:1px solid var(--line);
  background:var(--surface);
  cursor:pointer;
  font-size:13.5px;
  font-weight:600;
  font-family:inherit;
  color:var(--text-2);
  white-space:nowrap;
  box-shadow:var(--sh-1);
  transition:transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover{background:var(--surface-2);border-color:#d5ded8;text-decoration:none}
.btn-primary{
  background:linear-gradient(180deg,#1a8c46 0%,var(--brand) 100%);
  color:#fff;border-color:var(--brand-strong);
  box-shadow:0 1px 2px rgba(14,32,22,.12), 0 6px 16px rgba(21,128,61,.22);
}
.btn-primary:hover{background:linear-gradient(180deg,var(--brand) 0%,var(--brand-strong) 100%);text-decoration:none}
.btn-danger{background:var(--danger);color:#fff;border-color:#c81e1e}
.btn-danger:hover{background:#b91c1c;text-decoration:none}
.btn-warn{background:var(--warn);color:#fff;border-color:#a86209}
.btn-warn:hover{background:#a86209;text-decoration:none}
.btn-ghost{background:rgba(255,255,255,.08);color:#fff;border-color:rgba(255,255,255,.32);box-shadow:none}
.btn-ghost:hover{background:rgba(255,255,255,.16);text-decoration:none}
.card .btn-ghost{color:var(--brand);border-color:var(--line);background:var(--surface)}
.btn:active,.btn-primary:active,.btn-danger:active,.btn-warn:active{transform:translateY(1px)}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--brand);outline-offset:2px}

/* ------------------------------------------------------------------ cards */
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:4px 0 20px}
.page-head h1{margin:0}
.page-sub{margin:5px 0 0;color:var(--muted);font-size:13px}

.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  padding:20px;
  box-shadow:var(--sh-2);
  margin-bottom:18px;
}
.card > h3:first-child{margin-bottom:14px}
.section-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:14px;flex-wrap:wrap}
.section-head h3{margin:0}
.section-head .search-input{max-width:260px}

/* ------------------------------------------------------------ stat cards */
.stat-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(228px,1fr));
  gap:16px;
  margin:0 0 26px;
}
.stat{
  position:relative;
  display:flex;
  flex-direction:column;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  padding:18px 18px 20px;
  box-shadow:var(--sh-2);
  overflow:hidden;
  transition:transform .16s ease, box-shadow .16s ease;
}
.stat::before{
  content:"";
  position:absolute;
  inset-block-start:0;
  inset-inline:0;
  height:3px;
  background:linear-gradient(90deg,var(--brand) 0%,#4ade80 100%);
  opacity:.9;
}
.stat:hover{transform:translateY(-2px);box-shadow:var(--sh-3)}
.stat-icon{
  width:38px;height:38px;
  display:grid;place-items:center;
  border-radius:12px;
  background:var(--brand-100);
  color:var(--brand-ink);
  font-weight:800;font-size:15px;
  margin-bottom:14px;
  box-shadow:inset 0 0 0 1px var(--brand-200);
}
.stat-icon .ic{width:19px;height:19px}
.stat .label{
  font-size:11.5px;
  font-weight:700;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.055em;
}
body.rtl .stat .label{text-transform:none;letter-spacing:0;font-size:12.5px}
.stat .value{font-size:2rem;font-weight:800;color:var(--text);margin-top:7px;line-height:1.15;letter-spacing:-.02em}
.stat .value.positive,.pos{color:var(--brand)}
.stat .value.negative,.neg{color:var(--danger)}
.stat .sub{font-size:12px;color:var(--muted);margin-top:5px}
.stat--danger::before{background:linear-gradient(90deg,var(--danger) 0%,#f87171 100%)}
.stat--danger .stat-icon{background:var(--danger-soft);color:var(--danger-ink);box-shadow:inset 0 0 0 1px #fecaca}
.stat--warn::before{background:linear-gradient(90deg,var(--warn) 0%,#fbbf24 100%)}
.stat--warn .stat-icon{background:var(--warn-soft);color:var(--warn-ink);box-shadow:inset 0 0 0 1px #fde68a}

/* ----------------------------------------------------------------- tables */
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;border-radius:var(--r);border:1px solid var(--line)}
table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:var(--surface);
  font-size:13.5px;
}
.card > table,.card > .table-wrap > table{border-radius:var(--r);overflow:hidden}
.card > table{border:1px solid var(--line)}
th,td{padding:11px 14px;text-align:start;border-bottom:1px solid var(--line-soft);vertical-align:middle}
th{
  background:var(--brand-50);
  color:var(--brand-ink);
  font-weight:700;
  font-size:11.5px;
  text-transform:uppercase;
  letter-spacing:.05em;
  border-bottom:1px solid var(--brand-200);
  white-space:nowrap;
}
body.rtl th{text-transform:none;letter-spacing:0;font-size:12.5px}
tbody tr:last-child td{border-bottom:none}
tbody tr:hover td{background:var(--brand-50)}
tfoot th{background:var(--surface-2);color:var(--brand-ink);border-top:1px solid var(--line);border-bottom:none;font-size:12.5px}
.row-actions{display:flex;gap:6px;flex-wrap:wrap}
.row-actions .btn,.row-actions .btn-danger{min-height:32px;padding:5px 11px;font-size:12.5px}

/* ------------------------------------------------------------ pagination */
.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  margin-top:16px;
  padding-top:15px;
  border-top:1px solid var(--line-soft);
}
.pager-info{font-size:12.5px;color:var(--muted)}
.pager-info b{color:var(--text-2)}
.pager-links{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.pager-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:5px;
  min-width:38px;min-height:38px;
  padding:6px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  color:var(--text-2);
  font-size:13px;font-weight:600;
  box-shadow:var(--sh-1);
}
.pager-btn:hover{background:var(--brand-50);border-color:var(--brand-200);color:var(--brand-ink);text-decoration:none}
.pager-btn.is-current{background:var(--brand);border-color:var(--brand-strong);color:#fff;box-shadow:0 4px 12px rgba(21,128,61,.25)}
.pager-btn.is-disabled{opacity:.42;pointer-events:none;box-shadow:none}
.rtl .pager-btn .chev{display:inline-block;transform:scaleX(-1)}

/* ------------------------------------------------------------------ forms */
form .row{display:flex;gap:14px;flex-wrap:wrap;margin-bottom:14px}
form label{display:block;font-size:12px;font-weight:700;color:var(--text-2);margin-bottom:6px}
input[type=text],input[type=number],input[type=password],input[type=tel],input[type=date],select,textarea,.search-input,input:not([type]){
  width:100%;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:var(--r-sm);
  font-size:14px;
  font-family:inherit;
  background:var(--surface);
  color:var(--text);
  transition:border-color .15s ease, box-shadow .15s ease;
}
input::placeholder{color:#9aa8a0}
input:focus,select:focus,textarea:focus,.search-input:focus{
  outline:none;
  border-color:var(--brand);
  box-shadow:var(--ring);
}
input[readonly]{background:var(--surface-2);color:var(--muted)}
.field{flex:1;min-width:168px}
.field-action{display:flex;align-items:flex-end;gap:8px}
.actions{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-top:12px}

/* ----------------------------------------------------------------- badges */
.badge{
  display:inline-block;
  padding:3px 10px;
  border-radius:var(--pill);
  font-size:11.5px;
  font-weight:700;
  line-height:1.5;
  white-space:nowrap;
}
.badge.tiny{font-size:10px;padding:1px 7px;text-transform:none}
.badge.green{background:var(--brand-100);color:var(--brand-ink)}
.badge.red{background:var(--danger-soft);color:var(--danger-ink)}
.badge.amber{background:var(--warn-soft);color:var(--warn-ink)}
.badge.gray{background:#eef2f0;color:var(--text-2)}
.badge.blue{background:#dbeafe;color:#1e3a8a}

.flash{padding:12px 15px;border-radius:var(--r);margin-bottom:16px;font-weight:600;font-size:13.5px}
.flash.ok{background:var(--brand-100);color:var(--brand-ink);border:1px solid var(--brand-200)}
.flash.err{background:var(--danger-soft);color:var(--danger-ink);border:1px solid #fecaca}

/* ------------------------------------------------------------------ login */
/* 100dvh after 100vh: on iPhone 100vh is taller than the visible area while
   the address bar shows, which pushed the card off-centre. */
.login-wrap{min-height:100vh;min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:24px}
.login-card{
  width:400px;max-width:100%;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:22px;
  padding:34px 30px;
  box-shadow:var(--sh-3);
}
.login-card h1{
  color:var(--brand-ink);text-align:center;margin-bottom:4px;
  font-size:1.9rem;letter-spacing:.08em;
}
.login-card .sub{text-align:center;color:var(--muted);margin-bottom:22px;font-size:13.5px}
/* .lang is styled white-on-green for the top bar; on the white login card that
   made the language switch invisible. */
.login-card .lang{color:var(--brand-ink);border-color:var(--line)}
.login-card .lang:hover{background:var(--brand-50)}

/* ------------------------------------------------------------------ chips */
.chips{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 16px}
.chip{
  padding:8px 14px;
  border:1px solid var(--line);
  border-radius:var(--pill);
  cursor:pointer;
  background:var(--surface);
  font-size:13px;font-weight:600;
  box-shadow:var(--sh-1);
  transition:all .14s ease;
}
.chip:hover{border-color:var(--brand-200);background:var(--brand-50)}
.chip.active{background:var(--brand);color:#fff;border-color:var(--brand-strong);box-shadow:0 4px 12px rgba(21,128,61,.24)}
.chip.disabled{opacity:.45;cursor:not-allowed}

.price-strip{display:flex;flex-wrap:wrap;gap:10px;margin:0 0 20px}
.price-chip{
  display:flex;flex-direction:column;gap:2px;
  padding:10px 16px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--sh-1);
}
.price-chip span{font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
body.rtl .price-chip span{text-transform:none;letter-spacing:0;font-size:12px}
.price-chip b{font-size:1.1rem;color:var(--text);font-variant-numeric:tabular-nums}

/* --------------------------------------------------------- product photos */
.thumb{
  width:46px;height:46px;
  border-radius:10px;
  object-fit:cover;                 /* fill the tile without distorting the photo */
  background:var(--surface-2);
  border:1px solid var(--line);
  display:block;
  flex:none;
}
.thumb-empty{
  display:grid;place-items:center;
  color:#a8b5ad;
  background:linear-gradient(180deg,var(--surface-2),#f1f5f2);
}
.thumb-lg{width:76px;height:76px;border-radius:var(--r)}
.col-thumb{width:62px}

.photo-field{display:flex;align-items:flex-start;gap:14px}
.photo-field-input{flex:1;min-width:0;display:flex;flex-direction:column;gap:7px}
.photo-field-input input[type=file]{
  width:100%;
  padding:8px 10px;
  border:1px dashed var(--line);
  border-radius:var(--r-sm);
  background:var(--surface-2);
  font-size:13px;
  font-family:inherit;
  color:var(--text-2);
  cursor:pointer;
}
.photo-field-input input[type=file]:hover{border-color:var(--brand-200);background:var(--brand-50)}
.photo-field-input small{font-size:11.5px}
.photo-remove{
  display:flex;align-items:center;gap:7px;
  margin:0;font-size:12.5px;font-weight:600;color:var(--danger-ink);
}
.photo-remove input{width:auto;margin:0}

/* photo on a POS product card */
.product-media{margin:-15px -15px 12px;background:var(--surface-2);border-bottom:1px solid var(--line-soft)}
.thumb-card{
  width:100%;height:120px;
  border:0;border-radius:var(--r) var(--r) 0 0;
  background:transparent;
}
.thumb-card.thumb-empty{border-radius:var(--r) var(--r) 0 0}

/* ------------------------------------------------------------- POS / sales */
.sales-layout{display:grid;grid-template-columns:minmax(0,1fr) 440px;gap:18px;align-items:start}
.sales-products{min-height:420px}
.product-card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(215px,1fr));gap:14px}
.product-card{
  display:flex;
  flex-direction:column;
  border:1px solid var(--line);
  border-radius:var(--r);
  padding:15px;
  background:var(--surface);
  box-shadow:var(--sh-1);
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.product-card:hover{transform:translateY(-2px);box-shadow:var(--sh-2);border-color:var(--brand-200)}
.product-topline{display:flex;align-items:center;justify-content:space-between;gap:10px}
.product-topline b{font-size:12.5px;letter-spacing:.03em;color:var(--muted)}
.product-name{font-weight:700;margin:9px 0 4px;font-size:14.5px;line-height:1.35}
.product-price{
  font-size:1.15rem;font-weight:800;color:var(--brand);
  font-variant-numeric:tabular-nums;margin-bottom:12px;
}
.product-price small{font-size:11px;font-weight:600;color:var(--muted)}
.product-add-form{display:grid;gap:9px;margin-top:auto}
.inline-add{display:grid;grid-template-columns:72px 1fr;gap:8px}

.cart-panel{position:sticky;top:calc(var(--nav-h) + 16px)}
.cart-table{font-size:13px}
.cart-qty{width:72px;text-align:center}
.scan-card{border-color:var(--brand-200);background:linear-gradient(180deg,var(--brand-50) 0%,var(--surface) 65%)}
.scan-card .row{margin-bottom:0;align-items:flex-end}
.scan-result{margin-top:13px;padding:11px 14px;border-radius:var(--r);font-weight:600;font-size:13.5px}
.scan-result.ok{background:var(--brand-100);color:var(--brand-ink)}
.scan-result.err{background:var(--danger-soft);color:var(--danger-ink)}

.variant-entry{border-top:1px solid var(--line-soft);padding-top:16px;margin-top:8px}
.variant-row{align-items:flex-end}

.totals-box{
  display:grid;gap:11px;margin-top:16px;padding:16px;
  background:var(--surface-2);
  border:1px solid var(--line-soft);
  border-radius:var(--r);
}
.totals-box>div{display:flex;align-items:center;justify-content:space-between;gap:10px}
.totals-box span{color:var(--muted);font-size:13px;font-weight:600}
.totals-box b{font-variant-numeric:tabular-nums}
.discount-line{display:grid!important;grid-template-columns:auto minmax(80px,1fr) 92px;gap:8px;align-items:center}
.discount-line label{margin-bottom:0}
.order-total{
  display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  border-top:1px dashed var(--line);padding-top:14px;margin-top:2px;
}
.order-total b{font-size:1.9rem;color:var(--brand);font-weight:800;letter-spacing:-.02em}
.btn-complete{width:100%;min-height:50px;font-size:1rem;font-weight:800}
.payment-extra{display:none}
.payment-extra.active{display:block}

/* floating jump-to-cart button (phones only) */
.cart-fab{display:none}

/* --------------------------------------------------------- returns/debts */
/* Cells whose content is a form, not a value: they need room and must not be
   squeezed to the width of their text. */
.cell-form{min-width:230px}
.returns-table{min-width:900px}          /* .table-wrap scrolls it on tablets */

.user-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.user-pass-form{display:inline-flex;gap:6px;align-items:center}
.user-pass-form input[type=password]{width:150px}

.mini-return-form{display:grid;grid-template-columns:80px minmax(130px,1fr) auto;gap:8px;align-items:center}
.exchange-form{grid-template-columns:70px minmax(200px,1fr) auto minmax(110px,1fr) auto}
.replacement-form{grid-template-columns:70px minmax(200px,1fr) auto minmax(110px,1fr) auto}
.exchange-diff{white-space:nowrap;text-align:center}
.debt-pay-form{display:grid;grid-template-columns:110px minmax(120px,1fr) auto auto;gap:8px;align-items:center}

/* --------------------------------------------------------------- receipt */
/* A receipt with many lines is taller than a phone screen. The overlay scrolls,
   and the box is centred with margin:auto instead of align-items:center, which
   cut off the top of a tall box and left Print/Close below the screen. */
.receipt-modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:flex-start;
  justify-content:center;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:18px;
  background:rgba(9,20,14,.66);
  backdrop-filter:blur(2px);
  z-index:1000;
}
.receipt-modal.active{display:flex}
.receipt-modal-box{
  margin:auto;
  width:320px;
  max-width:calc(100vw - 24px);
  background:#fff;
  border-radius:var(--r);
  padding:14px;
  box-shadow:0 24px 60px rgba(0,0,0,.4);
}
/* Kurdish letters on the receipt. Courier New has Arabic-script letters, but
   it spaces them out like typewriter text, so a Kurdish name came out hard to
   read. This alias covers ONLY the Arabic-script range: Kurdish text uses a
   proper joined font, while Latin letters and every number keep Courier. */
@font-face{
  font-family:"Humtto Receipt Kurdish";
  src:local("Tahoma"),local("Segoe UI"),local("Noto Naskh Arabic"),local("Noto Sans Arabic");
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF;
}
.receipt-card{
  width:100%;
  padding:8px 6px;
  background:#fff;
  color:#000;
  font-family:"Humtto Receipt Kurdish","Courier New",Courier,monospace;
  font-size:13px;
  line-height:1.38;
  white-space:normal;
  /* Money columns stay left-to-right even in Kurdish mode. Item names carry
     dir="auto" individually, so a Kurdish name still reads right-to-left. */
  direction:ltr;
}
/* the standalone receipt.php page: a real 80mm slip rather than a modal card */
.receipt-card--paper{width:76mm;max-width:100%;padding:4mm 3mm}

/* Drawn, not typed: a run of "=" characters only lines up with the paper edge
   at one exact font size. A border always spans the full slip width. */
.receipt-edge,.receipt-rule{border-top:1px dashed #000;margin:6px 0}
.receipt-edge{border-top:3px double #000;margin:4px 0}
.receipt-title{text-align:center;font-size:17px;font-weight:700;line-height:1.25;letter-spacing:.12em}
.receipt-centered{text-align:center}
.receipt-status{font-weight:700;text-transform:uppercase}

/* label / value pairs: customer, cashier, payment */
.receipt-meta>div{display:flex;justify-content:space-between;gap:10px;align-items:baseline}
.receipt-meta span{flex:none}
.receipt-meta b{text-align:right;overflow-wrap:anywhere;font-weight:700}
.receipt-pay{margin-top:2px}

/* one item = name line, code/variant line, then "qty x price ...... amount" */
.receipt-item{margin:3px 0}
.receipt-item-name{font-weight:700;overflow-wrap:anywhere}
.receipt-item-sub{font-size:11.5px}
.receipt-item-calc{display:flex;justify-content:space-between;gap:10px}
.receipt-item-calc b{font-weight:700}

.receipt-title--joined{letter-spacing:0}
.receipt-sums{margin-bottom:4px}
.receipt-total{
  display:flex;justify-content:space-between;align-items:baseline;gap:12px;
  font-weight:700;font-size:18px;
  border-top:2px solid #000;border-bottom:2px solid #000;
  padding:4px 0;margin:4px 0 6px;
}
.receipt-thanks{text-align:center;font-weight:700}
.receipt-modal-actions{display:flex;justify-content:center;gap:10px;margin-top:14px}

/* --------------------------------------------------------- monthly report */
.report-sheet{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  padding:22px;
  box-shadow:var(--sh-2);
  margin-bottom:18px;
}
.report-head{
  display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap;
  padding-bottom:14px;margin-bottom:18px;
  border-bottom:2px solid var(--brand-200);
}
.report-title{margin:0;font-size:1.15rem;letter-spacing:.02em}
.report-period{margin:4px 0 0;font-size:1.35rem;font-weight:800;color:var(--brand-ink)}
.report-generated{margin:0;font-size:12px}
.report-list-title{margin-top:24px}
.report-summary{max-width:520px}
.report-summary th{
  background:transparent;color:var(--text-2);
  text-transform:none;letter-spacing:0;font-size:13px;white-space:normal;
  border-bottom:1px solid var(--line-soft);
}
.report-summary td{font-variant-numeric:tabular-nums;font-size:14px}
/* inside / outside the store: a smaller breakdown line under Revenue */
.report-summary tr.report-sub th{padding-inline-start:30px;font-size:12.5px;color:var(--muted);font-weight:600}
.report-summary tr.report-sub td{font-size:12.5px;color:var(--text-2)}
.report-summary tfoot th,.report-summary tfoot td{
  background:var(--brand-50);
  font-size:15px;font-weight:800;color:var(--brand-ink);
  border-top:2px solid var(--brand-200);
}

/* ------------------------------------------------------- clickable stat card */
/* A stat that is also a link (Stock Summary -> stock.php). Same box as .stat,
   plus a chevron so it reads as something you can open. */
a.stat{text-decoration:none;color:inherit;cursor:pointer}
a.stat:hover{border-color:var(--brand-200)}
a.stat::after{
  content:"›";
  position:absolute;
  inset-block-start:16px;
  inset-inline-end:16px;
  font-size:22px;line-height:1;
  color:var(--muted);
  transition:transform .16s ease,color .16s ease;
}
[dir="rtl"] a.stat::after{content:"‹"}
a.stat:hover::after{color:var(--brand);transform:translateX(2px)}
[dir="rtl"] a.stat:hover::after{transform:translateX(-2px)}
a.stat:focus-visible{outline:2px solid var(--brand);outline-offset:2px}

/* ------------------------------------------------------------ stock overview */
/* Summary first: four compact tiles. The Low / Out tiles are links that apply
   the matching filter, so the number you click is the number you get. */
.stock-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:0 0 18px}
.stock-kpi{
  position:relative;
  display:flex;flex-direction:column;gap:2px;
  padding:14px 16px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-1);
  color:inherit;
  overflow:hidden;
}
.stock-kpi::before{content:"";position:absolute;inset-block-start:0;inset-inline:0;height:3px;background:var(--brand)}
.stock-kpi-label{font-size:11.5px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
body.rtl .stock-kpi-label{text-transform:none;letter-spacing:0;font-size:12.5px}
.stock-kpi-value{font-size:1.7rem;font-weight:800;line-height:1.2;font-variant-numeric:tabular-nums;text-align:start}
.stock-kpi-sub{font-size:12px;color:var(--muted)}
.stock-kpi--low::before{background:var(--warn)}
.stock-kpi--low .stock-kpi-value{color:var(--warn-ink)}
.stock-kpi--out::before{background:var(--danger)}
.stock-kpi--out .stock-kpi-value{color:var(--danger)}
a.stock-kpi:hover{text-decoration:none;border-color:var(--brand-200);box-shadow:var(--sh-2)}
a.stock-kpi.is-on{border-color:var(--brand);box-shadow:var(--ring)}

/* one bar: search on the first line, category + status chips on the next */
.stock-tools{padding:16px 18px}
.stock-search-row{display:flex;gap:8px;align-items:center}
.stock-search-row .search-input{flex:1;min-width:0}
.stock-filter-groups{display:flex;flex-wrap:wrap;gap:10px 28px;margin-top:12px}
.stock-filters{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.stock-filter-label{font-size:12px;font-weight:700;color:var(--muted);margin-inline-end:4px}
.stock-filters .chip{padding:6px 13px;color:var(--text-2)}
.stock-filters .chip:hover{text-decoration:none}
.stock-filters .chip.is-on{background:var(--brand);color:#fff;border-color:var(--brand-strong)}

/* the list: one row per product, colors/sizes open underneath on click */
.stock-card{padding:18px}
.card > table.stock-table{border:1px solid var(--line)}
.stock-table td{padding:9px 12px}
.stock-table th{padding:10px 12px}
.stock-table .st-photo{width:58px}
.stock-table .st-photo .thumb{width:40px;height:40px;border-radius:9px}
.stock-table .st-code b{font-size:13.5px;letter-spacing:.01em;white-space:nowrap}
.stock-table .st-name{color:var(--text-2);overflow-wrap:anywhere}
.stock-table .st-qty{white-space:nowrap}
.stock-table .st-qty b{font-size:15px}
.st-unit{font-size:12px;color:var(--muted)}
.stock-table .st-toggle{width:1%;white-space:nowrap;text-align:end}
.stock-row{cursor:pointer}
.stock-row.is-out .st-qty b{color:var(--danger)}
.stock-row.is-low .st-qty b{color:var(--warn-ink)}
.stock-table tbody .stock-row.is-open td{background:var(--brand-50)}
.stock-toggle{
  display:inline-flex;align-items:center;gap:4px;
  padding:4px 8px 4px 10px;
  border:1px solid var(--line);border-radius:var(--pill);
  background:var(--surface);color:var(--text-2);
  font:inherit;font-size:12px;font-weight:700;cursor:pointer;
}
.stock-toggle:hover{border-color:var(--brand-200);background:var(--brand-50)}
.stock-chev{transition:transform .15s ease}
.stock-toggle[aria-expanded="true"] .stock-chev{transform:rotate(180deg)}

.stock-table .stock-sizes td{background:var(--surface-2);padding:10px 12px 12px;border-bottom:1px solid var(--line)}
.stock-table tbody:last-of-type .stock-sizes td{border-bottom:0}
.stock-table tbody .stock-sizes:hover td{background:var(--surface-2)}
/* hidden only when JS is running, so without it nothing is out of reach */
.js-on .stock-sizes:not(.is-open){display:none}

.size-chips{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:6px}
.size-chip{
  display:inline-flex;align-items:center;gap:8px;
  padding:3px 4px 3px 10px;
  border:1px solid var(--line);border-radius:var(--pill);
  background:var(--surface);font-size:12.5px;
}
body.rtl .size-chip{padding:3px 10px 3px 4px}
.size-chip-label{font-weight:600;color:var(--text-2)}
.size-chip-qty{min-width:28px;padding:1px 8px;border-radius:var(--pill);text-align:center;font-variant-numeric:tabular-nums;background:var(--brand-100);color:var(--brand-ink)}
.size-chip.is-low{border-color:#fcd34d}
.size-chip.is-low .size-chip-qty{background:var(--warn-soft);color:var(--warn-ink)}
.size-chip.is-out{border-color:#fca5a5}
.size-chip.is-out .size-chip-qty{background:var(--danger-soft);color:var(--danger-ink)}

/* stock_print.php - the A4 sheet */
.stock-print-summary{margin:0 0 12px;font-size:12.5px;color:var(--text-2)}
.stock-print-table{border:1px solid var(--line)}
.stock-print-table th,.stock-print-table td{padding:6px 8px}
.stock-print-sizes{font-size:11.5px;color:var(--text-2)}
.sp-size{white-space:nowrap}

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

/* --------------------------------------------------- full reset (danger page) */
.danger-card{
  background:var(--surface);
  border:1px solid #fca5a5;
  border-inline-start:4px solid var(--danger);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-2);
  padding:20px;
  margin-bottom:18px;
}
.danger-card h2,.danger-card h3{margin-top:0;color:var(--danger-ink)}
.danger-note{
  background:var(--danger-soft);
  border-radius:var(--r);
  padding:12px 14px;
  color:var(--danger-ink);
  font-weight:600;
  margin:0 0 16px;
}
.reset-steps{display:flex;flex-direction:column;gap:14px}
.reset-step{border:1px solid var(--line);border-radius:var(--r);padding:16px;background:var(--surface)}
.reset-step.is-done{border-color:var(--brand-200);background:var(--brand-50)}
.reset-step h3{margin:0 0 10px;font-size:15px}
.reset-confirm-input{max-width:260px;letter-spacing:.22em;text-transform:uppercase;font-weight:700}
.reset-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
@media (max-width:700px){
  .reset-grid{grid-template-columns:1fr}
}

/* the month currently open below the All Months table */
tr.is-current-month > td{background:var(--brand-50)}
tr.is-current-month a{font-weight:800}

/* --------------------------------------------------------------- helpers */
.muted{color:var(--muted)}
.right{text-align:end}
.center{text-align:center}
hr{border:none;border-top:1px solid var(--line-soft);margin:18px 0}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.footer{text-align:center;color:var(--muted);padding:26px 16px;font-size:12px}
.skip-link{position:absolute;inset-inline-start:-9999px}

/* -------------------------------------------------------- bottom nav bar */
.bottomnav{display:none}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* tablets and below: drawer navigation + bottom bar */
@media (max-width:900px){
  .nav-toggle{display:inline-flex}
  .nav-close{display:inline-flex}

  .topbar{padding:0 12px;gap:10px}
  .topbar .brand{flex:1}

  .nav-panel{
    position:fixed;
    inset-block:0;
    inset-inline-start:0;
    width:min(84vw,320px);
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    gap:0;
    padding:14px;
    background:linear-gradient(180deg,#1a6b3c 0%,var(--brand-ink) 55%);
    box-shadow:0 0 60px rgba(0,0,0,.4);
    transform:translateX(-100%);
    transition:transform .22s ease;
    overflow-y:auto;
    z-index:80;
  }
  [dir="rtl"] .nav-panel{transform:translateX(100%)}
  body.nav-open .nav-panel{transform:translateX(0)}

  .nav-panel-head{
    display:flex;align-items:center;justify-content:space-between;
    padding:2px 4px 16px;margin-bottom:10px;
    border-bottom:1px solid rgba(255,255,255,.16);
  }
  .brand-mark{color:#fff;font-weight:800;letter-spacing:.08em}

  .mainnav{flex-direction:column;align-items:stretch;gap:3px;flex-wrap:nowrap}
  .mainnav a{padding:11px 13px;border-radius:11px;font-size:14.5px}

  .topright{
    flex-direction:column;align-items:stretch;gap:10px;
    margin-top:auto;padding-top:16px;
    border-top:1px solid rgba(255,255,255,.16);
  }
  .lang,.topright .btn-ghost{justify-content:flex-start;border-radius:11px;min-height:42px}
  .who{padding:4px 2px}

  .nav-scrim{
    display:block;position:fixed;inset:0;z-index:70;
    background:rgba(9,20,14,.5);
    opacity:0;pointer-events:none;transition:opacity .2s ease;
  }
  body.nav-open .nav-scrim{opacity:1;pointer-events:auto}
  /* The drawer sits inside .topbar, and a sticky element with a z-index is a
     stacking layer of its own: the drawer's z-index:80 only counts inside it,
     so the whole top bar - drawer included - ranked as 60, BELOW the scrim
     (70). The scrim covered the open drawer and took every tap: the menu
     closed and the page never opened. Lifting the top bar over the scrim
     while the drawer is open puts the drawer on top. */
  body.nav-open .topbar{z-index:90}

  /* bottom tab bar */
  body.has-nav .bottomnav{
    display:grid;
    grid-template-columns:repeat(5,1fr);
    position:fixed;
    inset-inline:0;
    inset-block-end:0;
    z-index:65;
    min-height:var(--bottomnav-h);
    padding-bottom:env(safe-area-inset-bottom);
    background:rgba(255,255,255,.97);
    backdrop-filter:blur(8px);
    border-top:1px solid var(--line);
    box-shadow:0 -6px 22px rgba(14,32,22,.09);
  }
  .bottomnav a,.bottomnav button{
    display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
    padding:9px 4px;border:0;background:none;cursor:pointer;
    color:var(--muted);font-size:10.5px;font-weight:700;font-family:inherit;
    text-decoration:none;line-height:1.2;text-align:center;
  }
  .bottomnav .ic{width:21px;height:21px}
  .bottomnav a.is-active{color:var(--brand)}
  .bottomnav a.is-active .ic{stroke-width:2.1}
  .bottomnav span{overflow:hidden;text-overflow:ellipsis;max-width:100%;white-space:nowrap}
  .bottomnav .bn-primary{color:var(--brand-ink)}
  .bottomnav .bn-primary .ic{
    width:40px;height:40px;padding:9px;margin-top:-20px;
    border-radius:50%;
    background:linear-gradient(180deg,#1a8c46,var(--brand));
    color:#fff;
    box-shadow:0 6px 16px rgba(21,128,61,.4);
    border:3px solid #fff;
  }

  /* + the home-indicator strip, which the bar itself adds on iPhones */
  body.has-nav .container{padding-bottom:calc(var(--bottomnav-h) + 18px + env(safe-area-inset-bottom))}
  body.has-nav .footer{padding-bottom:calc(var(--bottomnav-h) + 18px + env(safe-area-inset-bottom))}
  body.nav-open{overflow:hidden}

  .sales-layout,.grid-2{grid-template-columns:1fr}
  .cart-panel{position:static}
}

/* phones: card-style tables, single column, floating cart button */
@media (max-width:700px){
  .container{margin:16px auto 24px;padding:0 12px}
  .card{padding:15px;border-radius:var(--r)}
  h1{font-size:1.35rem}
  .stat-grid{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
  .stat{padding:15px}
  .stat .value{font-size:1.6rem}
  .stat-icon{width:32px;height:32px;margin-bottom:10px}
  .section-head{align-items:stretch;flex-direction:column}
  .section-head .search-input{max-width:none}
  .product-card-grid{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:11px}
  .product-card{padding:12px}
  .product-media{margin:-12px -12px 10px}
  .thumb-card{height:96px}
  /* "Add to Cart" is nowrap, which gave every POS card a ~200px min-content
     floor. A grid 1fr track cannot shrink past its item's min-content, so two
     columns measured 413px inside a 366px row and scrolled the whole page
     sideways on a phone. Letting the label wrap drops that floor. */
  .inline-add{grid-template-columns:56px minmax(0,1fr)}
  .inline-add .btn-primary{white-space:normal;line-height:1.2;padding:7px 8px;font-size:12.5px}
  .photo-field{gap:11px}
  .thumb-lg{width:64px;height:64px}
  table.responsive tbody td.col-thumb{justify-content:space-between}
  .inline-add{grid-template-columns:64px 1fr}
  .mini-return-form,.exchange-form,.replacement-form,.discount-line,.debt-pay-form{grid-template-columns:1fr!important}
  .order-total b{font-size:1.55rem}
  .pager{justify-content:center}
  .pager-info{width:100%;text-align:center}

  /* one row = one card, with the column name in front of each value */
  table.responsive{border:0;background:transparent;font-size:13.5px}
  /* The table box itself has to stop being a table. While it stayed display:table
     a <tfoot> put the table back on the auto layout algorithm, which shrink-to-fits
     to the footer's columns - the reports list rendered its row cards at about 60%
     of the card width instead of filling it. */
  table.responsive,
  table.responsive tbody,
  table.responsive tfoot{display:block;width:100%}
  table.responsive tfoot tr{
    display:flex;align-items:baseline;justify-content:space-between;gap:10px;
    padding:11px 14px;margin-top:2px;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:var(--r);
  }
  table.responsive tfoot th{background:transparent;border:0;padding:0;text-align:start}
  table.responsive tfoot th:empty{display:none}
  .table-wrap:has(table.responsive){border:0;overflow:visible}
  table.responsive thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  table.responsive tbody tr{
    display:block;
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:var(--r);
    box-shadow:var(--sh-1);
    margin-bottom:11px;
    overflow:hidden;
  }
  table.responsive tbody tr:hover td{background:transparent}
  table.responsive tbody td{
    display:flex;align-items:center;justify-content:space-between;gap:14px;
    padding:9px 14px;
    text-align:end;
    border-bottom:1px solid var(--line-soft);
  }
  table.responsive tbody td:last-child{border-bottom:0;justify-content:flex-end}
  table.responsive tbody td[data-th]::before{
    content:attr(data-th);
    flex:0 0 auto;
    font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
    color:var(--muted);text-align:start;
  }
  body.rtl table.responsive tbody td[data-th]::before{text-transform:none;letter-spacing:0;font-size:12px}
  table.responsive tbody td .cart-qty{width:80px}
  table.responsive tbody td.center{justify-content:center}

  /* a min-width meant for the desktop scroll container would defeat card mode */
  table.responsive{min-width:0!important}
  .returns-table{min-width:0}

  /* a cell holding a form gets the full card width, label above the controls,
     instead of trying to sit beside it in a flex row */
  table.responsive tbody td.cell-form{display:block;text-align:start}
  table.responsive tbody td.cell-form[data-th]::before{display:block;margin-bottom:7px}
  table.responsive tbody td.cell-form form{width:100%}
  .cell-form{min-width:0}
  .user-actions{flex-direction:column;align-items:stretch}
  .user-pass-form{display:flex}
  .user-pass-form input[type=password]{width:auto;flex:1;min-width:0}

  /* tables that were not converted still scroll instead of breaking the page */
  .card > table{display:block;overflow-x:auto;white-space:nowrap}

  /* jump straight to the cart from anywhere on the POS screen */
  .cart-fab{
    display:flex;align-items:center;gap:10px;
    position:fixed;
    inset-inline:12px;
    inset-block-end:calc(var(--bottomnav-h) + 12px + env(safe-area-inset-bottom));
    z-index:55;
    padding:12px 16px;
    border-radius:var(--pill);
    background:linear-gradient(180deg,#1a8c46,var(--brand-strong));
    color:#fff;font-weight:700;font-size:13.5px;
    box-shadow:0 10px 26px rgba(15,58,34,.34);
  }
  .cart-fab:hover{text-decoration:none;color:#fff}
  .cart-fab b{margin-inline-start:auto;font-variant-numeric:tabular-nums}
  .cart-fab-count{
    display:grid;place-items:center;
    min-width:23px;height:23px;padding:0 6px;
    border-radius:var(--pill);
    background:rgba(255,255,255,.24);
    font-size:12px;
  }
}

@media (max-width:420px){
  /* minmax(0,...) not 1fr: a plain 1fr floors at the item's min-content width */
  .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .product-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .bottomnav span{font-size:9.5px}
  /* two stat cards across ~390px leaves ~150px of usable width: a seven-figure
     IQD total overflowed the tile at the larger size */
  .stat{padding:13px}
  .stat .value{font-size:1.25rem;overflow-wrap:anywhere}
  .stat .label{font-size:10.5px}
  .stat .sub{font-size:11px;overflow-wrap:anywhere}
  .page-head .actions{width:100%}
  .page-head .actions > *,
  .page-head .actions form{flex:1 1 46%}
  .page-head .actions .btn,
  .page-head .actions .btn-primary,
  .page-head .actions .btn-warn{width:100%}
  .report-head{gap:6px}
  .report-period{font-size:1.15rem}
}

/* stock overview on a tablet / phone */
@media (max-width:900px){
  .stock-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
}
@media (max-width:700px){
  .stock-kpi{padding:10px 12px;border-radius:var(--r)}
  .stock-kpi-value{font-size:1.3rem}
  .stock-kpi-sub{font-size:11px;line-height:1.35}
  .stock-tools{padding:12px}
  .stock-filter-groups{flex-direction:column;gap:8px;margin-top:10px}
  .stock-filters .chip{padding:5px 11px;font-size:12.5px}
  .stock-card{padding:12px}
  .stock-card .section-head{margin-bottom:6px}
  .stock-card .section-head h3,.stock-page-head .page-sub{display:none}
  .stock-kpi--plain .stock-kpi-sub{display:none}

  /* one product = one card: photo on the side, code + status on top, the
     name under it, then category, quantity and the sizes button */
  .card > table.stock-table{display:block;border:0;overflow:visible;white-space:normal;border-radius:0;background:transparent}
  .stock-table tbody{display:block}
  .stock-table thead{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}
  .stock-table .stock-row{
    display:grid;
    grid-template-columns:44px auto minmax(0,1fr) auto;
    grid-template-areas:
      "photo code code status"
      "photo name name name"
      "photo cat  qty  toggle";
    column-gap:10px;row-gap:3px;align-items:center;
    margin-top:10px;padding:11px 12px;
    background:var(--surface);
    border:1px solid var(--line);border-radius:var(--r);
    box-shadow:var(--sh-1);
  }
  .stock-table .stock-row td{display:block;padding:0;border:0;background:transparent!important;width:auto}
  .stock-table .st-photo{grid-area:photo;align-self:start}
  .stock-table .st-code{grid-area:code}
  .stock-table .st-status{grid-area:status;justify-self:end}
  .stock-table .st-name{grid-area:name;font-size:13.5px;line-height:1.35}
  .stock-table .st-cat{grid-area:cat}
  .stock-table .st-qty{grid-area:qty;text-align:start}
  .stock-table .st-toggle{grid-area:toggle;justify-self:end}
  .stock-table .stock-row.is-open{border-end-start-radius:0;border-end-end-radius:0;background:var(--brand-50);border-color:var(--brand-200)}
  .stock-table .stock-sizes{display:block}
  .stock-table .stock-sizes td{
    display:block;padding:10px 12px;
    border:1px solid var(--brand-200);border-top:0;
    border-radius:0 0 var(--r) var(--r);
  }
  .stock-table tbody:last-of-type .stock-sizes td{border-bottom:1px solid var(--brand-200)}
}

/* ------------------------------------------------------- touch screens */
@media (max-width:900px), (pointer:coarse){
  /* iOS Safari zooms the page into any text field under 16px when it is
     tapped, and stays zoomed in after you leave it. */
  input[type=text],input[type=number],input[type=password],input[type=tel],input[type=date],input[type=search],
  select,textarea,.search-input,input:not([type]){font-size:16px}

  /* 44px is the smallest target a finger hits reliably (Apple's guideline). */
  .btn,.btn-primary,.btn-ghost,.btn-danger,.btn-warn,
  .row-actions .btn,.row-actions .btn-danger,
  .lang,.topright .btn-ghost,.stock-toggle{min-height:44px}
  .pager-btn{min-height:44px;min-width:44px}
  .chip{display:inline-flex;align-items:center;min-height:44px}
  .nav-toggle,.nav-close{width:44px;height:44px}
}
/* a form that is on its way: see the submit guard in includes/footer.php */
.is-sending{opacity:.6;pointer-events:none}

@media (prefers-reduced-motion:reduce){
  *{transition:none!important;animation:none!important}
}

/* ------------------------------------------------------------------ print */
/*
   No @page rule lives here on purpose. It used to force "size:80mm auto" on
   EVERY page, so Ctrl+P on any screen produced a receipt-width page. Each page
   that is meant to be printed now declares its own paper: receipt.php asks for
   an 80mm roll, reports.php asks for A4 (see $__extraHead in includes/header.php).

   The old rule also isolated the receipt with `body *{visibility:hidden}` and
   an absolutely-positioned card. Printing now goes through receipt.php, which
   is a page containing nothing but the slip, so no isolation trick is needed
   and a long receipt can flow onto a second length of paper instead of being
   clipped.
*/
@media print{
  /* app chrome is never part of a printout */
  .topbar,.bottomnav,.nav-panel,.nav-scrim,.cart-fab,.footer,
  .no-print,.receipt-modal,.pager,.row-actions{display:none!important}

  body{background:#fff!important;background-image:none!important;color:#000!important}
  .container{max-width:none!important;margin:0!important;padding:0!important}
  body.has-nav .container{padding-bottom:0!important}

  /* flat, ink-cheap surfaces */
  .card,.report-sheet{
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    padding:0!important;
    margin:0 0 10px!important;
    background:#fff!important;
  }
  .table-wrap{overflow:visible!important;border:0!important}
  table{font-size:11.5px!important}
  th{background:#f2f2f2!important;color:#000!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  /* the summary's left column is a row label, not a column header */
  .report-summary th{background:transparent!important}
  .report-summary tfoot th,.report-summary tfoot td{background:#f2f2f2!important}
  .badge{border:1px solid #999!important;background:transparent!important;color:#000!important}

  /* keep report rows whole and repeat the header on every sheet */
  thead{display:table-header-group}
  tr,.receipt-item{break-inside:avoid;page-break-inside:avoid}
  .report-head{border-bottom:2px solid #000!important}
  .report-list-title{break-before:auto}

  a{color:#000!important;text-decoration:none!important}
}
