:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d4d4d4;
  --accent: #102a43;
  --accent-strong: #0b1f33;
  --warm: #6b7280;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 26px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.last-updated {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.collection-info {
  margin: 4px 0 0;
  color: #344054;
  font-size: 12px;
  line-height: 1.4;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.toolbar {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.model-info {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-align: right;
  text-transform: none;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.date-filter,
.meal-filter {
  display: inline-flex;
  min-height: 42px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(35, 31, 23, 0.06);
}

.date-filter {
  gap: 0;
}

.date-filter button,
.meal-filter button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 14px;
}

.date-filter button[aria-pressed="true"],
.meal-filter button[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
}

button,
.toggle {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(35, 31, 23, 0.06);
}

button {
  padding: 0 16px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.status {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--muted);
}

.status[hidden] {
  display: none;
}

.status.error {
  border-color: #98a2b3;
  color: var(--warm);
  background: #eeeeee;
}

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

.source-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.source-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
}

.source-actions {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.source-actions .source-link {
  text-align: right;
}

.source-type {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}

.source-link {
  align-self: flex-start;
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.source-link:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.summary {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.content {
  border-top: 1px solid var(--line);
  padding: 16px 18px 18px;
}

.source-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding: 0 18px 14px;
}

.source-updated {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.menu-list,
.ocr-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.meal {
  padding: 12px;
  border: 1px solid #d4d4d4;
  border-radius: 0;
  background: #fafafa;
}

.meal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-weight: 800;
}

.meal-title-main {
  min-width: 0;
}

.meal-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.meal-day {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item {
  padding: 5px 8px;
  border-radius: 0;
  background: #eeeeee;
  color: #102a43;
  font-size: 13px;
  line-height: 1.3;
}

.image-wrap {
  display: grid;
  gap: 12px;
}

.menu-image {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #f0f0f0;
}

.menu-image:hover {
  border-color: var(--accent);
}

.image-button {
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: zoom-in;
}

.ocr-block {
  display: grid;
  gap: 10px;
}

.section-title {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.validation-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ocr-raw-details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.ocr-raw-details summary {
  cursor: pointer;
}

.ocr-raw-details .ocr-list {
  margin-top: 10px;
}

.ocr-list li,
.raw-text {
  padding: 9px 10px;
  border: 1px solid #d4d4d4;
  border-radius: 0;
  background: #fafafa;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.45;
}

.raw-text {
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.empty-notice {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #f7f7f7;
  color: #344054;
}

body.modal-open {
  overflow: hidden;
}

.image-modal[hidden] {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 20, 17, 0.72);
}

.image-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, 100%);
  height: min(820px, calc(100vh - 48px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.image-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.image-modal-header h2 {
  font-size: 18px;
}

.icon-button {
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.image-modal-img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #f0f0f0;
}

.image-modal-source {
  justify-self: end;
  margin: 12px 16px 14px;
}

@media (max-width: 920px) {
  .grid {
    grid-template-columns: 1fr;
  }

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

  .actions {
    justify-content: flex-start;
  }

  .toolbar {
    justify-items: start;
    width: 100%;
  }

  .model-info {
    text-align: left;
  }

  .date-filter,
  .meal-filter {
    order: 3;
    width: 100%;
  }

  .date-filter button,
  .meal-filter button {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .source-header {
    flex-direction: column;
  }

  .source-link {
    align-self: stretch;
    text-align: center;
  }

  .source-actions {
    align-self: stretch;
  }

  .source-actions .source-link {
    flex: 1;
  }

  .image-modal {
    padding: 10px;
  }

  .image-modal-panel {
    height: min(760px, calc(100vh - 20px));
  }
}
