/* =====================================================================
   KASIR MIXDOM — Design System
   Tema: kepala bunga matahari (biji gelap + kelopak emas) & kucing.
   Ditulis tangan, tanpa build step, siap untuk shared hosting.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ---------------------------------------------------------------------
   1. Token
   --------------------------------------------------------------------- */
:root {
  /* Warna diambil dari kepala bunga matahari yang dilihat dari dekat:
     biji panggang gelap di tengah, kelopak emas, daun pelindung hijau. */
  --seed:        #2b2118;
  --seed-soft:   #3a2e22;
  --seed-line:   #4b3c2d;
  --husk:        #6b5844;
  --husk-light:  #96836c;

  --petal:       #f5b301;
  --petal-hi:    #ffce3d;
  --petal-deep:  #c97a0c;
  --petal-wash:  #fdf3d8;

  --bract:       #3e6b3a;
  --bract-wash:  #e8f0e5;

  --paw:         #d4674a;   /* bantalan kaki kucing — hanya untuk aksi berisiko */
  --paw-wash:    #fbe9e4;

  --milk:        #fbf7ef;
  --surface:     #ffffff;
  --line:        #ece2d0;
  --line-strong: #ddcfb7;

  --ink:         var(--seed);
  --ink-soft:    var(--husk);
  --ink-mute:    var(--husk-light);

  /* Tipografi */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Ritme */
  --sp-1: .25rem;  --sp-2: .5rem;   --sp-3: .75rem;  --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4rem;

  --r-sm: 8px;  --r-md: 12px;  --r-lg: 18px;  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(43, 33, 24, .06);
  --shadow-md: 0 4px 16px -4px rgba(43, 33, 24, .12);
  --shadow-lg: 0 18px 48px -16px rgba(43, 33, 24, .28);

  --sidebar-w: 264px;
  --topbar-h: 68px;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

/* ---------------------------------------------------------------------
   2. Dasar
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--milk);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: 'SOFT' 30, 'WONK' 1, 'opsz' 40;
  letter-spacing: -.015em;
}

a { color: var(--petal-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--seed); }

img, svg { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--petal-deep);
  outline-offset: 2px;
  border-radius: 4px;
}

.mono { font-family: var(--font-mono); font-size: .875em; letter-spacing: -.02em; }
.muted { color: var(--ink-mute); }
.soft  { color: var(--ink-soft); }

.eyebrow {
  font-size: .6875rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-mute);
}

.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;
}

.skip-link {
  position: absolute; left: -9999px; top: var(--sp-3); z-index: 999;
  background: var(--seed); color: var(--petal); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
}
.skip-link:focus { left: var(--sp-3); }

/* ---------------------------------------------------------------------
   3. Kerangka aplikasi
   --------------------------------------------------------------------- */
.shell { display: flex; min-height: 100dvh; }

/* --- Sidebar: pusat bunga yang gelap --- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--seed);
  color: #e7ddcd;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
}

.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
}
.brand__mark { width: 38px; height: 38px; flex: none; }
.brand__name {
  font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700;
  font-variation-settings: 'SOFT' 40, 'WONK' 1;
  color: #fff; line-height: 1.15;
}
.brand__meta { font-size: .6875rem; color: var(--husk-light); letter-spacing: .04em; }

.nav { flex: 1; overflow-y: auto; padding: var(--sp-2) var(--sp-3) var(--sp-5); }
.nav__group + .nav__group { margin-top: var(--sp-5); }
.nav__label {
  font-size: .625rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: #7a6752; padding: 0 var(--sp-3) var(--sp-2);
}

.nav__link {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: .625rem var(--sp-3);
  border-radius: var(--r-sm);
  color: #cfc2ae;
  font-size: .9375rem; font-weight: 500;
  text-decoration: none;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav__link:hover { background: var(--seed-soft); color: #fff; }
.nav__link svg { width: 19px; height: 19px; flex: none; opacity: .85; }

.nav__link.is-active { background: var(--seed-soft); color: #fff; }
.nav__link.is-active svg { opacity: 1; color: var(--petal); }

/* Penanda aktif: satu kelopak emas di tepi kiri */
.nav__link.is-active::before {
  content: '';
  position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px;
  background: var(--petal);
  border-radius: 0 var(--r-full) var(--r-full) 0;
}

.nav__badge {
  margin-left: auto;
  background: var(--paw); color: #fff;
  font-size: .6875rem; font-weight: 700;
  padding: 1px 7px; border-radius: var(--r-full);
}

/* Kucing duduk di kaki sidebar — muncul di tempat yang sepi */
.sidebar__foot {
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  border-top: 1px solid var(--seed-line);
  display: flex; align-items: flex-end; gap: var(--sp-3);
}
.sidebar__cat { width: 46px; height: 46px; flex: none; color: var(--petal); opacity: .9; }
.sidebar__note { font-size: .6875rem; line-height: 1.45; color: #7a6752; }

/* --- Area utama --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-5);
  background: rgba(251, 247, 239, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-size: 1.0625rem; font-weight: 600; }
.topbar__sub { font-size: .75rem; color: var(--ink-mute); }
.topbar__spacer { flex: 1; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--r-sm); color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:hover { background: var(--line); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: var(--r-full);
  background: var(--petal-wash);
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-weight: 700; font-size: .8125rem; color: var(--petal-deep);
}

.content { padding: var(--sp-5); flex: 1; }
.content__inner { max-width: 1240px; margin: 0 auto; }

.page-head {
  display: flex; align-items: flex-end; gap: var(--sp-4);
  flex-wrap: wrap; margin-bottom: var(--sp-5);
}
.page-head__title { font-size: 1.625rem; }
.page-head__desc { color: var(--ink-soft); font-size: .9375rem; margin-top: 2px; }
.page-head__actions { margin-left: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   4. Tombol
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: .5625rem var(--sp-4);
  min-height: 42px;
  font-family: inherit; font-size: .9375rem; font-weight: 600;
  border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn--primary {
  background: var(--petal); color: var(--seed);
  box-shadow: 0 1px 0 var(--petal-deep), var(--shadow-sm);
}
.btn--primary:hover { background: var(--petal-hi); color: var(--seed); }

.btn--dark { background: var(--seed); color: #fff; }
.btn--dark:hover { background: var(--seed-soft); color: #fff; }

.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--milk); border-color: var(--husk-light); color: var(--ink); }

.btn--danger { background: var(--paw-wash); color: var(--paw); border-color: #f0cfc5; }
.btn--danger:hover { background: var(--paw); color: #fff; }

.btn--sm { min-height: 34px; padding: .25rem .75rem; font-size: .8125rem; }
.btn--lg { min-height: 52px; padding: .75rem var(--sp-5); font-size: 1rem; }
.btn--block { width: 100%; }

/* ---------------------------------------------------------------------
   5. Kartu & panel
   --------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.card__title { font-size: .9375rem; font-weight: 600; }
.card__body { padding: var(--sp-5); }
.card__foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); background: var(--milk); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.grid { display: grid; gap: var(--sp-4); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* Kartu statistik: angka besar pakai display face */
.stat { padding: var(--sp-5); }
.stat__label { display: flex; align-items: center; gap: var(--sp-2); font-size: .8125rem; color: var(--ink-soft); font-weight: 500; }
.stat__label svg { width: 16px; height: 16px; color: var(--petal-deep); }
.stat__value {
  font-family: var(--font-display); font-size: 1.875rem; font-weight: 600;
  font-variation-settings: 'SOFT' 20, 'opsz' 40;
  margin-top: var(--sp-2); line-height: 1.05; letter-spacing: -.02em;
}
.stat__meta { font-size: .8125rem; color: var(--ink-mute); margin-top: var(--sp-2); }
.stat__delta { font-weight: 600; }
.stat__delta--up { color: var(--bract); }
.stat__delta--down { color: var(--paw); }

/* ---------------------------------------------------------------------
   6. Formulir
   --------------------------------------------------------------------- */
.field { margin-bottom: var(--sp-4); }
.field__label { display: block; font-size: .8125rem; font-weight: 600; margin-bottom: .375rem; }
.field__hint { font-size: .75rem; color: var(--ink-mute); margin-top: .375rem; }
.field__error { font-size: .75rem; color: var(--paw); margin-top: .375rem; font-weight: 500; }

.input, .select, .textarea {
  width: 100%;
  padding: .625rem var(--sp-3);
  min-height: 44px;
  font-family: inherit; font-size: .9375rem; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: #b9a892; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--petal-deep);
  box-shadow: 0 0 0 3px rgba(245, 179, 1, .22);
}
.input[aria-invalid="true"] { border-color: var(--paw); }
.textarea { min-height: 92px; resize: vertical; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b5844' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  padding-right: var(--sp-6);
}

.input--money { font-family: var(--font-mono); font-weight: 500; }

.field-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.input-group { display: flex; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* Pencarian di topbar */
.search {
  position: relative; flex: 1; max-width: 420px;
}
.search svg {
  position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--ink-mute); pointer-events: none;
}
.search .input { padding-left: 2.375rem; background: var(--surface); }

/* ---------------------------------------------------------------------
   7. Tabel
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  text-align: left; font-size: .6875rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--milk);
}
.table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fffdf7; }
.table .num { text-align: right; font-family: var(--font-mono); font-weight: 500; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }

.cell-title { font-weight: 600; }
.cell-sub { font-size: .75rem; color: var(--ink-mute); }

/* ---------------------------------------------------------------------
   8. Lencana & status
   --------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: .6875rem; font-weight: 700; letter-spacing: .02em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge--gold  { background: var(--petal-wash); color: #8a5c04; border-color: #f0dcae; }
.badge--green { background: var(--bract-wash); color: var(--bract); border-color: #cfe0ca; }
.badge--red   { background: var(--paw-wash);   color: var(--paw);   border-color: #f0cfc5; }
.badge--grey  { background: var(--line);       color: var(--ink-soft); border-color: var(--line-strong); }

.tier-chip {
  display: inline-flex; align-items: baseline; gap: var(--sp-2);
  padding: 4px 10px;
  background: var(--petal-wash);
  border: 1px dashed #e6c874;
  border-radius: var(--r-sm);
  font-size: .75rem;
}
.tier-chip strong { font-family: var(--font-mono); font-size: .8125rem; color: #8a5c04; }

/* ---------------------------------------------------------------------
   9. Pesan & keadaan kosong
   --------------------------------------------------------------------- */
.flash-stack {
  position: fixed; top: var(--sp-4); right: var(--sp-4); z-index: 90;
  display: flex; flex-direction: column; gap: var(--sp-2);
  width: min(360px, calc(100vw - 2rem));
}
.flash {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--husk);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  font-size: .875rem;
  animation: flash-in .3s var(--ease);
}
.flash--success { border-left-color: var(--bract); }
.flash--error   { border-left-color: var(--paw); }
.flash--info    { border-left-color: var(--petal); }
.flash__close { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--ink-mute); font-size: 18px; line-height: 1; padding: 0 2px; }

