/* Kitchen Dashboard — Echo Show–inspired family calendar
   Compatible with older Safari (iPad): no CSS grid gap reliance alone,
   avoid :has(), avoid logical props where risky, prefer flex + simple grid. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root {
  --bg: #F3F1EC;
  --bg-elev: #FFFFFF;
  --ink: #2C2A26;
  --ink-soft: #6B6560;
  --line: #E5E0D8;
  --accent: #5B8DEF;
  --warm: #F5A623;
  --ok: #7ED321;
  --danger: #E85D4C;
  --shadow: 0 4px 18px rgba(44, 42, 38, 0.08);
  --radius: 18px;
  --tabbar-h: 64px;
  --topbar-h: 48px;
  --star: #F5C542;
}

body.night {
  --bg: #1A1C22;
  --bg-elev: #252830;
  --ink: #F0EEE8;
  --ink-soft: #A8A49C;
  --line: #343842;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

body {
  background: var(--bg);
  color: var(--ink);
}

.app {
  height: 100%;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
}

/* —— Top bar —— */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  padding: 0 16px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

.topbar-left, .topbar-right, .topbar-center {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
}
.topbar-left { -webkit-flex: 1; flex: 1; }
.topbar-center { -webkit-flex: 0 0 auto; flex: 0 0 auto; }
.topbar-right { -webkit-flex: 1; flex: 1; -webkit-justify-content: flex-end; justify-content: flex-end; }

.family-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.example-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #8A5A00;
  background: #FFE8A8;
  padding: 3px 8px;
  border-radius: 999px;
}
body.night .example-badge {
  color: #FFE8A8;
  background: #5A4200;
}

.top-clock {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}

.icon-btn, .text-btn {
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.icon-btn:active, .text-btn:active { background: var(--line); }
.text-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* —— Panels —— */
.panels {
  -webkit-flex: 1;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  padding: 14px 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: none;
}
.panel.is-active {
  display: block;
}

/* —— Cards —— */
.card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  border: 1px solid var(--line);
}

.card-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.subtle { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: 0.75; }

/* —— HOME grid —— */
.home-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -7px;
  height: 100%;
  -webkit-align-content: stretch;
  align-content: stretch;
}
.home-grid > .card {
  margin: 7px;
}

