.button-danger {
  color: #9f1d2c;
  background: #fff6f7;
  border: 1px solid #f0c8ce;
  box-shadow: none;
}

.button-danger:hover {
  color: white;
  background: #9f1d2c;
}

.admin-shell {
  display: block;
  width: min(1440px, calc(100% - 48px));
}

.admin-tabbar {
  position: sticky;
  top: 72px;
  z-index: 18;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding: 8px;
  background: rgba(247, 249, 251, 0.96);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(19, 32, 43, 0.06);
  backdrop-filter: blur(14px);
}

.admin-tabbar button {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 17px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.admin-tabbar button:hover {
  color: var(--ink);
  background: white;
}

.admin-tabbar button.is-active {
  color: white;
  background: var(--graphite);
  box-shadow: 0 5px 14px rgba(19, 32, 43, 0.16);
}

.admin-tab-live-dot,
.admin-log-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #31c48d;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(49, 196, 141, 0.16);
}

.admin-main > [data-admin-tab-panel][hidden] {
  display: none;
}

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

.panel-description {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.admin-logs-heading {
  align-items: flex-start;
}

.admin-log-live-status {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 9px;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: #0a6f46;
  background: #e7f6ee;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.admin-log-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-log-toolbar input,
.admin-log-toolbar select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

.admin-log-table {
  min-width: 1040px;
}

.admin-log-table td {
  vertical-align: top;
}

.admin-log-table td strong,
.admin-log-table td small {
  display: block;
}

.admin-log-table td small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.admin-log-table code {
  color: var(--graphite);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.admin-log-time {
  width: 150px;
  white-space: nowrap;
}

.admin-log-method {
  display: inline-block;
  margin-right: 4px;
  padding: 2px 5px;
  color: #72510a;
  background: #fff2d9;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
}

.admin-log-method-delete {
  color: #9c2f2f;
  background: #fde8e8;
}

.admin-log-method-patch {
  color: #23568a;
  background: #e6f0fb;
}

.admin-log-empty {
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.admin-log-empty strong {
  color: var(--ink);
  font-size: 16px;
}

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

.metric-card {
  padding: 20px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

.metric-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.deposit-layout,
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(360px, 1.2fr);
  gap: 20px;
}

.deposit-form,
.order-form,
.ticket-form {
  display: grid;
  gap: 16px;
}

.deposit-form input,
.deposit-form select,
.order-form select,
.ticket-form input,
.ticket-form select,
.ticket-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  font: inherit;
}

.ticket-form textarea {
  min-height: 132px;
  padding-top: 13px;
  resize: vertical;
}

.wallet-box {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-placeholder {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 160px;
  height: 160px;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(19, 32, 43, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(19, 32, 43, 0.08) 1px, transparent 1px),
    white;
  background-size: 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-placeholder span {
  background: var(--graphite);
  border-radius: 4px;
}

.qr-placeholder span:nth-child(2),
.qr-placeholder span:nth-child(3) {
  background: var(--teal-dark);
}

.wallet-details {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.wallet-details code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 12px;
  color: var(--graphite);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.wallet-details p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.wallet-network {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.order-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

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

.ticket-list article {
  padding: 18px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ticket-list h3 {
  margin: 12px 0 6px;
  font-size: 18px;
}

.ticket-list p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-grid {
  display: grid;
  gap: 12px;
}

.settings-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-card > div:first-child {
  display: grid;
  gap: 5px;
}

.settings-card small {
  color: var(--muted);
  line-height: 1.45;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toggle-row span {
  display: grid;
  gap: 5px;
}

.toggle-row small {
  color: var(--muted);
  line-height: 1.45;
}

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

.admin-product-dialog {
  width: min(720px, calc(100vw - 28px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.admin-product-dialog::backdrop {
  background: rgba(19, 32, 43, 0.5);
  backdrop-filter: blur(5px);
}

.admin-product-modal {
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
}

.admin-product-view {
  display: grid;
  gap: 16px;
}

.admin-product-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-product-detail-grid article,
.admin-product-detail-section,
.admin-delivery-preview article {
  padding: 14px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-product-detail-grid span,
.admin-delivery-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-product-detail-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.admin-product-detail-section {
  display: grid;
  gap: 10px;
}

.admin-product-detail-section h3 {
  margin: 0;
  font-size: 16px;
}

.admin-product-detail-section p {
  margin: 0;
  color: var(--graphite);
  line-height: 1.55;
}

.admin-delivery-preview {
  display: grid;
  gap: 8px;
}

.admin-delivery-preview article {
  display: grid;
  gap: 7px;
}

.admin-delivery-preview code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
}

.admin-product-grid,
.admin-product-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-product-lists {
  margin-top: 22px;
}

.admin-product-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  background: #eef4f5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-product-tabs button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--graphite);
  font: inherit;
  font-weight: 800;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.admin-product-tabs button.is-active {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
}

.admin-product-tab-panel[hidden] {
  display: none;
}

.admin-product-tab-panel h3 {
  margin: 0 0 12px;
}

.inventory-check-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.inventory-check-summary {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.compact-metrics .metric-card {
  min-height: 116px;
}

.compact-toggle {
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.inventory-check-jobs {
  margin-top: 18px;
}

.admin-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  background: #fff6f7;
  border: 1px solid #f0c8ce;
  border-radius: 8px;
}

.admin-danger-zone h3,
.admin-danger-zone p {
  margin: 0;
}

.admin-danger-zone p {
  color: var(--graphite);
  font-size: 14px;
  line-height: 1.45;
}

.admin-category-form.is-editing,
.admin-product-form.is-editing {
  animation: editPulse 900ms ease;
}

.gateway-description {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

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

.gateway-stat-card {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.gateway-stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gateway-stat-card strong {
  font-size: 28px;
  line-height: 1;
}

.gateway-subsection {
  margin: 0 0 14px;
  padding-bottom: 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  border-bottom: 2px solid var(--teal);
}

.gateway-subsection:not(:first-of-type) {
  margin-top: 28px;
}

/* Number gateway forms */
.number-provider-form,
.number-product-form {
  display: grid;
  min-width: 0;
  gap: 14px;
  padding: 20px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.number-provider-form h3,
.number-product-form h3 {
  margin: 0 0 2px;
  font-size: 20px;
  line-height: 1.2;
}

.number-provider-form label,
.number-product-form label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--graphite);
  font-size: 13px;
  font-weight: 800;
}

.number-provider-form input,
.number-provider-form select,
.number-product-form input,
.number-product-form select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 14px;
}

.number-provider-form input:focus,
.number-provider-form select:focus,
.number-product-form input:focus,
.number-product-form select:focus {
  outline: 3px solid rgba(15, 159, 154, 0.16);
  border-color: var(--teal);
}

.number-provider-form .form-grid,
.number-product-form .form-grid {
  gap: 14px;
  align-items: start;
}

.number-provider-form .button,
.number-product-form .button {
  justify-self: start;
  margin-top: 2px;
}

.email-code-test-form {
  margin-bottom: 24px;
}

.email-code-test-form h3 {
  margin: 0;
  font-size: 20px;
}

.email-code-test-form .eyebrow {
  margin: 0 0 5px;
}

.form-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.email-code-test-result {
  margin: 0;
  padding: 12px;
  color: var(--graphite);
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.gateway-list-item {
  align-items: center;
}

.gateway-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gateway-item-header strong {
  font-size: 15px;
}

.gateway-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.gateway-item-meta span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.gateway-price {
  color: var(--teal-dark) !important;
  font-weight: 800 !important;
}

.gateway-stock {
  color: var(--graphite) !important;
  font-weight: 800 !important;
}

.gateway-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.gateway-badge-active {
  color: #0a6f46;
  background: #e7f6ee;
}

.gateway-badge-warning {
  color: #8a5a08;
  background: #fff2d9;
}

.gateway-badge-danger {
  color: #9f1d2c;
  background: #fff6f7;
}

.gateway-badge-muted {
  color: var(--muted);
  background: #edf2f5;
}

.gateway-badge-info {
  color: #1a56a8;
  background: #e8f1fc;
}

.gateway-badge-default {
  color: var(--graphite);
  background: #eef2f5;
}

.admin-chat-reply-form input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

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

.admin-chat-thread {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-chat-thread h3,
.admin-chat-thread p {
  margin: 0;
}

.admin-chat-reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

@keyframes editPulse {
  0% {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.16);
  }
  100% {
    border-color: var(--line);
    box-shadow: none;
  }
}

@media (max-width: 900px) {
  .admin-tabbar {
    top: 8px;
  }

  .admin-log-toolbar {
    grid-template-columns: minmax(220px, 1fr) 170px auto;
  }

  .admin-log-toolbar [data-refresh-admin-logs] {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

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

  .inventory-check-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .admin-shell {
    padding-top: 14px;
  }

  .admin-tabbar {
    margin-right: -8px;
    margin-left: -8px;
    border-radius: 8px;
  }

  .admin-tabbar button {
    min-height: 40px;
    padding: 0 14px;
  }

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

  .admin-log-toolbar [data-refresh-admin-logs] {
    grid-column: auto;
  }

  .admin-logs-heading {
    align-items: flex-start;
  }

  .qr-placeholder {
    width: 140px;
    height: 140px;
  }

  .admin-danger-zone {
    align-items: flex-start;
    flex-direction: column;
  }
}
