body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

*, *::before, *::after {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-shell {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 16px;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

#login-card {
  max-width: 420px;
}

.admin-remember input {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

input, select, button {
  font: inherit;
}

input, select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 10px;
}

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

.admin-logout-btn {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 600;
  padding: 9px 14px;
}

.admin-logout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.55);
}

h1, h2 {
  margin: 0 0 12px;
}

#login-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 12px;
}

#login-form input[type="password"] {
  width: 100%;
}

#login-form button[type="submit"] {
  width: 100%;
  padding: 11px 14px;
  font-weight: 700;
}

.admin-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
}

.model-picker {
  position: relative;
}

.model-picker-trigger {
  width: 100%;
  text-align: left;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  padding: 9px 36px 9px 10px;
  position: relative;
}

.model-picker-trigger::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid #111827;
  border-bottom: 2px solid #111827;
  transform: translateY(-60%) rotate(45deg);
}

.model-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  max-height: min(48vh, 300px);
  overflow-y: auto;
}

.model-picker-option {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #f3f4f6;
  border-radius: 0;
  background: #fff;
  color: #111827;
  padding: 10px 12px;
}

.model-picker-option:last-child {
  border-bottom: 0;
}

.model-picker-option.is-active {
  background: #eff6ff;
}

button {
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  padding: 9px 12px;
  cursor: pointer;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-visibility-filter {
  min-width: 260px;
}

.admin-visibility-filter .model-picker {
  margin-top: 6px;
  max-width: 320px;
}

.admin-filters-hint {
  flex: 1 0 100%;
  font-size: 12px;
  color: #666;
  margin: 0;
  line-height: 1.4;
}

.admin-filters-hint code {
  font-size: 11px;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 240px;
}

.model-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.bulk-price-panel {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #fafafa;
}

.bulk-price-title {
  font-size: 15px;
  margin: 0 0 8px;
}

.bulk-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
}

.bulk-pct-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.bulk-pct-input {
  width: 120px;
}

.bulk-scope-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.bulk-scope-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.bulk-pct-apply {
  padding: 10px 16px;
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.bulk-pct-apply:hover {
  background: #374151;
}

.bulk-pct-apply:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #93c5fd;
  border-radius: 6px;
  background: #fff;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

input[type="checkbox"]::before {
  content: "";
  width: 12px;
  height: 12px;
  transform: scale(0);
  transition: transform 0.12s ease-in-out;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
  background: #fff;
}

input[type="checkbox"]:checked {
  background: #0ea5e9;
  border-color: #0284c7;
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:active {
  transform: scale(0.95);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.35);
  outline-offset: 2px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

.thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: contain;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  cursor: zoom-in;
}

.thumb--ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 11px;
}

td input[type="text"] {
  width: 100%;
}

button.is-saving {
  background: #374151;
}

button.is-saved {
  background: #16a34a;
}

.error {
  color: #dc2626;
  margin-top: 10px;
}

.status {
  margin-top: 10px;
  color: #374151;
}

.orders-panel {
  margin-top: 20px;
  border-top: 1px solid #e5e7eb;
  padding-top: 16px;
}

.orders-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.orders-head h3 {
  margin: 0;
}

.orders-count {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}

#orders-tbody td {
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
}

.orders-table .order-cell--customer {
  min-width: 180px;
  max-width: 260px;
}

.orders-table .order-cell--items {
  min-width: 200px;
}

.orders-items-list {
  margin: 0;
  padding-left: 16px;
}

.orders-table .orders-items-list {
  padding-left: 0;
}

.orders-items-list li {
  margin: 0 0 4px;
}

.orders-muted {
  color: #6b7280;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.image-lightbox[hidden] {
  display: none !important;
}

.image-lightbox-img {
  max-width: min(96vw, 920px);
  max-height: 86vh;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.image-lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 0;
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.55);
}

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

