* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: #f4f5f7;
  color: #1a1f36;
  padding: 24px;
  max-width: 1200px;
  margin-inline: auto;
}

header h1 { margin: 0 0 4px; font-size: 1.5rem; }
.tag {
  font-size: 0.75rem;
  background: #635bff;
  color: #fff;
  border-radius: 4px;
  padding: 2px 8px;
  vertical-align: middle;
}
.warning {
  background: #fff8e1;
  border: 1px solid #f0c36d;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }

.auth-grid { align-items: start; }
.auth-box {
  border: 1px solid #e8ebf1;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}
.auth-box h3 {
  margin: 0;
  font-size: 0.95rem;
}

.help-popover {
  position: relative;
}

.help-popover > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid #d5d9e0;
  border-radius: 999px;
  background: #fff;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: #3c4563;
  user-select: none;
}

.help-popover > summary::-webkit-details-marker {
  display: none;
}

.help-popover-card {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(460px, 92vw);
  background: #fff;
  border: 1px solid #e1e5ee;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(26, 31, 54, 0.18);
  padding: 12px 14px;
  z-index: 20;
}

.help-popover-card h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.help-popover-card p {
  margin: 8px 0;
  font-size: 0.85rem;
}

.help-popover-card ol {
  margin: 6px 0 10px 18px;
  padding: 0;
  font-size: 0.84rem;
}

.columns { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .columns { grid-template-columns: 1fr; } }

.columns.merchant-mode {
  grid-template-columns: 1fr;
}

.columns.merchant-mode #merchant-panel {
  width: 100%;
  max-width: 100%;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 10px; align-items: end; }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: #4f566b; }