@keyframes flash-in { from { opacity: 0; transform: translateX(12px); } }

.alert {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  font-size: .875rem;
  background: var(--petal-wash);
  border: 1px solid #f0dcae;
  color: #7a5203;
}
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.alert--danger { background: var(--paw-wash); border-color: #f0cfc5; color: #8f3a24; }

/* Keadaan kosong: di sinilah kucingnya duduk */
.empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
}
.empty__cat { width: 108px; height: 108px; margin: 0 auto var(--sp-4); color: var(--line-strong); }
.empty__title { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; margin-bottom: var(--sp-2); }
.empty__text { color: var(--ink-soft); font-size: .875rem; max-width: 30rem; margin: 0 auto var(--sp-4); }

/* ---------------------------------------------------------------------
   10. Halaman masuk
   --------------------------------------------------------------------- */
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--milk);
}
.auth__aside {
  display: none;
  position: relative;
  background: var(--seed);
  color: #efe6d6;
  padding: var(--sp-7);
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
/* Pola biji bunga matahari — spiral phyllotaxis, sangat samar */
.auth__seeds {
  position: absolute; inset: -20% -30% auto auto;
  width: 720px; height: 720px; opacity: .16; color: var(--petal);
  pointer-events: none;
}
.auth__aside > * { position: relative; }
.auth__headline {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 600;
  font-variation-settings: 'SOFT' 40, 'WONK' 1, 'opsz' 90;
  line-height: 1.15; letter-spacing: -.02em; color: #fff;
  max-width: 16ch;
}
.auth__sub { color: #b3a289; margin-top: var(--sp-4); max-width: 34ch; font-size: .9375rem; }
.auth__aside-foot { display: flex; align-items: center; gap: var(--sp-3); font-size: .75rem; color: #8a7660; }

.auth__panel {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
}
.auth__box { width: 100%; max-width: 380px; }
.auth__mark { width: 52px; height: 52px; margin-bottom: var(--sp-4); }
.auth__title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; font-variation-settings: 'SOFT' 30, 'WONK' 1; }
.auth__desc { color: var(--ink-soft); font-size: .9375rem; margin: var(--sp-2) 0 var(--sp-5); }

.demo-hint {
  margin-top: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  font-size: .8125rem; color: var(--ink-soft);
}
.demo-hint code {
  font-family: var(--font-mono); font-size: .8125rem;
  background: var(--petal-wash); color: #8a5c04;
  padding: 1px 6px; border-radius: 4px;
}

/* ---------------------------------------------------------------------
   11. Navigasi bawah (mobile)
   --------------------------------------------------------------------- */
.tabbar { display: none; }

.drawer-scrim {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(43, 33, 24, .5);
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease);
}
body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }

