:root {
  color-scheme: light;
  --bg: #eef3ee;
  --surface: #ffffff;
  --surface-soft: #f7faf6;
  --ink: #17201b;
  --muted: #6d766f;
  --line: #dfe7df;
  --line-strong: #c9d8ce;
  --green: #1f7a4f;
  --green-strong: #115c39;
  --green-soft: #e7f4ec;
  --tomato: #c94d35;
  --tomato-soft: #fff0ec;
  --yellow: #fff6c9;
  --shadow: 0 18px 42px rgba(24, 43, 32, 0.12);
  --radius: 8px;
  --sidebar: 244px;
  --action-bar: 78px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(238, 243, 238, 0.95)),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100vh - var(--action-bar));
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: calc(100vh - var(--action-bar));
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--green);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #304039;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: var(--line-strong);
  background: var(--green-soft);
  color: var(--green-strong);
}

.icon,
.icon-button {
  display: grid;
  place-items: center;
}

.icon svg,
.icon-button svg,
.upload-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.sidebar-footer span,
.sidebar-footer small {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 18px 18px calc(var(--action-bar) + 18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 2px 4px 14px;
}

.eyeline {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.topbar-actions,
.action-buttons,
.quick-actions,
.table-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: #33433b;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.success {
  border-color: #b9dfc7;
  background: var(--green-soft);
  color: var(--green-strong);
}

.status-pill.warning {
  border-color: #ead88a;
  background: var(--yellow);
  color: #7c6120;
}

.main-grid {
  display: grid;
  grid-template-columns: 310px minmax(520px, 1fr) 380px;
  gap: 14px;
  align-items: stretch;
}

.panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

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

.panel-header p {
  margin-top: 6px;
}

.step-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--tomato-soft);
  color: var(--tomato);
  font-weight: 800;
}

.intake-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 16px;
}

.upload-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 174px;
  margin: 0 18px;
  padding: 18px;
  border: 1px dashed #aac7b5;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(231, 244, 236, 0.8), rgba(255, 255, 255, 0.9)),
    var(--surface);
  text-align: center;
}

.upload-zone.dragover {
  border-color: var(--green);
  background: var(--green-soft);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
}

.upload-zone small {
  max-width: 230px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 18px;
}

.photo-thumb {
  position: relative;
  height: 76px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: #dae7dd;
  background-image: url("assets/sample-food-board.png");
  background-size: 300% 100%;
  box-shadow: inset 0 -34px 34px rgba(0, 0, 0, 0.22);
}

.photo-thumb.enhanced::after {
  content: "已润色";
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(17, 92, 57, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.photo-thumb span {
  position: absolute;
  left: 8px;
  bottom: 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.photo-latte {
  background-position: left center;
}

.photo-salad {
  background-position: center center;
}

.photo-toast {
  background-position: right center;
}

.ai-job-card {
  margin: 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.job-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #dce8df;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #8abf65);
  transition: width 220ms ease;
}

.ai-job-card p {
  margin-top: 10px;
  font-size: 12px;
}

.quick-actions {
  padding: 0 18px;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 800;
}

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

.primary-button:hover {
  background: var(--green-strong);
}

.secondary-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: #26352e;
}

.secondary-button:hover,
.ghost-button:hover {
  background: var(--green-soft);
  color: var(--green-strong);
}

.secondary-button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.ghost-button {
  border-color: var(--line);
  background: transparent;
  color: #304039;
}

.table-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 178px);
}

.table-header {
  align-items: center;
}

.search-box,
.template-select {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-box input,
.template-select select {
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.search-box input {
  width: 150px;
  padding: 0 10px;
}

.template-select select {
  width: 116px;
  padding: 0 8px;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.summary-row span {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.summary-row strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.table-wrap {
  overflow: auto;
  min-height: 0;
  flex: 1;
}

.menu-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.menu-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 38px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  text-align: left;
  font-size: 12px;
}

.menu-table th:nth-child(1) {
  width: 104px;
}

.menu-table th:nth-child(2) {
  width: 142px;
}

.menu-table th:nth-child(4) {
  width: 84px;
}

.menu-table th:nth-child(5) {
  width: 76px;
}

.menu-table th:nth-child(6) {
  width: 74px;
}

.menu-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.menu-table tr.low-confidence {
  background: linear-gradient(90deg, rgba(255, 246, 201, 0.9), rgba(255, 255, 255, 0));
}

.cell-input {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
}

.cell-input:hover,
.cell-input:focus {
  border-color: var(--line-strong);
  background: white;
  outline: none;
}

.price-input {
  text-align: right;
}

.confidence {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 26px;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 800;
}

.confidence.low {
  background: var(--yellow);
  color: #7c6120;
}

.row-button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.row-button:hover {
  color: var(--tomato);
  border-color: #efb7aa;
  background: var(--tomato-soft);
}

.preview-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 178px);
}

.preview-header {
  align-items: center;
}

.print-preview-shell {
  flex: 1;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(23, 32, 27, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 32, 27, 0.04) 25%, transparent 25%),
    var(--surface-soft);
  background-size: 18px 18px;
}