label.inline { flex-direction: row; align-items: center; }
input,
select,
textarea {
  padding: 8px 10px;
  border: 1px solid #d5d9e0;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  background: #fff;
  color: #1a1f36;
}
textarea {
  resize: vertical;
  min-height: 90px;
  font-family: inherit;
}
input:focus,
select:focus,
textarea:focus { outline: 2px solid #635bff33; border-color: #635bff; }

.desc-format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.desc-format-toolbar button {
  min-width: 34px;
  min-height: 32px;
  padding: 5px 10px;
}

.desc-format-toolbar .muted {
  font-size: 0.76rem;
}

button {
  padding: 8px 14px;
  border: 1px solid #d5d9e0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.875rem;
}
button:hover { background: #f4f5f7; }
button.primary { background: #635bff; color: #fff; border-color: #635bff; }
button.primary:hover { background: #4f48d1; }
button.danger { color: #b3261e; border-color: #e2b4b1; }
.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid #d5d9e0;
  border-radius: 6px;
  background: #fff;
  color: #1a1f36;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none;
}
.button-like:hover { background: #f4f5f7; }
.button-like.primary {
  background: #635bff;
  color: #fff;
  border-color: #635bff;
}
.button-like.primary:hover { background: #4f48d1; }
.primary-text { color: #635bff; cursor: pointer; font-weight: 600; }

.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.row-gap { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.muted { color: #6b7280; font-size: 0.85rem; }
.hidden { display: none !important; }

.connected-identity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #d5d9e0;
  border-radius: 999px;
  background: #fff;
  color: #3c4563;
  font-size: 0.78rem;
}

.merchant-list { list-style: none; margin: 0 0 12px; padding: 0; }
.merchant-list li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.merchant-list li:hover { background: #f4f5f7; }
.merchant-list li.active { background: #635bff14; font-weight: 600; }
.merchant-list li > span:first-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.merchant-badges {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.merchant-visibility {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #e8ebf1;
  border-radius: 8px;
  background: #fbfcff;
}

.merchant-visibility h3 {
  margin: 0;
  font-size: 0.9rem;
}

.merchant-visibility-list {
  list-style: none;
  margin: 8px 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.merchant-visibility-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 8px;
  border-radius: 6px;
  min-width: 0;
  border: 1px solid #eef1f7;
  background: #fff;
}

.merchant-visibility-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.merchant-visibility-name {
  color: #1a1f36;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.merchant-visibility-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: #1a1f36;
  min-width: 0;
  white-space: normal;
}

.merchant-visibility-item input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.merchant-visibility-item span {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.3;
}

.merchant-visibility-list .merchant-badges {
  align-self: flex-start;
  max-width: 120px;
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .merchant-visibility-list li {
    flex-direction: column;
    gap: 8px;
  }
  .merchant-visibility-list .merchant-badges {
    max-width: none;
    justify-content: flex-start;
  }
}

#marketplace-admin-card form.compact {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eef1f7;
}

#marketplace-admin-card textarea {
  min-height: 72px;
}

.rule-checklist {
  margin-top: 6px;
  border: 1px solid #e5e9f2;
  border-radius: 8px;
  max-height: 340px;
  overflow: auto;
  background: #fff;
}

.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f3f8;
}

.rule-row:last-child {
  border-bottom: 0;
}

.rule-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rule-meta strong,
.rule-meta small {
  overflow-wrap: anywhere;
}

.rule-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.rule-actions label.inline {
  gap: 4px;
}

.marketplace-hero-block {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  align-items: start;
}

.marketplace-hero-preview-wrap {
  border: 1px solid #e5e9f2;
  border-radius: 8px;
  overflow: hidden;
  min-height: 120px;
  background: #f8fafd;
}

.marketplace-hero-preview {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.marketplace-hero-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.marketplace-panel-tabs {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: -4px;
}

.marketplace-panel-tabs button {
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 600;
}

.marketplace-panel-tabs button.active {
  background: #635bff;
  color: #fff;
  border-color: #635bff;
}

.marketplace-rules-grid.single-column {
  grid-template-columns: 1fr;
}

#mp-product-rules-block,
#mp-product-search-field {
  min-width: 0;
}

@media (max-width: 900px) {
  .marketplace-hero-block {
    grid-template-columns: 1fr;
  }
}

.env-filter-control {
  margin: 8px 0 12px;
}

.env-filter-control select {
  width: 100%;
}

.badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.pending, .badge.onboarding { background: #fff3cd; color: #8a6d1a; }
.badge.active { background: #d6f5df; color: #14683c; }
.badge.restricted { background: #ffe0d6; color: #a33c1a; }
.badge.disabled { background: #eee; color: #555; }
.badge.env.live { background: #ffe3e3; color: #a80b1f; }
.badge.env.test { background: #e6efff; color: #1e4db8; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; margin: 12px 0; }
@media (max-width: 800px) { .facts { grid-template-columns: 1fr; } }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: 0.72rem; text-transform: uppercase; color: #6b7280; }
.facts dd { margin: 0; font-size: 0.9rem; word-break: break-all; }

.requirements {
  background: #fff3cd;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
}
.requirements ul { margin: 6px 0 0; padding-left: 18px; }

.merchant-username-form {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.merchant-username-form label {
  flex: 1;
  min-width: 220px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; color: #6b7280; font-size: 0.72rem; text-transform: uppercase; }
th, td { padding: 8px 6px; border-bottom: 1px solid #eef0f3; }
tr.revoked { opacity: 0.5; text-decoration: line-through; }

.product {
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
}
.product.inactive { opacity: 0.55; }
.product h3 { margin: 0 0 4px; font-size: 0.95rem; }
.price-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-top: 1px dashed #eef0f3;
  font-size: 0.85rem;
  gap: 8px;
}
.price-line .interval {
  background: #e8e7ff;
  color: #4f48d1;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.72rem;
}
.price-form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.price-form input, .price-form select { width: auto; flex: 1; min-width: 90px; padding: 6px 8px; }

#products-table td code {
  display: inline;
  background: none;
  color: #6b7280;
  padding: 0;
  border-radius: 0;
  margin: 0;
  font-size: 0.78rem;
}

#products-table {
  width: 100%;
  table-layout: fixed;
}

#products-table th,
#products-table td {
  word-break: break-word;
}
#products-table th:nth-child(1),
#products-table td:nth-child(1) {
  width: 54px;
  padding-right: 4px;
}
#products-table th:nth-child(2),
#products-table td:nth-child(2) {
  padding-left: 4px;
}
#products-table th:nth-child(4),
#products-table td:nth-child(4) {
  width: 140px;
}
#products-table th:nth-child(5),
#products-table td:nth-child(5) {
  width: 110px;
}
.product-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#product-modal {
  min-width: 680px;
  max-width: 860px;
}

#product-modal h3 {
  margin: 16px 0 8px;
  font-size: 0.9rem;
}

#product-prices-table td code {
  display: inline;
  background: none;
  color: #6b7280;
  padding: 0;
  border-radius: 0;
  margin: 0;
}

@media (max-width: 800px) {
  #product-modal {
    min-width: auto;
    width: calc(100vw - 28px);
  }
}

dialog {
  border: none;
  border-radius: 10px;
  padding: 20px;
  max-width: 560px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}
dialog::backdrop { background: rgba(26,31,54,0.5); }
dialog code {
  display: block;
  background: #1a1f36;
  color: #7df3b1;
  padding: 12px;
  border-radius: 6px;
  word-break: break-all;
  margin: 10px 0;
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1f36;
  color: #fff;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  z-index: 100;
}
.toast.error { background: #b3261e; }

/* ------------------------------------------------ back-office à onglets */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  border-radius: 999px; padding: 8px 18px; font-weight: 600;
}
.tabs button.active { background: #635bff; color: #fff; border-color: #635bff; }

.stats-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 12px 16px; min-width: 160px;
}
.stat span { display: block; font-size: 0.72rem; text-transform: uppercase; color: #6b7280; }
.stat strong { font-size: 1.15rem; }
.stat.small strong { font-size: 0.95rem; }
.stat em { font-style: normal; color: #6b7280; font-size: 0.8rem; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select, .filters input {
  width: auto; min-width: 150px; padding: 7px 9px;
  border: 1px solid #d5d9e0; border-radius: 6px; font-size: 0.85rem;
}
.pay-actions-mobile { display: none; }
.item-actions-mobile { display: none; }
.pay-row-menu {
  position: relative;
  display: inline-block;
}
.pay-row-menu > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid #d5d9e0;
  border-radius: 8px;
  width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-size: 1rem;
  color: #2c3855;
}
.pay-row-menu > summary::-webkit-details-marker {
  display: none;
}
.pay-row-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  background: #fff;
  border: 1px solid #e1e5ee;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(26, 31, 54, 0.14);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 12;
}
.pay-row-menu-list button,
.pay-row-menu-list a {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 8px;
  border-radius: 7px;
  color: #1a1f36;
  text-decoration: none;
  font-size: 0.84rem;
}
.pay-row-menu-list button:hover,
.pay-row-menu-list a:hover {
  background: #f4f5f7;
}
.item-row-menu {
  position: relative;
  display: inline-block;
}
.item-row-menu > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid #d5d9e0;
  border-radius: 8px;
  width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-size: 1rem;
  color: #2c3855;
}
.item-row-menu > summary::-webkit-details-marker {
  display: none;
}
.item-row-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 148px;
  background: #fff;
  border: 1px solid #e1e5ee;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(26, 31, 54, 0.14);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 12;
}
.item-row-menu-list button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 8px;
  border-radius: 7px;
  color: #1a1f36;
  text-decoration: none;
  font-size: 0.84rem;
}
.item-row-menu-list button:hover {
  background: #f4f5f7;
}
.product-row-menu {
  position: relative;
  display: inline-block;
}
.product-row-menu > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid #d5d9e0;
  border-radius: 8px;
  width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-size: 1rem;
  color: #2c3855;
}
.product-row-menu > summary::-webkit-details-marker {
  display: none;
}
.product-row-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 150px;
  background: #fff;
  border: 1px solid #e1e5ee;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(26, 31, 54, 0.14);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 12;
}
.product-row-menu-list button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 8px;
  border-radius: 7px;
  color: #1a1f36;
  font-size: 0.84rem;
}
.product-row-menu-list button:hover {
  background: #f4f5f7;
}

