:root {
  --ink: #1f2522;
  --muted: #66706b;
  --paper: #f7f4ef;
  --surface: #ffffff;
  --line: #ded8cf;
  --accent: #0f7a5a;
  --accent-dark: #095b43;
  --warning: #b75524;
  --ready: #225a9a;
  --shadow: 0 14px 36px rgba(37, 31, 24, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
}

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

button,
select {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(14px, 4vw, 38px);
  background: rgba(247, 244, 239, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand,
.admin-link {
  color: inherit;
  text-decoration: none;
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: var(--accent);
  border-radius: 8px;
}

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

.brand small,
.admin-header p,
.order-intro p,
.empty-cart {
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-actions,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px clamp(16px, 4vw, 44px) 0;
}

.admin-tab {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 900;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-tab.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.admin-link,
.cart-pill,
.checkout-button,
.category-button,
.add-button,
.quantity-button,
.icon-button,
.soft-button {
  border: 0;
  border-radius: 8px;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  font-weight: 800;
  background: #fff;
  border: 1px solid var(--line);
}

.cart-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  background: var(--ink);
}

.cart-pill strong {
  min-width: 26px;
  padding: 3px 8px;
  color: var(--ink);
  background: #f0c44c;
  border-radius: 999px;
}

.order-intro,
.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 44px) 10px;
}

.order-intro h1,
.admin-header h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.order-intro p,
.admin-header p {
  max-width: 600px;
  margin: 0;
  line-height: 1.5;
}

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

h2,
h3,
p {
  margin-top: 0;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  gap: 8px;
  width: min(330px, 100%);
}

.status-strip span {
  padding: 10px 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 350px;
  gap: 20px;
  padding: 18px clamp(16px, 4vw, 44px) 42px;
}

.menu-sidebar,
.cart-panel {
  position: sticky;
  top: 78px;
  align-self: start;
}

.table-status,
.cart-panel,
.admin-panel,
.dish-card,
.qr-card,
.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-status {
  padding: 16px;
  margin-bottom: 12px;
}

.table-status span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.table-status strong {
  display: block;
  margin-top: 3px;
  font-size: 2rem;
}

.category-list {
  display: grid;
  gap: 7px;
}

.category-button {
  width: 100%;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
}

.category-button.active {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 8px 20px rgba(37, 31, 24, 0.06);
}

.section-heading,
.panel-heading,
.cart-header,
.order-topline,
.order-footer {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  align-items: end;
  margin-bottom: 16px;
}

.section-heading h2,
.cart-header h2,
.panel-heading h2,
.modal-card h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.08;
}

.search-wrap,
.note-field,
.admin-form,
.menu-editor {
  display: grid;
  gap: 7px;
}

.search-wrap {
  width: min(310px, 100%);
}

.search-wrap label,
.note-field span,
.admin-form label,
.menu-editor label,
.checkbox-field {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.search-wrap input,
.note-field textarea,
.admin-form input,
.menu-editor input,
.menu-editor textarea,
.order-footer select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.note-field textarea {
  min-height: 84px;
  padding-top: 10px;
  resize: vertical;
}

.menu-editor textarea {
  min-height: 84px;
  padding-top: 10px;
  resize: vertical;
}

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

.dish-card {
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(37, 31, 24, 0.06);
}

.dish-image {
  height: 130px;
  background: var(--line) center / cover;
}

.dish-body {
  display: grid;
  gap: 11px;
  padding: 14px;
}

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

.dish-card h3 {
  margin: 0 0 5px;
  font-size: 1.02rem;
}

.dish-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.42;
}

.price {
  color: var(--accent-dark);
  font-weight: 900;
  white-space: nowrap;
}

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

.dish-tags span {
  padding: 5px 8px;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  background: #e5f2ec;
  border-radius: 999px;
}

.checkout-button,
.add-button {
  min-height: 42px;
  color: #fff;
  font-weight: 900;
  background: var(--accent);
}

.checkout-button:hover,
.add-button:hover {
  background: var(--accent-dark);
}

.cart-panel {
  min-width: 0;
  padding: 17px;
  box-shadow: var(--shadow);
}

.cart-header {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 38px;
  height: 38px;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
  background: #efe9e1;
}

.close-cart {
  display: none;
}

.cart-items {
  display: grid;
  gap: 12px;
  min-height: 98px;
  padding: 15px 0;
}

