/* ============================================================
   Jagabisnis — Design System (Charcoal + Teal)
   Dark & Light theme (BVI §2.5 two-tone)
   Manrope (heading/body) + JetBrains Mono (angka/finansial)
   ============================================================ */
:root{
  /* DARK (default) */
  --bg:#14171A;
  --bg-darkest:#0D0F11;
  --surface:#1E2226;
  --surface-hover:#262B30;
  --border:#2C3136;
  --text:#F2F4F3;
  --text-dim:#D4D8D7;
  --muted:#9AA3A9;
  --muted-dark:#5B6167;
  --teal:#14B8A6;
  --teal-light:#5EEAD4;
  --teal-dark:#0F8E80;
  --teal-ink:#2DD4BF;      /* teal untuk TEKS/ikon (kontras per-theme) */
  --teal-12:rgba(20,184,166,.14);
  --teal-08:rgba(20,184,166,.08);
  --on-teal:#14171A;       /* teks di atas fill teal (selalu charcoal) */
  --amber:#F5A623;
  --amber-ink:#F5A623;
  --red:#EF4444;
  --red-ink:#EF4444;
  --info:#7FA6C9;
  --topbar-bg:rgba(20,23,26,.85);
  --auth-bg:radial-gradient(120% 80% at 50% 0%,#1a1f23 0%,var(--bg) 55%);
  --shadow:0 6px 24px rgba(0,0,0,.28);
  --radius-sm:8px; --radius:12px; --radius-lg:18px;
  --mono:'JetBrains Mono','Courier New',monospace;
  --sans:'Manrope','Segoe UI',system-ui,sans-serif;
  --sidebar:250px; --maxw:1180px;
}
html[data-theme="light"]{
  --bg:#F2F4F3;
  --bg-darkest:#E7EBEA;
  --surface:#FFFFFF;
  --surface-hover:#F0F3F2;
  --border:#DCE1E0;
  --text:#14171A;
  --text-dim:#2C3136;
  --muted:#5B6167;
  --muted-dark:#9AA3A9;
  --teal:#14B8A6;
  --teal-light:#0F8E80;
  --teal-dark:#0F8E80;
  --teal-ink:#0A7A6E;      /* teal gelap: kontras cukup di atas putih */
  --teal-12:rgba(20,184,166,.14);
  --teal-08:rgba(20,184,166,.10);
  --on-teal:#14171A;
  --amber:#F5A623;
  --amber-ink:#B4720C;
  --red:#EF4444;
  --red-ink:#D42F2F;
  --info:#3C6E9E;
  --topbar-bg:rgba(242,244,243,.9);
  --auth-bg:radial-gradient(120% 80% at 50% 0%,#ffffff 0%,var(--bg) 60%);
  --shadow:0 8px 24px rgba(20,37,64,.10);
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:var(--sans);background:var(--bg);color:var(--text);
  font-size:15px;line-height:1.55;-webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;transition:background .2s,color .2s;
}
h1,h2,h3,h4{font-weight:800;letter-spacing:-.02em;line-height:1.2}
a{color:var(--teal-ink);text-decoration:none}
.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
.muted{color:var(--muted)}
.dim{color:var(--muted-dark)}
.teal{color:var(--teal-ink)}
.up{color:var(--teal-ink)} .down{color:var(--red-ink)}
.boot{height:100vh;display:grid;place-items:center}
.spinner{width:34px;height:34px;border:3px solid var(--border);border-top-color:var(--teal);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.center{text-align:center}
.hide{display:none!important}

/* ---------- BUTTONS ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  background:var(--teal);color:var(--on-teal);border:none;border-radius:var(--radius);
  padding:12px 18px;font-family:inherit;font-weight:700;font-size:15px;cursor:pointer;
  transition:background .15s,transform .05s;min-height:44px;
}
.btn:hover{background:var(--teal-light)}
.btn:active{transform:translateY(1px)}
.btn:disabled{background:var(--muted-dark);color:var(--bg);cursor:default;opacity:.8}
.btn svg{width:18px;height:18px;flex:none}
.btn.block{width:100%}
.btn.sm{padding:8px 12px;font-size:13px;min-height:36px;border-radius:var(--radius-sm)}
.btn.ghost{background:transparent;color:var(--text);border:1px solid var(--border)}
.btn.ghost:hover{border-color:var(--teal);background:var(--teal-08)}
.btn.danger{background:transparent;color:var(--red-ink);border:1px solid var(--red)}
.btn.danger:hover{background:rgba(239,68,68,.12)}
.btn.amber{background:var(--amber);color:var(--on-teal)}
.btn.amber:hover{background:#ffb739}
.linkbtn{background:none;border:none;color:var(--teal-ink);font-family:inherit;font-size:14px;font-weight:600;cursor:pointer;padding:0}
.linkbtn:hover{opacity:.8}
.icon-btn{width:38px;height:38px;border-radius:10px;border:1px solid var(--border);background:transparent;color:var(--muted);display:grid;place-items:center;cursor:pointer;flex:none;transition:.15s}
.icon-btn:hover{border-color:var(--teal);color:var(--teal-ink)}
.icon-btn svg{width:19px;height:19px}
.theme-float{position:fixed;top:16px;right:16px;z-index:60}
.help-q{display:inline-grid;place-items:center;width:20px;height:20px;min-width:20px;border-radius:50%;border:1.5px solid var(--border);background:transparent;color:var(--muted);font-family:var(--sans);font-weight:800;font-size:12px;line-height:1;cursor:pointer;vertical-align:middle;padding:0;transition:.15s}
.help-q:hover{border-color:var(--teal);color:var(--teal-ink);background:var(--teal-08)}
button.icon-btn.help-q{width:38px;height:38px;min-width:38px;font-size:16px;border-radius:10px}
.help-body{font-size:14px;color:var(--text)}
.help-body p{margin:0 0 9px;color:var(--text-dim)}
.help-body ul,.help-body ol{margin:0 0 10px 20px}
.help-body li{margin-bottom:5px;color:var(--text-dim)}
.help-body b{color:var(--text)}
.help-body .mono{font-family:var(--mono);background:var(--teal-08);padding:1px 5px;border-radius:5px;color:var(--teal-ink)}

/* ---------- AUTH / LOGIN ---------- */
.auth{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;background:var(--auth-bg)}
.auth .lm{width:64px;height:64px;margin-bottom:14px;filter:drop-shadow(0 4px 16px rgba(20,184,166,.25))}
.auth .wordmark{font-size:26px;font-weight:800;letter-spacing:-.03em;margin-bottom:4px}
.auth .tag{color:var(--muted);font-size:14px;margin-bottom:26px;text-align:center}
.auth .card{width:100%;max-width:400px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:22px}
.field{display:block;margin-bottom:14px}
.field>span{display:block;font-size:12.5px;font-weight:600;color:var(--muted);margin-bottom:6px}
.inp{
  width:100%;background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-sm);
  padding:12px 13px;color:var(--text);font-family:inherit;font-size:15px;transition:border .15s,box-shadow .15s;
}
html[data-theme="light"] .inp{background:var(--surface)}
.inp:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 3px var(--teal-08)}
.inp.mono{font-family:var(--mono);letter-spacing:1px;text-transform:uppercase}
.inp::placeholder{color:var(--muted-dark)}
select.inp{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239AA3A9' stroke-width='1.6' fill='none'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 13px center;padding-right:34px}
.msg{font-size:13.5px;padding:10px 12px;border-radius:var(--radius-sm);margin-bottom:12px;display:none}
.msg.err{display:block;background:rgba(239,68,68,.12);color:var(--red-ink);border:1px solid rgba(239,68,68,.3)}
.msg.ok{display:block;background:var(--teal-12);color:var(--teal-ink);border:1px solid rgba(20,184,166,.3)}

/* ---------- APP SHELL ---------- */
.shell{display:flex;min-height:100vh;max-width:var(--maxw);margin:0 auto}
.sidebar{
  width:var(--sidebar);flex:none;background:var(--surface);border-right:1px solid var(--border);
  padding:20px 14px;position:sticky;top:0;height:100vh;display:flex;flex-direction:column;gap:4px;
}
.sb-brand{display:flex;align-items:center;gap:10px;padding:4px 8px 18px;font-weight:800;font-size:19px;letter-spacing:-.02em}
.sb-brand img{width:32px;height:32px}
.nav-item{
  display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:var(--radius-sm);
  color:var(--muted);font-weight:600;font-size:14.5px;cursor:pointer;position:relative;transition:background .12s,color .12s;
}
.nav-item svg{width:20px;height:20px;flex:none}
.nav-item:hover{background:var(--surface-hover);color:var(--text)}
.nav-item.active{background:var(--teal-08);color:var(--text)}
.nav-item.active::before{content:"";position:absolute;left:0;top:8px;bottom:8px;width:3px;border-radius:2px;background:var(--teal)}
.sb-spacer{flex:1}
.sb-foot{padding:12px 8px;border-top:1px solid var(--border);margin-top:8px}
.sb-user{font-size:12.5px;color:var(--muted);word-break:break-all;margin-bottom:8px}

.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 20px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--topbar-bg);backdrop-filter:blur(8px);z-index:20;
}
.topbar .mtitle{font-size:18px;font-weight:800}
.topbar .m-logo{display:none;align-items:center;gap:8px;font-weight:800;font-size:17px}
.topbar .m-logo img{width:26px;height:26px}
.topbar .tb-right{display:flex;align-items:center;gap:10px}
.sync{display:inline-flex;align-items:center;gap:6px;font-family:var(--mono);font-size:11.5px;color:var(--teal-ink);background:var(--teal-12);padding:5px 9px;border-radius:20px}
.sync .dot{width:7px;height:7px;border-radius:50%;background:var(--teal);box-shadow:0 0 0 0 rgba(20,184,166,.5);animation:pulse 2s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(20,184,166,.45)}70%{box-shadow:0 0 0 6px rgba(20,184,166,0)}100%{box-shadow:0 0 0 0 rgba(20,184,166,0)}}
.content{padding:20px;flex:1}