.cat-checkboxes {
  border: 1px solid #e8ebf1;
  border-radius: 8px;
  padding: 8px;
  max-height: 260px;
  overflow: auto;
  margin-bottom: 8px;
}

.cat-checkboxes label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.cat-checkboxes input[type="checkbox"] {
  width: auto;
}

.pstatus {
  padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
  white-space: nowrap;
}
.pstatus.succeeded, .pstatus.active, .pstatus.sent { background: #d6f5df; color: #14683c; }
.pstatus.requires_payment, .pstatus.processing, .pstatus.incomplete, .pstatus.past_due { background: #fff3cd; color: #8a6d1a; }
.pstatus.failed, .pstatus.canceled, .pstatus.unpaid { background: #ffe0d6; color: #a33c1a; }
.pstatus.refunded { background: #e8e7ff; color: #4f48d1; }
.pstatus.processed, .pstatus.ok { background: #d6f5df; color: #14683c; }
.pstatus.received { background: #fff3cd; color: #8a6d1a; }
.pstatus.ignored { background: #eee; color: #555; }
.pay-status-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1;
}
.pay-status-icon.success { background: #d6f5df; color: #14683c; }
.pay-status-icon.failed { background: #ffe0d6; color: #a33c1a; }
.pay-status-icon.pending { background: #fff3cd; color: #8a6d1a; }
.shipment-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-block;
}
.shipment-badge.pending { background: #fff3cd; color: #8a6d1a; }
.shipment-badge.shipped { background: #d6f5df; color: #14683c; }
.shipment-badge.delivered { background: #e8e7ff; color: #4f48d1; }

#payment-modal {
  min-width: 480px;
  max-width: 640px;
  width: min(640px, calc(100vw - 28px));
  max-height: min(90vh, 780px);
}
#payment-modal #payment-modal-body {
  max-height: calc(90vh - 120px);
  overflow: auto;
  padding-right: 2px;
}
#payment-modal h3 { margin: 14px 0 4px; font-size: 0.9rem; }
#shipment-modal { min-width: 420px; max-width: 520px; }
#shipment-modal h3 { margin: 0 0 4px; font-size: 1rem; }
#shipment-modal .row-gap { justify-content: flex-end; }
.detail-line {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed #eef0f3; font-size: 0.88rem;
}
.detail-line-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-line-main strong {
  font-size: 0.9rem;
  color: #1a1f36;
}
.detail-line-amounts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
}
.detail-line.totals {
  border-bottom: none;
  font-size: 0.86rem;
  color: #374151;
}
.detail-line.total {
  border-bottom: none;
  border-top: 2px solid #1a1f36;
  font-weight: 600;
  margin-top: 2px;
  padding-top: 10px;
}

/* onglet Articles */
.item-thumb {
  display: inline-block; width: 34px; height: 34px; border-radius: 6px;
  flex: 0 0 34px;
  aspect-ratio: 1 / 1;
  background-size: cover; background-position: center; background-color: #f4f5f7;
  background-repeat: no-repeat;
  vertical-align: middle;
}
.attr-badge {
  padding: 1px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 600;
  white-space: nowrap;
}
.attr-badge.explicit { background: #d6f5df; color: #14683c; }
.attr-badge.uid { background: #e8e7ff; color: #4f48d1; }
.attr-badge.default { background: #fff3cd; color: #8a6d1a; }
.bulk-bar { align-items: center; background: #f8f9fb; border-radius: 8px; padding: 8px 10px; }

/* ------------------------------------------------ professional layout */
:root {
  --bo-bg: #f3f6fc;
  --bo-panel: #ffffff;
  --bo-border: #dfe6f4;
  --bo-ink: #0e1a38;
  --bo-muted: #55617c;
  --bo-brand: #635bff;
  --bo-brand-dark: #4f48d1;
  --bo-shadow: 0 18px 48px rgba(14, 26, 56, 0.08);
}

body {
  font-family: "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
  max-width: none;
  margin-inline: 0;
  padding: 0;
  background:
    radial-gradient(circle at 10% -20%, #e6ecff 0%, transparent 45%),
    radial-gradient(circle at 90% -25%, #e8f8ff 0%, transparent 40%),
    var(--bo-bg);
  color: var(--bo-ink);
}

header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--bo-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(250, 252, 255, 0.96) 100%);
  backdrop-filter: blur(8px);
}

header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.tag {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  margin-left: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: linear-gradient(135deg, var(--bo-brand) 0%, #7f75ff 100%);
}

.warning {
  margin: 10px 0 0;
  border: 1px solid #f0d79d;
  background: #fff9ea;
}

.card {
  border: 1px solid var(--bo-border);
  border-radius: 14px;
  box-shadow: var(--bo-shadow);
  background: var(--bo-panel);
  padding: 18px;
}

body.is-connected #tabs:not(.hidden) {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 108px;
  left: 16px;
  width: 240px;
  max-height: calc(100vh - 124px);
  overflow: auto;
  padding: 14px;
  gap: 8px;
  border: 1px solid var(--bo-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--bo-shadow);
}

body.is-connected .tabs button {
  width: 100%;
  border-radius: 10px;
  text-align: left;
  font-weight: 600;
  color: #2c3855;
  padding: 10px 12px;
}

body.is-connected .tabs button.active {
  background: linear-gradient(135deg, var(--bo-brand) 0%, #7a70ff 100%);
  color: #fff;
  border-color: transparent;
}

#drawer-account-actions {
  display: none;
}

#btn-nav-drawer {
  display: none;
}

#mobile-drawer-backdrop {
  display: none;
}

body.is-connected #auth-card,
body.is-connected #config-card,
body.is-connected .tab-view {
  margin-left: 276px;
  margin-right: 18px;
  margin-top: 14px;
}

body:not(.is-connected) #auth-card,
body:not(.is-connected) #config-card,
body:not(.is-connected) .tab-view {
  margin: 18px auto;
  width: min(1220px, calc(100% - 36px));
}

body:not(.is-connected) #tabs {
  display: none;
}

.muted {
  color: var(--bo-muted);
}

button.primary {
  background: linear-gradient(135deg, var(--bo-brand) 0%, #7a70ff 100%);
  border-color: transparent;
}

button.primary:hover {
  background: linear-gradient(135deg, var(--bo-brand-dark) 0%, #6d64ef 100%);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  color: #60708f;
  font-size: 0.69rem;
  letter-spacing: 0.07em;
}

th, td {
  border-bottom: 1px solid #edf1fa;
}

@media (max-width: 980px) {
  header {
    padding: 14px;
  }

  header > .row-between {
    align-items: flex-start;
    gap: 10px;
  }

  header h1 {
    font-size: 1.1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    max-width: calc(100% - 120px);
  }

  .tag {
    margin-left: 0;
    font-size: 0.72rem;
    padding: 2px 8px;
  }

  #topbar-actions {
    margin-top: 0;
    justify-content: flex-end;
  }

  body.is-connected #tabs:not(.hidden) {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 310px);
    margin: 0;
    border-radius: 0 14px 14px 0;
    transform: translateX(-106%);
    transition: transform 0.25s ease;
    z-index: 80;
    padding-top: 20px;
  }

  body.is-connected .tabs button {
    width: 100%;
  }

  #payments-table th:nth-child(5),
  #payments-table td:nth-child(5),
  #payments-table th:nth-child(6),
  #payments-table td:nth-child(6),
  #payments-table th:nth-child(7),
  #payments-table td:nth-child(7) {
    display: none;
  }

  #tab-payments > .card:first-child {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding-left: 14px;
    padding-right: 14px;
  }

  #payments-table {
    width: 100%;
    table-layout: fixed;
  }

  #payments-table th,
  #payments-table td {
    padding-left: 8px;
    padding-right: 8px;
  }

  #payments-table th:first-child,
  #payments-table td:first-child {
    padding-left: 0;
    padding-right: 2px;
    width: 28px;
  }

  #payments-table th:nth-child(2),
  #payments-table td:nth-child(2) {
    padding-left: 2px;
  }

  #payments-table th:last-child,
  #payments-table td:last-child {
    padding-right: 0;
    text-align: right;
    width: 44px;
  }

  #payments-table th:nth-child(8),
  #payments-table td:nth-child(8) {
    width: 30px;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
  }

  .pay-actions-desktop {
    display: none;
  }

  .pay-actions-mobile {
    display: block;
  }

  #items-table th,
  #items-table td {
    padding-left: 4px;
    padding-right: 4px;
  }

  #items-table th:first-child,
  #items-table td:first-child {
    padding-left: 0;
    padding-right: 1px;
    width: 24px;
  }

  #items-table th:nth-child(2),
  #items-table td:nth-child(2) {
    width: 16px;
    padding-left: 1px;
    padding-right: 1px;
  }

  #items-table th:nth-child(3),
  #items-table td:nth-child(3) {
    padding-left: 2px;
  }

  #items-table th:last-child,
  #items-table td:last-child {
    width: 38px;
    text-align: right;
    padding-right: 0;
  }

  #products-table th:nth-child(3),
  #products-table td:nth-child(3),
  #products-table th:nth-child(5),
  #products-table td:nth-child(5) {
    display: none;
  }

  #products-table th,
  #products-table td {
    padding-left: 3px;
    padding-right: 3px;
  }

  #products-table th:nth-child(1),
  #products-table td:nth-child(1) {
    width: 34px;
    padding-right: 1px;
  }

  #products-table th:nth-child(2),
  #products-table td:nth-child(2) {
    padding-left: 1px;
  }

  .product-name-cell {
    gap: 5px;
  }

  .product-name-cell .item-thumb {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    border-radius: 5px;
  }

  #products-table th:last-child,
  #products-table td:last-child {
    width: 40px;
    text-align: right;
    padding-right: 0;
  }

  .item-actions-desktop {
    display: none;
  }

  .item-actions-mobile {
    display: block;
  }

  #payment-modal {
    min-width: 0;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: 92vh;
    margin: auto;
  }

  #payment-modal #payment-modal-body {
    max-height: calc(92vh - 116px);
  }

  body.is-connected #btn-nav-drawer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    font-weight: 600;
    background: #fff;
  }

  #mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 16, 38, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 70;
  }

  body.is-connected.drawer-open #mobile-drawer-backdrop {
    display: block !important;
    opacity: 1;
    pointer-events: auto;
  }

  body.is-connected.drawer-open #tabs:not(.hidden) {
    transform: translateX(0);
  }

  body.is-connected.drawer-open {
    overflow: hidden;
  }

  body.is-connected #drawer-account-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--bo-border);
  }

  body.is-connected #drawer-account-actions button {
    width: 100%;
    text-align: left;
    border-radius: 10px;
  }

  body.is-connected #auth-card,
  body.is-connected #config-card,
  body.is-connected .tab-view {
    margin-left: 14px;
    margin-right: 14px;
    margin-top: 14px;
  }
}

