:root {
  color-scheme: light;
  --bg: #f4f2ec;
  --surface: #fffdf8;
  --surface-2: #ebe8df;
  --ink: #20231f;
  --muted: #73766e;
  --line: #d9d6cc;
  --green: #28684a;
  --green-2: #dceadf;
  --orange: #e7792e;
  --danger: #ae3f35;
  --shadow: 0 12px 30px rgba(46, 50, 43, .09);
  --radius: 22px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell { max-width: 760px; min-height: 100vh; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(244, 242, 236, .92); backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(217, 214, 204, .7);
}
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px;
  background: var(--green); color: #fff; font-weight: 900; letter-spacing: -.04em;
}
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.brand-title { font-size: 19px; font-weight: 850; line-height: 1.1; }
.user-badge { margin-left: auto; max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.content { padding: 18px 16px calc(104px + env(safe-area-inset-bottom)); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(27px, 8vw, 38px); line-height: 1.04; letter-spacing: -.045em; }
h2 { margin-bottom: 12px; font-size: 20px; letter-spacing: -.025em; }
p { color: var(--muted); line-height: 1.45; }
.kicker { margin-bottom: 8px; color: var(--orange); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.hero { padding: 10px 2px 18px; }
.hero p { max-width: 520px; margin-bottom: 0; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.card-button, .zone-card {
  min-height: 118px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--shadow); cursor: pointer;
}
.card-button:active, .zone-card:active { transform: scale(.985); }
.card-button.wide { grid-column: 1 / -1; min-height: 104px; }
.card-icon { display: block; margin-bottom: 16px; font-size: 30px; }
.card-title { display: block; font-size: 17px; font-weight: 850; line-height: 1.15; }
.card-meta { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.back-button, .icon-button {
  display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.toolbar-title { min-width: 0; }
.toolbar-title h1 { margin: 0; font-size: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar-title p { margin: 3px 0 0; font-size: 12px; }

.zone-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.zone-card { min-height: 96px; box-shadow: none; }
.zone-card.active { border-color: var(--green); background: var(--green-2); }
.zone-card.complete { border-color: #8bb49a; }
.zone-name { display: block; font-size: 14px; font-weight: 820; line-height: 1.2; }
.zone-meta { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; }

.panel { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head p { margin: 4px 0 0; font-size: 12px; }
.list { display: grid; gap: 8px; }
.product-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 62px; padding: 10px 10px 10px 13px; border: 1px solid var(--line); border-radius: 16px; background: #fff;
}
.product-name { font-size: 14px; font-weight: 760; line-height: 1.25; }
.product-unit { margin-top: 4px; color: var(--muted); font-size: 12px; }
.remove-button { width: 38px; height: 38px; border: 0; border-radius: 12px; background: #f6e3df; color: var(--danger); font-size: 20px; cursor: pointer; }
.quantity-wrap { display: flex; align-items: center; gap: 6px; }
.quantity-input {
  width: 92px; height: 44px; border: 1.5px solid var(--line); border-radius: 13px;
  background: #fff; color: var(--ink); text-align: center; font-size: 17px; font-weight: 800; outline: none;
}
.quantity-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40, 104, 74, .12); }
.quantity-input.saved { border-color: #82ad91; background: #f3faf5; }
.zero-button { height: 38px; padding: 0 10px; border: 0; border-radius: 11px; background: var(--surface-2); color: var(--muted); font-weight: 800; cursor: pointer; }

.search-row { display: flex; gap: 8px; margin: 12px 0; }
.search-input { flex: 1; min-width: 0; height: 48px; padding: 0 15px; border: 1.5px solid var(--line); border-radius: 15px; background: #fff; outline: none; }
.search-input:focus { border-color: var(--green); }
.add-button { border: 0; border-radius: 14px; background: var(--green-2); color: var(--green); font-weight: 850; padding: 0 14px; cursor: pointer; }

.progress-card { margin-bottom: 16px; padding: 16px; border-radius: var(--radius); background: var(--green); color: #fff; }
.progress-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.progress-top strong { font-size: 21px; }
.progress-top span { color: rgba(255,255,255,.78); font-size: 12px; }
.progress-track { height: 8px; margin-top: 12px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; background: #fff; transition: width .2s ease; }

.bottom-bar {
  position: fixed; left: 50%; bottom: 0; z-index: 30; width: min(760px, 100%); transform: translateX(-50%);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(244, 242, 236, .94);
  border-top: 1px solid rgba(217, 214, 204, .75); backdrop-filter: blur(18px);
}
.primary-button, .secondary-button, .danger-button {
  width: 100%; min-height: 52px; border: 0; border-radius: 16px; font-weight: 900; cursor: pointer;
}
.primary-button { background: var(--green); color: #fff; }
.primary-button:disabled { background: #b9bdb7; cursor: default; }
.secondary-button { margin-top: 8px; background: var(--surface-2); color: var(--ink); }
.danger-button { margin-top: 8px; background: #f6e3df; color: var(--danger); }

.empty { padding: 28px 10px; text-align: center; color: var(--muted); }
.status-card, .loading-card, .error-card { margin-top: 10vh; padding: 28px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.status-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 24px; background: var(--green-2); color: var(--green); font-size: 34px; }
.error-card .status-icon { background: #f6e3df; color: var(--danger); }
.spinner { width: 34px; height: 34px; margin: 0 auto 20px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(440px, calc(100% - 32px)); padding: 13px 16px; border-radius: 14px; background: #20231f; color: #fff; box-shadow: var(--shadow); font-size: 13px; text-align: center; }
.notice { margin-bottom: 14px; padding: 12px 14px; border-radius: 14px; background: #fff0dc; color: #7d4b1f; font-size: 12px; line-height: 1.4; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .card-button.wide { grid-column: auto; } .zone-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
