:root {
  --bg: #f6f3ec;
  --panel: #fffaf0;
  --ink: #1f1a14;
  --muted: #766b5c;
  --line: #e6dcc9;
  --yellow: #ffd21a;
  --orange: #f5821f;
  --red: #bc1f1f;
  --black: #15110c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--black);
  color: #fff;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 20px;
  padding: 12px 22px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: block;
  background: #050403;
  border: 1px solid #31261a;
  border-radius: 8px;
  padding: 6px;
}

.brand img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: contain;
}

.nav {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a,
.logout button,
.primary-action,
.secondary-action,
.secondary-button,
.icon-button,
.toolbar button,
.form-actions button,
.status-form button,
.login-form button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.nav a {
  color: #f7f1e5;
  border-radius: 6px;
  flex: 0 0 auto;
  padding: 10px 12px;
  white-space: nowrap;
}

.nav a:hover {
  background: #2a2117;
}

.logout {
  align-items: center;
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 10px;
  color: #f7f1e5;
  justify-items: end;
}

.logout small {
  color: #d7c8ae;
}

.logout button {
  background: var(--orange);
  color: #fff;
  grid-row: 1 / span 2;
  grid-column: 2;
  padding: 10px 12px;
}

.content {
  padding: 28px;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
}

.page-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
}

.primary-action {
  background: var(--orange);
  color: #fff;
}

.secondary-action {
  background: #fff;
  border: 1px solid var(--line);
}

.secondary-button {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 36px;
  padding: 0 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 16px;
}

.metric span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 26px;
}

.panel {
  padding: 18px;
  overflow-x: auto;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
}

.panel-title a {
  color: var(--red);
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td a {
  color: var(--red);
  font-weight: 700;
}

.status,
.pill {
  display: inline-flex;
  border-radius: 999px;
  background: #fff1c5;
  color: #614300;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.status-form select,
.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px 11px;
}

.toolbar button,
.form-actions button,
.status-form button,
.login-form button {
  background: var(--black);
  color: #fff;
  padding: 10px 14px;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.form-grid label:has(textarea) {
  grid-column: 1 / -1;
}

.form-actions {
  margin-top: 16px;
}

.order-builder {
  display: grid;
  gap: 16px;
}

.customer-strip,
.catalog-panel,
.order-summary-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.customer-strip {
  padding: 16px;
}

.customer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.customer-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.customer-grid label:last-child {
  grid-column: 1 / -1;
}

.delivery-field.is-hidden,
.local-hidden-field.is-hidden {
  display: none;
}

.customer-grid input,
.customer-grid select,
.customer-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px 11px;
}

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

.catalog-panel {
  min-width: 0;
  overflow: hidden;
}

.catalog-topbar {
  align-items: center;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  padding: 12px;
}

.menu-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  height: 42px;
}

.catalog-search {
  display: block;
  position: relative;
}

.catalog-search span {
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.catalog-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 11px 14px;
}

.category-slider {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  padding: 0 12px 12px;
}

.category-slider-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 24px;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  border: 0;
  border-radius: 999px;
  background: #f1ece2;
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
  font-weight: 700;
  padding: 10px 14px;
  scroll-snap-align: start;
  white-space: nowrap;
}

.category-tab.active {
  background: #ffe4d1;
  color: var(--orange);
}

.product-list {
  display: grid;
  gap: 0 28px;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  padding: 8px 18px 18px;
}

.product-card {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e7eaf0;
  border-radius: 0;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 18px;
  min-height: 174px;
  padding: 22px 0;
}

.product-card:hover {
  background: rgba(255, 255, 255, 0.45);
}

.product-card.is-hidden {
  display: none !important;
}

.product-info {
  min-width: 0;
}

.product-info strong,
.summary-line strong {
  display: block;
}