/* ---------------------------------------------------------------------
   12. Responsif
   --------------------------------------------------------------------- */
@media (min-width: 1024px) {
  .auth { grid-template-columns: 1.05fr 1fr; }
  .auth__aside { display: flex; }
}

@media (max-width: 900px) {
  :root { --topbar-h: 60px; }

  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  body.drawer-open .sidebar { transform: translateX(0); }

  .content { padding: var(--sp-4) var(--sp-4) calc(76px + var(--sp-4)); }
  .page-head__title { font-size: 1.375rem; }
  .card__body { padding: var(--sp-4); }
  .stat { padding: var(--sp-4); }
  .flash-stack { top: auto; bottom: calc(76px + var(--sp-3)); right: var(--sp-3); left: var(--sp-3); width: auto; }

  /* Bilah tab bawah: empat aksi yang paling sering dipakai */
  .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: .5rem 0 .625rem;
    font-size: .625rem; font-weight: 600; letter-spacing: .02em;
    color: var(--ink-mute); text-decoration: none;
    background: none; border: 0; cursor: pointer; font-family: inherit;
  }
  .tabbar__item svg { width: 21px; height: 21px; }
  .tabbar__item.is-active { color: var(--petal-deep); }

  /* Tabel jadi daftar kartu di layar sempit */
  .table--stack thead { display: none; }
  .table--stack tbody tr {
    display: block; padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--line);
  }
  .table--stack tbody td {
    display: flex; justify-content: space-between; gap: var(--sp-4);
    padding: 3px 0; border: 0; text-align: right;
  }
  .table--stack tbody td::before {
    content: attr(data-label);
    font-size: .6875rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--ink-mute);
    text-align: left; flex: none;
  }
  .table--stack tbody td.actions { justify-content: flex-end; padding-top: var(--sp-3); }
}

