/* Sari-Sari Tracker: "Tindahan Bold" theme. Phone first; wider screens get a sidebar and a side cart. */
:root {
  --ink: #2B1A0E;
  --ink-soft: #5C4030;
  --cream: #FFF6DC;
  --paper: #FFFFFF;
  --accent: #FFD23F;
  --accent-text: var(--accent);   /* accent used as text on dark (ink) backgrounds */
  --on-accent: var(--ink);        /* text on accent backgrounds */
  --side: #1E4D2B; --side-ink: #F4F1E8; --side-active: #F2B233; --side-hover: #2A5E38; --side-badge: #C8372D;
  --tile-2: #FFE9A8;
  --tile-3: #D8F3E4;
  --good: #0B6B3A;
  --bad: #A3260E;
  --display: 'Baloo 2', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--body); background: var(--cream); color: var(--ink);
  padding-bottom: 80px; -webkit-tap-highlight-color: transparent;
}

/* ---------- header ---------- */
header {
  background: var(--accent); color: var(--on-accent); border-bottom: 4px solid var(--ink);
  padding: 16px 16px 14px; position: sticky; top: 0; z-index: 5;
}
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; max-width: 1200px; margin: 0 auto; }
.store-name { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.1; margin: 0; }
.badge { background: var(--ink); color: var(--accent-text); font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px auto 0; max-width: 1200px; }
.stat { color: var(--ink); background: var(--cream); border: 2px solid var(--ink); border-radius: 12px; padding: 7px 10px; display: flex; flex-direction: column; }
.stat span { font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.stat b { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.15; }
.stat b.good { color: var(--good); }
.stat b.bad { color: var(--bad); }

/* ---------- layout ---------- */
.shell { max-width: 1200px; margin: 0 auto; }
main { padding: 14px 16px; max-width: 680px; margin: 0 auto; }
h3 { font-family: var(--display); font-weight: 800; font-size: 20px; margin: 18px 0 8px; }

/* ---------- controls ---------- */
.card {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 16px;
  padding: 14px; margin-bottom: 12px; box-shadow: 3px 3px 0 var(--ink);
}
.card h3:first-child { margin-top: 0; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
input, select {
  width: 100%; font: 500 16px var(--body); padding: 11px 14px; min-height: 44px;
  border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); color: var(--ink);
}
input:focus, select:focus, button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.search { margin-bottom: 10px; }
button {
  font: 600 15px var(--body); border: 2px solid var(--ink); background: var(--paper); border-radius: 12px;
  padding: 8px 12px; min-height: 44px; cursor: pointer; color: var(--ink);
}
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--ink); color: var(--accent-text); }
button.big { width: 100%; padding: 14px; font-size: 16px; font-weight: 700; margin-top: 8px; display: block; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.small { padding: 4px 10px; font-size: 13px; min-height: 36px; }
button.link { border: none; background: none; color: var(--ink); padding: 6px 0; font-weight: 700; text-decoration: underline; }
.filebtn {
  display: block; text-align: center; cursor: pointer; border: 2px solid var(--ink); border-radius: 12px;
  padding: 14px; margin-top: 8px; background: var(--paper); font-size: 16px; font-weight: 700;
}

/* segmented: Paninda / GCash / Load */
.seg { display: flex; gap: 8px; margin-bottom: 12px; }
.seg button { flex: 1; font-weight: 700; background: var(--cream); }
.seg button.on { background: var(--ink); color: var(--accent-text); }

/* product tiles */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 6px;
  text-align: left; min-height: 96px; padding: 10px; border-radius: 16px; box-shadow: 3px 3px 0 var(--ink);
}
.tile:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.tile b { font-size: 13px; line-height: 1.2; font-weight: 700; }
.tile .price { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1; }
.tile small { font-size: 11px; font-weight: 600; color: var(--ink-soft); display: block; }
.tile.c1 { background: var(--paper); }
.tile.c2 { background: var(--tile-2); }
.tile.c3 { background: var(--tile-3); }
.tile.out { background: #E8E1D0; }
.low { color: var(--bad) !important; font-weight: 700; }
.owe { color: var(--bad); }

/* rows */
.line {
  display: flex; align-items: center; gap: 8px; background: var(--paper); border: 2px solid var(--ink);
  border-radius: 12px; padding: 10px; margin-bottom: 8px; width: 100%;
}
.line.tap { cursor: pointer; }
.line .grow { flex: 1; min-width: 0; }
.line small { display: block; color: var(--ink-soft); font-size: 12px; }
.line .qty { min-width: 24px; text-align: center; }
.line b { white-space: nowrap; }
.total {
  display: flex; justify-content: space-between; font-family: var(--display); font-size: 22px; font-weight: 800;
  padding: 10px 4px; border-top: 2px dashed var(--ink); margin-top: 8px;
}
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }

/* checkout bar (dark) */
.checkout {
  background: var(--ink); color: var(--cream); border-radius: 16px; padding: 12px 14px; margin-top: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.checkout .row { display: flex; align-items: center; gap: 12px; }
.checkout .sum { flex: 1; display: flex; flex-direction: column; }
.checkout .sum span { font-size: 12px; color: #E9D9B0; }
.checkout .sum b { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; }
.checkout label { color: #E9D9B0; }
.checkout select { border-color: var(--cream); }
.checkout .pay { background: var(--accent); color: var(--on-accent); border-color: var(--accent-text); font-weight: 800; font-size: 16px; padding: 0 20px; min-height: 50px; }
.checkout .field { margin-bottom: 0; }

/* bottom tabs */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--paper); border-top: 2px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); z-index: 6;
}
nav button {
  border: none; border-radius: 0; padding: 8px 0 12px; font-size: 12px; font-weight: 600; background: none; color: #6B5545;
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 56px;
}
nav button[data-ledger] { display: none; }
.side-brand, .side-badge { display: none; }
nav button::before { content: ''; width: 24px; height: 6px; border-radius: 3px; background: transparent; }
nav button.on { color: var(--ink); font-weight: 800; }
nav button.on::before { background: var(--accent); outline: 2px solid var(--ink); }

#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--accent-text);
  padding: 10px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s; pointer-events: none;
  font-size: 14px; font-weight: 700; max-width: 90%; text-align: center; z-index: 10;
}
#toast.show { opacity: 1; }

/* small phones */
@media (max-width: 360px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat b { font-size: 17px; }
}