/* ---------- METRIC CARDS ---------- */
.grid{display:grid;gap:14px}
.metrics{grid-template-columns:repeat(4,1fr)}
.metric{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px}
.metric.hi{border-color:rgba(20,184,166,.35);box-shadow:0 0 0 3px var(--teal-08)}
.metric .lbl{font-size:12.5px;color:var(--muted);font-weight:600;display:flex;align-items:center;gap:6px;margin-bottom:8px}
.metric .lbl svg{width:15px;height:15px}
.metric .val{font-family:var(--mono);font-size:23px;font-weight:700;letter-spacing:-.5px}
.metric .val.sm{font-size:19px}
.trend{display:inline-flex;align-items:center;gap:4px;font-family:var(--mono);font-size:12.5px;margin-top:6px;font-weight:600}
.trend svg{width:13px;height:13px}

/* ---------- PANELS / SECTIONS ---------- */
.panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px;margin-bottom:16px}
.panel-h{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.panel-h h3{font-size:16px}
.sec-title{font-size:13px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700;margin:22px 0 12px}

.row-item{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--border)}
.row-item:last-child{border-bottom:none}
.row-item .ico{width:38px;height:38px;border-radius:10px;background:var(--teal-08);display:grid;place-items:center;flex:none;color:var(--teal-ink)}
.row-item .ico svg{width:19px;height:19px}
.row-item .grow{flex:1;min-width:0}
.row-item .t{font-weight:600;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-item .s{font-size:12.5px;color:var(--muted)}
.amt{font-family:var(--mono);font-weight:600;white-space:nowrap}

.chip{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;padding:3px 9px;border-radius:20px;border:1px solid var(--border);color:var(--muted)}
.chip.teal{background:var(--teal-12);color:var(--teal-ink);border-color:rgba(20,184,166,.3)}
.chip.amber{background:rgba(245,166,35,.14);color:var(--amber-ink);border-color:rgba(245,166,35,.3)}
.chip.red{background:rgba(239,68,68,.14);color:var(--red-ink);border-color:rgba(239,68,68,.3)}
.badge-sel{cursor:pointer;user-select:none}

.tbl-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
table.tbl{width:100%;border-collapse:collapse;font-size:13.5px;min-width:420px}
.tbl th{text-align:left;padding:10px 10px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.05em;border-bottom:1px solid var(--border);font-weight:700;white-space:nowrap}
.tbl td{padding:11px 10px;border-bottom:1px solid var(--border);vertical-align:middle}
.tbl tr:last-child td{border-bottom:none}
.tbl .num{font-family:var(--mono);text-align:right;white-space:nowrap}

.empty{text-align:center;padding:34px 16px;color:var(--muted)}
.empty svg{width:40px;height:40px;color:var(--muted-dark);margin-bottom:10px}
.empty .big{color:var(--text);font-weight:700;margin-bottom:4px}

/* ---------- POS ---------- */
.pos{display:grid;grid-template-columns:1fr 360px;gap:16px;align-items:start}
.pos-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px}
.pcard{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:12px;cursor:pointer;transition:border .12s,background .12s;text-align:left}
.pcard:hover{border-color:var(--teal);background:var(--teal-08)}
.pcard .pn{font-weight:700;font-size:13.5px;margin-bottom:3px;line-height:1.25}
.pcard .pp{font-family:var(--mono);color:var(--teal-ink);font-size:13.5px;font-weight:600}
.pcard .ps{font-size:11.5px;color:var(--muted);margin-top:4px}
.pcard.out{opacity:.55}
.cart{position:sticky;top:76px}
.cart-line{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--border)}
.cart-line .cl-n{flex:1;font-size:13.5px;font-weight:600}
.qty{display:flex;align-items:center;gap:8px}
.qbtn{width:28px;height:28px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:16px;cursor:pointer;display:grid;place-items:center;line-height:1}
.qbtn:hover{border-color:var(--teal);color:var(--teal-ink)}
.qn{font-family:var(--mono);min-width:20px;text-align:center;font-weight:600}
.pay-methods{display:flex;gap:8px;margin:14px 0}
.pm{flex:1;text-align:center;padding:10px;border-radius:var(--radius-sm);border:1px solid var(--border);cursor:pointer;font-weight:600;font-size:13.5px;color:var(--muted)}
.pm.active{background:var(--teal);color:var(--on-teal);border-color:var(--teal)}
.total-row{display:flex;justify-content:space-between;align-items:baseline;margin:6px 0}
.total-row .big{font-family:var(--mono);font-size:26px;font-weight:700}

