:root {
  --brand: #ff9200;
  --brand-dark: #ed8000;
  --text: #16181d;
  --muted: #7a808c;
  --line: #eceef2;
  --soft: #f6f7f9;
  --panel: #fff;
  --danger: #ef4444;
  --ok: #18a058;
  --warn: #d97706;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--soft);
}

.upstream-balance-band { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 0 16px; margin: 0 0 16px; border-bottom: 1px solid var(--line); font-size: 13px; min-width: 0; }
.upstream-balance-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; min-width: 0; }
.upstream-balance-summary strong { font-size: 18px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.upstream-balance-summary small { color: var(--muted); }
.upstream-balance-band.is-low .upstream-balance-summary strong { color: #b42318; }
.upstream-balance-band .upstream-balance-toggle, .upstream-balance-band .upstream-balance-limit { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.upstream-balance-band input[type="checkbox"] { width: 16px; height: 16px; margin: 0; }
.upstream-balance-band input[type="number"] { width: 104px; min-width: 0; height: 34px; padding: 5px 8px; border: 1px solid #d0d5dd; border-radius: 4px; background: #fff; }
.upstream-balance-band button { min-height: 34px; padding: 6px 10px; border: 1px solid #d0d5dd; border-radius: 4px; background: #fff; color: var(--text); white-space: nowrap; }
.upstream-balance-band :focus-visible { outline: 2px solid #16788a; outline-offset: 2px; }
.upstream-balance-status { color: #9a3412; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .upstream-balance-band { gap: 10px 12px; }
  .upstream-balance-summary { flex-basis: 100%; }
  .upstream-balance-summary small { flex-basis: 100%; }
  .upstream-balance-status { flex-basis: 100%; }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
}

.admin-login-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, rgba(18, 20, 27, .92), rgba(255, 146, 0, .16));
  z-index: 2147483000;
}

.admin-login-overlay.show {
  display: grid;
}

.admin-login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 18px;
  background: rgba(255, 255, 255, .98);
  padding: 28px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .3);
}

.admin-login-brand {
  display: inline-block;
  color: var(--brand);
  font-size: 24px;
  font-weight: 900;
  font-style: italic;
  margin-bottom: 10px;
}

.admin-login-card h1 {
  margin: 0;
  font-size: 26px;
}

.admin-login-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-login-card label,
.admin-security-grid label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 14px;
}

.admin-login-card input,
.admin-security-grid input {
  width: 100%;
  height: 46px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.admin-login-card input:focus,
.admin-security-grid input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 146, 0, .14);
}

.admin-login-card button {
  height: 46px;
  border-radius: 999px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.admin-toast {
  position: fixed;
  left: 50%;
  top: 24px;
  width: max-content;
  min-width: 180px;
  max-width: min(520px, calc(100vw - 40px));
  border: 1px solid rgba(255, 146, 0, .2);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  color: #111827;
  padding: 13px 18px 13px 42px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, .2);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  transform: translate(-50%, -14px) scale(.98);
  opacity: 0;
  pointer-events: none;
  z-index: 2147483647;
  transition: opacity .2s ease, transform .2s ease;
}

.admin-toast::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(255, 146, 0, .14);
  transform: translateY(-50%);
}

.admin-toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  visibility: hidden;
}

body.admin-authenticated .admin-shell {
  visibility: visible;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, #12141b 0%, #171923 100%);
  color: #fff;
  padding: 24px 16px;
  border-right: 1px solid rgba(255, 255, 255, .06);
}

.brand {
  color: var(--brand);
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  margin: 0 8px 30px;
  letter-spacing: .2px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav button {
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b8bdc8;
  text-align: left;
  padding: 0 16px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.side-nav button.active,
.side-nav button:hover {
  background: rgba(255, 146, 0, .14);
  color: #fff;
}

.side-nav button.active {
  box-shadow: inset 3px 0 0 var(--brand);
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
}

.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
}

.top-actions button,
.panel-head button,
.modal-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
}

.primary {
  border-color: var(--brand) !important;
  background: var(--brand) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(255, 146, 0, .18);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stats-grid article,
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(16, 24, 40, .05);
}

.stats-grid article {
  padding: 18px;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stats-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  padding: 18px;
}

.admin-security-panel {
  margin-bottom: 18px;
}

.admin-security-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.admin-security-check {
  align-content: end;
  grid-template-columns: auto 1fr !important;
  justify-content: start;
  align-items: center;
  min-height: 72px;
}