.product-info strong {
  color: #2d2b35;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.18;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-info span {
  color: var(--orange);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

.product-info p {
  color: #73717b;
  display: -webkit-box;
  font-size: 17px;
  line-height: 1.45;
  margin: 14px 0 12px;
  min-height: 50px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-info b {
  color: #27252f;
  display: block;
  font-size: 20px;
  font-weight: 900;
}

.product-media {
  position: relative;
}

.product-media img {
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 8px 18px rgba(20, 17, 12, 0.12);
  display: block;
  object-fit: contain;
  padding: 8px;
  width: 100%;
}

.add-product-card {
  align-items: center;
  background: var(--orange);
  border: 0;
  border-radius: 999px;
  bottom: -8px;
  box-shadow: 0 6px 12px rgba(245, 130, 31, 0.28);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 22px;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  position: absolute;
  right: -6px;
  width: 34px;
}

.order-summary-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  position: sticky;
  top: 18px;
}

.summary-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.summary-header h2 {
  font-size: 20px;
  margin: 0;
}

.summary-header span {
  color: var(--muted);
  font-weight: 700;
}

.summary-lines {
  display: grid;
  gap: 10px;
}

.summary-line {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
}

.summary-line span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 4px;
}

.summary-line em {
  color: var(--ink);
  display: block;
  font-style: normal;
  font-weight: 800;
  margin-top: 6px;
}

.quantity-control {
  align-items: center;
  display: grid;
  grid-template-columns: 32px 28px 32px;
  gap: 4px;
}

.quantity-control button {
  background: #f1ece2;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
  height: 32px;
}

.quantity-control b {
  text-align: center;
}

.summary-total {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
}

.summary-total span {
  color: var(--muted);
  font-weight: 700;
}

.summary-total strong {
  font-size: 22px;
}

.submit-order {
  background: var(--orange);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  min-height: 46px;
}

.product-modal {
  display: none;
  inset: 0;
  position: fixed;
  z-index: 50;
}

.product-modal.is-open {
  display: block;
}

.product-modal-backdrop {
  background: rgba(15, 12, 8, 0.45);
  inset: 0;
  position: absolute;
}

.product-modal-panel {
  background: #fff;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(880px, calc(100vh - 48px));
  inset: 24px;
  margin: auto;
  max-width: 1120px;
  position: absolute;
}

.product-modal-header {
  align-items: center;
  border-bottom: 1px solid #e6e8ee;
  display: flex;
  justify-content: space-between;
  padding: 20px 24px;
}

.product-modal-header h2 {
  font-size: 28px;
  line-height: 1.1;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 34px;
}

.product-modal-body {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 0.92fr);
  min-height: 0;
  overflow: hidden;
  padding: 22px 24px;
}

.modal-product-image {
  align-items: center;
  background: #f6f7f8;
  display: flex;
  justify-content: center;
  min-height: 360px;
}

.modal-product-image img {
  display: block;
  max-height: 86%;
  max-width: 86%;
  object-fit: contain;
}

.modal-product-config {
  min-height: 0;
  overflow-y: auto;
  padding-right: 12px;
}

.modal-product-config > strong {
  display: block;
  font-size: 23px;
  margin-bottom: 12px;
}

.modal-product-config > p {
  color: #2d2b35;
  font-size: 18px;
  line-height: 1.35;
  margin: 0 0 18px;
}

.option-section {
  border: 1px solid #e6e8ee;
  border-radius: 18px;
  margin-bottom: 18px;
  overflow: hidden;
}

.option-section-title {
  align-items: flex-start;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 8px;
}

.option-section-title h3 {
  font-size: 20px;
  margin: 0;
}

.option-section-title p {
  color: #778094;
  margin: 6px 0 0;
}

.option-section-title > span {
  background: #f5f5f5;
  border-radius: 999px;
  color: #535965;
  flex: 0 0 auto;
  padding: 8px 12px;
}

.option-row {
  align-items: center;
  border-top: 1px solid #e6e8ee;
  color: #444b58;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
}

.option-row strong {
  display: block;
  font-weight: 500;
}

.option-row span {
  color: var(--ink);
  display: block;
  font-weight: 800;
  margin-top: 4px;
}

.option-row input[type="checkbox"] {
  appearance: none;
  border: 3px solid #4f5663;
  border-radius: 999px;
  height: 30px;
  width: 30px;
}

.option-row input[type="checkbox"]:checked {
  background: var(--orange);
  border-color: var(--orange);
  box-shadow: inset 0 0 0 6px #fff;
}

