/* Smart Shopkeeper Web — colours, type and shapes from the Android theme
   (ui/theme/Color.kt, Theme.kt: cards 14dp, buttons 12dp, Roboto) */
:root {
  --primary: #15803D; --primary-dark: #14532D; --primary-light: #DCFCE7; --on-primary: #FFFFFF;
  --bg: #EEF3EF; --card: #FFFFFF; --card-2: #F6F9F7; --border: #CBD5E1; --border-soft: #E2E8F0;
  --text: #0F172A; --text-2: #334155; --muted: #64748B;
  --red: #DC2626; --red-bg: #FEE2E2; --green: #15803D; --green-bg: #DCFCE7; --amber: #D97706; --amber-bg: #FEF3C7; --blue: #2563EB; --blue-bg: #DBEAFE;
  --topbar: #15803D; --topbar-line: #14532D; --nav-bg: #FFFFFF;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 8px rgba(15, 23, 42, .05);
  --r-card: 14px; --r-btn: 12px;
  --fs: 15px;
}
body.dark {
  --primary: #4ADE80; --primary-dark: #22C55E; --primary-light: #143822; --on-primary: #08130C;
  --bg: #0F1411; --card: #1A221D; --card-2: #151C18; --border: #2E3C33; --border-soft: #26322B;
  --text: #F8FAFC; --text-2: #CBD5E1; --muted: #94A3B8;
  --red: #F87171; --red-bg: #3B1717; --green: #4ADE80; --green-bg: #143822; --amber: #FBBF24; --amber-bg: #3A2D10; --blue: #60A5FA; --blue-bg: #172554;
  --topbar: #143320; --topbar-line: #14532D; --nav-bg: #151C18;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
body.large { --fs: 17px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif; font-size: var(--fs); background: var(--bg); color: var(--text); line-height: 1.4; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
.ms { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: "FILL" 1, "wght" 500; flex: none; }
.ms.o { font-variation-settings: "FILL" 0, "wght" 500; }
.num, .mono { font-variant-numeric: tabular-nums; }
a { color: var(--primary); }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; background: var(--topbar); color: #fff; border-bottom: 1.5px solid var(--topbar-line); height: 60px; display: flex; align-items: center; gap: 4px; padding: 0 max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left)); }
.topbar .title { flex: 1; min-width: 0; font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.topbar .sub { font-size: 12px; opacity: .85; font-weight: 500; display: block; }
.tb-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.tb-btn:hover { background: rgba(255, 255, 255, .15); }
.body-wrap { flex: 1; display: flex; min-height: 0; }
.main { flex: 1; min-width: 0; padding: 14px max(14px, env(safe-area-inset-right)) 110px max(14px, env(safe-area-inset-left)); max-width: 1180px; width: 100%; margin: 0 auto; }


.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--nav-bg); border-top: 1.2px solid var(--border); box-shadow: 0 -4px 14px rgba(0, 0, 0, .06); height: calc(78px + env(safe-area-inset-bottom)); padding: 4px 6px env(safe-area-inset-bottom); display: flex; align-items: center; justify-content: space-evenly; }
.nav-item { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; padding: 0; }
.nav-item .pill { width: 58px; height: 32px; border-radius: 16px; display: grid; place-items: center; }
.nav-item.on { color: var(--primary); }
.nav-item.on .pill { background: var(--primary-light); }
.nav-sale { flex: 1.1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--primary); font-size: 12px; font-weight: 700; }
.nav-sale .fab { width: 46px; height: 46px; border-radius: 50%; background: #15803D; color: #fff; display: grid; place-items: center; border: 2px solid var(--primary-light); box-shadow: 0 3px 8px rgba(0, 0, 0, .25); }
.nav-sale .fab .ms { font-size: 26px; }

.rail { display: none; }
@media (min-width: 960px) {
  .bottom-nav { display: none; }
  .rail { display: flex; flex-direction: column; gap: 4px; width: 96px; flex: none; background: var(--nav-bg); border-right: 1px solid var(--border); padding: 14px 6px; position: sticky; top: 60px; height: calc(100vh - 60px); }
  .rail .nav-item { flex: none; padding: 8px 0; }
  .rail .nav-sale { flex: none; padding: 8px 0 12px; }
  .main { padding-bottom: 32px; }
}

/* ---------- Building blocks ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 8px; }
.card-title { font-size: 17px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card-title .left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.section-title { font-size: 18px; font-weight: 800; margin: 18px 2px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.muted { color: var(--muted); } .t2 { color: var(--text-2); }
.small { font-size: .86em; } .tiny { font-size: .76em; }
.b { font-weight: 700; } .xb { font-weight: 800; }
.red { color: var(--red); } .green { color: var(--green); } .amber { color: var(--amber); } .blue { color: var(--blue); }
.right { text-align: right; } .center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { height: 1px; background: var(--border-soft); margin: 10px 0; }
.big-amt { font-size: 26px; font-weight: 800; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: var(--r-btn); border: 1.6px solid transparent; background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; font-size: .95em; }
body.dark .btn { color: #08130C; }
body.dark .btn.outline, body.dark .btn.ghost { color: var(--primary); }
body.dark .btn.danger-outline { color: var(--red); }
body.dark .btn.danger, body.dark .btn.wa, body.dark .btn.amber { color: #fff; }
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.outline { background: var(--card); color: var(--primary); border-color: var(--primary); }
.btn.ghost { background: transparent; color: var(--primary); border-color: transparent; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-outline { background: var(--card); color: var(--red); border-color: var(--red); }
.btn.wa { background: #16A34A; color: #fff; }
.btn.amber { background: var(--amber); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .86em; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; font-size: 1.05em; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2); flex: none; }
.icon-btn.plain { border: 0; background: transparent; }
.icon-btn.danger { color: var(--red); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > label { font-size: .84em; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; border: 1.4px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--card); color: var(--text); outline: none; font-size: 1em; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.input.right { text-align: right; }
.hint { font-size: .8em; color: var(--muted); }
.err { font-size: .82em; color: var(--red); font-weight: 600; }
.search { position: relative; }
.search .ms { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 21px; }
.search .input { padding-left: 42px; padding-right: 40px; }
.search .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; }
.input-wrap { position: relative; }
.input-wrap .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.4px solid var(--border); background: var(--card); color: var(--text-2); border-radius: 18px; padding: 7px 14px; font-weight: 600; cursor: pointer; font-size: .88em; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.chip.on { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.seg { display: inline-flex; border: 1.4px solid var(--primary); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: var(--card); color: var(--primary); padding: 9px 16px; font-weight: 700; cursor: pointer; min-height: 40px; }
.seg button + button { border-left: 1.4px solid var(--primary); }
.seg button.on { background: var(--primary); color: #fff; }
body.dark .seg button.on { color: #08130C; }
.field > .seg, .field > div > .seg { align-self: flex-start; }
.seg.full { display: flex; } .seg.full button { flex: 1; }
.badge { display: inline-flex; align-items: center; gap: 3px; border-radius: 8px; padding: 2px 8px; font-size: .74em; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); } .badge.red { background: var(--red-bg); color: var(--red); } .badge.amber { background: var(--amber-bg); color: var(--amber); } .badge.blue { background: var(--blue-bg); color: var(--blue); } .badge.gray { background: var(--card-2); color: var(--muted); border: 1px solid var(--border-soft); }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--border); transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }

/* lists */
.list { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; } .li.click:hover { background: var(--card-2); }
.li .t { font-weight: 700; } .li .s { font-size: .84em; color: var(--muted); }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-light); color: var(--primary); font-weight: 800; flex: none; }
.icon-tile { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-light); color: var(--primary); flex: none; }
.empty { text-align: center; color: var(--muted); padding: 26px 12px; }
.empty .ms { font-size: 40px; display: block; margin: 0 auto 6px; opacity: .5; }

