/* Pantau Harga & Iklan — NEO-BRUTALISM (diadaptasi dari UI Stock Opname, konsep Joe)
   Putih + aksen kuning #FACC15, border hitam tebal, hard shadow offset, DM Sans.
   Beda dari referensi: layout DESKTOP — sidebar kiri tetap, main fluid.
   CATATAN referensi tetap berlaku: jangan rotasi .card (kartu tinggi melenceng keluar layar);
   aksen miring cukup di elemen kecil (sticker, badge, stat). */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #111111; --paper: #ffffff; --bg: #f7f6f2;
  --acc: #FACC15; --acc-dk: #eab308;
  --ok: #22c55e; --warn: #fb923c; --bad: #ef4444;
  --shp: #fdba74;   /* badge Shopee */
  --ttk: #a5f3fc;   /* badge TikTok */
  --bd: 2.5px solid var(--ink);
  --sh: 4px 4px 0 var(--ink);
  --sh-lg: 6px 6px 0 var(--ink);
  --r: 10px;
  --head: 'DM Sans', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --sidebar-w: 216px;
}
html { -webkit-text-size-adjust: 100%; }
body { font: 15.5px/1.5 var(--body); background: var(--bg); color: var(--ink); }

h1, h2, h3, .title, #brand { font-family: var(--head); font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.15; margin-bottom: 4px; }
h3 { font-size: 16.5px; margin-bottom: 6px; }

/* ---------- Kerangka: sidebar + main ---------- */
#sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--paper); border-right: var(--bd); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 18px; z-index: 20; }
#brand { font-size: 17px; line-height: 1.5; }
#brand .mark { background: var(--acc); padding: 1px 8px; border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink); display: inline-block; transform: rotate(-1.5deg); margin-bottom: 4px; }
#nav { display: flex; flex-direction: column; gap: 10px; }
#nav button { text-align: left; width: 100%; background: var(--paper); font-size: 14.5px;
  padding: 10px 12px; min-height: 44px; box-shadow: 3px 3px 0 var(--ink); }
#nav button.on { background: var(--ink); color: var(--acc); }
#sidefoot { margin-top: auto; }
main { margin-left: var(--sidebar-w); padding: 24px 26px 60px; max-width: 1320px; }

.card { background: var(--paper); border: var(--bd); border-radius: var(--r);
  padding: 16px; margin-bottom: 16px; box-shadow: var(--sh); }
