/* ===== POS Toko Baju — tema pink fashion, ramah layar sentuh kasir ===== */
:root {
  --pink: #AD1457; --pink-2: #EC407A; --pink-3: #FCE4EC; --bg: #FFF5F8; --card: #fff;
  --text: #2B1B24; --muted: #7A6670; --line: #F1D6E0; --ok: #2E7D32; --warn: #EF6C00; --err: #C62828; --info: #1565C0;
  --radius: 12px; --shadow: 0 2px 10px rgba(173, 20, 87, .08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: .2em 0 .6em; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .error { color: var(--err); min-height: 1.2em; }
.num, td.money, td.int, td.pct { text-align: right; font-variant-numeric: tabular-nums; }
label { display: block; font-size: .85rem; color: var(--muted); margin: .5rem 0; }
label input, label select, label textarea { margin-top: .25rem; }
input, select, textarea { width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pink-2); border-color: transparent; }
input[data-ribuan] { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: auto; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.btn { border: 0; border-radius: 10px; padding: .65rem 1rem; font: inherit; font-weight: 600; cursor: pointer; background: var(--pink-3); color: var(--pink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--pink); color: #fff; } .btn-danger { background: var(--err); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; } .btn-ghost { background: transparent; color: var(--muted); }
.btn-light { background: #fff; color: var(--pink); } .btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; } .btn-xl { font-size: 1.2rem; padding: 1rem; }
.icon-btn { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: inherit; padding: .3rem .5rem; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .25rem .7rem; font-size: .8rem; cursor: pointer; }
.chip.off { background: #FFEBEE; color: var(--err); } .chip.on { color: var(--ok); } .chip.warn { background: #FFF3E0; color: var(--warn); }
.badge { background: var(--warn); color: #fff; border-radius: 6px; padding: .1rem .5rem; font-size: .75rem; font-weight: 700; }
.tag { display: inline-block; padding: .1rem .45rem; border-radius: 6px; font-size: .75rem; background: var(--pink-3); color: var(--pink); }
.tag.ok { background: #E8F5E9; color: var(--ok); } .tag.err { background: #FFEBEE; color: var(--err); } .tag.warn { background: #FFF3E0; color: var(--warn); }

#splash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, #F06292, #AD1457); color: #fff; z-index: 99; font-weight: 700; }
#update-banner { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: .6rem 1rem; border-radius: 12px; z-index: 90; display: flex; gap: 1rem; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.banner { background: #FFF3E0; color: #8D4A00; padding: .5rem 1rem; font-size: .9rem; border-bottom: 1px solid #FFE0B2; }
.banner.err { background: #FFEBEE; color: var(--err); }

#login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-card label { text-align: left; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem; background: #fff; padding: .5rem .8rem; border-bottom: 1px solid var(--line); }
.topbar .store { display: flex; flex-direction: column; line-height: 1.1; } .topbar .spacer { flex: 1; }
.layout { display: flex; min-height: calc(100vh - 54px); }
#nav { width: 210px; background: #fff; border-right: 1px solid var(--line); padding: .5rem; flex-shrink: 0; }
#nav a { display: block; padding: .65rem .8rem; border-radius: 10px; color: var(--text); text-decoration: none; margin-bottom: 2px; }
#nav a.active { background: var(--pink-3); color: var(--pink); font-weight: 700; }
#view { flex: 1; padding: 1rem; min-width: 0; }
@media (max-width: 860px) {
  #nav { position: fixed; top: 54px; bottom: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  #nav.open { transform: none; }
  #view { padding: .6rem; }
  .topbar .store small { display: none; }
}
@media (min-width: 861px) { #menu-btn { display: none; } }

table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { background: #FFF0F5; position: sticky; top: 0; }
.tbl tr.total td { font-weight: 700; background: #FFF8FB; }
.scroll-x { overflow-x: auto; }

/* ---- KASIR ---- */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 1rem; }
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr; } }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; max-height: 65vh; overflow: auto; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .5rem; cursor: pointer; text-align: center; }
.pcard:hover { border-color: var(--pink-2); }
.pcard .name { font-size: .85rem; font-weight: 600; margin-top: .3rem; } .pcard .price { color: var(--pink); font-weight: 700; }
.thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.thumb-initial { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #F8BBD0, #F48FB1); color: #fff; font-size: 1.8rem; font-weight: 800; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.cart-line .meta { font-size: .78rem; color: var(--muted); }
.qty { display: flex; align-items: center; gap: .3rem; } .qty input { width: 56px; text-align: center; padding: .3rem; }
.totals div { display: flex; justify-content: space-between; padding: .15rem 0; }
.totals .grand { font-size: 1.5rem; font-weight: 800; color: var(--pink); }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.variant-grid button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: .6rem; cursor: pointer; text-align: left; }
.variant-grid button:disabled { opacity: .45; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #ccc; vertical-align: middle; margin-right: 4px; }
.pay-tabs { display: flex; gap: .4rem; margin-bottom: .8rem; } .pay-tabs .btn { flex: 1; }
.pay-tabs .btn.active { background: var(--pink); color: #fff; }
.bank-card { display: flex; gap: .8rem; align-items: center; border: 2px solid var(--line); border-radius: 12px; padding: .7rem; cursor: pointer; margin-bottom: .5rem; }
.bank-card.active { border-color: var(--pink); background: #FFF8FB; } .bank-card img { width: 80px; }
.big-amount { font-size: 2.2rem; font-weight: 800; color: var(--pink); text-align: center; margin: .5rem 0; font-variant-numeric: tabular-nums; }
.qris-full { position: fixed; inset: 0; background: #fff; z-index: 120; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; gap: .6rem; }
.qris-full img { max-width: min(80vw, 60vh); max-height: 60vh; }
.qris-full .big-amount { font-size: clamp(2.2rem, 7vw, 4rem); }
.price-alert { margin-top: .3rem; padding: .3rem .5rem; border-radius: 8px; font-size: .82rem; font-weight: 700; }
.price-alert.up { background: #FFEBEE; color: var(--err); } .price-alert.down { background: #E3F2FD; color: var(--info); }

/* ---- modal & toast ---- */
.modal-wrap { position: fixed; inset: 0; background: rgba(43, 27, 36, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: .6rem; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-height: 92vh; display: flex; flex-direction: column; }
.modal-sm { max-width: 380px; } .modal-md { max-width: 560px; } .modal-lg { max-width: 920px; } .modal-full { max-width: none; height: 100%; max-height: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; } .modal-body { padding: 1rem; overflow: auto; } .modal-foot { padding: .8rem 1rem; display: flex; gap: .5rem; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }
#toast-box { position: fixed; top: 64px; right: 12px; z-index: 200; display: flex; flex-direction: column; gap: .4rem; }
.toast { background: var(--text); color: #fff; padding: .6rem .9rem; border-radius: 10px; max-width: 360px; transition: opacity .4s; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.toast-error { background: var(--err); } .toast-ok { background: var(--ok); } .toast-warn { background: var(--warn); }
.toast.hide { opacity: 0; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi .card { margin: 0; } .kpi .v { font-size: 1.4rem; font-weight: 800; color: var(--pink); }
.chart-box { position: relative; height: 340px; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tabs button { border: 0; background: #fff; border-radius: 999px; padding: .45rem .9rem; cursor: pointer; font: inherit; }
.tabs button.active { background: var(--pink); color: #fff; }

/* ---- laporan cetak A4/A5 & label ---- */
.report-paper { background: #fff; padding: 12mm; margin: 0 auto; box-shadow: var(--shadow); }
.report-paper.A4 { width: 210mm; min-height: 297mm; } .report-paper.A5 { width: 148mm; min-height: 210mm; font-size: 11px; }
.report-paper .rh { text-align: center; margin-bottom: 6mm; } .report-paper .trial { border: 2px dashed var(--err); color: var(--err); font-weight: 800; padding: 2mm; text-align: center; margin-bottom: 4mm; }
@media (max-width: 860px) { .report-paper.A4, .report-paper.A5 { width: 100%; min-height: 0; padding: 4mm; } }
.chips { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin: .3rem 0 .6rem; }
label.check { display: inline-flex; align-items: center; gap: .35rem; flex-direction: row; font-weight: 400; }
label.check input { width: auto; margin: 0; }
fieldset { border: 1px dashed var(--pink-3); border-radius: 10px; padding: .6rem .8rem; margin: .6rem 0; }
legend { font-weight: 700; color: var(--pink); padding: 0 .3rem; }
.paper-preview { background: #fff; color: #111; margin: 0 auto; padding: 10mm; box-shadow: 0 2px 12px rgba(0,0,0,.15); overflow: auto; }
.paper-preview.A4 { width: 210mm; max-width: 100%; } .paper-preview.A5 { width: 148mm; max-width: 100%; }
.report-trial { color: #c00; font-weight: 800; text-align: center; border: 2px solid #c00; padding: 4px; margin-bottom: 6px; }
.date-ddmm { display: flex; align-items: center; gap: .2rem; position: relative; margin-top: .25rem; }
.date-ddmm input[type=text] { margin: 0; }
.date-ddmm input.invalid { outline: 2px solid var(--err); }
.date-ddmm .date-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }

/* =====================================================================
   MOBILE / TABLET — layout dinamis (dikelola oleh js/layout.js)
   ===================================================================== */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
#logout-btn .ico { display: none; }
#nav-backdrop { position: fixed; inset: 0; background: rgba(43, 27, 36, .42); z-index: 28; }
#bottom-nav { display: none; }
@media (min-width: 861px) { #nav-backdrop { display: none !important; } }

@media (max-width: 860px) {
  #bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: #fff; border-top: 1px solid var(--line);
    padding: .25rem .2rem calc(.25rem + var(--safe-bottom));
    box-shadow: 0 -2px 12px rgba(173, 20, 87, .10);
  }
  #bottom-nav button {
    flex: 1; min-width: 0; border: 0; background: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .1rem; padding: .35rem .1rem; min-height: 52px; border-radius: 10px;
    font: inherit; font-size: .68rem; color: var(--muted);
  }
  #bottom-nav button .bi { font-size: 1.25rem; line-height: 1; }
  #bottom-nav button .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  #bottom-nav button.active { color: var(--pink); font-weight: 700; background: var(--pink-3); }
  .layout { padding-bottom: calc(62px + var(--safe-bottom)); }
  #nav { top: calc(54px + var(--safe-top)); z-index: 30; width: min(280px, 82vw); }
  .topbar { padding-top: calc(.5rem + var(--safe-top)); }
  #toast-box { top: calc(66px + var(--safe-top)); }
}

@media (max-width: 600px) {
  html, body { font-size: 14px; }
  .topbar { gap: .3rem; padding-left: .5rem; padding-right: .5rem; min-height: 52px; }
  .topbar img { width: 26px; height: 26px; }
  .topbar .store strong { font-size: .88rem; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .badge { font-size: .62rem; padding: .1rem .3rem; }
  .chip { padding: .2rem .45rem; font-size: .72rem; }
  #logout-btn .lbl { display: none; }
  #logout-btn .ico { display: inline; font-size: 1rem; }
  .banner { padding: .4rem .6rem; font-size: .8rem; }
  #view { padding: .6rem .55rem .9rem; }
  .card { padding: .8rem; border-radius: 10px; margin-bottom: .7rem; }
  h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
  .row > * { flex: 1 1 100%; }
  .grid2 { grid-template-columns: 1fr; }
  /* 16px mencegah auto-zoom Safari/iOS saat fokus input */
  input, select, textarea { font-size: 16px; padding: .7rem; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; padding: .35rem .6rem; }
  .icon-btn { min-width: 42px; min-height: 42px; }
  label { margin: .4rem 0; }
  .kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .kpi .card { padding: .7rem; }
  .kpi .v { font-size: 1.15rem; }
  .chart-box { height: 230px; }
  .products { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .45rem; max-height: none; }
  .pcard { padding: .4rem; } .pcard .name { font-size: .78rem; }
  .thumb { border-radius: 6px; }
  .variant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cart-line { grid-template-columns: 1fr auto; }
  .qty input { width: 52px; }
  .totals .grand { font-size: 1.3rem; }
  .big-amount { font-size: 1.8rem; }
  table.tbl { font-size: .78rem; display: block; overflow-x: auto; white-space: nowrap; }
  .tbl th, .tbl td { padding: .4rem .35rem; }
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal { max-height: 94dvh; border-radius: 16px 16px 0 0; width: 100%; }
  .modal-sm, .modal-md, .modal-lg { max-width: none; }
  .modal-full { height: 94dvh; }
  .modal-body { padding: .8rem; }
  .modal-foot { position: sticky; bottom: 0; background: #fff; padding: .6rem .8rem calc(.6rem + var(--safe-bottom)); }
  .modal-foot .btn { flex: 1; }
  #toast-box { left: 10px; right: 10px; top: calc(62px + var(--safe-top)); }
  .toast { max-width: none; }
  #update-banner { bottom: calc(70px + var(--safe-bottom)); width: calc(100% - 20px); justify-content: center; }
  .login-card { max-width: none; padding: 1.2rem; }
  .report-paper { padding: 3mm; }
  .tabs button { padding: .4rem .7rem; font-size: .85rem; }
  .chips { gap: .2rem .5rem; }
  .pay-tabs .btn { padding: .6rem .4rem; font-size: .85rem; }
  .bank-card img { width: 64px; }
}

/* Tablet: lebih lega, tetap ramah sentuh */
@media (min-width: 601px) and (max-width: 860px) {
  #view { padding: .9rem; }
  .products { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .btn { min-height: 46px; }
}

/* Safari lama: dvh belum didukung */
@supports not (height: 100dvh) {
  .modal { max-height: 94vh; }
}

/* =====================================================================
   DASHBOARD COLORFUL
   ===================================================================== */
.dash-hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 1.2rem 1.4rem; margin-bottom: 1rem;
  background: linear-gradient(120deg, #AD1457 0%, #D81B60 45%, #8E24AA 100%); color: #fff;
  box-shadow: 0 8px 24px rgba(173, 20, 87, .25); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.dash-hero::after { content: ''; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.10); }
.dh-salam { font-size: .9rem; opacity: .9; }
.dh-store { font-size: 1.5rem; font-weight: 800; letter-spacing: .2px; margin: .15rem 0; }
.dh-date { font-size: .82rem; opacity: .85; }
.dh-badges { display: flex; gap: .4rem; flex-wrap: wrap; z-index: 1; }
.dh-chip { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: .3rem .7rem; font-size: .75rem; font-weight: 700; }
.dh-chip.up { background: #2E7D32; border-color: #2E7D32; }
.dh-chip.down { background: #C62828; border-color: #C62828; }
.dh-chip.trial { background: #EF6C00; border-color: #EF6C00; }

.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.dk-card { position: relative; overflow: hidden; border-radius: 14px; padding: .9rem 1rem; color: #fff; min-height: 118px; box-shadow: 0 4px 14px rgba(0,0,0,.10); }
.dk-card::after { content: ''; position: absolute; right: -18px; bottom: -28px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,.12); }
.dk-top { display: flex; align-items: center; gap: .45rem; opacity: .92; }
.dk-icon { font-size: 1.15rem; }
.dk-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.dk-value { font-size: 1.55rem; font-weight: 800; margin: .4rem 0 .2rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.dk-sub { font-size: .75rem; opacity: .9; }
.dk-sub a { color: #fff; font-weight: 700; text-decoration: underline; }
.dk-pink { background: linear-gradient(135deg, #AD1457, #EC407A); }
.dk-purple { background: linear-gradient(135deg, #6A1B9A, #AB47BC); }
.dk-orange { background: linear-gradient(135deg, #E65100, #FB8C00); }
.dk-teal { background: linear-gradient(135deg, #00695C, #26A69A); }
.dk-blue { background: linear-gradient(135deg, #1565C0, #42A5F5); }
.dk-red { background: linear-gradient(135deg, #B71C1C, #E53935); }
.dk-amber { background: linear-gradient(135deg, #EF6C00, #FFB300); }
.dk-green { background: linear-gradient(135deg, #2E7D32, #66BB6A); }

.card.dc-chart { border-top: 4px solid var(--pink-2); }
.dc-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; flex-wrap: wrap; }
.dc-head h2 { margin: 0; font-size: 1.05rem; }
.dc-head a { color: var(--pink); font-weight: 700; font-size: .8rem; text-decoration: none; }
.dc-pill { background: var(--pink-3); color: var(--pink); border-radius: 999px; padding: .2rem .65rem; font-size: .8rem; font-weight: 800; }
.dc-pill.warn { background: #FFEBEE; color: var(--err); }
.dc-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .8rem; }
.dash-grid .card { margin: 0; border-top: 3px solid var(--line); }
.dash-grid .card:nth-child(4n+1) { border-top-color: #EC407A; }
.dash-grid .card:nth-child(4n+2) { border-top-color: #8E24AA; }
.dash-grid .card:nth-child(4n+3) { border-top-color: #00897B; }
.dash-grid .card:nth-child(4n+4) { border-top-color: #F9A825; }
.dc-wide { grid-column: 1 / -1; }
.dc-row { margin-bottom: .7rem; }
.dc-row-top { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: .25rem; }
.dc-row-top strong { font-variant-numeric: tabular-nums; }
.dbar { display: block; height: 7px; border-radius: 999px; background: #F3E5F1; overflow: hidden; }
.dbar > span { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.dc-list { list-style: none; margin: 0; padding: 0; }
.dc-list li { display: flex; align-items: center; gap: .5rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); font-size: .82rem; }
.dc-list li:last-child { border: 0; }
.dc-rank { font-family: ui-monospace, monospace; font-size: .72rem; color: var(--muted); background: var(--pink-3); border-radius: 6px; padding: .15rem .35rem; white-space: nowrap; }
.dc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dc-name small { display: block; color: var(--muted); font-weight: 400; font-size: .7rem; }
.dc-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dc-tag { font-size: .65rem; border-radius: 6px; padding: .1rem .35rem; background: #FFF3E0; color: var(--warn); }
.dc-tag.ok { background: #E8F5E9; color: var(--ok); }
.dc-stock { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .4rem .9rem; }
.dc-stock-item { display: flex; align-items: center; gap: .5rem; font-size: .8rem; border-bottom: 1px dashed var(--line); padding: .35rem 0; flex-wrap: wrap; }
.dc-sku { font-family: ui-monospace, monospace; font-size: .7rem; color: var(--muted); }
.dc-stock-num { margin-left: auto; font-weight: 800; color: var(--warn); font-variant-numeric: tabular-nums; }
.dc-stock-num.habis { color: var(--err); }

@media (max-width: 600px) {
  .dash-hero { padding: 1rem; border-radius: 14px; }
  .dh-store { font-size: 1.2rem; }
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .dk-card { min-height: 104px; padding: .7rem .75rem; }
  .dk-value { font-size: 1.15rem; }
  .dk-label { font-size: .68rem; }
  .dc-list li { flex-wrap: wrap; }
  .dc-amt { margin-left: auto; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid .card:nth-child(n) { border-top-color: var(--line); }
}

/* =====================================================================
   PIE CHART + LEGEND — Laporan Item Terbaik
   ===================================================================== */
.rchart-card { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--pink-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.rc-head h3 { margin: 0; font-size: 1.02rem; }
.rc-toggle { display: flex; gap: .3rem; background: #FCE4EC; padding: .2rem; border-radius: 999px; }
.rc-toggle button { border: 0; background: transparent; border-radius: 999px; padding: .35rem .8rem; font: inherit; font-size: .8rem; cursor: pointer; color: var(--pink); }
.rc-toggle button.active { background: var(--pink); color: #fff; font-weight: 700; }
.rc-body { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(240px, 1fr); gap: 1.2rem; align-items: center; }
.rc-canvas { position: relative; height: 320px; min-width: 0; }
.rc-legend { display: flex; flex-direction: column; gap: .15rem; max-height: 320px; overflow: auto; }
.rc-item { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: .5rem; padding: .35rem .4rem; border-bottom: 1px dashed var(--line); font-size: .82rem; }
.rc-swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.rc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rc-pct { min-width: 44px; text-align: right; color: var(--pink); font-weight: 800; font-variant-numeric: tabular-nums; }
.rc-total { display: grid; grid-template-columns: 12px 1fr auto auto; gap: .5rem; align-items: center; padding: .5rem .4rem; margin-top: .2rem; border-top: 2px solid var(--pink-3); font-weight: 800; font-size: .85rem; }
.rc-total span:last-child { color: var(--pink); text-align: right; }
@media (max-width: 700px) {
  .rc-body { grid-template-columns: 1fr; gap: .8rem; }
  .rc-canvas { height: 270px; }
  .rc-legend { max-height: none; }
  .rchart-card { padding: .8rem; }
}
