* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: #f5f5f3;
  color: #202020;
}
.admin-shell {
  min-height: calc(100vh - 52px);
  display: grid;
  place-items: center;
  padding: 28px 18px;
}
.admin-card {
  width: min(100%, 1180px);
  margin: 18px auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 8px 28px rgba(0,0,0,.06);
}
.brand {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .62;
}
h1 { margin: 8px 0; font-size: 34px; }
h2 { margin: 0; font-size: 23px; }
p { color: #666; line-height: 1.5; }
form { display: grid; gap: 7px; max-width: 420px; }
input, textarea {
  font: inherit;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  background: #fff;
}
form input { padding: 10px; margin-bottom: 8px; }
a { color: #202020; font-weight: 700; text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  border: 0;
  border-radius: 7px;
  padding: 10px 15px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #202020;
  color: #fff;
}
button.secondary { background: #e7e7e7; color: #202020; }
button:disabled { opacity: .6; cursor: wait; }
.admin-message { margin-top: 8px; min-height: 20px; }
.admin-message.success { color: #176b35; }
.admin-message.error { color: #a51d1d; }
.admin-dashboard { align-self: start; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 28px 0;
}
.tool-card {
  display: grid;
  gap: 7px;
  padding: 18px;
  border: 1px solid #d8d8d8;
  border-radius: 10px;
  background: #fafafa;
  transition: border-color .15s, box-shadow .15s;
}
.tool-card:hover {
  text-decoration: none;
  border-color: #aaa;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.tool-card strong { font-size: 19px; }
.tool-card > span:last-child { color: #666; font-size: 14px; font-weight: 400; line-height: 1.4; }
.tool-kicker, .kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .58;
}
.admin-dashboard-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid #eee;
  padding-top: 18px;
}
.admin-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid #eee;
  padding-bottom: 20px;
}
.back-link { white-space: nowrap; padding-top: 4px; }

.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 22px 0 12px;
}
.editor-help { display: block; color: #777; font-size: 13px; margin-top: 4px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.delivery-price {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-weight: 700;
}
.delivery-price input {
  width: 82px;
  padding: 7px 8px;
  margin: 0;
  font-weight: 600;
}

.add-item-button {
  padding: 8px 12px;
  border: 1px solid #c8c8c8;
  background: #fff;
  color: #202020;
  font-size: 13px;
}
.add-item-button:hover { border-color: #999; background: #f7f7f7; }

.menu-table-wrap {
  overflow-x: auto;
  border: 1px solid #d4d4d4;
  border-radius: 9px;
  background: #fff;
}
.menu-editor-table {
  width: 100%;
  min-width: 1160px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.menu-editor-table th,
.menu-editor-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #e7e7e7;
  vertical-align: middle;
  text-align: left;
}
.menu-editor-table thead th {
  height: 34px;
  padding: 7px 8px;
  background: #f1f1f1;
  color: #555;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 800;
  border-bottom: 1px solid #d7d7d7;
}
.menu-editor-table thead th:first-child { border-top-left-radius: 8px; }
.menu-editor-table thead th:last-child { border-top-right-radius: 8px; }

/* Explicit spreadsheet column proportions. Description gets extra room
   for longer customer-facing copy as the menu grows. */
.menu-editor-table col.col-order { width: 5%; }
.menu-editor-table col.col-item { width: 15%; }
.menu-editor-table col.col-unit { width: 8%; }
.menu-editor-table col.col-price { width: 8%; }
.menu-editor-table col.col-options { width: 19%; }
.menu-editor-table col.col-description { width: 33%; }
.menu-editor-table col.col-id { width: 7%; }
.menu-editor-table col.col-actions { width: 5%; }

.menu-editor-table tbody tr:not(.menu-category-row) {
  height: 56px;
  transition: background .12s;
}
.menu-editor-table tbody tr:not(.menu-category-row):hover { background: #fafafa; }
.menu-editor-table tbody tr:last-child td { border-bottom: 0; }

.menu-editor-table input,
.menu-editor-table textarea {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid #d2d2d2;
  border-radius: 5px;
  font-size: 13px;
  color: #202020;
}
.menu-editor-table input:focus,
.menu-editor-table textarea:focus,
.menu-category-description:focus,
.delivery-price input:focus {
  outline: 2px solid rgba(32,32,32,.12);
  border-color: #888;
}
.menu-editor-table textarea {
  min-height: 38px;
  height: 38px !important;
  resize: vertical;
  line-height: 1.25;
}
.menu-category-row th {
  padding: 9px 10px;
  background: #f8f8f8;
  border-bottom: 1px solid #d9d9d9;
}
.category-row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: 100%;
}
.category-row-head > div:first-child {
  width: 100%;
  min-width: 0;
}
.category-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}
.menu-category-description {
  display: block;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: 38px;
  padding: 8px 10px;
  color: #666;
  background: #fff;
  font-size: 13px;
}
.category-row-head .add-item-button {
  flex: 0 0 auto;
  white-space: nowrap;
}
.menu-id {
  color: #777;
  font: 11px/1.3 monospace;
  overflow-wrap: anywhere;
}
.menu-order {
  padding: 5px 6px !important;
  text-align: center !important;
  color: #777;
  font-weight: 700;
}
.order-controls {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 4px;
}
.move-item {
  width: 25px;
  height: 23px;
  padding: 0;
  border: 1px solid #d3d3d3;
  border-radius: 5px;
  background: #f7f7f7;
  color: #333;
  font-size: 13px;
  line-height: 1;
}
.move-item:hover:not(:disabled) { background: #eee; border-color: #aaa; }
.move-item:disabled { opacity: .3; cursor: default; }
.menu-delete-cell { text-align: center !important; }
.delete-item {
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
  color: #9b2525;
  font-size: 12px;
}
.delete-item:hover { border-color: #c9a0a0; background: #fff7f7; }

.editor-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
}
#save-menu { min-width: 130px; }
#reload-menu { min-width: 130px; }
code { background: #eee; padding: 2px 4px; border-radius: 4px; }

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.42);
}
.admin-modal[hidden] { display: none; }
.admin-modal-card {
  width: min(100%,560px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 18px 55px rgba(0,0,0,.18);
}
.admin-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.admin-modal-head h2 { margin-top: 6px; }
.modal-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: #eee;
  color: #202020;
  font-size: 22px;
  line-height: 1;
}
.add-item-form { display: grid; gap: 13px; }
.add-item-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.add-item-form input,
.add-item-form select,
.add-item-form textarea {
  width: 100%;
  padding: 9px 10px;
}
.add-item-form textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-note { color: #777; font-weight: 400; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }

@media (max-width: 650px) {
  .admin-shell { padding: 10px; }
  .admin-card { padding: 22px 16px; margin: 8px auto; }
  h1 { font-size: 30px; }
  .admin-page-head { flex-direction: column; }
  .editor-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; justify-content: space-between; }
  .delivery-price { align-self: center; }
}

/* The menu grid needs the full desktop width so the complete spreadsheet fits
   without an unnecessary horizontal scrollbar. Keep the other admin pages at
   the normal card width. */
.menu-editor-page {
  width: min(100%, 1270px);
}
.menu-editor-page .admin-page-head {
  margin-bottom: 0;
}
@media (max-width: 1300px) {
  .menu-editor-page {
    width: min(100%, calc(100vw - 36px));
  }
}


/* Order database */
.orders-page { width: min(100%, 1270px); align-self: start; }
.orders-toolbar {
  display:flex; justify-content:space-between; align-items:end; gap:18px;
  margin:22px 0 12px;
}
.orders-toolbar-actions { display:flex; align-items:center; gap:8px; }
.order-search, #order-status-filter {
  height:38px; padding:8px 10px; border:1px solid #cfcfcf; border-radius:6px;
  background:#fff; font:inherit; font-size:13px;
}
.order-search { width:260px; }
#order-status-filter { min-width:135px; }
.orders-table-wrap {
  max-height:520px; overflow:auto; border:1px solid #d4d4d4; border-radius:9px;
  background:#fff;
}
.orders-table { width:100%; min-width:850px; border-collapse:separate; border-spacing:0; }
.orders-table th, .orders-table td {
  padding:10px 11px; border-bottom:1px solid #e7e7e7; text-align:left; vertical-align:middle;
  font-size:13px;
}
.orders-table thead th {
  position:sticky; top:0; z-index:2; background:#f1f1f1; color:#555;
  font-size:11px; letter-spacing:.06em; text-transform:uppercase; font-weight:800;
  border-bottom:1px solid #d5d5d5;
}
.orders-table tbody tr:last-child td { border-bottom:0; }
.order-row { cursor:pointer; transition:background .12s; }
.order-row:hover, .order-row:focus { background:#f7f7f7; outline:none; }
.order-row td:first-child { white-space:nowrap; }
.orders-table small, .order-detail-grid small {
  display:block; margin-top:3px; color:#777; font-size:11px; font-weight:400;
}
.orders-empty { text-align:center !important; padding:35px !important; color:#777; }
.order-status {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:82px; padding:4px 8px; border-radius:999px;
  background:#eee; color:#444; font-size:11px; font-weight:800; text-transform:capitalize;
}
.status-new { background:#eaf3ff; color:#205b91; }
.status-contacted { background:#fff5df; color:#805a0b; }
.status-confirmed { background:#e8f6ec; color:#176b35; }
.status-completed { background:#e8e8e8; color:#333; }
.status-cancelled { background:#fdeaea; color:#9b2525; }
.order-modal-card { width:min(100%, 980px); }
.order-detail-grid {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 24px;
  padding:4px 0 20px; border-bottom:1px solid #eee;
}
.order-detail-grid > div { display:grid; gap:4px; }
.order-detail-grid .detail-wide { grid-column:1 / -1; }
.detail-label {
  color:#777; font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase;
}
.order-detail-heading { margin:20px 0 10px; font-size:16px; }
.order-items-wrap { overflow:auto; border:1px solid #ddd; border-radius:7px; }
.order-items-table { width:100%; min-width:700px; border-collapse:collapse; }
.order-items-table th, .order-items-table td {
  padding:8px 9px; border-bottom:1px solid #eee; text-align:left; font-size:12px;
}
.order-items-table th { background:#f5f5f5; color:#666; font-size:10px; text-transform:uppercase; letter-spacing:.05em; }
.order-items-table tr:last-child td { border-bottom:0; }
.order-totals { margin:14px 0 0 auto; width:min(100%,300px); }
.order-totals > div {
  display:flex; justify-content:space-between; gap:20px; padding:5px 0; font-size:13px;
}
.order-grand-total {
  margin-top:6px; padding-top:10px !important; border-top:1px solid #ddd; font-size:16px !important;
}
.order-note { margin-top:18px; padding:12px 14px; border:1px solid #e4e4e4; border-radius:7px; background:#fafafa; }
.order-note p { margin:6px 0 0; color:#444; white-space:pre-wrap; }
body.modal-open { overflow:hidden; }

@media (max-width: 760px) {
  .orders-toolbar { align-items:stretch; flex-direction:column; }
  .orders-toolbar-actions { flex-wrap:wrap; }
  .order-search { flex:1 1 100%; width:auto; }
  .order-detail-grid { grid-template-columns:1fr; }
  .order-detail-grid .detail-wide { grid-column:auto; }
}