.admin-security-check input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.admin-security-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.admin-security-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.admin-security-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 0 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel h2,
.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.vip-tier-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.vip-tier-heading > button { width: 34px; height: 34px; padding: 0; border: 1px solid #dfe5eb; border-radius: 6px; background: #fff; color: #374151; font-size: 24px; line-height: 1; cursor: pointer; }
.vip-invite-tier { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; align-items: end; gap: 12px; padding: 14px 0; border-bottom: 1px solid #e8ecf0; }
.vip-invite-tier > label { display: grid; gap: 8px; min-width: 0; font-size: 13px; }
.vip-invite-tier input { min-width: 0; width: 100%; }
.vip-invite-tier > button { min-height: 40px; padding: 8px 12px; border: 1px solid #f0dedf; border-radius: 6px; background: #fff; color: #b54d56; cursor: pointer; }
.vip-invite-tier > button:disabled,.vip-tier-heading > button:disabled { opacity: .4; cursor: not-allowed; }
@media(max-width: 540px) { .vip-invite-tier { grid-template-columns: minmax(0,1fr) auto; } .vip-invite-tier > label:first-child { grid-column: 1 / -1; } }

.vip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid #e8ba56;
  border-radius: 3px;
  background: #fff0cb;
  color: #775000;
  font-size: 10px;
  line-height: 16px;
  font-weight: 800;
  vertical-align: middle;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-order-kind-tabs {
  height: 38px;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(82px, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f3f4f6;
  padding: 3px;
}

.admin-order-kind-tabs button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 16px;
}

.admin-order-kind-tabs button.active {
  background: #fff;
  color: var(--brand-dark);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(16, 24, 40, .08);
}

.toolbar input,
.toolbar select,
.modal input,
.modal select,
.modal textarea {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 12px;
  outline: 0;
}

.modal textarea {
  height: auto;
  min-height: 120px;
  padding: 10px 12px;
  resize: vertical;
  font: inherit;
}

.panel textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  outline: 0;
  font: inherit;
  line-height: 1.5;
}

.form-hint,
.muted {
  color: var(--muted);
}

.danger-text {
  color: #ef4444;
}

.source-price-change {
  display: inline-grid;
  gap: 2px;
  white-space: nowrap;
}

.source-price-change strong {
  color: #c62828;
  font-weight: 600;
}

.source-price-change small {
  color: var(--muted);
  font-size: 11px;
}

.form-hint {
  margin: -4px 0 0;
  font-size: 12px;
}

.toolbar input {
  min-width: 280px;
  flex: 1;
}

.coupon-form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 120px 120px 140px 110px 130px 150px auto;
  gap: 10px;
  align-items: end;
}

.coupon-form-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

.coupon-form-grid input,
.coupon-form-grid select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  outline: 0;
  min-width: 0;
}

.coupon-form-grid .check-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 10px;
  color: var(--text);
  white-space: nowrap;
}

.coupon-form-grid button {
  min-height: 36px;
  padding: 0 16px;
  white-space: nowrap;
}

.coupon-history-panel {
  margin-top: 16px;
}

.compact-table-wrap {
  overflow: auto;
}

.compact-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.compact-table th,
.compact-table td {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.compact-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: #fbfcfe;
}

.compact-table td {
  font-size: 13px;
}

.agent-price-admin-table {
  min-width: 1180px;
}

.agent-price-admin-table th,
.agent-price-admin-table td {
  white-space: nowrap;
}

.compact-table strong {
  font-size: 13px;
}

.coupon-history-panel {
  padding-bottom: 0;
}

.coupon-history-panel .select-col {
  width: 48px;
  min-width: 48px;
}

