* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
  Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

#root {
  min-height: 100vh;
}

/* Navigation */
nav {
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav a {
  color: #333;
  text-decoration: none;
  margin-right: 1.5rem;
  font-weight: 500;
}

nav a:hover {
  color: #0066cc;
}

/* Brand slot: the mark and the product name, aligned on the nav's centre line.
   `align-items: center` matters — an inline SVG sits on the text baseline by
   default and lands a few pixels low next to the name. */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.app-logo {
  display: block;
  flex: none;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input, select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

input:focus, select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0,102,204,0.1);
}

button {
  background-color: #0066cc;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background-color: #0052a3;
}

button.secondary {
  background-color: #6c757d;
}

button.secondary:hover {
  background-color: #5a6268;
}

button.danger {
  background-color: #dc3545;
}

button.danger:hover {
  background-color: #c82333;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card h3 {
  margin-bottom: 0.5rem;
  color: #333;
}

.card p {
  color: #666;
  margin-bottom: 0.25rem;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Error messages */
.error {
  background-color: #f8d7da;
  color: #721c24;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Loading spinner */
.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2rem;
  color: #333;
}

/* Word and sentence items share their layout; a sentence row is marked with
   its own classes so it is never matched by a word selector. */
.word-item,
.sentence-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.word-item:last-child,
.sentence-item:last-child {
  border-bottom: none;
}

.word-text,
.sentence-text {
  font-size: 1.25rem;
  font-weight: 500;
}

.word-date {
  color: #666;
  font-size: 0.875rem;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-parent {
  background-color: #d4edda;
  color: #155724;
}

.badge-relative {
  background-color: #fff3cd;
  color: #856404;
}

/* Stats */
.stats-counts {
  display: flex;
  gap: 1.5rem;
  font-weight: 600;
  color: #555;
}

.chart-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #666;
}

/* The two stacked segments differ only in fill, so the legend carries a swatch
   of each rather than relying on colour alone. */
.chart-legend span {
  padding-left: 1rem;
  position: relative;
}

.chart-legend span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3rem;
  width: 0.6rem;
  height: 0.6rem;
}

.legend-words::before {
  background-color: #7fb3d5;
}

.legend-sentences::before {
  background-color: #f5b041;
}

/* Bar chart */
.bar-chart {
  margin-top: 1rem;
}

.chart-plot {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 8rem;
  border-bottom: 1px solid #ccc;
}

.chart-bar {
  flex: 1 1 0;
  min-width: 2px;
  /* Keeps a zero-height bucket a visible hairline rather than nothing at all; a
     series that is entirely empty still rests on the plot's own axis line. */
  min-height: 2px;
}

.chart-bar-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-words {
  fill: #7fb3d5;
}

.chart-sentences {
  fill: #f5b041;
}

/* Labels mirror the plot's flex sizing so each one sits under its own bar. */
.chart-labels {
  display: flex;
  gap: 2px;
}

.chart-tick {
  flex: 1 1 0;
  text-align: center;
  font-size: 0.65rem;
  color: #666;
  overflow: hidden;
  white-space: nowrap;
}

.stats-resolution {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.granularity-option {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  color: #333;
  cursor: pointer;
}

.granularity-option.is-active {
  background-color: #0066cc;
  border-color: #0066cc;
  color: #fff;
}

/* Baby avatars

   The artwork is one sprite, `assets/avatars.svg`, pulled in with `<use>`, so
   what differs per gender here is the palette alone. Custom properties inherit
   into the `<use>` shadow tree, which is why setting them on the outer `<svg>`
   recolours the referenced symbol — and why the sprite can spell the same three
   tokens in all three symbols. The literal fallbacks in that file are what paint
   when this sheet is missing: without them a failed stylesheet would leave three
   invisible boxes where the avatars should be. */
.avatar {
  display: block;
  flex: none;
  --av-skin: #f2c9a0;
}

.avatar-male {
  --av-hair: #5a4632;
  --av-clothes: #0066cc;
}

.avatar-female {
  --av-hair: #8a5a2b;
  --av-clothes: #b8478c;
}

.avatar-other {
  --av-hair: #4a4a52;
  --av-clothes: #2f8f5b;
}

.avatar-card,
.avatar-preview {
  width: 2.75rem;
  height: 2.75rem;
}

.avatar-header {
  width: 3.5rem;
  height: 3.5rem;
}

/* The name reads as the avatar's caption, so they share a baseline row. */
.baby-card-head,
.baby-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.baby-card-head h3 {
  margin-bottom: 0;
}

.avatar-preview {
  margin-top: 0.75rem;
}


/* Care screen. The latest-of-each-kind cards reuse .card and .grid; these
   rules give the recent rows their seams (rsx emits no whitespace between
   siblings) and the cards a size hierarchy, matching the word rows above. */
.care-summary {
  margin-left: 0.5rem;
  color: #555;
}

.care-notes {
  margin-left: 0.5rem;
  color: #777;
  font-style: italic;
}

.care-latest-summary {
  font-size: 1.25rem;
  font-weight: 500;
}

.care-hint {
  color: #666;
  font-style: italic;
  margin: 0.25rem 0;
}


/* Outdoor screen. The rows and totals reuse .card and the word-row seams;
   these rules give the running timer its presence (the elapsed line is the
   one number that moves) and the history rows their alignment, matching the
   care rows above. */
.outdoor-elapsed {
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.outdoor-totals {
  display: flex;
  gap: 1.5rem;
}

.outdoor-total-label {
  color: #666;
  margin-right: 0.5rem;
}

.outdoor-total-today,
.outdoor-total-week {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.outdoor-history {
  list-style: none;
  margin: 0;
  padding: 0;
}

.outdoor-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.outdoor-row:last-child {
  border-bottom: none;
}

.outdoor-location {
  font-weight: 500;
}

.outdoor-weather {
  margin-left: 0.5rem;
  color: #555;
}

.outdoor-session-notes {
  margin-left: 0.5rem;
  color: #777;
  font-style: italic;
}

.outdoor-duration {
  color: #555;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
