/* Grosir Pintar — tampilan mobile-first: teks besar, tombol besar, kartu.
   Dirancang dipakai pegawai toko dari ponsel di depan rak / saat menerima barang. */

:root {
  --ink: #10241c;
  --muted: #5b6b63;
  --bg: #eef4f0;
  --surface: #ffffff;
  --line: #dbe6df;
  --primary: #0f6e4e;
  --primary-dark: #0a5338;
  --primary-soft: #e2f2ea;
  --warn: #9a5b00;
  --warn-soft: #fff3df;
  --danger: #b3261e;
  --danger-soft: #fdeceb;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(16, 36, 28, .07);
  --shadow-lg: 0 8px 26px rgba(16, 36, 28, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: 92px;   /* ruang untuk navigasi bawah di ponsel */
}
a { color: var(--primary-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 6px; }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
h3 { font-size: 17px; }
p { margin: 0 0 10px; }
code { background: #eef2ef; padding: 1px 5px; border-radius: 6px; font-size: 15px; }

/* ---------- kerangka ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: var(--primary); color: #fff; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, .18);
  font-weight: 700; letter-spacing: .5px; flex: none;
}
.brand-mark.big { width: 58px; height: 58px; font-size: 22px; background: var(--primary); color: #fff; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 16px; }
.brand-text small { font-size: 12.5px; opacity: .85; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.who { display: none; font-size: 13px; opacity: .95; }
.who em { font-style: normal; opacity: .8; }
.topbar .btn { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .3); }
.inline { display: inline; margin: 0; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; gap: 2px; overflow-x: auto;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px 6px 6px; box-shadow: 0 -2px 12px rgba(16, 36, 28, .06);
}
.nav-item {
  position: relative; flex: 1 0 auto; min-width: 68px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 6px 4px; border-radius: 10px; text-decoration: none; color: var(--muted);
  font-size: 11.5px; font-weight: 600;
}
.nav-ico { font-size: 20px; line-height: 1; }
.nav-active { color: var(--primary); background: var(--primary-soft); }
.nav-badge {
  position: absolute; top: 2px; right: 8px; background: var(--danger); color: #fff;
  font-size: 10.5px; min-width: 17px; height: 17px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.main { max-width: 780px; margin: 0 auto; padding: 14px 14px 24px; }
.main.wide { max-width: 1080px; }
.foot { max-width: 1080px; margin: 0 auto; padding: 8px 14px 30px; color: var(--muted); font-size: 12.5px; text-align: center; }
.bare { background: linear-gradient(160deg, #0f6e4e, #0a5338); padding-bottom: 0; }
.bare-main { max-width: 460px; margin: 0 auto; padding: 26px 16px 40px; }

/* ---------- pesan ---------- */
.flashes { margin-bottom: 12px; }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 10px; font-size: 15.5px; }
.flash-ok { background: #e6f6ec; color: #12603c; border: 1px solid #bfe5cd; }
.flash-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #f3d9ab; }
.flash-err { background: var(--danger-soft); color: var(--danger); border: 1px solid #f3c6c2; }

/* ---------- kartu ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.card-title { font-size: 18px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-sub { color: var(--muted); font-size: 14.5px; margin-bottom: 12px; }
.card-warn { border-color: #f0d9ae; background: #fffdf7; }
.note { background: #f6faf7; font-size: 15px; }
.sub-title { margin: 18px 0 10px; font-size: 16px; }

/* ---------- aksi besar ---------- */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.action {
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; min-height: 118px; box-shadow: var(--shadow);
}
.action:active { transform: translateY(1px); }
.action-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.action-ico { font-size: 28px; line-height: 1; }
.action-text { font-weight: 700; font-size: 16.5px; display: flex; flex-direction: column; gap: 3px; }
.action-text small { font-weight: 500; font-size: 13px; opacity: .85; }

/* ---------- angka ringkas ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 21px; font-weight: 700; margin-top: 2px; }
.stat-hint { font-size: 12.5px; color: var(--muted); }
.stat-warn { border-color: #f0d9ae; background: #fffdf7; }
.stat-danger { border-color: #f3c6c2; background: var(--danger-soft); }

/* ---------- daftar baris ---------- */
.rows { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.row-item:first-child { border-top: none; }
.row-main { min-width: 0; }
.row-main strong { font-size: 16.5px; }
.row-main small { display: block; color: var(--muted); font-size: 13.5px; }
.row-side { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.row-value { font-weight: 700; white-space: nowrap; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- tabel ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.tbl tbody tr:last-child td { border-bottom: none; }

/* ---------- form ---------- */
.form { display: block; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field-hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.inp {
  width: 100%; min-height: 48px; padding: 11px 13px; font-size: 16.5px; font-family: inherit;
  color: var(--ink); background: #fff; border: 1px solid #c9d8d0; border-radius: 11px;
}
.inp:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
textarea.inp { min-height: 68px; }
.inp-num { text-align: right; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.grid-2-cards { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15.5px; margin-bottom: 14px; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; }
.filter { padding: 12px 14px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-row .inp { flex: 1 1 180px; }
.file-drop {
  display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 14px;
  border: 2px dashed #b9cec4; border-radius: var(--radius); background: #f7fbf8; cursor: pointer;
}
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-ico { font-size: 30px; }
.file-text { display: flex; flex-direction: column; }
.file-text small { color: var(--muted); font-size: 13.5px; }
.reading { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--primary-dark); font-weight: 600; }
.spin {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 3px solid #cfe6da; border-top-color: var(--primary); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hint { color: var(--muted); font-size: 14px; }

/* ---------- tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 11px 18px; font-size: 16.5px; font-weight: 600; font-family: inherit;
  border-radius: 11px; border: 1px solid transparent; text-decoration: none; cursor: pointer;
  background: #fff; color: var(--ink);
}
.btn, .btn * { -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:active { background: var(--primary-dark); }
.btn-outline { border-color: #c9d8d0; background: #fff; color: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger-outline { background: #fff; border-color: #eec3bf; color: var(--danger); }
.btn-small { min-height: 40px; padding: 7px 12px; font-size: 14.5px; }
.btn-big { min-height: 56px; font-size: 17.5px; }
.btn-block { width: 100%; }
.btn-ico { font-size: 19px; }
[hidden] { display: none !important; }

/* ---------- lencana ---------- */
.badge, .chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: #eef2ef; color: var(--muted);
}
.badge-warn, .chip-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger, .chip-danger { background: var(--danger-soft); color: var(--danger); }
.badge-ok, .chip-ok { background: var(--primary-soft); color: var(--primary-dark); }
.chip-muted { background: #eef2ef; }
.chip-btn { text-decoration: none; font-size: 14px; padding: 7px 12px; border: 1px solid #cfe0d7; background: #fff; color: var(--primary-dark); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- hasil jawaban asisten / cek harga ---------- */
.answer { border-radius: var(--radius); padding: 16px; margin-bottom: 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.ans-ok { border-color: #b9e0c9; background: #f4fcf7; }
.ans-warn { border-color: #f0d9ae; background: #fffdf6; }
.ans-danger { border-color: #f3c6c2; background: var(--danger-soft); }
.ans-info { border-color: #cfe0d7; }
.ans-head { font-size: 20px; margin-bottom: 12px; }
.ans-lines { margin: 0 0 12px; padding-left: 20px; font-size: 15.5px; }
.ans-lines li { margin-bottom: 6px; }
.followups { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.basis-list, .warn-list { margin: 0 0 12px; padding-left: 20px; font-size: 15px; color: #2c3d35; }
.basis-list li, .warn-list li { margin-bottom: 5px; }
.warn-list { color: var(--warn); }

/* ---------- produk ---------- */
.prod-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.prod-card {
  display: block; text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.prod-head strong { font-size: 16.5px; display: block; }
.prod-head small { color: var(--muted); font-size: 13px; }
.prod-numbers { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.prod-numbers div { display: flex; flex-direction: column; }
.prod-numbers span { font-size: 12.5px; color: var(--muted); }
.prod-numbers strong { font-size: 17px; }
.prod-flags { margin-top: 8px; }
.doc-thumb { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.back { display: inline-block; margin-bottom: 8px; font-size: 15px; text-decoration: none; color: var(--primary-dark); font-weight: 600; }

/* ---------- ringkasan total ---------- */
.totals-box { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 16px; }
.totals-box > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.totals-total { font-size: 19px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px !important; }

/* ---------- editor baris (tabel jadi kartu di ponsel) ---------- */
.table-wrap-editor { overflow-x: auto; }
.table-editor { min-width: 720px; }
.table-editor td { vertical-align: middle; }
.table-editor .line-total { font-weight: 700; white-space: nowrap; }
.cell-no { width: 46px; }
.cell-act { width: 90px; }
.editor-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- bar aksi menempel (tombol simpan selalu terlihat) ---------- */
.form-actions-sticky {
  position: sticky; bottom: 78px; z-index: 20; margin: 18px -4px 0;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  box-shadow: var(--shadow-lg);
}
.sticky-inner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sticky-inner .btn { flex: 1 1 160px; }
.guard { font-size: 13.5px; color: var(--warn); font-weight: 600; }

/* ---------- login ---------- */
.login-wrap { color: #fff; }
.login-brand { text-align: center; color: #fff; margin-bottom: 20px; }
.login-brand h1 { font-size: 26px; margin-top: 12px; }
.login-brand p { opacity: .9; font-size: 15px; }
.login-wrap .card { color: var(--ink); }
.login-wrap .note { color: var(--ink); }

/* ---------- bantuan ---------- */
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.text-warn { color: var(--warn); font-weight: 700; }
.text-danger { color: var(--danger); font-weight: 700; }
.warn-text { display: block; color: var(--warn); font-size: 13px; margin-top: 4px; }

/* ---------- desktop ---------- */
@media (min-width: 640px) {
  .who { display: block; }
  .grid-2, .grid-2-cards { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .prod-grid { grid-template-columns: 1fr 1fr; }
  .action-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 861px) {
  body { padding-bottom: 0; }
  .nav {
    position: static; justify-content: center; background: #fff; border-top: none;
    border-bottom: 1px solid var(--line); padding: 6px 10px; box-shadow: none;
  }
  .nav-item { flex: 0 0 auto; flex-direction: row; gap: 6px; font-size: 14.5px; padding: 10px 14px; min-height: 44px; }
  .nav-ico { font-size: 17px; }
  .form-actions-sticky { bottom: 0; }
}

/* ---------- ponsel: tabel jadi kartu ---------- */
@media (max-width: 760px) {
  .tbl-cards .table-wrap, .tbl-cards { overflow: visible; }
  .tbl-cards { display: block; }
  .tbl-cards thead { display: none; }
  .tbl-cards tbody, .tbl-cards tr, .tbl-cards td { display: block; width: 100%; }
  .tbl-cards tr {
    border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; background: #fff;
  }
  .tbl-cards td { border-bottom: 1px dashed #e8efe9; padding: 8px 0; }
  .tbl-cards tr td:last-child { border-bottom: none; }
  .tbl-cards td::before {
    content: attr(data-label); display: block; font-size: 12px; text-transform: uppercase;
    letter-spacing: .4px; color: var(--muted); margin-bottom: 2px;
  }
  .tbl-cards td:not([data-label])::before { content: none; }

  /* editor barang: satu kartu per baris barang */
  .table-wrap-editor { overflow: visible; }
  .table-editor { min-width: 0; border-collapse: separate; }
  .table-editor thead { display: none; }
  .table-editor tbody, .table-editor tr, .table-editor td { display: block; width: 100%; }
  .table-editor .item-row {
    border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px;
    background: #fff; box-shadow: var(--shadow);
  }
  .table-editor td { border: none; padding: 6px 0; }
  .table-editor td.cell-no { width: auto; }
  .table-editor td.cell-no .row-no {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
    border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700;
  }
  .table-editor td::before {
    content: attr(data-label); display: block; font-size: 12px; text-transform: uppercase;
    letter-spacing: .4px; color: var(--muted); margin-bottom: 4px;
  }
  .table-editor td.cell-wide { padding-top: 8px; }
  .table-editor td.cell-act { width: auto; }
  .table-editor td.cell-act::before { content: none; }
  .table-editor .line-total { font-size: 17px; }
}

/* ---------- halaman Mode UAT ---------- */
.check-grid { display: grid; grid-template-columns: 1fr; gap: 10px 18px; margin-bottom: 16px; }
@media (min-width: 640px) { .check-grid { grid-template-columns: 1fr 1fr; } }
.uat-checks { list-style: none; margin: 10px 0 0; padding: 0; }
.uat-check { display: flex; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--line); }
.uat-check:first-child { border-top: none; }
.uat-mark { flex: none; width: 22px; text-align: center; font-size: 17px; font-weight: 700; line-height: 1.35; }
.uat-ok .uat-mark { color: var(--primary); }
.uat-fail .uat-mark { color: var(--danger); }
.uat-info .uat-mark { color: #a3760a; }
.uat-body strong { font-size: 15.5px; }
.uat-body small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.uat-temuan { background: #fff8ec; border: 1px solid #f0d9ae; border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.uat-temuan strong { display: block; font-size: 14px; margin: 0 0 4px; }
.uat-temuan p { font-size: 14.5px; margin: 0 0 10px; }
.uat-temuan p:last-child { margin-bottom: 0; }
.uat-card.uat-danger { border-color: #f3c6c2; }
.uat-card.uat-warn { border-color: #f0d9ae; }
.uat-card.uat-ok { border-color: #bfe5cd; }

/* ---------- keputusan produk & konversi satuan (editor baris) ---------- */
.inp-small { min-height: 42px; font-size: 15.5px; }
.ok-text { display: block; color: var(--primary-dark); font-size: 13px; margin-top: 4px; }
.cell-dim { opacity: .55; }
.conv-line { display: block; font-size: 14.5px; font-weight: 600; }
.conv-row { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.conv-row .inp { max-width: 150px; }
.check-inline { margin: 0; font-size: 13.5px; align-items: center; }
.check-inline input { width: 20px; height: 20px; }
.check-inline span { font-size: 13.5px; }
[data-conv-cell][hidden] { display: none !important; }

/* ---------- ringkasan verifikasi (pilot) ---------- */
#pilot-summary .stat-value { font-size: 22px; }

/* ---------- Pilot Metrics: definisi metrik ---------- */
.def-list summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.def-list code { font-size: 14px; background: #eef2ef; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
