/* DankelTwins – Mobile-First UI */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --sophie: #d63384;
  --sophie-soft: #fbe4f1;
  --lars: #1c6ee0;
  --lars-soft: #e3edfc;
  --ok: #16803c;
  --warn: #b45309;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none; /* kein Gummi-Band-Ziehen im Standalone-Modus */
}
/* iOS zoomt automatisch in Eingabefelder < 16px */
input, select, textarea { font-size: 16px; }
button, .chip, .btn, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.container { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 14px 12px 40px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
h1 { font-size: 1.35rem; margin: 1.1rem 0 0.6rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }

/* Nav */
.topnav {
  display: flex; align-items: center; justify-content: space-between;
  background: #1f2937; color: #fff; padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px));
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 1.05rem; }
.navlinks { display: flex; align-items: center; gap: 4px; }
.navlinks a, .navlinks .linklike {
  color: #d1d5db; text-decoration: none; padding: 8px 9px; border-radius: 8px;
  font-size: 0.95rem; background: none; border: none; cursor: pointer; font-family: inherit;
  min-height: 36px; display: inline-flex; align-items: center;
}
.navlinks a.active, .navlinks a:hover { color: #fff; background: #374151; }
.inline { display: inline; }

/* Flash / Banner */
.flash {
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 10px;
}
.banner-warn {
  background: #fffbeb; border: 1px solid #fde68a; color: var(--warn);
  padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; font-weight: 600;
}

/* Beide-Zeile */
.both-row { display: flex; gap: 10px; margin-bottom: 12px; }
.both-row .btn { flex: 1; }

/* Baby-Karten */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--card); border-radius: 16px; padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-top: 5px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0; /* verhindert Aufweiten der Grid-Spalte durch breite Inhalte */
  overflow: hidden;
}
.baby-sophie { border-top-color: var(--sophie); }
.baby-lars { border-top-color: var(--lars); }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.baby-name { font-weight: 800; font-size: 1.1rem; }
.badge {
  font-size: 0.8rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #f3f4f6; color: var(--muted);
}
.badge-sophie { background: var(--sophie-soft); color: var(--sophie); }
.badge-lars { background: var(--lars-soft); color: var(--lars); }

.timer {
  font-variant-numeric: tabular-nums; font-weight: 800; text-align: center;
  font-size: 2.6rem; letter-spacing: 1px; line-height: 1.1;
}
.timer.running-sophie { color: var(--sophie); }
.timer.running-lars { color: var(--lars); }
.timer-sub { text-align: center; margin-top: -6px; }

.today {
  display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap;
  background: #f9fafb; border-radius: 10px; padding: 8px 10px; font-size: 0.9rem;
}

.weight-box summary {
  cursor: pointer; font-weight: 600; padding: 10px 0; min-height: 44px;
  display: flex; align-items: center; touch-action: manipulation;
}
.weight-box { min-width: 0; }
.weight-form { display: flex; gap: 8px; margin: 8px 0 4px; }
.weight-form input {
  flex: 1; width: 100%; min-width: 0; padding: 10px;
  border: 1.5px solid var(--line); border-radius: 10px;
}
.weight-form .btn-small { flex-shrink: 0; }

/* Checkboxen generell (Touch-Groesse) */
input[type="checkbox"] { width: 22px; height: 22px; accent-color: #1f2937; flex-shrink: 0; }

/* Vitamin-D-Zeile */
.vitd-row {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  background: #f9fafb; border-radius: 10px; padding: 8px 12px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; user-select: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.vitd-row.on { border-color: #a7f3d0; background: #ecfdf5; }
.vitd-row.on input[type="checkbox"] { accent-color: var(--ok); }

/* Stillen-Toggle auf der Karte */
.stillen-toggle { align-self: center; }
.stillen-toggle.active { background: var(--sophie-soft); border-color: var(--sophie); color: var(--sophie); }

/* Buttons */
.btn {
  border: none; border-radius: 12px; padding: 12px 16px; font-size: 1rem;
  font-weight: 700; cursor: pointer; font-family: inherit; transition: filter 0.1s;
  min-height: 48px;
}
.btn:active { filter: brightness(0.92); transform: scale(0.985); }
.btn-block { width: 100%; }
.btn-primary { background: #1f2937; color: #fff; }
.btn-start { background: var(--ok); color: #fff; font-size: 1.05rem; padding: 18px 16px; min-height: 66px; }
.btn-stop { background: var(--danger); color: #fff; font-size: 1.05rem; padding: 18px 16px; min-height: 66px; }
.btn-ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink); min-height: 46px; }
.btn-small { padding: 6px 10px; font-size: 0.85rem; border-radius: 8px; background: #1f2937; color: #fff; min-height: 34px; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.linklike { color: inherit; }

/* Login */
.login-card {
  max-width: 380px; margin: 8vh auto 0; background: var(--card);
  border-radius: 16px; padding: 26px 22px; box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.login-card h1 { margin: 0 0 2px; text-align: center; }
.login-card p { text-align: center; margin-top: 0; }
.login-card label { display: block; margin: 14px 0 4px; font-weight: 600; }
.login-card input {
  width: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 1.05rem;
}
.login-card input:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
.login-card .btn { margin-top: 20px; }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(17,24,39,0.55); z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 420px;
}
.modal-card input {
  width: 100%; padding: 14px; font-size: 1.4rem; text-align: center;
  border: 2px solid var(--line); border-radius: 10px; margin: 6px 0 10px;
}
.modal-card input:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px; }
.quick-amounts .chip { min-width: 58px; min-height: 46px; font-size: 1.05rem; }
.modal-flags { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.flag {
  position: relative; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; min-height: 76px; padding: 10px 4px;
  background: #fff; border: 2px solid var(--line); border-radius: 14px;
  font-size: 0.85rem; font-weight: 700; cursor: pointer; user-select: none;
  text-align: center; touch-action: manipulation;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.flag:active { transform: scale(0.96); }
.flag input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.flag .faux {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #cbd5e1; background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, border-color 0.12s;
}
.flag .faux::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 900; opacity: 0; }
.flag.on { border-color: var(--flag-color, #1f2937); background: var(--flag-bg, #f3f4f6); }
.flag.on .faux { background: var(--flag-color, #1f2937); border-color: var(--flag-color, #1f2937); }
.flag.on .faux::after { opacity: 1; }
.flag-stillen { --flag-color: var(--sophie); --flag-bg: #fbe4f1; }
.flag-pipi { --flag-color: #2563eb; --flag-bg: #e0edff; }
.flag-kaka { --flag-color: #b45309; --flag-bg: #fef3c7; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.modal-card { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }

.banner-warn { cursor: pointer; }

.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 10px 14px; font-size: 0.95rem; font-weight: 700; cursor: pointer; font-family: inherit;
  min-height: 44px;
}
.chip.active { background: #1f2937; color: #fff; border-color: #1f2937; }

/* Tabellen */
.tablewrap { overflow-x: auto; background: var(--card); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f9fafb; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.running-row { background: #fffbeb; }
.runbadge {
  background: #fde68a; color: var(--warn); font-size: 0.75rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.mini-input { width: 80px; padding: 5px; border: 1.5px solid var(--line); border-radius: 7px; }
.amend { display: inline-flex; gap: 6px; align-items: center; }

/* Charts */
.chart-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); }
.chart-card {
  background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.footer {
  text-align: center; color: var(--muted); font-size: 0.8rem;
  padding: 18px 0 calc(26px + env(safe-area-inset-bottom, 0px));
}
