:root {
  --bg: #fff8f4;
  --bg-card: #ffffff;
  --accent: #e89bb5;
  --accent-dark: #c2185b;
  --text: #2b2b2b;
  --muted: #888;
  --border: #f0d9e0;
  --warn: #f57c00;
  --warn-bg: #fff3e0;
  --ok: #66bb6a;
  --ok-bg: #e8f5e9;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app {
  padding: 14px 14px 90px 14px;
  max-width: 720px; margin: 0 auto;
}

.screen-title { margin: 0 0 14px; font-size: 22px; font-weight: 600; }
.section-h { margin: 18px 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }

.home-header { margin-bottom: 14px; }
.baby-title { font-size: 24px; font-weight: 600; }
.baby-day { color: var(--muted); font-size: 14px; margin-top: 4px; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.stat-card.tone-warn { background: var(--warn-bg); border-color: #ffe0b2; }
.stat-card.tone-ok { background: var(--ok-bg); border-color: #c8e6c9; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.stat-value { font-size: 22px; font-weight: 600; margin-top: 2px; }
.stat-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.stats-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stats-row .stat-card { margin-bottom: 0; padding: 10px; }
.stats-row .stat-value { font-size: 18px; }

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
}

.grid-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.big-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 4px;
  font: inherit; color: inherit;
  cursor: pointer;
  -webkit-appearance: none;
}
.big-btn:active { background: var(--bg); }
.big-btn-emoji { font-size: 28px; }
.big-btn-label { font-size: 13px; margin-top: 4px; }

.control-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.control-block .hint { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.actions-row button { flex: 1; }
.control-summary { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.control-total { font-size: 16px; margin-bottom: 8px; }
.control-total strong { color: var(--accent-dark); margin: 0 6px; font-size: 18px; }
.control-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }

.btn-primary, .btn-secondary, .btn-link {
  border: none; border-radius: 12px; padding: 12px 14px; font: inherit; cursor: pointer;
  -webkit-appearance: none;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:active { background: var(--accent-dark); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-link { background: none; color: var(--accent-dark); text-decoration: underline; padding: 6px; }

#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255, 248, 244, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
}
#bottom-nav .tab {
  background: none; border: none; padding: 6px 12px;
  display: flex; flex-direction: column; align-items: center;
  color: var(--muted); font-size: 11px; cursor: pointer;
}
#bottom-nav .tab.active { color: var(--accent-dark); }
#bottom-nav .ico { font-size: 22px; }
#bottom-nav .lbl { margin-top: 2px; }

#sync-indicator {
  position: fixed; top: 8px; right: 10px; z-index: 60;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(232,155,181,0.5);
  animation: pulse 1.2s infinite;
}
#sync-indicator.hidden { display: none; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(232,155,181,0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(232,155,181,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,155,181,0); }
}

/* Модалки */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  background: var(--bg);
  width: 100%; max-width: 720px;
  border-radius: 16px 16px 0 0;
  max-height: 92vh; overflow-y: auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp 0.18s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--muted); cursor: pointer; padding: 4px; }

.form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.form input[type="text"], .form input[type="date"], .form textarea, .form .dt-input {
  width: 100%; padding: 12px; font: inherit; border-radius: 10px;
  border: 1px solid var(--border); background: white;
}
.form .dt-input { width: auto; min-width: 250px; }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-row.big .chip { padding: 14px 18px; font-size: 15px; }
.chip {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 8px 14px; font: inherit; color: inherit;
  cursor: pointer; -webkit-appearance: none;
}
.chip.selected { background: var(--accent); color: white; border-color: var(--accent); }

.num-input { display: flex; align-items: center; gap: 8px; }
.num-input input {
  flex: 1; padding: 12px; font: inherit; text-align: center;
  border-radius: 10px; border: 1px solid var(--border); background: white;
  font-size: 18px; font-weight: 500;
}
.num-step {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 20px; cursor: pointer; -webkit-appearance: none;
}

.modal-actions { margin-top: 16px; }
.modal-actions .actions-row { gap: 8px; }
.modal-actions .btn-primary, .modal-actions .btn-secondary { padding: 14px 12px; font-size: 16px; }

.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 24px;
  background: rgba(40,40,40,0.92); color: white;
  font-size: 14px; z-index: 200;
  opacity: 1; transition: opacity 0.4s;
}
.toast.fade { opacity: 0; }
.toast.ok { background: rgba(56,142,60,0.95); }
.toast.err { background: rgba(211,47,47,0.95); }

/* Лог */
.log-day { margin: 18px 0 8px; font-size: 14px; color: var(--muted); font-weight: 500; }
.log-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; margin-bottom: 6px;
}
.log-emoji { font-size: 20px; }
.log-content { flex: 1; }
.log-label { font-size: 14px; }
.log-ts { font-size: 12px; color: var(--muted); margin-top: 2px; }
.log-delete {
  background: none; border: none; font-size: 16px;
  color: rgba(0,0,0,0.4); cursor: pointer; padding: 6px;
}
.muted { color: var(--muted); }

/* Меню */
.menu-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.menu-section h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.menu-section .hint { font-size: 13px; color: var(--muted); margin: 8px 0; }
.menu-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  font-size: 15px;
}

.hidden { display: none !important; }
