:root {
  --ink: #241f33;
  --muted: #837d99;
  --line: #e8e3f5;
  --bg-soft: #faf8fd;
  --bg-card: #ffffff;
  --accent: #8b5cf6;
  --accent-dark: #6d3fd1;
  --accent-tint: #f1ebfe;
  --danger: #d9491f;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(36, 31, 51, 0.04), 0 4px 14px rgba(36, 31, 51, 0.06);
  --shadow-hover: 0 4px 10px rgba(36, 31, 51, 0.06), 0 10px 26px rgba(36, 31, 51, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg-soft);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  letter-spacing: -0.5px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
}

/* ---------- Landing / sign-in ---------- */

.split {
  display: flex;
  min-height: 100vh;
}

.split .pane {
  flex: 1;
  min-width: 0;
}

.split .left {
  background: #fff;
  display: flex;
  flex-direction: column;
  padding: 36px 44px;
}

.split .left .brand {
  font-size: 20px;
  font-weight: 800;
}

.split .left .mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 28px 0;
}

.split .left h1 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 10px;
}

.split .left .sub {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.split .left .hint {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 0;
}

.split .left .foot {
  font-size: 12px;
  color: var(--muted);
}

.split .right {
  background: linear-gradient(160deg, #a78bfa, #6d3fd1 85%);
  color: #fff;
}

.split .right .inner {
  max-width: 420px;
  margin: 0 auto;
  padding: 36px 44px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.split .right h2 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 12px;
  color: #fff;
}

.split .right .rsub {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.55;
  margin: 0 0 24px;
}

.rfeat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rfeat li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
}

.rfeat .emoji {
  font-size: 18px;
  flex-shrink: 0;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.btn-google:hover {
  box-shadow: var(--shadow-hover);
}

@media (max-width: 760px) {
  .split {
    flex-direction: column;
  }
  .split .right {
    order: -1;
    padding: 8px 0;
  }
  .split .right .inner {
    padding: 24px 28px;
  }
  .split .left {
    padding: 28px;
  }
}

/* ---------- App shell ---------- */

#app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 84px;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar .brand-small {
  font-weight: 800;
  font-size: 15px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.view {
  padding: 20px 18px 8px;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.view-header h1 {
  font-size: 24px;
  margin: 0;
}

/* ---------- Buttons ---------- */

.btn-primary, .btn-secondary, .btn-icon {
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: var(--accent-tint);
  color: var(--accent-dark);
  border: 1px solid transparent;
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary:disabled:hover {
  border-color: transparent;
}

.btn-small {
  padding: 9px 14px;
  font-size: 13.5px;
}

.btn-icon {
  background: transparent;
  font-size: 18px;
  padding: 6px;
  line-height: 1;
}

.btn-icon:hover {
  background: var(--accent-tint);
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 0;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 28px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 10px;
}

.section-header h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

/* ---------- Baby summary / stats ---------- */

.baby-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.baby-avatar {
  font-size: 28px;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-tint);
  border-radius: 50%;
}

.baby-name {
  font-weight: 700;
  font-size: 17px;
}

.baby-age {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.stat-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-tile {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
}

.stat-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.quick-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.quick-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 10px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.quick-action-btn:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.qa-icon {
  font-size: 22px;
}

/* ---------- Growth ---------- */

.subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.subtab-btn {
  flex-shrink: 0;
  border: none;
  background: var(--bg-card);
  color: var(--muted);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

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

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px 14px;
  margin-bottom: 16px;
}

.growth-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 11px 13px;
  box-shadow: var(--shadow);
}

.entry-main {
  flex: 1;
  min-width: 0;
}

.entry-value {
  font-weight: 700;
  font-size: 15px;
}

.entry-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.entry-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}

.entry-actions {
  display: flex;
  gap: 2px;
}

.entry-actions button {
  background: transparent;
  border: none;
  font-size: 15px;
  padding: 6px;
  border-radius: var(--radius);
  color: var(--muted);
}

.entry-actions button:hover {
  background: var(--accent-tint);
  color: var(--accent-dark);
}

/* ---------- Placeholder cards (Bluetooth / photo) ---------- */

.placeholder-card {
  display: flex;
  gap: 12px;
  background: var(--accent-tint);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 16px;
}

.placeholder-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.placeholder-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--accent-dark);
}

.placeholder-text {
  font-size: 12.5px;
  color: var(--ink);
  opacity: 0.75;
  line-height: 1.4;
  margin: 3px 0 8px;
}

.placeholder-body input[type="file"] {
  font-size: 12.5px;
  max-width: 100%;
}

.photo-preview {
  display: block;
  max-width: 100%;
  max-height: 140px;
  border-radius: var(--radius);
  margin-top: 8px;
  object-fit: cover;
}

/* ---------- Milestones (groeiboekje) ---------- */

.milestone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.milestone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 6px;
  box-shadow: var(--shadow);
}

.milestone-card.achieved {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.milestone-icon {
  font-size: 22px;
}

.milestone-label {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
}

.milestone-status {
  font-size: 10.5px;
  color: var(--muted);
}

.milestone-card.achieved .milestone-status {
  color: var(--accent-dark);
  font-weight: 600;
}

.milestone-entry-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.milestone-entry {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.milestone-entry-title {
  font-weight: 700;
  font-size: 14.5px;
}

.milestone-entry-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.milestone-entry-note {
  font-size: 12.5px;
  margin-top: 5px;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  gap: 4px;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 0;
  border-radius: var(--radius);
}

.nav-btn span {
  font-size: 20px;
}

.nav-btn.active {
  color: var(--accent-dark);
  background: var(--accent-tint);
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 31, 51, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.modal {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 18px;
  margin: 0 0 14px;
}

#baby-form, #weight-form, #length-form, #milestone-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#baby-form input, #baby-form select,
#weight-form input, #length-form input, #milestone-form input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  background: #fff;
}

.field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 2px 0 -4px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.form-actions .btn-secondary#milestone-delete-btn,
.form-actions .btn-secondary#baby-delete-btn {
  color: var(--danger);
  margin-right: auto;
}

/* ---------- Baby switcher ---------- */

.baby-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 18px 2px;
}

.baby-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.baby-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.baby-chip.sex-boy {
  background: #eaf2ff;
  border-color: #cfe1fb;
  color: #2f6fd1;
}

.baby-chip.sex-boy.active {
  background: #4a90e2;
  border-color: #4a90e2;
  color: #fff;
}

.baby-chip.sex-girl {
  background: #fdedf3;
  border-color: #f9d3e4;
  color: #d1447e;
}

.baby-chip.sex-girl.active {
  background: #ec6fa0;
  border-color: #ec6fa0;
  color: #fff;
}

.baby-chip-add {
  background: transparent;
  border: 1px dashed var(--line);
  box-shadow: none;
  color: var(--accent-dark);
}

.baby-chip-add:hover {
  border-color: var(--accent);
}

@media (min-width: 480px) {
  .modal-overlay {
    align-items: center;
  }
  .modal {
    border-radius: var(--radius-lg);
  }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 30;
  box-shadow: var(--shadow-hover);
}
