:root {
  color-scheme: light;
  --ui-bg: #eef3f3;
  --ui-panel: #ffffff;
  --ui-panel-soft: #f7faf9;
  --ui-ink: #182326;
  --ui-muted: #667477;
  --ui-line: #dbe4e4;
  --ui-accent: #8cc63f;
  --ui-accent-2: #506b70;
  --ui-accent-dark: #2d4a4f;
  --ui-danger: #9b2532;
  --shadow: 0 18px 44px rgba(28, 42, 45, 0.13);
  --shadow-soft: 0 10px 26px rgba(28, 42, 45, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 22% 0%, rgba(140, 198, 63, 0.12), transparent 32%),
    linear-gradient(135deg, #edf3f3 0%, #f7f5f0 55%, #edf2f2 100%);
  color: var(--ui-ink);
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .app-shell,
body.auth-locked .modal-backdrop {
  display: none !important;
}

body:not(.auth-locked) .access-screen {
  display: none;
}

.access-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.access-card {
  width: min(380px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.access-card h1 {
  margin: -8px 0 4px;
  font-size: 28px;
  letter-spacing: 0;
}

.access-card button {
  width: 100%;
}

.access-error {
  margin: -4px 0 0;
  color: #9b2532;
  font-size: 13px;
  font-weight: 800;
}

body.is-preview-category-dragging,
body.is-preview-category-dragging * {
  cursor: grabbing !important;
}

button,
input,
select {
  font: inherit;
}

button,
.import-button {
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--ui-accent-2);
  color: #fff;
  min-height: 38px;
  padding: 0 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 800;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover,
.import-button:hover {
  filter: none;
  background: var(--ui-accent-dark);
  box-shadow: 0 8px 18px rgba(80, 107, 112, 0.2);
  transform: translateY(-1px);
}

.ghost-button,
.icon-button {
  background: #fff;
  color: var(--ui-ink);
  border-color: var(--ui-line);
}

.ghost-button:hover,
.icon-button:hover {
  background: var(--ui-panel-soft);
  border-color: rgba(80, 107, 112, 0.28);
  box-shadow: 0 8px 18px rgba(28, 42, 45, 0.1);
}

.danger-button {
  width: 100%;
  background: #fff;
  color: #842a2a;
  border-color: #e7caca;
}

.square-button {
  width: 38px;
  padding: 0;
}

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

input,
select {
  width: 100%;
  border: 1px solid var(--ui-line);
  border-radius: 7px;
  background: #fff;
  color: var(--ui-ink);
  min-height: 38px;
  padding: 8px 10px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus {
  outline: 0;
  border-color: rgba(80, 107, 112, 0.5);
  box-shadow: 0 0 0 3px rgba(140, 198, 63, 0.18);
}

input[type="range"] {
  min-height: auto;
  padding: 0;
  accent-color: var(--ui-accent);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--ui-accent);
}

input[type="file"] {
  font-size: 13px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(640px, 760px) minmax(0, 1fr);
  min-height: 100vh;
}

.editor-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--ui-line);
  padding: 22px;
  box-shadow: 8px 0 32px rgba(28, 42, 45, 0.08);
  z-index: 3;
}

.panel-head {
  position: sticky;
  top: -22px;
  z-index: 4;
  margin: -22px -22px 0;
  padding: 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--ui-line);
  backdrop-filter: blur(18px);
}

.panel-head,
.group-title-row,
.stage-toolbar,
.view-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.panel-head h1 {
  margin: 2px 0 0;
  font-size: 27px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--ui-accent-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.control-group {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(219, 228, 228, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.control-group:first-of-type {
  margin-top: 16px;
}

.control-group h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

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

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

.fixed-format {
  border: 1px solid var(--ui-line);
  border-radius: 7px;
  background: var(--ui-panel-soft);
  color: var(--ui-ink);
  min-height: 38px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 800;
}

.type-scale-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-panel-soft);
}

.range-line {
  display: grid;
  gap: 5px;
}

.range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 800;
}

.range-head output {
  color: var(--ui-ink);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-muted);
  min-height: 36px;
}

