:root {
  color-scheme: light;
  --ink: #241c16;
  --muted: #6f655c;
  --line: #e6dccb;
  --paper: #fbfaf6;
  --pane: #f3eee4;
  --green: #0e6b4f;
  --green-deep: #0a4d3a;
  --green-soft: #e7f4ee;
  --amber: #8a5a16;
  --navy: #2c4c6e;
  --danger: #8d2f2f;
  --shadow: 0 24px 60px rgba(36, 32, 24, 0.12);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Manrope, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background:
    radial-gradient(circle at 8% 0, rgba(255, 248, 230, 0.9), transparent 32%),
    radial-gradient(circle at 100% 100%, rgba(14, 107, 79, 0.16), transparent 36%),
    #dce8e2;
  padding: 16px;
}

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

button { cursor: pointer; }

a { color: var(--green-deep); text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: auto;
  background:
    radial-gradient(circle at 8% 0, rgba(255, 248, 230, 0.9), transparent 32%),
    radial-gradient(circle at 100% 100%, rgba(14, 107, 79, 0.18), transparent 36%),
    #dce8e2;
}

.gate[hidden], .app[hidden], .gate-card[hidden] { display: none; }

.gate-card {
  width: min(480px, 100%);
  max-height: calc(100dvh - 44px);
  overflow: auto;
  margin: auto;
  background: var(--paper);
  border-radius: 28px;
  padding: 26px 24px 22px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.gate-card h1 {
  margin: 0 0 8px;
  font-family: Newsreader, Georgia, serif;
  font-size: 44px;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.gate-lead { margin: 0 0 16px; color: var(--muted); }

.gate-card fieldset {
  margin: 0 0 12px;
  padding: 12px 12px 4px;
  border: 0;
  border-radius: 18px;
  background: #f7f3ec;
}

.gate-card legend { padding: 0; font-weight: 700; }

.gate-card label { display: block; margin: 10px 0; }

.gate-card label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.gate-card input {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: white;
  box-shadow: inset 0 0 0 1px var(--line);
}

.gate-error {
  min-height: 1.3em;
  margin: 4px 0 10px;
  color: var(--danger);
  font-size: 14px;
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 10px;
  color: var(--muted);
  font-size: 13px;
}

.app {
  height: calc(100dvh - 32px);
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  background: var(--paper);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.list-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, #f7f3ea 0, var(--pane) 120px);
  border-right: 1px solid var(--line);
}

.pane-head { padding: 20px 16px 12px; }

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

.mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: linear-gradient(160deg, #1a8a68, var(--green-deep));
  color: #f6fff9;
  display: grid;
  place-items: center;
  font-family: Newsreader, Georgia, serif;
  font-size: 24px;
  flex: none;
  box-shadow: 0 8px 16px rgba(14, 107, 79, 0.22);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

h1 {
  margin: 1px 0 0;
  font-family: Newsreader, Georgia, serif;
  font-size: 34px;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.local-note {
  margin: 10px 2px 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.bday-launch {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fff4f7);
  box-shadow: inset 0 0 0 1px #f0d4de;
}

.bday-launch:hover { background: #fff; }

.bday-launch-text { display: flex; flex-direction: column; min-width: 0; }

.bday-launch strong { font-size: 14px; }

.bday-launch em {
  font-style: normal;
  color: #8a4d62;
  font-size: 12px;
}

.bday-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  flex: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none'%3E%3Cpath d='M11 3.2c.4 1.3 1.6 2.2 2.6 2.2S16 4.4 16.2 3.2C16.6 5 15.2 6.6 13.6 6.6S10.6 5 11 3.2Z' fill='%23e07a9a'/%3E%3Cpath d='M6 9.2h10l-.7 8.2a2 2 0 0 1-2 1.8H8.7a2 2 0 0 1-2-1.8L6 9.2Z' fill='%23f6c14d'/%3E%3Cpath d='M5.2 8h11.6c.5 0 .8.4.7.9l-.2.8H4.7l-.2-.8c-.1-.5.2-.9.7-.9Z' fill='%23fff' stroke='%23e7b4c3'/%3E%3C/svg%3E") center / 22px no-repeat,
    linear-gradient(180deg, #ffe7ee, #ffd5e2);
}

.bday {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(36, 28, 22, 0.42);
}

.bday[hidden] { display: none; }

.bday-window {
  width: min(440px, 100%);
  max-height: min(680px, calc(100dvh - 44px));
  overflow: auto;
  background: #fffdfb;
  border-radius: 24px;
  padding: 16px 16px 18px;
  box-shadow: 0 24px 70px rgba(36, 28, 22, 0.28);
}

.bday-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: -16px;
  background: #fffdfb;
  padding-bottom: 8px;
  margin: 0 0 6px;
}

.bday-head h2 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: 30px;
  font-weight: 560;
  letter-spacing: -0.03em;
}

.bday-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f4efe8;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.bday-today, .bday-window section + section { margin-top: 8px; }

.bday-window h3 {
  margin: 8px 2px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a4d66;
}

.bday-window section + section h3 { color: var(--muted); }

.bday-date {
  margin: 14px 2px 6px;
  font-size: 14px;
  font-weight: 700;
}

.bday-date span {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.bday-person {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 7px 6px;
}

.bday-today .bday-person { background: #fff4f7; }

.bday-person:hover { background: #f7f3ec; }

.bday-person-text { display: flex; flex-direction: column; min-width: 0; }

.bday-person strong { font-size: 14px; }

.bday-person em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.bday-empty {
  margin: 0 2px 8px;
  color: var(--muted);
  font-size: 14px;
}

.search input {
  padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236f655c' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5L14 14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 13px 50%;
}

.filters { display: grid; gap: 8px; margin-top: 8px; }

input, select, textarea {
  width: 100%;
  border: 1px solid #e3d8c8;
  background: rgba(255, 253, 249, 0.92);
  border-radius: 12px;
  padding: 9px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea { min-height: 88px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--green);
  border-color: transparent;
}

.btn {
  border: 0;
  background: linear-gradient(180deg, #178666, var(--green-deep));
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(14, 107, 79, 0.18);
}

.btn:hover { filter: brightness(1.06); }

.btn:active { transform: translateY(1px); }

.btn.block { width: 100%; margin-top: 10px; }

.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--green-deep);
  box-shadow: inset 0 0 0 1px #c5ddd3;
}

.btn.ghost:hover { background: var(--green-soft); }

.btn.danger, .text-btn.danger { color: var(--danger); }

.btn.danger {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px #e7c8c8;
}

.btn.danger:hover { background: #f8ecec; }

.shown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  min-height: 1.2em;
}

.shown span {
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  box-shadow: inset 0 0 0 1px rgba(228, 217, 200, 0.9);
}

.shown b { color: var(--ink); font-weight: 700; }

.list { overflow: auto; min-height: 0; padding: 4px 8px 16px; }

.person {
  border-radius: 16px;
  margin-bottom: 6px;
  background: rgba(255, 252, 247, 0.55);
  box-shadow: inset 0 0 0 1px rgba(228, 217, 200, 0.65);
}

.person:hover { background: #fffdf8; }

.person.is-selected {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--green), 0 8px 20px rgba(36, 42, 34, 0.06);
}

.person-main {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 10px 4px 12px;
}

.person-body { min-width: 0; flex: 1; }

.systems {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 10px 10px 62px;
}

.detail .systems, .hero .systems { padding: 12px 0 0; }

.sys {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  border-radius: 999px;
  padding: 4px 9px 4px 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sys:hover { transform: translateY(-1px); }

.sys input {
  appearance: none;
  width: 15px;
  height: 15px;
  margin: 0;
  border-radius: 5px;
  border: 1.5px solid currentColor;
  background: transparent;
  display: grid;
  place-items: center;
}

.sys input:checked::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translate(0.5px, -1px);
}

.sys-tentorium {
  color: #8a6408;
  background: #fff6d8;
  box-shadow: inset 0 0 0 1px #ead48a;
}

.sys-mint {
  color: #1d4e89;
  background: #e8f1fb;
  box-shadow: inset 0 0 0 1px #b9d0ea;
}

.sys-leaf {
  color: #1d6b3a;
  background: #e7f6ec;
  box-shadow: inset 0 0 0 1px #b7dcc4;
}

.sys-tentorium.is-on { background: #f5c518; color: #3d2c00; box-shadow: none; }
.sys-mint.is-on { background: #2f6fdb; color: #fff; box-shadow: none; }
.sys-leaf.is-on { background: #1f8a45; color: #fff; box-shadow: none; }

.sys-mint.is-on input,
.sys-leaf.is-on input { border-color: rgba(255, 255, 255, 0.85); }

.sys-mint.is-on input:checked::after,
.sys-leaf.is-on input:checked::after { border-color: #fff; }

.row-top, .intake-top, .section-head, .who, .order-actions, .row-actions, .actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row-top { justify-content: space-between; align-items: baseline; gap: 10px; }

.nm {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cardno, .sub, .meta, .hint, .phone {
  color: var(--muted);
  font-size: 13px;
}

.cardno {
  font-variant-numeric: tabular-nums;
  flex: none;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 1px 7px;
}

.person .phone, .person .meta { display: block; margin: 1px 0 0; }

.meta {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.chip, .pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 650;
}

.chip-order, .chip-pill { color: var(--green-deep); background: var(--green-soft); }

.chip-wait { color: #8a6230; background: #fff3df; }

.chip-birth { color: #7a3e55; background: #fde8ef; }

.empty-list, .empty-detail {
  padding: 36px 22px;
  color: var(--muted);
}

.empty-detail {
  min-height: 70%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
}

.empty-detail .mark { margin-bottom: 8px; }

.detail { overflow: auto; min-width: 0; background: linear-gradient(180deg, #fcfbf8, #f7f4ee 280px); }

.detail-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 40px 80px;
}

.hero {
  background:
    radial-gradient(circle at 0 0, rgba(245, 197, 24, 0.16), transparent 42%),
    linear-gradient(180deg, #f4f8f5, rgba(255, 255, 255, 0.2));
  border-radius: 22px;
  padding: 16px 18px 14px;
  box-shadow: inset 0 0 0 1px rgba(183, 212, 200, 0.7);
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.who { flex: 1 1 240px; min-width: 0; align-items: center; gap: 14px; }

.who h2, .form-head h2, .empty-detail h2 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-size: 36px;
}

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: none;
  box-shadow: 0 8px 16px rgba(36, 32, 24, 0.12);
}

.avatar.sm {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 13px;
  box-shadow: none;
}

.actions, .row-actions, .order-actions { flex-wrap: wrap; }

.back { display: none; }

.banner {
  margin-top: 16px;
  padding: 14px 16px;
  background: #fff6e8;
  border-radius: 16px;
  color: #6a4b1d;
  box-shadow: inset 0 0 0 1px #f0ddb8;
}

.banner p { margin: 0 0 8px; }

.banner button {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 6px;
  border: 0;
  background: rgba(255, 255, 255, 0.55);
  color: #6a4b1d;
  font-weight: 700;
  border-radius: 10px;
  padding: 8px 10px;
}

.panel {
  margin-top: 16px;
  background: white;
  border-radius: 20px;
  padding: 6px 18px 16px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.section-title {
  margin: 22px 0 10px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.panel .section-title { margin-top: 12px; }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.contact-tile {
  background: #f7f4ee;
  border-radius: 14px;
  padding: 10px 12px 12px;
  min-width: 0;
}

.contact-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.contact-tile strong {
  display: block;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 9px 12px;
  margin: 0;
}

.facts dt { color: var(--muted); }

.facts dd { margin: 0; overflow-wrap: anywhere; }

.order-panel {
  margin-top: 16px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, 0.7), transparent 40%),
    var(--green-soft);
  border-radius: 20px;
  padding: 16px 18px 18px;
  box-shadow: inset 0 0 0 1px #cfe3d9;
}

.order-panel .section-title { margin-top: 0; }

.family .section-title { margin-top: 0; }

.mom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 14px;
}

.mom-row > span { color: var(--muted); }

.mom-switch { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.mom-btn {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: #f4efe8;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px transparent;
}

.mom-btn.works.is-on { background: #e7f6ec; box-shadow: inset 0 0 0 1px #1f8a45; color: #146b34; }

.mom-btn.home.is-on { background: #fff1e4; box-shadow: inset 0 0 0 1px #d9894a; color: #8a4e1d; }

.child-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.child-count span { color: var(--muted); }

.child-count select { width: 120px; background: white; }

.child-card {
  background: #faf7f2;
  border-radius: 16px;
  padding: 12px 12px 4px;
  margin: 0 0 10px;
  box-shadow: inset 0 0 0 1px #efe6da;
}

.child-card h4 { margin: 0 0 8px; font-size: 15px; }

.child-card label { display: block; margin-bottom: 10px; }

.child-card label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.child-card input, .child-card textarea { width: 100%; background: white; }

.child-card em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.family-hint { margin: 0 0 12px; }

.family [data-action="save-children"][hidden] { display: none; }

.when {
  margin: 0 0 12px;
  font-family: Newsreader, Georgia, serif;
  font-size: 42px;
  letter-spacing: -0.03em;
  line-height: 1;
}

.when.is-empty { color: #6e8f84; font-size: 32px; }

.order-actions input { max-width: 180px; background: white; }

.section-head { justify-content: flex-start; align-items: center; gap: 12px; }

.section-head .section-title { margin: 22px 0 0; }

.intake-lead { margin: 6px 0 0; }

h4 { margin: 18px 0 8px; font-size: 15px; }

.intake, .intake-form, .sheet {
  background: white;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.intake { margin-bottom: 10px; }

.intake.medication { box-shadow: inset 3px 0 0 var(--navy), inset 0 0 0 1px var(--line); }

.intake.vitamin { box-shadow: inset 3px 0 0 #c9852a, inset 0 0 0 1px var(--line); }

.intake h3 { margin: 2px 0 4px; font-size: 18px; }

.intake p { margin: 0; }

.kind {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.intake.medication .kind { color: var(--navy); }

.intake.vitamin .kind { color: var(--amber); }

.status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--green-deep);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 2px 8px;
}

.status.past { color: var(--muted); font-weight: 600; background: #f3efe8; }

.intake-form, .sheet { margin: 8px 0 14px; }

.empty-note, .note-text {
  margin: 0;
  color: var(--muted);
}

.note-text { color: var(--ink); }

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

.grid label, .form-head { display: block; }

.grid span, label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.grid .wide { grid-column: 1 / -1; }

.form-head { margin-bottom: 14px; }

.form-head h2 { font-size: 32px; }

.text-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--green-deep);
  font-weight: 700;
}

.row-actions { margin-top: 12px; }

.notes { margin-top: 8px; color: var(--ink); }

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 8px);
  background: #241c16;
  color: white;
  border-radius: 999px;
  padding: 11px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(440px, calc(100% - 32px));
  box-shadow: 0 12px 30px rgba(36, 28, 22, 0.28);
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  body { padding: 0; }

  .app {
    height: 100dvh;
    border-radius: 0;
    grid-template-columns: 1fr;
  }

  .app.show-detail .list-pane { display: none; }

  .app:not(.show-detail) .detail { display: none; }

  .back { display: inline-flex; margin-bottom: 8px; }

  .detail-inner { padding: 16px 14px 56px; }

  .hero { padding: 12px; }

  .who h2, .form-head h2 { font-size: 28px; }

  .facts, .grid, .contact-grid { grid-template-columns: 1fr; }

  .facts dd { margin-bottom: 8px; }

  .order-actions input { max-width: none; }

  .systems { padding-left: 12px; }
}
