:root {
  --pine: #17483d;
  --pine-dark: #0d3029;
  --sage: #dde9df;
  --sage-deep: #91aa99;
  --paper: #f7f5ee;
  --clay: #cd6b47;
  --ink: #17211e;
  --muted: #708078;
  --line: #d9ded5;
  --white: #fffefa;
  --danger: #a54232;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: #d8e0d7;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #d8e0d7; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 480px; min-height: 100vh; margin: 0 auto; position: relative; overflow: hidden; background: var(--paper); padding-bottom: 92px; }
.eyebrow { margin: 0 0 8px; color: var(--clay); font-size: 12px; font-weight: 700; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Noto Serif SC", serif; }
h1 { font-size: 34px; letter-spacing: -.06em; line-height: 1.2; }
h2 { font-size: 25px; margin-bottom: 6px; letter-spacing: -.04em; }
h3 { font-size: 17px; margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.65; }
.screen { animation: appear .32s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 14px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--pine); font-family: "Noto Serif SC", serif; font-weight: 700; letter-spacing: .08em; }
.brand-version { color: var(--sage-deep); font-family: "Noto Sans SC", sans-serif; font-size: 9px; font-weight: 600; letter-spacing: .04em; }
.brand-mark { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--pine); border-radius: 50% 50% 50% 8px; transform: rotate(-38deg); }
.brand-mark i { width: 14px; transform: rotate(38deg); }
.mode-button, .icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(23, 72, 61, .18); color: var(--pine); background: rgba(255,255,255,.42); border-radius: 50%; }
.mode-button i, .icon-button i { width: 18px; }

.hero { min-height: 290px; margin: 0 14px; border-radius: 4px 56px 4px 4px; overflow: hidden; position: relative; color: var(--white); background: var(--pine); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,43,34,.88) 0%, rgba(11,43,34,.58) 48%, rgba(11,43,34,.04) 100%); }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% center; }
.hero-copy { position: relative; z-index: 1; width: 67%; padding: 35px 26px; }
.hero h1 { margin-bottom: 13px; }
.hero p { font-size: 13px; line-height: 1.7; opacity: .9; }
.hero .hero-note { margin-top: 28px; font-size: 11px; letter-spacing: .08em; }
.section { padding: 29px 20px 0; }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.text-link { border: 0; color: var(--pine); background: transparent; padding: 4px 0; font-size: 13px; font-weight: 700; }
.notice-strip { display: flex; align-items: center; gap: 11px; margin-top: 17px; padding: 13px 14px; border-left: 3px solid var(--clay); background: #eee9dd; font-size: 13px; line-height: 1.5; }
.notice-strip i { flex: 0 0 auto; color: var(--clay); width: 17px; }
.upcoming { margin-top: 16px; padding: 18px; background: var(--white); border-top: 1px solid #e9e7df; box-shadow: 0 12px 28px rgba(23, 72, 61, .08); position: relative; overflow: hidden; }
.upcoming::after { content: ""; width: 74px; height: 74px; border: 1px solid var(--sage); position: absolute; border-radius: 50%; right: -23px; top: -29px; }
.upcoming-top { display: flex; justify-content: space-between; align-items: center; }
.pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 9px; background: var(--sage); color: var(--pine); font-size: 11px; font-weight: 700; }
.date-line { display: flex; align-items: baseline; gap: 9px; margin-top: 15px; font-family: "Noto Serif SC", serif; }
.date-line strong { font-size: 27px; }
.date-line span { font-size: 14px; }
.info-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12px; }
.info-row i { width: 14px; }

