/* TheGawl - Rissole Malah: palet hangat (krem, coklat tua, bata), serif untuk judul, sans untuk isi. */

:root {
  --paper: #f4ede1;
  --surface: #fffdf8;
  --surface-2: #faf4e9;
  --ink: #241a12;
  --muted: #6b5d4f;
  --line: #e0d5c3;
  --line-strong: #cbbca6;
  --accent: #a8431c;
  --accent-dark: #8a3616;
  --accent-soft: #f3e2d7;
  --ok: #2f6b4f;
  --ok-soft: #e3efe7;
  --warn: #7a4c0a;
  --warn-soft: #f7ead2;
  --danger: #8f2b2b;
  --danger-soft: #f6e3e3;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-lift: 0 12px 26px -20px rgba(36, 26, 18, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
.brand {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.3rem);
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.22rem;
}

h3 {
  font-size: 1.06rem;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

img {
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 0.85rem;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.site-header :focus-visible {
  outline-color: var(--paper);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--paper);
  font-size: 1.32rem;
  line-height: 1.1;
  margin-right: 4px;
}

.brand small {
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--accent-soft);
  margin-top: 3px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: #d8cbbb;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
}

.nav a[aria-current="page"] {
  background: var(--accent);
  color: #fff8f2;
}

.clock {
  margin-left: auto;
  color: #b7a996;
  font-size: 0.85rem;
  white-space: nowrap;
}

.logout-form {
  margin: 0;
  display: flex;
}

.logout-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #e7dbcc;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.logout-btn:hover {
  border-color: var(--paper);
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper);
}

/* Layout */

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-head .sub {
  color: var(--muted);
  margin-top: 6px;
  max-width: 62ch;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-head-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 18px;
  font-size: 0.94rem;
}

.flash-success {
  background: var(--ok-soft);
  border-color: #bfd8c8;
  color: #1f4c37;
}

.flash-error {
  background: var(--danger-soft);
  border-color: #e3c2c2;
  color: #6f2020;
}

/* Mode offline */

.offline-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 600;
}

.offline-bar.is-online {
  border-color: #bfd8c8;
  background: var(--ok-soft);
  color: #1f4c37;
}

.offline-bar.is-warning {
  border-color: #e3c2c2;
  background: var(--danger-soft);
  color: #6f2020;
}

.offline-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(36, 26, 18, 0.12);
}

.offline-text {
  flex: 1 1 180px;
  min-width: 0;
}

.offline-bar .btn-small {
  min-height: 34px;
  border-color: currentColor;
  background: transparent;
  color: inherit;
}

.offline-bar .btn-small:hover {
  background: rgba(255, 255, 255, 0.45);
  color: inherit;
}

.offline-bar .link-btn {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Buttons and fields */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--ink);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8f2;
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff8f2;
}

.btn-block {
  width: 100%;
}

.btn-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff5f5;
}

.btn-danger:hover {
  background: #741f1f;
  border-color: #741f1f;
  color: #fff5f5;
}

.btn-danger-ghost {
  color: var(--danger);
  border-color: #d9b7b7;
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn-primary:disabled:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  min-height: 36px;
}

