/* =========================================================
   TokoTani — tema hijau mint (mengikuti referensi desain)
   ========================================================= */
:root {
  --bg: #bfdbd7;
  --bg-2: #f4f8f8;
  --surface: #e7f1f0;
  --surface-2: #f3f8f7;
  --surface-solid: #ffffff;
  --line: #d3e4e1;
  --line-2: #c3d9d5;
  --text: #133a31;
  --text-2: #4b6b63;
  --muted: #7d9a93;
  --primary: #0f5a4a;
  --primary-2: #17795f;
  --accent: #1ea886;
  --accent-soft: #a8e0d0;
  --accent-bg: #d6efe8;
  --success: #138a4c;
  --success-bg: #d4f2df;
  --warning: #b9770e;
  --warning-bg: #fbecc8;
  --danger: #c0392b;
  --danger-bg: #fadbd6;
  --info: #1b6fa8;
  --info-bg: #d7e9f7;
  --sidebar-1: #2c6a5c;
  --sidebar-2: #4ac4a2;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 70, 58, 0.05), 0 6px 20px rgba(15, 70, 58, 0.06);
  --shadow-lg: 0 20px 60px rgba(10, 50, 40, 0.25);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
svg { width: 18px; height: 18px; flex: none; vertical-align: middle; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---------- App frame (kartu besar seperti referensi) ---------- */
.frame {
  min-height: 100vh;
  padding: 18px;
  background: var(--bg);
}
.app {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 36px);
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(165deg, var(--sidebar-1) 0%, #3a9a80 55%, var(--sidebar-2) 100%);
  border-radius: 22px;
  padding: 22px 16px;
  color: #eafff8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-weight: 800; font-size: 18px; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; background: #fff; color: var(--primary);
  display: grid; place-items: center; flex: none;
}
.brand small { display: block; font-size: 11px; font-weight: 500; opacity: 0.75; }
.nav { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.3) transparent; }
.nav a {
  display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, 0.86);
  padding: 10px 14px; border-radius: 14px; font-weight: 600; font-size: 13.5px; margin-bottom: 3px;
  transition: background 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, 0.24); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.95; }