.admin-modal-panel {
  width: min(100%, 400px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.admin-modal-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
}

.admin-modal-message {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: #374151;
}

.admin-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-modal-btn {
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.admin-modal-btn--primary {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.admin-modal-btn--primary:hover {
  background: #374151;
  border-color: #374151;
}

.admin-modal-btn--secondary {
  background: #fff;
  color: #111827;
  border-color: #d1d5db;
}

.admin-modal-btn--secondary:hover {
  background: #f9fafb;
}

@media (max-width: 760px) {
  input[type="checkbox"] {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .admin-shell {
    margin: 10px auto 20px;
    padding: 0 8px;
  }

  .card {
    padding: 12px;
    border-radius: 10px;
  }

  .admin-head {
    margin-bottom: 10px;
  }

  .admin-head h2 {
    font-size: 18px;
  }

  .filters {
    flex-direction: column;
    gap: 8px;
  }

  .filters label {
    min-width: 0;
  }

  .model-picker-menu {
    max-height: min(42vh, 240px);
  }

  .model-bar {
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }

  #save-model-btn {
    margin-left: auto;
  }

  .catalog-editor .table-wrap {
    overflow: hidden;
  }

  .catalog-editor thead {
    display: none;
  }

  .catalog-editor table,
  .catalog-editor tbody,
  .catalog-editor tr,
  .catalog-editor td {
    display: block;
    width: 100%;
  }

  .catalog-editor tbody tr {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) minmax(84px, 28vw);
    grid-template-areas:
      "img title title"
      "img save vis"
      "img price price";
    column-gap: 10px;
    row-gap: 8px;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    min-height: 120px;
    overflow: hidden;
  }

  .catalog-editor tbody tr:last-child {
    border-bottom: 0;
  }

  .catalog-editor td {
    border-bottom: 0;
    padding: 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .catalog-editor tbody tr td:nth-child(1) {
    grid-area: img;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Visible checkbox column */
  .catalog-editor tbody tr td:nth-child(2) {
    grid-area: vis;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
  }

  /* Title */
  .catalog-editor tbody tr td:nth-child(3) {
    grid-area: title;
  }

  .catalog-editor tbody tr td:nth-child(3) input[type="text"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: 14px;
    padding: 8px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Price */
  .catalog-editor tbody tr td:nth-child(4) {
    grid-area: price;
    display: flex;
    justify-content: flex-end;
  }

  .catalog-editor tbody tr td:nth-child(4) input[type="text"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: 14px;
    padding: 8px 8px;
  }

  /* Save button */
  .catalog-editor tbody tr td:nth-child(5) {
    grid-area: save;
    display: flex;
    justify-content: flex-start;
  }

  .catalog-editor tbody tr td:nth-child(5) button {
    width: 100%;
    max-width: 100%;
    padding: 8px 0;
    border-radius: 10px;
  }

  .catalog-editor .thumb {
    width: 56px;
    height: 56px;
    max-width: 100%;
    border-radius: 10px;
  }
}

/* ─── 2026 admin refresh: clean marketplace-style ops UI ───────────────────── */
body {
  background: #eceff3;
  color: #121212;
}

.admin-shell {
  max-width: 1280px;
  margin: 18px auto 30px;
  padding: 0 14px;
}

.admin-shell *,
.admin-shell *::before,
.admin-shell *::after {
  border-radius: 0 !important;
}

#admin-app.card {
  border: 1px solid #1a1a1a;
  box-shadow: none;
  padding: 0;
  overflow: hidden;
}

.admin-head {
  background: #0b0b0b;
  color: #fff;
  padding: 14px 16px;
  margin: 0;
  border-bottom: 2px solid #e01f1f;
}

.admin-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.admin-head #refresh-btn,
.admin-head .admin-logout-btn {
  background: #e01f1f;
  color: #fff;
  border: 1px solid #e01f1f;
  font-weight: 700;
  padding: 9px 14px;
}

.admin-head .admin-logout-btn {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
}

.admin-head #refresh-btn:hover {
  background: #b91616;
  border-color: #b91616;
}

.admin-head .admin-logout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.55);
}

.orders-dashboard,
.catalog-editor {
  padding: 16px;
}

.orders-dashboard {
  background: #fff;
  border-bottom: 1px solid #d4d8df;
}

.catalog-editor {
  background: #f7f8fa;
}

.section-head {
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0 0 2px;
  font-size: 17px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section-sub {
  margin: 0;
  font-size: 12px;
  color: #596272;
}

.orders-head {
  margin-bottom: 10px;
}

.orders-head h3 {
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.orders-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.orders-metric {
  border: 1px solid #d8dde6;
  background: #f8f9fc;
  padding: 10px;
}

.orders-metric-label {
  margin: 0 0 5px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  font-weight: 700;
}

.orders-metric-value {
  margin: 0;
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
}

.filters,
.model-bar,
.bulk-price-panel {
  border: 1px solid #d8dde6;
  background: #fff;
  padding: 10px;
}

.filters {
  margin-bottom: 10px;
  gap: 10px;
}

.model-bar {
  margin-bottom: 10px;
}

.bulk-price-panel {
  margin-bottom: 10px;
}

.bulk-price-title {
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #465063;
}

.table-wrap {
  border: 1px solid #d4d8df;
  background: #fff;
}

table {
  background: #fff;
}

thead th {
  background: #f1f4f8;
  color: #111827;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

th, td {
  border-bottom: 1px solid #e5e9f0;
}

td code {
  font-size: 11px;
  background: #f4f4f5;
  padding: 2px 5px;
}

input,
select,
.model-picker-trigger {
  border: 1px solid #cfd5df !important;
  background: #fff !important;
  color: #111827 !important;
}

.admin-shell .model-picker-trigger {
  font-weight: 600;
}

.admin-shell .model-picker-option {
  background: #fff !important;
  color: #111827 !important;
  border: 0 !important;
  border-bottom: 1px solid #e5e9f0 !important;
  font-weight: 500;
}

.admin-shell .model-picker-option.is-active {
  background: #f3f4f6 !important;
  color: #111827 !important;
  box-shadow: inset 3px 0 0 #e01f1f;
}

.admin-shell .model-picker-option:hover {
  background: #eef2f7 !important;
}

.admin-shell button:not(.model-picker-trigger):not(.model-picker-option),
.admin-shell .bulk-pct-apply {
  background: #111827;
  color: #fff;
  border: 1px solid #111827 !important;
  font-weight: 700;
}

.admin-shell button:not(.model-picker-trigger):not(.model-picker-option):hover,
.admin-shell .bulk-pct-apply:hover {
  background: #1f2937;
  border-color: #1f2937 !important;
}

.admin-head #refresh-btn {
  background: #e01f1f !important;
  border-color: #e01f1f !important;
  color: #fff !important;
}

.admin-head #refresh-btn:hover {
  background: #b91616 !important;
  border-color: #b91616 !important;
}

button.is-saved {
  background: #166534 !important;
  border-color: #166534 !important;
}

.toggle span {
  font-size: 13px;
  color: #243043;
}

.status {
  margin-top: 8px;
  color: #374151;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #e2e8f0;
  color: #1f2937;
}

.status-chip--paid {
  border-color: #16a34a;
  background: #dcfce7;
  color: #14532d;
}

.status-chip--failed {
  border-color: #ef4444;
  background: #fee2e2;
  color: #7f1d1d;
}

.status-chip--pending {
  border-color: #f59e0b;
  background: #fef3c7;
  color: #78350f;
}

.status-chip--pending {
  border-color: #f59e0b;
  background: #fef3c7;
  color: #78350f;
}

.fulfillment-chip--confirmed {
  border-color: #1f2937;
  background: #f3f4f6;
  color: #111827;
}

.fulfillment-chip--production {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.fulfillment-chip--quality {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #4c1d95;
}

.fulfillment-chip--dispatched {
  border-color: #16a34a;
  background: #dcfce7;
  color: #14532d;
}

.fulfillment-chip--cancelled {
  border-color: #ef4444;
  background: #fee2e2;
  color: #7f1d1d;
}

.overdue-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.overdue-badge--amber {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.overdue-badge--red {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.order-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.order-actions button {
  width: 100%;
  padding: 6px 8px;
  font-size: 11px;
}

.order-ref {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.order-buyer-label {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.order-buyer-name {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.order-buyer-phone,
.order-buyer-email {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.order-buyer-phone a,
.order-buyer-email a {
  color: #111827;
  text-decoration: none;
}

.order-buyer-phone a:hover,
.order-buyer-email a:hover {
  text-decoration: underline;
}

.order-buyer-address {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
}

.order-buyer-address span {
  display: block;
}

.orders-items-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
  margin: 0 0 8px;
  line-height: 1.45;
}

.order-item-qty {
  flex: 0 0 auto;
  font-weight: 700;
  color: #111827;
}

.order-item-desc {
  flex: 1 1 12rem;
  min-width: 0;
  word-break: break-word;
}

.order-item-price {
  flex: 0 0 auto;
  margin-left: auto;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

.order-total {
  font-size: 16px;
  font-weight: 800;
  color: #111827;
}

.dispatch-type-fieldset {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.dispatch-type-opt {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

.dispatch-fields label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
}

.dispatch-fields input,
.dispatch-fields select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
}

.dispatch-field-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
}

#dispatch-custom-link-wrap.is-required .dispatch-field-hint {
  color: #b45309;
}

.dispatch-link-preview {
  margin: 4px 0 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.dispatch-link-preview-label {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.dispatch-link-preview a {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: #1d4ed8;
  word-break: break-all;
}

.dispatch-link-preview-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #6b7280;
}

.admin-modal-actions--dispatch {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

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

@media (max-width: 560px) {
  .admin-modal-actions-main {
    flex-direction: column;
  }

  .admin-modal-actions-main .admin-modal-btn {
    width: 100%;
  }

  .admin-modal-actions--dispatch .admin-modal-btn {
    width: 100%;
  }
}

.admin-modal-panel--wide {
  max-width: 520px;
}

.admin-modal-panel--preview {
  max-width: 680px;
}

.email-preview-frame {
  width: 100%;
  height: 420px;
  border: 1px solid #e5e7eb;
  background: #fff;
}

.email-test-panel {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.email-test-panel[open] {
  padding: 12px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
}

.email-test-toggle {
  display: inline-block;
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  user-select: none;
}

.email-test-toggle::-webkit-details-marker {
  display: none;
}

.email-test-toggle::marker {
  content: "";
}

.email-test-toggle:hover {
  color: #e01f1f;
  text-decoration: underline;
}

.email-test-panel[open] .email-test-toggle {
  margin-bottom: 10px;
  color: #374151;
  text-decoration: none;
}

.email-test-body {
  padding-top: 2px;
}

.email-test-sub {
  margin: 0 0 12px;
  font-size: 13px;
  color: #6b7280;
}

.email-test-sub code {
  font-size: 12px;
  background: #f3f4f6;
  padding: 1px 4px;
}

.email-test-row {
  margin-bottom: 12px;
}

.email-test-to-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.email-test-to-label input {
  display: block;
  width: 100%;
  max-width: 320px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
}

.email-test-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #9ca3af;
}

.email-test-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.email-test-buttons .email-test-btn {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #1f2937;
  background: #fff;
  color: #111827;
}

.email-test-buttons .email-test-btn:hover {
  background: #fee2e2;
  border-color: #e01f1f;
  color: #991b1b;
}

.email-test-buttons .email-test-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .orders-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-head {
    padding: 12px;
  }
  .orders-dashboard,
  .catalog-editor {
    padding: 12px;
  }
  .orders-metrics {
    grid-template-columns: 1fr;
  }

  .orders-table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .orders-table thead {
    display: none;
  }

  .orders-table,
  .orders-table tbody,
  .orders-table tr,
  .orders-table td {
    display: block;
    width: 100%;
  }

  .orders-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "ref when"
      "payment fulfillment"
      "customer customer"
      "items items"
      "total total"
      "actions actions";
    gap: 0;
    margin-bottom: 12px;
    padding: 0;
    min-height: 0;
    overflow: visible;
    border: 1px solid #d4d8df;
    background: #fff;
  }

  .orders-table tbody tr:last-child {
    border-bottom: 1px solid #d4d8df;
  }

  .orders-table .order-cell {
    padding: 10px 12px;
    border-bottom: 1px solid #eef1f5;
    min-width: 0;
    max-width: none;
    overflow: visible;
  }

  .orders-table .order-cell--ref {
    grid-area: ref;
    background: #f8f9fc;
    font-size: 15px;
  }

  .orders-table .order-cell--when {
    grid-area: when;
    background: #f8f9fc;
    text-align: right;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
  }

  .orders-table .order-cell--payment {
    grid-area: payment;
    display: flex;
    align-items: center;
  }

  .orders-table .order-cell--fulfillment {
    grid-area: fulfillment;
    text-align: right;
  }

  .orders-table .order-cell--customer {
    grid-area: customer;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .orders-table .order-cell--items {
    grid-area: items;
    padding-top: 12px;
    padding-bottom: 4px;
  }

  .orders-table .order-cell--items::before {
    content: "Items";
    display: block;
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
  }

  .orders-table .orders-items-list {
    padding-left: 0;
    list-style: none;
  }

  .orders-table .order-cell--total {
    grid-area: total;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    padding-bottom: 12px;
    background: #f8f9fc;
  }

  .orders-table .order-cell--total::before {
    content: "Order total";
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
  }

  .orders-table .order-cell--actions {
    grid-area: actions;
    border-bottom: 0;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .orders-table .order-actions {
    min-width: 0;
    width: 100%;
  }

  .orders-table .order-actions button {
    padding: 11px 12px;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
    text-align: center;
  }

  .orders-table .status-chip {
    min-width: 0;
    max-width: 100%;
    font-size: 9px;
    padding: 4px 6px;
  }

  .orders-table .overdue-badge {
    display: block;
    margin-top: 6px;
    width: fit-content;
    margin-left: auto;
  }
}
