:root {
  --bg: #fff7ed;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-soft: #fffaf1;
  --text: #3a2418;
  --muted: #8b6f5a;
  --line: rgba(93, 54, 31, 0.12);
  --line-strong: rgba(93, 54, 31, 0.2);
  --primary: #f97316;
  --primary-dark: #d95b0b;
  --primary-soft: #ffedd5;
  --accent: #65a30d;
  --accent-soft: #fef3c7;
  --green: #4d7c0f;
  --green-bg: #ecfccb;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --shadow-sm: 0 1px 2px rgba(93, 54, 31, 0.06), 0 10px 26px rgba(93, 54, 31, 0.08);
  --shadow-md: 0 20px 52px rgba(93, 54, 31, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

* {
  scrollbar-color: rgba(124, 45, 18, 0.32) rgba(255, 250, 241, 0.58);
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: rgba(255, 250, 241, 0.58);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(124, 45, 18, 0.28);
  border: 2px solid rgba(255, 250, 241, 0.58);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 45, 18, 0.44);
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 16% 0%, rgba(249, 115, 22, 0.18), transparent 32%),
    radial-gradient(circle at 88% 6%, rgba(101, 163, 13, 0.13), transparent 30%),
    linear-gradient(180deg, #fffdf7 0%, var(--bg) 46%, #ffedd5 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.2);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
  touch-action: manipulation;
}

button:hover {
  background: var(--primary-dark);
  box-shadow: 0 12px 26px rgba(249, 115, 22, 0.26);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
  box-shadow: none;
}

button.ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-color: var(--line);
  box-shadow: none;
}

button.ghost:hover {
  background: var(--primary-soft);
  border-color: rgba(249, 115, 22, 0.28);
  color: var(--primary-dark);
}

button.danger {
  background: var(--red);
  box-shadow: 0 8px 18px rgba(201, 59, 59, 0.16);
}

button.danger:hover {
  background: #aa2e2e;
}

button.success {
  background: var(--green);
  box-shadow: 0 8px 18px rgba(22, 128, 60, 0.16);
}

button.success:hover {
  background: #3f6212;
}

.app-shell {
  width: min(1260px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.84);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.topbar > div {
  min-width: 0;
  max-width: 100%;
}

.topbar h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.05;
  letter-spacing: 0;
}

.app-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  background: #fff7ed;
}

.summary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 100%;
  margin-top: 10px;
}

.metric {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 251, 235, 0.8);
  color: var(--text);
}

.metric strong {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.metric em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.metric.ok {
  background: var(--green-bg);
  border-color: rgba(22, 128, 60, 0.16);
}

.metric.warn {
  background: var(--amber-bg);
  border-color: rgba(170, 101, 0, 0.2);
}

.metric.bad {
  background: var(--red-bg);
  border-color: rgba(201, 59, 59, 0.18);
}

.metric.info {
  background: var(--primary-soft);
  border-color: rgba(249, 115, 22, 0.2);
}

.metric.wide strong {
  max-width: 140px;
}

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

.mode-tabs,
.page-tabs,
.toolbar,
.actions,
.form-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-tabs,
.page-tabs {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 12px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.74);
  box-shadow: 0 1px 2px rgba(24, 33, 27, 0.04);
  backdrop-filter: blur(12px);
}

.mobile-tabs {
  display: none;
}

.page-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.mode-tabs button,
.page-tabs button {
  min-height: 34px;
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  box-shadow: none;
  white-space: nowrap;
}

.page-tabs button[draggable="true"] {
  cursor: grab;
}

.page-tabs button.dragging {
  opacity: 0.46;
  cursor: grabbing;
}

.mode-tabs button:hover,
.page-tabs button:hover {
  background: rgba(249, 115, 22, 0.11);
  color: var(--text);
  transform: none;
}

.mode-tabs button.active,
.page-tabs button.active {
  background: #7c2d12;
  color: #fff;
  border-color: #7c2d12;
  box-shadow: 0 8px 18px rgba(124, 45, 18, 0.18);
}

.content {
  min-height: 580px;
}