.coupon-history-panel .compact-table th,
.coupon-history-panel .compact-table td {
  height: 42px;
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coupon-history-panel .compact-table th:nth-child(2),
.coupon-history-panel .compact-table td:nth-child(2) {
  width: 22%;
}

.coupon-history-panel .compact-table th:nth-child(3),
.coupon-history-panel .compact-table td:nth-child(3) {
  width: 25%;
}

.coupon-history-panel .compact-table th:nth-child(4),
.coupon-history-panel .compact-table td:nth-child(4) {
  width: 150px;
}

.coupon-history-panel .compact-table th:nth-child(5),
.coupon-history-panel .compact-table td:nth-child(5) {
  width: 150px;
}

.coupon-history-panel .compact-table th:nth-child(6),
.coupon-history-panel .compact-table td:nth-child(6) {
  width: 96px;
}

.coupon-history-panel .compact-table th:nth-child(7),
.coupon-history-panel .compact-table td:nth-child(7) {
  width: 96px;
  text-align: right;
}

.coupon-grant-list {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.coupon-grant-head,
.coupon-grant-line {
  display: grid;
  grid-template-columns: 44px minmax(150px, 1.1fr) minmax(220px, 1.4fr) 160px 160px 84px 76px;
  align-items: center;
  gap: 10px;
  min-width: 980px;
  padding: 0 12px;
}

.coupon-grant-head {
  height: 38px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.coupon-grant-line {
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.coupon-grant-line:last-child {
  border-bottom: 0;
}

.coupon-grant-line > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-grant-check {
  display: flex;
  justify-content: center;
}

.coupon-grant-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.coupon-grant-line strong {
  color: #141821;
}

.coupon-grant-actions {
  text-align: right;
}

.coupon-grant-actions button {
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #ffe7e7;
  color: #d92d20;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.coupon-grant-empty {
  min-width: 980px;
  padding: 18px;
  color: var(--muted);
}

.mail-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mail-settings-grid label,
.mail-template-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.mail-settings-grid input,
.mail-settings-grid select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  outline: 0;
}

.settings-card .hidden {
  display: none !important;
}

.settings-card[data-settings-panel="automation"] .mail-settings-grid {
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 240px) minmax(240px, 1fr) minmax(220px, 1fr);
  gap: 10px;
}

.settings-card[data-settings-panel="automation"] .mail-settings-grid label {
  min-width: 0;
}

.settings-card[data-settings-panel="automation"] #sendTgMonthlyReport {
  width: auto;
  max-width: 100%;
  justify-self: start;
  align-self: flex-start;
  min-height: 34px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

#groupMessageSettings [data-add-message] {
  width: auto;
  max-width: 100%;
  margin-top: 10px;
}

.group-message-media img {
  width: 240px;
  max-width: 100%;
  height: 160px;
  object-fit: contain;
  object-position: left center;
}

.group-message-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.group-message-actions button,
#groupMessageSettings [data-add-link],
.group-message-link button {
  justify-self: start;
  width: auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.group-message-link { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: end; }
.group-message-link label { min-width: 0; display: grid; gap: 6px; }
@media (max-width: 640px) { .group-message-link { grid-template-columns: minmax(0, 1fr); } }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.switch-row span {
  display: grid;
  gap: 4px;
}

.switch-row strong {
  font-size: 15px;
}

.switch-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.switch-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  flex: 0 0 auto;
}

.mail-template-label {
  margin-top: 12px;
}

.table-panel {
  padding: 0;
  overflow: auto;
}

.select-col {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.select-col input,
.admin-list-controls input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.admin-list-controls {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 12px 16px;
}

.bulk-tools,
.pager-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-list-controls .check-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #30343b;
  font-size: 13px;
}

.admin-list-controls button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #30343b;
  padding: 0 12px;
}

.admin-list-controls button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.admin-list-controls .danger-lite {
  border-color: #fecaca;
  color: var(--danger);
  background: #fff7f7;
}

.auto-order-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.auto-order-summary div {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px 16px;
}

.auto-order-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.auto-order-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.automation-record-panel {
  margin-top: 16px;
}

.automation-record-panel .panel-head {
  padding: 16px 18px 4px;
}

.auto-record-message {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mono-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.ledger-plus {
  color: var(--brand-dark);
}

.ledger-minus {
  color: var(--danger);
}

.ledger-note {
  max-width: 360px;
  white-space: normal;
  line-height: 1.45;
  color: var(--muted);
}

[data-panel="orders"] .table-panel {
  isolation: isolate;
  overflow: visible;
}

[data-panel="orders"] table {
  table-layout: fixed;
  min-width: 0;
}

[data-panel="orders"] th,
[data-panel="orders"] td {
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 10px 8px;
  vertical-align: top;
}

[data-panel="orders"] th { position: sticky; top: 0; z-index: 2; }
[data-panel="orders"] th:first-child { width: 44px; }
[data-panel="orders"] th:nth-child(2) { width: 18%; }
[data-panel="orders"] th:nth-child(3) { width: 15%; }
[data-panel="orders"] table[data-order-kind="network"] th:nth-child(5) { width: 100px; }
[data-panel="orders"] table[data-order-kind="network"] th:nth-child(6) { width: 86px; }
[data-panel="orders"] table[data-order-kind="network"] th:nth-child(7) { width: 14%; }
[data-panel="orders"] .admin-order-product { min-width: 0; }
[data-panel="orders"] .admin-order-product > * { min-width: 0; }
[data-panel="orders"] th:last-child { width: 96px; z-index: 3; }
[data-panel="orders"] th:last-child,
[data-panel="orders"] td:last-child:not([colspan]) {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
}
[data-panel="orders"] td:last-child:not([colspan]) { z-index: 1; }
[data-panel="orders"] .row-actions { flex-direction: column; align-items: stretch; }
[data-panel="orders"] .row-actions button { white-space: nowrap; padding: 0 6px; }

@media (max-width: 1100px) {
  [data-panel="orders"] table { min-width: 900px; }
  [data-panel="orders"] .table-panel { overflow-x: auto; }
}

.admin-order-product {
  display: grid;
  gap: 3px;
  min-width: 260px;
  white-space: normal;
}

.admin-order-product strong {
  color: #141821;
  font-size: 13px;
}

.admin-order-product span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  height: 46px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: #686f7c;
  background: #fafafa;
  font-weight: 600;
}

