:root {
  --bg: #f7f3eb;
  --panel: #fffdf8;
  --ink: #25231f;
  --muted: #716b61;
  --line: #ded6c9;
  --soft: #efe8dc;
  --green: #5d8767;
  --leaf: #dce9d5;
  --blue: #416f8f;
  --sun: #c7843f;
  --pink: #dca9a4;
  --danger: #b8564e;
  --shadow: 0 10px 30px rgba(53, 43, 27, 0.08);
  --text-scale: 1;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(93, 135, 103, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(93, 135, 103, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 38px 38px;
  font-family: "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fffaf0;
  cursor: pointer;
}

button:hover {
  border-color: #cbbda8;
  background: #fff4df;
}

.danger-soft {
  border-color: #e1bbb5;
  color: #9a443c;
  background: #fff3f0;
}

.danger-soft:hover {
  border-color: #cd9188;
  background: #ffe9e5;
}

.primary {
  border-color: var(--green);
  color: white;
  background: var(--green);
}

.primary:hover {
  background: #4f7559;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 0;
}

#addIngredientBtn {
  padding-bottom: 2px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
}

input:disabled,
select:disabled {
  color: #9a9388;
  background: #eee9df;
  cursor: not-allowed;
}

input[type="range"] {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(
      to right,
      #1976f3 0,
      #1976f3 var(--range-progress, 0%),
      #e8edf2 var(--range-progress, 0%),
      #e8edf2 100%
    );
  box-shadow: inset 0 0 0 1px #cfd7df;
}

input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: #1976f3;
  appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: #e8edf2;
  box-shadow: inset 0 0 0 1px #cfd7df;
}

input[type="range"]::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: #1976f3;
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #1976f3;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns:
    var(--sidebar-width, 300px)
    10px
    minmax(520px, 1fr)
    10px
    var(--reco-width, 340px);
  gap: 8px;
  min-height: 100vh;
  padding: 18px;
}

.column-resizer {
  position: relative;
  min-height: calc(100vh - 36px);
  border: 0;
  border-radius: 999px;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::before {
  content: "";
  position: absolute;
  inset: 8px 4px;
  border-radius: 999px;
  background: rgba(93, 135, 103, 0.18);
  transition: background 0.16s ease, transform 0.16s ease;
}

.column-resizer:hover::before,
.column-resizer:focus-visible::before,
.column-resizer.dragging::before {
  background: rgba(65, 111, 143, 0.38);
  transform: scaleX(1.5);
}

body.resizing-columns {
  cursor: col-resize;
  user-select: none;
}

.sidebar,
.reco {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.print-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow);
}

.print-actions button {
  min-height: 34px;
  padding: 5px 7px;
  font-size: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border: 1px solid #bfd2dd;
  border-radius: 50%;
  background: white;
  box-shadow: 0 8px 18px rgba(36, 74, 102, 0.12);
  overflow: hidden;
}

.brand-mark img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  display: block;
}

.brand h1 {
  color: #224966;
  font-family: "Segoe UI Variable Display", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.14;
}

h1,
h2,
p {
  margin: 0;
}

.topbar h2 {
  font-size: 24px;
  letter-spacing: 0;
}

.topbar .eyebrow + h2 {
  margin-top: 9px;
}

.brand p,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.brand h1 + p {
  margin-top: 10px;
}

.text-scale-control {
  border-top: 1px solid rgba(222, 214, 201, 0.72);
  padding-top: 10px;
}

