/* ============================================================
   kasirin — application shell & screens
   ============================================================ */

html, body.app-body { height: 100%; }
body.app-body { overflow: hidden; }

.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 372px;
  height: 100dvh;
}

/* ---------- sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; }
.sb-brand img { width: 32px; height: 32px; border-radius: 9px; }
.sb-brand .word { font-size: 1.1rem; font-weight: 800; letter-spacing: -.045em; }
.sb-brand .word b { color: var(--accent-500); }
.sb-nav { display: flex; flex-direction: column; gap: 3px; }
.navitem {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--r-md);
  font-size: .9rem; font-weight: 600; color: var(--ink-2);
  transition: background .16s var(--ease), color .16s var(--ease);
  text-align: left; width: 100%;
}
.navitem svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.navitem:hover { background: var(--surface-3); color: var(--ink); }
.navitem[aria-current="page"] {
  background: var(--brand-50); color: var(--brand-700);
}
.navitem[aria-current="page"] svg { color: var(--brand-600); }
[data-theme="dark"] .navitem[aria-current="page"] { color: var(--brand-300); }
.navitem .count {
  margin-left: auto; font-size: .72rem; font-weight: 800;
  background: var(--surface-3); color: var(--muted); border-radius: var(--r-pill);
  padding: 2px 7px; min-width: 22px; text-align: center;
}
.navitem[aria-current="page"] .count { background: var(--brand-100); color: var(--brand-700); }
[data-theme="dark"] .navitem[aria-current="page"] .count { background: #12483A; color: var(--brand-200); }

.sb-store {
  margin-top: auto; padding: 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.sb-store .av {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: .9rem;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff;
  overflow: hidden;
}
.sb-store .av img { width: 100%; height: 100%; object-fit: cover; }
.sb-store .nm { font-size: .84rem; font-weight: 700; line-height: 1.2; }
.sb-store .sub { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.sb-foot { display: flex; gap: 6px; }
.sb-foot .btn { flex: 1; }

/* ---------- workspace ---------- */
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: transparent; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(10px);
  flex: none;
}
.topbar .mobile-brand { display: none; }
.search-wrap {
  position: relative; flex: 1; max-width: 520px;
}
.search-wrap svg.ic {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--muted-2); pointer-events: none;
}
.search-wrap input {
  width: 100%; height: 42px; padding: 0 74px 0 40px;
  border-radius: var(--r-pill); border: 1px solid var(--line-strong);
  background: var(--surface); font-size: .92rem;
}
.search-wrap input:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
.search-wrap .hint {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 4px; pointer-events: none;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.view {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 20px 22px 34px;
  scrollbar-gutter: stable;
}
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h1 { font-size: 1.5rem; letter-spacing: -.03em; }
.view-head .sub { font-size: .86rem; color: var(--muted); margin-top: 3px; }

/* ---------- category rail ---------- */
.cat-rail {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 26px 10px 2px; margin-bottom: 12px;
  scrollbar-width: none; scroll-padding-right: 26px;
}
.cat-rail::-webkit-scrollbar { display: none; }

/* ---------- product grid ---------- */
.pgrid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.pcard {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 10px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .13s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
  position: relative; overflow: hidden;
}
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-200); }
.pcard:active { transform: scale(.985); }
.pcard .thumb {
  height: 64px; border-radius: var(--r-sm); display: grid; place-items: center;
  font-size: 1.5rem; background: var(--tint, var(--surface-3));
  position: relative; overflow: hidden;
}
.pcard .thumb .ini { font-family: var(--font-ui); font-weight: 800; font-size: 1.1rem; color: var(--tint-ink, var(--brand-700)); }
.pcard .pname { font-size: .84rem; font-weight: 700; line-height: 1.28; min-height: 2.1em; }
.pcard .pmeta { font-size: .72rem; color: var(--muted); }
.pcard .pprice { font-size: .92rem; font-weight: 800; letter-spacing: -.02em; margin-top: auto; }
.pcard .stocktag {
  position: absolute; bottom: 6px; right: 6px; font-size: .62rem; font-weight: 800;
  padding: 2px 6px; border-radius: var(--r-pill); background: rgba(255,255,255,.9); color: var(--ink-2);
  border: 1px solid var(--line);
}
.pcard .stocktag.low { background: var(--accent-400); color: #2A1B00; border-color: transparent; }
.pcard .stocktag.out { background: var(--danger-500); color: #fff; border-color: transparent; }
.pcard.is-out { opacity: .62; }
.pcard .addhint {
  position: absolute; inset: auto 0 0 0; padding: 6px; text-align: center;
  font-size: .7rem; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, transparent, rgba(10,92,70,.92));
  opacity: 0; transition: opacity .16s var(--ease);
}
.pcard:hover .addhint { opacity: 1; }

/* compact row layout */
.pgrid.rows { grid-template-columns: 1fr; }
.pgrid.rows .pcard {
  flex-direction: row; align-items: center; gap: 12px; padding: 9px 12px;
}
.pgrid.rows .pcard .thumb { width: 44px; height: 44px; flex: none; font-size: 1.1rem; }
.pgrid.rows .pcard .pname { min-height: 0; flex: 1; }
.pgrid.rows .pcard .pmeta { display: none; }
.pgrid.rows .pcard .pprice { margin: 0; }
.pgrid.rows .pcard .stocktag { position: static; }
.pgrid.rows .pcard .addhint { display: none; }

/* ---------- cart ---------- */
.cart-panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-left: 1px solid var(--line);
}
.cart-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px 10px; flex: none;
}
.cart-head h2 { font-size: 1rem; }
.cart-head .sub { font-size: .76rem; color: var(--muted); }
.cart-lines { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 10px 8px; }
.cline {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 8px;
  padding: 9px 8px; border-radius: var(--r-md);
  transition: background .14s var(--ease);
}
.cline:hover { background: var(--surface-2); }
.cline + .cline { border-top: 1px dashed var(--line); border-radius: 0; }
.cline .nm { font-size: .84rem; font-weight: 700; line-height: 1.3; }
.cline .meta { font-size: .74rem; color: var(--muted); }
.cline .lt { font-size: .86rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; gap: 2px; grid-column: 1 / -1; margin-top: 2px; }
.qty button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-weight: 800; font-size: .9rem; color: var(--ink-2);
  background: var(--surface);
}
.qty button:hover { border-color: var(--brand-400); color: var(--brand-700); }
.qty .v {
  min-width: 30px; text-align: center; font-size: .84rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.qty .del { margin-left: auto; border: 0; color: var(--muted); width: 30px; }
.qty .del:hover { color: var(--danger-500); background: var(--danger-50); }
.cart-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.cart-empty .ic {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px;
  background: var(--surface-3); display: grid; place-items: center;
}
.cart-foot { flex: none; padding: 12px 14px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.sumrow { display: flex; justify-content: space-between; font-size: .85rem; padding: 3px 2px; color: var(--ink-2); }
.sumrow.disc { color: var(--brand-700); }
.sumrow.total {
  font-size: 1.15rem; font-weight: 800; letter-spacing: -.03em; color: var(--ink);
  border-top: 1px dashed var(--line-strong); margin-top: 6px; padding-top: 9px;
}
.cart-foot .btn-pay { margin-top: 10px; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 4px; }
.pay-methods button {
  padding: 9px 4px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  font-size: .76rem; font-weight: 700; color: var(--ink-2); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.pay-methods button svg { width: 16px; height: 16px; }
.pay-methods button[aria-pressed="true"] {
  border-color: var(--brand-600); background: var(--brand-600); color: var(--on-brand);
  box-shadow: var(--shadow-sm);
}
.pay-methods button[aria-pressed="true"] svg { color: currentColor; }

/* mobile cart bar */
.cartbar { display: none; }

/* ---------- tables / lists ---------- */
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.lrow {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer; transition: background .14s var(--ease);
  width: 100%; text-align: left;
}
.lrow:last-child { border-bottom: 0; }
.lrow:hover { background: var(--surface-2); }
.lrow .av {
  width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: .88rem; background: var(--brand-50); color: var(--brand-700);
}
[data-theme="dark"] .lrow .av { color: var(--brand-300); }
.lrow .main { flex: 1; min-width: 0; }
.lrow .t { font-size: .9rem; font-weight: 700; }
.lrow .s { font-size: .78rem; color: var(--muted); margin-top: 1px; }
.lrow .amt { font-weight: 800; font-size: .92rem; text-align: right; white-space: nowrap; }

/* kpi */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px; position: relative; overflow: hidden;
}
.kpi-card .lab { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.kpi-card .val { font-size: 1.42rem; font-weight: 800; letter-spacing: -.035em; margin-top: 4px; }
.kpi-card .delta { font-size: .75rem; font-weight: 700; margin-top: 3px; color: var(--brand-600); }
.kpi-card .delta.neg { color: var(--danger-500); }
.kpi-card.hero { background: linear-gradient(140deg, var(--brand-600), var(--brand-700)); border-color: transparent; color: #fff; }
.kpi-card.hero .lab { color: rgba(255,255,255,.72); }
.kpi-card.hero .delta { color: #CFF5E5; }

/* chart */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; margin-top: 14px; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart .bar {
  width: 100%; max-width: 44px; border-radius: 6px 6px 3px 3px; min-height: 3px;
  background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
  transition: height .5s var(--ease); position: relative;
}
.chart .col.today .bar { background: linear-gradient(180deg, var(--accent-400), var(--accent-500)); }
.chart .col span { font-size: .68rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.chart .bar:hover::after {
  content: attr(data-v); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--surface); font-size: .68rem; font-weight: 700;
  padding: 3px 7px; border-radius: 6px; white-space: nowrap;
}

/* settings */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.lap-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 320px); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .lap-main { grid-template-columns: minmax(0, 1fr); } }
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.set-card .hd {
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.set-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: 0; }
.set-row .txt { flex: 1; min-width: 0; }
.set-row .txt .t { font-size: .88rem; font-weight: 700; }
.set-row .txt .s { font-size: .76rem; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.set-row .ctl { flex: none; }

/* receipt */
.receipt {
  background: #fff; color: #111; font-family: var(--font-mono); font-size: 11px; line-height: 1.5;
  padding: 14px 12px; border-radius: 4px; max-width: 300px; margin: 0 auto;
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
}
.receipt .c { text-align: center; }
.receipt .b { font-weight: 700; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 7px 0; }
.receipt .li { display: flex; justify-content: space-between; gap: 6px; }
.receipt .li .n { flex: 1; }
.receipt .tooth {
  height: 8px; margin-top: 10px;
  background: radial-gradient(circle at 4px -2px, transparent 4px, #fff 4px) 0 0/8px 8px repeat-x;
}

/* misc app bits */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-800);
  font-size: .85rem; margin-bottom: 14px;
}
[data-theme="dark"] .banner { color: var(--brand-200); border-color: #17453A; }
.banner svg { width: 18px; height: 18px; flex: none; }
.banner .btn { margin-left: auto; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }

.progress { height: 7px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--brand-500); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 210px minmax(0, 1fr) 330px; }
}
@media (max-width: 1020px) {
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding: 14px 10px; align-items: center; }
  .sb-brand .word, .navitem span.lbl, .sb-store .txt, .sb-foot { display: none; }
  .navitem { justify-content: center; padding: 12px 0; }
  .navitem .count { display: none; }
  .sb-store { padding: 8px; }
  .cart-panel {
    position: fixed; inset: auto 0 0 0; z-index: 60;
    border-left: 0; border-top: 1px solid var(--line);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: 0 -18px 44px -22px rgba(10,40,30,.35);
    transform: translateY(calc(100% - 0px)); transition: transform .28s var(--ease);
    max-height: 84dvh; height: auto;
  }
  .cart-panel.open { transform: none; }
  .cart-panel .cart-lines { max-height: 46dvh; }
  .cartbar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 61;
    padding: 10px 12px 10px 16px; border-radius: var(--r-lg);
    background: linear-gradient(180deg, var(--brand-500), var(--brand-700));
    color: #fff; box-shadow: 0 18px 40px -18px rgba(10,60,45,.7);
  }
  .cartbar .info { flex: 1; min-width: 0; }
  .cartbar .info small { display: block; font-size: .7rem; opacity: .8; }
  .cartbar .info b { font-size: 1.05rem; letter-spacing: -.02em; }
  .cartbar .btn { --btn-bg: rgba(255,255,255,.16); --btn-fg: #fff; --btn-border: rgba(255,255,255,.35); }
  .view { padding-bottom: 96px; }
  .cart-panel .close-sheet { display: grid; }
}
@media (min-width: 1021px) {
  .cart-panel .close-sheet { display: none; }
  .cartbar { display: none !important; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; z-index: 65;
    flex-direction: row; justify-content: space-around; gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .sb-brand, .sb-store, .sb-foot { display: none; }
  .sidebar .kasir-entry { display: none; }
  .sb-nav { overflow-x: auto; scrollbar-width: none; }
  .sb-nav::-webkit-scrollbar { display: none; }
  .navitem { min-width: 56px; }
  .sb-nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .navitem { flex-direction: column; gap: 3px; padding: 6px 4px; border-radius: 10px; flex: 1; }
  .navitem .lbl { display: block !important; font-size: .66rem; font-weight: 700; }
  .navitem[aria-current="page"] { background: var(--brand-50); }
  .topbar { padding: 10px 12px; }
  .topbar .mobile-brand { display: inline-flex; align-items: center; gap: 7px; }
  .topbar .mobile-brand img { width: 26px; height: 26px; border-radius: 7px; }
  .topbar .mobile-brand span { font-size: .95rem; font-weight: 800; letter-spacing: -.04em; display: none; }
  .search-wrap input { padding-right: 40px; }
  .search-wrap .hint { display: none; }
  .view { padding: 14px 12px 150px; }
  .view-head h1 { font-size: 1.25rem; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 8px; }
  .pcard .thumb { height: 58px; font-size: 1.25rem; }
  .pcard .pname { font-size: .78rem; }
  .pcard .pprice { font-size: .86rem; }
  .cartbar { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .kpi-card .val { font-size: 1.2rem; }
}
@media (max-width: 400px) {
  .pgrid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- print ---------- */
@media print {
  body.app-body { overflow: visible; }
  .app, .topbar, .sidebar, .cartbar, .toast-host, .modal-root:not(.printing) { display: none !important; }
  .modal-root.printing { position: static; display: block; padding: 0; }
  .modal-root.printing .modal-backdrop, .modal-root.printing .modal-head,
  .modal-root.printing .modal-foot { display: none !important; }
  .modal-root.printing .modal { box-shadow: none; border: 0; width: 58mm; max-width: 58mm; max-height: none; }
  .modal-root.printing .modal-body { padding: 0; overflow: visible; }
  .receipt { box-shadow: none; max-width: 58mm; padding: 0; font-size: 10.5px; }
  @page { margin: 4mm; size: 58mm auto; }
}

/* ============================================================
   v1.2 — foto produk, varian, kategori, detail, lisensi
   ============================================================ */
.pcard .thumb img.ph { width: 100%; height: 100%; object-fit: cover; display: block; }
img.ph-missing { opacity: .25; }
.pcard .optflag {
  position: absolute; top: 5px; left: 5px; z-index: 2;
  background: rgba(255,255,255,.92); color: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--r-pill); font-size: .66rem; font-weight: 800; line-height: 1;
  padding: 2px 5px; letter-spacing: .02em;
}
.ph-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph-slot { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.ph-slot img { width: 100%; height: 100%; object-fit: cover; }
.ph-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(10,20,16,.6); color: #fff; font-size: .66rem; display: grid; place-items: center;
}
.ph-add {
  aspect-ratio: 1; border: 1.5px dashed var(--line-strong); border-radius: 10px;
  display: grid; place-items: center; gap: 1px; color: var(--muted);
  font-size: .66rem; font-weight: 700; background: var(--surface-2); cursor: pointer;
}
.ph-add span { font-size: 1.25rem; line-height: 1; }

.rep-row { display: grid; grid-template-columns: 1fr 96px 30px; gap: 6px; align-items: center; }
.rep-row[data-urow] { grid-template-columns: 1fr 62px 96px 30px; }
.rep-row .input { min-height: 38px; padding: 6px 9px; font-size: .86rem; }
.rep-del { width: 30px; height: 36px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; }
.rep-del:hover { background: var(--danger-50); color: var(--danger-500); }

details.acc { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
details.acc summary { cursor: pointer; font-size: .86rem; font-weight: 700; display: flex; gap: 8px; align-items: center; }
details.acc summary .badge { margin-left: auto; }

.detail { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 16px; }
@media (max-width: 580px) { .detail { grid-template-columns: 1fr; } }
.detail-photos { display: grid; gap: 6px; }
.detail-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); opacity: .6; cursor: pointer; }
.detail-photos img.on { opacity: 1; border-color: var(--brand-500); }
.detail-ph { aspect-ratio: 1; border-radius: 14px; display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; }
.detail-body { min-width: 0; }

.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.rel-card { text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.rel-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); }
.rel-thumb { height: 62px; border-radius: 8px; display: grid; place-items: center; font-size: 1.4rem; overflow: hidden; }
.rel-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rel-nm { font-size: .78rem; font-weight: 700; line-height: 1.25; }
.rel-pr { font-size: .8rem; font-weight: 800; color: var(--brand-600); }

.cat-dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid; flex: none; }
.swatch { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); }
.swatch:hover { transform: translateY(-1px); }

