:root {
  --brand: #2E7D32;
  --accent: #EF6C00;
  --bg: #F3F8EE;
  --surface: #FFFFFF;
  --text: #1A1C19;
  --muted: #5B6358;
  --line: #DEE5D8;
  --warn-bg: #FFDCC2;
  --warn-text: #301400;
  --error-bg: #FFDAD6;
  --error-text: #410002;
  --hero: linear-gradient(135deg, #26C6DA 0%, #00897B 50%, #2E7D32 100%);
  --shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .08);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101510;
    --surface: #1B211A;
    --text: #E0E4DB;
    --muted: #A9B1A5;
    --line: #2F362E;
    --warn-bg: #6F3800;
    --warn-text: #FFDCC2;
    --error-bg: #93000A;
    --error-text: #FFDAD6;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 0;
  background: none;
}

.hero {
  background: var(--hero);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 8px) 8px 16px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hero img { width: 72px; height: 81px; }
.hero h1 { margin: 0; font-size: 28px; font-weight: 800; }
.hero p { margin: 0; opacity: .92; }
.hero .grow { flex: 1; }

.bar {
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 4px) 4px 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 56px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.bar h2 {
  flex: 1;
  margin: 0 4px;
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.icon-btn:active { background: rgba(255, 255, 255, .2); }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }

main {
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 100px);
  max-width: 640px;
  margin: 0 auto;
  background-image: url("icons/pin-faint.svg");
  background-repeat: no-repeat;
  background-position: center 120px;
  background-size: 300px;
  min-height: 70vh;
}

.hint { color: var(--muted); font-size: 14px; margin: 4px 4px 10px; }

.card {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.banner {
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--warn-bg);
  color: var(--warn-text);
}

.banner.error { background: var(--error-bg); color: var(--error-text); }
.banner b { display: block; margin-bottom: 2px; }

.stores, .items { list-style: none; margin: 0; padding: 0; }

.store-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.store-card .name { flex: 1; font-weight: 600; font-size: 18px; }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.badge {
  min-width: 36px;
  padding: 5px 12px;
  border-radius: 16px;
  text-align: center;
  font-weight: 700;
  background: var(--line);
  color: var(--muted);
}

.badge.active { background: var(--accent); color: #fff; }

.sortable-ghost { opacity: .4; }
.sortable-chosen { box-shadow: 0 8px 20px rgba(0, 0, 0, .25); }

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  background: var(--accent);
  color: #fff;
  border-radius: 16px;
  padding: 16px 20px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fab svg { width: 22px; height: 22px; fill: currentColor; }

.add-row { display: flex; gap: 8px; margin-bottom: 12px; }

.add-row input {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
}

.add-row input:focus { outline: none; border-color: var(--store, var(--brand)); }

.round-btn {
  width: 52px;
  border-radius: 12px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.round-btn svg { width: 26px; height: 26px; fill: currentColor; }

.item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
}

.tick {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--store, var(--brand));
  flex: none;
}

.empty { color: var(--muted); padding: 16px 4px; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 24px;
  border: 2px solid var(--line);
  background: var(--surface);
  font-weight: 600;
}

.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: #C62828; }
.btn svg { width: 20px; height: 20px; fill: currentColor; }

.section { padding: 16px; margin-bottom: 14px; }
.section h3 { margin: 0 0 8px; font-size: 18px; }
.section p { margin: 6px 0; }
.small { font-size: 14px; color: var(--muted); }

.section textarea {
  width: 100%;
  min-height: 80px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg);
  font-size: 14px;
}

.card-view {
  background: #fff;
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card-view img { max-width: 100%; max-height: calc(100vh - 180px); }
.card-view .empty { color: #555; }

.card-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  max-width: 560px;
  margin: 0 auto;
  background: #323632;
  color: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
}

.toast[hidden] { display: none; }
.toast span { flex: 1; }
.toast button { color: #FFB77C; font-weight: 700; padding: 6px 4px; }