.hidden {
  display: none !important;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(286px, 1fr));
  gap: 16px;
}

.today-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.today-card {
  min-width: 0;
}

.meal-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.meal-switch button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.meal-switch button:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.meal-switch button.active {
  background: #7c2d12;
  color: #fff;
  border-color: #7c2d12;
  box-shadow: 0 10px 22px rgba(124, 45, 18, 0.18);
}

.meal-switch span {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(24, 33, 27, 0.08);
  font-size: 12px;
}

.meal-switch button.active span {
  background: rgba(255, 255, 255, 0.18);
}

.card,
.panel {
  position: relative;
  min-width: 0;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.card {
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(249, 115, 22, 0.24);
  box-shadow: var(--shadow-md);
}

.compact-card .card-body {
  display: grid;
  gap: 8px;
}

.compact-card p {
  margin: 0;
}

.compact-card .actions:last-child {
  margin-top: 4px;
}

.card[data-action="view-recipe"] {
  cursor: pointer;
}

.card[data-action="view-recipe"]:hover {
  border-color: rgba(249, 115, 22, 0.34);
}

.card-body,
.panel {
  padding: 16px;
}

.recipe-image,
.image-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #fed7aa, #fef3c7 52%, #dcfce7);
}

.image-placeholder {
  position: relative;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, var(--cover-color, #d8f3dc), rgba(255, 255, 255, 0.68)),
    linear-gradient(135deg, #fed7aa, #fef3c7 52%, #dcfce7);
  color: rgba(58, 36, 24, 0.78);
  font-size: 22px;
  font-weight: 800;
  isolation: isolate;
}

.image-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.42);
  z-index: -1;
}

.card h3,
.panel h2,
.panel h3 {
  margin: 0 0 8px;
  letter-spacing: 0;
}

.panel h2 {
  font-size: 21px;
}

.card h3 {
  font-size: 20px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 760;
}

.status.ok {
  color: var(--green);
  background: var(--green-bg);
}

.status.bad {
  color: var(--red);
  background: var(--red-bg);
}

.status.warn {
  color: var(--amber);
  background: var(--amber-bg);
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #fff7ed;
  color: #7c2d12;
  border: 1px solid rgba(249, 115, 22, 0.16);
  font-size: 12px;
  font-weight: 620;
  overflow-wrap: anywhere;
}

.missing {
  display: inline-block;
  color: var(--red);
  font-weight: 760;
}

.ok-text {
  color: var(--green);
  font-weight: 760;
}

.toolbar {
  margin-bottom: 16px;
  align-items: center;
}

.toolbar > * {
  min-width: 0;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(64px, 1fr));
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.78);
}

.segmented button {
  min-height: 34px;
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  box-shadow: none;
}

.segmented button.active,
.segmented button:hover {
  background: #7c2d12;
  color: #fff;
  transform: none;
}

.admin-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  padding: 10px 11px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(249, 115, 22, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: #5f3b25;
  font-size: 14px;
  font-weight: 620;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 12px;
}

.full {
  grid-column: 1 / -1;
}

.shopping-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.shopping-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.shopping-item.checked {
  background: rgba(248, 250, 247, 0.74);
  border-color: rgba(93, 54, 31, 0.08);
}

.shopping-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.shopping-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.shopping-toggle span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid rgba(139, 111, 90, 0.38);
  border-radius: 999px;
  background: #fff;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.shopping-toggle span::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  opacity: 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.shopping-toggle input:focus-visible + span {
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14);
}

.shopping-toggle input:checked + span {
  border-color: var(--green);
  background: var(--green);
}

.shopping-toggle input:checked + span::after {
  opacity: 1;
}

.shopping-main {
  min-width: 0;
}

.shopping-main strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-main em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}

.shopping-item.checked .shopping-main strong {
  color: var(--muted);
  text-decoration: line-through;
}

.shopping-item.checked .shopping-main em {
  color: rgba(139, 111, 90, 0.62);
}

.shopping-actions {
  flex-wrap: nowrap;
}

.shopping-actions button {
  min-height: 34px;
  padding: 6px 9px;
}

.history-groups {
  display: grid;
  gap: 14px;
}

