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

:root {
  --green: #2c7a2c;
  --green-dark: #1e5c1e;
  --green-light: #e8f5e9;
  --red: #d32f2f;
  --red-dark: #b71c1c;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  --radius: 10px;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: #f0f2f0;
  color: #1a1a1a;
  height: 100dvh;
  overflow: hidden;
}

/* ── Views ──────────────────────────────────────────────────────────────────── */

#app {
  height: 100dvh;
}

.view {
  display: none;
  flex-direction: column;
  height: 100dvh;
}

.view.active {
  display: flex;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

header {
  background: var(--green);
  color: #fff;
  padding: 1rem 1.25rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.subtitle {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 0.15rem;
}

#stall-view header {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 1.25rem 1.25rem 1rem;
}

#stall-view header h1 {
  font-size: 1.5rem;
}

#back-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0;
  opacity: 0.9;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

#back-btn:active {
  opacity: 0.6;
}

/* ── Scrollable main ─────────────────────────────────────────────────────────── */

main {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

/* ── Stall list ──────────────────────────────────────────────────────────────── */

.stall-item {
  display: block;
  width: 100%;
  padding: 1.125rem 1.25rem;
  margin-bottom: 0.5rem;
  background: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

.stall-item:active {
  background: var(--green-light);
}

/* ── Product list ────────────────────────────────────────────────────────────── */

.product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  gap: 0.5rem;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  display: block;
  color: #555;
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

.product-controls {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.product-controls button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--green);
  background: #fff;
  color: var(--green);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, color 0.1s;
}

.product-controls button:active {
  background: var(--green);
  color: #fff;
}

.product-controls .qty {
  min-width: 2rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a1a;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */

footer {
  background: #fff;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #dde5dd;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

#total {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.01em;
}

#reset-btn {
  padding: 0.7rem 1.4rem;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

#reset-btn:active {
  background: var(--red-dark);
}
