/* Asisten OXY — mobile-first, kontras tinggi (≥7:1), target sentuh ≥44px, tanpa gulir horizontal. */
:root {
  color-scheme: light dark;
  --bg: #f2f6fa; --surface: #ffffff; --line: #8a9299; --line-soft: #d5d8db;
  --text: #14181c; --muted: #444c53;
  --accent: #0a4d93; --on-accent: #ffffff; --accent-soft: #e3eefb;
  --danger: #8a1c1c; --danger-soft: #fde8e8; --ok: #0d5c2e; --ok-soft: #e1f4e8;
  --focus: #b35c00;
  --radius: 14px; --gap: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1316; --surface: #181e23; --line: #7d8790; --line-soft: #2c353c;
    --text: #f2f5f7; --muted: #bcc6cd;
    --accent: #8cc4ff; --on-accent: #06182b; --accent-soft: #14283d;
    --danger: #ffb4b4; --danger-soft: #3a1717; --ok: #8be0a8; --ok-soft: #12301d;
    --focus: #ffb454;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.45 var(--font); overflow-x: hidden; }
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Kerangka */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: var(--gap); padding: 4px max(12px, calc((100% - 1080px) / 2)); padding-top: max(4px, env(safe-area-inset-top)); min-height: 52px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; margin-right: auto; }
.brand-mark { display: block; object-fit: cover; border-radius: 24%; }
.ico { display: block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.topnav { display: none; gap: 4px; }
.navlink { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.navlink[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
main { flex: 1; width: 100%; max-width: 1128px; margin: 0 auto; padding: 16px 12px calc(96px + env(safe-area-inset-bottom)); }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line-soft); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav .navlink { flex-direction: column; justify-content: center; gap: 0; min-height: 56px; border-radius: 0; font-size: 12px; line-height: 1.15; text-align: center; padding: 4px 1px; white-space: nowrap; }
.bottomnav .ico { width: 22px; height: 22px; }
@media (min-width: 800px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  main { padding: 32px 24px 48px; }
}

/* Form */
label, .label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="search"], input[type="text"], input[type="password"], input[type="date"], select {
  width: 100%; min-height: 52px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; }
input[type="search"] { font-size: 18px; }
.field { margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: var(--radius); border: 2px solid var(--accent); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--accent); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn.danger.confirm { background: var(--danger); color: var(--surface); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.actions { display: flex; justify-content: flex-end; gap: var(--gap); flex-wrap: wrap; margin-top: 16px; }
progress { width: 100%; height: 18px; accent-color: var(--accent); }
.notice { padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--line-soft); }
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); font-weight: 600; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); font-weight: 600; }

