:root {
  --bg: #f5ead8;
  --panel: rgba(255, 250, 242, 0.9);
  --panel-strong: #fffaf1;
  --surface: #fffdf8;
  --text: #2f241d;
  --muted: #7c6658;
  --accent: #bc4b2c;
  --accent-dark: #8c3117;
  --accent-soft: #f7d5bc;
  --line: rgba(84, 53, 38, 0.12);
  --success: #244d3a;
  --shadow: 0 24px 60px rgba(80, 45, 25, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Barlow", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(188, 75, 44, 0.22), transparent 28%),
    radial-gradient(circle at bottom left, rgba(255, 196, 122, 0.22), transparent 30%),
    linear-gradient(180deg, #fbf4eb 0%, var(--bg) 100%);
  color: var(--text);
}

body {
  padding: 20px 14px 36px;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.tabs-nav {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255, 250, 242, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.tab-button {
  padding: 14px 18px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tab-button.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
}

.tab-panel {
  display: none;
  gap: 18px;
}

.tab-panel.active {
  display: grid;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  padding: 28px 22px;
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent);
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-family: "DM Serif Display", serif;
  font-size: clamp(2.5rem, 7vw, 4.4rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.5rem;
}

.hero-copy {
  margin: 14px 0 0;
  max-width: 560px;
  font-size: 1.05rem;
  color: var(--muted);
}

.brand-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  white-space: nowrap;
}

.panel {
  padding: 22px 18px;
}

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

.ghost-button,
.primary-button,
.size-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.ghost-button:hover,
.primary-button:hover,
.size-button:hover {
  transform: translateY(-1px);
}

.ghost-button {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(47, 36, 29, 0.07);
  color: var(--text);
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  font-size: 0.95rem;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(188, 75, 44, 0.25);
  border-color: rgba(188, 75, 44, 0.32);
}

.field input[readonly] {
  background: rgba(47, 36, 29, 0.06);
  font-weight: 800;
}

.menu-context {
  margin: 12px 0 16px;
}

.menu-context h3 {
  margin: 0;
  font-size: 1.2rem;
}

.empty-message,
.empty-group {
  margin: 10px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(47, 36, 29, 0.05);
  color: var(--muted);
}

.menu-list {
  display: grid;
  gap: 14px;
}

.menu-card {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 247, 240, 0.92));
  border: 1px solid rgba(84, 53, 38, 0.08);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.item-title {
  margin: 0;
  font-size: 1.18rem;
}

.item-description {
  margin: 6px 0 0;
  color: var(--muted);
}

.price-tag {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(188, 75, 44, 0.1);
  color: var(--accent-dark);
  font-weight: 800;
  white-space: nowrap;
}

.size-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.size-button {
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.size-button.active {
  background: #fff;
  border-color: rgba(188, 75, 44, 0.34);
  box-shadow: inset 0 0 0 1px rgba(188, 75, 44, 0.12);
}

.size-info strong {
  display: block;
  font-size: 1rem;
}

.size-info span {
  color: var(--muted);
  font-size: 0.92rem;
}

.size-info .inactive-note {
  display: inline-block;
  margin-top: 4px;
  color: var(--accent-dark);
  font-weight: 700;
}

.quantity-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.quantity-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(47, 36, 29, 0.08);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.quantity-button:hover {
  background: rgba(188, 75, 44, 0.16);
}

.quantity-value {
  width: 26px;
  text-align: center;
  font-weight: 800;
}

.actions {
  margin-top: 22px;
}

.primary-button {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  font-size: 1rem;
  font-weight: 800;
}

.management-panel {
  grid-column: 1 / -1;
}

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

.history-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(84, 53, 38, 0.08);
}

.history-card-header,
.history-meta,
.history-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.history-card-header {
  margin-bottom: 12px;
}

.history-order-id {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.history-stamp,
.history-meta,
.history-notes {
  color: var(--muted);
}

.history-items {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(84, 53, 38, 0.2);
  display: grid;
  gap: 8px;
}

.history-item-name {
  margin: 0;
  font-weight: 700;
}

.history-notes {
  margin: 12px 0 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  padding: 18px;
  background: rgba(47, 36, 29, 0.42);
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-card {
  width: min(540px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px 18px;
  border-radius: 28px;
  background: #fffaf1;
  box-shadow: var(--shadow);
}

.confirmation-block,
.confirmation-items {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(84, 53, 38, 0.08);
}

.confirmation-items {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.confirmation-note {
  margin: 14px 0 18px;
  color: var(--muted);
  font-weight: 600;
}

.management-form {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(84, 53, 38, 0.08);
}

.toggle-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 18px 0;
  padding: 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid rgba(84, 53, 38, 0.08);
}

.toggle-label {
  display: block;
  font-weight: 800;
  margin-bottom: 4px;
}

.toggle-field p {
  margin: 0;
  color: var(--muted);
}

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

.management-form-actions {
  display: grid;
  gap: 10px;
}

.management-columns {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.management-group {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(84, 53, 38, 0.08);
}

.management-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.management-heading h3 {
  margin: 0;
  font-size: 1.2rem;
}

.management-counter {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(47, 36, 29, 0.07);
  font-weight: 700;
}

.management-list {
  display: grid;
  gap: 12px;
}

.management-card {
  padding: 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid rgba(84, 53, 38, 0.08);
}

.management-top,
.management-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.management-bottom {
  margin-top: 14px;
  align-items: center;
}

.management-name {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
}

.management-description {
  margin: 6px 0 0;
  color: var(--muted);
}

.management-price {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(188, 75, 44, 0.1);
  color: var(--accent-dark);
  font-weight: 800;
  white-space: nowrap;
}

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

.small-button {
  padding: 9px 12px;
  border-radius: 999px;
}

.status-pill {
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.status-pill.enabled {
  background: rgba(36, 77, 58, 0.12);
  color: var(--success);
}

.status-pill.disabled {
  background: rgba(124, 102, 88, 0.14);
  color: var(--muted);
}

.summary-card,
.ticket-preview {
  background: var(--panel-strong);
  border: 1px solid rgba(84, 53, 38, 0.08);
  border-radius: 20px;
}

.summary-card {
  padding: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.total-row {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px dashed rgba(84, 53, 38, 0.24);
  font-size: 1.15rem;
}

.order-number {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(36, 77, 58, 0.1);
  color: var(--success);
  font-weight: 800;
}

.ticket-preview {
  margin-top: 16px;
  padding: 14px;
}

.print-sheet {
  display: grid;
  gap: 14px;
}

.ticket-copy {
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(84, 53, 38, 0.22);
}

.ticket-copy:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.ticket {
  background: white;
  color: #111;
  border-radius: 14px;
  padding: 18px 16px;
  font-family: "Courier New", monospace;
}

.ticket-header,
.ticket-total {
  text-align: center;
}

.ticket-brand {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.ticket-subtitle,
.ticket-section-title {
  margin: 4px 0 0;
  font-size: 0.92rem;
  text-transform: uppercase;
}

.ticket-meta p,
.ticket-notes-block p {
  margin: 6px 0;
  word-break: break-word;
}

.ticket-divider {
  margin: 14px 0;
  border-top: 1px dashed #111;
}

.ticket-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.ticket-item:last-child {
  margin-bottom: 0;
}

.ticket-item-info p {
  margin: 0;
}

.ticket-item-price {
  font-weight: 700;
  white-space: nowrap;
}

.ticket-notes-block {
  margin-top: 14px;
}

@media (min-width: 900px) {
  body {
    padding: 28px 22px 40px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  }

  .hero-card {
    grid-column: 1 / -1;
  }

  #orders-tab-panel {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  }

  .field-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

@media print {
  body {
    padding: 0;
    background: white;
  }

  .hero-card,
  .tabs-nav,
  #orders-tab-panel > .order-panel,
  #menu-tab-panel,
  #history-tab-panel,
  .modal-overlay,
  .summary-panel > :not(.ticket-preview) {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .summary-panel,
  .ticket-preview,
  .print-sheet,
  .ticket-copy,
  .ticket {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background: white;
  }

  .ticket-copy {
    page-break-inside: avoid;
    break-inside: avoid;
    border-bottom: 1px dashed #111;
    padding-bottom: 6mm;
    margin-bottom: 6mm;
  }

  .ticket-copy:last-child {
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .ticket {
    width: 80mm;
    padding: 6mm 4mm;
  }
}
