/* Food kiosk demo. Warm street-food palette, system fonts, big tap targets. */
:root {
  --bg: #fff7ea;
  --paper: #ffffff;
  --ink: #2a1d14;
  --muted: #6b5a4c;
  --line: #ecdcc6;
  --chili: #c8341f;
  --chili-dark: #9e2614;
  --turmeric: #f4b324;
  --pandan: #23744a;
  --pandan-soft: #e3f3e9;
  --loss: #b3261e;
  --loss-soft: #fdecea;
  --sky: #fff1cc;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
.app { max-width: 480px; margin: 0 auto; padding: 0 16px 32px; min-height: 100vh; }
main { padding-top: 4px; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 16px 0 8px; text-align: center; }
h2 { font-size: 1.4rem; margin: 12px 0; }
h3 { font-size: 1.05rem; margin: 20px 0 8px; }
p { margin: 8px 0; }
.lead { font-size: 1.05rem; }
.note, .small { color: var(--muted); font-size: .875rem; }
.screen-title .lead, .screen-title .note, .screen-title h2 { text-align: center; }
.brand-name { margin-bottom: 0; }
.brand-tagline { text-align: center; color: var(--muted); font-weight: 600; margin-top: 2px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; min-height: 64px; }

/* Buttons: every tap target at least 44px */
.btn {
  font: inherit; min-height: 44px; min-width: 44px; padding: 10px 16px; border-radius: 12px;
  border: 2px solid transparent; cursor: pointer; touch-action: manipulation;
}
.btn:disabled { cursor: not-allowed; opacity: .45; }
.btn:focus-visible, .card:focus-visible, .day:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--turmeric); outline-offset: 2px;
}
.btn-primary { background: var(--chili); color: #fff; font-weight: 700; }
.btn-primary:not(:disabled):active { background: var(--chili-dark); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--ink); font-weight: 600; }
.btn-big { display: block; width: 100%; min-height: 52px; font-size: 1.1rem; margin: 16px 0 8px; }
.btn-lang { background: var(--paper); border-color: var(--line); color: var(--ink); font-size: .9rem; padding: 8px 12px; }