.card-clock {
  width: calc(38% - 14px);
  min-height: 200px;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-justify-content: center;
  justify-content: center;
  background: -webkit-linear-gradient(135deg, #E8F0FE 0%, #FFF6E8 100%);
  background: linear-gradient(135deg, #E8F0FE 0%, #FFF6E8 100%);
  border: none;
}
body.night .card-clock {
  background: -webkit-linear-gradient(135deg, #2A3348 0%, #3A2F28 100%);
  background: linear-gradient(135deg, #2A3348 0%, #3A2F28 100%);
}

.big-clock {
  font-size: 72px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}
.big-date {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}
.greeting {
  margin-top: 6px;
  font-size: 16px;
  color: var(--ink-soft);
}

.card-weather {
  width: calc(62% - 14px);
  min-height: 200px;
}

.weather-current {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.weather-temp {
  font-size: 56px;
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.weather-meta { font-size: 16px; color: var(--ink-soft); }
.weather-meta strong { color: var(--ink); font-weight: 600; }
.weather-icon { font-size: 48px; line-height: 1; }

.weather-days {
  display: -webkit-flex;
  display: flex;
  gap: 8px;
}
.day-pill {
  -webkit-flex: 1;
  flex: 1;
  text-align: center;
  background: var(--bg);
  border-radius: 12px;
  padding: 8px 4px;
  font-size: 13px;
}
.day-pill .d-name { font-weight: 700; color: var(--ink-soft); margin-bottom: 2px; }
.day-pill .d-icon { font-size: 20px; margin: 2px 0; }
.day-pill .d-hi { font-weight: 700; }
.day-pill .d-lo { color: var(--ink-soft); }
.weather-loc {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-soft);
}

.card-today {
  width: calc(58% - 14px);
  min-height: 180px;
  max-height: calc(100% - 240px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.card-notices {
  width: calc(42% - 14px);
  min-height: 180px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.event-list { list-style: none; }
.event-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.event-row:last-child { border-bottom: none; }
.event-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}
.event-time {
  width: 72px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}
.event-title { font-size: 17px; font-weight: 600; }
.event-who { font-size: 13px; color: var(--ink-soft); }
.empty-hint {
  color: var(--ink-soft);
  font-size: 15px;
  padding: 12px 0;
}

.notice-strip { list-style: none; }
.notice-item {
  display: -webkit-flex;
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--bg);
  -webkit-align-items: flex-start;
  align-items: flex-start;
}
.notice-item.is-high { background: #FFE8E4; }
body.night .notice-item.is-high { background: #3A2826; }
.notice-icon { font-size: 22px; line-height: 1.2; }
.notice-title { font-size: 15px; font-weight: 700; }
.notice-detail { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* —— CALENDAR week —— */
.cal-header {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.cal-range {
  font-size: 20px;
  font-weight: 700;
  -webkit-flex: 1;
  flex: 1;
  text-align: center;
}

.member-legend {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.legend-chip {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
}

.week-grid {
  display: -webkit-flex;
  display: flex;
  gap: 8px;
  height: calc(100% - 70px);
  min-height: 320px;
}
.week-day {
  -webkit-flex: 1;
  flex: 1;
  background: var(--bg-elev);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 10px 8px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}
.week-day.is-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 141, 239, 0.25), var(--shadow);
}
.wd-head {
  text-align: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.wd-name { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; }
.wd-num {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}
.week-day.is-today .wd-num { color: var(--accent); }
.wd-event {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 7px;
  border-radius: 8px;
  margin-bottom: 6px;
  color: #fff;
  line-height: 1.25;
}
.wd-event .we-time { opacity: 0.85; font-weight: 500; font-size: 11px; display: block; }

/* —— PLAYROOM —— */
.play-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -7px;
}
.play-grid > .card { margin: 7px; }

.card-kids { width: calc(100% - 14px); }
.card-routine { width: calc(50% - 14px); min-height: 260px; }
.card-chores { width: calc(50% - 14px); min-height: 260px; }
.card-rewards { width: calc(100% - 14px); }

.kids-progress {
  display: -webkit-flex;
  display: flex;
  gap: 14px;
}
.kid-card {
  -webkit-flex: 1;
  flex: 1;
  background: var(--bg);
  border-radius: 14px;
  padding: 14px 16px;
  border-left: 5px solid #ccc;
}
.kid-name { font-size: 20px; font-weight: 700; }
.kid-stars {
  margin-top: 4px;
  font-size: 18px;
  color: var(--star);
  font-weight: 700;
}
.kid-level { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.progress-bar {
  margin-top: 10px;
  height: 12px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--star);
  width: 0%;
  -webkit-transition: width 0.35s ease;
  transition: width 0.35s ease;
}

.kid-tabs {
  display: -webkit-flex;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.kid-tab {
  border: 2px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-appearance: none;
}
.kid-tab.is-active {
  color: #fff;
  border-color: transparent;
}

.check-list { list-style: none; }
.check-item {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  font-size: 17px;
  font-weight: 600;
}
.check-item:last-child { border-bottom: none; }
.check-item.is-done {
  opacity: 0.55;
  text-decoration: line-through;
}
.check-box {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}
.check-item.is-done .check-box {
  background: var(--ok);
  border-color: var(--ok);
}
.check-stars {
  margin-left: auto;
  color: var(--star);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.rewards-list {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 10px;
}
.reward-card {
  -webkit-flex: 1 1 200px;
  flex: 1 1 200px;
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 8px;
}
.reward-label { font-size: 17px; font-weight: 700; }
.reward-cost { font-size: 14px; color: var(--star); font-weight: 700; }
.reward-btn {
  margin-top: auto;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  -webkit-appearance: none;
}
.reward-btn:disabled {
  background: var(--line);
  color: var(--ink-soft);
  cursor: default;
}

/* —— SPORTS —— */
.card-sports { max-width: 720px; margin: 0 auto; }
.sports-list { list-style: none; }
.sport-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.sport-row:last-child { border-bottom: none; }
.sport-teams { -webkit-flex: 1; flex: 1; }
.sport-team {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 600;
  padding: 2px 0;
}
.sport-score {
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}
.sport-status {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  min-width: 70px;
  text-align: right;
}
.sports-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-soft);
}
.sports-note code {
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

/* —— Tab bar —— */
.tabbar {
  height: var(--tabbar-h);
  min-height: var(--tabbar-h);
  display: -webkit-flex;
  display: flex;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 2;
}
.tab {
  -webkit-flex: 1;
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  -webkit-appearance: none;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  margin: 6px 4px;
}
.tab-icon { font-size: 22px; line-height: 1; }
.tab.is-active {
  color: var(--accent);
  background: rgba(91, 141, 239, 0.12);
}
body.night .tab.is-active {
  background: rgba(91, 141, 239, 0.22);
}

/* —— Responsive tweaks for ~1024x768 —— */
@media (max-width: 900px) {
  .big-clock { font-size: 56px; }
  .weather-temp { font-size: 44px; }
  .card-clock, .card-weather, .card-today, .card-notices,
  .card-routine, .card-chores { width: calc(100% - 14px); }
  .week-grid { -webkit-flex-wrap: wrap; flex-wrap: wrap; height: auto; }
  .week-day { min-width: calc(25% - 8px); height: 220px; }
}

/* Hide sports tab when disabled via body class */
body.sports-off #tab-sports,
body.sports-off #panel-sports { display: none !important; }


/* —— Older Safari compatibility: flex gap fallbacks ——
   Safari added flex gap in 14.1; use margins so older iPads still space items. */
.topbar-left > * + *,
.topbar-right > * + * { margin-left: 10px; }
.weather-current > * + * { margin-left: 14px; }
.weather-days > * + * { margin-left: 8px; }
.event-row > * + * { margin-left: 12px; }
.notice-item > * + * { margin-left: 12px; }
.cal-header > * + * { margin-left: 8px; }
.member-legend > * + * { margin-left: 10px; }
.member-legend { margin-bottom: 12px; }
.member-legend .legend-chip { margin-bottom: 6px; }
.week-grid > * + * { margin-left: 8px; }
.kids-progress > * + * { margin-left: 14px; }
.kid-tabs > * + * { margin-left: 8px; }
.check-item > * + * { margin-left: 12px; }
.rewards-list > .reward-card { margin: 5px; }
.sport-row > * + * { margin-left: 12px; }
.tab > * + * { margin-top: 2px; }
.legend-chip > * + * { margin-left: 6px; }

/* Playroom: keep rewards visible on 768-tall screens */
.panel-playroom { padding-bottom: 8px; }
.card-kids { padding: 12px 14px; }
.card-routine, .card-chores {
  min-height: 0;
  max-height: 340px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.card-rewards { padding: 12px 14px; }
.kid-name { font-size: 18px; }
.kid-stars { font-size: 16px; }
.check-item { padding: 9px 6px; font-size: 16px; }
.reward-card { padding: 12px; }
.reward-btn { padding: 8px 10px; }

/* Big clock AM/PM */
.big-clock-wrap {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: baseline;
  align-items: baseline;
  gap: 8px;
}
.big-ampm {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-left: 8px;
}

/* —— KITCHEN tab —— */
.kitchen-toolbar {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.kitchen-tabs-mini { display: -webkit-flex; display: flex; }
.kitchen-tabs-mini > * + * { margin-left: 6px; }
.k-subtab, .filter-chip {
  border: 2px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-appearance: none;
}
.k-subtab.is-active, .filter-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.kitchen-filters {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-align-items: center;
  align-items: center;
}
.kitchen-filters > * { margin: 3px; }
.recipe-search {
  border: 2px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  min-width: 160px;
  -webkit-appearance: none;
  appearance: none;
}
.kitchen-attrib {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.kitchen-view { display: none; }
.kitchen-view.is-active { display: block; }

.recipe-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -6px;
}
.recipe-card {
  width: calc(25% - 12px);
  margin: 6px;
  background: var(--bg-elev);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.recipe-card:active { -webkit-transform: scale(0.98); transform: scale(0.98); }
.recipe-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  background: var(--line);
}
.recipe-card-body { padding: 10px 12px 12px; }
.recipe-card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.recipe-card-subtitle {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-soft);
  max-height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.recipe-card-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}
.recipe-card-tags { margin-top: 6px; }
.tag-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(91,141,239,0.15);
  color: var(--accent);
  margin: 0 4px 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tag-pill.veggie { background: rgba(126,211,33,0.2); color: #4a8a10; }
.tag-pill.quick { background: rgba(245,166,35,0.2); color: #9a6400; }
.tag-pill.kid-friendly { background: rgba(189,16,224,0.15); color: #8a0aa8; }
body.night .tag-pill.veggie { color: #b6e87a; }
body.night .tag-pill.quick { color: #ffd27a; }
body.night .tag-pill.kid-friendly { color: #e9a0f5; }

@media (max-width: 900px) {
  .recipe-card { width: calc(33.33% - 12px); }
}

.primary-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  -webkit-appearance: none;
}
.primary-btn.is-added { background: var(--ok); }

.recipe-detail {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 5;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
}
.recipe-detail-top {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 10px;
}
.recipe-hero {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 12px;
  background: var(--line);
}
.recipe-detail-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}
.recipe-detail-subtitle {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.recipe-detail-meta {
  font-size: 15px;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 10px;
}
.recipe-detail-desc {
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 14px;
  color: var(--ink);
}
.recipe-cols {
  display: -webkit-flex;
  display: flex;
  margin: -7px;
}
.recipe-cols > .card {
  margin: 7px;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}
.recipe-cols .card-ings { -webkit-flex: 0 0 38%; flex: 0 0 38%; }
.ing-line, .step-line {
  font-size: 16px;
  line-height: 1.35;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.step-line { font-size: 18px; padding: 12px 0; }
.step-num {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  margin-right: 10px;
  vertical-align: top;
}
.cook-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-soft);
}

.meal-plan-list { list-style: none; }
.meal-plan-item {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.meal-plan-item > * + * { margin-left: 12px; }
.meal-plan-item img {
  width: 72px; height: 54px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--line);
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}
.meal-plan-text { -webkit-flex: 1; flex: 1; min-width: 0; }
.meal-plan-title { font-size: 17px; font-weight: 700; }
.meal-plan-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.meal-remove {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  -webkit-appearance: none;
  padding: 8px;
}

.grocery-add-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 12px;
}
.grocery-add-row > * + * { margin-left: 8px; }
.grocery-add-row .recipe-search { -webkit-flex: 1; flex: 1; }
.grocery-cat { margin-bottom: 14px; }
.grocery-cat-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.grocery-item {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.grocery-item.is-checked {
  opacity: 0.5;
  text-decoration: line-through;
}
.grocery-item .check-box { margin-right: 12px; }
.grocery-item.is-checked .check-box {
  background: var(--ok);
  border-color: var(--ok);
}

.grocery-staples {
  margin-bottom: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 4px 10px 6px;
  background: rgba(0,0,0,0.02);
}
body.night .grocery-staples { background: rgba(255,255,255,0.03); }
.grocery-staples-summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 0;
  margin-bottom: 0;
  -webkit-user-select: none;
  user-select: none;
}
.grocery-staples-summary::-webkit-details-marker { display: none; }
.grocery-staples-hint {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.7;
  margin-left: 6px;
  font-size: 12px;
}
.grocery-staples[open] .grocery-staples-hint { display: none; }
.grocery-staples .grocery-cat { margin-bottom: 0; }
