.commerce-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px;
  background: #f8f7f2;
  border: 1px solid var(--line, #dedbd1);
  border-radius: 12px;
  margin-bottom: 22px;
  cursor: pointer;
}
.commerce-toggle input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 3px;
  accent-color: #14110e;
}
.commerce-toggle b,
.commerce-toggle small {
  display: block;
}
.commerce-toggle small {
  color: var(--muted);
  line-height: 1.7;
  margin-top: 5px;
}
.commerce-advanced {
  margin: 20px 0;
  border: 1px solid var(--line, #dedbd1);
  border-radius: 10px;
  padding: 16px;
}
.commerce-advanced summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 28px;
}
.commerce-advanced p,
.commerce-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.commerce-sync h3,
.commerce-links a {
  margin: 0;
}
.commerce-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}
.commerce-links a {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.commerce-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.commerce-metrics > div {
  padding: 20px;
  border: 1px solid var(--line, #dedbd1);
  border-radius: 12px;
}
.commerce-metrics span,
.commerce-metrics strong {
  display: block;
}
.commerce-metrics span {
  color: var(--muted);
  font-size: 14px;
}
.commerce-metrics strong {
  font-size: 36px;
  line-height: 1.5;
}
.commerce-money {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.commerce-money > div {
  padding: 18px;
  background: #f4f5eb;
  border-radius: 12px;
  min-width: 180px;
}
.commerce-money b,
.commerce-money span,
.commerce-money small {
  display: block;
}
.commerce-money b {
  font-size: 24px;
}
.commerce-money span {
  margin: 5px 0;
}
.commerce-money small {
  color: var(--muted);
}
.commerce-table-wrap {
  overflow: auto;
  max-height: 360px;
  border: 1px solid var(--line, #dedbd1);
  border-radius: 10px;
  margin-top: 20px;
}
.commerce-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  text-align: start;
}
.commerce-table caption {
  text-align: start;
  padding: 14px;
  font-weight: 700;
}
.commerce-table th,
.commerce-table td {
  text-align: start;
  padding: 12px 16px;
  white-space: nowrap;
  border-top: 1px solid var(--line, #dedbd1);
}
.commerce-table th {
  background: #f8f7f2;
}
.commerce-secret {
  padding: 20px;
  background: #fff6cd;
  border: 1px solid #ead382;
  border-radius: 12px;
  margin: 18px 0;
}
.commerce-secret code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  user-select: all;
  font-size: 14px;
  margin: 14px 0;
}
.commerce-code {
  padding: 16px;
  border-radius: 10px;
  background: #14110e;
  color: #faf8f2;
  font-size: 12px;
  line-height: 1.8;
  overflow: auto;
  max-width: 100%;
  text-align: left;
}
.commerce-sync .btn-row {
  flex-wrap: wrap;
}
.commerce-secret button {
  margin-inline-end: 8px;
}
.merchant-dashboard #view-publishing .panel,
.merchant-dashboard #view-referrals .panel {
  min-width: 0;
}
.merchant-dashboard #view-publishing textarea {
  resize: vertical;
  min-height: 100px;
}
@media (max-width: 600px) {
  .commerce-metrics {
    gap: 10px;
  }
  .commerce-metrics > div {
    padding: 14px;
  }
  .commerce-metrics strong {
    font-size: 30px;
  }
  .commerce-toggle {
    padding: 14px;
  }
  .commerce-advanced {
    padding: 12px;
  }
  .commerce-money > div {
    min-width: 0;
    width: 100%;
  }
  .commerce-links {
    flex-direction: column;
  }
  .commerce-code {
    font-size: 11px;
  }
  .commerce-sync .btn-row > * {
    flex: 1 1 100%;
  }
  .commerce-table th,
  .commerce-table td {
    padding: 10px;
  }
}
/* Keep the mobile navigation sized to its content instead of stretching its rows. */
@media (max-width: 860px) {
  .merchant-dashboard .app {
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
  }
  .merchant-dashboard .app-side {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: 44px 44px;
    gap: 8px 12px;
    align-content: start;
    align-items: center;
    align-self: start;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    height: auto;
    min-height: 0;
  }
  .merchant-dashboard .app-side .logo {
    grid-column: 1;
    grid-row: 1;
    padding-inline: 0;
    font-size: 21px;
  }
  .merchant-dashboard .app-side .store-switch {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    height: 44px;
    min-height: 44px;
  }
  .merchant-dashboard .app-side .app-nav {
    grid-column: 1/-1;
    grid-row: 2;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .merchant-dashboard .app-nav a {
    height: 44px;
    min-height: 44px;
    padding-inline: 12px;
    gap: 8px;
    white-space: nowrap;
    font-size: 13px;
  }
  .merchant-dashboard .app-nav a svg {
    width: 17px;
    height: 17px;
  }
  .merchant-dashboard .app-head {
    padding: 14px 16px;
    gap: 10px;
  }
  .merchant-dashboard .app-head h1 {
    font-size: 21px;
    margin: 0;
  }
  .merchant-dashboard .app-head a.domain {
    font-size: 12px;
  }
  .merchant-dashboard .app-head .btn-row {
    gap: 6px;
  }
  .merchant-dashboard .app-body {
    padding: 16px;
    gap: 16px;
  }
  .merchant-dashboard .dashboard-mobile-tools {
    padding: 0 12px;
  }
}