@media (max-width: 480px) {
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---------------------------------------------------------------------
   13. Cetak struk termal (58mm / 80mm)
   --------------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .tabbar, .flash-stack, .no-print, .drawer-scrim { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
}

.receipt {
  width: 58mm;
  margin: 0 auto;
  padding: 4mm 3mm;
  background: #fff;
  color: #000;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
}
.receipt--80 { width: 80mm; }
.receipt__store { text-align: center; font-weight: 600; font-size: 13px; letter-spacing: .04em; }
.receipt__meta { text-align: center; font-size: 10px; margin-bottom: 3mm; }
.receipt__rule { border-top: 1px dashed #000; margin: 2mm 0; }
.receipt__row { display: flex; justify-content: space-between; gap: 3mm; }
.receipt__item-name { font-size: 11px; }
.receipt__total { font-weight: 600; font-size: 13px; }
.receipt__foot { text-align: center; font-size: 10px; margin-top: 3mm; }

@page { margin: 0; }

/* =====================================================================
   14. Bar gulir
   Bawaan sistem terlihat kasar di samping panel gelap. Kita ganti
   dengan batang tipis berwarna sekam yang hanya menegas saat disentuh.
   ===================================================================== */

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* WebKit / Blink */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-full);
  border: 3px solid var(--milk);   /* jarak dari tepi, thumb jadi terlihat ramping */
  background-clip: padding-box;
  transition: background .2s var(--ease);
}
::-webkit-scrollbar-thumb:hover { background: var(--husk-light); background-clip: padding-box; }
::-webkit-scrollbar-thumb:active { background: var(--husk); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* Di atas permukaan putih, bingkai thumb ikut putih */
.card ::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.cselect__list::-webkit-scrollbar-thumb {
  border-color: var(--surface);
}

/* Sidebar gelap: thumb terang, bingkai gelap */
.sidebar { scrollbar-color: #55452f transparent; }
.sidebar ::-webkit-scrollbar-thumb,
.nav::-webkit-scrollbar-thumb {
  background: #55452f;
  border-color: var(--seed);
}
.nav::-webkit-scrollbar-thumb:hover { background: #6f5b3e; background-clip: padding-box; }

/* Panel yang sering digulir: batang lebih ramping lagi */
.scroll-slim::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-slim::-webkit-scrollbar-thumb { border-width: 2px; }

/* =====================================================================
   15. Dropdown
   <select> bawaan tidak bisa ditata dan tampil beda di tiap sistem.
   Kita bungkus dengan tombol + daftar sendiri; select aslinya tetap
   ada di DOM sebagai sumber nilai, jadi form tetap terkirim normal
   walau JavaScript mati.
   ===================================================================== */

.cselect { position: relative; }

/* Select asli disembunyikan tapi tetap hidup */
.cselect > select {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; margin: -1px;
}

.cselect__button {
  width: 100%;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: .625rem var(--sp-3);
  min-height: 44px;
  font-family: inherit; font-size: .9375rem; text-align: left; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.cselect__button:hover { border-color: var(--husk-light); }
.cselect__button:focus-visible,
.cselect.is-open .cselect__button {
  outline: none;
  border-color: var(--petal-deep);
  box-shadow: 0 0 0 3px rgba(245, 179, 1, .22);
}
.cselect__value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect__value.is-placeholder { color: #b9a892; }

.cselect__chevron {
  width: 15px; height: 15px; flex: none; color: var(--ink-soft);
  transition: transform .2s var(--ease);
}
.cselect.is-open .cselect__chevron { transform: rotate(180deg); }

/* Daftar pilihan */
.cselect__menu {
  position: absolute; z-index: 60;
  left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
  display: none;
  transform-origin: top center;
}
.cselect.is-open .cselect__menu {
  display: block;
  animation: cselect-in .16s var(--ease);
}
.cselect.is-up .cselect__menu { top: auto; bottom: calc(100% + 6px); transform-origin: bottom center; }

@keyframes cselect-in {
  from { opacity: 0; transform: translateY(-4px) scale(.985); }
}

.cselect__search {
  width: 100%; margin-bottom: var(--sp-2);
  padding: .4375rem var(--sp-3);
  font-family: inherit; font-size: .875rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--milk);
}
.cselect__search:focus { outline: none; border-color: var(--petal-deep); background: var(--surface); }

.cselect__list { max-height: 264px; overflow-y: auto; }

.cselect__option {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: .5rem var(--sp-3);
  border-radius: var(--r-sm);
  font-size: .9375rem; line-height: 1.35;
  cursor: pointer;
  scroll-margin: 4px;
}
.cselect__option:hover,
.cselect__option.is-active { background: var(--petal-wash); }

/* Penanda pilihan: satu titik emas, sekecil biji */
.cselect__option::before {
  content: '';
  width: 6px; height: 6px; flex: none;
  border-radius: var(--r-full);
  background: transparent;
  transition: background .15s var(--ease);
}
.cselect__option[aria-selected="true"] { font-weight: 600; }
.cselect__option[aria-selected="true"]::before { background: var(--petal); }

.cselect__empty {
  padding: var(--sp-3);
  font-size: .875rem; color: var(--ink-mute); text-align: center;
}

/* Varian ramping untuk dipakai di dalam baris tabel */
.cselect--sm .cselect__button { min-height: 34px; padding: .25rem .625rem; font-size: .8125rem; }

/* =====================================================================
   16. Layar kasir
   Dua panel: katalog di kiri, keranjang di kanan yang selalu terlihat.
   Di layar sempit keranjang turun jadi lembar yang bisa ditarik naik.
   ===================================================================== */

.pos {
  display: grid;
  grid-template-columns: 1fr 384px;
  gap: var(--sp-4);
  align-items: start;
}

/* --- Panel katalog --- */
.pos__catalog { min-width: 0; }

.pos__search { margin-bottom: var(--sp-3); }
.pos__search .input { padding-left: 2.5rem; font-size: 1rem; min-height: 50px; }
.pos__search svg { width: 19px; height: 19px; }

.pos__chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-2); margin-bottom: var(--sp-3); }
.pos__chip {
  flex: none;
  padding: .375rem .875rem;
  font-family: inherit; font-size: .8125rem; font-weight: 600;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: var(--r-full);
  cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.pos__chip:hover { border-color: var(--husk-light); }
.pos__chip.is-active { background: var(--seed); color: #fff; border-color: var(--seed); }

.pos__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(174px, 1fr));
  gap: var(--sp-3);
}

.pos-card {
  position: relative;
  display: flex; flex-direction: column; gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  cursor: pointer;
  transition: transform .14s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.pos-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.pos-card:active { transform: translateY(0); }
.pos-card[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.pos-card__name { font-size: .875rem; font-weight: 600; line-height: 1.3; }
.pos-card__sku { font-family: var(--font-mono); font-size: .6875rem; color: var(--ink-mute); }
.pos-card__price {
  font-family: var(--font-display); font-size: 1.125rem; font-weight: 600;
  font-variation-settings: 'SOFT' 20; margin-top: auto; padding-top: var(--sp-2);
}
.pos-card__foot { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1); }
.pos-card__stock { font-size: .6875rem; font-weight: 600; color: var(--ink-mute); }

/* Sudut emas: tanda barang ini punya harga grosir */
.pos-card__tier {
  position: absolute; top: 0; right: 0;
  padding: 3px 8px;
  font-size: .625rem; font-weight: 700; letter-spacing: .04em;
  background: var(--petal-wash); color: #8a5c04;
  border-left: 1px solid #f0dcae; border-bottom: 1px solid #f0dcae;
  border-radius: 0 var(--r-md) 0 var(--r-sm);
}

/* --- Panel keranjang --- */
.pos__cart {
  position: sticky; top: calc(var(--topbar-h) + var(--sp-5));
  display: flex; flex-direction: column;
  max-height: calc(100dvh - var(--topbar-h) - var(--sp-7));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.cart__head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.cart__count {
  margin-left: auto;
  font-size: .75rem; font-weight: 700;
  background: var(--seed); color: var(--petal);
  padding: 2px 9px; border-radius: var(--r-full);
}

.cart__items { flex: 1; overflow-y: auto; padding: var(--sp-2); min-height: 120px; }

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-sm);
}
.cart-line + .cart-line { border-top: 1px solid var(--line); }
.cart-line__name { font-size: .875rem; font-weight: 600; line-height: 1.3; }
.cart-line__meta { font-size: .75rem; color: var(--ink-mute); font-family: var(--font-mono); }
.cart-line__total { font-family: var(--font-mono); font-size: .875rem; font-weight: 600; text-align: right; white-space: nowrap; }
.cart-line__tier { color: var(--petal-deep); font-weight: 700; }

.qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--milk);
}
.qty button {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-soft); font-size: 16px; line-height: 1; font-family: inherit;
}
.qty button:hover { background: var(--line); color: var(--ink); }
.qty input {
  width: 42px; height: 30px;
  border: 0; background: transparent; text-align: center;
  font-family: var(--font-mono); font-size: .8125rem; font-weight: 600; color: var(--ink);
  -moz-appearance: textfield;
}
.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; background: var(--surface); }