.hpp-out{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:6px}
.hpp-card{background:var(--bg);border:1px solid var(--border);border-radius:var(--radius);padding:14px;text-align:center;position:relative}
html[data-theme="light"] .hpp-card{background:var(--bg-darkest)}
.hpp-card.rec{border-color:var(--teal);box-shadow:0 0 0 3px var(--teal-08)}
.hpp-card .tier{font-size:12px;font-weight:700;color:var(--muted);margin-bottom:6px}
.hpp-card .pr{font-family:var(--mono);font-size:19px;font-weight:700;color:var(--teal-ink)}
.hpp-card .mg{font-size:11.5px;margin-top:5px}
.rec-tag{position:absolute;top:-9px;left:50%;transform:translateX(-50%);background:var(--teal);color:var(--on-teal);font-size:10px;font-weight:700;padding:2px 8px;border-radius:20px;white-space:nowrap}
.cost-line{display:flex;gap:8px;margin-bottom:8px;align-items:center}
.cost-line .inp{flex:1}
.cost-line .inp.amt-inp{max-width:130px}
.rm{width:34px;height:34px;flex:none;border:1px solid var(--border);background:var(--bg);border-radius:8px;color:var(--muted);cursor:pointer;display:grid;place-items:center}
html[data-theme="light"] .rm{background:var(--surface)}
.rm:hover{border-color:var(--red);color:var(--red-ink)}

