:root {
  --ink: #25313b;
  --muted: #64707a;
  --line: #d8dee4;
  --paper: #fffdf9;
  --surface: #ffffff;
  --teal: #087f8c;
  --coral: #e85d75;
  --yellow: #f6c85f;
  --mint: #dff5ef;
  --rose: #fff0f3;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.top-band {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px clamp(18px, 4vw, 56px);
  background: #fffdf9;
  border-bottom: 1px solid var(--line);
}

.baby-photo {
  width: 76px;
  height: 76px;
  object-fit: cover;
  object-position: 58% 40%;
  border: 3px solid #ffffff;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.day-tab {
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 760;
}

.day-tab.active {
  color: #053f46;
  background: var(--mint);
  border-color: #b8e6d9;
}

.control-band {
  padding: 20px clamp(18px, 4vw, 56px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.profile-grid {
  display: grid;
  gap: 14px;
  max-width: 1380px;
  margin: 0 auto;
}

.profile-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.profile-row-secondary {
  align-items: start;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.field-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

input,
select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
}

input[readonly] {
  color: var(--muted);
  background: #f7faf9;
}

.custom-schedule {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1.35fr);
  gap: 18px;
  align-items: start;
  max-width: 1380px;
  margin: 18px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.custom-schedule[hidden] {
  display: none;
}

.helper-copy {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  max-width: 1380px;
  margin: 14px auto 0;
}

.day-tab,
.ghost-button,
.secondary-button,
.icon-button {
  font-size: 0.92rem;
}

.ghost-button {
  min-height: 42px;
  padding: 0 14px;
  color: #823144;
  background: #fff;
  border: 1px solid #f1c6d0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 760;
}

.custom-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: start;
  max-width: 1380px;
  margin: 0 auto;
  padding: 22px clamp(18px, 4vw, 56px) 44px;
}

.today-panel,
.log-panel,
.guidance-panel,
.trend-panel,
.history-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.today-panel {
  padding: 24px;
}

.log-panel,
.guidance-panel,
.trend-panel,
.history-panel {
  padding: 20px;
}

.history-panel {
  grid-column: 1 / -1;
}

.section-heading {
  margin-bottom: 18px;
}

.meter-wrap {
  margin: 4px 0 16px;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.meter {
  height: 18px;
  overflow: hidden;
  background: #edf2f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--yellow), var(--coral));
  border-radius: 8px;
  transition: width 180ms ease;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  display: grid;
  gap: 3px;
  min-height: 74px;
  padding: 10px;
  background: #f7faf9;
  border: 1px solid #dce8e5;
  border-radius: 8px;
}

.stat span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.stat strong {
  align-self: start;
  max-width: 100%;
  font-size: clamp(0.95rem, 1.45vw, 1.15rem);
  line-height: 1.1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.recommendation {
  margin-top: 14px;
  padding: 14px;
  background: var(--rose);
  border: 1px solid #ffd3dd;
  border-left: 6px solid var(--coral);
  border-radius: 8px;
  color: #4d2630;
  font-size: 0.84rem;
  line-height: 1.4;
}

.recommendation strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 0.92rem;
}

.breakdown-wrap {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.compact-heading {
  margin-bottom: 12px;
}

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

.breakdown-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.breakdown-item {
  display: grid;
  gap: 4px;
  min-height: 82px;
  padding: 10px;
  background: #f8fbff;
  border: 1px solid #dce8f3;
  border-radius: 8px;
}

.breakdown-item.actual-good {
  background: #eef8f2;
  border-color: #b8ddc4;
}

.breakdown-item.actual-alert {
  background: #fff2f4;
  border-color: #f0c2cb;
}

.breakdown-item span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.breakdown-item strong {
  display: block;
  margin: 0;
  font-size: clamp(0.88rem, 1.1vw, 1rem);
  line-height: 1.2;
}

.breakdown-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.naps-list {
  display: grid;
  gap: 12px;
}

.bedtime-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}

.nap-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(72px, auto);
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: #f8fbff;
  border: 1px solid #dce8f3;
  border-radius: 8px;
}

.icon-button,
.secondary-button {
  min-height: 46px;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 760;
}

.icon-button {
  width: 72px;
  padding: 0 10px;
  font-size: 0.8rem;
  line-height: 1;
  color: #823144;
  background: #ffe7ed;
}

.secondary-button {
  width: 100%;
  margin-top: 12px;
  padding: 0 14px;
  font-size: 0.8rem;
  line-height: 1.1;
  color: #053f46;
  background: var(--mint);
}

.signal-list {
  display: grid;
  gap: 11px;
}

.panel-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.signal {
  position: relative;
  padding: 14px;
  background: #fffaf0;
  border: 1px solid #f8dda1;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.4;
}

.signal strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.signal-dismiss {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  gap: 8px;
  align-items: end;
  height: 152px;
  padding: 10px 0 0;
}

.trend-bars:empty {
  display: none;
  height: 0;
  padding: 0;
}

.trend-day {
  display: grid;
  gap: 6px;
  align-items: end;
  min-width: 0;
  height: 100%;
}

.bar {
  width: 100%;
  min-height: 18px;
  background: var(--teal);
  border-radius: 8px 8px 3px 3px;
}

.trend-day:nth-child(3n) .bar {
  background: var(--coral);
}

.trend-day:nth-child(4n) .bar {
  background: var(--yellow);
}

.trend-day span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.trend-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.history-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  text-align: left;
  background: #f8fbff;
  border: 1px solid #dce8f3;
  border-radius: 8px;
  cursor: pointer;
}

.history-item.active {
  background: var(--mint);
  border-color: #b8e6d9;
}

.history-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.history-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

@media (max-width: 960px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .history-list {
    grid-template-columns: 1fr;
  }

  .profile-row,
  .stat-grid,
  .breakdown-list,
  .custom-schedule,
  .custom-schedule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 2.35rem;
  }

  .profile-row,
  .stat-grid,
  .breakdown-list,
  .custom-schedule,
  .custom-schedule-grid,
  .bedtime-row,
  .nap-row {
    grid-template-columns: 1fr;
  }

  .icon-button {
    width: 100%;
  }

  .today-panel,
  .log-panel,
  .guidance-panel,
  .trend-panel,
  .history-panel {
    padding: 16px;
  }
}