.empty-cart {
  margin: 0;
  line-height: 1.5;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.cart-line h3 {
  margin: 0 0 4px;
  font-size: 0.96rem;
}

.cart-line small {
  color: var(--muted);
}

.quantity-control {
  display: inline-grid;
  grid-template-columns: 34px 34px 34px;
  align-items: center;
  overflow: hidden;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quantity-button {
  height: 34px;
  background: #f1ece5;
}

.quantity-control span {
  text-align: center;
  font-weight: 800;
}

.service-row {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.service-row label {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.totals {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.totals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.totals dd {
  margin: 0;
  font-weight: 900;
}

.grand-total {
  font-size: 1.22rem;
}

.checkout-button {
  width: 100%;
  padding: 0 16px;
  border: 0;
}

.checkout-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.compact-button {
  width: auto;
  min-width: 160px;
}

.soft-button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  font-weight: 800;
  background: #efe9e1;
}

.danger-button {
  color: #fff;
  background: #9f3328;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 20px;
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

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

.admin-panel {
  min-width: 0;
  padding: 18px;
  box-shadow: var(--shadow);
}

.admin-form {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin: 16px 0;
}

.admin-form label {
  grid-column: 1 / -1;
}

.password-form {
  grid-template-columns: 1fr;
}

.menu-editor {
  margin: 16px 0;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-list {
  display: grid;
  gap: 8px;
  max-height: 440px;
  overflow: auto;
}

.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.menu-row strong,
.menu-row small {
  display: block;
}

.menu-row small,
.form-message {
  color: var(--muted);
}

.muted-row {
  opacity: 0.56;
}

.form-message {
  min-height: 20px;
  margin: 0;
  font-weight: 700;
}

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

.qr-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px;
  text-align: center;
}

.qr-card strong {
  font-size: 1.18rem;
}

.qr-card img {
  width: 132px;
  height: 132px;
}

.qr-card small {
  width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.orders-board {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.order-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.order-topline strong {
  display: block;
  font-size: 1.2rem;
}

.order-topline small {
  color: var(--muted);
}

.status-badge {
  padding: 6px 9px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--accent);
  border-radius: 999px;
}

.status-badge.preparing {
  background: var(--warning);
}

.status-badge.ready {
  background: var(--ready);
}

.status-badge.served {
  background: var(--muted);
}

.order-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
}

.order-note {
  margin: 0;
  color: var(--warning);
  font-weight: 700;
}

.order-footer {
  align-items: center;
}

.order-footer select {
  width: min(160px, 100%);
}

.order-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(20, 18, 14, 0.52);
}

.order-modal.open {
  display: grid;
}

.modal-card {
  width: min(460px, 100%);
  padding: 24px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-card .icon-button {
  float: right;
}

.login-card {
  display: grid;
  gap: 14px;
}

.login-card .icon-button {
  justify-self: end;
}

.success-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 14px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--accent);
  border-radius: 50%;
}

.progress-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0;
}

.progress-list span {
  padding: 9px 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  background: #f1ece5;
  border-radius: 8px;
}

.progress-list .active {
  color: #fff;
  background: var(--accent);
}

@media (max-width: 1100px) {
  .order-shell {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .cart-panel {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 20;
    width: min(390px, 100%);
    overflow: auto;
    transform: translateX(105%);
    transition: transform 180ms ease;
  }

  .cart-panel.open {
    transform: translateX(0);
  }

  .close-cart {
    display: inline-grid;
  }

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

@media (max-width: 760px) {
  .topbar,
  .order-intro,
  .admin-header,
  .admin-actions,
  .editor-actions {
    align-items: stretch;
  }

  .topbar,
  .order-intro,
  .admin-header,
  .admin-actions,
  .editor-actions,
  .section-heading {
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
  }

  .order-shell {
    grid-template-columns: 1fr;
    padding-top: 14px;
  }

  .menu-sidebar {
    position: static;
  }

  .table-status {
    display: none;
  }

  .category-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .category-button {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .section-heading {
    display: grid;
    align-items: start;
  }

  .status-strip {
    width: 100%;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .admin-header,
  .admin-tabs,
  .panel-heading,
  .admin-form,
  .orders-board,
  .menu-editor,
  .menu-list,
  .admin-panel:nth-child(n + 2) {
    display: none !important;
  }

  .admin-app,
  .admin-grid,
  .admin-panel {
    display: block !important;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .qr-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .qr-card {
    break-inside: avoid;
    border: 1px solid #111;
  }
}