.cart__foot { border-top: 1px solid var(--line); padding: var(--sp-4); background: var(--milk); }

.sum-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--sp-3); font-size: .875rem; padding: 2px 0;
}
.sum-row span:last-child { font-family: var(--font-mono); font-weight: 500; }
.sum-row--total {
  margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px dashed var(--line-strong);
  align-items: center;
}
.sum-row--total span:first-child { font-size: .8125rem; font-weight: 600; color: var(--ink-soft); }
.sum-row--total span:last-child {
  font-family: var(--font-display); font-size: 1.625rem; font-weight: 700;
  font-variation-settings: 'SOFT' 20; letter-spacing: -.02em;
}
.sum-row--change span:last-child { color: var(--bract); font-weight: 700; }
.sum-row--kurang span:last-child { color: var(--paw); font-weight: 700; }

/* Tombol uang cepat */
.cash-quick { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }
.cash-quick button {
  flex: 1; min-width: 68px;
  padding: .3125rem .5rem;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 600;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  cursor: pointer;
}
.cash-quick button:hover { background: var(--petal-wash); border-color: #e6c874; color: #8a5c04; }

/* Pilihan cara bayar */
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-1); margin-bottom: var(--sp-3); }
.pay-methods input { position: absolute; opacity: 0; width: 0; height: 0; }
.pay-methods label {
  padding: .4375rem .25rem;
  text-align: center; font-size: .75rem; font-weight: 600;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  cursor: pointer;
}
.pay-methods input:checked + label { background: var(--seed); color: #fff; border-color: var(--seed); }
.pay-methods input:focus-visible + label { outline: 2px solid var(--petal-deep); outline-offset: 2px; }

/* Lembar keranjang di layar sempit */
.pos__bar { display: none; }

@media (max-width: 1024px) {
  .pos { grid-template-columns: 1fr; }

  .pos__cart {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    z-index: 36;
    max-height: 86dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    transform: translateY(101%);
    transition: transform .3s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  body.cart-open .pos__cart { transform: translateY(0); }
  body.cart-open .tabbar { display: none; }

  .pos__bar {
    display: flex; align-items: center; gap: var(--sp-3);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
    background: var(--seed); color: #fff;
    border: 0; width: 100%; font-family: inherit; text-align: left;
    cursor: pointer;
  }
  body.cart-open .pos__bar { display: none; }
  .pos__bar-count {
    width: 30px; height: 30px; flex: none;
    display: grid; place-items: center;
    background: var(--petal); color: var(--seed);
    border-radius: var(--r-full); font-weight: 700; font-size: .8125rem;
  }
  .pos__bar-total { margin-left: auto; font-family: var(--font-mono); font-weight: 700; font-size: 1rem; }

  .content:has(.pos) { padding-bottom: calc(72px + var(--sp-4)); }
}

@media (max-width: 560px) {
  .pos__grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Struk pratinjau di layar */
.receipt-preview {
  background: var(--milk);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  display: flex; justify-content: center;
}
.receipt-preview .receipt {
  box-shadow: var(--shadow-md);
  border-radius: 2px;
}

/* =====================================================================
   17. Perbaikan untuk ponsel
   Diuji pada lebar 360–430px, ukuran ponsel Android dan iPhone umum.
   ===================================================================== */

@media (max-width: 900px) {

  /* iOS Safari memperbesar halaman sendiri kalau kolom isian di bawah 16px.
     Jadi di ponsel semua kolom isian dipaksa tepat 16px. */
  .input, .select, .textarea,
  .cselect__button, .cselect__search,
  .qty input, input[type="date"], input[type="number"], input[type="search"] {
    font-size: 16px;
  }

  /* Sasaran sentuh: tidak ada tombol di bawah 44px */
  .btn { min-height: 46px; }
  .btn--sm { min-height: 40px; padding: .375rem .75rem; }
  .icon-btn { width: 44px; height: 44px; }

  .qty button { width: 40px; height: 40px; font-size: 19px; }
  .qty input  { width: 52px; height: 40px; }

  .cselect__option { padding: .625rem var(--sp-3); }
  .pos__chip { padding: .5rem 1rem; }

  /* Baris jenjang harga: 4 kolom terlalu sesak, dipecah jadi dua baris */
  .tier-row {
    grid-template-columns: 1fr 1fr !important;
    gap: .625rem !important;
    padding: var(--sp-3);
    background: var(--milk);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
  }
  .tier-row > .field:first-child { grid-column: 1 / -1; }
  .tier-row > button { grid-column: 1 / -1; width: 100%; }

  /* Jarak antar kolom di baris isian dirapatkan */
  .field-row { gap: var(--sp-3); }

  /* Judul halaman tidak perlu sebesar di layar lebar */
  .stat__value { font-size: 1.625rem; }
  .sum-row--total span:last-child { font-size: 1.5rem; }

  /* Tabel yang menumpuk: beri jarak antar kartu supaya terbaca */
  .table--stack tbody tr { padding: var(--sp-4); }
  .table--stack tbody td { padding: 4px 0; }
}

@media (max-width: 430px) {
  .content { padding: var(--sp-3) var(--sp-3) calc(76px + var(--sp-3)); }
  .card__body { padding: var(--sp-3); }
  .page-head { margin-bottom: var(--sp-4); }
  .page-head__title { font-size: 1.25rem; }

  /* Saringan pencarian jadi satu kolom penuh */
  .card__body > .field { min-width: 100% !important; }
  .card__body > .btn { width: 100%; }

  .pay-methods { grid-template-columns: repeat(2, 1fr); }
  .pay-methods label { padding: .625rem .25rem; }

  .grid--stats { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
  .stat { padding: var(--sp-3); }
  .stat__value { font-size: 1.25rem; }
  .stat__label { font-size: .75rem; }
}

/* Perangkat sentuh: hilangkan efek melayang yang menempel setelah disentuh */
@media (hover: none) {
  .pos-card:hover { transform: none; box-shadow: var(--shadow-sm); }
  .table tbody tr:hover { background: transparent; }
}

/* =====================================================================
   18. Mode terpasang (ditambahkan ke layar utama ponsel)
   ===================================================================== */
@media (display-mode: standalone) {
  /* Tanpa bilah alamat, konten perlu jarak dari poni layar */
  .topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .sidebar { padding-top: env(safe-area-inset-top); }
}