.segmented button.active {
  background: var(--ui-accent);
  color: #fff;
}

.toggle-line {
  display: flex;
  align-items: center;
  color: var(--ui-ink);
}

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

.import-button input {
  display: none;
}

.category-editor {
  display: grid;
  gap: 10px;
}

.category-card {
  border: 1px solid rgba(219, 228, 228, 0.95);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(28, 42, 45, 0.06);
  transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.category-card:hover {
  border-color: rgba(80, 107, 112, 0.28);
  box-shadow: 0 12px 24px rgba(28, 42, 45, 0.1);
}

.category-card.is-dragging {
  opacity: 0.58;
  transform: scale(0.995);
}

.category-card.is-drag-over,
.category-card.is-drag-over-after {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 2px rgba(124, 38, 56, 0.18);
}

.category-card.is-drag-over {
  border-top-width: 3px;
}

.category-card.is-drag-over-after {
  border-bottom-width: 3px;
}

.category-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #f7faf9);
  border-bottom: 1px solid var(--ui-line);
  align-items: center;
}

.category-top button {
  min-width: 38px;
  padding: 0 10px;
}

.edit-category {
  min-width: 72px;
}

.category-count {
  min-width: 28px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(140, 198, 63, 0.14);
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.move-category {
  cursor: grab;
}

.move-category:active {
  cursor: grabbing;
}

.price-editor-field {
  display: grid;
  gap: 3px;
}

.price-editor-field span {
  color: var(--ui-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.price-editor-field input {
  min-height: 32px;
  font-size: 13px;
}

.remove-price {
  width: 34px;
  min-width: 34px;
  padding: 0;
  color: #842a2a;
  border-color: #e7caca;
  background: #fff;
}

.item-editor {
  display: grid;
  grid-template-columns: minmax(128px, 0.9fr) minmax(108px, 0.72fr) minmax(310px, 1.7fr) auto;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid #eee5dc;
  border-radius: 7px;
  background: #fff;
}

.item-editor input {
  min-height: 34px;
  font-size: 13px;
}

.price-editor-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.price-editor-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.95fr) minmax(76px, 1fr) auto;
  gap: 6px;
  align-items: end;
}

.add-item-price {
  min-height: 30px;
  justify-self: start;
  padding: 0 10px;
  font-size: 12px;
}

.remove-item,
.remove-category {
  color: #842a2a;
  border-color: #e7caca;
  background: #fff;
}

.add-item {
  justify-self: start;
}

body.has-open-modal {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 28px;
  background: rgba(24, 35, 38, 0.42);
  backdrop-filter: blur(5px);
}

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

.category-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, calc(100vw - 56px));
  max-height: min(880px, calc(100vh - 56px));
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-panel);
  box-shadow: 0 24px 74px rgba(28, 42, 45, 0.28);
  overflow: hidden;
}

.category-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ui-line);
  background: linear-gradient(180deg, #ffffff, #f7faf9);
}

.category-modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.category-modal-content {
  display: grid;
  gap: 14px;
  padding: 18px 20px 22px;
  overflow: auto;
}

.settings-modal {
  width: min(720px, calc(100vw - 56px));
}

.settings-modal-content {
  gap: 18px;
}

.settings-section {
  display: grid;
  gap: 12px;
}

.settings-section + .settings-section {
  padding-top: 18px;
  border-top: 1px solid var(--ui-line);
}

.settings-section h3 {
  margin: 0;
  color: var(--ui-ink);
  font-size: 15px;
}

.modal-category-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.modal-category-meta {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--ui-line);
  border-radius: 7px;
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 800;
  background: #fff;
}

.modal-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.modal-items-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-item-list {
  display: grid;
  gap: 9px;
}

.category-modal .item-editor {
  grid-template-columns: minmax(180px, 0.9fr) minmax(160px, 0.72fr) minmax(390px, 1.7fr) auto;
}