td {
  color: #23262d;
}

tr:last-child td {
  border-bottom: 0;
}

.status,
.status-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  background: #eef2ff;
  color: #4655d9;
}

.status.pending {
  background: #fff7ed;
  color: var(--warn);
}

.status.completed,
.status.submitted,
.status.active {
  background: #ecfdf3;
  color: var(--ok);
}

.status.failed {
  background: #fef2f2;
  color: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions button {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #333;
  padding: 0 10px;
  font-size: 12px;
}

.selectable-log-row {
  grid-template-columns: 32px 1fr auto;
}

.table-lite,
.log-list,
.log-grid {
  display: grid;
  gap: 8px;
}

.lite-row,
.log-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
}

.lite-row strong,
.log-row strong {
  display: block;
  font-size: 13px;
}

.lite-row span,
.log-row span {
  color: var(--muted);
  font-size: 12px;
}

.command-box {
  border-radius: 12px;
  background: #11131a;
  color: #e9edf5;
  padding: 14px;
  margin-bottom: 14px;
}

.command-box p {
  margin: 0 0 6px;
  color: #aeb5c3;
}

.command-box code {
  display: block;
  margin-bottom: 12px;
  color: #fff;
  word-break: break-all;
}

.command-note {
  margin: 8px 0 0 !important;
  color: #ffbf73 !important;
}

.api-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.api-tool-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.api-tool-grid input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 12px;
  outline: 0;
}

.api-tool-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.api-tool-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.api-result {
  min-height: 160px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f172a;
  color: #e5e7eb;
  padding: 14px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.settings-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.settings-header .form-hint {
  margin: 0;
}

.settings-header button {
  height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 20px;
  white-space: nowrap;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px;
}

.settings-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #596171;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

.settings-tabs button.active {
  border-color: rgba(255, 143, 0, .45);
  background: rgba(255, 143, 0, .1);
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(255, 143, 0, .12);
}

.settings-grid {
  display: block;
}

.settings-card {
  display: none;
  gap: 14px;
}

.settings-card.active {
  display: grid;
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.settings-card-head h2 {
  margin: 0;
  font-size: 17px;
}

.settings-card-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  line-height: 1.4;
}

.settings-grid label {
  display: grid;
  gap: 7px;
  color: #333843;
  font-size: 13px;
}

.settings-grid textarea {
  min-height: 132px;
}

.settings-grid .mail-template-label textarea {
  min-height: 132px;
}

.switch-line {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
  padding: 0 12px;
  color: var(--text) !important;
}

.switch-line input {
  width: 32px;
  height: 18px;
  order: 2;
}

.switch-line span {
  font-weight: 600;
}

.legacy-settings-textarea {
  display: none !important;
}

.structured-editor {
  display: grid;
  gap: 12px;
}

.structured-list {
  display: grid;
  gap: 12px;
}

.structured-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafafa;
  padding: 12px;
}

.structured-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.structured-row-head strong {
  font-size: 13px;
  color: var(--text);
}

.structured-row-head button,
.add-row-btn {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.structured-row-head button {
  color: #ef4444;
}

.add-row-btn {
  width: 100%;
  color: var(--accent);
  border-color: rgba(255, 143, 0, .35);
  background: rgba(255, 143, 0, .07);
  font-weight: 700;
}

.structured-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.structured-field {
  display: grid;
  gap: 6px;
}

.structured-field span,
.structured-check span {
  color: #5f6673;
  font-size: 12px;
}

.structured-field input,
.structured-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 9px 10px;
  color: var(--text);
  outline: 0;
}

.structured-field input,
.structured-field select {
  min-height: 38px;
}

.structured-field textarea {
  min-height: 92px;
  resize: vertical;
}

