/* ============================================================
   KOTAKMUA POS — Stylesheet
   Palette Vena (proyek internal Kotak Moneta / Ichsan)
   ============================================================ */
:root {
  /* ===== Palette monokrom (hitam-putih) untuk KOTAKMUA POS ===== */
  --gold:  #111111;   /* aksen utama → hitam */
  --teal:  #0A0A0A;   /* gelap utama → near-black */
  --cream: #FFFFFF;   /* terang utama → putih */
  --black: #0A0A0A;

  --teal-soft: #2b2b2b;
  --gold-soft: #cfcfcf;
  --line: #e3e3e3;
  --muted: #777777;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(0,0,0,0.08);

  /* warna fungsional (dipertahankan supaya status mudah dibaca) */
  --ok: #2e7d52;
  --warn: #c0392b;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--black);
  font-size: 15px;
  line-height: 1.45;
}
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; font-size: 15px; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1; }
.right { text-align: right; }
.muted { color: var(--muted); font-size: 13px; }
.gold { color: var(--gold); }
.bold { font-weight: 700; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* ---------- Login ---------- */
#loginScreen {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, var(--teal) 0%, var(--teal-soft) 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: var(--cream); border-radius: 20px; padding: 34px 26px;
  width: 100%; max-width: 360px; box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.login-card .logo { text-align: center; margin-bottom: 22px; }
.login-card .logo h1 { font-size: 26px; letter-spacing: 1px; color: var(--teal); }
.login-card .logo h1 span { color: var(--gold); }
.login-card .logo p { font-size: 12px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

/* ---------- App shell ---------- */
#app { display: none; min-height: 100%; padding-bottom: 72px; }
.topbar {
  background: var(--teal); color: var(--cream);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 17px; letter-spacing: .5px; }
.topbar h1 span { color: var(--gold); }
.topbar .user { font-size: 12px; opacity: .85; }
.page { padding: 16px; max-width: 900px; margin: 0 auto; }
.page-title { font-size: 19px; font-weight: 700; color: var(--teal); margin-bottom: 4px; }
.page-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 6px 4px env(safe-area-inset-bottom, 6px);
}
.bottomnav button {
  background: none; border: none; flex: 1; padding: 6px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; font-weight: 600;
}
.bottomnav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.bottomnav button.active { color: var(--gold); }

/* ---------- Cards & inputs ---------- */
.card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--teal); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); }

/* ---------- Buttons ---------- */
.btn { padding: 12px 18px; border-radius: 10px; font-weight: 700; font-size: 15px; transition: transform .08s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--gold); color: #fff; }
.btn-teal { background: var(--teal); color: var(--cream); }
.btn-ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--line); }
.btn-danger { background: var(--warn); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 9px 8px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: none; }

/* ---------- Badge ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-offline { background: #f0f0f0; color: #333; border: 1px solid #ddd; }
.badge-online { background: #111; color: #fff; }
.badge-ok { background: #e3f3ea; color: var(--ok); }
.badge-off { background: #f3e3e3; color: var(--warn); }

/* ---------- POS / Cart ---------- */
.channel-pills { display: flex; gap: 8px; margin-bottom: 14px; }
.channel-pills button {
  flex: 1; padding: 11px 6px; border-radius: 10px; border: 2px solid var(--line);
  background: #fff; font-weight: 700; font-size: 13px; color: var(--muted);
}
.channel-pills button.active { border-color: var(--gold); background: var(--gold); color: #fff; }

.product-search { position: relative; margin-bottom: 12px; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 0 0 10px 10px; max-height: 260px; overflow-y: auto; z-index: 20; box-shadow: var(--shadow); }
.search-results .item { padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.search-results .item:active { background: var(--cream); }
.search-results .item .nm { font-weight: 600; }
.search-results .item .meta { font-size: 12px; color: var(--muted); }

.cart-item { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .info .nm { font-weight: 600; font-size: 14px; }
.cart-item .info .pr { font-size: 12px; color: var(--muted); }
.cart-item .qty { display: flex; align-items: center; gap: 6px; }
.cart-item .qty button { width: 28px; height: 28px; border-radius: 7px; background: var(--cream); border: 1px solid var(--line); font-size: 17px; font-weight: 700; color: var(--teal); }
.cart-item .qty input { width: 42px; text-align: center; padding: 5px; border: 1px solid var(--line); border-radius: 7px; }
.cart-item .price-edit { width: 86px; padding: 6px; text-align: right; border: 1px solid var(--line); border-radius: 7px; }
.cart-item .del { background: none; color: var(--warn); font-size: 18px; padding: 2px 6px; }

.cart-summary { background: var(--cream); border-radius: 10px; padding: 12px 14px; margin-top: 8px; }
.cart-summary .row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.cart-summary .row.total { font-size: 18px; font-weight: 800; color: var(--teal); border-top: 1.5px dashed var(--line); margin-top: 6px; padding-top: 8px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(10,10,8,.55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto; }
.modal h3 { color: var(--teal); margin-bottom: 14px; font-size: 17px; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 200; background: var(--teal); color: var(--cream); padding: 11px 18px; border-radius: 30px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: 90%; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }
#toast.err { background: var(--warn); }

/* ---------- Dashboard stat ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 22px; font-weight: 800; color: var(--teal); margin-top: 3px; }
.stat.accent { background: var(--teal); }
.stat.accent .label { color: var(--gold-soft); }
.stat.accent .value { color: var(--cream); }

.channel-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.channel-row:last-child { border-bottom: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { flex: 1; padding: 9px; border-radius: 9px; background: #fff; border: 1.5px solid var(--line); font-weight: 700; font-size: 13px; color: var(--muted); }
.tabs button.active { background: var(--teal); color: var(--cream); border-color: var(--teal); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; stroke: var(--line); fill: none; stroke-width: 1.5; margin-bottom: 10px; }

@media (min-width: 600px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}