:root {
  --primary: #D35400;
  --secondary: #27AE60;
  --accent: #8E44AD;
  --shopping: #2980B9;
  --danger: #C0392B;
  --bg: #F9F9F6;
  --text: #2C3E50;
  --gray: #7f8c8d;
  --light-gray: #EAECEE;
}

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

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}

h1 { font-size: 1.6rem; margin: 0; color: var(--primary); }
h2 { font-size: 1.4rem; margin: 0; }
.subtitle { font-size: 0.8rem; color: var(--gray); margin: 2px 0 0; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
}
.header .title-block { flex: 1; min-width: 0; }
.header img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }

.actions-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.actions-row .btn { flex: 1; min-width: 0; font-size: 0.72rem; padding: 10px 4px; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  font-family: inherit;
}
.btn:active { opacity: 0.85; }
.btn.secondary { background: var(--secondary); }
.btn.accent { background: var(--accent); }
.btn.shopping { background: var(--shopping); }
.btn.dark { background: #2C3E50; }
.btn.outline {
  background: transparent;
  border: 2px solid currentColor;
  color: var(--primary);
  padding: 8px 14px;
}
.btn.outline.danger { color: var(--danger); }
.btn.small { font-size: 0.75rem; padding: 6px 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.category-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 18px 0 8px;
}

.plat-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  padding: 13px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.plat-card.selected { background: #D5F5E3; }
.plat-card.selected .plat-name { color: #145A32; font-weight: 700; }
.plat-card.disabled { opacity: 0.45; }
.plat-name { flex: 1; min-width: 0; }

.badge {
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge.shopping-badge {
  background: rgba(41,128,185,0.15);
  color: var(--shopping);
  border-radius: 6px;
}

.footer-credits {
  text-align: center;
  color: var(--gray);
  font-size: 0.78rem;
  margin: 20px 0 4px;
}
.footer-trial {
  text-align: center;
  color: rgba(211,84,0,0.8);
  font-size: 0.72rem;
  font-weight: 500;
}

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 14px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.settings-row .label { flex: 1; }
.settings-row .label b { display: block; color: #333; font-size: 0.95rem; }
.settings-row .label span { font-size: 0.75rem; color: var(--gray); }

.counter { display: flex; align-items: center; gap: 8px; }
.counter .count {
  min-width: 64px;
  text-align: center;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.85rem;
}
.btn-round {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 30px;
  transition: background 0.2s;
  cursor: pointer;
}
.switch .track::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { left: 25px; }

.back-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 14px;
}
.back-header .title-block { flex: 1; min-width: 0; }

.row-2 { display: flex; gap: 8px; margin-bottom: 12px; }
.row-2 .btn { flex: 2; }
.row-2 .btn.outline { flex: 1; }

.recap-day {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  padding: 13px 14px;
  margin-bottom: 10px;
}
.recap-day.empty { background: rgba(234,236,238,0.5); box-shadow: none; }
.recap-day .day-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.recap-day .day-name { font-weight: 700; color: var(--primary); font-size: 1rem; white-space: nowrap; }
.recap-day.empty .day-name { color: var(--gray); }
.recap-day .day-meal { text-align: right; flex: 1; }
.recap-day.empty .day-meal { color: var(--gray); font-weight: 400; }
.recap-day .divider { border-top: 1px solid rgba(0,0,0,0.06); margin: 9px 0; }
.recap-day .day-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.shopping-cat {
  font-weight: 700;
  color: var(--shopping);
  font-size: 0.95rem;
  margin: 14px 0 6px;
}
.shopping-item {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

.empty-state {
  text-align: center;
  color: var(--gray);
  padding: 60px 20px;
  font-size: 1rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  width: 100%;
  max-width: 420px;
  max-height: 86vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 12px; font-size: 1.15rem; }
.modal .hint { font-size: 0.85rem; color: #555; margin: 10px 0 6px; font-weight: 700; color: var(--primary); }
.modal input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  border: 2px solid #ccc;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 10px;
}
.modal .day-btn {
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 10px;
  background: var(--light-gray);
  color: #444;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 6px;
  font-family: inherit;
}
.modal .day-btn.current { background: var(--primary); color: #fff; font-weight: 700; }
.modal .day-btn.taken { background: rgba(211,215,219,0.5); color: #999; }
.modal .modal-row { display: flex; gap: 8px; }
.modal .modal-row > * { flex: 1; }
.modal .close-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.link-btn {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 0;
}
.link-btn.danger { color: var(--danger); font-weight: 600; }

.paywall {
  max-width: 480px;
  margin: 0 auto;
  padding: 60px 24px;
  text-align: center;
}
.paywall h2 { color: var(--primary); }
.paywall p { color: var(--gray); line-height: 1.6; }
.paywall .btn { width: 100%; padding: 14px; font-size: 1rem; margin-top: 20px; }
.paywall .note { font-size: 0.75rem; color: var(--gray); margin-top: 14px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2C3E50;
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.85rem;
  z-index: 200;
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