@media (min-width: 981px) {
  #mobile-drawer-backdrop {
    display: none !important;
  }

  body.is-connected #btn-nav-drawer {
    display: none !important;
  }
}

/* ------------------------------------------------ Kadomi hosted mockup */
.console-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid #dfe6f4;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
}

.console-header-row {
  width: min(1320px, calc(100% - 28px));
  margin: 0 auto;
  padding: 12px 2px;
  align-items: center;
}

.console-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #143266;
}

.console-title span {
  font-weight: 600;
}

.console-title .tag {
  margin-left: 10px;
  background: #e7efff;
  color: #2b5fc6;
  font-size: 0.77rem;
}

.console-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.console-links {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}

.console-links a {
  text-decoration: none;
  color: #243c65;
  font-size: 0.84rem;
  font-weight: 600;
}

.console-links a:hover {
  color: #194cae;
}

.console-hero {
  width: min(1320px, calc(100% - 28px));
  margin: 16px auto 0;
  border: 1px solid #dce7fa;
  border-radius: 20px;
  background:
    linear-gradient(100deg, rgba(247, 251, 255, 0.97) 0%, rgba(242, 248, 255, 0.95) 52%, rgba(236, 244, 255, 0.72) 100%),
    url("./bg-kadomi-hosted.png") right center / cover no-repeat;
  box-shadow: 0 16px 36px rgba(19, 45, 86, 0.08);
  overflow: hidden;
}