.panel,
.day-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.compact {
  display: grid;
  gap: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-title h2 {
  font-size: 16px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-value {
  display: inline-block;
  color: var(--ink);
  font-size: 14px;
}

.reset-zone {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.reset-zone button {
  width: 100%;
  min-height: 34px;
  font-size: 12px;
  font-weight: 800;
}

.sync-box {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.sync-box strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.sync-box p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  word-break: keep-all;
}

.sync-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.sync-actions button {
  min-height: 30px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 800;
}

.sync-actions button:first-child {
  grid-column: 1 / -1;
}

.legend {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.legend span,
.ingredient-meta {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.tested {
  background: var(--green);
}

.testing {
  background: var(--sun);
}

.locked {
  background: #aaa39a;
}

.ingredient-list {
  display: grid;
  gap: 8px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 4px;
}

.ingredient {
  position: relative;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  padding-top: 12px;
  background: white;
}

.ingredient-edit,
.ingredient-delete {
  position: absolute;
  right: 7px;
  min-height: 26px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 11px;
}

.ingredient-edit {
  top: 7px;
}

.ingredient-delete {
  top: 38px;
  border-color: #e1bbb5;
  color: #9a443c;
  background: #fff3f0;
}

.ingredient.expired {
  border-color: #c8c3bb;
  background: #e9e7e2;
  filter: grayscale(0.75);
}

.ingredient.soon {
  border-color: #dec578;
}

.ingredient strong {
  padding-right: 52px;
  font-size: 14px;
}

.ingredient-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.ingredient-note {
  color: var(--muted);
  font-size: 12px;
}

.expiry-date {
  white-space: nowrap;
}

.expired-date {
  text-decoration: line-through;
}

.expired-text,
.expired-shortage {
  color: #e00000;
  font-weight: 900;
}

.expired-shortage {
  display: block;
  margin-top: 2px;
  font-size: 10px;
}

.expiry-tools {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.expiry-soon-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 6px;
  min-width: 0;
}

.expiry-soon-row input {
  min-height: 32px;
  padding: 4px;
}

.expiry-soon-row .check-row {
  flex: 1 1 128px;
  min-width: 0;
}

#soonDays {
  flex: 0 0 44px;
}

#soonColor {
  flex: 0 0 42px;
}

.expiry-inline-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.expiry-summary {
  min-width: 0;
  border-radius: 8px;
  padding: 8px;
  color: #5f554a;
  background: #f5efe4;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: keep-all;
}

.expiry-summary p {
  margin: 0 0 4px;
}

.expiry-summary p:last-child {
  margin-bottom: 0;
}

.expiry-summary.empty {
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-right: 52px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
}

.status-tested {
  color: #23513a;
  background: #dcebd6;
}

.status-testing {
  color: #734614;
  background: #fde3bd;
}

.status-locked {
  color: #55504a;
  background: #e5e1da;
}

.pref-상 {
  color: #1f4e35;
  background: #d8eddf;
}

.pref-중 {
  color: #5b4a18;
  background: #f4e7b5;
}

.pref-하 {
  color: #7b3d31;
  background: #f4cfca;
}

.pref-none {
  color: #5d6065;
  background: #e8eaed;
}

.allergy {
  color: white;
  background: var(--danger);
}

.commercial {
  color: #4f3e73;
  background: #eee8fa;
}

main {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#clearWeekBtn,
#todayBtn {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 12px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.summary-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 253, 248, 0.9);
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-strip strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 10px;
  transition: transform 160ms ease;
}

.calendar.slide-left {
  transform: translateX(-18px);
}

.calendar.slide-right {
  transform: translateX(18px);
}

.calendar.slide-in-right {
  animation: slideInRight 180ms ease;
}

.calendar.slide-in-left {
  animation: slideInLeft 180ms ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(18px);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-18px);
  }
  to {
    transform: translateX(0);
  }
}

.day-card {
  min-height: 350px;
  overflow: hidden;
}

.day-card.today {
  border-color: #2f6b49;
  box-shadow:
    0 12px 28px rgba(47, 107, 73, 0.18),
    0 0 0 2px rgba(47, 107, 73, 0.16);
  transform: translateY(-1px);
}

.day-card.prepared {
  border-color: #a4c4ad;
  background: #f2faef;
}

.day-card.prepared .day-head {
  background: #dcebd6;
}

.day-card.today {
  border-color: #2f6b49;
}

.day-card.past {
  filter: grayscale(0.85);
  opacity: 0.68;
}

.day-card.past .day-head {
  background: #e3e0da;
}

.selected-day {
  outline: 2px solid rgba(65, 111, 143, 0.24);
}

.day-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 86px;
  padding: 12px;
  background: var(--soft);
}

