/* SINGHAGIRI — CRM Soft / iPay shell tokens (exact from crm-shell.css) */
:root {
  --fx-primary: #2b6ff3;
  --fx-primary-dark: #1e56c9;
  --fx-navy: #092c4c;
  --fx-muted: #7e91a1;
  --fx-success: #51d277;
  --fx-success-bg: #e8f8ed;
  --fx-warn: #ffc736;
  --fx-warn-bg: #fff8e6;
  --fx-danger: #ff6363;
  --fx-danger-bg: #ffecec;
  --fx-border: #e5e4e5;
  --fx-ice: #e2eaf2;
  --fx-snow: #fafafa;
  --fx-white: #ffffff;
  --fx-shadow: 0 1px 3px rgba(9, 44, 76, 0.08);
  --fx-shadow-lg: 0 10px 40px rgba(9, 44, 76, 0.12);
  --ok: var(--fx-success);
  --bad: var(--fx-danger);
  --muted: var(--fx-muted);
  --nav-w: 272px;
  --top-h: 56px;
  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Sans", system-ui, sans-serif;
  --space: 0.65rem;
  --gap: 20px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.35;
  color: var(--fx-navy);
  background: var(--fx-snow);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ── Auth (compact) ─────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 10% 15%, rgba(43,111,243,.16), transparent 40%),
    linear-gradient(160deg, #d5e0ec, #eef2f7 55%, #f4f6f9);
}
.auth-card {
  width: min(380px, 100%);
  background: var(--fx-white);
  border: 1px solid var(--fx-border);
  border-radius: var(--r-lg);
  box-shadow: var(--fx-shadow-lg);
  padding: 1.25rem 1.35rem;
}
.auth-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.auth-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 1px solid var(--fx-border); }
.auth-brand h1 { margin: 0; font-family: var(--font-display); font-size: 1.2rem; letter-spacing: -.02em; }
.product { margin: .1rem 0 0; color: var(--fx-primary); font-weight: 800; letter-spacing: .08em; font-size: .72rem; }
.auth-lead { color: var(--fx-muted); margin: 0 0 .85rem; font-size: .82rem; }
.field { display: grid; gap: .2rem; margin-bottom: .55rem; }
.field > span, .field label, label.field span {
  font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--fx-muted);
}
.field input, .field select, .toolbar input, .toolbar select, .inline-qty {
  height: 34px; padding: 0 .6rem; border: 1px solid var(--fx-border); border-radius: var(--r-md);
  background: var(--fx-white); color: var(--fx-navy); width: 100%;
}
.error { color: var(--fx-danger); background: var(--fx-danger-bg); padding: .5rem .65rem; border-radius: var(--r-md); margin-top: .5rem; font-size: .82rem; }

/* ── Shell: fill viewport, no wasted chrome ─────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: var(--nav-w); flex: 0 0 var(--nav-w);
  background: linear-gradient(180deg, var(--fx-navy) 0%, #0a3558 100%);
  color: #f8fafc; display: flex; flex-direction: column; z-index: 40;
}
.brand { padding: .7rem .75rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-row { display: flex; align-items: center; gap: .55rem; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  background: #fff; border: 1px solid rgba(255,255,255,.25);
}
.brand h1 { margin: 0; font-family: var(--font-display); font-size: .82rem; font-weight: 800; }
.brand-sub { font-size: .58rem; letter-spacing: .08em; opacity: .6; margin-top: .05rem; }
.nav { flex: 1; overflow: auto; padding: .35rem .4rem .6rem; }
.nav-cap {
  font-size: .55rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(248,250,252,.35); padding: .45rem .5rem .15rem;
}
.nav-item {
  display: flex; align-items: center; gap: .4rem; width: 100%;
  padding: .4rem .55rem; border-radius: var(--r-md); border: 0;
  background: transparent; color: rgba(248,250,252,.88); font-weight: 600; font-size: .78rem;
  text-align: left; margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.on { background: rgba(43,111,243,.35); color: #fff; box-shadow: inset 0 0 0 1px rgba(91,159,255,.4); }
.sidebar-foot {
  padding: .5rem .75rem; font-size: .58rem; color: rgba(248,250,252,.35);
  border-top: 1px solid rgba(255,255,255,.07);
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.top {
  height: var(--top-h); flex: 0 0 var(--top-h);
  padding: 0 .9rem; background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--fx-border); z-index: 30;
  display: flex; align-items: center;
}
.top-inner { display: flex; justify-content: space-between; gap: .75rem; align-items: center; width: 100%; }
.top h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; }
.top .desc { margin: .05rem 0 0; color: var(--fx-muted); font-size: .72rem; }
.user {
  display: flex; align-items: center; gap: .4rem; padding: .15rem .35rem .15rem .15rem;
  border: 1px solid var(--fx-border); border-radius: 999px; background: #fff;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--fx-primary); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: .68rem;
}
.user-meta { display: grid; line-height: 1.1; }
.user-meta strong { font-size: .75rem; }
.user-meta span { font-size: .62rem; color: var(--fx-muted); text-transform: capitalize; }

/* Content fills remaining height — kills empty white voids */
.content {
  padding: .45rem .55rem .55rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.content > .panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}
