:root {
  /* Palette: #FFEEB3 cream · #B4D7CD mint · #8EA8C3 blue-grey · #F47321 orange */
  --cream: #FFEEB3;
  --mint: #B4D7CD;
  --steel: #8EA8C3;
  --orange: #F47321;

  --bg: #FFF9E8;            /* light cream page */
  --card: #ffffff;
  --ink: #2C3340;
  --muted: #6E7A88;
  --line: #EDE3C4;
  --brand: var(--orange);   /* fills: header, primary buttons */
  --brand-ink: #C4520F;     /* orange for text on light backgrounds */
  --brand-soft: #FFE4D1;
  --green: #2F7462;         /* paid / OK — dark mint */
  --green-soft: #DCEEE8;
  --red: #C0352B;
  --red-soft: #FCE3DF;
  --blue: #3F5E80;          /* transfer — dark blue-grey */
  --blue-soft: #DCE5EF;
  --purple: #8A6300;        /* coupon — dark cream (name kept for code) */
  --purple-soft: var(--cream);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Prompt", system-ui, sans-serif; font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; }
h1, h2, h3 { margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

/* Login */
#login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-box h1 { color: var(--brand-ink); font-size: 1.6rem; line-height: 1.3; }
.login-box form { display: grid; gap: .6rem; margin-top: 1rem; }

/* Layout */
header { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: .6rem 1rem; background: var(--brand); color: #fff; font-weight: 700; }
main { max-width: 720px; margin: 0 auto; padding: 1rem 1rem calc(90px + env(safe-area-inset-bottom)); }
nav { box-shadow: 0 -2px 10px rgba(142,168,195,.18); position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav button { border: 0; background: none; padding: .5rem 0 .6rem; font: inherit; font-size: 1.3rem; color: var(--muted); display: grid; gap: 2px; }
nav button span { font-size: .8rem; }
nav button.active { color: var(--brand-ink); font-weight: 700; }

/* Inputs & buttons */
input, select, textarea { width: 100%; font: inherit; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
label { display: block; font-size: .9rem; color: var(--muted); margin: .6rem 0 .25rem; }
.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .55rem .9rem; border-radius: 10px; cursor: pointer; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.btn.danger { color: var(--red); border-color: #f5c2c2; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.5); color: inherit; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn.big { padding: .85rem; font-size: 1.1rem; width: 100%; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: .5rem; align-items: center; }
.row > * { flex: 1; }
.row > .btn { flex: 0 0 auto; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem; margin-bottom: .8rem; }
.product { display: flex; align-items: center; gap: .75rem; }
.product .info { flex: 1; }
.product .name { font-weight: 700; }
.product .left { font-size: .85rem; color: var(--muted); }
.product .left.low { color: var(--red); font-weight: 700; }
.stepper { display: flex; align-items: center; gap: .4rem; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--brand-soft); font-size: 1.4rem; color: var(--brand-ink); }
.stepper input { width: 56px; text-align: center; font-size: 1.2rem; font-weight: 700; padding: .4rem; }
.total-bar { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; margin: .5rem 0; }
.total-bar b { font-size: 1.6rem; color: var(--brand-ink); }

.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pay-box { border: 1px solid var(--line); border-radius: 12px; padding: .6rem; }
.pay-box.coupon { background: var(--purple-soft); border-color: #F0D98A; }
.pay-box.transfer { background: var(--blue-soft); border-color: var(--steel); }
.pay-box .title { font-weight: 700; margin-bottom: .3rem; }
.slip-btn { display: block; width: 100%; text-align: center; margin-top: .5rem; white-space: nowrap; }
.slip-preview { margin-top: .5rem; max-width: 100%; max-height: 160px; border-radius: 8px; display: block; }
.diff { text-align: center; margin: .5rem 0; font-weight: 600; }
.diff.ok { color: var(--green); }
.diff.bad { color: var(--red); }

/* Badges */
.badge { display: inline-block; font-size: .78rem; padding: .1rem .5rem; border-radius: 999px; font-weight: 700; margin-right: .25rem; }
.badge.paid { background: var(--green-soft); color: var(--green); }
.badge.unpaid { background: var(--red-soft); color: var(--red); }
.badge.partial { background: var(--brand-soft); color: var(--brand-ink); }
.badge.picked { background: var(--blue-soft); color: var(--blue); }
.badge.waiting { background: #EEF1F4; color: var(--muted); }
.badge.coupon { background: var(--purple-soft); color: var(--purple); }
.badge.transfer { background: var(--blue-soft); color: var(--blue); }

/* Pre-order list */
.chips { display: flex; gap: .4rem; overflow-x: auto; margin: .6rem 0; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .35rem .8rem; font: inherit; font-size: .9rem; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.order-head { display: flex; justify-content: space-between; gap: .5rem; }
.order-head .who { font-weight: 700; }
.order-items { margin: .3rem 0; font-size: .95rem; }
.pay-line { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; padding: .2rem 0; border-top: 1px dashed var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }

/* Summary */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.stat { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--steel); border-radius: 14px; padding: .8rem; }
.stat .k { font-size: .85rem; color: var(--muted); }
.stat .v { font-size: 1.5rem; font-weight: 700; }
.stat.coupon .v { color: var(--purple); }
.stat.transfer .v { color: var(--blue); }
.stat.total .v { color: var(--green); }
.stat.owe .v { color: var(--red); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .45rem .3rem; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td.big { font-weight: 700; color: var(--brand-ink); font-size: 1.05rem; }

/* Modal & toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.modal-card { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .modal { align-items: center; } .modal-card { border-radius: 18px; } }
.modal-card img.full { width: 100%; border-radius: 8px; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 10px; z-index: 30; max-width: 90vw; }
.toast.err { background: var(--red); }

.stat.coupon { border-top-color: #F0D98A; }
.stat.transfer { border-top-color: var(--steel); }
.stat.total { border-top-color: var(--mint); }
.stat.owe { border-top-color: var(--orange); }
.btn.primary, nav button span, header { font-weight: 600; }