.day-main,
.day-counts {
  display: grid;
  gap: 4px;
}

.day-main {
  grid-column: 1;
}

.day-counts {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-items: end;
  align-content: start;
  text-align: right;
  padding-top: 1px;
}

.day-name {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  word-break: keep-all;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.day-name small {
  color: #8a8379;
  font-size: 11px;
  font-weight: 800;
}

.date-line {
  white-space: nowrap;
  font-size: 17px;
  font-weight: 900;
}

.dplus {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.babyfood-day {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.prepared-check {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.prepared-check input,
.mode-field input {
  width: auto;
  min-height: auto;
}

.new-test {
  min-height: 28px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: #7f4c21;
  background: #fff1dc;
  font-size: 12px;
  font-weight: 800;
}

.meals {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.meal {
  width: 100%;
  display: block;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: white;
}

.meal:hover,
.selected-meal {
  border-color: var(--blue);
  background: #f4f9fb;
}

.meal[draggable="true"] {
  cursor: grab;
}

.meal[draggable="true"]:active {
  cursor: grabbing;
}

.meal h3 {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 13px;
}

.meal ul,
.prep-list ul,
.recipe-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.meal li,
.prep-list li,
.recipe-lines li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px dashed #eadfce;
  padding: 5px 0;
  color: var(--muted);
  font-size: 12px;
}

.meal li:first-child,
.prep-list li:first-child,
.recipe-lines li:first-child {
  border-top: 0;
}

.meal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.meal-tag {
  border-radius: 999px;
  padding: 3px 7px;
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.meal-tag.porridge {
  background: var(--blue);
}

.meal-tag.cube {
  background: var(--sun);
}

.meal-tag.commercial {
  color: #4f3e73;
  background: #eee8fa;
}

.reco .panel {
  display: grid;
  gap: 12px;
}

.mode-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin: 0;
}

.mode-field legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mode-field label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
}

.include-field {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin: 0;
}

.include-field legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.recommendations {
  display: grid;
  gap: 10px;
}

.recipe-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  box-shadow: var(--shadow);
}

.recipe-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.recipe-card h3 {
  margin: 0;
  font-size: 16px;
}

.recipe-new {
  margin-left: 6px;
  color: #c9362c;
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}

.badge {
  align-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  color: white;
  background: var(--blue);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.cube {
  background: var(--sun);
}

.buy-note {
  border-radius: 8px;
  padding: 8px;
  color: #7b3d31;
  background: #fff0ed;
  font-size: 12px;
  font-weight: 800;
}

.allergy-warning {
  border-radius: 8px;
  padding: 7px;
  color: #8d2d25;
  background: #ffe9e6;
  font-size: 12px;
  font-weight: 900;
}

.commercial-note {
  border-radius: 8px;
  padding: 7px;
  color: #46355f;
  background: #eee8fa;
  font-size: 12px;
  font-weight: 900;
}

.clear-meal {
  display: inline-flex;
  margin-top: 7px;
  border-radius: 999px;
  padding: 3px 7px;
  color: #7b3d31;
  background: #fff0ed;
  font-size: 11px;
  font-weight: 900;
}

.reason {
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0;
}

.score-row span {
  border-radius: 8px;
  padding: 7px;
  background: var(--leaf);
  color: #355b3f;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.apply-recipe,
.preview-apply-recipe {
  width: 100%;
  margin-top: 10px;
}

.prep-list.empty {
  color: var(--muted);
  font-size: 13px;
}

.prep-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.prep-list em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.recipe-library {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.library-recipe {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: white;
  cursor: pointer;
}

.library-recipe:hover,
.library-recipe:focus-visible {
  border-color: #b9c9b4;
  outline: none;
  background: #fbf8f0;
}

.library-recipe.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(93, 135, 103, 0.18);
}

.library-recipe strong,
.library-recipe span {
  display: block;
  word-break: keep-all;
  overflow-wrap: normal;
}

.library-recipe strong {
  font-size: 13px;
}

.library-recipe span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.library-actions {
  display: grid;
  gap: 5px;
}

.library-apply {
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
}

.library-edit {
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
}

.library-delete {
  min-height: 26px;
  padding: 3px 7px;
  border-color: #e1bbb5;
  color: #9a443c;
  background: #fff3f0;
  font-size: 11px;
}

.recipe-preview {
  position: fixed;
  z-index: 20;
  min-width: 0;
  max-height: calc(100vh - 24px);
  overflow: auto;
  filter: drop-shadow(0 16px 28px rgba(53, 43, 27, 0.14));
}

.recipe-preview.empty {
  display: none;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: #fbf7ef;
  font-size: 12px;
  line-height: 1.4;
  word-break: keep-all;
}

.recipe-preview .recipe-card {
  box-shadow: var(--shadow);
}

.month-panel {
  overflow: hidden;
}

.month-past-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fffaf0;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.week-prepared-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fffaf0;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.week-prepared-toggle input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.month-past-toggle input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.month-panel .panel-title h2 {
  font-size: 24px;
  letter-spacing: 0;
}

.month-calendar {
  display: grid;
  gap: 6px;
}

.month-labels,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-labels span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.month-title {
  align-self: center;
  min-width: 86px;
  font-size: 13px;
  text-align: center;
}

.month-cell {
  min-height: 112px;
  border: 1px solid var(--line);
  padding: 7px;
  background: white;
  font-size: 11px;
}

.month-cell.today {
  border-color: #2f6b49;
  box-shadow:
    0 8px 18px rgba(47, 107, 73, 0.14),
    inset 0 0 0 1px rgba(47, 107, 73, 0.22);
}

.month-cell.outside {
  opacity: 0.42;
  background: #f1eee8;
}

.month-cell.prepared {
  background: #f2faef;
}

.month-cell.past {
  border-color: #c8c3bb;
  background: #e9e7e2;
  filter: grayscale(0.75);
  opacity: 0.66;
}

.month-cell.past.today {
  filter: none;
  opacity: 1;
}

.month-cell strong,
.month-cell span,
.month-cell p {
  display: block;
}

.month-cell small {
  color: #4f3e73;
  font-size: 10px;
  font-weight: 900;
}

.month-cell > strong {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.month-cell .month-day-count {
  display: inline;
  color: #8f867a;
  font-size: 9.5px;
  font-weight: 700;
}

.month-cell p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.month-meal {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  border: 1px solid #e6ded0;
  border-radius: 6px;
  padding: 5px;
  background: #fbf7ef;
}

.month-meal b {
  color: #8b5e2f;
  font-size: 10px;
}

.month-meal span {
  color: #2f4f66;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.3;
  word-break: keep-all;
  overflow-wrap: normal;
}

.month-meal em {
  color: #8f867a;
  font-size: 9px;
  font-style: normal;
  line-height: 1.3;
  word-break: keep-all;
  overflow-wrap: normal;
}

.month-new {
  margin-top: 4px;
  color: #7f4c21;
  font-weight: 900;
}

.below-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meal-settings {
  display: grid;
  gap: 6px;
}

.meal-setting-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 6px;
}

.meal-setting-row input[type="text"] {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.phase-editor {
  display: grid;
  gap: 8px;
}

.phase-editor.collapsed {
  display: none;
}

.small-btn {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.phase-row {
  display: grid;
  grid-template-columns: 48px 1fr 1fr;
  align-items: center;
  gap: 6px;
}

.phase-row strong {
  font-size: 12px;
}

.phase-row input {
  min-height: 32px;
  padding: 5px;
  font-size: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.compact-actions {
  gap: 6px;
  margin-top: -4px;
}

.compact-actions button {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check-row input {
  width: auto;
  min-height: auto;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(35, 32, 27, 0.32);
}

.dialog-card {
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
}

.dialog-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
  word-break: keep-all;
}

.danger-message {
  color: #e00000;
  font-weight: 900;
}

#recipeDialog .dialog-card {
  width: min(760px, calc(100vw - 32px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
  align-items: start;
}

#recipeDialog .recipe-dialog-head,
#recipeDialog .dialog-card input[type="hidden"],
#recipeDialog .dialog-card label:has(#recipeTitle),
#recipeDialog .dialog-card label:has(#recipeReason),
#recipeDialog .dialog-actions {
  grid-column: 1 / -1;
}

.recipe-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 6px;
}

.recipe-dialog-head h2 {
  margin: 0;
}

.recipe-commercial-row {
  display: grid;
  grid-template-columns: auto minmax(220px, 270px);
  align-items: center;
  gap: 18px;
}

#recipeDialog .recipe-commercial-row .check-row {
  align-self: center;
  min-height: 38px;
  margin: 0;
}

#recipeBrandWrap {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#recipeBrandWrap input {
  min-height: 34px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

label,
button,
input,
select,
.brand p,
.eyebrow,
.reason,
.prep-list.empty,
.prep-title {
  font-size: calc(13px * var(--text-scale));
}

.brand h1 {
  font-size: calc(21px * var(--text-scale));
}

.topbar h2,
.month-panel .panel-title h2 {
  font-size: calc(24px * var(--text-scale));
}

.panel-title h2 {
  font-size: calc(16px * var(--text-scale));
}

.range-value,
.summary-strip strong {
  font-size: calc(15px * var(--text-scale));
}

.summary-strip span,
.ingredient-meta,
.ingredient-note,
.expiry-inline-text,
.expiry-summary,
.score-row span,
.month-labels span {
  font-size: calc(12px * var(--text-scale));
}

.ingredient strong,
.date-line {
  font-size: calc(14px * var(--text-scale));
}

.tag,
.small-btn,
.print-actions button,
.library-apply,
.library-edit,
.library-delete,
.month-past-toggle,
.month-cell,
.month-meal b,
.month-meal span,
.meal-tag,
.expired-shortage,
.prep-list em {
  font-size: calc(11px * var(--text-scale));
}

.topbar .eyebrow,
.month-cell small,
.month-cell .month-day-count,
.month-meal em {
  font-size: calc(10px * var(--text-scale));
}

.meal h3,
.meal-footer,
.meal li,
.dplus,
.babyfood-day,
.prepared-check,
.new-test,
.library-recipe strong {
  font-size: calc(13px * var(--text-scale));
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .column-resizer {
    display: none;
  }

  .reco {
    grid-column: auto;
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .sidebar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .recipe-preview {
    position: static;
    max-height: none;
    overflow: visible;
    filter: none;
  }

  .recipe-preview:not(.empty) {
    display: block;
    grid-column: 1 / -1;
  }

  .day-head {
    grid-template-columns: 1fr;
  }

  .day-main,
  .day-counts,
  .prepared-check {
    grid-column: 1;
    grid-row: auto;
  }

  .day-counts {
    justify-items: start;
    text-align: left;
    padding-top: 4px;
  }
}

@media (max-width: 820px) {
  .app-shell,
  .reco {
    grid-template-columns: 1fr;
  }

  .calendar {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .below-grid {
    grid-template-columns: 1fr;
  }

  .month-calendar {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .month-labels,
  .month-grid {
    grid-template-columns: repeat(7, minmax(72px, 1fr));
    min-width: 560px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .day-card {
    min-height: auto;
  }

  #recipeDialog .dialog-card {
    grid-template-columns: 1fr;
  }

  .recipe-dialog-head,
  .recipe-commercial-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  #recipeBrandWrap {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: landscape;
    margin: 8mm;
  }

  body {
    color: var(--ink);
    background: var(--bg);
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .sidebar,
  .reco,
  .column-resizer,
  .recipe-preview,
  .top-actions,
  .below-grid {
    display: none !important;
  }

  .app-shell {
    display: block;
    min-height: auto;
    padding: 0;
  }

  main {
    display: grid;
    gap: 0;
    width: 100%;
  }

  body[data-print-mode="week"] .month-panel {
    display: none !important;
  }

  body[data-print-mode="month"] .topbar,
  body[data-print-mode="month"] .summary-strip,
  body[data-print-mode="month"] .calendar {
    display: none !important;
  }

  .topbar {
    align-items: flex-end;
    margin-bottom: 6px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .eyebrow {
    font-size: 10px;
  }

  .summary-strip {
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    background: rgba(255, 253, 248, 0.94);
  }

  .summary-strip div {
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    padding: 8px 10px;
    background: rgba(255, 253, 248, 0.94);
  }

  .summary-strip div:last-child {
    border-right: 0;
  }

  .summary-strip span {
    font-size: 10px;
  }

  .summary-strip strong {
    font-size: 12px;
  }

  body[data-print-mode="week"] .summary-strip,
  body[data-print-mode="week"] .calendar,
  body[data-print-mode="both"] .summary-strip,
  body[data-print-mode="both"] .calendar {
    width: calc(100% - 4mm);
    margin-left: 2mm;
    margin-right: 2mm;
  }

  .calendar {
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    background: white;
  }

  .day-card,
  .panel,
  .month-cell {
    break-inside: avoid;
    box-shadow: none;
  }

  .day-card {
    min-height: 0;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: var(--panel);
  }

  .day-card:last-child {
    border-right: 0;
  }

  .day-card.today,
  .month-cell.today {
    border-color: var(--line);
    box-shadow: none;
    transform: none;
  }

  .day-card.past {
    filter: none;
    opacity: 0.82;
  }

  .day-head {
    min-height: 0;
    padding: 8px;
    background: var(--soft);
  }

  .day-name {
    font-size: 11px;
  }

  .date-line {
    font-size: 14px;
  }

  .dplus,
  .babyfood-day,
  .prepared-check,
  .new-test {
    font-size: 9.5px;
  }

  .new-test {
    min-height: 0;
    padding: 5px 7px;
  }

  .meals {
    gap: 5px;
    padding: 6px;
  }

  .meal {
    min-height: 0;
    border-radius: 6px;
    padding: 0;
    background: white;
  }

  .meal h3 {
    padding: 6px 7px 0;
    font-size: 11px;
  }

  .meal ul {
    padding: 4px 7px;
  }

  .meal li {
    gap: 4px;
    padding: 2px 0;
    font-size: 9.5px;
  }

  .meal-footer {
    padding: 5px 7px 6px;
    font-size: 9.5px;
  }

  .meal-tag {
    padding: 2px 5px;
    font-size: 8.5px;
  }

  .clear-meal {
    display: none !important;
  }

  .month-labels,
  .month-grid {
    grid-template-columns: repeat(7, 1fr);
    width: 100%;
    min-width: 0 !important;
  }

  .month-panel {
    overflow: visible;
    margin-top: 8px;
    border-color: var(--line);
    background: var(--panel);
  }

  .month-calendar {
    overflow: visible !important;
    width: 100%;
    padding-bottom: 0;
  }

  .month-cell {
    min-height: 72px;
    padding: 5px;
    background: white;
    font-size: 9px;
  }

  .month-meal {
    padding: 4px;
    background: #fbf7ef;
  }
}
