:root {
  --bg: #f8fbff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --ink: #071633;
  --muted: #526584;
  --soft: #eef4fb;
  --line: #dfe7f1;
  --green: #079b68;
  --green-dark: #087553;
  --green-soft: #e9f8f1;
  --red: #e21f33;
  --red-soft: #fff0f2;
  --orange: #f28a00;
  --orange-soft: #fff5e9;
  --blue: #2c7df2;
  --blue-soft: #eef5ff;
  --violet: #8b55e6;
  --violet-soft: #f5efff;
  --teal: #0aa6a6;
  --teal-soft: #edfafa;
  --shadow: 0 24px 70px rgba(20, 44, 84, 0.11);
  --shadow-soft: 0 12px 38px rgba(20, 44, 84, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 55% -10%, rgba(216, 234, 255, 0.64), transparent 36%),
    linear-gradient(135deg, #fbfdff 0%, #f7fbff 46%, #f9fcff 100%);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding: 48px 26px 34px;
  background: rgba(255, 255, 255, 0.62);
  border-right: 1px solid rgba(223, 231, 241, 0.9);
  backdrop-filter: blur(18px);
}

.brand,
.child-button,
.account-card,
.help-card {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  background: linear-gradient(135deg, #42bea2, #087553);
  box-shadow: 0 12px 28px rgba(7, 117, 83, 0.2);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.brand h1,
.topbar h2,
.panel-header h3,
.modal h2,
.section-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand .eyebrow {
  color: var(--ink);
  font-size: 22px;
  text-transform: none;
}

.section-heading,
.panel-header,
.topbar,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2,
.section-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.section-kicker {
  margin: 28px 0 14px;
}

.icon-button,
.quiet-button,
.primary-action,
.nav-tab,
.child-button,
.quick-action,
.mobile-menu,
.bottom-new-episode {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--green);
  font-size: 24px;
  font-weight: 500;
  box-shadow: var(--shadow-soft);
}

.child-list,
.nav-tabs {
  display: grid;
  gap: 14px;
}

.child-button {
  position: relative;
  grid-template-columns: 62px 1fr 24px;
  gap: 14px;
  width: 100%;
  min-height: 108px;
  padding: 18px 20px;
  text-align: left;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.child-button.active {
  border-color: #d9e8f1;
}

.avatar {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffe7da 0 18%, transparent 19%),
    linear-gradient(135deg, #f9c9ad, #f8e0d8);
  color: #9a5b40;
  font-size: 22px;
  font-weight: 900;
}

.child-name {
  display: block;
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 900;
}

.child-age,
.account-card span,
.help-card span {
  display: block;
  color: var(--muted);
  font-size: 15px;
}

.child-caret {
  color: var(--ink);
  font-size: 18px;
}

.nav-tabs {
  margin-top: 0;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(232, 248, 241, 0.95), rgba(239, 249, 247, 0.82));
  color: var(--green-dark);
}

.nav-icon {
  display: grid;
  place-items: center;
  min-width: 26px;
  color: currentColor;
  font-size: 25px;
  line-height: 1;
}

.help-card {
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
  padding: 18px 20px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.help-card strong,
.account-card strong {
  display: block;
  margin-bottom: 6px;
}

.help-card > span:last-child {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 22px;
}

.account-card {
  gap: 14px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e9eef6;
  color: var(--ink);
  font-weight: 900;
}

.account-card > span:last-child {
  margin-left: auto;
}

.main-content {
  min-width: 0;
  padding: 46px 38px 38px;
}

.topbar {
  margin: 0 auto 38px;
  max-width: 1180px;
}

.mobile-menu {
  display: none;
}

.topbar h2 {
  font-size: 40px;
  line-height: 1.06;
}

#current-child-label {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.topbar-copy,
.panel-copy {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 28px;
  background: linear-gradient(135deg, #12a974, #058a61);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 18px 30px rgba(7, 142, 99, 0.24);
}

.primary-action.full {
  width: 100%;
}

.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  background: #f1f3f7;
  color: var(--muted);
  font-weight: 900;
}

.quiet-button::before {
  content: "▣";
  margin-right: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.live-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.08fr) minmax(380px, 0.8fr);
  gap: 28px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
}

.active-panel,
.timeline-panel,
.metric-panel,
.report-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.active-panel,
.timeline-panel {
  padding: 28px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.panel-header h3 {
  font-size: 25px;
}

.panel-header.compact {
  margin-bottom: 18px;
}

.episode-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 26px 0 0;
}

.meta-box {
  display: grid;
  grid-template-columns: 56px 1fr;
  column-gap: 14px;
  align-items: center;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.meta-box .eyebrow {
  grid-column: 2;
  margin: 0;
  font-size: 12px;
}

.meta-box strong {
  display: block;
  grid-column: 2;
  margin-top: 4px;
  font-size: 19px;
}

.meta-icon {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  font-size: 27px;
}

.meta-icon.status {
  background: var(--green-soft);
  color: var(--green);
}

.meta-icon.child {
  background: var(--blue-soft);
  color: var(--blue);
}

.meta-icon.action {
  background: var(--violet-soft);
  color: var(--violet);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.quick-action {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 118px;
  padding: 18px;
  color: var(--ink);
  text-align: center;
  font-size: 16px;
  font-weight: 900;
}

.quick-action::before {
  display: block;
  font-size: 36px;
  line-height: 1;
}

.quick-action.temperature {
  background: linear-gradient(135deg, var(--red-soft), #fff7f7);
  color: var(--red);
}

.quick-action.temperature::before {
  content: "♨";
}

.quick-action.symptom {
  background: linear-gradient(135deg, var(--orange-soft), #fffaf5);
}

.quick-action.symptom::before {
  content: "☹";
  color: var(--orange);
}

.quick-action.medicine {
  background: linear-gradient(135deg, var(--blue-soft), #f8fbff);
}

.quick-action.medicine::before {
  content: "◧";
  color: var(--blue);
}

.quick-action.note {
  background: linear-gradient(135deg, var(--green-soft), #f8fffb);
}

.quick-action.note::before {
  content: "▤";
  color: var(--green);
}

.quick-action.sleep {
  background: linear-gradient(135deg, var(--violet-soft), #fbf8ff);
}

.quick-action.sleep::before {
  content: "☾";
  color: var(--violet);
}

.quick-action.doctor {
  background: linear-gradient(135deg, var(--teal-soft), #f5ffff);
}

.quick-action.doctor::before {
  content: "♙";
  color: var(--teal);
}

.quick-action:disabled {
  cursor: not-allowed;
}

.quiet-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.fever-alert {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  align-items: center;
  margin: 24px 0 0;
  padding: 18px;
  border: 1px solid #f0b8aa;
  border-radius: 14px;
  background: #fff4f1;
}

.fever-alert[hidden] {
  display: none;
}

.fever-alert.resolved {
  border-color: #a9d9c6;
  background: #effaf4;
}

.thermometer {
  position: relative;
  width: 48px;
  height: 98px;
  margin: 0 auto;
}

.thermometer-stem {
  position: absolute;
  left: 17px;
  top: 6px;
  width: 14px;
  height: 68px;
  border-radius: 999px;
  background: #e6e6e6;
  border: 3px solid #b83e2b;
  overflow: hidden;
}

.thermometer-stem::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 70%;
  border-radius: 999px;
  background: #d8432e;
  animation: fever-pulse 900ms ease-in-out infinite alternate;
}

.thermometer-bulb {
  position: absolute;
  left: 8px;
  bottom: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #d8432e;
  border: 3px solid #b83e2b;
  box-shadow: 0 0 0 8px rgba(216, 67, 46, 0.12);
  animation: fever-glow 900ms ease-in-out infinite alternate;
}

.fever-alert.resolved .thermometer-stem {
  border-color: var(--green);
}

.fever-alert.resolved .thermometer-stem::after,
.fever-alert.resolved .thermometer-bulb {
  background: var(--green);
  border-color: var(--green);
  animation: none;
}

.fever-alert.resolved .thermometer-bulb {
  box-shadow: 0 0 0 8px rgba(35, 120, 90, 0.12);
}

.fever-title {
  margin: 0 0 4px;
  font-weight: 900;
}

.fever-message {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.fever-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
}

.fever-alert.resolved .fever-button {
  display: none;
}

.medicine-followup {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfa;
}

@keyframes fever-pulse {
  from {
    height: 52%;
  }
  to {
    height: 86%;
  }
}

@keyframes fever-glow {
  from {
    transform: scale(1);
    box-shadow: 0 0 0 7px rgba(216, 67, 46, 0.12);
  }
  to {
    transform: scale(1.08);
    box-shadow: 0 0 0 13px rgba(216, 67, 46, 0.2);
  }
}

.timeline {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 230px);
  overflow: auto;
  padding-right: 4px;
}

.timeline-item,
.history-item {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.timeline-time {
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
}

.timeline-title,
.history-title {
  margin: 0 0 4px;
  font-weight: 900;
}

.timeline-detail,
.history-detail {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 390px;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.empty-illustration {
  position: relative;
  display: grid;
  place-items: center;
  width: 168px;
  height: 150px;
  margin-bottom: 8px;
}

.empty-illustration::before {
  content: "";
  position: absolute;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8f8f1, #f6fbfd);
}

.clipboard-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 82px;
  height: 100px;
  border: 8px solid #c8e8df;
  border-radius: 10px;
  background: #fafdff;
  color: #ff6677;
  font-size: 28px;
  box-shadow: 0 12px 22px rgba(20, 44, 84, 0.08);
}

.empty-state p {
  max-width: 360px;
  margin: 10px 0 20px;
  font-size: 17px;
  line-height: 1.5;
}

.inline-new-episode {
  min-height: 52px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
}

.metric-panel,
.report-panel {
  padding: 22px;
}

.metric-panel strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.report-panel {
  grid-column: span 2;
}

.report-panel ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.history-list {
  display: grid;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
}

.mobile-child-card,
.bottom-nav {
  display: none;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0;
}

.modal::backdrop {
  background: rgba(7, 22, 51, 0.36);
}

.modal-content {
  display: grid;
  gap: 14px;
  padding: 24px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .live-grid {
    grid-template-columns: 1fr;
  }

  .timeline {
    max-height: none;
  }
}

@media (max-width: 840px) {
  body {
    background: #fbfdff;
  }

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

  .sidebar {
    display: none;
  }

  .main-content {
    padding: 34px 18px 0;
  }

  .topbar {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) auto;
    align-items: start;
    gap: 18px;
    margin-bottom: 26px;
  }

  .mobile-menu {
    display: grid;
    place-items: center;
    width: 82px;
    height: 82px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    color: var(--ink);
    font-size: 31px;
    box-shadow: var(--shadow-soft);
  }

  .topbar h2 {
    font-size: 34px;
  }

  #current-child-label {
    margin-top: 10px;
    font-size: 20px;
  }

  .topbar-copy {
    margin-top: 18px;
    font-size: 20px;
    line-height: 1.35;
  }

  .topbar .primary-action {
    min-width: 216px;
    min-height: 72px;
    border-radius: 14px;
    font-size: 19px;
  }

  .mobile-child-card {
    display: block;
    margin: 0 0 28px;
  }

  .mobile-child-card .child-button {
    min-height: 140px;
    border-radius: 22px;
    padding: 24px 30px;
  }

  .mobile-child-card .avatar {
    width: 78px;
    height: 78px;
  }

  .mobile-child-card .child-name {
    font-size: 26px;
  }

  .mobile-child-card .child-age {
    font-size: 22px;
  }

  .live-grid {
    gap: 28px;
  }

  .active-panel,
  .timeline-panel {
    padding: 38px;
    border-radius: 24px;
  }

  .panel-title-row {
    gap: 16px;
  }

  .status-pill {
    min-height: 42px;
    font-size: 18px;
  }

  .panel-header {
    align-items: start;
  }

  .panel-header h3 {
    font-size: 28px;
  }

  .panel-copy {
    font-size: 20px;
  }

  .quiet-button {
    min-height: 60px;
    padding: 0 22px;
    font-size: 18px;
  }

  .episode-meta {
    gap: 16px;
  }

  .meta-box {
    min-height: 112px;
    padding: 16px;
  }

  .meta-box strong {
    font-size: 21px;
  }

  .quick-actions {
    gap: 18px;
  }

  .quick-action {
    min-height: 140px;
    border-radius: 14px;
    font-size: 20px;
  }

  .timeline-panel .empty-state {
    grid-template-columns: 190px 1fr;
    place-items: center start;
    min-height: 240px;
    text-align: left;
    border: 1px solid var(--line);
  }

  .timeline-panel .empty-state p {
    font-size: 20px;
  }

  .bottom-nav {
    position: sticky;
    bottom: 18px;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    min-height: 94px;
    margin: 28px 18px 18px;
    padding: 12px 12px 16px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 20px 56px rgba(20, 44, 84, 0.18);
    backdrop-filter: blur(20px);
  }

  .bottom-nav .nav-tab {
    display: grid;
    justify-items: center;
    gap: 8px;
    min-height: 62px;
    padding: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
  }

  .bottom-nav .nav-tab.active {
    color: var(--green);
  }

  .bottom-nav .nav-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 28px;
  }

  .bottom-nav .nav-tab.active .nav-icon {
    background: var(--green-soft);
  }

  .bottom-new-episode {
    display: grid;
    place-items: center;
    width: 78px;
    height: 78px;
    min-height: 78px;
    margin: -34px auto 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #13ad78, #058a61);
    color: white;
    font-size: 42px;
    box-shadow: 0 18px 32px rgba(7, 142, 99, 0.28);
  }
}

@media (max-width: 620px) {
  .main-content {
    padding: 24px 18px 0;
  }

  .topbar {
    grid-template-columns: 64px minmax(0, 1fr) 136px;
    gap: 10px;
  }

  .mobile-menu {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    font-size: 28px;
  }

  .topbar .primary-action {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    min-width: 136px;
    min-height: 58px;
    padding: 0 12px;
    font-size: 14px;
  }

  .topbar h2 {
    font-size: 30px;
  }

  #current-child-label,
  .topbar-copy {
    font-size: 18px;
  }

  .mobile-child-card .child-button {
    min-height: 116px;
    padding: 20px;
  }

  .mobile-child-card .avatar {
    width: 66px;
    height: 66px;
  }

  .mobile-child-card .child-name {
    font-size: 22px;
  }

  .mobile-child-card .child-age {
    font-size: 18px;
  }

  .active-panel,
  .timeline-panel {
    padding: 26px 20px;
    border-radius: 22px;
  }

  .episode-meta,
  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .meta-box {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    min-height: 112px;
    padding: 12px 8px;
  }

  .meta-icon {
    grid-row: auto;
    width: 44px;
    height: 44px;
    margin-bottom: 8px;
    font-size: 22px;
  }

  .meta-box .eyebrow,
  .meta-box strong {
    grid-column: 1;
  }

  .meta-box .eyebrow {
    font-size: 10px;
  }

  .meta-box strong {
    font-size: 16px;
  }

  .quick-action {
    min-height: 112px;
    padding: 12px 8px;
    font-size: 15px;
  }

  .quick-action::before {
    font-size: 30px;
  }

  .timeline-panel .empty-state,
  .timeline-item,
  .history-item {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .timeline-panel .empty-state {
    place-items: center;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .report-panel {
    grid-column: auto;
  }

  .modal-content {
    padding: 20px;
  }
}