.target { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; margin-bottom: 10px; }
.warn-note { background: var(--danger-50); border-color: #F3C9C9; color: var(--danger-700) !important; }
[data-theme="dark"] .warn-note { background: #331B1B; border-color: #5A2B2B; color: #FFB4B4 !important; }
.plan-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-weight: 800; flex: none; }
.plan-ic.on { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; }

body.simple .view { font-size: 1.04rem; }
body.simple .pcard .pname { font-size: .92rem; }
body.simple .pcard .thumb { height: 78px; }
body.simple .pcard .pmeta { font-size: .78rem; }
body.simple .kpi-card .delta,
body.simple .chart-card,
body.simple [data-p="adjustHistory"] { display: none; }
body.simple .navitem[data-nav="laporan"] { display: none; }
body.simple .btn { min-height: 46px; }
body.simple .qty button { width: 34px; height: 34px; }

/* --- ringkasan penjual + thumbnail produk --- */
.k4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.k4 .kc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px; }
.k4 .kc .lab { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.k4 .kc .val { font-size: 1.28rem; font-weight: 800; letter-spacing: -.03em; margin-top: 3px; }
.k4 .kc .hint { font-size: .7rem; color: var(--muted); margin-top: 2px; }
.thumb-xs { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex: none; display: grid; place-items: center; font-size: .95rem; background: var(--surface-3); }
img.thumb-xs.ph-missing { background: var(--surface-3); }

/* --- seller center: pesanan & ringkasan --- */
.rk-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr); gap: 12px; align-items: start; }
.oc { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); margin-bottom: 8px; }
.oc:last-child { margin-bottom: 0; }
.oc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.oc-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.oc-list { display: grid; gap: 0; padding-bottom: 8px; }
.oc-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 7px; margin-top: 8px; }
.oc-actions .btn { width: 100%; justify-content: center; }
.navitem .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-500); margin-left: auto; }
@media (max-width: 900px) { .rk-grid { grid-template-columns: 1fr; } }