.content > .fill-stack {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.content > .pos-layout {
  flex: 1;
  min-height: 0;
  display: grid;
}
.fill-stack {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.fill-stack > .panel.grow,
.panel.grow {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Controls */
.btn {
  border: 0; border-radius: var(--r-md); padding: .42rem .75rem; font-weight: 700; font-size: .78rem;
  background: var(--fx-navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
}
.btn-p { background: var(--fx-primary); }
.btn-p:hover { background: var(--fx-primary-dark); }
.btn-warn { background: #c47a12; }
.btn-warn:hover { background: #a3650e; }
.btn-danger { background: var(--fx-danger); }
.btn-ghost { background: #fff; color: var(--fx-navy); border: 1px solid var(--fx-border); }
.btn-sm { padding: .28rem .5rem; font-size: .72rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Dense KPI cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .45rem;
  margin-bottom: 0;
  flex: 0 0 auto;
}
.stat {
  background: #fff; border: 1px solid var(--fx-border); border-radius: var(--r-lg);
  padding: .55rem .65rem; box-shadow: var(--fx-shadow);
}
.stat .label { color: var(--fx-muted); font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; margin-top: .1rem; line-height: 1.15; }
.stat .meta { color: var(--fx-muted); font-size: .68rem; margin-top: .12rem; line-height: 1.25; }
.stat.profit .value { color: var(--fx-success); }
.stat.loss .value { color: var(--fx-danger); }
.stat.neutral .value { color: var(--fx-navy); }
.stat.loan .value { color: #b45309; }
.stat.loan .label { color: #92400e; }
.report-month-strip { flex: 0 0 auto; }
.report-month-strip h3 { margin: 0 0 .4rem; font-size: .88rem; }

/* Panels */
.panel {
  background: #fff; border: 1px solid var(--fx-border); border-radius: var(--r-lg);
  box-shadow: var(--fx-shadow); padding: .65rem .75rem; display: flex; flex-direction: column; min-height: 0;
}
.panel h3 { margin: 0 0 .4rem; font-family: var(--font-display); font-size: .92rem; }
.panel-hint { margin: 0 0 .45rem; color: var(--fx-muted); font-size: .75rem; line-height: 1.35; }
.toolbar { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .4rem; flex: 0 0 auto; }
.toolbar > * { flex: 1; min-width: 100px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .35rem; flex: 0 0 auto; }
.panel-head h3 { margin: 0; }
.chk { font-size: .72rem; color: var(--fx-muted); display: flex; align-items: center; gap: .3rem; white-space: nowrap; }
.hint { margin: 0 0 .35rem; font-size: .72rem; color: var(--fx-muted); flex: 0 0 auto; }

/* Sell: two columns fill height — advanced dense ops */
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.9fr);
  gap: .45rem;
  flex: 1;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}
.pos-layout > .panel {
  max-height: 100%;
  overflow: hidden;
}
.pos-layout > .panel-items {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.pos-layout > .panel-cart {
  height: auto;
  max-height: 100%;
  align-self: stretch;
  overflow: auto;
}
.pos-layout > .panel-cart:has(.cart-lines.is-empty) {
  align-self: start;
  height: auto;
}
.panel-items {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .5rem .6rem !important;
}
.panel-items .panel-head,
.panel-items .browse-crumb,
.panel-items .model-bar,
.panel-items .dept-bar,
.panel-items .toolbar,
.panel-items .pager-top,
.panel-items .item-hint,
.panel-items .browse-lead { flex: 0 0 auto; }
.panel-items .browse-stage {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.panel-items .items-stage {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  flex: 1 1 auto;
  min-height: 0;
}
.browse-lead {
  margin: 0 0 .35rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--fx-muted);
  line-height: 1.35;
}
.browse-lead strong { color: var(--fx-navy); }
.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .45rem;
  overflow: auto;
  flex: 1 1 auto;
  align-content: start;
  min-height: 160px;
  padding-bottom: .25rem;
}
.browse-stage { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.item-hint {
  margin: 0;
  font-size: .65rem;
  font-weight: 700;
  color: var(--fx-muted);
}

/* Cart: NO empty void — lines capped, pay form packs tight */
.sticky-cart {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .5rem .6rem !important;
  overflow: hidden;
}
.cart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex: 0 0 auto;
}
.cart-head h3 { margin: 0; }
.cart-count { font-size: .68rem; font-weight: 700; color: var(--fx-muted); }
.pay-block {
  flex: 0 0 auto;
  margin-top: 0;
  padding-top: .35rem;
  border-top: 1px solid var(--fx-border);
  overflow: auto;
}
.pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem .4rem;
}
.pay-block .field { margin-bottom: .25rem; }
.pay-block .field > span { font-size: .55rem; }
.pay-block .field input,
.pay-block .field select { height: 30px; font-size: .78rem; }
.cart-foot-hint { margin: .35rem 0 0 !important; font-size: .65rem !important; line-height: 1.3; }
.cash-row { display: flex; gap: .35rem; align-items: center; }
.cash-row input { flex: 1; }
.cash-chips { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .2rem; }
.cash-chips button {
  border: 1px solid var(--fx-border); background: #fff; border-radius: 999px;
  padding: .12rem .4rem; font-weight: 700; font-size: .65rem; color: var(--fx-navy);
}
.cash-chips button:hover { border-color: var(--fx-primary); color: var(--fx-primary); }
.more-details { margin-top: .5rem; color: var(--fx-muted); font-size: .78rem; }
.more-details summary { cursor: pointer; font-weight: 700; color: var(--fx-navy); }

/* Model / dept — single-row chips (kills tall tile waste) */
.browse-crumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem;
  margin: 0; font-size: .7rem; font-weight: 700; flex: 0 0 auto;
}
.crumb-link {
  border: 0; background: transparent; color: var(--fx-primary);
  cursor: pointer; font: inherit; font-weight: 800; padding: 0; text-decoration: underline;
}
.crumb-sep { color: var(--fx-muted); }
.crumb-now { color: var(--fx-navy); }
.model-bar, .dept-bar { margin: 0; flex: 0 0 auto; max-height: none; overflow: visible; }
.chip-scroll {
  display: flex; flex-wrap: nowrap; gap: .3rem; overflow-x: auto;
  padding-bottom: .15rem; scrollbar-width: thin;
}
.chip-wrap { position: relative; flex: 0 0 auto; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--fx-border); border-radius: 999px;
  background: #fff; padding: .28rem .55rem; cursor: pointer;
  font: inherit; color: var(--fx-navy); white-space: nowrap;
}
.chip.on {
  border-color: var(--fx-primary);
  background: rgba(43,111,243,.08);
  box-shadow: inset 0 0 0 1px rgba(43,111,243,.25);
}
.chip.dim { opacity: .45; }
.chip-all { border-style: dashed; }
.chip strong { font-size: .72rem; font-weight: 800; }
.chip span { font-size: .58rem; color: var(--fx-muted); font-weight: 700; }
.chip-x {
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--fx-border);
  background: #fff; color: var(--fx-muted); font-size: .65rem; line-height: 1;
  padding: 0; cursor: pointer; opacity: 0;
}
.chip-wrap:hover .chip-x { opacity: 1; }
.chip-x:hover { color: var(--fx-danger); border-color: var(--fx-danger); }
.chip-add {
  display: inline-flex; align-items: center; gap: .25rem; flex: 0 0 auto;
  border: 1px dashed var(--fx-border); border-radius: 999px; padding: .15rem .2rem .15rem .45rem;
  background: var(--fx-snow);
}
.chip-add input {
  width: 96px; border: 0; background: transparent; font: inherit;
  font-size: .72rem; font-weight: 700; outline: none;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: .35rem;
}
.browse-tile-wrap { position: relative; }
.browse-tile {
  width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--fx-border); border-radius: var(--r-md);
  background: linear-gradient(180deg, #fff, var(--fx-snow));
  padding: .65rem .7rem; display: flex; flex-direction: column; gap: .2rem;
  font: inherit; color: var(--fx-navy); min-height: 72px;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.browse-tile:hover {
  border-color: var(--fx-primary);
  box-shadow: 0 2px 10px rgba(43, 111, 243, .12);
  transform: translateY(-1px);
}
.browse-tile:active { transform: translateY(0); }
.browse-tile.dim { opacity: .5; }
.browse-tile.all-tile { border-style: dashed; background: #fff; }
.browse-tile strong { font-weight: 800; font-size: .88rem; line-height: 1.2; }
.browse-tile span { font-size: .65rem; color: var(--fx-muted); font-weight: 600; }
.brand-tile {
  background: linear-gradient(145deg, #fff 0%, rgba(43, 111, 243, .06) 100%);
  min-height: 84px;
}
.dept-tile { min-height: 68px; }
.browse-tile-all { border-style: dashed; }
.browse-tile-name { font-weight: 800; font-size: .8rem; }
.browse-tile-meta { font-size: .62rem; color: var(--fx-muted); font-weight: 600; }
.tile-del {
  position: absolute; top: 2px; right: 2px; padding: .1rem .3rem !important;
  line-height: 1; opacity: .5;
}
.tile-del:hover { opacity: 1; color: var(--fx-danger); }
.new-model-form {
  display: flex; flex-direction: column; gap: .25rem;
  border: 1px dashed var(--fx-border); border-radius: var(--r-md);
  padding: .4rem; background: #fff; min-height: 52px; justify-content: center;
}
.new-model-form input {
  font: inherit; font-size: .75rem; font-weight: 700; padding: .3rem .4rem;
  border: 1px solid var(--fx-border); border-radius: var(--r-sm);
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: .28rem;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 120px;
  align-content: start;
  background:
    linear-gradient(180deg, transparent 0%, transparent calc(100% - 28px), rgba(9,44,76,.03));
}
.item-card {
  border: 1px solid var(--fx-border); border-radius: var(--r-md); background: #fff;
  padding: .3rem .35rem; text-align: left; display: flex; flex-direction: column; gap: .06rem;
  min-height: 70px; max-height: 88px;
  transition: border-color .12s, box-shadow .12s;
}
.item-card:hover:not(:disabled) {
  border-color: rgba(43,111,243,.5); box-shadow: var(--fx-shadow);
}
.item-card:disabled { opacity: .5; }
.item-card .code { font-size: .55rem; color: var(--fx-muted); font-weight: 600; }
.item-card .name {
  font-weight: 700; font-size: .72rem; line-height: 1.15; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-card .meta {
  font-size: .55rem; color: var(--fx-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-card .row { display: flex; justify-content: space-between; align-items: center; margin-top: .05rem; }
.badge {
  font-size: .55rem; font-weight: 800; padding: .06rem .3rem; border-radius: 999px; color: #fff;
}
.badge.ok { background: var(--fx-success); }
.badge.warn { background: var(--fx-warn); }
.badge.bad { background: var(--fx-danger); }
.price { font-weight: 700; color: var(--fx-primary); font-size: .72rem; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.cart-lines {
  list-style: none; margin: 0; padding: 0; overflow: auto;
  flex: 1 1 auto; min-height: 48px; max-height: 28vh;
}
.cart-lines.is-empty {
  flex: 0 0 auto; max-height: none; min-height: 0; margin: 0;
}
.cart-lines.is-empty .empty {
  border: 0; display: block; padding: .25rem .4rem; margin: 0;
  background: var(--fx-snow); border-radius: var(--r-md); font-size: .72rem; color: var(--fx-muted);
}
.sticky-cart:has(.is-empty) .pay-block {
  margin-top: .15rem;
  padding-top: .3rem;
}
.cart-lines li {
  display: grid; grid-template-columns: 1fr auto; gap: .3rem;
  padding: .28rem 0; border-bottom: 1px solid var(--fx-border); font-size: .74rem;
}
.qty-ctrl { display: inline-flex; align-items: center; gap: .2rem; margin-top: .1rem; }
.qty-ctrl button {
  width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--fx-border); background: #fff; font-size: .7rem;
}
.totals { margin-top: .25rem; display: grid; gap: .1rem; font-size: .76rem; }
.totals .grand { font-size: 1rem; font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.suggest {
  list-style: none; margin: 0; padding: 0; border: 1px solid var(--fx-border); border-radius: var(--r-md);
  background: #fff; max-height: 100px; overflow: auto; box-shadow: var(--fx-shadow-lg);
}
.suggest li { padding: .3rem .5rem; cursor: pointer; border-bottom: 1px solid var(--fx-border); font-size: .74rem; }
.suggest li:hover { background: var(--fx-ice); }
.btn-row { display: flex; gap: .3rem; margin-top: .35rem; flex-wrap: wrap; }
.checkout-actions .btn { flex: 1; min-width: 0; padding: .38rem .4rem; font-size: .72rem; }
.pager-top { margin: 0; }

/* Tables — size to content, scroll if long (no fake empty vault) */
.table-wrap {
  overflow: auto; background: #fff; border: 1px solid var(--fx-border);
  border-radius: var(--r-lg); flex: 0 1 auto; min-height: 0; max-height: min(52vh, 100%);
}
.panel > .table-wrap { box-shadow: none; border: 0; border-radius: 0; }
.panel.report-sales { flex: 0 0 auto; }
.fill-stack {
  overflow: auto;
}
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th, td { padding: .4rem .55rem; border-bottom: 1px solid var(--fx-border); text-align: left; }
th {
  background: var(--fx-snow); position: sticky; top: 0; z-index: 1;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--fx-muted);
}
.tabs { display: flex; gap: .25rem; margin-bottom: .4rem; flex-wrap: wrap; flex: 0 0 auto; }
.tabs button {
  border: 1px solid var(--fx-border); background: #fff; padding: .3rem .65rem;
  border-radius: 999px; font-weight: 700; font-size: .75rem; color: var(--fx-navy);
}
.tabs button.active { background: var(--fx-primary); color: #fff; border-color: var(--fx-primary); }

.alert-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem;
  flex: 1; overflow: auto; align-content: start;
}
.alert-list li {
  background: #fff; border: 1px solid var(--fx-border); border-radius: var(--r-md);
  padding: .5rem .65rem;
}
.alert-list li.unread { border-left: 3px solid var(--fx-primary); }

.modal {
  position: fixed; inset: 0; background: rgba(9,44,76,.48);
  display: grid; place-items: center; z-index: 80; padding: .75rem;
}
.modal-card {
  width: min(720px, 96vw); max-height: 90vh; overflow: auto;
  background: #fff; border-radius: var(--r-lg); padding: 1rem;
  border: 1px solid var(--fx-border); box-shadow: var(--fx-shadow-lg);
}
.modal-card:has(.receipt) {
  width: min(760px, 96vw);
  padding: 0.85rem;
}
.receipt {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: #0f172a;
  background: #fff;
  max-width: 720px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.rcpt-head {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, #092c4c 0%, #0d3a5f 100%);
  color: #fff;
}
.rcpt-logo {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.rcpt-shop {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em;
}
.rcpt-trade, .rcpt-addr {
  font-size: 0.72rem; opacity: 0.85; margin-top: 0.1rem;
}
.rcpt-doc { text-align: right; }
.rcpt-doc-title {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; opacity: 0.8;
}
.rcpt-doc-no {
  font-family: ui-monospace, "Courier New", monospace;
  font-weight: 700; font-size: 0.88rem; margin-top: 0.15rem;
}
.rcpt-reprint {
  display: inline-block; margin-top: 0.25rem;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em;
  padding: 0.1rem 0.4rem; border: 1px solid rgba(255,255,255,.45);
  border-radius: 4px;
}
.rcpt-meta, .rcpt-party {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid #eef2f7;
  font-size: 0.78rem;
}
.rcpt-meta span, .rcpt-party span {
  display: block; color: #64748b; font-size: 0.65rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.rcpt-meta strong, .rcpt-party strong {
  font-weight: 700; color: #092c4c;
}
.rcpt-status.held { color: #c2410c; }
.rcpt-status.refunded { color: #b91c1c; }
.rcpt-status.completed { color: #15803d; }
.rcpt-lines {
  width: 100%; border-collapse: collapse;
  font-size: 0.8rem;
}
.rcpt-lines th {
  text-align: left; font-size: 0.62rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: #64748b;
  background: #f8fafc; padding: 0.45rem 0.55rem;
  border-bottom: 1px solid #e2e8f0;
}
.rcpt-lines td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.rcpt-num { width: 2rem; color: #94a3b8; text-align: center; }
.rcpt-qty { width: 3rem; text-align: center; font-weight: 700; }
.rcpt-money { width: 6.5rem; text-align: right; white-space: nowrap; }
.rcpt-item strong { display: block; color: #092c4c; font-size: 0.82rem; }
.rcpt-sku {
  display: block; font-size: 0.68rem; color: #64748b;
  font-family: ui-monospace, "Courier New", monospace; margin-top: 0.1rem;
}
.rcpt-empty { text-align: center; color: #94a3b8; padding: 1rem !important; }
.rcpt-totals {
  margin: 0.65rem 1.15rem 0.85rem auto;
  width: min(280px, 100%);
  display: flex; flex-direction: column; gap: 0.28rem;
}
.rcpt-row {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.8rem; color: #334155;
}
.rcpt-row.is-total {
  margin-top: 0.25rem; padding-top: 0.4rem;
  border-top: 2px solid #092c4c;
  font-size: 1rem; font-weight: 800; color: #092c4c;
}
.rcpt-hold {
  margin: 0 1.15rem 0.85rem;
  padding: 0.55rem 0.7rem;
  background: #fff7ed; border: 1px solid #fdba74;
  border-radius: 8px; color: #9a3412;
  font-size: 0.78rem; font-weight: 650; text-align: center;
}
.rcpt-foot {
  padding: 0.85rem 1.15rem 1rem;
  border-top: 1px dashed #cbd5e1;
  text-align: center;
}
.rcpt-thanks {
  font-weight: 800; color: #092c4c; font-size: 0.9rem;
}
.rcpt-policy {
  font-size: 0.72rem; color: #64748b; margin-top: 0.25rem;
}
.rcpt-engine {
  margin-top: 0.55rem; font-size: 0.62rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: #94a3b8; font-weight: 700;
}
.rcpt-actions { margin-top: 0.85rem; justify-content: flex-end; }

@media print {
  body * { visibility: hidden; }
  #print-root, #print-root * { visibility: visible; }
  #print-root {
    position: absolute; left: 0; top: 0;
    width: 210mm; max-width: 210mm;
    padding: 10mm 12mm; margin: 0;
    border: none; border-radius: 0;
    box-shadow: none; background: #fff;
  }
  .rcpt-head {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .no-print { display: none !important; }
  .modal, .modal-card {
    position: static !important; inset: auto !important;
    width: auto !important; max-height: none !important;
    overflow: visible !important; background: transparent !important;
    box-shadow: none !important; border: none !important; padding: 0 !important;
  }
}

.empty {
  color: var(--fx-muted); padding: .75rem; text-align: center; border: 1px dashed var(--fx-border);
  border-radius: var(--r-md); background: var(--fx-snow); font-size: .8rem;
}

.item-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem .65rem;
}
.item-form .field { margin-bottom: 0; }
.item-form .field-full { grid-column: 1 / -1; }
.item-form input,
.item-form select,
.item-form textarea {
  font: inherit; font-size: .85rem; font-weight: 600;
  color: var(--fx-navy); padding: .45rem .55rem; border: 1px solid var(--fx-border);
  border-radius: var(--r-md); background: #fff; height: auto;
}
.item-form textarea { resize: vertical; min-height: 56px; line-height: 1.35; }
.form-msg { margin: .45rem 0 0; font-size: .78rem; font-weight: 700; }
.form-msg.ok { color: var(--fx-success); }
.form-msg.err { color: var(--fx-danger); }
.desc-cell {
  max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--fx-muted); font-size: .75rem;
}
.click-row { cursor: pointer; }
.click-row:hover { background: var(--fx-ice); }

/* Global pagination */
.pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .4rem; margin-top: .4rem; padding: .4rem 0 0;
  border-top: 1px solid var(--fx-border); flex: 0 0 auto;
}
.pager-info { font-size: .72rem; font-weight: 700; color: var(--fx-muted); }
.pager-btns { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.pager-page { font-size: .72rem; font-weight: 800; color: var(--fx-navy); padding: 0 .3rem; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Owner Today (shop-owner primary) ───────────────────── */
.owner-home {
  display: flex; flex-direction: column; gap: .65rem;
  max-width: none; margin: 0; width: 100%;
  padding-bottom: .5rem;
}
.owner-hero {
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem 1.05rem;
  color: #fff;
  background: linear-gradient(135deg, #0a3558 0%, #1e56c9 55%, #2b6ff3 100%);
  box-shadow: var(--fx-shadow-lg);
}
.owner-hero.profit {
  background: linear-gradient(135deg, #0d5c38 0%, #2f9e5f 60%, #3db870 100%);
}
.owner-hero.loss {
  background: linear-gradient(135deg, #8b1e1e 0%, #e04545 70%, #ef6b6b 100%);
}
.owner-hero.neutral {
  background: linear-gradient(135deg, #092c4c 0%, #3a5166 100%);
}
.owner-hero-label {
  font-size: .68rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; opacity: .85;
}
.owner-hero-value {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.85rem, 7vw, 2.55rem); letter-spacing: -.03em;
  margin: .15rem 0 .2rem; line-height: 1.05;
}
.owner-hero-meta { font-size: .8rem; opacity: .9; }
.owner-day-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
}
.owner-day-cards .stat {
  background: var(--fx-white); border: 1px solid var(--fx-border);
  border-radius: var(--r-md); padding: .55rem .65rem; box-shadow: var(--fx-shadow);
}
.owner-day-cards .stat .label {
  font-size: .58rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--fx-muted);
}
.owner-day-cards .stat .value {
  font-family: var(--font-display); font-weight: 800;
  font-size: 1.05rem; margin: .15rem 0 .05rem;
}
.owner-day-cards .stat .meta { font-size: .68rem; color: var(--fx-muted); }
.owner-day-cards .stat.loan .value { color: var(--fx-warn); }
.owner-day-cards .stat.profit .value { color: var(--fx-success); }
.owner-day-cards .stat.loss .value { color: var(--fx-danger); }
.owner-block .panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .45rem;
}
.panel-head-actions { display: flex; align-items: center; gap: .35rem; }
.excel-panel .excel-actions { flex-wrap: wrap; gap: .4rem; }
.excel-file-btn { display: inline-flex; align-items: center; cursor: pointer; margin: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.owner-block .panel-head h3 { margin: 0; font-size: .92rem; }
.meta-pill {
  font-size: .65rem; font-weight: 800; background: var(--fx-ice);
  border: 1px solid var(--fx-border); border-radius: 999px;
  padding: .15rem .45rem; color: var(--fx-muted);
}
.sold-item-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: .35rem;
}
.sold-item-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .55rem; align-items: center;
  padding: .55rem .6rem;
  background: var(--fx-snow);
  border: 1px solid var(--fx-border);
  border-radius: var(--r-md);
}
.sold-main { min-width: 0; }
.sold-main strong {
  display: block; font-size: .85rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sold-main .meta { font-size: .68rem; color: var(--fx-muted); }
.sold-qty {
  font-weight: 800; font-size: .85rem; color: var(--fx-navy);
  background: var(--fx-ice); border-radius: var(--r-sm);
  padding: .2rem .4rem; text-align: center;
}
.sold-money { text-align: right; }
.sold-money strong { display: block; font-size: .85rem; }
.sold-money .meta { font-size: .68rem; font-weight: 700; }
.sold-money .profit, td.profit, .profit { color: var(--fx-success); }
.sold-money .loss, td.loss, .loss { color: var(--fx-danger); }
.owner-receipt-list li { grid-template-columns: 1fr auto; }

/* Mobile chrome defaults (desktop hide) */
.date-filter {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem .55rem;
  margin: .35rem 0 .5rem; padding: .4rem .5rem;
  background: var(--fx-snow, #f6f8fb); border: 1px solid var(--fx-border);
  border-radius: var(--r-md);
}
.date-field {
  display: flex; flex-direction: column; gap: .15rem; font-size: .65rem;
  font-weight: 700; color: var(--fx-muted); text-transform: uppercase;
}
.date-field input[type="date"] {
  font: inherit; font-size: .78rem; font-weight: 700; color: var(--fx-navy);
  height: 32px; padding: 0 .4rem; border: 1px solid var(--fx-border);
  border-radius: var(--r-sm); background: #fff; min-width: 9.5rem;
}
.cust-layout {
  display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: .75rem;
  align-items: start;
}
.cust-profile { display: flex; flex-direction: column; gap: .75rem; }
.cust-stats { margin-top: .65rem; }
.soft-count {
  font-size: .75rem; font-weight: 700; color: var(--fx-muted); margin-left: .25rem;
}
@media (max-width: 900px) {
  .cust-layout { grid-template-columns: 1fr; }
}

.nav-backdrop { display: none; }
.bottom-nav { display: none; }

@media (max-width: 900px) {
  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  /* Brand → Dept → Items first; cart under the picker on phone */
  .pos-layout > .panel-items { order: 0; }
  .pos-layout > .panel-cart {
    order: 1;
    position: sticky;
    bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 5;
  }
  .app { height: auto; min-height: 100dvh; overflow: auto; }
  .main { height: auto; overflow: visible; min-height: 100dvh; }
  .content {
    overflow: visible;
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  }
  .owner-day-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  :root { --top-h: 48px; --nav-w: min(280px, 86vw); }

  .btn-menu {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: 0 0 auto;
    border: 1px solid var(--fx-border); border-radius: var(--r-md);
    background: var(--fx-white); color: var(--fx-navy);
    font-size: 1.15rem; line-height: 1; padding: 0;
  }
  .top-inner { gap: .45rem; }
  .top-lead { min-width: 0; flex: 1; }
  .top h2 { font-size: .98rem; }
  .top .desc { display: none; }
  .user-meta { display: none; }
  .top-profile .btn-sm { padding: .25rem .45rem; font-size: .7rem; }

  .app { flex-direction: row; height: auto; min-height: 100dvh; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--nav-w); flex-basis: var(--nav-w);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: none;
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 28px rgba(9, 44, 76, .28);
  }
  .nav-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(9, 44, 76, .45); z-index: 35;
  }
  .nav-backdrop[hidden] { display: none !important; }

  .main { width: 100%; flex: 1; min-width: 0; }
  .content { padding: .55rem .55rem 0; }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 30;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--fx-border);
    padding: .28rem .2rem calc(.28rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 18px rgba(9, 44, 76, .08);
  }
  .bnav-item {
    display: flex; flex-direction: column; align-items: center; gap: .1rem;
    border: 0; background: transparent; color: var(--fx-muted);
    font-size: .58rem; font-weight: 800; padding: .25rem .1rem;
    border-radius: var(--r-sm);
  }
  .bnav-ico { font-size: 1.05rem; line-height: 1; }
  .bnav-item.on { color: var(--fx-primary); background: rgba(43,111,243,.08); }

  .item-form { grid-template-columns: 1fr; }
  .pager { flex-direction: column; align-items: stretch; }
  .pager-btns { justify-content: center; }
  .cards:not(.owner-day-cards) { grid-template-columns: 1fr 1fr; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sold-item-list li {
    grid-template-columns: 1fr auto;
    grid-template-areas: "main qty" "main money";
  }
  .sold-main { grid-area: main; }
  .sold-qty { grid-area: qty; justify-self: end; }
  .sold-money { grid-area: money; }
  .owner-receipt-list li { grid-template-areas: "main money"; }
  .auth-card { width: min(100%, 420px); padding: 1.1rem; }
  .modal-card { width: min(100vw - 1rem, 520px); max-height: 90dvh; overflow: auto; }
}

@media (max-width: 480px) {
  .owner-day-cards { grid-template-columns: 1fr 1fr; }
  .owner-hero { padding: .85rem .9rem; }
  .owner-hero-value { font-size: 2rem; }
  .cards:not(.owner-day-cards) { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
  .panel { padding: .55rem; }
}

