/* Mobile first. No inline styles anywhere (the CSP forbids them). */
:root {
    --green: #2f7d4f; --green-dark: #236039; --bg: #f5f6f3; --card: #fff; --text: #1f2a24;
    --muted: #6a756e; --line: #dfe3dd; --red: #b3372f; --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--green-dark); }
main { max-width: 640px; margin: 0 auto; padding: 12px 12px 48px; }
h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
h3 { margin: 16px 0 8px; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); font-weight: normal; font-size: .9rem; }
.center { text-align: center; }

.top { background: var(--green); color: #fff; padding: 8px 12px; }
.top .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; align-items: center; }
.nav a, .nav .linklike { color: #fff; text-decoration: none; font-size: .95rem; padding: 4px 0; }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > label { flex: 1; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; }
input, select, button { font: inherit; }
input:not([type=checkbox]):not([type=radio]), select {
    width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); min-height: 44px;
}
.row input:not([type=checkbox]), .row select { width: auto; flex: 1; min-width: 0; }
.btn { display: inline-block; padding: 10px 16px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
    text-decoration: none; cursor: pointer; text-align: center; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.big { font-size: 1.2rem; min-height: 56px; width: 100%; }

.flash { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.flash-ok { background: #e3f3e8; color: #1c5a32; }
.flash-error { background: #fbe6e4; color: #8a2a23; }

.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.daynav h1 { margin: 0; text-align: center; flex: 1; }
.daynav small { color: var(--muted); font-weight: normal; font-size: .8rem; display: block; }
progress { width: 100%; height: 10px; margin-top: 4px; accent-color: var(--green); }
.cal-big strong { font-size: 2rem; }
.macros { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: .9rem; }
.macros li { display: flex; flex-direction: column; }

.entries, .foods, .plain { list-style: none; padding: 0; margin: 0 0 8px; }
.entries li, .foods li, .plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.entries li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; }
.entry-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.entry-edit { flex-basis: 100%; }
.entry-edit summary, .quick summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.quick summary { color: var(--text); font-size: 1rem; list-style: none; }
.actions { margin-top: 8px; }
.food-main { display: flex; flex-direction: column; margin-bottom: 4px; }
.badge { background: #fff2cc; color: #7a5a00; border-radius: 6px; padding: 1px 6px; font-size: .75rem; }

.child { border-top: 1px solid var(--line); padding: 8px 0; }
.child summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.child form { margin-top: 8px; }
.avatar { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.av-red { background: #d64545; } .av-orange { background: #e8833a; } .av-yellow { background: #c9a400; }
.av-green { background: #3a9a5b; } .av-teal { background: #2a9d9d; } .av-blue { background: #3b72d1; }
.av-purple { background: #8a5bd1; } .av-pink { background: #d1559b; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pick-item { flex-direction: column; align-items: center; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px; color: var(--text); cursor: pointer; }
.pick-item:has(input:checked) { border-color: var(--green); }
.who { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; }

.code-input { font-size: 1.8rem; text-align: center; letter-spacing: .15em; }
.code-display { font-size: 2.4rem; font-weight: 700; letter-spacing: .15em; margin: 12px 0; }

.kid-home h1 { text-align: center; margin: 16px 0; }
.tiles { display: grid; gap: 14px; }
.tile { display: flex; align-items: center; justify-content: center; min-height: 28vh; border-radius: 20px; color: #fff; text-decoration: none; font-size: 1.8rem; font-weight: 700; }
.tile-chores { background: #3b72d1; }
.tile-recipes { background: #e8833a; }
@media (min-width: 560px) { .tiles { grid-template-columns: 1fr 1fr; } }

/* Chores */
textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; }
.off { opacity: .55; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 8px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .9rem; }
.tabs a.on { background: var(--green); color: #fff; border-color: var(--green); }

.kid-top h1 { margin-bottom: 8px; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; text-decoration: none; color: var(--text); }
.celebrate { background: #fff7d6; border: 2px solid #f0c93a; border-radius: var(--radius); padding: 14px; text-align: center; font-size: 1.3rem; font-weight: 700; }
.chore-card { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.chore-card.is-done { border-color: #9bd2ae; background: #f3fbf5; }
.chore-head { display: flex; gap: 12px; align-items: center; }
.chore-icon { font-size: 2.2rem; }
.chore-title { display: flex; flex-direction: column; }
.chore-title strong { font-size: 1.25rem; }
.steps { list-style: none; padding: 0; margin: 8px 0 0; }
.steps li { padding: 6px 0; }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 1rem; }
.done-note { margin: 0; font-weight: 600; color: #1c5a32; }
.points-big strong { font-size: 3rem; }

.board-scroll { overflow-x: auto; margin: 0 -12px 12px; padding: 0 12px; }
.board { border-collapse: collapse; min-width: 640px; width: 100%; background: #fff; }
.board th, .board td { border: 1px solid var(--line); padding: 6px; vertical-align: top; text-align: left; font-size: .85rem; }
.board th.today, .board td.today { background: #f3fbf5; }
.board tbody th { white-space: nowrap; }
.chip { margin-bottom: 4px; border-radius: 8px; border: 1px solid var(--line); padding: 4px 6px; background: #fff; }
.chip summary { cursor: pointer; }
.chip.st-done, .chip.st-approved { background: #e3f3e8; }
.chip.st-skipped { background: #eee; color: var(--muted); }
.chip-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.chip-actions .btn { padding: 6px 10px; min-height: 36px; }
.rates { width: 100%; border-collapse: collapse; }
.rates th, .rates td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; }

/* Barcode scanning */
.scan-video { width: 100%; max-height: 60vh; background: #000; border-radius: 12px; object-fit: cover; }
.scan-video[hidden] { display: none; }
.flash-info { background: #e8f0fb; color: #1f3f73; }

/* Fitness */
.facts { list-style: none; padding: 0; margin: 8px 0; }
.facts li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.btn.off { opacity: .35; pointer-events: none; }
.chart-box { margin: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart circle.s-actual { fill: #1f2a24; }
.chart polyline.s-trend { stroke: var(--green); stroke-width: 2.5; }
.chart polyline.s-projected { stroke: #c0762a; stroke-width: 2; }
.chart polyline.s-measurement { stroke: #3b72d1; stroke-width: 2.5; }
.chart circle.s-points { fill: #3b72d1; }
.chart .dashed { stroke-dasharray: 6 5; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.key::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: #888; }
.key.s-actual::before { background: #1f2a24; }
.key.s-trend::before { background: var(--green); }
.key.s-projected::before { background: #c0762a; }
.key.s-measurement::before, .key.s-points::before { background: #3b72d1; }

/* Recipes */
.recipe-grid { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.recipe-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.recipe-link { display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; }
.recipe-link img, .recipe-noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #eef1ec; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.recipe-hero { width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; margin-bottom: 8px; }
.tag { display: inline-block; background: #eef1ec; border-radius: 999px; padding: 2px 10px; font-size: .85rem; text-decoration: none; color: var(--text); }
.ingredients { padding-left: 20px; margin: 6px 0; }
.ingredients li { padding: 3px 0; }
.steps-list { padding-left: 22px; }
.steps-list li { padding: 6px 0; }
.badge.job { background: #e1ecfb; color: #1f3f73; }
.badge.warn { background: #fde7d8; color: #8a3b0b; }
.big-btn { font-size: 1.1rem; min-height: 52px; }
.ing-row, .step-row { border-bottom: 1px solid var(--line); padding: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.photo-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.photo { margin: 0; width: 140px; }
.photo img { width: 140px; height: 100px; object-fit: cover; border-radius: 8px; }
.today-card { border-color: var(--green); }

/* Cook mode: big text, one step at a time */
.cook { display: flex; flex-direction: column; min-height: calc(100vh - 90px); }
.cook-bar { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 8px; }
.cook-title { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook-ingredients { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; max-height: 40vh; overflow: auto; }
.cook-ingredients[hidden], .cook-step[hidden], [data-finished][hidden] { display: none; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 8px 0; font-size: 1.15rem; }
.checklist input { width: 24px; height: 24px; }
.cook-step { flex: 1; background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.cook-step.has-job { border-color: #3b72d1; }
.cook-step.is-adult { border-color: #e8833a; }
.cook-count { margin: 0; color: var(--muted); }
.cook-body { font-size: 1.6rem; line-height: 1.4; margin: 0; }
.cook-job { margin: 0; background: #e1ecfb; color: #1f3f73; border-radius: 12px; padding: 10px 14px; font-size: 1.3rem; }
.cook-adult { margin: 0; background: #fde7d8; color: #8a3b0b; border-radius: 12px; padding: 10px 14px; font-size: 1.2rem; font-weight: 600; }
.cook-timers { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.cook-timer { display: flex; align-items: center; gap: 10px; background: #fff7d6; border: 2px solid #f0c93a; border-radius: 12px; padding: 8px 12px; }
.cook-timer.is-done { background: #fde1df; border-color: #d64545; animation: pulse 1s infinite; }
.cook-timer-time { font-size: 1.6rem; flex: 1; text-align: center; font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: .55; } }
.cook-nav { display: flex; gap: 8px; margin-top: 8px; }
.cook-nav .btn { flex: 1; }
.cook-nav [hidden] { display: none; }
.cook-done { text-align: center; font-size: 1.6rem; }
@media (min-width: 700px) { .cook-body { font-size: 2.1rem; } .cook { max-width: 900px; margin: 0 auto; } }

/* Printing: just the recipe */
@media print {
    .top, .no-print, .tabs, .flash, .cook-nav, button, .btn { display: none !important; }
    body { background: #fff; color: #000; }
    main { max-width: none; padding: 0; }
    .card { border: 0; padding: 0; }
    .print-recipe h1 { font-size: 1.8rem; }
}

/* Shopping */
.shop-list { list-style: none; padding: 0; margin: 0; }
.shop-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shop-item.is-checked .shop-name { text-decoration: line-through; color: var(--muted); }
.shop-name { flex: 1; min-width: 0; }
.shop-edit { flex-basis: 100%; }
.shop-edit summary { cursor: pointer; color: var(--muted); }
.tick { background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; min-width: 44px; min-height: 44px; }
.narrow-input { max-width: 90px; }
.current { font-weight: 700; }
.break { word-break: break-all; }
pre { background: #f0f2ee; padding: 10px; border-radius: 8px; overflow-x: auto; }