@media (max-width: 980px) {
  .modal-backdrop {
    padding: 12px;
  }

  .category-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .modal-category-grid,
  .category-modal .item-editor {
    grid-template-columns: 1fr;
  }

}

.preview-stage {
  min-width: 0;
  padding: 18px 24px 32px;
}

.app-version {
  position: fixed;
  right: 12px;
  bottom: 10px;
  z-index: 20;
  padding: 5px 8px;
  border: 1px solid rgba(80, 107, 112, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ui-muted);
  box-shadow: 0 8px 18px rgba(28, 42, 45, 0.1);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.stage-toolbar {
  position: sticky;
  top: 0;
  margin: -18px -24px 0;
  padding: 14px 24px;
  z-index: 2;
  flex-wrap: wrap;
  background: rgba(238, 243, 243, 0.82);
  border-bottom: 1px solid rgba(219, 228, 228, 0.72);
  backdrop-filter: blur(16px);
}

.page-summary,
.zoom-label {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 800;
}

.zoom-label {
  min-width: 52px;
  text-align: center;
}

.sheet-wrap {
  overflow: auto;
  padding: 24px 8px 42px;
}

.sheet-stack {
  display: grid;
  justify-items: center;
  gap: 34px;
  min-width: max-content;
}

.sheet-stack.is-category-dragging {
  user-select: none;
  -webkit-user-select: none;
}

.layout-measurer {
  position: fixed;
  left: -20000px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}

.sheet-frame {
  --page-width: 794px;
  --page-height: 1123px;
  --preview-zoom: 0.86;
  width: calc(var(--page-width) * var(--preview-zoom));
}

.sheet-page-box {
  width: calc(var(--page-width) * var(--preview-zoom));
  height: calc(var(--page-height) * var(--preview-zoom));
}

.sheet-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 8px;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 800;
}

.menu-sheet {
  --paper: #fffaf2;
  --ink: #211717;
  --muted: #685b55;
  --accent: #84243d;
  --accent-soft: #f1d8d7;
  --secondary: #1f5c54;
  --rule: rgba(33, 23, 23, 0.18);
  --density-scale: 1;
  width: var(--page-width);
  height: var(--page-height);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: calc(44px * var(--density-scale, 1)) calc(44px * var(--density-scale, 1)) calc(30px * var(--density-scale, 1));
  position: relative;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  transform-origin: top left;
  transform: none;
  zoom: var(--preview-zoom);
}

.menu-sheet[data-template="winebar"] {
  --paper: #f8f2e8;
  --ink: #231817;
  --muted: #75685e;
  --accent: #8b2638;
  --secondary: #225f55;
  --rule: rgba(35, 24, 23, 0.14);
  background:
    linear-gradient(90deg, rgba(139, 38, 56, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(79, 105, 112, 0.1), transparent 28%),
    var(--paper);
}

.menu-sheet[data-template="modern"] {
  --paper: #fbfbf7;
  --ink: #1f2323;
  --muted: #626c68;
  --accent: #255f62;
  --secondary: #8fc63f;
  --rule: rgba(31, 35, 35, 0.12);
  background:
    linear-gradient(180deg, #ffffff 0, #ffffff 135px, var(--paper) 136px),
    var(--paper);
}

.menu-sheet[data-template="classic"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 210px),
    var(--paper);
}

.menu-sheet[data-size="a5"] {
  --page-width: 560px;
  --page-height: 793px;
  padding: calc(40px * var(--density-scale, 1)) calc(38px * var(--density-scale, 1)) calc(26px * var(--density-scale, 1));
}

.menu-sheet[data-size="square"] {
  padding: calc(48px * var(--density-scale, 1)) calc(56px * var(--density-scale, 1)) calc(34px * var(--density-scale, 1));
}

.menu-sheet[data-theme="garden"] {
  --paper: #fbfbf4;
  --ink: #17231e;
  --muted: #5c6a60;
  --accent: #2f6b4f;
  --accent-soft: #dce9dd;
  --secondary: #9a5c20;
}

.menu-sheet[data-theme="bistro"] {
  --paper: #f7f7f2;
  --ink: #1c2124;
  --muted: #5f666a;
  --accent: #254f73;
  --accent-soft: #dbe8ee;
  --secondary: #8d3645;
}

.menu-sheet::before,
.menu-sheet::after {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid var(--rule);
  pointer-events: none;
}

.menu-sheet[data-template="winebar"]::before {
  inset: 18px;
  border-color: rgba(139, 38, 56, 0.26);
}

.menu-sheet[data-template="winebar"]::after {
  inset: 32px;
  border-color: rgba(34, 95, 85, 0.18);
}

.menu-sheet[data-template="modern"]::before {
  inset: 0;
  border: 0;
  border-left: 14px solid var(--secondary);
}

.menu-sheet[data-template="modern"]::after {
  display: none;
}

.menu-sheet::after {
  inset: 30px;
  border-color: rgba(132, 36, 61, 0.16);
}

.menu-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) max-content;
  align-items: center;
  gap: calc(34px * var(--density-scale, 1));
  padding: calc(18px * var(--density-scale, 1)) calc(20px * var(--density-scale, 1));
  margin-bottom: calc(18px * var(--density-scale, 1));
  z-index: 1;
  background: #4f6970;
  border-radius: 8px;
}

