@font-face {
  font-family: "Nunito";
  src: url("assets/fonts/Nunito.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  font-family: "Nunito", "Segoe UI", sans-serif;
  line-height: 1.4;
  color: var(--text);
  background: var(--background);
  color-scheme: light;
  --background: #f8f4ef;
  --surface: #fffcf8;
  --soft: #f3ece3;
  --border: #e4d8cb;
  --text: #594638;
  --label: #695343;
  --muted: #706050;
  --accent: #7e593f;
  --accent-hover: #704c33;
  --selected: #efddca;
  --outline: #9d7657;
  --on-accent: #ffffff;
  --time-color: var(--text);
  --sage: #e8eee3;
  --sage-border: #d2ddc9;
  --peach: #f7e8dd;
  --peach-border: #ead7c7;
  --sand: #f3ead8;
  --sand-border: #e3d8bd;
  --moon: #ddb36b;
  --shadow: #5946380a;
  --shadow-strong: #59463826;
  --backdrop: #59463866;
  --error: #9c3d32;
}

* { box-sizing: border-box; }
button:disabled { cursor: default; opacity: .6; }
.auth-panel { max-width: 440px; margin: 0 auto 24px; }
.session-loading { padding: 32px 16px; text-align: center; color: var(--muted); }
.auth-panel form { display: grid; gap: 12px; margin-top: 20px; }
.auth-panel input { width: 100%; }
.auth-panel .save-button { margin-top: 8px; }
#auth-message { color: var(--error); font-size: 14px; }
.cloud-status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
#cloud-status { flex: 1; min-width: 140px; color: var(--muted); font-size: 13px; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { max-width: 820px; margin: 0 auto; padding: 28px 18px 42px; }
.topbar { position: relative; display: flex; justify-content: center; padding: 8px 0 24px; }
.top-actions { position: absolute; top: 12px; right: 0; }
.app-emblem { display: flex; align-items: center; justify-content: center; margin: 0; line-height: 1; }
.emblem-image { display: block; width: 340px; max-width: 100%; height: auto; }
.header-controls { display: flex; align-items: center; gap: 8px; }
.settings-button, .settings-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--accent); font-size: 27px; }
.settings-button:hover, .settings-close:hover { border-color: var(--outline); background: var(--selected); }
.role-chip { min-height: 34px; padding: 0 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--accent); font-size: 12px; font-weight: 750; }
.overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.summary-column { min-width: 0; display: grid; grid-template-rows: 34px auto; gap: 8px; }
.summary-column .summary-label { display: block; align-self: center; padding: 0; text-align: center; white-space: nowrap; color: var(--accent); font-size: 24px; font-weight: 800; letter-spacing: -.02em; text-transform: none; }
.summary-card { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 22px var(--shadow); display: grid; grid-template-rows: 48px 26px; align-items: center; gap: 8px; text-align: center; }
.summary-card .summary-time { color: var(--time-color); font-size: 38px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.summary-card .summary-status { color: var(--label); font-size: 18px; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.primary-card, .feed-card, .stool-card { border-color: var(--border); background: var(--soft); }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.settings-section { margin: 20px 0 0; }
.settings-section + .settings-section { padding-top: 20px; border-top: 1px solid var(--border); }
.settings-section h3 { margin: 0; color: var(--accent); font-size: 16px; }
.settings-section label { margin: 14px 0 7px; }
.settings-section p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.settings-section .checkbox-label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 15px; }
.checkbox-label input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }

.panel { margin-bottom: 16px; padding: 22px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: 0 10px 30px var(--shadow); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 19px; }
h2 { margin: 5px 0 0; font-size: 23px; letter-spacing: -.04em; }
.event-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 17px; }
.event-button { min-height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 14px 8px; border: 1px solid var(--border); border-radius: 16px; background: var(--soft); color: var(--label); font-size: 19px; font-weight: 750; letter-spacing: -.02em; }
.event-button-icon { font-size: 40px; line-height: 1.1; }
.event-button:hover { border-color: var(--outline); }
.event-button[aria-pressed="true"] { border-color: var(--outline); background: var(--selected); box-shadow: inset 0 0 0 1px var(--outline); }
.event-fields[hidden] { display: none; }
.feed-volume { margin: 0 0 17px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--soft); }
.feed-volume summary { cursor: pointer; color: var(--label); font-size: 14px; font-weight: 700; }
.feed-volume .volume-options { margin-top: 12px; }
.feed-volume[hidden] { display: none; }
.volume-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.volume-option { min-height: 44px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--label); font-size: 14px; font-weight: 750; }
.volume-option[aria-pressed="true"] { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }
.time-section { margin-bottom: 16px; }
.field-title { display: block; margin-bottom: 8px; color: var(--label); font-size: 13px; font-weight: 700; }
.time-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 2px 0 10px; }
.time-preset { flex: 0 0 auto; min-height: 42px; padding: 0 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--soft); color: var(--label); font-size: 13px; font-weight: 700; scroll-snap-align: start; }
.time-preset[aria-pressed="true"] { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }
.time-preset { padding: 6px 4px; border-radius: 12px; }
.event-fields { scroll-margin-top: 18px; }
.live-time { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; margin-bottom: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--soft); color: var(--label); font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.clock-edit { font-size: 18px; }
.timeline-controls { display: flex; gap: 8px; }
.password-field { display: flex; gap: 8px; }
.password-field input { min-width: 0; margin: 0; }
.password-field button { display: grid; place-items: center; flex: 0 0 46px; border: 1px solid var(--border); border-radius: 10px; background: var(--soft); color: var(--label); }
.auth-panel label[for="auth-password"] { margin-bottom: -6px; }
.danger-button { min-height: 44px; padding: 10px 16px; color: var(--error); background: var(--surface); border: 1px solid var(--error); border-radius: 12px; font-weight: 750; }
.danger-button:disabled { opacity: .55; cursor: wait; }
.reset-actions { display: flex; justify-content: space-between; gap: 10px; }
#reset-dialog p { color: var(--muted); line-height: 1.5; }
.summary-column .summary-label, .event-button { font-size: 19px; font-weight: 750; }
.manual-time { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 0 0; }
.manual-time[hidden] { display: none; }
label { display: block; color: var(--label); font-size: 13px; font-weight: 700; margin-bottom: 13px; }
input, select { width: 100%; height: 42px; margin-top: 6px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); outline-color: var(--accent); font-size: 16px; }
.form-footer { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 6px; }
#form-message { color: var(--error); font-size: 12px; }
#form-message:empty { display: none; }
.save-button { min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 750; }
.save-button:hover { background: var(--accent-hover); }
.timeline-date { flex: none; width: 145px; margin: 0; height: 40px; font-size: 14px; }
.timeline-filters { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 9px; }
.action-toast { position: fixed; z-index: 100; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 12px); max-width: calc(100vw - 32px); padding: 13px 20px; border-radius: 16px; background: var(--accent-hover); color: var(--on-accent); box-shadow: 0 8px 28px var(--shadow-strong); text-align: center; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.action-toast:empty { padding: 0; }
.action-toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .action-toast { transition: none; } }
.timeline-filter { flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--soft); color: var(--label); font-size: 12px; font-weight: 700; }
.timeline-filter[aria-pressed="true"] { border-color: var(--outline); background: var(--selected); color: var(--accent); }
.empty-state { padding: 25px 8px; color: var(--muted); text-align: center; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; align-items: center; gap: 12px; padding: 16px 10px; margin-top: 8px; border: 1px solid var(--border); border-radius: 16px; background: var(--soft); }
.event-time { flex: none; width: 76px; }
.event-time time { display: block; color: var(--time-color); font-size: 25px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.event-time small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.event-icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--selected); font-size: 27px; }
.event-details { flex: 1; min-width: 0; }
.event-details strong { display: block; font-size: 17px; }
.event-description { display: block; margin-top: 5px; color: var(--label); font-size: 13px; line-height: 1.4; }
.event-edit { flex: none; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 12px; color: var(--accent); background: var(--surface); font-size: 24px; }
.event-edit:hover { background: var(--selected); border-color: var(--outline); }
.event-actions { display: grid; gap: 6px; flex: none; }
.event-delete { width: 44px; height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--error); font-size: 21px; }
.daily-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.daily-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--soft); text-align: center; }
.daily-card strong { font-size: clamp(16px, 3.7vw, 24px); font-variant-numeric: tabular-nums; }
.daily-card span { font-size: clamp(11px, 3vw, 15px); font-weight: 750; }
.daily-card small, .daily-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
#daily-date { width: 155px; margin: 0; }
.daily-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.daily-heading h2 { margin: 0; }
.daily-panel { padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
#time-dialog h2 { margin-top: 0; }
#time-message { color: var(--error); }
.live-time { width: 100%; font-size: 18px; }
#delete-message { color: var(--error); }
.edit-form { margin-top: 20px; }
.edit-form .manual-time { padding: 0; }
[hidden] { display: none !important; }
#edit-message { color: var(--error); font-size: 13px; }
.event-details small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
footer { color: var(--muted); font-size: 11px; text-align: center; padding: 12px; }
.role-dialog, .settings-dialog { width: min(440px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 25px; border: 0; border-radius: 22px; color: var(--text); background: var(--surface); box-shadow: 0 25px 80px var(--shadow-strong); }
.role-dialog::backdrop, .settings-dialog::backdrop { background: var(--backdrop); }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-heading h2 { margin: 0; }
.role-dialog h2 { margin: 8px 0 10px; }
.role-dialog p { margin: 0 0 19px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.role-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.role-options button { min-height: 49px; border: 1px solid var(--border); border-radius: 12px; background: var(--soft); color: var(--accent); font-weight: 750; }
.role-options button:hover { border-color: var(--outline); background: var(--selected); }

@media (max-width: 620px) {
  .app-shell { padding: 18px 12px 32px; }
  .topbar { padding-top: 58px; }
  .top-actions { top: 0; }
  .emblem-image { width: min(300px, calc(100vw - 48px)); }
  .role-chip { max-width: 128px; }
  .overview { gap: 6px; }
  .summary-column { grid-template-rows: 28px auto; gap: 6px; }
  .summary-card { padding: 12px 8px; grid-template-rows: 40px 22px; gap: 6px; border-radius: 14px; }
  .summary-column .summary-label { padding: 0; font-size: clamp(13px, 3.65vw, 21px); letter-spacing: -.025em; }
  .summary-card .summary-time { font-size: clamp(16px, 4.2vw, 26px); }
  .summary-card .summary-status { font-size: clamp(10px, 2.6vw, 16px); }
  .panel { padding: 17px; }
  .event-button { min-height: 100px; gap: 8px; padding: 12px 4px; font-size: clamp(14px, 4vw, 18px); }
  .event-button-icon { font-size: 34px; }
  .manual-time { grid-template-columns: 1fr 1fr; gap: 8px; }
  .time-preset { min-height: 44px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .save-button { width: 100%; }
  .timeline li { gap: 8px; padding: 12px 8px; }
  .event-icon { width: 36px; height: 40px; font-size: 23px; }
  .event-details strong { font-size: 15px; }
  .event-description { font-size: 12px; }
  .event-time { width: 65px; }
  .event-time time { font-size: 23px; }
}

@media (max-width: 380px) {
  .timeline-panel .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .timeline-date { width: 100%; }
}

@media (max-width: 620px) {
  .summary-column .summary-label, .event-button { font-size: clamp(13px, 3.7vw, 18px); font-weight: 750; }
  .timeline-panel .section-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .timeline-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .timeline-controls .timeline-date { width: 100%; min-width: 0; font-size: 13px; padding: 0 6px; }
  .manual-time input { min-width: 0; }
}

.feeding-options { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 12px; }
.feeding-options .checkbox-label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.feeding-hint { color: var(--muted); font-size: 14px; margin: 6px 0; }
.solids-comment { display: grid; gap: 6px; margin-top: 14px; }
.solids-comment textarea { box-sizing: border-box; width: 100%; min-height: 80px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 16px; resize: vertical; }
.solids-comment[hidden], #formula-volume[hidden], #edit-feeding[hidden], #edit-volume-field[hidden] { display: none; }
.event-description { overflow-wrap: anywhere; white-space: pre-wrap; }