/* panel keranjang hanya relevan di mode kasir */
body.no-cart .cart-panel { display: none; }
@media (min-width: 1024px) {
  body.no-cart .app { grid-template-columns: 236px minmax(0, 1fr); }
}

/* --- daftar produk versi HP --- */
.prod-mobile { display: none; }
.pm { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; }
.pm-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; display: grid; place-items: center; font-size: 1.2rem; background: var(--surface-3); }
.pm-main { min-width: 0; }
.pm-name { font-size: .84rem; font-weight: 700; text-align: left; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pm-sub { font-size: .68rem; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-price { font-size: .84rem; font-weight: 800; margin-top: 2px; }
.pm-price span { font-size: .66rem; font-weight: 600; color: var(--muted); }
.pm-side { text-align: right; display: grid; gap: 5px; justify-items: end; }
.pm-stock { font-size: .68rem; font-weight: 700; color: var(--ink-2); background: var(--surface-3); border-radius: 6px; padding: 2px 6px; }
.pm-stock.low { background: var(--accent-100); color: var(--accent-700); }
.pm-actions { display: flex; gap: 4px; }
.pm-actions button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .8rem; color: var(--ink-2); display: grid; place-items: center; }
@media (max-width: 720px) {
  .prod-table { display: none; }
  .prod-mobile { display: grid; gap: 8px; }
}

/* bottom bar HP kecil: 6 menu harus muat tanpa terpotong */
@media (max-width: 430px) {
  .sidebar { padding-left: 4px; padding-right: 4px; }
  .sb-nav { gap: 0; justify-content: space-between; }
  .navitem { flex: 1 1 0; min-width: 0; padding: 6px 0; gap: 2px; position: relative; }
  .navitem .lbl { font-size: .58rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .navitem svg { width: 17px; height: 17px; }
  .navitem .count { position: absolute; top: 1px; right: 6px; font-size: .52rem; padding: 0 4px; line-height: 1.3; }
}

/* tombol kasir: hanya di sidebar penuh, jangan tampil saat sidebar menyempit */
.sidebar .kasir-entry { display: none; }
@media (min-width: 1021px) { .sidebar .kasir-entry { display: flex; } }

/* tombol kasir: menempel di bawah nav, bukan melayang di tengah */
.sidebar .kasir-entry {
  margin: 6px 8px 0;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  color: var(--brand-800);
  font-weight: 700;
}
.sidebar .kasir-entry:hover { background: var(--brand-100); }
.sidebar .kasir-entry svg { color: var(--brand-600); }

/* ---------- laporan: chart tren ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 12px; }
.ch-legend { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; color: var(--muted); font-weight: 700; }
.ch-legend i { width: 9px; height: 9px; border-radius: 3px; background: linear-gradient(180deg, var(--brand-400), var(--brand-600)); display: inline-block; }
.ch-wrap { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 8px; margin-top: 12px; }
.ch-y { display: flex; flex-direction: column; justify-content: space-between; height: 210px; padding-bottom: 20px; font-size: .62rem; color: var(--muted-2); text-align: right; font-variant-numeric: tabular-nums; }
.ch-main { min-width: 0; }
.ch-plot { position: relative; height: 210px; }
.ch-grid { position: absolute; inset: 0 0 20px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.ch-grid i { display: block; border-top: 1px dashed var(--line); height: 0; }
.ch-bars { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0,1fr)); gap: 3px; align-items: end; height: 100%; padding-bottom: 20px; }
.ch-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; position: relative; }
.ch-bar { width: 100%; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--brand-400), var(--brand-600)); position: relative; transition: filter .15s; }
.ch-col.zero .ch-bar { background: var(--surface-3); }
.ch-col:hover .ch-bar { filter: brightness(1.06); }
.ch-bar b { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: .56rem; font-weight: 800; color: var(--brand-700); white-space: nowrap; }
.ch-bars.dense { padding-top: 34px; }
.ch-bars.dense .ch-bar b { top: auto; bottom: calc(100% + 4px); writing-mode: vertical-rl; transform: translateX(-50%) rotate(180deg); font-size: .5rem; letter-spacing: -.02em; z-index: 10; text-shadow: 0 0 3px var(--surface), 0 0 4px var(--surface); }
.ch-bars.dense .ch-col > span { font-size: .5rem; letter-spacing: -.02em; }
.ch-col > span { height: 18px; line-height: 18px; margin-top: 2px; font-size: .62rem; color: var(--muted); text-align: center; overflow: visible; white-space: nowrap; }
.ch-foot { display: flex; flex-wrap: wrap; gap: 8px 18px; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.ch-foot div { display: flex; flex-direction: column; gap: 1px; }
.ch-foot span { font-size: .62rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.ch-foot b { font-size: .84rem; }
@media (max-width: 560px) {
  .ch-wrap { grid-template-columns: 34px minmax(0,1fr); }
  .ch-y { font-size: .56rem; }
  .ch-bar b { font-size: .5rem; }
  .ch-bars.dense .ch-bar b { font-size: .42rem; letter-spacing: -.04em; }
  .ch-col > span { font-size: .5rem; }
  .ch-bars.dense .ch-col > span { font-size: .44rem; }
  .ch-foot b { font-size: .78rem; }
}

/* chart: header total + panel rincian transaksi */
.ch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ch-total { text-align: right; }
.ch-total span { display: block; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ch-total b { display: block; font-size: 1.15rem; letter-spacing: -.02em; margin-top: 1px; }
.ch-total small { display: block; font-size: .66rem; color: var(--muted); margin-top: 2px; }
.ch-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(230px, .85fr); gap: 18px; margin-top: 14px; }
.ch-left { min-width: 0; }
.ch-wrap { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 8px; margin-top: 0; }
.ch-right { min-width: 0; border-left: 1px solid var(--line); padding-left: 16px; }
.ch-right-h { font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.ch-list { display: grid; gap: 3px; max-height: 268px; overflow: auto; padding-right: 2px; }
.ch-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 6px 8px; border-radius: 9px; align-items: center; }
.ch-row[data-jump] { cursor: pointer; }
.ch-top { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; background: var(--brand-50); border: 1px solid var(--brand-200); border-radius: 12px; padding: 12px; }
.ch-top-amt { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; color: var(--brand-800); }
.ch-top-when { font-size: .72rem; color: var(--ink-2); }
.ch-top-meta { font-size: .72rem; color: var(--muted); }
.ch-top-link { margin-top: 6px; font-size: .72rem; font-weight: 800; color: var(--brand-700); }
.ch-row:hover { background: var(--surface-2); }
.ch-row.top { background: var(--brand-50); }
.ch-row-a { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.ch-row-a b { font-size: .74rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-row-a span { font-size: .62rem; color: var(--muted); white-space: nowrap; flex: none; }
.ch-row-b { text-align: right; display: grid; gap: 3px; justify-items: end; }
.ch-row-b b { font-size: .74rem; font-variant-numeric: tabular-nums; }
.ch-mini { width: 56px; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: block; }
.ch-mini i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-400), var(--brand-600)); }
.ch-empty { font-size: .76rem; color: var(--muted); padding: 10px 4px; }
@media (max-width: 900px) {
  .ch-body { grid-template-columns: 1fr; gap: 12px; }
  .ch-right { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 12px; }
  .ch-list { max-height: 240px; }
  .ch-total { text-align: left; }
}

/* riwayat transaksi: kartu di HP, tabel di desktop */
.tx-cards { display: none; }
.tx-card { display: grid; gap: 3px; width: 100%; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); background: transparent; }
.tx-card:last-child { border-bottom: 0; }
.tx-top { display: flex; justify-content: space-between; gap: 8px; font-size: .84rem; }
.tx-top b.num { font-variant-numeric: tabular-nums; }
.tx-meta { font-size: .72rem; color: var(--muted); }
.tx-badge { justify-self: start; margin-top: 3px; font-size: .64rem; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.tx-badge.ok { background: var(--brand-50); color: var(--brand-700); }
.tx-badge.danger { background: var(--danger-50); color: var(--danger-700); }
@media (max-width: 720px) {
  .tx-cards { display: block; }
  .tx-table { display: none; }
}
.url-wrap, .mono.tiny { overflow-wrap: anywhere; word-break: break-word; }

/* ---------- kategori: tab + kelola inline ---------- */
.catbar { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; flex-wrap: wrap; }
.cat-scroll { display: flex; gap: 6px; overflow-x: auto; flex: 1 1 320px; min-width: 0; padding-bottom: 2px; scrollbar-width: none; }
.cat-scroll::-webkit-scrollbar { display: none; }
.ctab { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .8rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.ctab b { font-size: .66rem; font-weight: 800; opacity: .7; }
.ctab[aria-pressed="true"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.ctab[aria-pressed="true"] b { opacity: .9; }
.ctab.add { border-style: dashed; color: var(--brand-700); }
.catbar-tools { display: flex; gap: 6px; align-items: center; }
.catbar-tools .input { height: 36px; width: 180px; font-size: .8rem; }
.catmg { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.catmg-head { font-size: .76rem; color: var(--muted); margin-bottom: 8px; }
.catmg-list { display: grid; gap: 6px; }
.catmg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.catmg-row .input { height: 36px; font-size: .84rem; }
.catmg-add { display: flex; gap: 8px; margin-top: 10px; }
.catmg-add .input { height: 38px; flex: 1; }
.thumb-xs.ini, .pm-thumb.ini { display: inline-grid; place-items: center; font-weight: 800; font-size: .9rem; }
.pm-thumb.ini { font-size: 1rem; }
@media (max-width: 720px) {
  .catbar-tools { width: 100%; }
  .catbar-tools .input { flex: 1; width: auto; }
  .catmg-row { grid-template-columns: minmax(0, 1fr) auto; }
  .catmg-row .badge { display: none; }
}

/* ---------- produk: tampilan kartu (grid) vs baris ---------- */
.prod-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.pc { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.pc-media { position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; }
.pc-media img { width: 100%; height: 100%; object-fit: cover; }
.pc-media b { font-size: 2.1rem; font-weight: 800; opacity: .8; }
.pc-media .pm-stock { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.94); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.pc-media .pm-stock.low { background: var(--accent-100); }
.pc-body { padding: 10px 12px 12px; display: grid; gap: 5px; }
.pc-name { font-size: .84rem; font-weight: 700; text-align: left; line-height: 1.28; min-height: 2.15em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-meta { font-size: .66rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-price { font-weight: 800; font-size: .92rem; }
.pc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 3px; }
.pc-actions .btn { justify-content: center; height: 32px; font-size: .72rem; }
.prod-view.rows .prod-cards { display: none !important; }
.prod-view.grid .prod-table, .prod-view.grid .prod-mobile { display: none !important; }
@media (max-width: 720px) {
  .prod-view.grid .prod-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .prod-view.rows .prod-table { display: none !important; }
  .prod-view.rows .prod-mobile { display: grid !important; }
}

/* ---------- modal & panel: ruang aman bawah + info kategori ---------- */
.modal-body { padding-bottom: 20px; scroll-padding-bottom: 16px; }
.catmg-row .badge { display: inline-flex; align-items: center; font-size: .64rem; white-space: nowrap; }
@media (max-width: 520px) {
  .modal { max-height: calc(100dvh - 12px); }
  .modal-body { padding-left: 16px; padding-right: 16px; padding-bottom: 26px; }
  .rel-note { display: none; }
}

/* kategori: satu baris penuh (input + jumlah + hapus) */
.catmg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.catmg-head .btn { flex: none; }
.catmg-row { grid-template-columns: minmax(0, 1fr) auto 32px; align-items: center; }
.catmg-row .input { min-width: 0; }
.catmg-row .badge { display: inline-flex; font-size: .64rem; white-space: nowrap; }
.catmg-row .cat-del { width: 32px; height: 32px; border-radius: 8px; color: var(--danger-500); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.catmg-row .cat-del:disabled { opacity: .35; }
@media (max-width: 720px) {
  .catmg-row { grid-template-columns: minmax(0, 1fr) auto 30px; gap: 6px; }
  .catmg-row .badge { font-size: .6rem; padding: 2px 5px; }
  .catmg-row .cat-del { width: 30px; height: 30px; }
}
.rel-thumb { aspect-ratio: 1 / 1; height: auto; }
.rel-thumb img { object-fit: cover; }
/* kolom varian: nama dipersingkat, harga lebih lega */
.rep-row { grid-template-columns: minmax(0, .8fr) minmax(120px, 1.2fr) 30px; }
.rep-row[data-urow] { grid-template-columns: minmax(0, .8fr) 52px minmax(110px, 1.2fr) 30px; }
@media (max-width: 520px) {
  .rep-row { grid-template-columns: minmax(0, .78fr) minmax(118px, 1.22fr) 30px; gap: 5px; }
  .rep-row[data-urow] { grid-template-columns: minmax(0, .78fr) 46px minmax(104px, 1.22fr) 30px; gap: 5px; }
}

/* penanda baru / stok bertambah di kartu produk app */
.pc-flags { position: absolute; left: 7px; bottom: 7px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.pflag { font-style: normal; font-size: .56rem; font-weight: 800; padding: 3px 6px; border-radius: 6px; border: 1px solid transparent; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.pflag.new { background: #E7F8EF; color: #0A6B45; border-color: #B7E6CD; }
.pflag.restock { background: #FFF4E5; color: #A45B00; border-color: #FFD9A8; }

/* editor foto produk */
.phe { position: fixed; inset: 0; z-index: 200; background: rgba(10, 20, 16, .58); display: grid; place-items: center; padding: 14px; }
.phe-card { width: min(380px, 100%); max-height: calc(100dvh - 28px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); }
.phe-x { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; }
.phe-stage { margin: 10px 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.phe-stage canvas { display: block; width: 100%; height: auto; }
.phe-ratios { width: 100%; }
.phe-ratios button { flex: 1; }
.phe-zoom { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.phe-zoom input { flex: 1; accent-color: var(--brand-600); }
.phe-anchors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.phe-anchors button { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; }
.phe-anchors button i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.phe-anchors button.on { border-color: var(--brand-500); background: var(--brand-50); }
.phe-anchors button.on i { background: var(--brand-600); }

/* iOS: cegah auto-zoom saat fokus input */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 720px) {
    input, select, textarea { font-size: 16px !important; }
  }
}

/* fallback browser lama */
@supports not (backdrop-filter: blur(2px)) {
  .sidebar, .topbar, .cart-panel { background: var(--surface); }
}