.link-btn:hover {
  text-decoration: underline;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.field input::placeholder {
  color: #7a6a5a;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 67, 28, 0.16);
}

.field input[type="file"] {
  padding: 8px;
  background: var(--surface-2);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.form-error {
  color: #6f2020;
  background: var(--danger-soft);
  border: 1px solid #e3c2c2;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.88rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-wide {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  margin: 10px 0 14px;
  cursor: pointer;
}

.checkbox input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

/* POS */

.pos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.search input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.search input::placeholder {
  color: #7a6a5a;
}

.search input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 67, 28, 0.16);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.product {
  --card-pad: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 112px;
  padding: var(--card-pad);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.product-photo {
  display: block;
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 8px;
  border-radius: 13px 13px 0 0;
  overflow: hidden;
  background: var(--surface-2);
}

.product-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.product:hover {
  border-color: var(--line-strong);
  background: #fffaf3;
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.product:active {
  transform: translateY(0);
}

.product:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.product-name {
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.product-cat {
  font-size: 0.74rem;
  color: var(--muted);
}

.product-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.product-price {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.product-stock {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.product-stock.is-low {
  border-color: transparent;
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
}

.product-stock.is-negative {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

/* Cart */

.cart-panel {
  --panel-pad: 18px;
  position: sticky;
  top: 88px;
  scroll-margin-top: 100px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  padding: var(--panel-pad);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 40px -34px rgba(36, 26, 18, 0.5);
}

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: calc(-1 * var(--panel-pad)) calc(-1 * var(--panel-pad)) 14px;
  padding: 14px var(--panel-pad);
  border-radius: 13px 13px 0 0;
  background: var(--ink);
  color: var(--paper);
}

.cart-head h2 {
  color: var(--paper);
  font-size: 1.12rem;
}

.cart-head .link-btn {
  color: var(--accent-soft);
}

.cart-head .link-btn:hover {
  color: var(--paper);
}

.cart-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 14px 0 6px;
}

.cart-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.cart-line {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.cart-line-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.cart-line-name {
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1.3;
}

.cart-line-total {
  font-size: 0.94rem;
  white-space: nowrap;
}

.cart-line-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.cart-line-meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin-right: auto;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stepper button {
  width: 44px;
  height: 40px;
  border: 0;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.stepper button:hover {
  background: var(--accent-soft);
}

.stepper span {
  min-width: 32px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.remove {
  border: 0;
  background: none;
  color: var(--danger);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 2px;
  cursor: pointer;
}

.remove:hover {
  text-decoration: underline;
}

.cart-form {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.pay {
  border: 0;
  padding: 0;
  margin: 0;
}

.pay legend {
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.method-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.method {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.method:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.method.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.method:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quick-cash {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.qris-box {
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface-2);
}

.qris-box img {
  display: block;
  width: 180px;
  height: 180px;
  margin: 0 auto 10px;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  object-fit: contain;
}

.qris-box p {
  font-size: 0.88rem;
  color: var(--muted);
}

.qris-merchant {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink) !important;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.qris-box strong {
  color: var(--ink);
}

.qris-box .btn {
  margin-top: 10px;
}

.qris-compact {
  padding: 14px;
}

.qris-total-line {
  font-size: 0.88rem;
  color: var(--muted);
}

.qris-total-line strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--ink);
  margin-top: 2px;
}

.qris-compact .qris-merchant {
  margin-top: 4px;
}

.totals {
  margin: 0;
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.totals > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.totals dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.totals dd {
  margin: 0;
  font-weight: 600;
}

.total-row {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.total-row dt,
.total-row dd {
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.change-row,
#change-row {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

#change-row dt,
#change-row dd {
  font-size: 0.9rem;
}

#change-row.is-ok {
  background: var(--ok-soft);
}

#change-row.is-ok dd {
  color: var(--ok);
}

#change-row.is-short {
  background: var(--danger-soft);
}

#change-row.is-short dd {
  color: var(--danger);
}

.mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -12px 30px -24px rgba(36, 26, 18, 0.6);
}

.mobile-bar-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.mobile-bar-info span {
  color: var(--muted);
  font-size: 0.78rem;
}

.mobile-bar-info strong {
  font-size: 1.05rem;
}

/* Empty states */

.empty {
  color: var(--muted);
  padding: 24px 0;
}

.empty-state {
  text-align: center;
  padding: 44px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-state h1,
.empty-state h2,
.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 16px;
  max-width: 46ch;
  margin-left: auto;
  margin-right: auto;
}

/* Cards and sections */

.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-head .muted {
  font-size: 0.85rem;
}

.stack {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

/* Tables */

.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.table-tools .search {
  flex: 1 1 260px;
  max-width: 360px;
}

.table-tools .muted {
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #fffaf3;
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

.table .actions-col {
  text-align: right;
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}

.table .actions .btn {
  margin-left: 4px;
}

.cell-strong {
  display: block;
  font-weight: 600;
}

.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.tag-ok {
  background: var(--ok-soft);
  border-color: transparent;
  color: #245741;
}

.tag-danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: #742424;
}

.tag-warn {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}

/* Reports */

.range-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.range-form .field {
  width: 170px;
}

.range-note {
  margin: -6px 0 18px;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.stats {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.stat-note {
  font-size: 0.76rem;
  color: var(--muted);
}

.stat-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.stat-primary .stat-label,
.stat-primary .stat-note {
  color: #cbbfae;
}

.stat-primary .stat-value {
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
  align-items: start;
}

.report-grid > .card:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

.report-grid > .card:nth-child(2) {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.report-grid > .card:nth-child(3) {
  grid-column: 1;
  grid-row: 2;
}

.bar-col {
  width: 26%;
}

.bar {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.top-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.top-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.top-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.top-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.top-name {
  font-weight: 600;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.top-qty {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.top-revenue {
  font-size: 0.78rem;
  color: var(--muted);
}

.payment-list {
  margin: 0;
  display: grid;
  gap: 10px;
}

.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.payment-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.payment-item dt {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
}

.payment-item dt .muted {
  font-weight: 400;
  font-size: 0.76rem;
}

.payment-item dd {
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
}

/* Settings */

.qris-settings {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.qris-preview {
  width: 180px;
  height: 180px;
  object-fit: contain;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.qris-settings p {
  margin-bottom: 8px;
}

.qris-settings form {
  margin-top: 8px;
}

.upload-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.upload-form .field {
  flex: 1 1 280px;
}

.merchant-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.merchant-form .field {
  flex: 1 1 280px;
}

.card-danger {
  border-color: #e3c2c2;
  background: #fffaf9;
}

.reset-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--danger);
  padding: 6px 0;
  min-height: 36px;
}

.reset-body {
  margin-top: 8px;
  font-size: 0.92rem;
}

.reset-body p {
  color: var(--muted);
  margin-bottom: 10px;
  max-width: 62ch;
}

/* Dialog */

.dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 70px -40px rgba(20, 12, 6, 0.7);
}

.dialog-wide {
  width: min(560px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: rgba(36, 26, 18, 0.5);
}

.dialog h2 {
  margin-bottom: 10px;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}

.success-figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0 0;
}

.success-figures > div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.success-figures dt {
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0;
  font-weight: 600;
}

.success-figures dd {
  margin: 3px 0 0;
  font-size: 1.02rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.offline-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.88rem;
  font-weight: 600;
}

.pending-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: min(46vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pending-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.pending-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pending-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.pending-error {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--danger-soft);
  color: #6f2020;
  font-size: 0.84rem;
}

.pending-empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-align: center;
}

.pending-cancel {
  margin-top: 8px;
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-wait {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.table .badge {
  margin-left: 6px;
  vertical-align: middle;
}

.nota-offline {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.8rem;
}

.qris-amount {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 700;
  text-align: center;
  margin: 6px 0 12px;
}

.qris-large {
  display: block;
  width: min(320px, 80vw);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto 12px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  object-fit: contain;
}

/* Toast */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(340px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9rem;
  box-shadow: 0 18px 40px -24px rgba(20, 12, 6, 0.8);
  animation: toast-in 0.18s ease-out;
}

.toast.is-error {
  background: #6f2020;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Nota digital */

.nota-page {
  max-width: 560px;
  margin: 0 auto;
}

.nota-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.nota-brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.nota-brand:hover {
  color: var(--accent);
}

.nota-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.nota-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.nota-head h1 {
  font-size: 1.55rem;
}

.nota-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.85rem;
}

.nota-meta,
.nota-totals {
  display: grid;
  gap: 6px;
  margin: 0;
}

.nota-meta {
  padding: 16px 0;
  border-bottom: 1px dashed var(--line-strong);
}

.nota-meta div,
.nota-totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.9rem;
}

.nota-meta dt,
.nota-totals dt {
  color: var(--muted);
}

.nota-meta dd,
.nota-totals dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.nota-items {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line-strong);
  list-style: none;
}

.nota-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.nota-item-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.nota-item-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
}

.nota-item-total {
  font-weight: 600;
  white-space: nowrap;
}

.nota-totals {
  padding-top: 16px;
}

.nota-grand {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 1.2rem;
}

.nota-grand dt,
.nota-grand dd {
  color: var(--ink);
  font-weight: 700;
}

.nota-note {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.nota-qris {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.nota-qris img {
  width: 104px;
  height: 104px;
  flex: none;
  border-radius: var(--radius-sm);
  background: #fff;
  object-fit: contain;
}

.nota-qris-label {
  font-weight: 700;
}

.nota-qris-merchant {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.88rem;
}

.nota-qris-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.nota-qris-download {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.nota-qris-download:hover {
  text-decoration: underline;
}

.nota-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.nota-actions .btn {
  flex: 1 1 200px;
}

.nota-hint {
  margin-top: 10px;
  text-align: center;
}

/* Login */

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.auth-card {
  width: min(420px, 100%);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 30px 70px -50px rgba(36, 26, 18, 0.6);
}

.auth-head {
  text-align: center;
  margin: 0;
  padding: 30px 26px 24px;
  background: var(--ink);
  color: var(--paper);
}

.auth-head .brand {
  align-items: center;
  font-size: 1.12rem;
}

.auth-head h1 {
  margin-top: 16px;
  font-size: 1.42rem;
  color: var(--paper);
}

.auth-head p {
  margin-top: 8px;
  font-size: 0.9rem;
}

.auth-head .muted {
  color: #cfc2b1;
}

.auth-form {
  display: grid;
  gap: 14px;
  padding: 22px 26px 0;
}

.auth-note {
  margin-top: 14px;
  padding: 0 26px 24px;
  text-align: center;
}

.auth-card .flash {
  margin: 18px 26px 0;
}

/* Responsive */

.checkout-footer {
  display: grid;
  gap: 12px;
}

@media (min-width: 981px) {
  .checkout-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-top: 12px;
    background: var(--surface);
  }
}

@media (max-width: 980px) {
  .pos {
    grid-template-columns: minmax(0, 1fr);
  }

  .cart-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .mobile-bar:not([hidden]) {
    display: flex;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .report-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .report-grid > .card:nth-child(1),
  .report-grid > .card:nth-child(2),
  .report-grid > .card:nth-child(3) {
    grid-column: auto;
    grid-row: auto;
  }

  .main {
    padding-bottom: 96px;
  }

  .clock {
    display: none;
  }
}

@media (max-width: 720px) {
  .header-inner {
    padding: 10px 16px;
    gap: 8px;
  }

  .nav {
    width: 100%;
    order: 3;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
    padding: 0 10px;
  }

  .brand {
    font-size: 1.05rem;
  }

  .clock {
    display: block;
    font-size: 0.72rem;
  }

  .cart-panel {
    scroll-margin-top: 124px;
  }

  .btn-small,
  .link-btn,
  .logout-btn,
  .chip,
  .remove,
  .reset-details summary {
    min-height: 44px;
  }

  .stepper button {
    height: 44px;
  }

  .remove {
    padding: 8px 6px;
  }

  .main {
    padding: 20px 16px 96px;
  }

  .page-head {
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .range-form .field {
    width: calc(50% - 6px);
    min-width: 130px;
  }

  .presets {
    margin-left: 0;
    width: 100%;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .success-figures {
    grid-template-columns: 1fr;
  }

  .dialog {
    padding: 20px;
  }

  .qris-box img {
    width: 180px;
    height: 180px;
  }

  .nota-card {
    padding: 20px;
  }
}

@media (max-width: 520px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .product {
    --card-pad: 12px;
    min-height: 104px;
  }

  .product-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-primary {
    grid-column: auto;
  }

  .page-head-actions {
    width: 100%;
  }

  .page-head-actions .btn {
    flex: 1 1 auto;
  }

  .cart-panel {
    --panel-pad: 14px;
  }
}

/* Mobile & tablet polish */

.table-wrap {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.nota-qris > div {
  min-width: 0;
}

.nota-qris-hint {
  overflow-wrap: anywhere;
}

.nota-qris-download {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 0;
}

button,
.btn,
.chip,
.method,
.product,
.stepper button,
.nav a,
.link-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(168, 67, 28, 0.12);
}

/* Tabel jadi kartu bertumpuk di HP supaya tidak perlu digeser ke samping. */
@media (max-width: 640px) {
  .table-stack {
    min-width: 0;
  }

  .table-stack thead {
    display: none;
  }

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  .table-stack tbody tr:last-child {
    border-bottom: 0;
  }

  .table-stack td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    font-size: 0.9rem;
    text-align: left;
  }

  .table-stack td::before {
    content: attr(data-label);
    flex: none;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
  }

  .table-stack td:first-child {
    display: block;
    padding: 0 0 6px;
    font-weight: 600;
  }

  .table-stack td:first-child::before {
    display: none;
  }

  .table-stack td.num {
    text-align: right;
  }

  .table-stack td.actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    padding-top: 8px;
  }

  .table-stack td.actions::before {
    margin-right: auto;
  }

  .table-stack td.bar-col {
    width: auto;
    padding-top: 8px;
  }

  .table-stack td.bar-col::before {
    display: none;
  }

  .table-stack td.bar-col .bar {
    height: 8px;
  }
}

@media (max-width: 980px) {
  .toast {
    left: 16px;
    right: 16px;
    max-width: none;
  }

  body:has(.mobile-bar:not([hidden])) .toast {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 720px) {
  .nota-qris-download {
    min-height: 44px;
  }
}

/* Form dan tombol jadi satu kolom penuh di layar sempit. */
@media (max-width: 520px) {
  .upload-form .field,
  .merchant-form .field {
    flex-basis: 100%;
  }

  .form-actions,
  .dialog-actions,
  .upload-form,
  .merchant-form,
  .range-form {
    align-items: stretch;
  }

  .form-actions .btn,
  .dialog-actions .btn,
  .upload-form .btn,
  .merchant-form .btn,
  .range-form > .btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .clock {
    display: none;
  }
}

/* viewport-fit=cover: jaga konten tetap di area aman iPhone. */
@supports (padding: env(safe-area-inset-left)) {
  .site-header {
    padding-top: env(safe-area-inset-top);
  }

  .header-inner,
  .main {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }

  .mobile-bar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  @media (max-width: 720px) {
    .header-inner,
    .main {
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Di tablet dan HP, kontrol kecil dinaikkan ke 44px supaya nyaman disentuh. */
@media (max-width: 980px) {
  .nav a,
  .logout-btn,
  .btn-small,
  .chip,
  .link-btn,
  .remove,
  .stepper button,
  .reset-details summary,
  .nota-qris-download {
    min-height: 44px;
  }
}