.bottom-nav { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); max-width: 480px; width: 100%; display: flex; justify-content: space-around; padding: 10px 12px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid #e5e4dc; background: rgba(255,254,250,.96); backdrop-filter: blur(12px); z-index: 5; }
.nav-item { min-width: 64px; display: grid; gap: 4px; justify-items: center; border: 0; color: #8b948e; background: transparent; font-size: 10px; }
.nav-item i { width: 19px; }
.nav-item.active { color: var(--pine); font-weight: 700; }

.page-head { padding: 8px 20px 14px; }
.back { display: inline-flex; align-items: center; gap: 5px; padding: 0; margin-bottom: 22px; color: var(--pine); font-size: 13px; font-weight: 700; background: transparent; border: 0; }
.back i { width: 16px; }
.form-section { padding: 0 20px 24px; }
.form-group { margin: 24px 0; }
.form-label { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--pine-dark); font-weight: 700; font-size: 14px; }
.form-label small { color: var(--muted); font-size: 11px; font-weight: 400; }
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.choice { min-height: 60px; text-align: left; border: 1px solid var(--line); border-radius: 3px 18px 3px 3px; padding: 11px 12px; color: var(--ink); background: rgba(255,255,255,.52); }
.choice strong, .choice span { display: block; }
.choice strong { font-size: 13px; }
.choice span { color: var(--muted); margin-top: 3px; font-size: 11px; }
.choice.selected { border-color: var(--pine); background: var(--sage); box-shadow: inset 3px 0 0 var(--pine); }
.date-scroller { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.date-choice { min-height: 76px; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 30px 30px 4px 4px; }
.date-choice b, .date-choice span { display: block; }
.date-choice b { color: var(--ink); font-size: 18px; margin-top: 3px; }
.date-choice.selected { border-color: var(--pine); color: var(--white); background: var(--pine); }
.date-choice.selected b { color: var(--white); }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { min-height: 78px; text-align: left; border: 1px solid var(--line); color: var(--ink); background: var(--white); border-radius: 2px 16px 2px 2px; padding: 11px 10px; font-size: 13px; }
.slot b, .slot span { display: block; }
.slot b { font-size: 13px; }
.slot span { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.slot.full { border-color: rgba(205,107,71,.55); background: #f5ece5; }
.slot.selected { color: var(--white); border-color: var(--clay); background: var(--clay); }
.slot.selected span { color: rgba(255,255,255,.78); }
.slot[disabled] { color: #a4aaa5; background: #ebece7; text-decoration: line-through; cursor: not-allowed; }
.primary { width: 100%; min-height: 53px; border: 0; border-radius: 2px 22px 2px 2px; color: var(--white); background: var(--pine); font-weight: 700; letter-spacing: .06em; }
.secondary { width: 100%; min-height: 46px; border: 1px solid var(--pine); border-radius: 2px 18px 2px 2px; color: var(--pine); background: transparent; font-weight: 700; }
.inline-action { border: 0; color: var(--pine); background: transparent; padding: 5px 0; font-size: 12px; font-weight: 700; }

.profile-banner { margin: 0 20px; padding: 22px 20px; color: var(--white); background: var(--pine); border-radius: 0 34px 3px 3px; position: relative; overflow: hidden; }
.profile-banner::after { content: ""; position: absolute; right: -22px; top: -19px; width: 115px; height: 115px; border-radius: 45% 55% 65% 35%; background: rgba(221,233,223,.18); }
.profile-name { position: relative; z-index: 1; font-family: "Noto Serif SC", serif; font-size: 25px; margin-bottom: 3px; }
.profile-banner p { position: relative; z-index: 1; margin: 0; font-size: 12px; opacity: .76; }
.metric { position: relative; z-index: 1; display: flex; align-items: end; gap: 7px; margin-top: 23px; }
.metric b { font: 42px/1 "Noto Serif SC", serif; }
.metric span { padding-bottom: 4px; font-size: 12px; }
.family-summary { display: flex; gap: 13px; align-items: center; margin: 15px 20px 0; padding: 16px; border-left: 3px solid var(--clay); background: #eee9dd; }
.family-summary-icon { display: grid; flex: 0 0 39px; width: 39px; height: 39px; place-items: center; color: var(--pine); border: 1px solid rgba(23,72,61,.25); border-radius: 50% 50% 12px 50%; }
.family-summary .eyebrow { margin-bottom: 4px; font-size: 10px; }
.family-summary b, .family-summary span { display: block; }
.family-summary b { color: var(--pine-dark); font-size: 14px; }
.family-summary span { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.record-row { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.record-row:last-child { border-bottom: 0; }
.record-main b, .record-main span { display: block; }
.record-main b { font-size: 14px; }
.record-main span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.record-value { color: var(--pine); font: 20px "Noto Serif SC", serif; }
.placeholder { display: flex; align-items: center; justify-content: space-between; padding: 17px; margin-top: 20px; border: 1px dashed var(--sage-deep); background: rgba(221,233,223,.28); color: var(--pine); }
.placeholder div { display: flex; align-items: center; gap: 11px; }
.placeholder i { width: 20px; }
.placeholder b { font-size: 14px; }
.placeholder span { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }

.admin-band { margin: 0 14px; padding: 20px; min-height: 160px; color: var(--white); background: var(--pine-dark); border-radius: 3px 44px 3px 3px; position: relative; overflow: hidden; }
.admin-band::before { content: ""; position: absolute; width: 170px; height: 170px; right: -77px; top: -90px; border-radius: 50%; border: 1px solid rgba(221,233,223,.35); }
.admin-band::after { content: ""; position: absolute; width: 130px; height: 130px; right: -48px; top: -69px; border-radius: 50%; border: 1px solid rgba(221,233,223,.2); }
.admin-band h1 { position: relative; z-index: 1; font-size: 27px; margin: 4px 0 11px; }
.admin-band p { position: relative; z-index: 1; margin: 0; color: rgba(255,255,255,.68); font-size: 12px; }
.stat-row { display: flex; gap: 25px; margin-top: 21px; }
.stat b, .stat span { display: block; }
.stat b { font: 27px "Noto Serif SC", serif; }
.stat span { color: rgba(255,255,255,.68); font-size: 11px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 18px; }
.quick { min-height: 74px; border: 1px solid #e1e5dd; text-align: left; padding: 14px; background: var(--white); color: var(--pine); border-radius: 2px 19px 2px 2px; }
.quick i { width: 19px; margin-bottom: 5px; }
.quick span { display: block; font-size: 12px; font-weight: 700; }
.admin-list { margin-top: 15px; }
.appointment-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.appointment-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.appointment-top b { font-size: 14px; }
.appointment-meta { margin: 7px 0 11px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.actions { display: flex; gap: 8px; }
.small-button { border: 1px solid var(--pine); border-radius: 2px; padding: 7px 11px; color: var(--pine); background: transparent; font-size: 11px; font-weight: 700; }
.small-button.filled { color: var(--white); background: var(--pine); }
.small-button.danger { color: var(--danger); border-color: rgba(165,66,50,.4); }
.admin-tabs { display: flex; overflow-x: auto; gap: 18px; padding: 0 20px 6px; border-bottom: 1px solid var(--line); }
.admin-tab { white-space: nowrap; padding: 8px 0; color: var(--muted); border: 0; background: transparent; font-size: 13px; }
.admin-tab.active { color: var(--pine); border-bottom: 2px solid var(--pine); font-weight: 700; }
.config-card { margin: 15px 20px 0; padding: 17px; border: 1px solid #e0e3dc; background: var(--white); }
.config-card h3 { display: flex; justify-content: space-between; align-items: center; }
.config-card h3 i { width: 17px; color: var(--pine); }
.config-card p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.family-card { margin-top: 15px; padding: 17px; border: 1px solid #d8dfd5; border-radius: 2px 26px 2px 2px; background: var(--white); box-shadow: 0 10px 22px rgba(23,72,61,.05); }
.family-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.family-card h3 { margin-bottom: 0; }
.family-card .eyebrow { margin-bottom: 5px; font-size: 10px; }
.family-remaining { min-width: 75px; text-align: right; color: var(--pine); }
.family-remaining b, .family-remaining span { display: block; }
.family-remaining b { font: 28px/1 "Noto Serif SC", serif; }
.family-remaining span { margin-top: 4px; font-size: 10px; }
.family-members { display: flex; align-items: center; gap: 7px; margin-top: 16px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--pine); font-size: 13px; }
.family-members i { width: 17px; }
.family-card > p { margin: 11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.switchline { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.switchline:last-child { border-bottom: 0; }
.switch { appearance: none; width: 38px; height: 22px; margin: 0; border-radius: 99px; background: #c2c8c1; position: relative; transition: .2s; }
.switch::after { content: ""; width: 16px; height: 16px; border-radius: 50%; position: absolute; top: 3px; left: 3px; background: white; transition: .2s; }
.switch:checked { background: var(--pine); }
.switch:checked::after { left: 19px; }
.ledger-number { color: var(--clay); font: 32px "Noto Serif SC", serif; }

.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; align-items: end; background: rgba(12,37,31,.43); }
.modal { width: min(480px, 100%); padding: 27px 22px max(28px, env(safe-area-inset-bottom)); background: var(--paper); border-radius: 26px 26px 0 0; animation: lift .25s ease both; }
@keyframes lift { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal h2 { margin-bottom: 10px; }
.modal p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.modal-actions { display: flex; gap: 9px; margin-top: 22px; }
.modal-actions button { flex: 1; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 96px; transform: translate(-50%, 20px); max-width: calc(100% - 40px); padding: 11px 15px; border-radius: 99px; color: var(--white); background: var(--ink); font-size: 12px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 28px 0; color: var(--muted); text-align: center; font-size: 13px; }
.auth-screen { min-height: 100vh; padding-bottom: 0; background: var(--paper); }
.auth-hero { min-height: 43vh; padding: 25px 28px 34px; color: var(--white); background: var(--pine); position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; width: 310px; height: 310px; right: -160px; bottom: -210px; border: 1px solid rgba(221,233,223,.48); border-radius: 48% 52% 60% 40%; transform: rotate(22deg); box-shadow: 0 0 0 30px rgba(221,233,223,.06), 0 0 0 60px rgba(221,233,223,.04); }
.auth-hero .brand { color: var(--white); position: relative; z-index: 1; }
.auth-hero .brand-version { color: rgba(255,255,255,.58); }
.auth-hero .eyebrow { position: relative; z-index: 1; margin-top: 58px; color: #c7ddcc; }
.auth-hero h1 { position: relative; z-index: 1; margin-bottom: 12px; font-size: 35px; }
.auth-hero > p:last-child { position: relative; z-index: 1; width: 78%; margin: 0; color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.7; }
.auth-panel { position: relative; z-index: 2; margin: -17px 15px 0; padding: 24px 20px 30px; background: var(--white); border-radius: 3px 28px 3px 3px; box-shadow: 0 18px 38px rgba(23,72,61,.13); }
.auth-switch { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 23px; }
.auth-switch button { padding: 0 0 9px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 14px; }
.auth-switch button.active { border-bottom-color: var(--pine); color: var(--pine); font-weight: 700; }
.input-label { display: block; margin-bottom: 17px; color: var(--pine-dark); font-size: 13px; font-weight: 700; }
.input-label input { display: block; width: 100%; min-height: 48px; margin-top: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 2px 14px 2px 2px; outline: 0; color: var(--ink); background: #fbfaf5; font-family: "Noto Sans SC", sans-serif; font-weight: 400; }
.input-label input:focus { border-color: var(--pine); box-shadow: inset 3px 0 0 var(--sage-deep); }
.auth-hint { margin: -4px 0 18px; color: var(--muted); font-size: 11px; }
@media (min-width: 600px) { .app-shell { box-shadow: 0 0 60px rgba(23,72,61,.18); } }