/* CSS-drawn kiosk */
.kiosk { width: 240px; margin: 16px auto 0; }
.kiosk-board {
  background: var(--turmeric); color: var(--ink); font-weight: 800; text-align: center; letter-spacing: .04em;
  text-transform: uppercase; padding: 10px 12px; border-radius: 10px 10px 0 0; border: 3px solid var(--ink);
  border-bottom: 0; overflow-wrap: anywhere; font-size: 1.15rem;
}
.kiosk-canopy {
  height: 34px; border: 3px solid var(--ink); border-bottom: 0;
  background: repeating-linear-gradient(90deg, var(--chili) 0 30px, #fff 30px 60px);
  position: relative;
}
.kiosk-canopy::after { /* scalloped edge */
  content: ""; position: absolute; left: -3px; right: -3px; bottom: -14px; height: 15px;
  background: radial-gradient(circle at 15px 0, var(--chili) 13px, transparent 14px) 0 0 / 30px 15px repeat-x;
}
.kiosk-body {
  height: 92px; margin: 0 10px; background: #8a5a3b; border: 3px solid var(--ink); border-top: 0;
  border-radius: 0 0 8px 8px; display: flex; align-items: flex-end; justify-content: center; gap: 14px;
  padding: 0 0 10px; background-image: linear-gradient(var(--sky) 0 42%, #8a5a3b 42%);
}
.jar { width: 30px; height: 44px; border: 3px solid var(--ink); border-radius: 8px 8px 10px 10px; background: #fff; position: relative; }
.jar::before { content: ""; position: absolute; left: 2px; right: 2px; bottom: 2px; top: 12px; border-radius: 4px 4px 6px 6px; }
.jar-a::before { background: #e8503a; }
.jar-b::before { background: var(--turmeric); }
.jar-c::before { background: #5fb36b; }
.kiosk-small { width: auto; max-width: 70%; margin: 0; }
.kiosk-small .kiosk-board { font-size: .8rem; padding: 4px 10px; border-width: 2px; border-radius: 8px 8px 0 0; }
.kiosk-small .kiosk-canopy { height: 12px; border-width: 2px; background-size: auto; }
.kiosk-small .kiosk-canopy::after { display: none; }
.brand-foot { text-align: center; color: var(--muted); font-size: .875rem; padding: 16px 0 0; overflow-wrap: anywhere; }

/* How */
.steps { list-style: none; padding: 0; margin: 16px 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.step-n { flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--turmeric); font-weight: 800; display: grid; place-items: center; }

/* Setup cards */
.cards { display: grid; gap: 10px; }
.card {
  font: inherit; text-align: left; color: var(--ink); background: var(--paper); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; width: 100%;
}
.card-on { border-color: var(--chili); box-shadow: inset 6px 0 0 var(--chili); background: #fff3ef; }
.card-title { font-weight: 700; font-size: 1.05rem; }
.card-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--sky); border-radius: 999px; padding: 2px 10px; font-size: .85rem; white-space: nowrap; font-weight: 600; }
.card-desc { color: var(--muted); font-size: .9rem; }
.papers { display: grid; gap: 8px; }
.paper {
  display: flex; gap: 12px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; cursor: pointer; min-height: 44px;
}
.paper input { width: 24px; height: 24px; margin: 2px 0 0; flex: 0 0 24px; accent-color: var(--pandan); }
.paper-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.paper-head { display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.warn { background: var(--loss-soft); color: var(--loss); border-left: 4px solid var(--loss); padding: 10px 12px; border-radius: 8px; font-weight: 600; }

.slider-wrap { padding: 4px 0; }
.slider { width: 100%; height: 44px; accent-color: var(--chili); margin: 0; }
.slider-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; }
.summary { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.summary h3 { margin-top: 8px; }
.savings-value { font-size: 1.8rem; font-weight: 800; text-align: center; }

/* Rows */
.row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.row span { min-width: 0; }
.row strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-muted { color: var(--muted, #666); font-size: 0.9em; }
.row-total { font-size: 1.05rem; border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 8px; }
.row-hero { font-size: 1.15rem; font-weight: 600; border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.row-good strong { color: var(--pandan); }
.row-bad strong { color: var(--loss); }

/* Week */
.week-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.week-no { font-size: 1.3rem; }
.cash strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.cash-bad strong { color: var(--loss); }
.banner { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; display: flex; flex-direction: column; }
.banner-forecast { background: #e6f0ff; border: 2px solid #2b5cab; color: #183a73; }
.banner-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.panel h3 { margin-top: 0; }
.decisions-locked { opacity: .7; }
.control { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.control-col { flex-direction: column; align-items: stretch; }
.control-label { font-weight: 600; display: flex; flex-direction: column; }
.control-label small { font-weight: 400; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 6px; }
.btn-step { background: var(--sky); color: var(--ink); font-size: 1.4rem; font-weight: 800; padding: 0; width: 44px; line-height: 1; }
.step-value { min-width: 84px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
/* 4+3 rows on small phones so each day stays >= 44x44; one row of 7 when there is room. */
.days { display: grid; grid-template-columns: repeat(4, minmax(44px, 1fr)); gap: 6px; }
@media (min-width: 400px) { .days { grid-template-columns: repeat(7, minmax(44px, 1fr)); gap: 4px; } }
.day {
  font: inherit; font-size: .85rem; min-height: 44px; padding: 0; border-radius: 10px; border: 2px solid var(--line);
  background: var(--paper); color: var(--ink); cursor: pointer;
}
.day-on { background: var(--pandan); border-color: var(--pandan); color: #fff; font-weight: 700; }
.day:disabled { opacity: .35; cursor: not-allowed; text-decoration: line-through; }
.day-on:disabled { text-decoration: none; opacity: .8; }
.btn-toggle { background: var(--paper); border-color: var(--line); color: var(--ink); min-width: 72px; font-weight: 700; }
.btn-toggle-on { background: var(--pandan); border-color: var(--pandan); color: #fff; }
.result-panel { border: 2px solid var(--ink); }
.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.stat { background: var(--bg); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.stat span { font-size: .85rem; color: var(--muted); }
.stat strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.cost-details { margin: 8px 0; }
.cost-details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; list-style: none; }
.cost-details summary::-webkit-details-marker { display: none; }
.cost-details summary::before { content: "▸"; }
.cost-details[open] summary::before { content: "▾"; }
.event { background: var(--sky); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.event p { margin: 4px 0 0; }
.event .banner-label { display: block; color: var(--muted); }
.tip-label { font-weight: 700; }

/* Result */
.lessons { margin: 0; padding-left: 20px; }
.lessons li { margin-bottom: 8px; }
.cta-box { background: var(--turmeric); border-radius: var(--radius); padding: 14px; margin-top: 16px; }
.cta-q { font-weight: 800; font-size: 1.15rem; margin: 0; }
.cta-box .btn-big { margin-bottom: 0; }
.screen-result .note { text-align: center; }
.feedback { margin-top: 16px; }
.feedback-q, .feedback-thanks { font-weight: 600; margin-top: 0; }
.feedback-thanks { margin-bottom: 0; }
.feedback-votes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feedback-votes .btn, .feedback > .btn { margin: 0; min-height: 48px; }
.feedback > .btn { margin-top: 10px; width: 100%; }
.feedback textarea {
  font: inherit; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); width: 100%; resize: vertical;
}
.feedback textarea:focus-visible { outline: 3px solid var(--turmeric); outline-offset: 2px; }

/* Sign-up */
.form { display: grid; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-weight: 600; }
.field small { color: var(--muted); }
.field input, .field select {
  font: inherit; min-height: 48px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); width: 100%;
}
.field-error { color: var(--loss); font-weight: 600; font-size: .9rem; }
.pdpa ul { margin: 0 0 8px; padding-left: 18px; }
.pdpa-lang + .pdpa-lang { border-top: 1px dashed var(--line); padding-top: 8px; }
.pdpa { font-size: .9rem; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.consent span { font-weight: 600; }
.result-panel:focus { outline: none; }