.console-hero-content {
  width: min(760px, 100%);
  padding: 34px 28px 30px;
}

.console-eyebrow {
  margin: 0 0 12px;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: #5470a2;
  font-weight: 700;
}

.console-hero h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #0f2a56;
  max-width: 680px;
}

.console-lead {
  margin: 12px 0 18px;
  font-size: 1.08rem;
  line-height: 1.45;
  color: #51688e;
  max-width: 680px;
}

.console-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.console-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #d9e4f8;
  background: rgba(255, 255, 255, 0.75);
  color: #153062;
  font-size: 0.93rem;
  font-weight: 700;
}

.console-pill small {
  font-size: 0.75rem;
  color: #5f7295;
  font-weight: 500;
}

body:not(.is-connected) #auth-card {
  width: min(1320px, calc(100% - 28px));
  margin: 14px auto 24px;
  border-radius: 18px;
  border-color: #dde8fb;
  box-shadow: 0 18px 36px rgba(19, 45, 86, 0.09);
}

#auth-card h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.02em;
  color: #112a55;
}

#auth-card > .muted {
  font-size: 1rem;
  color: #607190;
  margin: 8px 0 14px;
}

#auth-card .warning {
  margin: 10px 0 14px;
  border: 1px solid #f6d49a;
  border-radius: 10px;
  padding: 11px 14px;
  color: #8b6223;
  background: #fff8ea;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 900px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }
}

