/* ShopPOS — styles (landing + app) */

:root {
  --ink: #17202b;
  --muted: #6b7686;
  --line: #e3e8ef;
  --bg: #f4f6fa;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #15803d;
  --sidebar: #141d2b;
  --sidebar-ink: #c7d2e0;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(23, 32, 43, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.full { width: 100%; }
.r { text-align: right; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: .55rem 1rem;
  border-radius: 9px;
  font-size: .95rem;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}
.btn:hover { border-color: #c6d0de; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; border-radius: 7px; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1.05rem; border-radius: 11px; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.file-btn { cursor: pointer; }
.hidden-file { display: none; }

.icon-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 1rem; padding: .3rem .45rem; border-radius: 7px; color: var(--muted);
}
.icon-btn:hover { background: #eef1f6; }
.icon-btn.danger:hover { color: var(--danger); }

.badge {
  font-size: .72rem; font-weight: 600; padding: .12rem .5rem;
  border-radius: 999px; vertical-align: middle;
}
.badge-low { background: #fef3c7; color: var(--warn); border: 1px solid #fde68a; }
.badge-ok { background: #dcfce7; color: var(--ok); border: 1px solid #bbf7d0; }
.badge-featured { background: var(--primary); color: #fff; }

kbd {
  background: #eef1f6; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 .35rem; font-size: .78rem; font-family: inherit;
}

/* ---------- landing ---------- */
.landing { background: #fff; }
.landing-wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

.landing-nav {
  position: sticky; top: 0; background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); z-index: 10;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.nav-inner nav { display: flex; align-items: center; gap: 1.4rem; }
.nav-inner nav a { color: var(--ink); }
.logo { font-weight: 800; font-size: 1.25rem; }

.hero {
  text-align: center; padding: 4.5rem 0 3.5rem;
  background: linear-gradient(180deg, #eef4ff 0%, #ffffff 100%);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.12; margin: 0 0 1rem; }
.hero-sub { font-size: 1.15rem; color: var(--muted); max-width: 620px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 1rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.pin-note { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: .55rem 1rem; border-radius: 9px; }
.hero-stats {
  display: flex; gap: 2.5rem; justify-content: center; flex-wrap: wrap; margin-top: 3rem;
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.4rem; color: var(--primary); }
.hero-stats span { color: var(--muted); font-size: .85rem; }

.section { padding: 3.5rem 0; }
.section.alt { background: var(--bg); }
.section h2 { text-align: center; font-size: 1.9rem; margin: 0 0 2.2rem; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.25rem; }
.feature-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.feature-icon { font-size: 1.8rem; }
.feature-card h3 { margin: .6rem 0 .4rem; }
.feature-card p { color: var(--muted); margin: 0; line-height: 1.55; }

.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.25rem; align-items: stretch; }
.price-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem; text-align: center; box-shadow: var(--shadow); position: relative;
}
.price-card.featured { border: 2px solid var(--primary); }
.price-card .badge-featured { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); }
.price-card .price { font-size: 2.2rem; font-weight: 800; margin: .5rem 0 1rem; }
.price-card .price span { font-size: .9rem; color: var(--muted); font-weight: 400; }
.price-card ul { list-style: none; padding: 0; margin: 0 0 1.5rem; color: var(--muted); line-height: 1.9; }

.landing-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; }
.landing-footer .landing-wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #141d2b, #2563eb);
  padding: 1rem;
}
.login-card {
  background: #fff; border-radius: 18px; padding: 2.2rem; width: 100%; max-width: 360px;
  text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.login-logo { font-size: 2.6rem; }
.login-card h1 { margin: .3rem 0 .2rem; }
.login-card input {
  width: 100%; padding: .8rem; font-size: 1.3rem; text-align: center;
  letter-spacing: .35em; border: 1px solid var(--line); border-radius: 10px; margin: 1rem 0 .4rem;
}
.error-text { color: var(--danger); min-height: 1.2em; margin: .2rem 0 .6rem; font-size: .9rem; }
.login-card .muted.small { margin-top: 1rem; }

/* ---------- app shell ---------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 230px; flex: none; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 1.1rem .8rem;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.sidebar-brand { padding: .2rem .6rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .logo { color: #fff; display: block; }
.shop-name { font-size: .85rem; color: #8fa3bd; display: block; }
.cashier-name { font-size: .82rem; color: #a9c6f5; display: block; margin-top: .15rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; margin-top: 1rem; flex: 1; }
.nav-item {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: var(--sidebar-ink); padding: .6rem .7rem; border-radius: 9px; cursor: pointer;
  font-size: .95rem; font-family: inherit;
}
a.nav-item:hover { text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: .6rem; display: flex; flex-direction: column; gap: .25rem; }

.main { flex: 1; min-width: 0; padding: 0 1.5rem 2.5rem; }
.topbar {
  display: flex; align-items: center; gap: .6rem; padding: 1rem 0;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.topbar h2 { margin: 0; font-size: 1.35rem; }
.menu-btn { display: none; font-size: 1.3rem; }

/* bottom nav (phones only, shown via media query) */
.bottom-nav { display: none; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.card h3 { margin-top: 0; }

/* dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .3rem;
  min-width: 0;
}
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-value { font-size: 1.6rem; font-weight: 800; overflow-wrap: anywhere; }
.stat-card.warn .stat-value { color: var(--warn); }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: .65rem 0; border-bottom: 1px solid var(--line);
}
.recent-list li:last-child { border-bottom: none; }

/* charts */
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.chart-head h3 { margin: 0; }
.chart-range { display: flex; gap: .4rem; }
.chart-range-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chart-box { margin-top: .8rem; overflow-x: auto; }
.chart-svg { width: 100%; height: auto; min-width: 0; display: block; }
.chart-value { font-size: 12px; fill: var(--ink); font-weight: 600; }
.chart-tick { font-size: 11px; fill: var(--muted); }
.chart-name { font-size: 12.5px; fill: var(--ink); }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.chart-grid .card { margin-bottom: 1.25rem; }

/* toolbar / tables */
.toolbar { display: flex; gap: .8rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar h3 { margin: 0; }
.toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 220px; padding: .65rem .9rem; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1rem; background: #fff; font-family: inherit;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: .93rem; }
.table-narrow { min-width: 0; }
.table th, .table td { padding: .6rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }

/* POS */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 1.25rem; align-items: start; }
.pos-left { min-width: 0; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; margin-top: 1rem; }
.pos-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: .15rem;
  font-family: inherit; box-shadow: var(--shadow); min-width: 0;
}
.pos-tile:hover:not(:disabled) { border-color: var(--primary); }
.pos-tile:disabled { opacity: .5; cursor: not-allowed; }
.pos-tile-name { font-weight: 700; overflow-wrap: anywhere; }
.pos-tile-sku { color: var(--muted); font-size: .75rem; }
.pos-tile-price { color: var(--primary); font-weight: 800; font-size: 1.1rem; }
.pos-tile-stock { color: var(--muted); font-size: .8rem; }
.pos-tile-stock.out { color: var(--danger); }
.shortcut-hints { margin-top: 1rem; }

.pos-right { position: sticky; top: 76px; min-width: 0; }
.cart-lines { display: flex; flex-direction: column; gap: .5rem; margin: .8rem 0; }
.cart-line {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem;
  background: var(--bg); border-radius: 9px;
}
.cart-line-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cart-line-name { font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.qty-ctrl { display: flex; align-items: center; gap: .35rem; flex: none; }
.qty-ctrl button {
  width: 28px; height: 28px; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; cursor: pointer; font-size: 1rem; line-height: 1;
}
.cart-line-total { font-weight: 700; min-width: 64px; text-align: right; }

.cart-totals { border-top: 1px solid var(--line); padding-top: .7rem; display: flex; flex-direction: column; gap: .35rem; }
.cart-totals > div { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.cart-totals .grand { font-size: 1.25rem; font-weight: 800; border-top: 1px dashed var(--line); padding-top: .5rem; }
.discount-row input { width: 62px; padding: .25rem .4rem; border: 1px solid var(--line); border-radius: 6px; }

/* payments */
.pay-section { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.pay-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.pay-title { font-weight: 700; }
.payment-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.payment-row select, .payment-row input {
  padding: .55rem .6rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; color: var(--ink); background: #fff; font-family: inherit; min-width: 0;
}
.payment-row select { flex: 1 1 40%; }
.payment-row input { flex: 1 1 60%; }
.pay-summary { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; }
.pay-summary > div { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.pay-summary .change-row { border-top: 1px dashed var(--line); padding-top: .45rem; }
.pay-summary .change-row strong { font-size: 1.15rem; }

.pos-actions { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.pos-actions .btn-primary { flex: 1; }

.held-bill {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 9px; padding: .55rem .7rem; margin-top: .5rem;
}

/* returns */
.return-line {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem;
  background: var(--bg); border-radius: 9px; margin-bottom: .5rem;
}
.return-line input.return-qty {
  width: 76px; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; font-family: inherit; flex: none;
}
.return-total { font-size: 1.15rem; }

/* inventory */
.low-list { list-style: none; margin: 0; padding: 0; }
.low-list li { display: flex; justify-content: space-between; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.low-list li:last-child { border-bottom: none; }

/* sales */
.sales-top { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.zrow { display: flex; justify-content: space-between; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.zrow:last-child { border-bottom: none; }
.zrow.grand { font-size: 1.1rem; }

/* purchase orders */
.po-items-head, .po-item-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 76px 110px 36px; gap: .5rem; align-items: center;
}
.po-items-head { font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.po-item-row { margin-bottom: .5rem; }
.po-item-row select, .po-item-row input {
  padding: .55rem .6rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; color: var(--ink); background: #fff; font-family: inherit; min-width: 0; width: 100%;
}
.po-total-row {
  display: flex; justify-content: space-between; border-top: 1px dashed var(--line);
  padding-top: .6rem; margin-top: .6rem; font-size: 1.05rem;
}

/* forms */
.field-label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--muted); margin-bottom: .8rem; min-width: 0; }
.field-label input, .field-label select {
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; color: var(--ink); background: #fff; font-family: inherit; min-width: 0; width: 100%;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .7rem; }
.form-row > * { min-width: 0; }
.settings-form { max-width: 520px; }
.input-with-btn { display: flex; gap: .5rem; align-items: stretch; }
.input-with-btn input {
  flex: 1; min-width: 0; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; color: var(--ink); background: #fff; font-family: inherit;
}

/* payment method chips */
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .8rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; background: #eef4ff;
  border: 1px solid #c7dcff; color: var(--primary-dark); border-radius: 999px;
  padding: .3rem .4rem .3rem .75rem; font-size: .9rem; font-weight: 600;
}
.chip-x {
  border: none; background: transparent; color: var(--primary-dark); cursor: pointer;
  font-size: .8rem; padding: .15rem .35rem; border-radius: 999px; line-height: 1;
}
.chip-x:hover { background: #dbeafe; color: var(--danger); }

/* modals: scrollable body + always-visible actions */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 29, 43, .55);
  display: flex; align-items: center; justify-content: center; padding: .75rem; z-index: 50;
}
.modal {
  background: #fff; border-radius: 16px; width: min(480px, 100%);
  max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-wide { width: min(640px, 100%); }
.modal > h3 { margin: 0; padding: 1.2rem 1.4rem .4rem; }
.modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: .6rem 1.4rem 1rem; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap;
  padding: .85rem 1.4rem 1.1rem; border-top: 1px solid var(--line); background: #fff; flex: none;
}

/* receipt */
.receipt-modal { width: min(380px, 100%); }
.receipt-head { text-align: center; border-bottom: 1px dashed var(--line); padding-bottom: .7rem; margin-bottom: .7rem; }
.receipt-head h3 { margin: 0; }
.receipt-head p { margin: .15rem 0; }
.receipt-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.receipt-table th, .receipt-table td { padding: .35rem .3rem; border-bottom: 1px solid #f0f3f8; text-align: left; }
.receipt-totals { margin-top: .7rem; display: flex; flex-direction: column; gap: .3rem; }
.receipt-totals > div { display: flex; justify-content: space-between; gap: .5rem; }
.receipt-totals .grand { font-weight: 800; font-size: 1.1rem; border-top: 1px dashed var(--line); padding-top: .45rem; }
.receipt-thanks { text-align: center; color: var(--muted); margin-top: 1rem; font-size: .88rem; }

/* barcode labels */
.label-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.label {
  border: 1px solid #999; border-radius: 6px; padding: 8px; text-align: center;
  page-break-inside: avoid; background: #fff;
}
.label-name { font-weight: 700; font-size: 13px; }
.label-price { font-size: 15px; font-weight: 800; margin: 2px 0; }
.label-barcode svg { max-width: 100%; height: auto; }
.label-code { font-size: 11px; letter-spacing: .12em; }

/* toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* print: receipt or label sheet only */
.print-only { display: none; }
@media print {
  body * { visibility: hidden; }
  #receipt-print, #receipt-print * { visibility: visible; }
  #receipt-print {
    display: block; position: absolute; top: 0; left: 0; width: 100%;
    padding: 1rem; font-size: 13px;
  }
  body.printing-labels #receipt-print { display: none; }
  body.printing-labels #label-print, body.printing-labels #label-print * { visibility: visible; }
  body.printing-labels #label-print {
    display: block; position: absolute; top: 0; left: 0; width: 100%; padding: .5rem;
  }
}

/* ---------- responsive ---------- */

/* large desktop: a touch more breathing room */
@media (min-width: 1440px) {
  .main { padding: 0 2rem 2.5rem; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
}

/* tablet landscape / small laptop */
@media (max-width: 1100px) {
  .sidebar { width: 205px; }
  .pos-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
}

/* tablet portrait: POS stacks, charts stack */
@media (max-width: 960px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-right { position: static; }
  .sales-top { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
}

/* small tablet / large phone: sidebar becomes a drawer */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%);
    transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.3); width: min(260px, 84vw);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: block; }
  .main { padding: 0 1rem 2rem; }
  .nav-item { min-height: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .field-label input, .field-label select,
  .payment-row select, .payment-row input,
  .po-item-row select, .po-item-row input,
  .input-with-btn input, .search-input { min-height: 44px; font-size: 16px; }
  .qty-ctrl button { width: 40px; height: 40px; }
  .pos-tile { min-height: 88px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .modal > h3 { padding: 1rem 1.1rem .3rem; }
  .modal-body { padding: .5rem 1.1rem .9rem; }
  .modal-actions { padding: .8rem 1.1rem 1rem; }
  .modal-actions .btn { flex: 1; }
}

/* phones: bottom nav, single-column everything, no horizontal overflow */
@media (max-width: 480px) {
  .main { padding: 0 .8rem 96px; }
  .topbar { padding: .7rem 0; }
  .topbar h2 { font-size: 1.15rem; }
  .card { padding: 1rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .stat-value { font-size: 1.25rem; }
  .form-row { grid-template-columns: 1fr; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
  .cart-line-total { min-width: 56px; }
  .pos-actions .btn { flex: 1; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { flex: 1; }
  .search-input { min-width: 0; width: 100%; }
  .payment-row { flex-wrap: wrap; }
  .payment-row select { flex: 1 1 100%; }
  .payment-row input { flex: 1 1 auto; }
  .po-items-head, .po-item-row { grid-template-columns: minmax(0, 1fr) 64px 92px 36px; }
  .label-sheet { grid-template-columns: repeat(2, 1fr); }
  .toast { bottom: 86px; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--sidebar); padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(0,0,0,.25);
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem;
    background: transparent; border: none; color: var(--sidebar-ink);
    font-size: .68rem; font-family: inherit; padding: .4rem .1rem; border-radius: 9px;
    min-height: 52px; cursor: pointer;
  }
  .bottom-nav-item span { font-size: 1.15rem; line-height: 1; }
  .bottom-nav-item.active { background: var(--primary); color: #fff; }
}

/* very small phones */
@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
  .pos-grid { grid-template-columns: 1fr 1fr; }
  .label-sheet { grid-template-columns: 1fr; }
}
