/* SGG app & seller portal. Brand tokens follow skipper.co.id. System fonts only (no third-party requests). */
:root {
  color-scheme: light;
  --white: #FFFFFF; --warm: #FAF9F6; --gray: #F5F5F5; --line: #E3E3E0; --line-2: #CFCFCB;
  --ink: #111111; --ink-2: #2B2B2B; --muted: #666666;
  --orange: #FF904C; --orange-text: #B3540F; --orange-soft: #FFF1E8;
  --ok: #1E7A45; --ok-soft: #E6F4EC; --warn: #8A5A00; --warn-soft: #FFF6DB; --bad: #B42318; --bad-soft: #FDECEA; --info: #2C4A9E; --info-soft: #E8EEFB;
  --font: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r: 10px;
}
* { box-sizing: border-box }
html, body { margin: 0; background: var(--warm); color: var(--ink); font: 15px/1.5 var(--font) }
body { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px) }
a { color: var(--orange-text) }
button, input, select, textarea { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--orange-text); outline-offset: 2px }
.mono { font-family: var(--mono); font-size: 13.5px }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }
.muted { color: var(--muted) }
[hidden] { display: none !important }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)) }
.auth-card { width: min(420px, 100%); background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px }
.auth-card h1 { margin: 4px 0 0; font-size: 22px }
.brand { display: flex; gap: 10px; align-items: center }
/* Skipper wordmark + "system" lockup */
.brand { gap: 12px }
.lockup { display: inline-grid; justify-items: start; line-height: 1; width: max-content }
.lockup img { display: block; height: 34px; width: auto }
.lockup .lk-sys { align-self: stretch; text-align: right; font-size: 8px; font-weight: 400; letter-spacing: 0; color: var(--ink-2); margin-top: 1px; padding-right: 4% }
.top .lockup img { height: 28px }
.top .lockup .lk-sys { align-self: stretch; text-align: right; font-size: 8px; font-weight: 400; letter-spacing: 0; color: var(--ink-2); margin-top: 1px; padding-right: 4% }
.lk-sub { font-size: 12px; font-weight: 700; color: var(--orange-text); background: var(--orange-soft); padding: 3px 9px; border-radius: 99px; white-space: nowrap }
.qr { display: grid; place-items: center; padding: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 10px }
.sub { color: var(--muted); margin: 0; font-size: 14px }
.note { background: var(--info-soft); border-radius: 8px; padding: 10px 12px; margin: 0; font-size: 14px }
.err { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 8px 12px; margin: 0; font-size: 14px }
code { font-family: var(--mono); background: var(--gray); padding: 1px 5px; border-radius: 4px; word-break: break-all }

/* layout */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--white); color: var(--ink); border-bottom: 1px solid var(--line) }
.top-in { display: flex; align-items: center; gap: 14px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)) }

.top .who { margin-left: auto; text-align: right; font-size: 13px; line-height: 1.3 }
.top .who small { display: block; color: var(--muted) }
.top .btn.ghost { background: transparent }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 max(12px, env(safe-area-inset-left, 0px)); background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: calc(env(safe-area-inset-top, 0px) + 56px); z-index: 19 }
nav.tabs a { padding: 12px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500 }
nav.tabs a.on { color: var(--ink); border-color: var(--orange) }
main.page { max-width: 1120px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 16px }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px }
.head h1 { margin: 0; font-size: 22px; text-wrap: balance }
.head p { margin: 2px 0 0; color: var(--muted); max-width: 70ch }
.crumb { font-size: 13.5px }
.box { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 14px; min-width: 0 }
.box h2 { margin: 0; font-size: 16px }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14.5px }
.kv dt { color: var(--muted) }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere }
.stack { display: grid; gap: 12px }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center }
.row.end { justify-content: flex-end }
.empty { padding: 28px; text-align: center; color: var(--muted) }
@media (max-width: 760px) { .grid2 { grid-template-columns: minmax(0, 1fr) } }

