:root {
  --ink: #24312d;
  --muted: #66756f;
  --line: #d9e2dd;
  --paper: #ffffff;
  --mist: #f3f7f4;
  --leaf: #427b58;
  --leaf-dark: #2f5d42;
  --coral: #c8664a;
  --sky: #4f7f9f;
  --gold: #d8aa45;
  --shadow: 0 18px 45px rgba(36, 49, 45, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(79, 127, 159, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(199, 109, 79, 0.18), transparent 36%),
    var(--mist);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(360px, 440px);
  justify-content: center;
  gap: 32px;
  min-height: 100vh;
  padding: 32px;
}

.sidebar {
  align-self: center;
  height: min(760px, calc(100vh - 64px));
  min-height: 0;
  border: 1px solid rgba(66, 123, 88, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 999px;
  color: white;
  font-weight: 800;
}

.brand-mark {
  width: 42px;
  height: 42px;
  background: var(--leaf);
}

.brand strong,
.brand span,
.privacy-note span,
.nav-item span {
  display: block;
}

.brand span,
.privacy-note span {
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 12px;
  text-align: left;
}

.nav-item.is-active {
  background: var(--leaf);
  color: white;
}

.nav-icon {
  width: 34px;
  border-radius: 999px;
  background: rgba(36, 49, 45, 0.08);
  padding: 6px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.nav-item.is-active .nav-icon {
  background: rgba(255, 255, 255, 0.2);
}

.privacy-note {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.phone-frame {
  position: relative;
  align-self: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 34px;
  background: var(--mist);
  box-shadow: inset 0 0 0 1px rgba(36, 49, 45, 0.08);
}

.iphone-device {
  position: relative;
  align-self: center;
  width: min(430px, calc(100vw - 64px));
  height: min(820px, calc(100vh - 64px));
  border: 10px solid #151918;
  border-radius: 48px;
  background:
    linear-gradient(145deg, #2f3734, #101312 34%, #252c29);
  box-shadow:
    0 28px 70px rgba(36, 49, 45, 0.24),
    0 8px 20px rgba(36, 49, 45, 0.16),
    inset 0 0 0 2px rgba(255, 255, 255, 0.08);
  padding: 12px;
}

.iphone-device::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: 52px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(36, 49, 45, 0.22));
}

.dynamic-island {
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 5;
  width: 118px;
  height: 32px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #0c0f0e;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.dynamic-island::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #253b45, #080a0a 70%);
}

.home-indicator {
  position: absolute;
  right: 50%;
  bottom: 18px;
  z-index: 5;
  width: 132px;
  height: 5px;
  transform: translateX(50%);
  border-radius: 999px;
  background: rgba(36, 49, 45, 0.38);
}

.iphone-button {
  position: absolute;
  display: block;
  width: 4px;
  border-radius: 999px;
  background: #111514;
}

.power-button {
  right: -14px;
  top: 150px;
  height: 88px;
}

.volume-button {
  left: -14px;
  height: 64px;
}

.volume-button.top {
  top: 126px;
}

.volume-button.bottom {
  top: 204px;
}

.screen {
  display: none;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: 64px 20px 48px;
  scrollbar-gutter: stable;
}

.screen.is-visible {
  display: block;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

[data-screen="drafts"] .screen-header {
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--leaf);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.status-pill,
.ghost-button,
.text-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--leaf-dark);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 11px;
}

.setup-steps,
.draft-list,
.profile-stack,
.settings-list,
.timeline {
  display: grid;
  gap: 12px;
}

.setup-step,
.event-row,
.child-card,
.setting-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: left;
}

.setup-step > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--leaf);
  font-weight: 900;
}

.setup-step.is-done > span {
  background: var(--leaf);
  color: white;
}

.setup-step strong,
.setup-step small {
  display: block;
}

small {
  color: var(--muted);
}

.naming-tip,
.alert-card,
.role-card,
.draft-card,
.profile-card {
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 24px rgba(36, 49, 45, 0.08);
}

.naming-tip {
  display: grid;
  gap: 6px;
  margin: 18px 0;
  border-left: 4px solid var(--sky);
  padding: 15px;
}

.naming-tip span {
  color: var(--muted);
  line-height: 1.45;
}

.primary-action,
.secondary-action,
.compact-action {
  width: 100%;
  border: 0;
  border-radius: 8px;
  font-weight: 850;
}

.primary-action {
  background: var(--leaf);
  color: white;
  padding: 14px 16px;
}

.primary-action:hover {
  background: var(--leaf-dark);
}

.secondary-action {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 14px 16px;
}