.structured-field-wide {
  grid-column: 1 / -1;
}

.structured-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 10px;
}

.structured-check input {
  width: 32px;
  height: 18px;
  order: 2;
  margin-left: auto;
}

#settingContactsEditor .structured-list,
#settingCryptoChannelsEditor .structured-list {
  gap: 8px;
}

#settingContactsEditor .structured-row,
#settingCryptoChannelsEditor .structured-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: end;
  gap: 10px 14px;
  border-radius: 10px;
  padding: 10px 12px;
}

#settingContactsEditor .structured-row-head,
#settingCryptoChannelsEditor .structured-row-head {
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  margin: 0;
}

#settingContactsEditor .structured-row-head button,
#settingCryptoChannelsEditor .structured-row-head button {
  min-height: 28px;
  padding: 0 10px;
}

#settingContactsEditor .structured-fields {
  grid-template-columns: minmax(180px, 280px) minmax(240px, 1fr);
}

#settingCryptoChannelsEditor .structured-fields {
  grid-template-columns: 120px 140px minmax(260px, 1fr) minmax(220px, 1fr);
}

#settingContactsEditor .structured-field,
#settingCryptoChannelsEditor .structured-field {
  gap: 5px;
}

#settingContactsEditor .add-row-btn,
#settingCryptoChannelsEditor .add-row-btn {
  min-height: 34px;
}

@media (max-width: 1380px) {
  .coupon-form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .settings-card[data-settings-panel="automation"] .mail-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .settings-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .coupon-form-grid,
  .settings-card[data-settings-panel="automation"] .mail-settings-grid {
    grid-template-columns: 1fr;
  }

  .structured-fields {
    grid-template-columns: 1fr;
  }

  #settingContactsEditor .structured-row,
  #settingCryptoChannelsEditor .structured-row {
    grid-template-columns: 1fr;
  }

  #settingContactsEditor .structured-fields,
  #settingCryptoChannelsEditor .structured-fields {
    grid-template-columns: 1fr;
  }
}