.quantity-control.compact {
  grid-template-columns: 30px 28px 30px;
}

.product-modal-footer {
  align-items: center;
  border-top: 1px solid #e6e8ee;
  display: grid;
  gap: 16px;
  grid-template-columns: 130px 190px minmax(180px, 1fr);
  justify-content: end;
  padding: 14px 24px;
}

.modal-delete,
.modal-quantity button,
.modal-submit {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  min-height: 46px;
}

.modal-delete {
  background: #fff1ef;
  color: var(--red);
}

.modal-quantity {
  align-items: center;
  border: 1px solid #e1e3e8;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  min-height: 46px;
}

.modal-quantity button {
  background: #fff;
  font-size: 20px;
}

.modal-quantity b {
  text-align: center;
}

.modal-submit {
  background: var(--orange);
  color: #fff;
  font-size: 18px;
  padding: 0 18px;
}

.order-lines {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.order-lines-list {
  display: grid;
  gap: 10px;
}

.order-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 42px;
  gap: 12px;
  align-items: end;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.order-line label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.order-line select,
.order-line input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px 11px;
}

.icon-button {
  width: 42px;
  height: 42px;
  background: #2c251d;
  color: #fff;
  font-size: 22px;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.field-error,
.message.error {
  color: var(--red);
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.message {
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff1c5;
  border: 1px solid #f2d87d;
}

.message.success {
  background: #eaf8e1;
  border-color: #b9dc9d;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.line-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.line-item span,
.subline {
  color: var(--muted);
}

.subline {
  margin: 5px 0;
}

dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  margin: 0;
}

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

dd {
  margin: 0;
}

.status-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #0f0c08;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  background: var(--panel);
  border-radius: 8px;
  padding: 22px;
  border: 1px solid #3f2d16;
}

.login-logo {
  width: 100%;
  height: 190px;
  object-fit: contain;
  display: block;
  background: #080604;
  border-radius: 8px;
  margin-bottom: 16px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 1280px) {
  .product-list {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 120px 1fr;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand img {
    height: 50px;
  }

  .nav {
    grid-column: 1 / -1;
    order: 3;
  }

  .logout {
    justify-self: end;
  }

  .metric-grid,
  .detail-grid,
  .form-grid,
  .order-line,
  .customer-grid,
  .ordering-layout {
    grid-template-columns: 1fr;
  }

  .order-summary-panel {
    bottom: 0;
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: auto;
    z-index: 3;
  }

  .customer-strip {
    padding: 12px;
  }

  .catalog-topbar {
    grid-template-columns: 38px 1fr;
    padding: 10px;
  }

  .menu-chip {
    height: 38px;
  }

  .category-slider {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 10px 10px;
  }

  .category-slider-button {
    display: none;
  }

  .category-tab {
    padding: 9px 12px;
  }

  .product-list {
    gap: 0;
    grid-template-columns: 1fr;
    padding: 2px 12px 10px;
  }

  .product-card {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 12px;
    min-height: 138px;
    padding: 16px 0;
  }

  .product-info strong {
    font-size: 15px;
  }

  .product-info p {
    font-size: 14px;
    line-height: 1.35;
    margin: 8px 0;
    min-height: 38px;
    -webkit-line-clamp: 2;
  }

  .product-info b {
    font-size: 17px;
  }

  .product-media img {
    border-radius: 12px;
    padding: 5px;
  }

  .add-product-card {
    bottom: -6px;
    height: 30px;
    right: -4px;
    width: 30px;
  }

  .content {
    padding: 14px;
  }

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

  .product-modal-panel {
    height: 100vh;
    inset: 0;
    max-width: none;
  }

  .product-modal-header {
    padding: 16px;
  }

  .product-modal-header h2 {
    font-size: 22px;
  }

  .product-modal-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
    padding: 16px;
  }

  .modal-product-image {
    min-height: 240px;
  }

  .modal-product-config {
    overflow: visible;
    padding-right: 0;
  }

  .product-modal-footer {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }

  .modal-quantity {
    order: 1;
  }

  .modal-submit {
    order: 2;
  }

  .modal-delete {
    order: 3;
  }
}