.menu-sheet[data-template="winebar"] .menu-header {
  grid-template-columns: minmax(270px, 1fr) max-content;
  background: #4f6970;
  border: 1px solid rgba(35, 24, 23, 0.16);
  border-radius: 8px;
  padding: calc(18px * var(--density-scale, 1)) calc(20px * var(--density-scale, 1));
  margin-bottom: calc(18px * var(--density-scale, 1));
}

.menu-sheet[data-template="modern"] .menu-header {
  grid-template-columns: minmax(260px, 1fr) max-content;
  background: #4f6970;
  padding: calc(18px * var(--density-scale, 1)) calc(20px * var(--density-scale, 1));
  border-bottom: 4px solid var(--secondary);
}

.logo-mark {
  position: relative;
  width: 100%;
  max-width: calc(390px * var(--density-scale, 1));
  height: calc(108px * var(--density-scale, 1));
  border: 0;
  border-radius: 0;
  display: grid;
  align-items: center;
  justify-items: start;
  color: var(--accent);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 900;
  font-size: 27px;
  letter-spacing: 0;
  background: transparent;
  overflow: hidden;
  padding: 0;
}

.logo-mark.is-monogram {
  width: 72px;
  height: 72px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  padding: 0;
}

.logo-mark img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.brand-block {
  min-width: 0;
  padding-left: 0;
  justify-self: end;
}

.brand-block h2 {
  margin: 0;
  color: #fff;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(32px * var(--font-scale, 1));
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  text-wrap: nowrap;
}

.page-kicker {
  margin: 9px 0 0;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(10px * var(--font-scale, 1));
  font-weight: 800;
  text-transform: uppercase;
}

.header-rule {
  grid-column: 1 / -1;
  height: calc(7px * var(--density-scale, 1));
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  margin-top: calc(12px * var(--density-scale, 1));
}

.menu-sheet[data-template="winebar"] .header-rule {
  border-radius: 99px;
  height: calc(7px * var(--density-scale, 1));
}

.menu-sheet[data-template="modern"] .header-rule {
  display: none;
}

.menu-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--columns, 2), minmax(0, 1fr));
  gap: calc(18px * var(--density-scale, 1));
}

.menu-column {
  display: grid;
  align-content: start;
  gap: calc(12px * var(--density-scale, 1));
  min-width: 0;
}