.compact-action {
  margin-top: 14px;
  background: var(--ink);
  color: white;
  padding: 11px 14px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.summary-strip div {
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.summary-strip strong,
.summary-strip span {
  display: block;
}

.summary-strip strong {
  font-size: 24px;
}

.summary-strip span {
  color: var(--muted);
  font-size: 12px;
}

.alert-card {
  border-left: 5px solid var(--coral);
  padding: 16px;
}

.alert-card h2 {
  margin-bottom: 6px;
}

.content-section {
  margin-top: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 17px;
}

.text-link {
  padding: 7px 10px;
}

.child-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.child-card {
  display: grid;
  gap: 8px;
  padding: 15px;
  text-align: left;
}

.avatar {
  width: 44px;
  height: 44px;
}

.avatar.lena {
  background: var(--leaf);
}

.avatar.mats {
  background: var(--sky);
}

.avatar.new-child {
  background: var(--gold);
}

.child-card em {
  color: var(--coral);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.event-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  padding: 14px;
  text-align: left;
}

.event-row time {
  color: var(--leaf-dark);
  font-weight: 900;
}

.event-row span,
.draft-meta span,
.calendar-writeback span {
  color: var(--muted);
  font-size: 13px;
}

.needs-choice {
  border-color: rgba(216, 170, 69, 0.7);
  background: #fff9e9;
}

.profile-card {
  padding: 16px;
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-top h2 {
  margin: 0 0 4px;
}

.profile-top p {
  margin: 0;
}

.profile-facts {
  display: grid;
  gap: 9px;
  margin: 16px 0 0;
}

.profile-facts div,
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-facts dt {
  color: var(--muted);
  font-size: 13px;
}

.profile-facts dd {
  margin: 0;
  font-weight: 800;
}

.profile-edit {
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mist);
  color: var(--leaf-dark);
  font-size: 13px;
  font-weight: 850;
  padding: 10px 12px;
}

.draft-card {
  padding: 14px;
}

.answer-tabs {
  position: sticky;
  top: -64px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: rgba(243, 247, 244, 0.94);
  padding: 5px;
  backdrop-filter: blur(12px);
}

.answer-tab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.answer-tab.is-active {
  background: white;
  color: var(--leaf-dark);
  box-shadow: 0 6px 18px rgba(36, 49, 45, 0.08);
}

.is-hidden {
  display: none;
}

.draft-card.is-urgent {
  border-top: 4px solid var(--coral);
}

.draft-card.message-burst {
  border: 1px solid rgba(79, 127, 159, 0.28);
  background:
    linear-gradient(180deg, rgba(79, 127, 159, 0.08), transparent 112px),
    white;
}

.draft-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

blockquote {
  margin: 10px 0 0;
  border-radius: 8px;
  background: var(--mist);
  padding: 11px;
  color: var(--ink);
  line-height: 1.42;
}

.calendar-writeback {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  border: 1px solid rgba(66, 123, 88, 0.28);
  border-radius: 8px;
  background: #f5fbf7;
  padding: 11px;
}

.summary-box {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  border: 1px solid rgba(79, 127, 159, 0.24);
  border-radius: 8px;
  background: #f4f8fb;
  padding: 10px 11px;
}

.summary-box strong {
  color: var(--ink);
}

.summary-box ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.calendar-writeback strong,
.calendar-writeback span {
  display: block;
}

.reply-options {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.reply-option {
  flex: 1 0 96px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  padding: 8px 9px;
}

.reply-option.is-selected {
  border-color: var(--leaf);
  background: var(--leaf);
  color: white;
}

.custom-reply {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.custom-reply span,
.child-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.custom-reply textarea,
.child-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px;
  resize: vertical;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.button-row.three-actions {
  grid-template-columns: 1fr 1fr 1fr;
}

.small {
  padding: 10px 11px;
  font-size: 13px;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.history-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-card span {
  color: var(--muted);
  font-size: 13px;
}

.history-card p {
  margin: 9px 0 0;
}

.setting-row {
  padding: 14px;
}

.setting-row span,
.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row select,
.setting-row input {
  max-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mist);
  color: var(--ink);
  padding: 9px 10px;
}

.role-card {
  margin-top: 18px;
  padding: 16px;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-list span {
  border-radius: 999px;
  background: var(--mist);
  color: var(--leaf-dark);
  font-size: 12px;
  font-weight: 850;
  padding: 8px 10px;
}

.bottom-nav {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  border: 1px solid rgba(217, 226, 221, 0.82);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  padding: 7px;
  box-shadow: 0 -10px 28px rgba(36, 49, 45, 0.1);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  min-width: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 850;
}

.bottom-nav button.is-active {
  background: var(--leaf);
  color: white;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(20px);
  opacity: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 12px 14px;
  transition: 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.child-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow);
}

.chat-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  border: 0;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow);
}

.chat-dialog::backdrop {
  background: rgba(36, 49, 45, 0.34);
  backdrop-filter: blur(4px);
}

.chat-reader {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.chat-thread {
  display: grid;
  gap: 9px;
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-thread li {
  border-radius: 8px;
  background: var(--mist);
  color: var(--muted);
  line-height: 1.45;
  padding: 10px 12px;
}

.chat-thread strong {
  color: var(--ink);
}

.child-dialog::backdrop {
  background: rgba(36, 49, 45, 0.32);
  backdrop-filter: blur(4px);
}

.child-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 24px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-weight: 900;
}

.child-form label {
  display: grid;
  gap: 7px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid label:first-child {
  grid-column: 1 / -1;
}

.planning-note {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(79, 127, 159, 0.24);
  border-radius: 8px;
  background: #f4f8fb;
  padding: 10px 11px;
}

.planning-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  text-align: left;
}

.choice-button:hover {
  border-color: var(--leaf);
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
    padding: 0;
  }

  .sidebar {
    display: none;
  }

  .phone-frame {
    height: calc(100vh - 62px);
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .iphone-device {
    width: 100vw;
    height: calc(100vh - 62px);
    border: 0;
    border-radius: 0;
    background: var(--mist);
    box-shadow: none;
    padding: 0;
  }

  .iphone-device::before,
  .iphone-button {
    display: none;
  }

  .dynamic-island {
    top: 10px;
  }

  .screen {
    height: 100%;
    min-height: 0;
    padding: 54px 20px 82px;
  }

  .answer-tabs {
    top: -54px;
  }

  .home-indicator {
    display: none;
  }

  .bottom-nav {
    right: 8px;
    bottom: 8px;
    left: 8px;
  }

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

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

  .button-row.three-actions {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}