.nav .badge-dot { margin-left: auto; background: #fff; color: var(--primary); font-size: 10px; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.side-foot { padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.15); }
.side-foot a { display: flex; gap: 12px; align-items: center; color: #fff; padding: 10px 14px; font-weight: 600; border-radius: 14px; }
.side-foot a:hover { background: rgba(255,255,255,.1); }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.topbar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
}
.topbar h1 { font-size: 24px; font-weight: 800; color: var(--primary); }
.topbar .sub { font-size: 12.5px; color: var(--muted); }
.topbar .search {
  margin-left: auto; position: relative; width: min(340px, 40vw);
}
.topbar .search input {
  width: 100%; border: 0; background: #fff; border-radius: 99px; padding: 11px 16px 11px 40px; outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.topbar .search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--text-2); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  z-index: 40; max-height: 360px; overflow: auto; padding: 6px;
}
.search-results a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 10px; color: var(--text); }
.search-results a:hover, .search-results a.hl { background: var(--accent-bg); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; background: #fff; border: 0; display: grid; place-items: center;
  cursor: pointer; color: var(--primary); position: relative; flex: none;
}
.icon-btn:hover { background: var(--accent-bg); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #e0533d; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 12px; border: 0; background: transparent; }
.user-chip:hover { background: rgba(255,255,255,.6); }
.avatar { width: 36px; height: 36px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; }
.user-chip .meta { text-align: left; line-height: 1.2; }
.user-chip .meta b { font-size: 13px; display: block; }
.user-chip .meta span { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.menu-btn { display: none; }

.dropdown {
  position: absolute; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; min-width: 220px;
}
.dropdown a, .dropdown button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text); background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--accent-bg); }
.dropdown svg { width: 16px; height: 16px; }
.notif-item { padding: 10px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: flex-start; }
.notif-item:hover { background: var(--surface-2); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card.white { background: var(--surface-2); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h3 { font-size: 17px; font-weight: 800; color: var(--primary); }
.card-h .pill { background: #fff; border-radius: 99px; padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--text-2); }

.kpi {
  background: var(--surface-2); border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; min-width: 0;
  border-top: 4px solid var(--accent);
}
.kpi .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.kpi .value { font-size: 27px; font-weight: 800; margin: 10px 0 6px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .ic { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.kpi .ic svg { width: 17px; height: 17px; }
.kpi .foot { font-size: 12px; color: var(--text-2); }
.up { color: var(--success); font-weight: 700; }
.down { color: var(--danger); font-weight: 700; }
.ring {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: var(--accent);
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), #fff 0); position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
}
.ring::before { content: ''; position: absolute; inset: 6px; background: #fff; border-radius: 50%; }
.ring span { position: relative; }

.promo {
  background: linear-gradient(160deg, #2a6a5b, #47b897); color: #fff; border-radius: var(--radius); padding: 22px; position: relative; overflow: hidden;
}
.promo h3 { color: #fff; font-size: 20px; margin: 12px 0 6px; }
.promo p { opacity: 0.88; margin: 0 0 16px; font-size: 13px; }
.promo .btn { background: rgba(255,255,255,.25); color: #fff; width: 100%; justify-content: center; }
.promo .btn:hover { background: rgba(255,255,255,.35); }
.promo .ico { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; }

.list-item { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.list-item b { display: block; font-size: 13.5px; }
.list-item span { font-size: 12px; color: var(--muted); }

.activity { display: flex; gap: 14px; align-items: center; padding: 10px 0; }
.activity .ai { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }
.activity .ai svg { width: 16px; height: 16px; }
.activity b { font-size: 13.5px; }

/* ---------- Calendar ---------- */
.cal-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-h b { color: var(--primary); font-size: 15px; }
.cal-h button { background: none; border: 0; cursor: pointer; color: var(--primary); padding: 4px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 12.5px; }
.cal .dn { font-size: 11px; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.cal .d { aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; font-weight: 600; position: relative; }
.cal .d.today { background: var(--primary); color: #fff; }
.cal .d.mark::after { content: ''; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: #e0533d; }
.cal .d.sel { box-shadow: inset 0 0 0 1.5px var(--primary); }

/* ---------- Buttons & form ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 13.5px; white-space: nowrap; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.sec { background: #fff; color: var(--primary); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.sec:hover { background: var(--accent-bg); filter: none; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--accent-bg); filter: none; }
.btn.accent { background: var(--accent); }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warning); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.lg { padding: 14px 20px; font-size: 15px; border-radius: 14px; }
.btn.block { width: 100%; justify-content: center; }

label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); min-width: 0; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line-2); background: #fff; border-radius: 11px; padding: 9px 12px; outline: none; font-size: 14px; color: var(--text);
  min-width: 0;
}
textarea.input { resize: vertical; min-height: 70px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30, 168, 134, 0.18); }
.input.sm { padding: 6px 9px; font-size: 13px; border-radius: 9px; }
.input.num { text-align: right; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.seg { display: inline-flex; background: #fff; border-radius: 12px; padding: 3px; gap: 2px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--text-2); font-size: 13px; }
.seg button.on { background: var(--primary); color: #fff; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 9px 16px; border-radius: 12px; font-weight: 700; font-size: 13px; color: var(--text-2); background: var(--surface); white-space: nowrap; }
.tabs a.on { background: var(--primary); color: #fff; }
.tabs a:hover:not(.on) { background: var(--accent-bg); }

/* ---------- Table ---------- */
.tbl-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tbl-tools .input { max-width: 260px; }
.tbl-wrap { overflow-x: auto; border-radius: 14px; background: var(--surface-2); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; background: var(--surface-2); position: sticky; top: 0; }
.tbl th.sortable { cursor: pointer; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: #fff; }
.tbl tfoot td { font-weight: 800; background: var(--accent-bg); border-bottom: 0; }
.tbl .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .c { text-align: center; }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 12.5px; color: var(--muted); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--accent-bg); color: var(--primary); }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.gray { background: #e5ecea; color: var(--text-2); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(9, 38, 31, 0.45); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal {
  background: var(--bg-2); border-radius: 22px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s ease-out;
}
.modal.lg { width: min(860px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal-h { padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 18px; color: var(--primary); }
.modal-b { padding: 20px 22px; overflow-y: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px); }
.toast { background: var(--primary); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; animation: pop .2s; max-width: 380px; }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warning); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 16px; }
.login {
  width: min(900px, 100%); display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.login .hero { background: linear-gradient(160deg, var(--sidebar-1), var(--sidebar-2)); color: #fff; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; min-height: 460px; }
.login .hero h2 { font-size: 30px; line-height: 1.15; margin: 20px 0 10px; }
.login .hero p { opacity: .85; }
.login form { padding: 44px 40px; display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.login form h3 { font-size: 24px; color: var(--primary); }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.pos-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pos-search { display: flex; gap: 8px; }
.pos-search .input { padding: 12px 14px; font-size: 15px; border-radius: 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 0; background: #fff; padding: 7px 14px; border-radius: 99px; font-weight: 700; font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--primary); color: #fff; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pcard { background: var(--surface-2); border-radius: 16px; padding: 10px; cursor: pointer; border: 2px solid transparent; transition: border-color .15s, transform .1s; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.pcard:hover { border-color: var(--accent); }
.pcard:active { transform: scale(.98); }
.pcard .ph { aspect-ratio: 4 / 3; border-radius: 12px; background: linear-gradient(135deg, var(--accent-bg), #fff); display: grid; place-items: center; overflow: hidden; color: var(--accent); }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.pcard .ph svg { width: 34px; height: 34px; opacity: .7; }
.pcard .nm { font-weight: 700; font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 32px; }
.pcard .pr { font-weight: 800; color: var(--primary); }
.pcard .st { font-size: 11px; color: var(--muted); }
.pcard .st.low { color: var(--danger); font-weight: 700; }

.cart { background: var(--surface); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 18px; max-height: calc(100vh - 36px); }
.cart-lines { overflow-y: auto; flex: 1; min-height: 120px; display: flex; flex-direction: column; gap: 8px; margin: 0 -4px; padding: 0 4px; }
.cline { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.cline .t { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 13px; }
.cline .b { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.qty { display: inline-flex; align-items: center; background: #fff; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-2); }
.qty button { border: 0; background: none; width: 30px; height: 30px; cursor: pointer; font-weight: 800; color: var(--primary); font-size: 16px; }
.qty input { width: 52px; border: 0; text-align: center; outline: none; font-weight: 700; background: transparent; }
.cline select { padding: 5px 6px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; font-size: 12.5px; }
.totals { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-size: 13px; }
.totals .tr { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { font-size: 22px; font-weight: 800; color: var(--primary); padding-top: 8px; margin-top: 6px; border-top: 1px dashed var(--line-2); }
.cart-fab { display: none; }
.pay-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { border: 0; background: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 700; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); }
.quick button:hover { background: var(--accent-bg); }
.big-total { text-align: center; padding: 14px; background: var(--accent-bg); border-radius: 16px; margin-bottom: 14px; }
.big-total b { font-size: 30px; color: var(--primary); display: block; }

/* ---------- Line editor (pembelian, mutasi, dll) ---------- */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 50; max-height: 300px; overflow-y: auto; padding: 4px; }
.picker-list div { padding: 9px 11px; border-radius: 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.picker-list div:hover, .picker-list div.hl { background: var(--accent-bg); }
.lines td .input { min-width: 70px; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }
.overlay { display: none; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.stat-mini { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.stat-mini span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-mini b { display: block; font-size: 18px; margin-top: 4px; }
.bar { height: 8px; border-radius: 99px; background: #fff; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.chart-box { position: relative; height: 240px; }
.photo-prev { width: 110px; height: 110px; border-radius: 14px; background: var(--accent-bg); display: grid; place-items: center; overflow: hidden; color: var(--accent); }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; }
#scanner { width: 100%; border-radius: 14px; overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 900px) {
  .frame { padding: 0; }
  .app { grid-template-columns: 1fr; gap: 0; min-height: 100vh; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 270px; height: 100vh; border-radius: 0 22px 22px 0; z-index: 90;
    transform: translateX(-105%); transition: transform .25s ease;
  }
  .sidebar.open { transform: none; }
  .overlay.open { display: block; position: fixed; inset: 0; background: rgba(9, 38, 31, .4); z-index: 80; }
  .main { padding: 12px 16px 90px; gap: 14px; background: var(--bg); min-height: 100vh; }
  .topbar { padding: 12px 14px; gap: 10px; flex-wrap: wrap; position: sticky; top: 8px; z-index: 30; box-shadow: var(--shadow); }
  .topbar h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
  .topbar > div:nth-child(2) { min-width: 0; }
  .topbar .sub { display: none; }
  .topbar .search { order: 10; width: 100%; margin-left: 0; }
  .topbar .search input { padding: 9px 14px 9px 38px; }
  .menu-btn { display: grid; }
  .topbar .spacer { margin-left: auto; }
  .user-chip .meta { display: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .kpi .value { font-size: 22px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 70;
    background: linear-gradient(120deg, var(--sidebar-1), #3a9a80); border-radius: 20px; padding: 6px; box-shadow: var(--shadow-lg);
  }
  .bottom-nav a { color: rgba(255,255,255,.8); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 700; padding: 6px 0; border-radius: 14px; }
  .bottom-nav a.active { background: rgba(255,255,255,.22); color: #fff; }
  .bottom-nav svg { width: 20px; height: 20px; }
  .pos { grid-template-columns: 1fr; }
  #chartsRow { grid-template-columns: 1fr !important; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .cart {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 88vh; z-index: 95; border-radius: 22px 22px 0 0;
    transform: translateY(105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); padding-bottom: 20px;
  }
  .cart.open { transform: none; }
  .cart-fab {
    display: flex; position: fixed; left: 16px; right: 16px; bottom: 84px; z-index: 75; justify-content: space-between; align-items: center;
    background: var(--primary); color: #fff; border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 800; font-size: 15px; box-shadow: var(--shadow-lg);
  }
  .modal-bg { padding: 0; align-items: end; }
  .modal, .modal.lg, .modal.xl { width: 100%; max-height: 94vh; border-radius: 22px 22px 0 0; }
  .toasts { left: 16px; right: 16px; bottom: 90px; }
  .login { grid-template-columns: 1fr; }
  .login .hero { min-height: 0; padding: 28px; }
  .login .hero .hide-m { display: none; }
  .login form { padding: 28px; }
  .tbl-tools .input { max-width: none; flex: 1; }
  .hide-m { display: none !important; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 19px; margin-top: 30px; }
  .kpi .ring { display: none; }
  .pay-row { grid-template-columns: 1fr 1fr; }
}
@media print {
  body * { visibility: hidden; }
}