.type-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin:6px 0 18px}
.type-card{background:var(--bg);border:1px solid var(--border);border-radius:var(--radius);padding:14px;cursor:pointer;display:flex;align-items:center;gap:10px;font-weight:600;font-size:14px;transition:border .12s,background .12s}
html[data-theme="light"] .type-card{background:var(--surface)}
.type-card:hover{border-color:var(--teal)}
.type-card.sel{border-color:var(--teal);background:var(--teal-08)}
.type-card .ti{width:34px;height:34px;border-radius:9px;background:var(--teal-12);color:var(--teal-ink);display:grid;place-items:center;flex:none}
.type-card .ti svg{width:18px;height:18px}

.bars{display:flex;align-items:flex-end;gap:6px;height:120px;padding-top:10px}
.bar-col{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%;justify-content:flex-end}
.bar{width:100%;max-width:34px;background:var(--teal);border-radius:5px 5px 0 0;min-height:3px;transition:height .3s}
.bar.dim{background:var(--border)}
.bar-lbl{font-size:10px;color:var(--muted);font-family:var(--mono)}

.toast{position:fixed;left:50%;bottom:80px;transform:translateX(-50%) translateY(20px);background:var(--surface);border:1px solid var(--teal);color:var(--text);padding:12px 18px;border-radius:var(--radius);font-weight:600;font-size:14px;box-shadow:var(--shadow);opacity:0;pointer-events:none;transition:.25s;z-index:100;display:flex;align-items:center;gap:8px}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.toast svg{width:18px;height:18px;color:var(--teal-ink)}
.toast.err{border-color:var(--red)}
.toast.err svg{color:var(--red-ink)}

.overlay{position:fixed;inset:0;background:rgba(0,0,0,.6);display:grid;place-items:center;padding:18px;z-index:90;backdrop-filter:blur(3px)}
.modal{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:20px;width:100%;max-width:440px;max-height:90vh;overflow:auto}
.modal h3{font-size:17px;margin-bottom:16px}

.botnav{display:none}

/* ---------- RESPONSIVE ---------- */
@media(max-width:1000px){ .metrics{grid-template-columns:repeat(2,1fr)} .pos{grid-template-columns:1fr} .cart{position:static} }
@media(max-width:860px){
  .sidebar{display:none}
  .topbar .mtitle{display:none}
  .topbar .m-logo{display:flex}
  .content{padding:16px 15px 90px}
  .hpp-out{grid-template-columns:1fr}
  .botnav{
    display:flex;position:fixed;bottom:0;left:0;right:0;background:var(--surface);border-top:1px solid var(--border);
    padding:6px 4px calc(6px + env(safe-area-inset-bottom));z-index:50;justify-content:space-around;
  }
  .bn{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 2px;color:var(--muted);font-size:10px;font-weight:600;cursor:pointer;border-radius:8px}
  .bn svg{width:22px;height:22px}
  .bn.active{color:var(--teal-ink)}
}
@media(max-width:420px){ .metrics{grid-template-columns:repeat(2,1fr)} .type-grid{grid-template-columns:1fr} }