.auth-box {
  border-radius: 14px;
  border: 1px solid #dde6f6;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  padding: 16px;
}

.auth-box h3 {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  color: #102b58;
}

.auth-box label {
  font-size: 0.82rem;
  color: #5c7092;
  gap: 6px;
}

.auth-box input {
  border-radius: 10px;
  border-color: #d9e3f3;
  height: 42px;
}

#merchant-login-form button.primary {
  background: linear-gradient(135deg, #2673fb 0%, #326fff 52%, #4c7cff 100%);
  border: none;
  color: #fff;
  font-weight: 700;
  height: 42px;
}

#merchant-login-form button.primary:hover {
  background: linear-gradient(135deg, #1862e4 0%, #245fef 55%, #4172f2 100%);
}

#merchant-signup-form button.primary {
  background: linear-gradient(135deg, #0f7c5a 0%, #1f946d 55%, #29a879 100%);
  border: none;
  color: #fff;
  font-weight: 700;
  height: 42px;
}

#merchant-signup-form button.primary:hover {
  background: linear-gradient(135deg, #0d6f50 0%, #1b855f 55%, #22966d 100%);
}

#merchant-signup-result {
  border: 1px solid #d7e9df;
  background: #f5fcf8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.86rem;
  color: #1f5e46;
}