.menu-section {
  break-inside: avoid;
  page-break-inside: avoid;
  margin: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.menu-section:active {
  cursor: grabbing;
}

.sheet-stack.is-category-dragging .menu-section {
  cursor: grabbing;
}

.sheet-stack.is-category-dragging .menu-section:not(.is-preview-grabbed) {
  opacity: 0.64;
  filter: grayscale(0.18);
}

.menu-section.is-preview-grabbed,
.menu-section.is-preview-dragging {
  opacity: 0.44;
  filter: grayscale(0.75);
  transform: scale(0.992);
  box-shadow: inset 0 0 0 999px rgba(80, 80, 80, 0.08), 0 10px 24px rgba(35, 24, 23, 0.18);
}

.menu-section.is-preview-drag-over,
.menu-section.is-preview-drag-over-after {
  box-shadow: 0 0 0 2px rgba(139, 38, 56, 0.24);
}

.menu-section.is-preview-drag-over {
  box-shadow: inset 0 4px 0 var(--accent), 0 0 0 2px rgba(139, 38, 56, 0.24);
}

.menu-section.is-preview-drag-over-after {
  box-shadow: inset 0 -4px 0 var(--accent), 0 0 0 2px rgba(139, 38, 56, 0.24);
}

.menu-sheet[data-template="winebar"] .menu-section {
  padding: calc(11px * var(--density-scale, 1)) calc(11px * var(--density-scale, 1)) calc(9px * var(--density-scale, 1));
  border: 1px solid rgba(35, 24, 23, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.32);
}

.menu-sheet[data-template="modern"] .menu-section {
  padding: 0 0 calc(10px * var(--density-scale, 1));
  border-bottom: 1px solid var(--rule);
}

.menu-section h3 {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--density-scale, 1));
  margin: 0 0 calc(8px * var(--density-scale, 1));
  color: var(--accent);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(13.5px * var(--font-scale, 1));
  letter-spacing: 0;
  text-transform: uppercase;
}

.menu-sheet[data-template="winebar"] .menu-section h3 {
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  padding: calc(5px * var(--density-scale, 1)) calc(8px * var(--density-scale, 1));
  border-radius: 5px;
  margin-bottom: calc(8px * var(--density-scale, 1));
}

.menu-sheet[data-template="winebar"] .menu-section h3::after {
  display: none;
}

.menu-sheet[data-template="modern"] .menu-section h3 {
  color: var(--accent);
  border-left: 4px solid var(--secondary);
  padding-left: 7px;
}

.menu-section h3::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--rule);
}

.menu-item {
  display: grid;
  gap: calc(2px * var(--density-scale, 1));
  padding: calc(4px * var(--density-scale, 1)) 0 calc(5px * var(--density-scale, 1));
  border-bottom: 1px dotted rgba(33, 23, 23, 0.18);
}

.menu-sheet[data-template="winebar"] .menu-item {
  padding: calc(5px * var(--density-scale, 1)) 0 calc(6px * var(--density-scale, 1));
}

.menu-sheet[data-template="modern"] .menu-item {
  border-bottom-style: solid;
  border-bottom-color: rgba(31, 35, 35, 0.08);
}

.menu-item:last-child {
  border-bottom: 0;
}

.item-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
}

.item-name {
  font-size: calc(12.7px * var(--font-scale, 1));
  font-weight: 700;
  line-height: 1.25;
}

.item-price {
  color: var(--ink);
  font-size: calc(12.2px * var(--font-scale, 1));
  font-weight: 800;
  white-space: nowrap;
}

.item-note,
.price-list {
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(9.1px * var(--font-scale, 1));
  line-height: 1.35;
}

.menu-sheet[data-template="winebar"] .item-note {
  display: inline-flex;
  width: fit-content;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(143, 198, 63, 0.16);
  color: var(--secondary);
  font-weight: 800;
}

.price-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(var(--price-columns, 3), minmax(0, 1fr));
  gap: calc(5px * var(--density-scale, 1));
  margin-top: calc(2px * var(--density-scale, 1));
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.price-cell {
  display: grid;
  gap: calc(1px * var(--density-scale, 1));
  min-width: 0;
  padding: calc(3px * var(--density-scale, 1)) calc(4px * var(--density-scale, 1));
  border: 1px solid rgba(33, 23, 23, 0.14);
  background: rgba(255, 255, 255, 0.34);
}