/* forms */
.field { display: grid; gap: 5px; min-width: 0 }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2) }
.field .hint { font-size: 12.5px; color: var(--muted) }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--white); min-width: 0 }
textarea { resize: vertical }
input[type=number] { text-align: right }
.scan { font-family: var(--mono); font-size: 17px; letter-spacing: .02em }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--white); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--ink) }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff }
.btn.ghost { background: transparent }
.btn.sm { padding: 5px 10px; font-size: 13.5px }
.btn:disabled { opacity: .5; cursor: default }
.link { background: none; border: 0; padding: 0; color: var(--orange-text); cursor: pointer; font-weight: 600; justify-self: start }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--white) }
table.tbl { border-collapse: collapse; width: 100%; font-size: 14px }
.tbl th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); background: #FAFAF8; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle }
.tbl tbody tr:last-child td { border-bottom: 0 }
.tbl tr.click { cursor: pointer }
.tbl tr.click:hover td { background: var(--orange-soft) }
.tbl tfoot td { font-weight: 700; background: #FAFAF8 }
.tbl input, .tbl select { padding: 6px 8px }

/* status chips */
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--gray); color: var(--ink-2); white-space: nowrap }
.chip.draf { background: var(--gray) }
.chip.menunggu_kiriman { background: var(--info-soft); color: var(--info) }
.chip.diterima_sebagian { background: var(--warn-soft); color: var(--warn) }
.chip.diterima { background: var(--ok-soft); color: var(--ok) }
.chip.dibatalkan { background: var(--bad-soft); color: var(--bad) }
.steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px }
.steps span { padding: 3px 10px; border-radius: 99px; background: var(--gray); color: var(--muted) }
.steps span.done { background: var(--ok-soft); color: var(--ok); font-weight: 600 }
.steps span.now { background: var(--orange-soft); color: var(--orange-text); font-weight: 700 }

/* toast + dialog */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); transition: opacity .3s }
.toast.err { background: var(--bad) }
.toast.out { opacity: 0 }
dialog.dlg { border: 0; border-radius: 14px; padding: 22px; width: min(440px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3) }
dialog.dlg::backdrop { background: rgba(17,17,17,.45) }
dialog.dlg form { display: grid; gap: 14px }
dialog.dlg h3 { margin: 0 }
dialog.dlg p { margin: 0; color: var(--muted) }

/* labels (print) — TSC TTP-244 Pro, stickers 40 x 20 mm, 2 across (one row = one printed page) */
#print { display: none }
.label { width: 40mm; height: 20mm; padding: 1mm 1.5mm; display: grid; grid-template-rows: auto auto 1fr; gap: .3mm; overflow: hidden; border: 1px dashed var(--line-2); border-radius: 3px; background: #fff; color: #000; font-family: var(--font); line-height: 1.1 }
.label .lb-top { display: flex; justify-content: space-between; gap: 1mm; font-size: 5.5pt; font-weight: 700; white-space: nowrap; overflow: hidden }
.label .lb-bar { display: block; width: 30mm; margin: 0 auto; height: 8.8mm; object-fit: fill; image-rendering: pixelated }
.label .lb-code { font-family: var(--mono); font-size: 8pt; font-weight: 700; text-align: center; letter-spacing: .05em }
.label .lb-txt { font-size: 5pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.lb-row { display: flex; gap: 2mm; width: 82mm; height: 20mm }
.labels-preview { display: flex; flex-wrap: wrap; gap: 8px }
.labels-preview .label { transform: scale(1.6); transform-origin: top left; margin: 0 26mm 13mm 0 }
@media print {
  @page { size: 82mm 20mm; margin: 0 }
  body > *:not(#print) { display: none !important }
  html, body { background: #fff; margin: 0; padding: 0 }
  #print { display: block !important }
  #print .label { border: 0; border-radius: 0 }
  #print .lb-row { break-after: page; page-break-after: always }
}