.print-page {
  width: 312px;
  min-height: 442px;
  margin: 0 auto;
  padding: 18px;
  border-radius: 4px;
  background: #fffdf7;
  color: #1a201c;
  box-shadow: var(--shadow);
  transform-origin: top center;
}

.menu-cover {
  display: grid;
  gap: 10px;
  margin-bottom: 15px;
}

.menu-cover h3 {
  margin: 0;
  color: var(--green-strong);
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
}

.menu-cover p {
  color: #667066;
  font-size: 11px;
}

.hero-photo {
  height: 94px;
  border-radius: var(--radius);
  background-image:
    linear-gradient(90deg, rgba(17, 92, 57, 0.74), rgba(17, 92, 57, 0.05)),
    url("assets/sample-food-board.png");
  background-size: cover;
  background-position: center;
}

.template-bistro .hero-photo {
  background-image:
    linear-gradient(90deg, rgba(201, 77, 53, 0.75), rgba(201, 77, 53, 0.05)),
    url("assets/sample-food-board.png");
}

.template-board .hero-photo {
  display: none;
}

.menu-category {
  margin-top: 13px;
}

.menu-category h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--tomato);
  font-size: 13px;
  letter-spacing: 0;
}

.menu-category h4::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #eaded2;
}

.preview-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 7px;
}

.preview-item strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

.preview-item small {
  display: block;
  margin-top: 2px;
  color: #788074;
  font-size: 9px;
  line-height: 1.35;
}

.preview-price {
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 900;
}

.template-board {
  background: #162119;
  color: #f7f0df;
}

.template-board .menu-cover h3,
.template-board .preview-price {
  color: #f9c766;
}

.template-board p,
.template-board .preview-item small {
  color: #b9c7ba;
}

.template-board .menu-category h4 {
  color: #ff8f74;
}

.template-board .menu-category h4::after {
  background: rgba(249, 199, 102, 0.28);
}

.template-bistro {
  background: #fff9f6;
}

.template-bistro .menu-cover h3,
.template-bistro .preview-price {
  color: var(--tomato);
}

.action-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--action-bar);
  padding: 12px 18px 12px calc(var(--sidebar) + 18px);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -12px 40px rgba(24, 43, 32, 0.1);
  backdrop-filter: blur(16px);
}

.action-bar strong,
.action-bar span {
  display: block;
}

.action-bar strong {
  font-size: 14px;
}

.action-bar span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.modal {
  width: min(720px, calc(100vw - 48px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(18, 28, 22, 0.38);
}

.modal-card {
  padding: 22px;
  background: var(--surface);
}

.modal-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-card h2 {
  font-size: 24px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.modal-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  align-items: center;
}

.qr-card {
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(21, 7px);
  grid-template-rows: repeat(21, 7px);
  gap: 2px;
}

.qr-grid span {
  width: 7px;
  height: 7px;
  background: transparent;
}

.qr-grid span.on {
  background: var(--ink);
}

.digital-copy {
  display: grid;
  gap: 10px;
}

.digital-copy p {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--green-strong);
  font-weight: 800;
  word-break: break-all;
}

.digital-copy ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

@media (max-width: 1240px) {
  body {
    min-width: 960px;
  }

  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  :root {
    --sidebar: 210px;
  }

  .main-grid {
    grid-template-columns: 280px minmax(440px, 1fr) 330px;
  }
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    font-size: 12px;
  }

  .nav-item .icon {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 14px 12px calc(var(--action-bar) + 16px);
  }

  .topbar,
  .topbar-actions,
  .main-grid,
  .action-bar {
    display: grid;
  }

  .topbar-actions,
  .action-buttons,
  .quick-actions,
  .table-tools {
    flex-wrap: wrap;
  }

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

  .table-panel,
  .preview-panel {
    min-height: auto;
  }

  .action-bar {
    left: 0;
    min-height: auto;
    padding: 12px;
    gap: 12px;
  }

  .action-buttons {
    justify-content: stretch;
  }

  .action-buttons button {
    flex: 1;
  }

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

@media print {
  body {
    min-width: 0;
    background: white;
  }

  .sidebar,
  .topbar,
  .intake-panel,
  .table-panel,
  .preview-panel > .panel-header,
  .action-bar,
  .modal {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .main-grid,
  .preview-panel,
  .print-preview-shell {
    display: block;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    background: white;
    box-shadow: none;
  }

  .preview-panel {
    border: 0;
  }

  .print-page {
    width: 210mm;
    min-height: 297mm;
    padding: 16mm;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }
}