.cook-stats {
  margin-bottom: 14px;
}

.rank-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.rank-item {
  display: grid;
  grid-template-columns: 28px minmax(88px, 160px) minmax(100px, 1fr) 52px;
  gap: 10px;
  align-items: center;
}

.rank-no {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 850;
}

.rank-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(24, 33, 27, 0.08);
}

.rank-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.rank-item em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 760;
  text-align: right;
}

.history-day {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.history-day header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.history-day h2 {
  margin: 0;
  font-size: 19px;
}

.history-day header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.history-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item p {
  margin: 3px 0 0;
}

.history-item button {
  min-height: 34px;
  padding: 6px 10px;
}

.stepper {
  display: grid;
  grid-template-columns: 42px minmax(72px, 1fr) 42px;
  gap: 6px;
  align-items: center;
}

.stepper input {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.stepper-btn {
  display: grid;
  min-height: 42px;
  padding: 0;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.table {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.table th,
.table td {
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.table td {
  background: rgba(255, 255, 255, 0.68);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.table td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
}

.table td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: 16px;
  align-items: start;
}

.step-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  margin-top: 12px;
  background: rgba(248, 250, 247, 0.82);
}

.consume-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(154px, 190px) 44px;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(24, 33, 27, 0.09);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.timer {
  width: fit-content;
  margin: 14px 0;
  padding: 10px 16px;
  border-radius: 8px;
  background: #7c2d12;
  color: #fff;
  font-size: 42px;
  font-weight: 850;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #7c2d12;
  color: #fff;
  padding: 11px 15px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 251, 235, 0.7);
}

.empty::before {
  content: "🥣";
  display: block;
  margin-bottom: 6px;
  font-size: 24px;
}

.fridge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.fridge-menu .fridge-grid {
  grid-template-columns: 1fr;
}

.fridge-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.fridge-item:hover {
  border-color: rgba(249, 115, 22, 0.34);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.fridge-item strong,
.fridge-item p {
  overflow-wrap: anywhere;
}

.fridge-item .actions {
  grid-column: 1 / -1;
}

.fridge-meta {
  justify-self: end;
}

.fridge-shop {
  display: grid;
  gap: 14px;
}

.fridge-searchbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.fridge-shop-body {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.fridge-cats {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.76);
  box-shadow: var(--shadow-sm);
}

.fridge-cats button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  border-color: transparent;
  box-shadow: none;
  text-align: left;
}

.fridge-cats button span {
  color: var(--muted);
  font-size: 12px;
}

.fridge-cats button.active,
.fridge-cats button:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
  transform: none;
}

.fridge-menu {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.fridge-menu-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.fridge-menu-head h2 {
  margin: 0;
}

.fridge-menu-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hint,
.notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(217, 119, 6, 0.24);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: #7c3f00;
  font-size: 14px;
  font-weight: 680;
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.08);
  position: relative;
}

.notice::before {
  content: "💡";
  margin-right: 6px;
}

.warning-panel {
  margin-bottom: 14px;
  border-color: rgba(217, 119, 6, 0.22);
}

.warning-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.warning-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 13px;
}

.warning-item.soon {
  border-color: rgba(170, 101, 0, 0.28);
  background: var(--amber-bg);
}

.warning-item.expired {
  border-color: rgba(201, 59, 59, 0.28);
  background: var(--red-bg);
}

.warning-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warning-item span,
.warning-item em {
  white-space: nowrap;
}

.warning-item span {
  color: var(--amber);
  font-weight: 760;
}

.warning-item.expired span {
  color: var(--red);
}

.warning-item em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
}

.warning-item p {
  overflow-wrap: anywhere;
}

.recipe-shop {
  display: grid;
  gap: 14px;
}

.recipe-searchbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 150px auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.recipe-shop-body {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.recipe-cats {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.76);
  box-shadow: var(--shadow-sm);
}

.recipe-cats button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  border-color: transparent;
  box-shadow: none;
  text-align: left;
}

.recipe-cats button span {
  color: var(--muted);
  font-size: 12px;
}

.recipe-cats button.active,
.recipe-cats button:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
  transform: none;
}