/* stats */
.stat { background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat .l { font-size: .8em; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.stat .v { font-size: 1.25em; font-weight: 800; margin-top: 2px; word-break: break-word; }
.stat.click { cursor: pointer; }
.stat.red { background: var(--red-bg); border-color: transparent; } .stat.green { background: var(--green-bg); border-color: transparent; } .stat.amber { background: var(--amber-bg); border-color: transparent; }
.hero { background: linear-gradient(135deg, #15803D, #14532D); color: #fff; border-radius: var(--r-card); padding: 16px; }
.hero .l { opacity: .85; font-size: .88em; font-weight: 600; }
.hero .v { font-size: 1.8em; font-weight: 800; }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .86em; }
.tbl th { background: var(--primary-dark); color: #fff; text-align: left; padding: 9px 10px; font-weight: 700; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.tbl td.r, .tbl th.r { text-align: right; white-space: nowrap; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--card-2); }
.tbl tfoot td { font-weight: 800; background: var(--primary-light); color: var(--primary); }
.tbl tr.sub td { background: var(--card-2); font-weight: 700; }

/* product cards */
.p-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; box-shadow: var(--shadow); }
.p-card:hover { border-color: var(--primary); }
.p-card .name { font-weight: 700; font-size: 1.02em; }
.p-card .meta { font-size: .82em; color: var(--muted); }

/* cart */
.cart-item { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.cart-item:last-child { border-bottom: 0; }
.qty { display: inline-flex; align-items: center; border: 1.4px solid var(--border); border-radius: 12px; overflow: hidden; }
.qty button { width: 38px; height: 38px; border: 0; background: var(--card-2); cursor: pointer; color: var(--primary); display: grid; place-items: center; }
.qty input { width: 56px; height: 38px; border: 0; text-align: center; background: var(--card); font-weight: 700; outline: none; }
.sale-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--border); padding: 12px max(14px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 12px; box-shadow: 0 -4px 14px rgba(0, 0, 0, .08); }
@media (min-width: 960px) { .sale-bar { left: 96px; } }
.main.no-nav { padding-bottom: 110px; }
.tot-row { display: flex; justify-content: space-between; padding: 4px 0; }
.tot-row.grand { font-size: 1.2em; font-weight: 800; border-top: 2px solid var(--text); margin-top: 6px; padding-top: 8px; }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 23, .55); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .12s; }
@media (max-width: 640px) { .modal-bg { align-items: flex-end; padding: 0; } .modal { border-radius: 20px 20px 0 0 !important; max-height: 94vh !important; } }
.modal { background: var(--card); border-radius: 20px; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 860px; }
.modal.full { max-width: 980px; }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.modal-h .ttl { flex: 1; min-width: 0; }
.modal-h h3 { margin: 0; font-size: 1.15em; font-weight: 800; }
.modal-h .sub { font-size: .82em; color: var(--muted); }
.modal-b { padding: 16px; overflow-y: auto; flex: 1; }
.modal-f { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-soft); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.modal-f .btn { flex: 1; min-width: 120px; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.toast { position: fixed; left: 50%; top: calc(70px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 200; background: #0F172A; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); max-width: min(92vw, 520px); text-align: center; font-size: .92em; }
.toast.err { background: #B91C1C; }
.loader { position: fixed; inset: 0; z-index: 300; background: rgba(2, 6, 23, .35); display: grid; place-items: center; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #DCFCE7, transparent), radial-gradient(900px 500px at 110% 110%, #FEF3C7, transparent), var(--bg); }
body.dark .auth { background: var(--bg); }
.auth-card { width: 100%; max-width: 430px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 26px 22px; box-shadow: 0 10px 40px rgba(20, 83, 45, .12); }
.logo-badge { width: 76px; height: 76px; border-radius: 22px; background: linear-gradient(135deg, #15803D, #14532D); color: #fff; display: grid; place-items: center; margin: 0 auto 10px; box-shadow: 0 8px 20px rgba(21, 128, 61, .35); }
.logo-badge .ms { font-size: 42px; }
.chhotu { display: inline-block; background: #FFF3E0; border: 1px solid #FFB74D; color: #E65100; font-weight: 700; font-size: 13px; border-radius: 12px; padding: 3px 14px; }
.welcome-feat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.welcome-feat .f { background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 14px; padding: 12px; }
.welcome-feat .f .ms { color: var(--primary); }
.welcome-feat .f b { display: block; margin: 4px 0 2px; font-size: .92em; }
.welcome-feat .f span { font-size: .8em; color: var(--muted); }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primary); }
.pin-dots i.on { background: var(--primary); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.keypad button { height: 58px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); font-size: 22px; font-weight: 700; cursor: pointer; }

/* receipt preview */
.receipt-frame { width: 100%; border: 1px solid var(--border); border-radius: 12px; background: #fff; height: 420px; }
.ledger-type { font-size: .72em; font-weight: 800; border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.manual h3 { margin: 18px 0 6px; color: var(--primary); }
.manual p, .manual li { color: var(--text-2); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.bar-chart .b { flex: 1; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 2px; position: relative; }
.bar-chart .b span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; }
.bar-labels { display: flex; gap: 6px; } .bar-labels span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); overflow: hidden; }
@media print { body * { visibility: hidden; } }

/* =====================================================================
   v2 — Modern Dashboard look (layout + skin only; behaviour unchanged)
   ===================================================================== */
:root {
  --primary: #16A34A; --primary-dark: #0E4D2C; --primary-light: #E7F7EC;
  --bg: #F3F6F4; --card: #FFFFFF; --card-2: #F7FAF8; --border: #DDE5E0; --border-soft: #EAF0EC;
  --text: #0B1A12; --text-2: #3B4A42; --muted: #6B7A72;
  --teal: #0D9488; --teal-bg: #E6F7F5;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .05);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);
  --r-card: 16px; --r-btn: 10px;
  --side-w: 252px;
}
body.dark { --teal: #2DD4BF; --teal-bg: #0F2E2B; --shadow-lg: 0 10px 30px rgba(0,0,0,.5); }
body { font-family: Roboto, "Segoe UI", system-ui, sans-serif; letter-spacing: -.005em; }

.shell.v2 { flex-direction: row; align-items: stretch; }
.shell.v2 .workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* sidebar (desktop) */
.side { display: none; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.side-logo { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #4ADE80, #16A34A); color: #052E16; display: grid; place-items: center; flex: none; box-shadow: 0 4px 12px rgba(34,197,94,.35); }
.side-shop { font-weight: 800; font-size: 16px; color: #fff; }
.side-tag { font-size: 11.5px; color: rgba(255,255,255,.6); }
.side-sale { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 12px; padding: 12px 14px; background: #22C55E; color: #052E16; font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 6px 16px rgba(34,197,94,.35); margin-bottom: 8px; }
.side-sale:hover { background: #4ADE80; }
.side-sale kbd { margin-left: auto; font: 700 11px/1 inherit; background: rgba(5,46,22,.15); border-radius: 6px; padding: 4px 6px; }
.side-group { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.42); margin: 16px 12px 6px; }
.side-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; color: rgba(255,255,255,.78); padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: 14.5px; cursor: pointer; text-align: left; }
.side-item .ms { font-size: 21px; }
.side-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-item.on { background: #fff; color: #0E4D2C; font-weight: 800; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.side-foot { margin-top: auto; padding-top: 14px; }
.side-user { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.07); border-radius: 12px; padding: 10px; color: #fff; }
.side-user .avatar { background: rgba(255,255,255,.14); color: #fff; width: 36px; height: 36px; }
.side-user .tiny { color: rgba(255,255,255,.6); }
.side-user .icon-btn { color: rgba(255,255,255,.8); }

/* top bar */
.shell.v2 .topbar { height: auto; min-height: 60px; background: linear-gradient(120deg, #0E4D2C, #16A34A); border-bottom: 0; box-shadow: 0 4px 14px rgba(14,77,44,.25); }
.shell.v2 .topbar .title { display: flex; flex-direction: column; }
.d-title, .d-only { display: none; }
.m-only { display: grid; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--r-card); padding: 14px; box-shadow: var(--shadow); min-width: 0; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--k-bg); opacity: .6; }
.kpi.click { cursor: pointer; } .kpi.click:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--k-bg); color: var(--k); }
.kpi-l { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-v { font-size: 20px; font-weight: 800; margin-top: 2px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.green { --k: var(--green); --k-bg: var(--green-bg); } .kpi.red { --k: var(--red); --k-bg: var(--red-bg); } .kpi.amber { --k: var(--amber); --k-bg: var(--amber-bg); } .kpi.teal { --k: var(--teal); --k-bg: var(--teal-bg); }

/* quick actions */
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.q-tile { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-soft); background: var(--card); border-radius: 14px; padding: 14px; font-weight: 700; color: var(--text); cursor: pointer; box-shadow: var(--shadow); text-align: left; }
.q-tile .ms { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-light); color: var(--primary); }
.q-tile:hover { border-color: var(--primary); }
.q-tile.primary { background: linear-gradient(120deg, #0E4D2C, #16A34A); color: #fff; border-color: transparent; }
.q-tile.primary .ms { background: rgba(255,255,255,.18); color: #fff; }

/* dashboard grid + tables */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.dash-grid > .card { margin: 0 !important; }
.tbl-wrap { overflow-x: auto; margin: 0 -14px -14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; padding: 10px 14px; background: var(--card-2); border-bottom: 1px solid var(--border-soft); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--card-2); }
.tbl .r { text-align: right; }

/* skin of existing pieces */
.card { border-color: var(--border-soft); }
.card-title { font-size: 16px; font-weight: 800; }
.list { border-color: var(--border-soft); box-shadow: var(--shadow); }
.stat { background: var(--card); border-color: var(--border-soft); border-radius: 14px; padding: 12px 14px; }
.stat .l { text-transform: uppercase; font-size: 11px; letter-spacing: .05em; color: var(--muted); }
.stat.red, .stat.green, .stat.amber { border-left: 4px solid; }
.stat.red { border-left-color: var(--red); } .stat.green { border-left-color: var(--green); } .stat.amber { border-left-color: var(--amber); }
.btn { box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.btn:not(.outline):not(.ghost):not(.danger-outline):not(.wa):not(.danger):not(.amber) { background: linear-gradient(120deg, #15803D, #16A34A); }
.btn.outline, .btn.danger-outline { box-shadow: none; }
.input, select.input, textarea.input { border-radius: 10px; border-color: var(--border); background: var(--card); }
.chip { border-radius: 999px; }
.modal { border-radius: 18px; box-shadow: 0 24px 70px rgba(2, 6, 23, .28); }
.modal-h { padding: 16px 18px; }
.avatar { background: linear-gradient(135deg, #DCFCE7, #BBF7D0); color: #0E4D2C; }

/* mobile bottom nav — floating */
.bottom-nav { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); height: 68px; border-radius: 20px; border: 1px solid var(--border-soft); box-shadow: 0 10px 30px rgba(16,24,40,.16); padding: 4px 6px; }
.nav-item .pill { height: 30px; }
.nav-sale .fab { background: linear-gradient(135deg, #22C55E, #15803D); margin-top: -26px; width: 54px; height: 54px; border: 4px solid var(--bg); }

@media (min-width: 700px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .side { display: flex; flex-direction: column; width: var(--side-w); flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; background: linear-gradient(180deg, #0A3A21 0%, #0E4D2C 100%); scrollbar-width: thin; }
  .shell.v2 .rail { display: none; }
  .shell.v2 .topbar { position: sticky; top: 0; z-index: 40; background: rgba(243,246,244,.86); backdrop-filter: blur(10px); color: var(--text); box-shadow: none; border-bottom: 1px solid var(--border-soft); min-height: 74px; padding: 0 28px; gap: 10px; }
  body.dark .shell.v2 .topbar { background: rgba(15,20,17,.86); }
  .shell.v2 .tb-btn { color: var(--text-2); background: var(--card); border: 1px solid var(--border-soft); width: 40px; height: 40px; border-radius: 10px; }
  .m-shop, .m-only { display: none !important; }
  .d-title { display: block; font-size: 22px; font-weight: 800; color: var(--text); }
  .d-only { display: inline-flex; }
  td.d-only, th.d-only { display: table-cell; }
  .shell.v2 .topbar .sub { color: var(--muted); font-size: 13px; opacity: 1; }
  .tb-sale { min-height: 40px; }
  .shell.v2 .main { padding: 22px 28px 40px; max-width: 1320px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
  .kpi-v { font-size: 22px; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid .span2 { grid-column: span 2; }
}
@media (min-width: 1280px) { .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash-grid .span2 { grid-column: span 2; grid-row: span 2; } }
/* v2 fixes */
.kpi > * { position: relative; z-index: 1; }
.kpi::after { width: 64px; height: 64px; right: -22px; top: -22px; opacity: .5; z-index: 0; }
.btn.ghost { box-shadow: none; }
.dash-grid .stat .v { font-size: 1.05em; white-space: nowrap; }
.tbl td.nw, .tbl td:first-child { white-space: nowrap; }
@media (max-width: 699px) {
  .kpi { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .kpi-ic { width: 34px; height: 34px; border-radius: 10px; }
  .kpi-ic .ms { font-size: 19px; }
  .kpi-l { font-size: 11px; }
  .kpi-v { font-size: 18px; }
  .q-tile { padding: 12px; font-size: 14px; }
  .q-tile .ms { width: 34px; height: 34px; }
}
@media (min-width: 960px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1360px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpi { flex-direction: column; align-items: flex-start; gap: 10px; } }
@media (min-width: 960px) { .shell.v2 .sale-bar { left: var(--side-w); padding-left: 28px; padding-right: 28px; box-shadow: 0 -6px 20px rgba(16,24,40,.06); } }
.side-logo.img { background: #fff; padding: 4px; } .side-logo.img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.clm-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.clm-btns .btn { width: 100%; min-width: 0; white-space: nowrap; }
.cm-opts { display: grid; gap: 8px; }
.cm-opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; border: 1.5px solid var(--border); background: var(--card); border-radius: 12px; padding: 10px 12px; cursor: pointer; color: var(--text); font: inherit; }
.cm-opt .b .ms { font-size: 18px; vertical-align: -3px; color: var(--muted); }
.cm-opt .cm-tick .ms { font-size: 24px; color: var(--muted); }
.cm-opt.on { border-color: var(--primary); background: var(--primary-light); }
.cm-opt.on .cm-tick .ms, .cm-opt.on .b .ms { color: var(--primary); }
.cm-opt:disabled { opacity: .5; cursor: not-allowed; }
/* package rights — hide features not in the shop's package */
body.pkg-no-profit [data-testid="inv_profit"], body.pkg-no-profit [data-act="pp-why"], body.pkg-no-profit [data-pkg~="profit"] { display: none !important; }
body.pkg-no-a4 [data-act="cs-a4"], body.pkg-no-a4 [data-act="inv-a4"], body.pkg-no-a4 [data-act="cs-paper"][data-v="A4"] { display: none !important; }
body.pkg-no-saleReturn [data-act="sr-open"] { display: none !important; }
body.pkg-no-purchaseEdit [data-act="pe-start"] { display: none !important; }
body.pkg-no-whatsapp [data-act$="-wa"], body.pkg-no-whatsapp [data-act$="-whatsapp"], body.pkg-no-whatsapp .btn.wa:not(.keep) { display: none !important; }
body.pkg-no-cheques [data-v="Cheque"], body.pkg-no-cheques [data-v="CHEQUE"] { display: none !important; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; }
.pk-grid .check { margin: 0; font-size: 14px; }
/* branch switcher */
.side-br { display: flex; align-items: center; gap: 8px; margin: -6px 0 14px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
.side-br select { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; font: 600 13.5px/1.2 inherit; outline: none; cursor: pointer; }
.side-br select option { color: #111; }
.m-br { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--border-soft); box-shadow: var(--shadow); }
.m-br .ms { color: var(--primary); }
.m-br select { flex: 1; min-width: 0; border: 0; background: transparent; font: 700 15px/1.2 inherit; color: var(--text); outline: none; }
@media (min-width: 960px) { .m-br { display: none; } }
