:root {
	--bg: #f6f4f0; --card: #ffffff; --surface-2: #f2efe9; --ink: #1f2328; --muted: #6f6a64; --label: #3f3a35;
	--line: #e6e1d9; --field-bg: #ffffff; --field-line: #d4cec4;
	--brand: #3456d6; --brand-strong: #2742b0; --link: #2a47bd; --on-brand: #ffffff;
	--soft: #ebeffc; --soft-2: #dfe5fa; --accent: #ef7440;
	--ok: #1f9d6b; --ok-soft: #e5f4ec; --ok-ink: #13704b;
	--warn: #cf8812; --warn-soft: #fbf1dd; --warn-ink: #83520a;
	--bad: #d1435b; --bad-soft: #fbeaed; --bad-ink: #a2253c;
	--info: #2f7fd1; --info-soft: #e7f0fa; --info-ink: #1d5c9e;
	--off-chip: #ebe7e0; --chip-ring: rgba(0, 0, 0, .08);
	--top-bg: rgba(255, 255, 255, .9); --overlay: rgba(20, 22, 26, .45);
	--shadow: 0 1px 2px rgba(31, 35, 40, .04), 0 4px 16px rgba(31, 35, 40, .05);
	--toast-bg: #24282f; --toast-ink: #ffffff;
	--r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body.no-scroll { overflow: hidden; }
a { color: var(--link); }
h2, h3, h4 { margin: 0 0 10px; line-height: 1.2; }
h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 14px; margin-top: 16px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
h2.page { font-size: 22px; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; }
.fh-loading { padding: 40px; text-align: center; color: var(--muted); }

/* Header & nav */
.top { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { font-weight: 800; font-size: 18px; color: var(--brand); text-decoration: none; display: flex; align-items: center; }
.brand img { height: 34px; width: auto; display: block; }
.hello { margin: 4px 0 18px; }
.hello h1 { margin: 0; font-size: 26px; }
.hello p { margin: 2px 0 0; color: var(--muted); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; }
.nav a b { font-weight: 400; }
.nav a.on { background: var(--soft); color: var(--link); }
.me { font-size: 13px; color: var(--muted); white-space: nowrap; }
main { max-width: 1100px; margin: 0 auto; padding: 20px; padding-bottom: 100px; }

@media (max-width: 760px) {
	.top { padding: 10px 14px; }
	.nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); justify-content: space-around; padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom)); gap: 0; }
	.nav a { flex-direction: column; gap: 0; padding: 4px 6px; font-size: 11px; }
	.nav a b { font-size: 20px; line-height: 1.1; }
	.brand { flex: 1; }
	main { padding: 14px; padding-bottom: 110px; }
}

/* Cards & layout */
.card { background: var(--card); border-radius: var(--r); padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.card.inner { box-shadow: none; border: 1px solid var(--line); padding: 14px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.row.between { justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sticky { position: sticky; top: 58px; z-index: 10; background: var(--bg); padding: 8px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

/* Forms */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--label); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--field-line); border-radius: 9px; background: var(--card); color: var(--ink); }
input[type=color] { padding: 2px; height: 40px; min-width: 50px; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--soft-2); border-color: var(--brand); }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks label, .check { display: flex; gap: 6px; align-items: center; font-weight: 400; }
.check { margin-bottom: 12px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--brand); color: var(--on-brand); font: 600 14px/1 inherit; font-family: inherit; padding: 11px 16px; border-radius: 10px; cursor: pointer; }
.btn.small { padding: 8px 12px; font-size: 13px; }
a.btn { color: var(--on-brand); text-decoration: none; }
.btn.ghost, a.btn.ghost { background: var(--soft); color: var(--link); }
.btn:active { transform: translateY(1px); }
.link { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; font-size: 13px; padding: 4px; }
.link.bad { color: var(--bad); }
.icon-btn { background: var(--surface-2); border: 0; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; font-size: 15px; }