/* ---------- tablets and PC ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  header { padding: 18px 28px 16px; }
  .store-name { display: none; } /* computer: the sidebar shows the store name */
  .stats { grid-template-columns: repeat(3, minmax(0, 220px)); justify-content: start; }
  .shell { display: flex; align-items: flex-start; gap: 24px; padding: 20px 28px; margin-left: 240px; max-width: none; }
  header { margin-left: 240px; }
  nav {
    position: fixed; top: 0; bottom: 0; left: 0; width: 240px; z-index: 7; overflow-y: auto;
    display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
    background: var(--side); color: var(--side-ink); border: none; border-radius: 0; box-shadow: none;
  }
  .side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 20px; }
  .side-logo { width: 46px; height: 46px; border-radius: 12px; flex: none; }
  .side-name { display: block; font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.1; }
  .side-brand small { font-size: 12px; opacity: 0.8; }
  nav button {
    flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; min-height: 48px; width: 100%;
    border-radius: 12px; font-size: 15px; color: var(--side-ink); background: none; font-weight: 600;
  }
  nav button:hover { background: var(--side-hover); }
  nav button::before { display: none; }
  nav button.on { background: var(--side-active); color: #2B1A0E; font-weight: 800; }
  nav button .nav-ic { width: 26px; height: 26px; background: none; color: inherit; flex: none; }
  nav button .nav-ic .ic { width: 22px; height: 22px; }
  nav button.on .nav-ic { background: none !important; outline: none !important; color: inherit; }
  nav button[data-ledger]:not([hidden]) { display: flex; }
  .side-badge { display: inline-block; margin-left: auto; background: var(--side-badge); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 2px 8px; }
  .side-badge[hidden] { display: none; }
  main { flex: 1; min-width: 0; max-width: none; padding: 0; margin: 0; }
  main > .card, main > form, main > .field { max-width: 640px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .sell-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
  .sell-cart { position: sticky; top: 150px; background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; padding: 14px; box-shadow: 3px 3px 0 var(--ink); }
  .sell-cart h3 { margin-top: 0; }
  #toast { bottom: 32px; }
}

/* ---------- 4 header boxes, critical stock, print ---------- */
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stat { padding: 6px 8px; }
.stat span { font-size: 10px; line-height: 1.2; }
.stat b { font-size: 18px; }
@media (min-width: 900px) {
  /* computer: the four boxes fill the header beside the sidebar */
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; max-width: none; margin-top: 14px; }
  .head-row { max-width: none; justify-content: flex-end; }
  .stat { padding: 14px 18px; border-radius: 16px; min-height: 96px; justify-content: center; }
  .stat span { font-size: 15px; line-height: 1.2; }
  .stat b { font-size: 34px; }
  header { padding-top: 22px; padding-bottom: 20px; }
}
.card.critical { background: #FFE4DC; }
.card.critical h3 { color: var(--bad); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .big { flex: 1 1 160px; }
#toast { white-space: normal; }
#print { display: none; }
@media print {
  body { background: #fff; padding: 0; }
  header, .shell, nav, #toast { display: none !important; }
  #print { display: block; font-family: var(--body); color: #000; padding: 12mm; }
  #print h1 { font-size: 20pt; margin: 0 0 4pt; }
  #print p { font-size: 10pt; margin: 0 0 10pt; }
  #print table { width: 100%; border-collapse: collapse; font-size: 12pt; }
  #print th, #print td { border: 1px solid #000; padding: 6pt 8pt; text-align: left; }
  #print td:nth-child(n+2), #print th:nth-child(n+2) { text-align: right; }
  #print td:last-child { width: 25%; }
}

/* ---------- color themes (Settings) ---------- */
html[data-theme="berde"] { --accent: #5DD39E; --tile-2: #C9F2DD; --tile-3: #FFF1B8; --cream: #EFFAF3; }
html[data-theme="pula"]   { --accent: #B3261E; --accent-text: #FFB4AB; --on-accent: #FFFFFF; --tile-2: #F9D2CE; --tile-3: #FFE3C2; --cream: #FFF4F2; }
html[data-theme="royal"]  { --accent: #1F4FBF; --accent-text: #B9CFFF; --on-accent: #FFFFFF; --tile-2: #D3E1FF; --tile-3: #FFE9B0; --cream: #F1F5FF; }
html[data-theme="lila"]   { --accent: #6A2DB5; --accent-text: #DCC6FF; --on-accent: #FFFFFF; --tile-2: #E6D7FA; --tile-3: #FFF1B8; --cream: #F8F3FF; }
html[data-theme="teal"]   { --accent: #00796B; --accent-text: #9EEBDD; --on-accent: #FFFFFF; --tile-2: #C4EEE7; --tile-3: #FFF1B8; --cream: #EFFAF8; }
html[data-theme="orange"] { --accent: #C94A0C; --accent-text: #FFC9A6; --on-accent: #FFFFFF; --tile-2: #FFDCC4; --tile-3: #FFF1B8; --cream: #FFF5EE; }
html[data-theme="kahel"] { --accent: #FF9F45; --tile-2: #FFD8B0; --tile-3: #D8F3E4; --cream: #FFF3E6; }
html[data-theme="asul"]  { --accent: #6EC1FF; --tile-2: #CDE8FF; --tile-3: #FFF1B8; --cream: #EEF6FF; }
html[data-theme="rosas"] { --accent: #FF8FB8; --tile-2: #FFD3E3; --tile-3: #D8F3E4; --cream: #FFF0F5; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 4px; }
.theme-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; font-size: 13px; font-weight: 700; }
.theme-btn .sw { width: 100%; height: 28px; border-radius: 8px; border: 2px solid var(--ink); }
.theme-btn[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 3px 3px 0 var(--ink); }

/* ---------- statistics chart ---------- */
.stats-card .seg { margin-bottom: 8px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 10px; }
.kpis div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpis span { font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.kpis b { font-family: var(--display); font-weight: 800; font-size: 18px; line-height: 1.1; overflow-wrap: anywhere; }
.readout { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 13px; background: var(--cream); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.readout > b:first-child { width: 100%; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.plot { position: relative; padding-top: 18px; }
.ymax { position: absolute; top: 0; left: 0; font-size: 11px; color: var(--ink-soft); }
.bars {
  display: flex; align-items: flex-end; gap: 2px; height: 190px;
  border-top: 1px dashed #D9CDB0; border-bottom: 2px solid var(--ink);
  background: linear-gradient(#D9CDB0, #D9CDB0) 0 50% / 100% 1px no-repeat;
}
.bar {
  flex: 1 1 0; min-width: 0; height: 100%; padding: 0; border: none; border-radius: 6px 6px 0 0; background: transparent;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; position: relative; min-height: 0; box-shadow: none;
}
.bar:hover, .bar.sel { background: rgba(43, 26, 14, 0.07); }
.bar .stack { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 0 18%; }
.bar .segm { display: block; width: 100%; }
.bar .stack .segm:first-child { border-radius: 4px 4px 0 0; }
.bar .xl { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.bar.sel .xl { color: var(--ink); font-weight: 800; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; font-weight: 600; margin-top: 28px; }
.stats-card details { margin-top: 8px; }
.stats-card summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table th, .stat-table td { padding: 6px 4px; border-bottom: 1px solid #E9DFC8; text-align: right; }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; }
@media (min-width: 900px) { .stats-card { max-width: 860px; } .bar .xl { font-size: 11px; } }

/* ---------- in-app confirm box ---------- */
#confirm { position: fixed; inset: 0; background: rgba(43, 26, 14, 0.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
#confirm[hidden] { display: none; }
.confirm-card { background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); padding: 18px; width: 100%; max-width: 420px; }
.confirm-card p { margin: 0 0 14px; font-size: 16px; font-weight: 600; line-height: 1.4; }
.confirm-card .btn-row button { flex: 1 1 140px; font-weight: 700; }
button.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
@media print { #confirm { display: none !important; } }

/* ---------- pinned section buttons (Benta, Paninda) ---------- */
.seg-sticky {
  position: sticky; top: var(--head-h, 0px); z-index: 4;
  background: var(--cream); margin: -14px -16px 12px; padding: 12px 16px 10px;
  border-bottom: 2px solid var(--ink);
}
.seg-sticky button { min-height: 46px; }
.count-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 800; margin-left: 4px;
}
.seg button.on .count-badge { background: var(--accent); color: var(--on-accent); }
@media (max-width: 400px) { .seg-sticky button { font-size: 13px; padding: 6px 6px; } }
@media (min-width: 900px) {
  .seg-sticky { margin: -20px 0 16px; padding: 16px 0 12px; border-bottom: none; }
}

/* GCash/Load customer list in Reports */
.table-scroll { overflow-x: auto; margin-top: 10px; }
.service-table { min-width: 460px; }

/* ---------- POS: receipt, TOTAL, payment, slip ---------- */
.receipt {
  background: #FFFFFF; border: 2px solid var(--ink); border-radius: 14px; padding: 12px 12px 10px;
  font-variant-numeric: tabular-nums;
}
.r-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px dashed var(--ink); padding-bottom: 8px; margin-bottom: 6px; }
.r-head b { font-family: var(--display); font-size: 20px; }
.r-empty { margin: 14px 0; }
.r-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #EFE6D2; }
.r-main { display: flex; flex-direction: column; min-width: 0; }
.r-name { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.r-sub { font-size: 12px; color: var(--ink-soft); }
.r-qty { display: flex; align-items: center; gap: 4px; }
.r-qty button { width: 36px; padding: 0; font-size: 18px; }
.r-qty b { min-width: 22px; text-align: center; }
.r-total { min-width: 74px; text-align: right; }
.r-sum { padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.r-sum div { display: flex; justify-content: space-between; font-size: 14px; }
.r-subtotal { font-family: var(--display); font-size: 22px !important; font-weight: 800; border-top: 2px dashed var(--ink); padding-top: 8px; }
.total-btn, .finish-btn {
  width: 100%; margin-top: 12px; min-height: 60px; border-radius: 14px; border: 2px solid var(--ink);
  background: var(--ink); color: var(--accent-text); font-family: var(--display); font-size: 24px; font-weight: 800; box-shadow: 3px 3px 0 var(--ink);
}
.total-btn:disabled, .finish-btn:disabled { opacity: .4; box-shadow: none; }
/* phone: running subtotal bar above the bottom tabs */
.pos-bar {
  position: fixed; left: 10px; right: 10px; bottom: 66px; z-index: 6; background: var(--ink); color: var(--cream);
  border-radius: 14px; padding: 8px 8px 8px 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 0 rgba(0,0,0,.2);
}
.pos-bar span { flex: 1; display: flex; flex-direction: column; }
.pos-bar small { color: #E9D9B0; font-size: 12px; }
.pos-bar b { font-family: var(--display); font-size: 24px; line-height: 1.1; }
.pos-bar button { background: var(--accent); color: var(--on-accent); border-color: var(--accent-text); font-family: var(--display); font-weight: 800; font-size: 20px; min-height: 50px; padding: 0 22px; }
body:has(.pos-bar) main { padding-bottom: 90px; }
/* payment */
.pay-screen { max-width: 560px; margin: 0 auto; }
.pay-total { background: var(--ink); color: var(--cream); border-radius: 16px; padding: 14px 16px; margin: 8px 0 12px; display: flex; flex-direction: column; }
.pay-total span { font-size: 13px; color: #E9D9B0; font-weight: 600; }
.pay-total b { font-family: var(--display); font-size: 44px; font-weight: 800; line-height: 1.05; color: var(--accent); }
.pay-methods button { font-size: 15px; }
.cash-input { font-family: var(--display); font-size: 30px !important; font-weight: 800; min-height: 60px; text-align: right; }
.bills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.bills button { font-weight: 800; min-height: 48px; }
.sukli { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px; background: var(--cream); border: 2px solid var(--ink); border-radius: 12px; padding: 10px 14px; }
.sukli span { font-weight: 700; }
.sukli b { font-family: var(--display); font-size: 32px; font-weight: 800; color: var(--good); }
.sukli small { width: 100%; color: var(--ink-soft); }
.sukli .bad { color: var(--bad); }
.sukli.big { margin-bottom: 12px; }
.sukli.big b { font-size: 40px; }
.pay-note { margin: 0; font-weight: 600; }
.finish-btn { background: var(--good); border-color: var(--ink); color: #fff; }
/* receipt slip */
.slip { background: #fff; border: 2px dashed var(--ink); border-radius: 6px; padding: 16px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.slip h2 { font-family: var(--display); text-align: center; margin: 0; font-size: 22px; }
.slip-date { text-align: center; margin: 2px 0 10px; font-size: 12px; color: var(--ink-soft); }
.slip table { width: 100%; border-collapse: collapse; font-size: 14px; }
.slip td { padding: 4px 0; vertical-align: top; }
.slip td:last-child { text-align: right; white-space: nowrap; padding-left: 8px; }
.slip small { color: var(--ink-soft); }
.slip-sep { border-top: 2px dashed var(--ink); margin: 8px 0; }
.slip-total td { font-family: var(--display); font-size: 20px; font-weight: 800; }
.slip-thanks { text-align: center; margin: 10px 0 0; font-weight: 700; }
@media (min-width: 900px) {
  .pos-bar { display: none; }
  body:has(.pos-bar) main { padding-bottom: 0; }
  .sell-cart { padding: 12px; }
}
@media print {
  #print .print-slip { border: none; max-width: 80mm; margin: 0 auto; padding: 0; font-size: 11pt; }
  #print .print-slip table { font-size: 11pt; }
}

/* ---------- batches (one card per resibo) ---------- */
.batch { background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.batch-head { width: 100%; display: flex; align-items: center; gap: 10px; border: none; border-radius: 0; background: none; text-align: left; padding: 10px 12px; min-height: 56px; }
.batch-no { font-family: var(--display); font-weight: 800; font-size: 18px; background: var(--accent); color: var(--on-accent); border: 2px solid var(--ink); border-radius: 10px; min-width: 44px; text-align: center; padding: 2px 6px; }
.batch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.batch-main b { overflow-wrap: anywhere; }
.batch-main small { color: var(--ink-soft); font-size: 12px; }
.batch-total { font-family: var(--display); font-size: 18px; white-space: nowrap; }
.batch.open { box-shadow: 3px 3px 0 var(--ink); }
.batch-body { border-top: 2px dashed var(--ink); padding: 8px 12px 10px; }
.batch-item { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 3px 0; }
.batch-body .btn-row { margin-top: 8px; }
.slip-suki { text-align: center; margin: -6px 0 10px; font-size: 14px; }

/* ---------- phone: resibo as a pull-up panel at the bottom ---------- */
.tile { position: relative; }
.tile-badge {
  position: absolute; top: -8px; right: -6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px;
  background: var(--ink); color: var(--accent-text); font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--paper);
}
.sheet-grab, .sheet-backdrop { display: none; }
@media (max-width: 899px) {
  .sell-cart {
    position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 7;
    background: var(--paper); border-top: 3px solid var(--ink); border-radius: 20px 20px 0 0;
    box-shadow: 0 -6px 18px rgba(43, 26, 14, 0.18); padding: 0 14px 10px;
    max-height: calc(100vh - var(--head-h, 150px) - 70px); overflow-y: auto; overscroll-behavior: contain;
  }
  .sell-cart.is-empty { display: none; }
  .sheet-grab {
    display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; border: none; border-radius: 0;
    background: var(--paper); padding: 6px 0 4px; min-height: 48px; position: sticky; top: 0; z-index: 1; touch-action: none;
  }
  .grab-bar { align-self: center; width: 46px; height: 5px; border-radius: 3px; background: #CDBB9A; }
  .grab-row { display: flex; justify-content: space-between; align-items: baseline; }
  .grab-row b { font-family: var(--display); font-size: 18px; }
  .grab-row small { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
  .sell-cart .receipt { border: none; padding: 0; background: transparent; }
  .sell-cart .r-head { display: none; }
  .sell-cart.sheet-open .r-head { display: flex; border-bottom: none; padding-bottom: 0; }
  .sell-cart .r-head b { display: none; }
  .sell-cart:not(.sheet-open) .r-extra { display: none; }
  .sell-cart .r-line { padding: 6px 0; }
  .sell-cart .r-qty button { width: 40px; min-height: 40px; }
  .sell-cart .r-sum div:first-child { display: none; }
  .sell-cart .r-subtotal { font-size: 20px !important; padding-top: 6px; }
  .sell-cart .total-btn { margin-top: 8px; min-height: 52px; font-size: 22px; }
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 6; background: rgba(43, 26, 14, 0.4); border: none; border-radius: 0; padding: 0; }
  main:has(.sell-cart:not(.is-empty)) { padding-bottom: calc(var(--sheet-h, 0px) + 16px); }
}
@media (max-width: 899px) { #toast { bottom: calc(var(--sheet-h, 0px) + 72px); } }
/* compact pull-up panel (phone) */
.sheet-foot { display: none; }
@media (max-width: 899px) {
  .sell-cart { padding: 0 12px 8px; }
  .sheet-grab { min-height: 40px; padding: 4px 0 2px; }
  .grab-row b { font-size: 17px; }
  .sell-cart .r-line { grid-template-columns: minmax(0, 1fr) auto 64px; gap: 6px; padding: 4px 0; }
  .sell-cart .r-name { font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sell-cart .r-sub { font-size: 11px; }
  .sell-cart .r-qty button { width: 38px; min-height: 38px; height: 38px; font-size: 18px; }
  .sell-cart .r-total { min-width: 0; font-size: 14px; }
  .sell-cart .r-sum, .sell-cart .total-btn { display: none; }
  .sheet-foot { display: flex; align-items: center; gap: 10px; padding-top: 6px; border-top: 2px dashed var(--ink); margin-top: 2px; }
  .sheet-foot div { flex: 1; display: flex; flex-direction: column; }
  .sheet-foot small { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
  .sheet-foot b { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.05; }
  .sheet-foot button { min-height: 50px; padding: 0 24px; border-radius: 14px; background: var(--ink); color: var(--accent-text); font-family: var(--display); font-weight: 800; font-size: 22px; }
}
@media (max-width: 899px) { .sell-cart.sheet-open .r-head { justify-content: flex-end; margin: -4px 0 0; padding: 0; } }

/* ---------- icons (Tabler, inline SVG) ---------- */
.ic { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.ic-sm { width: 16px; height: 16px; vertical-align: -3px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button .ic { width: 19px; height: 19px; }
button.big, .total-btn, .finish-btn, .sheet-foot button, .checkout .pay { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button.big { display: flex; }
.total-btn .ic, .finish-btn .ic, .sheet-foot button .ic { width: 24px; height: 24px; }
.grab-row b, .r-head b { display: inline-flex; align-items: center; gap: 6px; }
.grab-row b .ic, .r-head b .ic { width: 20px; height: 20px; }
/* bottom tabs: icon on top of the label; the selected tab gets a yellow pill behind its icon */
nav button::before { content: none; display: none; }
nav button { gap: 2px; padding: 6px 0 10px; }
.nav-ic { display: flex; align-items: center; justify-content: center; width: 54px; height: 30px; border-radius: 999px; }
.nav-ic .ic { width: 24px; height: 24px; }
nav button.on .nav-ic { background: var(--accent); color: var(--on-accent); outline: 2px solid var(--ink); }
.nav-label { font-size: 12px; line-height: 1.1; }
@media (max-width: 400px) { .seg button .ic { width: 17px; height: 17px; } .seg button { gap: 4px; } }
@media (min-width: 900px) {
  nav button { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 10px; }
  .nav-ic { width: 40px; height: 34px; border-radius: 10px; }
  nav button.on .nav-ic { outline: 2px solid var(--ink); }
  .nav-label { font-size: 15px; }
}
.grab-row { align-items: center; }
.h-ic { display: flex; align-items: center; gap: 8px; }
.h-ic .ic { width: 22px; height: 22px; }
/* Paninda tabs on phones: icon above a one-line label so nothing wraps */
@media (max-width: 899px) {
  .seg-stack button { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 13px; line-height: 1.15; white-space: nowrap; position: relative; }
  .seg-stack button .ic { width: 20px; height: 20px; }
  .seg-stack .count-badge { position: absolute; top: 4px; right: 6px; margin: 0; min-width: 20px; height: 20px; font-size: 11px; }
}

/* GCash/Load payment choice: Cash / Utang / Kulang */
.pay-pick { border: 2px dashed var(--ink); border-radius: 12px; padding: 8px 10px 10px; margin: 6px 0 10px; }
.pay-pick legend { font-size: 13px; font-weight: 700; padding: 0 4px; }
.pay-pick .seg { margin-bottom: 6px; }
.seg-radio { flex: 1; position: relative; }
.seg-radio input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-radio span { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 2px solid var(--ink); border-radius: 12px; background: var(--cream); font-weight: 700; }
.seg-radio input:checked + span { background: var(--ink); color: var(--accent-text); }
.seg-radio input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.seg-radio input:disabled + span { opacity: .4; }
[hidden] { display: none !important; }

/* Puhunan and Gastos (optional section) */
.ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #E9DFC8; }
.ledger-row:last-child { border-bottom: 0; }
.check-row { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 12px; font-size: 14px; }
.check-row input { margin-top: 3px; width: 18px; height: 18px; }
/* Four report tabs (Puhunan and Gastos on): a little tighter so all fit on a phone */
.seg-many button { font-size: 14px; padding-left: 6px; padding-right: 6px; gap: 4px; }
.seg-many button .ic { width: 17px; height: 17px; }

/* Backup code row in Settings */
.code-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.code-text { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; font-weight: 700; letter-spacing: 1px; }

/* Settings PIN lock */
.pin-card { max-width: 360px; margin: 24px auto; text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-soft); }
.pin-dot.on { background: var(--ink-soft); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { font-size: 22px; padding: 14px 0; border-radius: 12px; }
.pin-pad button.small { font-size: 14px; }

/* App style picker (Settings) */
.ui-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 4px; }
.ui-style-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px; text-align: left; }
.ui-style-btn b { font-size: 14px; margin-top: 6px; }
.ui-style-btn small { font-size: 12px; font-weight: 500; color: var(--ink-soft); line-height: 1.3; }
.ui-prev { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 14px 22px 10px; gap: 4px; width: 100%; padding: 6px; border-radius: 10px; border: 1px solid rgba(0, 0, 0, .15); }
.ui-prev i { display: block; border-radius: 4px; }
.ui-prev i:first-child { grid-column: 1 / -1; }
.ui-prev i:last-child { grid-column: 1 / -1; border-radius: 999px; }
.ui-style-btn[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 3px 3px 0 var(--ink); }
/* Computer: payment screen in two columns so the details fit without scrolling */
@media (min-width: 900px) {
  .pay-screen { max-width: 960px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 12px 20px; align-items: start; }
  .pay-screen > .link { grid-column: 1 / -1; justify-self: start; margin: 0; }
  .pay-screen > .pay-total { grid-column: 1; grid-row: 2; margin: 0; }
  .pay-screen > .pay-methods { grid-column: 1; grid-row: 3; margin: 0; }
  .pay-screen > .finish-btn { grid-column: 1; grid-row: 4; margin: 0; }
  .pay-screen > .card { grid-column: 2; grid-row: 2 / span 3; margin: 0; }
}
