/*
 * MoonSips — CSS tanpa build step.
 * Token warna, ukuran, dan radius diambil dari docs/design_reference.html
 * (konfigurasi Tailwind di sana diterjemahkan ke CSS variable). Lihat ADR-004.
 */

:root {
  --swiss-coffee: #f9f1e0;   /* latar halaman */
  --chocolate: #523c30;      /* teks & tombol utama */
  --grove: #99a285;          /* lunas, chip aktif */
  --deep-grove: #56614a;     /* teks hijau */
  --lemon: #fff0bf;          /* sorotan, omzet, belum bayar */
  --veil: #d2d8d6;           /* garis, nonaktif */
  --muted: #7a6a5e;          /* teks sekunder */
  --terracotta: #9c4a32;     /* error, hapus */
  --white: #ffffff;

  --r-sm: 8px;
  --r: 10px;
  --r-md: 12px;
  --r-xl: 16px;

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--swiss-coffee);
  color: var(--chocolate);
  font: 400 15px/22px var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
p, h1, h2, h3 { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }

/* ---------- Tipografi ---------- */
.h-display { font: italic 600 28px/34px var(--font-display); letter-spacing: -0.25px; font-variant-numeric: lining-nums; }
.h-page    { font: italic 600 24px/28px var(--font-display); letter-spacing: -0.25px; font-variant-numeric: lining-nums; }
.h-section { font: 600 18px/24px var(--font-body); }
.brand     { font: italic 600 18px/24px var(--font-display); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.brand svg { width: 20px; height: 20px; }
.label-lg  { font-size: 15px; line-height: 22px; font-weight: 600; }
.label-md  { font-size: 14px; line-height: 20px; font-weight: 700; }
.label-sm  { font-size: 13px; line-height: 18px; font-weight: 500; }
.muted     { color: var(--muted); }
.grove     { color: var(--deep-grove); }
.num       { font-variant-numeric: lining-nums tabular-nums; }
.big-num   { font: italic 600 28px/34px var(--font-display); font-variant-numeric: lining-nums tabular-nums; }
.sr-only   { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 160px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-center { min-height: 100vh; justify-content: center; padding-bottom: 32px; }
.page-public { padding-bottom: 24px; gap: 24px; min-height: 100vh; }
.stack    { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.row      { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-base { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wrap     { flex-wrap: wrap; }
.grow     { flex: 1; min-width: 0; }
.center   { text-align: center; align-items: center; }
.header   { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.header-back { display: flex; align-items: center; gap: 8px; }

/* ---------- Kartu ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--veil);
  border-radius: var(--r-md);
  padding: 16px;
}
.card-lemon { background: var(--lemon); }
.card-list { padding: 0; }
.card-list > * + * { border-top: 1px solid var(--veil); }
.card-list > .item { padding: 14px 16px; }
.divider { border-top: 1px solid var(--veil); padding-top: 8px; }

/* ---------- Tombol ---------- */
.btn {
  min-height: 44px;
  padding: 8px 24px;
  border-radius: var(--r);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px; line-height: 22px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 120ms ease-out, background-color 120ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-primary   { background: var(--chocolate); color: var(--swiss-coffee); }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: var(--white); border-color: var(--veil); color: var(--chocolate); }
.btn-secondary:hover { background: var(--lemon); }
.btn-danger    { background: transparent; color: var(--terracotta); padding-inline: 12px; }
.btn-ghost     { background: transparent; color: var(--chocolate); padding-inline: 12px; }
.btn-block     { width: 100%; }
.btn-sm        { min-height: 36px; padding: 4px 14px; font-size: 14px; }
.btn-icon {
  width: 44px; height: 44px; padding: 0; flex-shrink: 0;
  background: var(--swiss-coffee); border-color: var(--veil); color: var(--chocolate);
}
.btn-icon:hover { background: var(--lemon); }
.btn-icon.dark  { background: var(--chocolate); border-color: var(--chocolate); color: var(--swiss-coffee); }
.btn-icon.plain { background: transparent; border-color: transparent; }
.btn[disabled]  { background: var(--veil); color: var(--chocolate); opacity: .75; cursor: not-allowed; }
.inline-form { display: inline; margin: 0; }

/* ---------- Pill / badge / chip ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 9999px; border: 1px solid transparent;
  font-size: 14px; line-height: 20px; font-weight: 700;
  white-space: nowrap; text-decoration: none; cursor: default;
}
.pill svg { width: 14px; height: 14px; }
button.pill { cursor: pointer; }
button.pill:hover { opacity: .9; }
.pill-unpaid { background: var(--lemon); color: var(--chocolate); }
.pill-paid   { background: var(--grove); color: var(--chocolate); }
.pill-open   { border-color: var(--grove); color: var(--deep-grove); padding: 4px 12px; }
.pill-closed { background: var(--veil); color: var(--muted); padding: 4px 12px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.chip {
  min-height: 44px; padding: 4px 16px; border-radius: 9999px; flex-shrink: 0;
  display: inline-flex; align-items: center;
  background: var(--white); border: 1px solid var(--veil);
  font-size: 14px; line-height: 20px; font-weight: 700; text-decoration: none;
}
.chip:hover { background: var(--lemon); }
.chip[aria-current="true"] { background: var(--grove); border-color: var(--grove); }
.tag-btn {
  min-height: 36px; padding: 4px 12px; border-radius: 9999px; cursor: pointer;
  background: var(--lemon); border: 1px solid var(--veil); font-size: 13px; font-weight: 500;
}
.tag-btn:hover { background: var(--grove); }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span, .field > label { font-size: 14px; line-height: 20px; font-weight: 700; }
.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border-radius: var(--r); border: 1px solid var(--veil); background: var(--white);
  color: var(--chocolate); font-size: 15px; line-height: 22px;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border: 2px solid var(--chocolate); padding: 9px 13px; }
.input[readonly], .input:disabled { background: var(--swiss-coffee); }
textarea.input { resize: vertical; min-height: 110px; }
.alert {
  border-radius: var(--r); padding: 10px 16px; font-size: 14px; line-height: 20px;
  border: 1px solid var(--veil);
}
.alert-error { border: 2px solid var(--terracotta); color: var(--terracotta); background: var(--white); }
.alert-ok    { background: var(--grove); }
.alert-info  { background: var(--lemon); }

/* ---------- Stepper qty ---------- */
.stepper { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.stepper input {
  width: 44px; min-height: 44px; text-align: center; border: none; background: transparent;
  font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: 2px solid var(--chocolate); border-radius: var(--r-sm); }
.stepper .btn-icon svg { width: 16px; height: 16px; }

/* ---------- Switch (menu aktif) ---------- */
.switch {
  width: 48px; height: 28px; padding: 2px; flex-shrink: 0; cursor: pointer;
  border: none; border-radius: 9999px; background: var(--veil);
  display: inline-flex; align-items: center; justify-content: flex-start;
  transition: background-color 120ms ease-out;
}
.switch span { width: 24px; height: 24px; border-radius: 9999px; background: var(--white); display: block; }
.switch[aria-checked="true"] { background: var(--grove); justify-content: flex-end; }
.switch[aria-checked="true"] span { border: 1px solid var(--veil); }

/* ---------- Kartu order ---------- */
.order-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.order-card .name { text-decoration: none; }
.order-card .name:hover { text-decoration: underline; }

/* ---------- Bar bawah & navigasi ---------- */
.bottom {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  background: var(--swiss-coffee); border-top: 1px solid var(--veil);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-action { padding: 8px 16px; }
.bottom-total {
  background: var(--white); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.bottom-total .btn { padding-inline: 32px; }
.bottom-nav {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--white); border-top: 1px solid var(--veil);
}
.bottom-nav a {
  min-height: 52px; padding: 6px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-top: 2px solid transparent; color: var(--muted); text-decoration: none;
  font-size: 13px; line-height: 18px; font-weight: 500;
}
.bottom-nav a svg { width: 20px; height: 20px; }
.bottom-nav a[aria-current="page"] { border-top-color: var(--grove); color: var(--chocolate); font-weight: 700; }
.top-nav { display: none; }

/* ---------- Toast ---------- */
.toast-slot {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 140px; z-index: 30;
  width: calc(100% - 32px); max-width: 448px;
}
.toast {
  background: var(--chocolate); color: var(--swiss-coffee); border-radius: var(--r);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 14px; line-height: 20px; font-weight: 700;
}
.toast button {
  background: none; border: none; padding: 4px; cursor: pointer;
  color: var(--lemon); text-decoration: underline; text-underline-offset: 4px; font-weight: 700;
}

/* ---------- Dialog (bottom sheet tambah menu) ---------- */
dialog.sheet {
  margin: auto auto 0; width: 100%; max-width: 480px; border: none; padding: 16px;
  border-radius: var(--r-xl) var(--r-xl) 0 0; border-top: 1px solid var(--veil);
  background: var(--swiss-coffee); color: var(--chocolate);
}
dialog.sheet::backdrop { background: rgba(82, 60, 48, .4); }
details.edit summary { list-style: none; cursor: pointer; }
details.edit summary::-webkit-details-marker { display: none; }
details.edit[open] { background: var(--swiss-coffee); }

/* ---------- Halaman bayar ---------- */
.qris-img {
  width: 224px; height: 224px; object-fit: contain;
  border: 1px solid var(--veil); border-radius: var(--r); padding: 8px; background: var(--white);
}
.wa-bubble {
  background: var(--lemon); border: 1px solid var(--veil); border-radius: var(--r-md);
  padding: 12px; white-space: pre-wrap; word-break: break-word;
}
.empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty svg { width: 32px; height: 32px; }

/* ---------- Desktop (≥ 1024px): navigasi atas + 2 kolom ---------- */
@media (min-width: 1024px) {
  .top-nav {
    display: block; background: var(--white); border-bottom: 1px solid var(--veil);
  }
  .top-nav-inner {
    max-width: 1080px; margin: 0 auto; padding: 0 24px; height: 64px;
    display: flex; align-items: center; gap: 32px;
  }
  .top-nav-inner .brand { font-size: 24px; line-height: 28px; }
  .top-nav-inner nav { display: flex; gap: 24px; }
  .top-nav-inner nav a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; }
  .top-nav-inner nav a[aria-current="page"] { color: var(--chocolate); font-weight: 600; border-bottom-color: var(--grove); }
  .top-nav-inner .logout { margin-left: auto; }
  .bottom-nav { display: none; }
  .mobile-brand { display: none; }

  .page { max-width: 720px; padding-top: 32px; padding-bottom: 120px; }
  .page.wide { max-width: 1080px; padding-inline: 24px; }
  .two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; align-items: start; }
  .two-col aside { position: sticky; top: 24px; }
  .bottom, .toast-slot { max-width: 720px; }
  .page.wide ~ .bottom { max-width: 1080px; background: transparent; border: none; }
  .page.wide ~ .bottom .bottom-action { display: flex; justify-content: flex-end; }
  .page.wide ~ .bottom .bottom-action .btn { width: auto; }
}
@media (max-width: 1023px) {
  .desktop-only { display: none !important; }
}

@media (min-width: 1024px) { .desktop-hide { display: none; } }

/* ---------- Kelola Menu: opsi ukuran (revisi docs/stock_revisi.html) ---------- */
.size-chip {
  padding: 4px 10px; border-radius: 9999px;
  background: var(--swiss-coffee); border: 1px solid var(--veil);
  font-size: 13px; line-height: 18px; font-weight: 500;
}
.link-btn {
  background: none; border: none; padding: 4px 0; cursor: pointer;
  color: var(--deep-grove); font-size: 13px; line-height: 18px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 4px;
}
.link-btn:hover { opacity: .8; }
.link-btn.muted { color: var(--muted); }
.size-row { display: grid; grid-template-columns: 5fr 5fr 2fr; gap: 4px; align-items: center; }
.size-row .btn-icon { width: 100%; }
.btn-icon.danger { color: var(--terracotta); }
.btn-icon.danger:hover { background: var(--white); }
dialog.sheet { max-height: 90vh; overflow-y: auto; }

/* ---------- Footer halaman bayar ---------- */
.site-footer {
  margin-top: auto; padding-top: 8px; text-align: center;
  color: var(--muted); font-size: 13px; line-height: 18px; font-weight: 500;
}