.recipe-menu {
  display: grid;
  gap: 10px;
}

.recipe-menu-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.recipe-menu-item:hover {
  border-color: rgba(249, 115, 22, 0.24);
}

.recipe-menu-item .recipe-image,
.recipe-menu-item .image-placeholder {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
}

.recipe-menu-main {
  min-width: 0;
}

.recipe-menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.recipe-menu-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.recipe-menu-main p {
  display: -webkit-box;
  margin: 6px 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.recipe-menu-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.recipe-menu-meta span {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 247, 237, 0.9);
}

.recipe-menu-meta .warn-text,
.recipe-menu-missing {
  color: var(--amber);
}

.recipe-menu-missing {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 760;
}

.recipe-menu-actions {
  margin-top: 8px;
}

.recipe-menu-actions button {
  min-height: 34px;
  padding: 6px 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(58, 36, 24, 0.34);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.94);
  box-shadow: 0 28px 90px rgba(93, 54, 31, 0.28);
  padding: 18px 24px 18px 18px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.94);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(93, 54, 31, 0.12);
  font-size: 22px;
  line-height: 1;
}

.modal-close:hover {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(201, 59, 59, 0.2);
  box-shadow: none;
}

.modal-card.wide {
  width: min(860px, 100%);
  padding: 0;
}

.modal-card.compact {
  width: min(440px, 100%);
}

.modal-card h2 {
  margin: 0 0 8px;
  letter-spacing: 0;
}

.modal-card > :not(.modal-close):not(.recipe-image):not(.image-placeholder) {
  min-height: 0;
  overflow: auto;
  padding-right: 8px;
}

.modal-card > h2,
.modal-card > form,
.modal-card > p,
.modal-card > .actions {
  padding-top: 22px;
}

.modal-body {
  padding: 18px;
}

.modal-card.wide > .modal-body {
  padding-right: 18px;
}

.detail-cover {
  flex: 0 0 auto;
  max-height: 260px;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
}