.empty-panel {
  min-height: 140px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.trumpet-product-toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.trumpet-product-toolbar input { flex: 1 1 190px; min-width: 0; }
.trumpet-product-table { overflow-x: auto; }
.trumpet-product-table table { min-width: 680px; }
.trumpet-mobile-meta { display: none; }
.trumpet-product-toolbar button, .trumpet-product-table button {
  appearance: none; font: inherit; border: 1px solid var(--line, #e5e7eb); border-radius: 6px;
  padding: 7px 10px; min-height: 34px; cursor: pointer;
}
.trumpet-product-toolbar button:not(.primary), .trumpet-product-table button { background: #fff; }
.trumpet-inventory-summary { min-height: 28px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.trumpet-product-modal { border-radius: 8px !important; }
dialog.modal.trumpet-product-modal { width: min(1100px, calc(100vw - 32px)); max-width: 1100px; max-height: calc(100vh - 32px); overflow: auto; box-sizing: border-box; }
.trumpet-package-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.trumpet-package-heading h3 { margin: 0; font-size: 16px; }
.trumpet-package-heading button, .trumpet-package-edit-row button { border: 1px solid #dce1e8; border-radius: 6px; background: #fff; color: #20242a; font: inherit; }
.trumpet-package-heading button { padding: 8px 12px; font-size: 13px; }
.trumpet-package-edit-row { display: grid; grid-template-columns: minmax(140px, 2fr) 70px 70px minmax(90px, 1fr) minmax(110px, 1fr) 60px 36px; gap: 8px; align-items: end; padding: 12px 0; border-bottom: 1px solid #e8ebf1; }
.trumpet-package-edit-row label { min-width: 0; font-size: 12px; }
.trumpet-package-edit-row input:not([type="checkbox"]), .trumpet-package-edit-row select { width: 100%; min-width: 0; box-sizing: border-box; }
.trumpet-package-edit-row button { width: 36px; height: 36px; padding: 0; }
@media (max-width: 760px) {
  .trumpet-package-edit-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trumpet-package-edit-row label:first-child { grid-column: 1 / -1; }
  .trumpet-package-edit-row button { justify-self: end; }
}
@media (max-width: 640px) {
  .trumpet-product-modal .product-edit-grid { grid-template-columns: minmax(0, 1fr); }
  .trumpet-product-toolbar input { flex-basis: 100%; }
  .trumpet-product-table table { min-width: 0; width: 100%; table-layout: fixed; }
  .trumpet-product-table th, .trumpet-product-table td { padding: 10px 6px; overflow-wrap: anywhere; }
  .trumpet-product-table th:nth-child(2), .trumpet-product-table td:nth-child(2),
  .trumpet-product-table th:nth-child(3), .trumpet-product-table td:nth-child(3),
  .trumpet-product-table th:nth-child(5), .trumpet-product-table td:nth-child(5) { display: none; }
  .trumpet-product-table th:first-child { width: 33%; }
  .trumpet-product-table th:nth-child(4) { width: 25%; }
  .trumpet-product-table th:nth-child(6) { width: 24%; }
  .trumpet-product-table th:last-child { width: 18%; }
  .trumpet-product-table button { padding: 6px; }
  .trumpet-mobile-meta { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; white-space: normal; }
}

.modal {
  width: min(480px, calc(100vw - 32px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .22);
}

.modal::backdrop {
  background: rgba(0, 0, 0, .42);
}

.modal form {
  padding: 20px;
}

.modal h2 {
  margin: 0 0 16px;
}

.modal-hint {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.user-edit-modal {
  width: min(680px, calc(100vw - 32px));
}

.manual-activation-modal {
  width: min(640px, calc(100vw - 32px));
}

.product-modal {
  width: min(720px, calc(100vw - 32px));
}

.product-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.product-edit-grid label {
  margin-bottom: 0;
}

.product-edit-wide {
  grid-column: 1 / -1;
}

.product-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
}

.product-check-grid .check-line {
  margin: 0;
}

.manual-activation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.manual-activation-grid label:nth-child(4),
.manual-activation-grid label:nth-child(5) {
  grid-column: 1 / -1;
}

.manual-activation-grid textarea {
  resize: vertical;
}

.user-edit-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafafa;
  padding: 14px;
  margin-bottom: 12px;
}

.user-edit-section h3 {
  margin: 0;
  font-size: 15px;
}

.user-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.user-edit-grid label {
  margin-bottom: 0;
}

.user-edit-wide {
  grid-column: 1 / -1;
}

@media (min-width: 1180px) {
  .user-edit-modal {
    width: 760px;
  }

  .user-edit-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-edit-wide {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .user-edit-grid {
    grid-template-columns: 1fr;
  }

  .product-edit-grid,
  .product-check-grid {
    grid-template-columns: 1fr;
  }

  .user-edit-wide {
    grid-column: auto;
  }

  .admin-coupon-dialog-grid {
    grid-template-columns: 1fr;
  }
}

.modal label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: #555c68;
  font-size: 13px;
}

.modal label.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.network-refund-form { width: min(440px, 100%); }
.network-refund-form p { overflow-wrap: anywhere; line-height: 1.6; }
.network-refund-form textarea { width: 100%; min-width: 0; resize: vertical; }
.network-refund-form .network-refund-confirm { display: flex; gap: 8px; align-items: flex-start; line-height: 1.6; }
.network-refund-confirm input { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; }
.network-refund-form .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

.modal label.check-line input {
  width: 32px;
  height: 18px;
  padding: 0;
  order: 2;
  margin-left: auto;
}

.switch-line input,
.coupon-form-grid .check-line input,
.mail-settings-grid .check-line input,
.structured-check input,
.modal label.check-line input,
.admin-coupon-dialog-grid .check-line input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 38px !important;
  height: 22px !important;
  border: 1px solid #cfd6df;
  border-radius: 999px;
  background: #eef1f5;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .08);
  transition: background .16s ease, border-color .16s ease;
}

.switch-line input::before,
.coupon-form-grid .check-line input::before,
.mail-settings-grid .check-line input::before,
.structured-check input::before,
.modal label.check-line input::before,
.admin-coupon-dialog-grid .check-line input::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, .24);
  transition: transform .16s ease;
}

.switch-line input:checked,
.coupon-form-grid .check-line input:checked,
.mail-settings-grid .check-line input:checked,
.structured-check input:checked,
.modal label.check-line input:checked,
.admin-coupon-dialog-grid .check-line input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.switch-line input:checked::before,
.coupon-form-grid .check-line input:checked::before,
.mail-settings-grid .check-line input:checked::before,
.structured-check input:checked::before,
.modal label.check-line input:checked::before,
.admin-coupon-dialog-grid .check-line input:checked::before {
  transform: translateX(16px);
}

.coupon-form-grid .check-line input,
.mail-settings-grid .check-line input,
.admin-coupon-dialog-grid .check-line input {
  order: 2;
  margin-left: auto;
}

.mini-badges {
  display: inline-flex;
  gap: 5px;
  margin-left: 6px;
  vertical-align: middle;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  border-radius: 999px;
  padding: 0 7px;
  font-size: 12px;
}

.mini-badge.red {
  background: #fff1f2;
  color: #e11d48;
}

.mini-badge.grey {
  background: #f1f5f9;
  color: #64748b;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.admin-action-dialog {
  width: min(430px, calc(100vw - 32px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: #111827;
  background: transparent;
  z-index: 9999;
}

.admin-action-dialog::backdrop {
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
}

.admin-action-sheet {
  display: grid;
  gap: 14px;
  border-radius: 18px;
  background: #fff;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.admin-action-sheet h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.admin-action-sheet p {
  margin: 0;
  color: #657080;
  line-height: 1.7;
}

.admin-action-input {
  width: 100%;
  height: 46px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0 14px;
  outline: 0;
  font-size: 15px;
}

.admin-action-input:focus {
  border-color: #ff9900;
  box-shadow: 0 0 0 3px rgba(255, 153, 0, .14);
}

.admin-action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.admin-action-buttons button {
  min-width: 92px;
  height: 40px;
  border-radius: 12px;
}

.admin-action-buttons .primary {
  border-color: #ff9900;
  background: #ff9900;
  color: #fff;
}

.admin-action-buttons .danger {
  border-color: #ef4444;
  background: #ef4444;
  color: #fff;
}

.admin-hidden {
  display: none !important;
}

.admin-section-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.admin-icon-add {
  min-width: 132px;
  height: 42px;
  border-radius: 999px;
}

.admin-coupon-dialog {
  width: min(560px, calc(100vw - 32px));
}

.admin-coupon-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-coupon-dialog-grid label {
  display: grid;
  gap: 7px;
  color: #4b5563;
  font-size: 13px;
}

.admin-coupon-dialog-grid input,
.admin-coupon-dialog-grid select {
  width: 100%;
  height: 44px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0 12px;
  outline: 0;
  background: #fff;
}

.admin-coupon-dialog-grid input:focus,
.admin-coupon-dialog-grid select:focus {
  border-color: #ff9900;
  box-shadow: 0 0 0 3px rgba(255, 153, 0, .14);
}

.admin-coupon-dialog-grid .check-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-coupon-dialog-grid .check-line input {
  width: 16px;
  height: 16px;
  padding: 0;
}

@media (max-width: 920px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .side-nav button {
    text-align: center;
    padding: 0 8px;
  }

  .stats-grid,
  .split,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 18px 14px;
  }

  .topbar {
    display: grid;
  }
}

/* Settings layout only; controls retain their existing order and identifiers. */
[data-panel="settings"] .settings-grid,
[data-panel="settings"] .settings-card,
[data-panel="settings"] label { min-width: 0; }

[data-panel="settings"] .settings-form-grid,
[data-panel="settings"] .admin-security-grid,
[data-panel="settings"] .mail-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px 16px;
}

[data-panel="settings"] input:not([type="checkbox"]),
[data-panel="settings"] select,
[data-panel="settings"] textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

[data-panel="settings"] input:not([type="checkbox"]),
[data-panel="settings"] select { height: 36px; }
[data-panel="settings"] .structured-field textarea { min-height: 96px; }
[data-panel="settings"] .admin-security-panel { margin: 0; }
[data-panel="settings"] .admin-security-check { min-height: 60px; }
[data-panel="settings"]:has([data-settings-tab="security"].active) #saveSiteConfig { display: none; }
[data-panel="settings"] .structured-row,
[data-panel="settings"] .switch-line,
[data-panel="settings"] .switch-row,
[data-panel="settings"] button { border-radius: 6px; }

#settingCryptoChannelsEditor .structured-fields {
  grid-template-columns: 80px 96px minmax(0, 1fr) minmax(0, 1fr);
}
#settingContactsEditor .structured-fields {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

@media (min-width: 1100px) {
  [data-panel="settings"].active {
    display: grid;
    grid-template-columns: 144px minmax(0, 1fr);
    align-items: start;
    gap: 16px 24px;
  }
  [data-panel="settings"] .settings-header {
    grid-column: 1 / -1;
    margin: 0;
    padding: 12px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  [data-panel="settings"] .settings-tabs {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  [data-panel="settings"] .settings-tabs button {
    text-align: left;
    min-height: 36px;
    font-weight: 500;
  }
  [data-panel="settings"] .settings-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    gap: 14px;
  }
  [data-panel="settings"] .settings-card-head { align-items: center; }
  #settingAnnouncementsEditor .structured-list,
  #settingFaqsEditor .structured-list,
  #settingTrumpetCountriesEditor .structured-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  #settingTrumpetCountriesEditor .structured-list {
    max-height: min(640px, 65vh);
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-gutter: stable;
  }
  #settingCryptoChannelsEditor .structured-row,
  #settingContactsEditor .structured-row {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 10px;
  }
}

@media (min-width: 641px) and (max-width: 1099px) {
  #settingCryptoChannelsEditor .structured-fields,
  #settingContactsEditor .structured-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  [data-panel="settings"] .settings-form-grid,
  [data-panel="settings"] .admin-security-grid,
  [data-panel="settings"] .mail-settings-grid,
  [data-panel="settings"] .structured-fields,
  #settingCryptoChannelsEditor .structured-fields,
  #settingContactsEditor .structured-fields { grid-template-columns: minmax(0, 1fr); }
  [data-panel="settings"] .settings-card-head { flex-wrap: wrap; }
  [data-panel="settings"] .settings-card-head span { text-align: left; }
}

/* Compact number settings without changing shared admin controls. */
[data-panel="settings"] [data-settings-panel="trumpet"] {
  width: 100%;
  max-width: 760px;
  box-sizing: border-box;
  gap: 10px;
}
[data-panel="settings"] [data-settings-panel="trumpet"] .settings-card-head { gap: 6px; }
[data-panel="settings"] [data-settings-panel="trumpet"] .settings-card-head h2 { font-size: 17px; }
[data-panel="settings"] [data-settings-panel="trumpet"] .settings-form-grid { gap: 8px 12px; }
[data-panel="settings"] [data-settings-panel="trumpet"] label { gap: 4px; margin-bottom: 0; font-size: 12px; }
[data-panel="settings"] [data-settings-panel="trumpet"] input:not([type="checkbox"]) { height: 32px; padding: 6px 8px; font-size: 13px; }
[data-panel="settings"] [data-settings-panel="trumpet"] .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 8px 10px; }
dialog.modal.trumpet-product-modal { width: min(920px, calc(100vw - 24px)); max-width: 920px; max-height: min(800px, calc(100dvh - 24px)); overflow: hidden; }
.trumpet-product-modal form { padding: 14px; display: flex; flex-direction: column; max-height: min(800px, calc(100dvh - 24px)); box-sizing: border-box; }
.trumpet-product-modal form > :not(#trumpetPackageEditor) { flex-shrink: 0; }
.trumpet-product-modal #trumpetPackageEditor { min-height: 0; overflow-y: auto; overflow-x: hidden; }
.trumpet-product-modal h2 { margin: 0 0 10px; font-size: 18px; }
.trumpet-product-modal .product-edit-grid { gap: 8px 10px; }
.trumpet-product-modal label { gap: 4px; margin-bottom: 0; font-size: 12px; }
.trumpet-product-modal input:not([type="checkbox"]), .trumpet-product-modal select { height: 32px; padding: 5px 7px; font-size: 13px; box-sizing: border-box; }
.trumpet-product-modal .trumpet-package-heading { margin: 12px 0 4px; }
.trumpet-product-modal .trumpet-package-heading h3 { font-size: 14px; }
.trumpet-product-modal .trumpet-package-heading button { padding: 6px 10px; }
.trumpet-product-modal .trumpet-package-edit-row { gap: 6px; padding: 8px 0; }
.trumpet-product-modal .trumpet-package-edit-row button { width: 30px; height: 32px; }
.trumpet-product-modal .trumpet-package-edit-row > small { font-size: 11px; line-height: 16px; overflow-wrap: anywhere; }
.trumpet-product-modal .modal-actions { margin: 10px -14px -14px; padding: 10px 14px; background: #fff; border-top: 1px solid var(--line); }
.trumpet-product-modal .modal-actions button { min-height: 34px; padding: 6px 14px; }
@media (min-width: 721px) {
  .trumpet-product-modal .product-edit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trumpet-product-modal .product-edit-wide { grid-column: span 2; }
  .trumpet-product-modal .trumpet-package-edit-row { grid-template-columns: minmax(130px, 1.8fr) 56px 64px minmax(74px, 1fr) minmax(96px, 1fr) 48px 30px; }
  .trumpet-product-modal .trumpet-package-edit-row label.check-line { flex-direction: column; align-items: flex-start; justify-content: space-between; min-height: 50px; white-space: nowrap; }
  .trumpet-product-modal .trumpet-package-edit-row label.check-line input { order: 1; margin: 0; }
}
@media (max-width: 720px) {
  .trumpet-product-modal .product-edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
