/* NestDays — warm, quiet, product-grade UI */
:root {
  --paper: #faf7f2;
  --card: #ffffff;
  --ink: #221e1a;
  --muted: #736b61;
  --line: #eae2d8;
  --line-strong: #ded3c4;
  --pink: #d96a8c;
  --pink-ink: #8e3453;
  --pink-soft: #f8e3ea;
  --blue: #4a6d9b;
  --blue-ink: #2c4467;
  --blue-soft: #e2eaf5;
  --gold: #b0812f;
  --gold-soft: #fbf0dc;
  --green: #4d7a62;
  --green-soft: #e4f0e8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(34, 30, 26, .04), 0 14px 36px rgba(34, 30, 26, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; letter-spacing: .02em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 550;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  text-decoration: none;
}
.btn:hover { border-color: #cbbfae; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #3a332c; }
.btn.pink { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.danger { color: #a63b3b; border-color: #eccccc; background: #fdf4f4; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card);
}
.icon-btn:hover { background: #f4eee6; }

/* ---------- landing ---------- */
.landing { max-width: 1120px; margin: 0 auto; padding: 0 24px 80px; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; font-size: 19px; text-decoration: none; }
.wordmark .mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--pink) 0 50%, var(--blue) 50% 100%);
  color: #fff; font-size: 14px; font-weight: 700;
}
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; padding: 48px 0 40px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 600; }
.hero h1 { font-family: var(--serif); font-size: 56px; line-height: 1.04; font-weight: 500; letter-spacing: -0.02em; margin: 16px 0 18px; }
.hero h1 em { font-style: italic; color: var(--pink-ink); }
.hero p.lead { font-size: 17px; color: var(--muted); max-width: 44ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-note { margin-top: 16px; font-size: 12.5px; color: var(--muted); }

.mock {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 18px;
  box-shadow: var(--shadow); transform: rotate(-1.2deg);
}
.mock .mock-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mock .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.mock .cell { aspect-ratio: 1 / 1.05; border-radius: 8px; background: #f4efe8; position: relative; }
.mock .cell.m { background: var(--pink-soft); }
.mock .cell.d { background: var(--blue-soft); }
.mock .cell.split { background: linear-gradient(to bottom, var(--pink-soft) 0 62%, var(--blue-soft) 62% 100%); }
.mock .cell.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.mock .legend { display: flex; gap: 14px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.m { background: var(--pink); }
.dot.d { background: var(--blue); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 36px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature h3 { font-size: 16px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 14px; }

.strip { margin-top: 44px; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 26px; display: flex; gap: 26px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.strip h2 { font-family: var(--serif); font-size: 26px; font-weight: 500; }

footer.site { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
footer.site a { text-decoration: none; margin-right: 14px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 460px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { font-family: var(--serif); font-size: 32px; font-weight: 500; margin: 18px 0 6px; }
.auth-card p.sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: .01em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fffdfa; font-size: 15px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #d9cdbd; outline-offset: 1px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { background: #fdf1f1; border: 1px solid #eccccc; color: #993c3c; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }

.pattern-list { display: grid; gap: 8px; margin-bottom: 14px; }
.pattern-opt { border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: #fffdfa; }
.pattern-opt:hover { border-color: #c9bba8; }
.pattern-opt input { display: none; }
.pattern-opt.sel { border-color: var(--ink); background: #f7f1e8; box-shadow: inset 0 0 0 1px var(--ink); }
.pattern-opt strong { display: block; font-size: 14px; }
.pattern-opt span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.rail { border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 26px; background: #f7f2ea; position: sticky; top: 0; height: 100vh; }
.rail nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 550; border: none; background: none; text-align: left; width: 100%; }
.nav-item:hover { background: #efe7db; color: var(--ink); }
.nav-item.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.04), inset 3px 0 0 var(--ink); }
.nav-item .badge { margin-left: auto; background: var(--pink); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 999px; }
.rail .child { padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.rail .child .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.rail .child .name { font-family: var(--serif); font-size: 20px; margin-top: 2px; }
.rail .foot { margin-top: auto; font-size: 12px; color: var(--muted); display: grid; gap: 8px; }

.main { padding: 26px 32px 60px; max-width: 1220px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { font-family: var(--serif); font-size: 30px; font-weight: 500; }
.topbar .spacer { flex: 1; }
.month-nav { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.month-nav button { border: none; background: none; width: 30px; height: 30px; border-radius: 50%; font-size: 15px; color: var(--muted); }
.month-nav button:hover { background: #f4eee6; color: var(--ink); }
.month-label { min-width: 128px; text-align: center; font-weight: 600; font-size: 14px; }

.legend { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 12.5px; margin-bottom: 12px; flex-wrap: wrap; }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }

.cal-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(34,30,26,.03); }
.week-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.week-head div { padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.day { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 9px; position: relative; cursor: pointer; background: #fff; }
.day:nth-child(7n) { border-right: none; }
.day.out { background: #fcfaf6; }
.day:hover { filter: brightness(.975); }
.day:hover .num { color: var(--ink); }
.day .num { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.day.today .num span.dn { background: var(--ink); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.day .owner-strip { position: absolute; inset: 0; z-index: 0; opacity: .9; }
.day > * { position: relative; z-index: 1; }
.day .chips { margin-top: 6px; display: grid; gap: 3px; }
.chip { font-size: 10.5px; padding: 2px 5px; border-radius: 5px; background: #f3eee7; color: #4d463e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 2px solid #c9bba8; }
.chip.school { background: var(--gold-soft); border-color: var(--gold); }
.chip.work { background: #e9edf2; border-color: #69829e; }
.chip.busy { background: #f1ece4; border-color: #a49682; }
.chip.family { background: var(--green-soft); border-color: var(--green); }
.day .more { font-size: 10px; color: var(--muted); }
.day .exch { position: absolute; right: 6px; bottom: 5px; font-size: 9px; color: #5f574e; z-index: 2; letter-spacing: .01em; background: rgba(255,255,255,.82); border: 1px solid rgba(34,30,26,.06); border-radius: 999px; padding: 1px 5px; }
.day .split-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed rgba(34,30,26,.22); z-index: 2; pointer-events: none; }
.day .swap-flag { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

/* owner backgrounds */
.owner-mom { background: linear-gradient(180deg, #fbeef2 0%, #f9e6ec 100%); }
.owner-dad { background: linear-gradient(180deg, #ecf1f8 0%, #e7eef7 100%); }
.owner-both { background: #fff; }

/* ---------- day panel ---------- */
.panel-backdrop { position: fixed; inset: 0; background: rgba(34,30,26,.28); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .18s; }
.panel-backdrop.open { opacity: 1; pointer-events: auto; }
.panel { position: fixed; z-index: 50; top: 0; right: 0; height: 100vh; width: 400px; background: var(--card); border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column; }
.panel.open { transform: translateX(0); }
.panel-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 10px; }
.panel-head h2 { font-family: var(--serif); font-size: 24px; font-weight: 500; }
.panel-body { padding: 18px 22px 30px; overflow-y: auto; }
.panel .who { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.panel .who .dot { width: 12px; height: 12px; }
.panel .who.mom { background: var(--pink-soft); }
.panel .who.dad { background: var(--blue-soft); }
.section { margin-top: 22px; }
.section h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 9px; }
.ev-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f2ece4; align-items: flex-start; }
.ev-row .time { font-size: 12px; color: var(--muted); min-width: 62px; }
.ev-row .t { font-size: 14px; }
.ev-row .meta { font-size: 11.5px; color: var(--muted); }

/* ---------- ledger ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; }
.stat .s { font-size: 12px; color: var(--muted); }
.bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #efe8dd; margin: 10px 0 8px; }
.bar .m { background: var(--pink); }
.bar .d { background: var(--blue); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.month-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.month-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.month-table td { padding: 7px 4px; border-bottom: 1px solid #f4efe7; }
.month-table td.m { color: var(--pink-ink); font-weight: 600; }
.month-table td.d { color: var(--blue-ink); font-weight: 600; }

/* ---------- settings ---------- */
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.set-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.set-card h2 { font-family: var(--serif); font-size: 21px; font-weight: 500; margin-bottom: 4px; }
.set-card .desc { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid #f4efe7; }
.kv .k { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
.copy-row input { flex: 1; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fffdfa; font-size: 12px; }
.source-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f4efe7; font-size: 13px; align-items: center; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(34,30,26,.35); z-index: 60; display: none; }
.modal-backdrop.open { display: block; }
.modal { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 94vw); max-height: 88vh; overflow: auto; background: var(--card); border-radius: 20px; padding: 24px; display: none; }
.modal.open { display: block; }
.modal h2 { font-family: var(--serif); font-size: 24px; font-weight: 500; margin-bottom: 6px; }
.modal .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 90; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- partner ---------- */
.partner-banner { background: var(--gold-soft); border: 1px solid #eddcc0; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.partner-banner .t { font-size: 14px; }
.partner-banner .s { font-size: 12px; color: var(--muted); }

.mobile-bar { display: none; }
.bottom-nav { display: none; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 24px; }
  .hero h1 { font-size: 40px; }
  .features { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding: 16px 14px 96px; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px 14px; }
  .topbar { gap: 8px; }
  .topbar h1 { font-size: 24px; }
  .day { min-height: 76px; padding: 5px 6px; }
  .day .num { font-size: 11px; }
  .chip { font-size: 9.5px; padding: 1px 4px; }
  .week-head div { padding: 8px 6px; font-size: 9.5px; }
  .panel { top: auto; bottom: 0; right: 0; left: 0; width: 100%; height: 80vh; transform: translateY(100%); border-left: none; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; }
  .panel.open { transform: translateY(0); }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: #fffdfa; border-top: 1px solid var(--line); padding: 6px 4px 10px; z-index: 30; }
  .bottom-nav button { border: none; background: none; display: grid; justify-items: center; gap: 2px; font-size: 10px; color: var(--muted); padding: 6px 2px; }
  .bottom-nav button.active { color: var(--ink); font-weight: 600; }
  .stat-grid { grid-template-columns: 1fr; }
  .set-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px; }
  .row2 { grid-template-columns: 1fr; }
}