.mut { color: #4b5563; font-size: 13px; }
.sm { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
hr.sep { border: 0; border-top: 2px dashed var(--ink); opacity: .25; margin: 14px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- Kontrol ---------- */
button { font: 700 15px var(--body); border: var(--bd); border-radius: 8px;
  padding: 10px 16px; min-height: 44px; background: var(--acc); color: var(--ink);
  cursor: pointer; box-shadow: var(--sh); transition: transform .05s, box-shadow .05s; }
button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
button.sec { background: var(--paper); }
button.ok { background: var(--ok); }
button.warn { background: var(--warn); }
button.danger { background: var(--bad); color: #fff; }
button.ghost { border: none; box-shadow: none; background: none; color: var(--ink);
  text-decoration: underline 2.5px var(--acc); text-underline-offset: 4px;
  padding: 6px 8px; min-height: 0; }
button.ghost:active { transform: none; }
button.small { padding: 6px 12px; min-height: 36px; font-size: 13px; box-shadow: 3px 3px 0 var(--ink); }
button:disabled { opacity: .4; cursor: default; }
button.block { width: 100%; }

input, select { font: 500 15px var(--body); width: 100%; padding: 10px 12px; min-height: 44px;
  border: var(--bd); border-radius: 8px; background: var(--paper); color: var(--ink); }
input:focus, select:focus { outline: none; box-shadow: var(--sh); background: #fffdf2; }
input::placeholder { color: #9ca3af; font-weight: 500; }
input[type="file"] { padding: 8px; }
label { font-size: 12.5px; font-weight: 700; display: block; margin: 12px 0 5px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Badge & status ---------- */
.badge { display: inline-block; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .3px; white-space: nowrap;
  vertical-align: middle; box-shadow: 2px 2px 0 var(--ink); background: var(--paper); }
.badge.shopee { background: var(--shp); }
.badge.tiktok { background: var(--ttk); }
.badge.ok { background: #86efac; }        /* harga terbaru dari userscript */
.badge.manual { background: var(--acc); } /* harga diisi manual */
.badge.fail { background: var(--bad); color: #fff; }
.badge.stale { background: #e5e7eb; }
.badge.sehat { background: #86efac; }
.badge.boncos { background: var(--bad); color: #fff; }
.badge.nodata { background: #e5e7eb; }
.badge.never { background: #e5e7eb; }

/* ---------- Statistik ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--paper); border: var(--bd); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh); }
.stat:nth-child(1) { transform: rotate(-0.5deg); }
.stat:nth-child(2) { background: var(--acc); transform: rotate(0.6deg); }
.stat b { font-family: var(--head); font-size: 26px; display: block; line-height: 1.1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #374151; }
.stat.alert { background: var(--bad); color: #fff; }
.stat.alert span { color: #fecaca; }

.progress { height: 14px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px;
  overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--acc);
  background-image: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(0,0,0,.12) 8px 16px);
  border-right: 2px solid var(--ink); transition: width .25s; }

.syncline { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #4b5563; font-weight: 500; flex-wrap: wrap; }
.syncline.stale { color: var(--ink); background: var(--acc); border: 2px solid var(--ink);
  padding: 6px 10px; font-weight: 700; box-shadow: 3px 3px 0 var(--ink); }

/* ---------- Tabel ---------- */
.tablewrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 2px solid #e5e7eb; vertical-align: middle; }
th { font-family: var(--head); font-weight: 800; font-size: 12px; letter-spacing: 0;
  white-space: nowrap; position: sticky; top: 0; background: var(--paper);
  border-bottom: 2.5px solid var(--ink); z-index: 2; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fffbeb; }
tr.boncos-row td:first-child { border-left: 5px solid var(--bad); }
tr.sehat-row td:first-child { border-left: 5px solid var(--ok); }
.var-plus { color: #15803d; font-weight: 800; }
.var-min { color: var(--bad); font-weight: 800; }
.ellip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

.filters { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; flex-wrap: wrap; }
.filters button { white-space: nowrap; }
.filters button.on { background: var(--ink); color: var(--acc); }
.filters button.off { background: var(--paper); }

/* ---------- Chart SVG ---------- */
.chartwrap { overflow-x: auto; }
.chartwrap svg { display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; font-weight: 700; margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--ink); margin-right: 5px; vertical-align: -2px; }

/* ---------- Toast & dialog ---------- */
#toast { position: fixed; bottom: 28px; left: calc(var(--sidebar-w) + 50%); transform: translateX(-50%);
  background: var(--ink); color: var(--acc); border: var(--bd);
  padding: 13px 18px; border-radius: 8px; font-size: 14px; font-weight: 700;
  box-shadow: var(--sh-lg); opacity: 0; pointer-events: none; transition: opacity .15s;
  max-width: 70vw; z-index: 50; }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); color: #fff; }

/* ---------- Login ---------- */
.login-wrap { max-width: 380px; margin: 9vh auto 0; }
.login-wrap .card { transform: rotate(-0.6deg); box-shadow: var(--sh-lg); }
.login-wrap h1 { font-size: 30px; margin-bottom: 2px; }
.login-wrap input { margin-bottom: 4px; }
.login-wrap pre { white-space: pre-wrap; word-break: break-word; }
.login-logo { width: 76px; height: 76px; margin: 0 0 -24px 20px; position: relative; z-index: 2;
  background: var(--acc); border: var(--bd); border-radius: 12px; box-shadow: var(--sh);
  display: flex; align-items: center; justify-content: center; font-size: 38px;
  transform: rotate(-4deg); }

#dlg { position: fixed; inset: 0; background: rgba(17, 17, 17, .55); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.dlg-box { background: var(--paper); border: var(--bd); border-radius: var(--r);
  box-shadow: var(--sh-lg); padding: 18px; width: 100%; max-width: 460px;
  transform: rotate(-0.4deg); }
.dlg-msg { font-weight: 500; overflow-wrap: break-word; }
.dlg-box input, .dlg-box select { margin-top: 12px; }
.hidden { display: none !important; }

/* layar sempit: sidebar jadi bar atas */
@media (max-width: 860px) {
  #sidebar { position: static; width: auto; border-right: none; border-bottom: var(--bd);
    flex-direction: row; align-items: center; padding: 10px 14px; }
  #brand br { display: none; }
  #nav { flex-direction: row; overflow-x: auto; }
  #nav button { width: auto; white-space: nowrap; }
  #sidefoot { display: none; }
  main { margin-left: 0; padding: 16px 14px 60px; }
  #toast { left: 50%; }
}
