/* Syla Kasir — token dulu, nilai dari skala saja. */
:root {
  /* spacing 4-pt */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  /* tipografi: 12 / 14 / 16 / 20 / 28 */
  --t-xs: 12px; --t-sm: 14px; --t-md: 16px; --t-lg: 20px; --t-xl: 28px;
  /* warna semantik */
  --ink: #1d1a1b; --ink-2: #4a4446; --muted: #6b6567; --line: #e4e0de; --bg: #f4f2f1; --surface: #fff;
  --accent: #1d1a1b; --on-accent: #fff;
  --danger: #b3261e; --danger-bg: #fbeae9; --ok: #1e7a46; --ok-bg: #e7f4ec; --warn: #8a5a00; --warn-bg: #fdf3dc;
  --r1: 6px; --r2: 10px;
  --focus: 0 0 0 3px #fff, 0 0 0 5px #1d1a1b;
  --bar: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 var(--t-sm)/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r1); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- tombol ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4); border-radius: var(--r1); border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: #000; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #f0c9c6; }
.btn-lg { min-height: 56px; font-size: var(--t-md); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- form ---------- */
.field { display: grid; gap: var(--s1); }
.field > label { font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); }
.input { width: 100%; min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r1); background: var(--surface); }
textarea.input { padding: var(--s2) var(--s3); min-height: 72px; resize: vertical; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(29,26,27,.12); }
.input::placeholder { color: #8d8789; }
.input-money { font-size: var(--t-lg); font-weight: 600; text-align: right; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s1); padding: var(--s1); background: var(--bg); border-radius: var(--r1); }
.seg button { min-height: 40px; border: 0; border-radius: 4px; background: transparent; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- pesan ---------- */
.msg { padding: var(--s2) var(--s3); border-radius: var(--r1); font-size: var(--t-sm); }
.msg-error { background: var(--danger-bg); color: var(--danger); }
.msg-warn { background: var(--warn-bg); color: var(--warn); }
.msg-ok { background: var(--ok-bg); color: var(--ok); }
.badge { display: inline-block; padding: 0 var(--s2); border-radius: 999px; font-size: var(--t-xs); font-weight: 600; line-height: 20px; background: var(--bg); color: var(--ink-2); }
.badge-vip { background: var(--ink); color: #fff; }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-out { background: var(--danger-bg); color: var(--danger); }
.offline { position: fixed; inset: auto 0 0 0; z-index: 60; padding: var(--s2) var(--s4); background: var(--danger); color: #fff; text-align: center; font-weight: 600; }

/* ---------- layout ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3); height: var(--bar); padding: 0 var(--s4); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .06em; }
.topbar .where { display: grid; line-height: 1.2; min-width: 0; }
.topbar .where small { color: var(--muted); font-size: var(--t-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar nav { margin-left: auto; display: flex; gap: var(--s1); }
.topbar nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s3); border-radius: var(--r1); color: var(--ink-2); text-decoration: none; font-weight: 600; }
.topbar nav a[aria-current="page"] { background: var(--bg); color: var(--ink); }

.page { max-width: 1280px; margin: 0 auto; padding: var(--s4); }
.narrow { max-width: 440px; margin: var(--s6) auto; padding: 0 var(--s4); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s5); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.stack-sm { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s2); }
.between { justify-content: space-between; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: var(--t-xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }

/* ---------- kasir ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--s4); height: calc(100dvh - var(--bar)); padding: var(--s4); max-width: 1440px; margin: 0 auto; }
.catalog { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; }
.search { display: flex; gap: var(--s2); padding: var(--s3); border-bottom: 1px solid var(--line); }
.search .input { font-size: var(--t-md); }
.plist { overflow: auto; min-height: 0; }
.pitem { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; width: 100%; padding: var(--s2) var(--s3); border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.pitem:hover { background: #faf9f8; }
.pitem[disabled] { cursor: not-allowed; opacity: .55; }
.pitem img, .pitem .ph { width: 48px; height: 48px; border-radius: var(--r1); object-fit: cover; background: var(--bg); }
.pitem .t { display: grid; min-width: 0; }
.pitem .t b { font-size: var(--t-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pitem .t span { color: var(--muted); font-size: var(--t-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pitem .r { display: grid; justify-items: end; gap: var(--s1); }
.pitem .incart { min-width: 24px; height: 24px; padding: 0 var(--s1); border-radius: 12px; background: var(--ink); color: #fff; font-size: var(--t-xs); font-weight: 700; display: inline-grid; place-items: center; }
.empty { display: grid; justify-items: center; gap: var(--s2); padding: var(--s6) var(--s4); text-align: center; color: var(--muted); }
.empty b { color: var(--ink); font-size: var(--t-md); }
.skel { height: 64px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #f4f2f1 0, #ebe8e6 40%, #f4f2f1 80%); background-size: 400% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -100% 0; } }

.cart { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; }
.cart-head > *, .cart-foot > * { min-width: 0; }
.cart-head { display: grid; gap: var(--s3); padding: var(--s3); border-bottom: 1px solid var(--line); }
.cust { overflow: hidden; display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 44px; padding: 0 var(--s3); border: 1px dashed var(--line); border-radius: var(--r1); background: none; text-align: left; cursor: pointer; }
.cust b, .cust > span:not(.ch):not(.badge) { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust .ch, .cust .badge { flex: none; }
.ship .field, .ship .two > * { min-width: 0; }
.cust .ch { margin-left: auto; color: var(--muted); font-size: var(--t-xs); }
.lines { overflow: auto; min-height: 0; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s1) var(--s3); padding: var(--s3); border-bottom: 1px solid var(--line); }
.line .nm { min-width: 0; }
.line .nm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line .nm span { font-size: var(--t-xs); color: var(--muted); }
.line .tot { text-align: right; font-weight: 600; }
.line .tot s { display: block; font-weight: 400; font-size: var(--t-xs); color: var(--muted); }
.line .err { grid-column: 1 / -1; font-size: var(--t-xs); color: var(--danger); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r1); }
.qty button { width: 40px; height: 36px; border: 0; background: none; font-size: var(--t-lg); line-height: 1; cursor: pointer; }
.qty input { width: 48px; height: 36px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-weight: 600; }
.qty input:focus { outline: none; background: var(--bg); }
.linebar { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s2); }
.linebar .unit { font-size: var(--t-xs); color: var(--muted); }
.linebar .rm { margin-left: auto; min-height: 36px; padding: 0 var(--s2); font-size: var(--t-xs); color: var(--muted); }
.cart-foot { display: grid; gap: var(--s3); padding: var(--s3); border-top: 1px solid var(--line); background: #fcfbfb; }
.sum { display: grid; gap: var(--s1); }
.sum div { display: flex; justify-content: space-between; color: var(--ink-2); }
.sum .grand { margin-top: var(--s1); color: var(--ink); font-size: var(--t-lg); font-weight: 700; }
.ship { display: grid; gap: var(--s2); }
.ship .two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.rates { display: grid; gap: var(--s1); }
.rate { display: flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r1); cursor: pointer; }
.rate input { accent-color: var(--ink); }
.rate .c { margin-left: auto; font-weight: 600; }

.mbar { display: none; }

/* ---------- sheet / modal ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(29,26,27,.45); display: grid; place-items: center; padding: var(--s4); }
.sheet { width: min(520px, 100%); max-height: calc(100dvh - 2 * var(--s4)); overflow: auto; background: var(--surface); border-radius: var(--r2); padding: var(--s5); display: grid; gap: var(--s4); }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.big { font-size: var(--t-xl); font-weight: 700; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.quick .btn { padding: 0 var(--s2); }
.qris { justify-self: center; width: min(320px, 100%); border: 1px solid var(--line); border-radius: var(--r2); background: #fff; }
.result { display: grid; justify-items: center; gap: var(--s2); text-align: center; }
.check { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; font-size: var(--t-xl); font-weight: 700; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s4); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.clist { display: grid; }
.citem { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 52px; padding: var(--s2) var(--s3); border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.citem:hover { background: #faf9f8; }
.citem .t { display: grid; min-width: 0; }
.citem .t span { font-size: var(--t-xs); color: var(--muted); }
.citem .badge { margin-left: auto; }

/* ---------- tabel ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th { text-align: left; font-size: var(--t-xs); font-weight: 600; color: var(--muted); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.n, .table th.n { text-align: right; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #faf9f8; }
.table tr.void td { color: var(--muted); text-decoration: line-through; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r2); }
.toast { position: fixed; left: 50%; bottom: var(--s5); z-index: 70; transform: translateX(-50%); max-width: calc(100% - 2 * var(--s4)); padding: var(--s3) var(--s4); border-radius: var(--r1); background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ---------- ponsel ---------- */
@media (max-width: 860px) {
  .pos { grid-template-columns: 1fr; padding: 0; height: calc(100dvh - var(--bar)); gap: 0; }
  .catalog { border: 0; border-radius: 0; padding-bottom: 72px; }
  .cart { position: fixed; inset: 0; z-index: 30; border: 0; border-radius: 0; }
  .cart:not(.open) { display: none; }
  .cart .close-cart { display: inline-flex; }
  .mbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 25; padding: var(--s3) var(--s4); background: var(--surface); border-top: 1px solid var(--line); }
  .mbar .btn { flex: 1; justify-content: space-between; }
  .topbar { gap: var(--s2); padding: 0 var(--s3); }
  .topbar .brand, .topbar nav .nav-out { display: none; }
  .topbar .where b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
  .topbar .where small { max-width: 34vw; }
  .topbar nav { gap: 0; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { flex: none; }
  .topbar nav a { padding: 0 var(--s2); }
  .toast { bottom: 88px; }
  .sheet-bg { place-items: end stretch; padding: 0; }
  .sheet { width: 100%; max-height: 92dvh; border-radius: var(--r2) var(--r2) 0 0; padding: var(--s4); }
  .quick { grid-template-columns: repeat(2, 1fr); }
}
.close-cart { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .topbar, .mbar { display: none; } }
