* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --border: #ecdfd0;
  --text: #2c1810;
  --muted: #7a6a5d;
  --accent: #b8341d;
  --accent-dark: #8f2614;
  --accent-soft: #fdecdc;
  --success: #2f8f4a;
  --shadow: 0 2px 8px rgba(60, 30, 10, 0.06);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  gap: 12px;
}

.title-block h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  opacity: 0.85;
}

.progress-block {
  text-align: right;
  min-width: 100px;
}

.progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.progress-bar {
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  transition: width 0.25s ease;
}

/* Category nav */
.category-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-nav::-webkit-scrollbar { display: none; }

.cat-chip {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.cat-chip:active,
.cat-chip:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* Content */
.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 12px 40px;
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

.category-section {
  margin-bottom: 18px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: 120px;
}

.category-header {
  padding: 12px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.item-row:last-child { border-bottom: none; }

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

.item-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  word-wrap: break-word;
}

.item-variant {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  vertical-align: 1px;
}

.price-wrap {
  position: relative;
  flex: 0 0 auto;
}

.price-symbol {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
  font-weight: 500;
}

.price-input {
  width: 110px;
  height: 42px;
  padding: 0 12px 0 24px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.price-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 52, 29, 0.15);
}

.price-input.has-value {
  background: #fff;
  border-color: #d8c5b0;
}

.price-input.saving {
  border-color: #d8b53a;
}
.price-input.saved {
  border-color: var(--success);
}
.price-input.error {
  border-color: #d33;
  background: #fff5f5;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 100px);
  background: #2c1810;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 20;
}
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
.toast.error {
  background: #b3261e;
}

/* Tablet & up */
@media (min-width: 600px) {
  .header-inner { padding: 18px 24px 12px; }
  .title-block h1 { font-size: 1.45rem; }
  .content { padding: 16px 16px 60px; }
  .price-input { width: 130px; }
}