/* Riwayat Order */
.history-header {
  display: grid;
  gap: 6px;
  padding: clamp(20px, 4vw, 44px);
  background: linear-gradient(112deg, #092546 25%, #103d68);
  color: #fff;
  border-radius: var(--radius);
}
.history-header h1 {
  font-size: clamp(34px, 2rem + 2vw, 56px);
  line-height: 1.04;
  letter-spacing: -.045em;
}
.history-header p { max-width: 42ch; color: #dcecff; }
.history-search {
  position: relative;
  margin: clamp(10px, 1.4vw, 16px) 0 0;
  padding: clamp(12px, 2vw, 24px);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}
.history-search .chips { flex-wrap: wrap; overflow: visible; }
.history-search .chip { max-width: 100%; }
.chip-x { min-width: 44px; padding: 0; margin-left: -6px; }
.history-header.compact { padding: 10px 16px; }
.history-header.compact h1 { font-size: 20px; letter-spacing: -.02em; }
.history-header.compact p { display: none; }
.searchfield { position: relative; }
.searchfield .ico { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--accent); pointer-events: none; }
.searchfield input[type="search"] { padding-left: 44px; }
.searchfield input::placeholder { color: var(--muted); }
.searchbox { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 4; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); max-height: 60vh; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.suggest h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px 2px; }
.suggest button { display: block; width: 100%; text-align: left; min-height: 48px; padding: 8px 14px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.suggest button:hover, .suggest button:focus-visible { background: var(--accent-soft); }
.suggest .sub { display: block; color: var(--muted); font-size: 14px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; max-width: 80vw; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.master-tools .chips { flex-wrap: wrap; overflow: visible; }
.master-tools .chip { max-width: 100%; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.resultbar { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); margin: 18px 0 10px; }
.resultbar select { width: auto; min-height: 44px; }
.resultbar a { display: inline-flex; align-items: center; min-height: 44px; }

/* Kartu produk */
.cards { display: grid; gap: var(--gap); }
.card { display: block; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: clamp(14px, 2vw, 24px); color: var(--text); text-decoration: none; }
a.card:hover { border-color: var(--accent); }
.card .pname { font-size: clamp(19px, 2vw, 24px); font-weight: 700; line-height: 1.25; }
.card .meta { margin-top: 4px; display: grid; gap: 2px; color: var(--muted); font-size: 15px; }
.card .meta b { color: var(--text); font-weight: 600; }
.lastdisc { margin-top: 10px; padding: 10px 12px; background: var(--accent-soft); border-radius: 10px; }
.lastdisc .cap { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lastdisc { min-width: 0; overflow-wrap: anywhere; }
.lastdisc .big { color: var(--accent); font-size: clamp(20px, 2vw, 26px); font-weight: 800; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.lastdisc .when { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.hist { margin-top: 10px; border-top: 1px dashed var(--line-soft); }
.hist .head, .hrow { display: grid; grid-template-columns: 6em 4.8em 1fr; gap: 6px; white-space: nowrap; padding: 6px 0; align-items: baseline; }
.hist .head { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding-bottom: 2px; }
.hrow { border-top: 1px solid var(--line-soft); font-size: 15px; }
.hrow:first-of-type { border-top: 0; }
.hrow .who { grid-column: 1 / -1; white-space: normal; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.hrow .r { text-align: right; }
.hist .head .r { text-align: right; }
.more { margin-top: 6px; color: var(--accent); font-weight: 700; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1.5px solid currentColor; vertical-align: middle; }
.badge.retur { color: var(--danger); background: var(--danger-soft); }
.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 19px; margin-bottom: 6px; }
@media (min-width: 800px) {
  .history-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, .7fr); align-items: start; gap: 12px 28px; }
  .history-card > .lastdisc, .history-card > .hist, .history-card > .more { margin-top: 0; }
  .history-card > .hist, .history-card > .more { grid-column: 1 / -1; }
}


/* Detail */
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-bottom: 4px; padding: 0 12px 0 0; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.pagehead h1 { font-size: clamp(24px, 3vw, 36px); line-height: 1.2; overflow-wrap: anywhere; }
.pagehead .meta { margin-top: 4px; color: var(--muted); display: grid; gap: 2px; }
.pagehead .meta b { color: var(--text); }
.product-info { margin: 14px 0; width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.product-info caption { margin-bottom: 6px; text-align: left; font-weight: 700; }
.product-info th, .product-info td { padding: 8px 12px; text-align: left; overflow-wrap: anywhere; }
.product-info tr + tr { border-top: 1px solid var(--line-soft); }
.product-info th { width: 36%; color: var(--muted); font-weight: 600; }
.totals-wrap { margin: 14px 0; overflow-x: auto; } /* fallback for very large numbers */
.totals td.num { white-space: nowrap; }
.totals { margin: 0; width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.totals th, .totals td { padding: 8px 8px; text-align: right; border-bottom: 1px solid var(--line-soft); }
.totals th:first-child, .totals td:first-child { text-align: left; }
.totals thead th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.totals tr.sum td { font-weight: 800; }
@media (max-width: 480px) { .totals { font-size: 12px; } .totals th { font-size: 11px; } .totals th, .totals td { padding: 8px 3px; } .totals th:first-child, .totals td:first-child { padding-left: 8px; } .totals th:last-child, .totals td:last-child { padding-right: 8px; }
  /* stacked rows: billions of rupiah never fit four columns on a phone */
  .totals-wrap { overflow-x: visible; } .totals, .totals tbody, .totals tr { display: block; } .totals thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .totals tr { padding: 8px; border-bottom: 1px solid var(--line-soft); } .totals td { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border: 0; font-size: 14px; }
  .totals td:first-child { font-weight: 700; padding: 0 0 4px; } .totals td.num::before { content: attr(data-label); color: var(--muted); font-weight: 400; } }
.line { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; }
.line.is-return { border-left: 5px solid var(--danger); }
.line .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.line .date { font-weight: 800; }
.line .cust { display: flex; align-items: center; min-height: 44px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
dl.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 6px 0 0; }
dl.kv div { min-width: 0; }
dl.kv dt { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
dl.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* Unggah */
.upload-heading { margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: clamp(14px, 2vw, 24px); margin-bottom: var(--gap); }
.panel h2 { font-size: 19px; margin-bottom: 8px; }
.filepick { margin-top: 16px; }
.filepick input[type="file"] { width: 100%; min-height: 48px; font: inherit; }
.stat { display: flex; gap: 8px 18px; flex-wrap: wrap; margin: 6px 0; }
.stat div { min-width: 0; }
.imp { border-top: 1px solid var(--line-soft); padding: 10px 0; }
.imp:first-of-type { border-top: 0; }
.imp .st { font-weight: 700; }
.imp .st.sukses { color: var(--ok); } .imp .st.gagal, .imp .st.dibatalkan, .imp .st.deleted { color: var(--danger); }

dialog { width: min(94vw, 520px); max-height: 88vh; padding: 0; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog .dhead { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line-soft); }
dialog .dhead h2 { font-size: 19px; }
dialog .dbody { padding: 14px 16px 16px; overflow: auto; max-height: calc(88vh - 70px); }
.iconbtn { display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--text); cursor: pointer; border-radius: 10px; }
.optlist { display: grid; gap: 6px; margin-top: 10px; }
.optlist button { text-align: left; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.optlist button:hover, .optlist button:focus-visible { background: var(--accent-soft); border-color: var(--accent); }
.daterow { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.login-page { display: grid; align-content: center; padding: 24px 16px; }
.login {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 36px);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.login .brand-mark { width: clamp(112px, 12vw, 136px); height: auto; margin-inline: auto; }
.login h1 { font-size: clamp(23px, 4vw, 28px); text-align: center; margin: 14px 0 24px; }
.login .notice { margin-bottom: 14px; }
.login-help { margin-top: 6px; font-size: 15px; }
.center { display: grid; place-items: center; min-height: 40vh; }

@media (prefers-reduced-motion: no-preference) {
  .login .brand-mark { animation: avatar-in .4s ease-out both; }
  .card, .btn, .chip { transition: border-color .12s, background-color .12s; }
}

@keyframes avatar-in {
  from { opacity: 0; transform: translateY(4px) scale(.94); }
}

/* Akun */
.account-card { margin-bottom: var(--gap); max-width: 560px; }
.account-card h2 { margin: 0 0 6px; font-size: 20px; }
.account-card .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.account-card .muted { margin: 0 0 12px; }
.pin-status { font-weight: 600; margin: 0 0 12px; }

/* LPP */
.lpp-head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; margin-bottom: var(--gap); }
.lpp-head h1 { font-size: clamp(26px, 3vw, 36px); }
.lpp-tools { display: grid; gap: 10px; margin-bottom: var(--gap); }
.lpp-tools .field { margin: 0; }
.lpp-sum { padding: 10px 14px; background: var(--accent-soft); border-radius: var(--radius); font-weight: 600; }
.nowrap { white-space: nowrap; }
.lpp-card .top, .line .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lpp-card .date { font-weight: 800; }
.lpp-card .badges, .line .badges { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.lpp-amt { margin-top: 6px; font-size: 20px; font-weight: 800; white-space: nowrap; color: var(--accent); }
.lpp-card.is-cancelled .pname, .lpp-card.is-cancelled .lpp-amt { color: var(--muted); }
.line.is-cancelled { border-left: 5px solid var(--danger); }
.lpp-lines dl.kv .wide { grid-column: 1 / -1; }
.lpp-lines dl.kv dd { white-space: nowrap; }
.lpp-lines dl.kv .wide dd { white-space: normal; }
[hidden] { display: none !important; }

/* Isi/Box */
.navlink { position: relative; }
.navcount { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #b3261e; color: #fff; font-size: 12px; line-height: 20px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.navcount[hidden] { display: none; }
.bottomnav .navcount { position: absolute; top: 2px; left: calc(50% + 4px); min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; padding: 0 4px; }
.smalllink { font-size: 14px; }
.master-tools { display: grid; gap: 8px; }
.mactions { justify-content: flex-start; margin-top: 4px; }
.mactions .btn { min-height: 44px; padding: 0 14px; }
.mlist { display: grid; gap: var(--gap); margin-top: 8px; }
.mhead { display: none; }
.mrow { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px 14px; }
.mrow .mname { display: grid; gap: 2px; }
.mrow .mfield { display: grid; gap: 4px; }
.mrow .mlabel { color: var(--muted); }
.mrow .btn { min-height: 44px; width: 100%; }
.mstatus { min-height: 20px; font-size: 14px; color: var(--muted); }
.mstatus.ok { color: var(--ok); font-weight: 600; }
.mstatus.err { color: var(--danger); font-weight: 600; }
@media (min-width: 800px) {
  .mlist { gap: 0; border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
  .mhead, .mrow { grid-template-columns: 130px minmax(0, 1fr) minmax(200px, 280px) 110px; gap: 14px; align-items: start; }
  .mhead { display: grid; margin-top: 12px; padding: 8px 14px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
  .mrow { border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; padding: 8px 14px; }
  .mrow:first-child { border-top: 0; }
  .mrow .mlabel { display: none; }
  .mrow input { min-height: 44px; }
  .mrow .btn { width: auto; }
}

.device-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.device { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); display: grid; gap: 4px; }
.device .badge { margin-left: 8px; }
.device .btn { justify-self: start; min-height: 44px; }