/* Badges, chips, dots */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); } .badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.bad { background: var(--bad-soft); color: var(--bad-ink); } .badge.info { background: var(--info-soft); color: var(--info-ink); }
.chip { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; padding: 2px 6px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--chip-ring); line-height: 1.3; white-space: nowrap; }
.chip.off { background: var(--off-chip); color: var(--muted); box-shadow: none; }
.chip i { font-style: normal; margin-left: 2px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.bad { background: var(--bad); } .dot.info { background: var(--info); }
.who { margin-bottom: 10px; }

/* Home */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { border-left: 4px solid var(--warn); background: var(--warn-soft); border-radius: 8px; margin-bottom: 8px; }
.alerts li.bad { border-color: var(--bad); background: var(--bad-soft); }
.alerts a { display: block; padding: 10px 12px; color: inherit; text-decoration: none; }
.allclear { color: var(--ok); font-weight: 600; }
.week { display: flex; flex-direction: column; gap: 6px; }
.dayrow { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); color: inherit; text-decoration: none; border-left: 4px solid transparent; }
.dayrow.clash { border-left-color: var(--bad); } .dayrow.covered { border-left-color: var(--info); }
.dr-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.dr-date { font-weight: 600; }
.log { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.log li:last-child { border: 0; }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cal-head h2 { margin: 0; flex: 1; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow span { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cell { min-height: 92px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 5px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; font: inherit; position: relative; }
.cell .num { font-size: 13px; font-weight: 700; }
.cell.other { opacity: .45; }
.cell.noschool { background: var(--surface-2); }
.cell.today { outline: 2px solid var(--brand); }
.cell.clash { border-color: var(--bad); box-shadow: inset 0 -4px 0 var(--bad); }
.cell.covered { box-shadow: inset 0 -4px 0 var(--info); }
.cell .ns { font-size: 10px; color: var(--muted); line-height: 1.1; }
@media (max-width: 760px) {
	.card:has(.cal) { padding: 12px 8px; }
	.cell { min-height: 70px; padding: 3px; }
	.cell .chip { font-size: 10px; padding: 1px 3px; }
	.cell .ns { display: none; }
}

/* Day modal & gaps */
.gap { padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; background: var(--info-soft); }
.gap.open { background: var(--bad-soft); }
.gap-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.plain { padding-left: 18px; }
.custom[hidden] { display: none; }
.needlist { display: flex; flex-direction: column; gap: 8px; }
.need { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); border-left: 4px solid var(--bad); }
.need.breakfast, .need.after { background: var(--warn-soft); border-left-color: var(--warn); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr.expired td, .tbl tr.urgent td { background: var(--bad-soft); }
.tbl tr.soon td { background: var(--warn-soft); }
.tbl.edit td { padding: 4px; }
.tbl.edit input { padding: 6px 8px; }
.tbl.edit input.xs { width: 60px; }
@media (max-width: 760px) { .card { overflow-x: auto; } }

/* Medication */
.med .bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 12px 0; }
.med .bar span { display: block; height: 100%; background: var(--ok); }
.med.soon .bar span { background: var(--warn); }
.med.reorder .bar span, .med.out .bar span, .med.ordered_low .bar span { background: var(--bad); }
.med.ordered .bar span { background: var(--info); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.stats b { display: block; font-size: 18px; }
.stats span { font-size: 12px; color: var(--muted); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Pattern editor */
.pattern { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 8px; }
.pday { display: block; background: var(--surface-2); border-radius: 8px; padding: 6px; font-size: 12px; }
.pday span { display: block; font-weight: 700; margin-bottom: 4px; }
.pday em { font-style: normal; font-weight: 400; color: var(--muted); }
.pday select { padding: 5px; font-size: 13px; }

/* Modal & toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 14px; overflow-y: auto; }
.modal { background: var(--card); border-radius: 16px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px; }
@media (max-width: 760px) { .modal-wrap { padding: 0; align-items: flex-end; } .modal { border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; } }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--toast-bg); color: var(--toast-ink); padding: 11px 18px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100vw - 32px); opacity: 0; transition: .25s; z-index: 200; font-size: 14px; }
.toast.bad { background: #c0354d; color: #fff; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ setup guide */
.wz-top { margin: 4px 0 14px; }
.wz-top h1 { margin: 0; font-size: 26px; }
.wz-top p { margin: 4px 0 0; }
.wz-back { display: inline-block; margin-bottom: 12px; font-weight: 600; text-decoration: none; }
.wz-progress { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; }
.wz-dot { flex: 1; min-width: 70px; text-decoration: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; text-align: center; }
.wz-dot span { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-2, var(--surface-2)); border: 2px solid var(--line); color: var(--muted); font-size: 13px; }
.wz-dot em { font-style: normal; line-height: 1.2; }
.wz-dot.done span { background: var(--ok); border-color: var(--ok); color: #fff; }
.wz-dot.skipped span { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); }
.wz-dot.on span { border-color: var(--brand); background: var(--brand); color: var(--on-brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.wz-dot.on { color: var(--ink); }
@media (max-width: 760px) { .wz-dot em { display: none; } .wz-dot { min-width: 34px; } }

.wz-head { display: flex; align-items: center; gap: 14px; }
.wz-head h2 { margin: 0; font-size: 22px; }
.wz-ico { font-size: 28px; width: 54px; height: 54px; border-radius: 16px; background: var(--soft); display: flex; align-items: center; justify-content: center; flex: none; }
.wz-step { margin: 0 0 2px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--link); }
.wz-saved { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.wz-intro { margin: 12px 0 16px; max-width: 46em; }
.wz-foot { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.wz-right { display: flex; align-items: center; gap: 14px; }
@media (max-width: 760px) { .wz-foot { bottom: 64px; } }

.choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.choice { text-align: left; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 14px; padding: 12px 14px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 3px; }
.choice span { font-size: 13px; color: var(--muted); }
.choice:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.choice.on { border-color: var(--brand); background: var(--soft); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; background: var(--card); }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--soft); color: var(--link); }
.seg input { width: auto; margin: 0; }
.seg.big { margin: 6px 0 14px; }
.check.big { font-size: 15px; margin-bottom: 10px; }
.okbox, .infobox { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; line-height: 1.5; }
.okbox { background: var(--ok-soft); color: var(--ok-ink); }
.infobox { background: var(--info-soft); color: var(--info-ink); }
.infobox .actions { margin-top: 8px; }
.warnlist { background: var(--warn-soft); color: var(--warn-ink); border-radius: 12px; padding: 10px 14px 10px 30px; font-size: 13px; }
.kid .row, .provider .row { align-items: flex-end; }
.field.age { flex: 0 0 90px !important; }
.kid-tools { display: flex; gap: 6px; align-items: center; padding-bottom: 14px; }
.club .row { margin-top: 6px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; }
.tab.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.row.tight { gap: 6px; flex-wrap: nowrap; }
input.sm { width: 90px; flex: none; }
.row.tight select { width: auto; }
.weekgrid { overflow-x: auto; }
.weekgrid table { border-collapse: separate; border-spacing: 4px; min-width: 560px; }
.weekgrid th { font-size: 12px; color: var(--muted); text-align: center; font-weight: 700; }
.weekgrid tbody th { text-align: left; white-space: nowrap; padding-right: 6px; }
.weekgrid select { padding: 6px; font-size: 13px; min-width: 64px; }
.preview { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.pv { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 42px; font-size: 11px; color: var(--muted); text-align: center; }
.mini-steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.6; }
.wz-list { list-style: none; margin: 0 0 12px; padding: 0; }
.wz-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wz-add h4, .wz-kit h4 { margin-top: 0; }
.kitbox .wz-item { margin-top: 6px; }
.wz-done { text-align: center; padding: 34px 22px; }
.wz-party { font-size: 54px; }
.wz-summary { list-style: none; padding: 0; margin: 20px auto 24px; max-width: 360px; text-align: left; }
.wz-summary li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.wz-summary li span { width: 22px; text-align: center; font-weight: 700; color: var(--ok); }
.wz-summary li.todo span, .wz-summary li.skipped span { color: var(--muted); }
.wz-summary li a { margin-left: auto; font-size: 13px; }

/* Settings hub & home banner */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.hub-item { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin: 0 !important; }
.hub-item:hover { border-color: var(--brand) !important; }
.hub-ico { font-size: 22px; width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: flex; align-items: center; justify-content: center; flex: none; }
.hub-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.hub-txt small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-go { color: var(--muted); font-size: 22px; }
.members li { padding: 4px 0; }
.setup-banner { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border-left: 5px solid var(--brand) !important; }
.setup-banner h2 { margin: 0 0 2px; }
.setup-banner p { margin: 0; }
[hidden] { display: none !important; }

/* Accordions (medication by person, schools) */
.acc { background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; overflow: hidden; }
.acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-size: 15px; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: '›'; margin-left: auto; font-size: 22px; line-height: 1; color: var(--muted); transition: transform .15s; }
.acc[open] > summary::after { transform: rotate(90deg); }
.acc > summary .muted { margin-left: 4px; }
.acc > summary:hover { background: var(--surface-2, var(--surface-2)); }
.acc-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.acc-body > .card.med { box-shadow: none; border: 1px solid var(--line); margin: 12px 0; }
.acc-ico { font-size: 18px; }
.acc .wz-add { margin-top: 10px; }
.inline-select { width: auto; padding: 7px 10px; font-size: 13px; }
.schools-today { padding-left: 0; list-style: none; margin: 0 0 12px; }
