:root {
  --bg: #f5f1e9;
  --surface: #ffffff;
  --surface-sunken: #efe8da;
  --text: #2b241c;
  --text-muted: #8a7f6c;
  --accent: #b3441c;
  --accent-dark: #8f3717;
  --structure: #46535b;
  --structure-tint: #e6ebec;
  --border: #e3dbc9;
  --success: #3f7d4a;
  --danger: #a83232;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: 24px;
  min-height: 100vh;
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  padding-top: max(7px, env(safe-area-inset-top));
  background: var(--structure);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brandbar .brand {
  font-family: 'Archivo', -apple-system, sans-serif;
  font-weight: 800;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.brandbar .brand b { color: #f0c19f; font-weight: 800; }

.brandbar .phone {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  opacity: 0.95;
}

.brandbar .phone svg { width: 14px; height: 14px; }
.brandbar .phone:active { opacity: 0.7; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px;
  background: var(--structure);
  color: #fff;
}

.topbar h1 {
  flex: 1;
  font-family: 'Archivo', -apple-system, sans-serif;
  font-size: 17px;
  margin: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.3); }
.icon-btn[hidden] { display: none; }

.search-bar {
  position: relative;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.search-bar[hidden] { display: none; }

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 38px 10px 36px;
  -webkit-appearance: none;
  appearance: none;
}
#searchInput::-webkit-search-cancel-button { display: none; }
#searchInput:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.search-clear {
  position: absolute;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}
.search-clear:active { background: var(--surface-sunken); }
.search-clear[hidden] { display: none; }

.search-suggestions {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 100%;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-height: 65vh;
  overflow-y: auto;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  z-index: 20;
}
.search-suggestions[hidden] { display: none; }

.search-suggestion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.search-suggestion-row:last-child { border-bottom: none; }
.search-suggestion-row:active { background: var(--bg); }

.suggestion-photo, .suggestion-photo-placeholder {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
}
.suggestion-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.suggestion-info { flex: 1; min-width: 0; }
.suggestion-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggestion-path {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggestion-empty {
  padding: 14px 12px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.search-suggestion-more {
  padding: 11px 12px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-dark);
  cursor: pointer;
}
.search-suggestion-more:active { background: var(--bg); }

.search-result-path {
  font-size: 12px;
  color: var(--text-muted);
}

@keyframes flashHighlight {
  0% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 3px transparent; }
}
.item-card.flash-highlight {
  animation: flashHighlight 1.4s ease-out;
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

main {
  padding: 12px;
  max-width: 640px;
  margin: 0 auto;
}

.crumb {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 2px 12px;
}

.folder-list, .item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.folder-list + .item-list {
  margin-top: 16px;
}

.folder-card, .item-card, .cart-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.folder-card .icon {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  background: var(--structure-tint);
  color: var(--structure);
  display: flex;
  align-items: center;
  justify-content: center;
}
.folder-card .icon svg { width: 19px; height: 19px; }
.folder-card .folder-photo {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
  background: var(--structure-tint);
}
.folder-card .name { flex: 1; font-family: 'Archivo', -apple-system, sans-serif; font-weight: 600; font-size: 15px; }
.folder-card .chev { color: var(--text-muted); font-size: 18px; }
.folder-card:active { background: #fbfaf8; }

.item-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.item-card .item-photo {
  width: 84px;
  height: 84px;
  flex: none;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg);
}

.item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-card .name {
  font-family: 'Archivo', -apple-system, sans-serif;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
}

.desc-toggle {
  align-self: flex-start;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.desc-toggle:active { color: var(--accent-dark); }

.item-card .description {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  white-space: pre-line;
}
.item-card .description[hidden] {
  display: none;
}

.item-card .price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.item-card .price .unit {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
}

.add-btn {
  align-self: flex-start;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
}

.add-btn:active { background: var(--accent-dark); }

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  align-self: flex-start;
}

.stepper button {
  border: none;
  background: var(--surface-sunken);
  width: 40px;
  height: 40px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-dark);
  cursor: pointer;
}

.stepper button:active { background: #eee7de; }

.stepper .qty {
  min-width: 40px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.stepper .qty-input {
  width: 48px;
  height: 40px;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  -moz-appearance: textfield;
}

.stepper .qty-input::-webkit-outer-spin-button,
.stepper .qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper .qty-input:focus {
  outline: none;
  background: #fbf3ea;
}

.stepper .plus { background: var(--accent); color: #fff; }
.stepper .plus:active { background: var(--accent-dark); }

.nav-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.nav-row button {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
}

.nav-row button:active { background: #f0ede8; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 16px;
  font-size: 15px;
}

.cart-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-row .cart-photo {
  width: 44px;
  height: 44px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
}

.cart-row .info { flex: 1; }
.cart-row .name { font-family: 'Archivo', -apple-system, sans-serif; font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.cart-row .line-total { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-summary .total { font-family: 'Archivo', -apple-system, sans-serif; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

.primary-btn {
  display: block;
  width: 100%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 15px;
  border-radius: 12px;
  margin-top: 16px;
  cursor: pointer;
}

.primary-btn:active { background: var(--accent-dark); }
.primary-btn:disabled { opacity: 0.5; }

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-error {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
}

.success-box {
  text-align: center;
  padding: 40px 16px;
}

.success-box .check {
  font-size: 52px;
  margin-bottom: 12px;
}

.success-box h2 { font-family: 'Archivo', -apple-system, sans-serif; margin: 0 0 8px; font-size: 20px; }
.success-box p { color: var(--text-muted); margin: 0 0 20px; }

.info-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 7px 12px;
  background: var(--structure);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-strip .row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  white-space: nowrap;
}

.info-strip svg {
  width: 13px;
  height: 13px;
  flex: none;
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  max-width: 90vw;
  text-align: center;
}