#merchant-key-form button {
  border-radius: 10px;
  border-color: #dde6f6;
  background: #f2f5fb;
  color: #2b3d60;
  font-weight: 700;
  height: 42px;
}

#merchant-key-form button:hover {
  background: #e8edf7;
}

.technical-access-panel {
  margin-top: 12px;
  border: 1px solid #dbe5f5;
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px 12px 14px;
}

.technical-access-summary {
  cursor: pointer;
  list-style: none;
  color: #1c3e75;
  font-weight: 700;
  font-size: 0.96rem;
}

.technical-access-summary::-webkit-details-marker {
  display: none;
}

.technical-access-note {
  margin: 8px 0 10px;
  font-size: 0.86rem;
}

.technical-access-form {
  margin-top: 0;
  box-shadow: none;
}

body.is-connected .console-hero {
  display: none;
}

@media (max-width: 980px) {
  .console-header-row {
    width: calc(100% - 18px);
  }

  .console-title {
    font-size: 1.2rem;
  }

  .console-title .tag {
    margin-left: 6px;
    font-size: 0.69rem;
  }

  .console-links {
    display: none;
  }

  .console-hero {
    width: calc(100% - 18px);
    border-radius: 16px;
  }

  .console-hero-content {
    padding: 20px 14px;
  }

  .console-hero h2 {
    font-size: 2rem;
  }

  .console-lead {
    font-size: 0.95rem;
  }

  .console-pill {
    min-width: 46%;
    font-size: 0.84rem;
    padding: 8px 10px;
  }

  body:not(.is-connected) #auth-card {
    width: calc(100% - 18px);
    margin: 10px auto 16px;
  }

  #auth-card h2 {
    font-size: 1.52rem;
  }

  .auth-box h3 {
    font-size: 1.2rem;
  }
}