.menu-sheet[data-template="winebar"] .price-cell {
  border-color: rgba(139, 38, 56, 0.16);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.56);
}

.menu-sheet[data-template="modern"] .price-cell {
  border: 0;
  border-radius: 4px;
  background: rgba(37, 95, 98, 0.08);
}

.price-label {
  color: var(--muted);
  font-size: calc(7.6px * var(--font-scale, 1));
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.price-cell strong {
  color: var(--ink);
  font-size: calc(9px * var(--font-scale, 1));
  line-height: 1.15;
  white-space: nowrap;
}

.price-pill {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
}

.price-pill strong {
  color: var(--ink);
}

.menu-footer {
  position: absolute;
  z-index: 1;
  left: calc(44px * var(--density-scale, 1));
  right: calc(44px * var(--density-scale, 1));
  bottom: calc(24px * var(--density-scale, 1));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(18px * var(--density-scale, 1));
  border-top: 1px solid var(--rule);
  padding-top: calc(9px * var(--density-scale, 1));
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.3;
}

.menu-sheet {
  --paper: #f7f6f1;
  --ink: #263032;
  --muted: #7a8585;
  --accent: #8cc63f;
  --secondary: #506b70;
  --rule: rgba(38, 48, 50, 0.16);
  --sheet-pad-top: calc(22px * var(--density-scale, 1));
  --sheet-pad-x: calc(18px * var(--density-scale, 1));
  padding: var(--sheet-pad-top) var(--sheet-pad-x) calc(54px * var(--density-scale, 1));
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.menu-sheet[data-size="a5"] {
  --sheet-pad-top: calc(18px * var(--density-scale, 1));
  --sheet-pad-x: calc(22px * var(--density-scale, 1));
  padding: var(--sheet-pad-top) var(--sheet-pad-x) calc(42px * var(--density-scale, 1));
}

.menu-sheet[data-size="square"] {
  --sheet-pad-top: calc(22px * var(--density-scale, 1));
  --sheet-pad-x: calc(18px * var(--density-scale, 1));
  padding: var(--sheet-pad-top) var(--sheet-pad-x) calc(48px * var(--density-scale, 1));
}

.menu-sheet[data-template="perkmistr-bw"] {
  --paper: #fff;
  --ink: #111;
  --muted: #555;
  --accent: #111;
  --secondary: #fff;
  --rule: rgba(17, 17, 17, 0.18);
}

.menu-sheet::before,
.menu-sheet::after {
  display: none;
}

.menu-sheet .menu-header {
  --header-stripe-height: calc(7px * var(--density-scale, 1));
  display: grid;
  grid-template-columns: minmax(150px, 1fr) max-content;
  align-items: center;
  min-height: calc(92px * var(--density-scale, 1));
  gap: calc(38px * var(--density-scale, 1));
  padding: calc(18px * var(--density-scale, 1)) calc(52px * var(--density-scale, 1)) calc(22px * var(--density-scale, 1));
  margin: calc(-1 * var(--sheet-pad-top)) calc(-1 * var(--sheet-pad-x)) 0;
  width: 100%;
  width: calc(100% + (2 * var(--sheet-pad-x)));
  background:
    linear-gradient(
      180deg,
      var(--secondary) 0,
      var(--secondary) calc(100% - var(--header-stripe-height)),
      var(--accent) calc(100% - var(--header-stripe-height)),
      var(--accent) 100%
    );
  border: 0;
  border-radius: 0;
}

.menu-sheet[data-template="perkmistr-bw"] .menu-header {
  background: #fff;
  border-bottom: calc(2px * var(--density-scale, 1)) solid var(--ink);
  box-shadow: inset 0 calc(-7px * var(--density-scale, 1)) 0 #fff;
}

.menu-sheet[data-template="perkmistr-bw"] .logo-mark {
  width: calc(165px * var(--density-scale, 1));
  max-width: calc(165px * var(--density-scale, 1));
  height: calc(70px * var(--density-scale, 1));
}

.menu-sheet .logo-mark {
  width: calc(150px * var(--density-scale, 1));
  max-width: calc(150px * var(--density-scale, 1));
  height: calc(54px * var(--density-scale, 1));
}

.menu-sheet .logo-mark img {
  object-fit: contain;
  object-position: left center;
}

.menu-sheet[data-template="perkmistr-bw"] .logo-mark img {
  display: block;
  object-fit: contain;
  object-position: left center;
}

.menu-sheet .brand-block h2 {
  color: #fff;
  font-size: calc(18.5px * var(--font-scale, 1) * var(--type-header-scale, 1));
  font-weight: 800;
  letter-spacing: 0.3em;
  line-height: 1;
  text-transform: uppercase;
}

.menu-sheet[data-template="perkmistr-bw"] .brand-block h2 {
  color: var(--ink);
}

.menu-sheet .header-rule {
  display: none;
}

.menu-sheet .menu-content {
  --content-inset: calc(24px * var(--density-scale, 1));
  display: grid;
  grid-template-columns: repeat(var(--columns, 2), minmax(0, 1fr));
  gap: calc(30px * var(--density-scale, 1));
  width: calc(100% - (2 * var(--content-inset)));
  margin: calc(34px * var(--density-scale, 1)) var(--content-inset) 0;
  box-sizing: border-box;
}

.menu-sheet .menu-column {
  gap: calc(24px * var(--density-scale, 1));
  min-width: 0;
}

.menu-sheet .menu-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.menu-sheet .menu-section h3 {
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(9px * var(--density-scale, 1));
  margin: 0 0 calc(13px * var(--density-scale, 1));
  padding: calc(17px * var(--density-scale, 1)) 0 0;
  border-top: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(15.4px * var(--font-scale, 1) * var(--type-category-scale, 1));
  font-weight: 800;
  letter-spacing: 0.2em;
  line-height: 1.08;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: visible;
}

.menu-sheet .menu-section h3::before {
  content: "";
  flex: 0 0 calc(10px * var(--density-scale, 1));
  width: calc(10px * var(--density-scale, 1));
  height: calc(10px * var(--density-scale, 1));
  background: var(--accent);
}

.menu-sheet .menu-section[data-continued="true"] h3 {
  margin-bottom: calc(10px * var(--density-scale, 1));
  padding-top: calc(13px * var(--density-scale, 1));
  color: rgba(38, 48, 50, 0.78);
  font-size: calc(13.2px * var(--font-scale, 1) * var(--type-category-scale, 1));
  letter-spacing: 0.16em;
}

.menu-sheet .menu-section[data-continued="true"] h3::before {
  flex-basis: calc(7px * var(--density-scale, 1));
  width: calc(7px * var(--density-scale, 1));
  height: calc(7px * var(--density-scale, 1));
  opacity: 0.78;
}

.menu-sheet .menu-section h3::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: block;
  height: calc(2px * var(--density-scale, 1));
  background: var(--ink);
  pointer-events: none;
}

.menu-sheet .menu-section[data-continued="true"] h3::after {
  height: 1px;
  background: var(--rule);
}

.menu-sheet .menu-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(78%, var(--price-column-width, 166px));
  grid-template-rows: 1fr auto;
  column-gap: calc(9px * var(--density-scale, 1));
  row-gap: calc(2px * var(--density-scale, 1));
  align-items: end;
  height: calc(52px * var(--density-scale, 1));
  min-height: calc(52px * var(--density-scale, 1));
  padding:
    calc(5px * var(--density-scale, 1))
    0
    calc(6px * var(--density-scale, 1))
    calc(10px * var(--density-scale, 1));
  border-bottom: 1px solid var(--rule);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.menu-sheet .item-main {
  display: contents;
}

.menu-sheet .item-name {
  grid-column: 1;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(14.1px * var(--font-scale, 1) * var(--type-item-scale, 1));
  font-weight: 800;
  line-height: 1.08;
  align-self: end;
  display: block;
  width: 118%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  transform: scaleX(0.86);
  transform-origin: left center;
}

.menu-sheet .item-note {
  grid-column: 1;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(9.7px * var(--font-scale, 1) * var(--type-note-scale, 1));
  font-weight: 500;
  line-height: 1.08;
  align-self: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.menu-sheet .price-grid {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  align-self: center;
  width: 100%;
  gap: calc(10px * var(--density-scale, 1));
  margin: 0;
  overflow: visible;
}

.menu-sheet .price-cell {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: calc(2px * var(--density-scale, 1));
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  text-align: right;
}

.menu-sheet .price-label {
  color: var(--muted);
  font-size: calc(7.5px * var(--font-scale, 1) * var(--type-price-scale, 1));
  font-weight: 600;
  line-height: 1;
  min-height: calc(8px * var(--font-scale, 1) * var(--type-price-scale, 1));
  max-width: 100%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.menu-sheet .price-cell strong {
  color: var(--ink);
  font-size: calc(10.7px * var(--font-scale, 1) * var(--type-price-scale, 1));
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  display: block;
}

.menu-sheet .item-price {
  grid-column: 2;
  justify-self: end;
  align-self: center;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(13.5px * var(--font-scale, 1) * var(--type-price-scale, 1));
  font-weight: 900;
  line-height: 1.08;
}

.menu-sheet .price-list {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: center;
  color: var(--ink);
  font-size: calc(13.5px * var(--font-scale, 1) * var(--type-price-scale, 1));
  font-weight: 900;
}

.menu-sheet .menu-footer {
  left: 0;
  right: 0;
  bottom: 0;
  min-height: calc(34px * var(--density-scale, 1));
  padding: calc(8px * var(--density-scale, 1)) calc(76px * var(--density-scale, 1)) calc(7px * var(--density-scale, 1));
  border-top: 0;
  background:
    linear-gradient(
      180deg,
      var(--accent) 0,
      var(--accent) calc(4px * var(--density-scale, 1)),
      var(--secondary) calc(4px * var(--density-scale, 1)),
      var(--secondary) 100%
    );
  color: rgba(255, 255, 255, 0.82);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: calc(8.8px * var(--font-scale, 1) * var(--type-footer-scale, 1));
  line-height: 1.2;
}

.menu-sheet[data-template="perkmistr-bw"] .menu-footer {
  background: #fff;
  border-top: calc(2px * var(--density-scale, 1)) solid var(--ink);
  color: var(--ink);
}

.menu-sheet[data-template="perkmistr-bw"] .menu-footer span:last-child {
  color: var(--ink);
}

.menu-sheet .menu-footer span:last-child {
  color: #fff;
  font-weight: 800;
}

.menu-sheet .menu-section.is-preview-grabbed,
.menu-sheet .menu-section.is-preview-dragging {
  transform: scale(0.992);
}

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

  .editor-panel {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--ui-line);
  }

  .preview-stage {
    padding: 14px 10px 28px;
  }

  .sheet-wrap {
    padding-inline: 0;
  }

  .item-editor,
  .split-fields {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: 210mm 210mm;
    margin: 0;
  }

  html,
  body {
    background: #fff;
    width: 210mm;
    margin: 0;
  }

  .editor-panel,
  .stage-toolbar,
  .app-version {
    display: none !important;
  }

  .app-shell,
  .preview-stage,
  .sheet-wrap,
  .sheet-stack,
  .sheet-frame,
  .sheet-page-box {
    display: block;
    padding: 0;
    margin: 0;
    min-height: auto;
  }

  .menu-sheet {
    box-shadow: none;
    width: var(--print-width, 210mm) !important;
    height: var(--print-height, 210mm) !important;
    margin: 0;
    overflow: visible;
    transform: none !important;
    zoom: 1 !important;
    page-break-after: always;
    break-after: page;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .sheet-page-box:last-child .menu-sheet {
    page-break-after: auto;
    break-after: auto;
  }

  .sheet-caption {
    display: none;
  }
}