.detail-cover .recipe-image,
.detail-cover .image-placeholder {
  aspect-ratio: 16 / 7;
  max-height: 260px;
  object-fit: cover;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.option-card {
  display: grid;
  gap: 4px;
  min-height: 92px;
  justify-items: start;
  align-content: center;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
  text-align: left;
}

.option-card:hover {
  background: var(--primary-soft);
  border-color: rgba(249, 115, 22, 0.3);
  color: var(--primary-dark);
}

.option-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  padding: 6px 10px;
  color: var(--text);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.choice-pill input {
  width: auto;
  accent-color: var(--primary);
}

@media (max-width: 1080px) and (min-width: 821px) {
  .today-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1260px);
    padding: 12px 0 86px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .mode-tabs,
  .app-shell > .page-tabs {
    display: none;
  }

  .mobile-tabs {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 252, 244, 0.94);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
  }

  .mobile-tabs button {
    min-width: 0;
    min-height: 44px;
    padding: 6px 3px;
    background: transparent;
    color: var(--muted);
    border-color: transparent;
    box-shadow: none;
    font-size: 12px;
    line-height: 1.15;
  }

  .mobile-tabs button.active,
  .mobile-tabs button:hover {
    background: #7c2d12;
    color: #fff;
    transform: none;
  }

  .summary-metrics {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .metric {
    flex: 0 0 auto;
    min-width: 92px;
  }

  .metric strong {
    max-width: 96px;
  }

  .top-actions,
  .top-actions button,
  .toolbar,
  .toolbar input,
  .toolbar button {
    width: 100%;
  }

  .grid,
  .fridge-grid,
  .warning-list,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .today-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .actions {
    align-items: stretch;
  }

  .actions > button,
  .actions > label.ghost {
    flex: 1 1 auto;
  }

  .compact-card .actions {
    align-items: center;
  }

  .compact-card .actions > button {
    flex: 1 1 120px;
  }

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

  .panel,
  .card-body {
    padding: 14px;
  }

  .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-spacing: 0 7px;
    -webkit-overflow-scrolling: touch;
  }

  .table th,
  .table td {
    white-space: nowrap;
  }

  .table td:last-child {
    min-width: 128px;
  }

  .shopping-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .shopping-actions {
    grid-column: 2;
  }

  .history-day {
    padding: 11px;
  }

  .rank-item {
    grid-template-columns: 28px minmax(0, 1fr) 48px;
  }

  .rank-bar {
    grid-column: 2 / -1;
  }

  .history-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-item button {
    width: 100%;
  }

  .consume-row {
    grid-template-columns: 1fr;
  }

  .stepper {
    grid-template-columns: 40px minmax(70px, 1fr) 40px;
  }

  .timer {
    width: 100%;
    text-align: center;
    font-size: 36px;
  }

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

  .meal-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meal-switch button {
    min-width: 0;
    gap: 8px;
  }

  .fridge-item {
    grid-template-columns: 1fr;
  }

  .fridge-meta {
    justify-self: start;
  }

  .warning-item {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .recipe-searchbar {
    grid-template-columns: 1fr 1fr;
  }

  .recipe-searchbar input,
  .recipe-searchbar button {
    grid-column: 1 / -1;
  }

  .recipe-shop-body {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
  }

  .fridge-searchbar {
    grid-template-columns: 1fr 1fr;
  }

  .fridge-searchbar input {
    grid-column: 1 / -1;
  }

  .fridge-shop-body {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
  }

  .recipe-cats {
    top: 8px;
    max-height: calc(100dvh - 180px);
    padding: 5px;
  }

  .recipe-cats button {
    min-height: 38px;
    padding: 7px 8px;
    font-size: 13px;
  }

  .fridge-cats {
    top: 8px;
    max-height: calc(100dvh - 180px);
    padding: 5px;
  }

  .fridge-cats button {
    min-height: 38px;
    padding: 7px 8px;
    font-size: 13px;
  }

  .fridge-menu {
    padding: 10px;
  }

  .fridge-menu-head {
    margin-bottom: 8px;
  }

  .recipe-menu-item {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .recipe-menu-head h3 {
    font-size: 15px;
  }

  .recipe-menu-main p {
    -webkit-line-clamp: 1;
  }

  .recipe-menu-actions button {
    flex: 1 1 86px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-card,
  .modal-card.wide,
  .modal-card.compact {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 14px 20px 14px 14px;
  }

  .modal-card.wide {
    padding: 0;
  }

  .modal-close {
    top: 8px;
    right: 8px;
  }

  .modal-body {
    padding: 14px 18px 14px 14px;
  }

  .detail-cover {
    max-height: 180px;
  }

  .detail-cover .recipe-image,
  .detail-cover .image-placeholder {
    aspect-ratio: 16 / 8;
    max-height: 180px;
  }

  .choice-grid {
    align-items: stretch;
  }

  .choice-pill {
    flex: 1 1 calc(50% - 8px);
  }
}

@media (max-width: 480px) {
  button,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  button {
    min-height: 44px;
    padding: 9px 11px;
  }

  .app-shell {
    width: min(100% - 14px, 1260px);
    padding-top: 8px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px;
  }

  .topbar h1 {
    max-width: 100%;
    font-size: 24px;
    overflow-wrap: anywhere;
  }

  .app-logo {
    width: 32px;
    height: 32px;
  }

  .summary-metrics {
    gap: 6px;
  }

  .metric {
    justify-content: center;
    min-height: 36px;
    min-width: 76px;
    padding: 5px 7px;
  }

  .metric strong,
  .metric.wide strong {
    max-width: 70px;
    font-size: 14px;
  }

  .metric em {
    font-size: 11px;
  }

  .mode-tabs,
  .page-tabs {
    margin-bottom: 10px;
  }

  .page-tabs button {
    min-height: 40px;
  }

  .content {
    min-height: auto;
  }

  .grid,
  .today-grid {
    gap: 12px;
  }

  .today-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .meal-switch {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .meal-switch button {
    min-height: 38px;
    padding: 6px 7px;
    font-size: 13px;
  }

  .meal-switch span {
    min-width: 20px;
    height: 20px;
  }

  .today-card .recipe-image,
  .today-card .image-placeholder {
    aspect-ratio: 1 / 1;
  }

  .today-card .card-body {
    padding: 7px;
  }

  .today-card h3 {
    margin-bottom: 5px;
    font-size: 14px;
    line-height: 1.25;
  }

  .today-card p {
    margin: 5px 0;
  }

  .today-card .tag,
  .today-card .status {
    min-height: 20px;
    padding: 2px 5px;
    font-size: 10px;
  }

  .today-card .missing,
  .today-card .ok-text {
    font-size: 11px;
  }

  .today-card .actions {
    gap: 4px;
  }

  .today-card .actions > button {
    flex: 1 1 100%;
    min-height: 30px;
    padding: 4px 5px;
    font-size: 11px;
  }

  .panel > .actions,
  .modal-card .actions,
  .modal-body .actions,
  form > .actions,
  .step-box > .actions {
    width: 100%;
  }

  .panel > .actions > button,
  .panel > .actions > label.ghost,
  .modal-card .actions > button,
  .modal-card .actions > label.ghost,
  .modal-body .actions > button,
  .modal-body .actions > label.ghost,
  form > .actions > button,
  form > .actions > label.ghost,
  .step-box > .actions > button,
  .step-box > .actions > label.ghost {
    flex-basis: 100%;
    width: 100%;
  }

  .card .actions,
  .compact-card .actions {
    width: auto;
  }

  .card .actions > button,
  .compact-card .actions > button {
    flex: 1 1 128px;
    width: auto;
  }

  .card h3 {
    font-size: 18px;
  }

  .today-card h3 {
    font-size: 14px;
  }

  .shopping-item {
    padding: 9px;
  }

  .shopping-actions {
    width: 100%;
  }

  .shopping-actions > button {
    flex: 1 1 auto;
    width: auto;
  }

  .recipe-searchbar {
    gap: 6px;
    padding: 8px;
  }

  .recipe-searchbar select {
    padding: 8px 7px;
  }

  .segmented {
    width: 100%;
  }

  .recipe-shop-body {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .fridge-searchbar {
    gap: 6px;
    padding: 8px;
  }

  .fridge-shop-body {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .recipe-cats button {
    min-height: 34px;
    padding: 6px;
    font-size: 12px;
  }

  .recipe-cats button span {
    font-size: 11px;
  }

  .fridge-cats button {
    min-height: 34px;
    padding: 6px;
    font-size: 12px;
  }

  .fridge-cats button span {
    font-size: 11px;
  }

  .fridge-menu {
    padding: 8px;
  }

  .recipe-menu-item {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .recipe-menu-meta {
    gap: 4px;
    font-size: 11px;
  }

  .recipe-menu-actions {
    gap: 4px;
  }

  .recipe-menu-actions button {
    min-height: 30px;
    padding: 4px 6px;
    font-size: 11px;
  }

  .stepper {
    grid-template-columns: 36px minmax(64px, 1fr) 36px;
  }

  .stepper-btn {
    min-height: 38px;
  }

  .panel h2 {
    font-size: 19px;
  }

  .notice,
  .hint {
    padding: 10px 11px;
  }

  .empty {
    padding: 22px 12px;
  }

  .timer {
    font-size: 32px;
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal-card,
  .modal-card.wide,
  .modal-card.compact {
    max-height: 100dvh;
    border-radius: 8px 8px 0 0;
  }

  .modal-close {
    top: 8px;
    right: 8px;
    width: 40px;
    min-height: 40px;
  }

  .detail-cover {
    max-height: 150px;
  }

  .detail-cover .recipe-image,
  .detail-cover .image-placeholder {
    max-height: 150px;
  }

  .choice-pill {
    flex-basis: 100%;
  }
}

@media (max-width: 360px) {
  .app-shell {
    width: min(100% - 10px, 1260px);
  }

  .topbar {
    padding: 10px;
  }

  .topbar h1 {
    gap: 7px;
    font-size: 22px;
  }

  .app-logo {
    width: 28px;
    height: 28px;
  }

  .metric {
    min-width: 68px;
  }
}
