:root {
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  color: #172033;
  background: #f4f6fa;
}
* { box-sizing: border-box; }
body { margin: 0; }
header {
  min-height: 64px; padding: 0 5%; display: flex; align-items: center;
  justify-content: space-between; background: #152238; color: white;
}
.brand { font-weight: 700; font-size: 20px; }
nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
nav a, button.link { color: white; text-decoration: none; }
nav form { margin: 0; }
button.link { background: transparent; padding: 0; }
main { width: min(1180px, 92%); margin: 32px auto; }
h1 { margin-top: 0; }
.card {
  background: white; border-radius: 12px; padding: 22px;
  box-shadow: 0 4px 18px rgba(20, 35, 60, .06); margin-bottom: 22px;
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stats .card { display: flex; flex-direction: column; margin: 0; }
.stats b { font-size: 32px; color: #1768e5; }
.stats span { color: #687386; margin-top: 6px; }
.stats .warning b { color: #d97706; }
.finance-stats { grid-template-columns: repeat(3, 1fr); }
.finance-stats .profit b, .positive-profit { color: #18864b; font-weight: 700; }
.negative-profit { color: #bd2525; font-weight: 700; }
.grid-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #526074; font-size: 14px; }
input, select {
  width: 100%; padding: 10px 12px; border: 1px solid #d6dce7;
  border-radius: 7px; font: inherit; background: white;
}

/* Channel console compact reset */
.role-channel .channel-action-grid {
  grid-template-columns: minmax(440px, 1.25fr) minmax(340px, .75fr);
  align-items: start;
  gap: 12px;
}
.role-channel .channel-action-grid > article:nth-child(2) {
  order: 1;
  grid-row: auto;
}
.role-channel .channel-action-grid > article:nth-child(4) {
  order: 2;
}
.role-channel .channel-action-grid > article:nth-child(1) {
  order: 3;
}
.role-channel .channel-action-grid > article:nth-child(3) {
  order: 4;
  grid-column: 1 / -1;
}
.role-channel .channel-action-grid > .card {
  min-height: 0;
  display: block;
}
.role-channel .channel-action-grid .compact-section-title {
  min-height: 0;
  margin-bottom: 10px;
}
.role-channel .channel-order-form,
.role-channel .channel-wallet-topup-card,
.role-channel .channel-customer-form {
  gap: 8px;
}
.role-channel .channel-order-form label,
.role-channel .channel-wallet-topup-card label,
.role-channel .channel-customer-form label {
  font-size: 12px;
}
.role-channel .channel-order-form input,
.role-channel .channel-order-form select,
.role-channel .channel-wallet-topup-card input,
.role-channel .channel-wallet-topup-card select,
.role-channel .channel-customer-form input,
.role-channel .channel-customer-form select {
  min-height: 38px;
}
.role-channel .channel-order-summary {
  padding: 10px;
}
.role-channel .channel-order-summary strong {
  font-size: 24px;
}
.role-channel .channel-action-grid > article:nth-child(3) {
  padding: 12px 14px;
}
.role-channel .channel-action-grid > article:nth-child(3) .compact-section-title {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}
.role-channel .channel-action-grid > article:nth-child(3) .compact-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  margin-top: 8px;
  padding: 0;
}
.role-channel .channel-action-grid > article:nth-child(3) .compact-panel > summary {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
}
.role-channel .channel-action-grid > article:nth-child(3) .panel-content {
  padding: 10px 12px 12px;
}
.role-channel .channel-action-grid > article:nth-child(3) .channel-wallet-topup-card {
  grid-template-columns: minmax(260px, 1.5fr) minmax(120px, .5fr) auto;
  align-items: end;
}
.role-channel .channel-action-grid > article:nth-child(3) .channel-wallet-topup-card label:nth-of-type(2) {
  min-width: 120px;
}
.role-channel .channel-action-grid > article:nth-child(3) .channel-wallet-topup-card button {
  min-height: 38px;
}
.role-channel .channel-action-grid > article:nth-child(3) > .hint {
  margin: 8px 0 0;
}
.role-channel #sub-channels {
  padding: 14px;
}
.role-channel #sub-channels .compact-section-title {
  margin-bottom: 10px;
}
.role-channel #sub-channels .channel-sub-grid {
  grid-template-columns: minmax(360px, 680px);
  max-width: 720px;
  gap: 10px;
}
.role-channel #sub-channels .channel-sub-form {
  gap: 8px;
}
.role-channel #sub-channels .channel-sub-form .form-grid-2 {
  gap: 8px;
}
.role-channel #sub-channels .channel-sub-form input,
.role-channel #sub-channels .channel-sub-form button {
  min-height: 38px;
}
.role-channel #sub-channels .channel-sub-list {
  margin-top: 12px;
}
.role-channel #sub-channels .channel-sub-channel-fold {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
  overflow: hidden;
  background: #fff;
}
.role-channel #sub-channels .channel-sub-channel-fold summary {
  min-height: 58px;
  padding: 10px 12px 10px 42px;
  background: #f8fafc;
}
.role-channel #sub-channels .channel-sub-channel-fold summary::before {
  left: 12px;
}
.role-channel #sub-channels .channel-sub-body {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 10px 12px 12px;
  gap: 8px;
}
.role-channel #sub-channels .channel-sub-actions {
  grid-template-columns: minmax(260px, 420px) minmax(260px, 1fr);
  gap: 10px;
}
.role-channel #sub-channels .channel-sub-mini-form {
  grid-template-columns: minmax(110px, .45fr) minmax(140px, 1fr) auto;
}
.role-channel #sub-channels .channel-sub-price-panel {
  padding: 0;
}
.role-channel #sub-channels .channel-sub-price-panel > summary {
  padding: 8px 10px;
}
.role-channel #sub-channels .channel-sub-price-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 8px 10px 10px;
}
.role-channel #sub-channels .channel-sub-price-form button {
  grid-column: auto;
}
.role-channel .channel-people-grid {
  grid-template-columns: minmax(360px, .72fr) minmax(0, 1.28fr);
}
.role-channel .channel-people-grid > article:nth-child(2) {
  order: 0;
}
.role-channel .channel-price-list {
  max-height: 360px;
  overflow: auto;
}
.role-channel .channel-price-row {
  min-height: 56px;
  padding: 10px 12px;
}

.btn,
button,
input,
select,
textarea {
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease, transform .16s ease;
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(37, 99, 235, .12);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b8c7dc;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
  outline: none;
}

.routing-filter-grid {
  grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 1fr) minmax(160px, .6fr) auto auto;
  align-items: end;
}

.routing-rule summary {
  gap: 8px 12px;
}

.routing-rule summary span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
}

@media (max-width: 980px) {
  .role-channel .channel-action-grid,
  .role-channel .channel-portal-grid,
  .role-channel .channel-people-grid,
  .role-channel #sub-channels .channel-sub-actions,
  .role-channel #sub-channels .channel-sub-price-form,
  .routing-filter-grid {
    grid-template-columns: 1fr;
  }
  .role-channel #sub-channels .channel-sub-grid {
    max-width: none;
    grid-template-columns: 1fr;
  }
}

.system-error-page {
  min-height: min(620px, calc(100vh - 160px));
  display: grid;
  place-items: center;
}

.system-error-card {
  width: min(620px, 100%);
  background: #ffffff;
  border: 1px solid #dce4f0;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(20, 35, 60, 0.08);
  padding: 32px;
}

.system-error-code {
  display: inline-flex;
  min-width: 72px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eef4ff;
  color: #2563eb;
  font-weight: 800;
  margin-bottom: 18px;
}

.system-error-card h1 {
  margin: 0 0 10px;
  font-size: 30px;
}

.system-error-card p {
  margin: 0;
  color: #64748b;
  line-height: 1.7;
}

.system-error-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.system-error-meta {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #dce4f0;
  border-radius: 12px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
}

.system-error-type {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2563eb;
  font-weight: 800;
}

.system-error-type.permission {
  background: #fff7ed;
  color: #c2410c;
}

.system-error-type.xray,
.system-error-type.database,
.system-error-type.system {
  background: #fef2f2;
  color: #b91c1c;
}

.routing-control-card {
  margin-bottom: 16px;
}

.routing-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.routing-summary-grid div {
  min-height: 82px;
  padding: 16px;
  border: 1px solid #dce4f0;
  border-radius: 12px;
  background: #f8fafc;
}

.routing-summary-grid b {
  display: block;
  color: #2563eb;
  font-size: 26px;
  line-height: 1.1;
}

.routing-summary-grid span {
  display: block;
  margin-top: 8px;
  color: #64748b;
}

.routing-layers {
  display: grid;
  gap: 16px;
}

.routing-layer {
  border-left: 5px solid #2563eb;
}

.routing-layer-security {
  border-left-color: #f59e0b;
}

.routing-layer-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.routing-layer-head h2 {
  margin: 0 0 4px;
}

.routing-layer-head p {
  margin: 0;
  color: #64748b;
}

.routing-layer-head > span {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2563eb;
  font-weight: 800;
}

.routing-rule-list {
  display: grid;
  gap: 8px;
}

.routing-rule {
  border: 1px solid #dce4f0;
  border-radius: 12px;
  background: #fff;
}

.routing-rule summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
}

.routing-rule summary span {
  color: #475569;
}

.routing-rule pre {
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-top: 1px solid #dce4f0;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .system-error-card {
    padding: 22px;
  }

  .system-error-card h1 {
    font-size: 24px;
  }

  .system-error-actions .btn,
  .system-error-actions a {
    width: 100%;
    justify-content: center;
  }

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

  .routing-layer-head {
    flex-direction: column;
  }
}

@media (max-width: 360px) {
  .system-error-page {
    min-height: calc(100vh - 96px);
  }

  .system-error-card {
    padding: 18px;
    border-radius: 12px;
  }

  .routing-summary-grid {
    grid-template-columns: 1fr;
  }
}
.select-filter-input {
  margin-bottom: 8px;
  background: #f8fbff;
}
textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d6dce7;
  border-radius: 7px; font: inherit; resize: vertical;
}
button {
  border: 0; border-radius: 7px; padding: 11px 16px; cursor: pointer;
  background: #1768e5; color: white; font: inherit; white-space: nowrap;
}
button.secondary { background: #526074; }
button.danger { background: #bd2525; }
.button-link {
  display: inline-block; border-radius: 7px; padding: 11px 16px;
  background: #526074; color: white; text-decoration: none; white-space: nowrap;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid #edf0f5; text-align: left; }
th { color: #687386; font-size: 13px; }
.renew-form { display: flex; gap: 7px; }
.renew-form input { width: 85px; }
.flash { padding: 13px 16px; border-radius: 8px; margin-bottom: 18px; }
.flash.success { background: #e8f8ef; color: #176b3a; }
.flash.error { background: #fdecec; color: #a32929; }
.login { width: min(420px, 100%); margin: 80px auto; }
.title-row, .reminder, .actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.reminder pre { white-space: pre-wrap; background: #f5f7fb; padding: 14px; border-radius: 8px; }
.renewal-card {
  align-items: stretch; border-left: 5px solid #94a3b8;
}

.channel-delivery-row {
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
}
.channel-delivery-actions {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
}
.channel-delivery-actions strong {
  width: 100%;
  text-align: right;
}
.inline-mini-form {
  display: inline-flex !important;
  margin: 0;
}
.inline-mini-form button {
  padding: 7px 10px;
  min-height: 34px;
  font-size: 13px;
}

@media (max-width: 500px) {
  .channel-delivery-row {
    grid-template-columns: 1fr;
  }
  .channel-delivery-actions {
    justify-content: flex-start;
  }
  .channel-delivery-actions strong {
    width: auto;
    text-align: left;
  }
}

.public-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}
.public-link-row input {
  min-width: 0;
}
.public-delivery-page {
  background: #f3f6fb;
  color: var(--text);
}
.public-delivery-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 28px auto;
}
.public-delivery-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.public-delivery-hero h1 {
  margin: 0;
  font-size: 32px;
}
.public-delivery-hero p {
  margin: 8px 0 0;
  color: var(--muted);
}
.public-delivery-grid {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(0, 1.15fr);
  gap: 16px;
}
.public-qr-card,
.public-delivery-info,
.public-unavailable-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.public-qr-card {
  display: grid;
  justify-items: center;
  gap: 16px;
}
.public-info-row {
  display: grid;
  gap: 5px;
  padding: 14px 0;
  border-bottom: 1px solid #edf0f5;
}
.public-info-row:first-child {
  padding-top: 0;
}
.public-info-row span,
.public-info-row small {
  color: var(--muted);
}
.public-info-row b {
  font-size: 20px;
}
.public-delivery-message {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}
.public-delivery-message p,
.public-unavailable-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 720px) {
  .public-delivery-shell {
    width: min(100% - 20px, 520px);
    margin: 14px auto;
  }
  .public-delivery-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .public-delivery-hero h1 {
    font-size: 26px;
  }
  .public-delivery-grid,
  .public-link-row {
    grid-template-columns: 1fr;
  }
}

/* Customer self-service portal */
.customer-auth-page,
.customer-portal-page {
  min-height: 100vh;
  margin: 0;
  background: #f3f6fb;
  color: #111827;
}
.customer-auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.customer-auth-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid #dfe7f3;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .10);
}
.customer-auth-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}
.customer-auth-brand span,
.customer-portal-mark {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  font-weight: 900;
}
.customer-auth-brand h1 {
  margin: 0 0 4px;
}
.customer-auth-brand p,
.customer-auth-help {
  color: #64748b;
}
.customer-auth-form {
  display: grid;
  gap: 14px;
}
.customer-auth-help {
  display: inline-flex;
  margin-top: 18px;
  text-decoration: none;
  font-weight: 700;
}
.customer-portal-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid #e5ecf6;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}
.customer-portal-topbar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.customer-portal-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.customer-portal-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 18px 42px;
}
.customer-portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 24px;
  border: 1px solid #dfe7f3;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}
.customer-portal-hero h1 {
  margin: 4px 0 6px;
}
.customer-portal-hero p {
  margin: 0;
  color: #64748b;
}
.customer-portal-balance {
  min-width: 170px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.customer-portal-balance span,
.customer-portal-stats span,
.customer-line-grid span,
.customer-mini-list span {
  display: block;
  color: #64748b;
}
.customer-portal-balance b {
  display: block;
  margin-top: 4px;
  color: #15803d;
  font-size: 28px;
}
.customer-topup-request-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}
.customer-topup-request-form input,
.customer-topup-request-form button {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 13px;
}
.customer-topup-request-form button {
  background: #2563eb;
  color: #fff;
}
.customer-portal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0;
}
.customer-portal-stats div,
.customer-portal-section {
  border: 1px solid #dfe7f3;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}
.customer-portal-stats div {
  padding: 16px;
}
.customer-portal-stats b {
  display: block;
  font-size: 26px;
  color: #2563eb;
}
.customer-renewal-alerts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -2px 0 14px;
}
.customer-renewal-alert {
  padding: 12px 14px;
  border: 1px solid #dfe7f3;
  border-left: 4px solid #2563eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
}
.customer-renewal-alert b,
.customer-renewal-alert span {
  display: block;
}
.customer-renewal-alert b {
  color: #0f172a;
}
.customer-renewal-alert span {
  margin-top: 2px;
  color: #64748b;
  font-size: 13px;
}
.customer-renewal-alert.urgent { border-left-color: #f59e0b; background: #fffbeb; }
.customer-renewal-alert.overdue { border-left-color: #dc2626; background: #fff7f7; }
.customer-renewal-alert.soon { border-left-color: #2563eb; background: #f8fbff; }
.customer-portal-section {
  padding: 18px;
  margin-bottom: 14px;
}
.customer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.customer-section-head h2 {
  margin: 0 0 4px;
}
.customer-section-head p {
  margin: 0;
  color: #64748b;
}
.customer-line-list {
  display: grid;
  gap: 12px;
}
.customer-line-card {
  padding: 16px;
  border: 1px solid #dfe7f3;
  border-radius: 10px;
  background: #fbfdff;
}
.customer-line-card.is-unavailable {
  opacity: .78;
}
.customer-line-card.is-renewal-due {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffaf0, #fbfdff 55%);
}
.customer-line-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.customer-line-main h3 {
  margin: 0 0 4px;
  font-size: 22px;
}
.customer-line-main p {
  margin: 0;
  color: #64748b;
  overflow-wrap: anywhere;
}
.customer-line-pills {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.customer-line-renewal-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 900;
  white-space: nowrap;
}
.customer-line-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.customer-line-grid > div {
  min-width: 0;
  padding: 11px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e5ecf6;
}
.customer-line-grid b {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.customer-line-delivery {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5ecf6;
}
.customer-line-delivery img {
  width: 180px;
  height: 180px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}
.customer-line-delivery > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.customer-renew-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5ecf6;
}
.customer-renew-form label {
  margin: 0;
}
.customer-renew-form select {
  font-weight: 800;
}
.customer-renew-form button {
  white-space: nowrap;
}
.customer-renew-form.is-attention {
  padding: 12px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffdf5;
}
.customer-renew-balance-hint {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}
.customer-line-warning {
  margin: 12px 0 0;
  color: #b91c1c;
}
.customer-portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.customer-mini-list {
  display: grid;
  gap: 9px;
}
.customer-mini-list > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
}
.customer-mini-list b,
.customer-mini-list span {
  overflow-wrap: anywhere;
}
.customer-account-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}
.checkbox-line input {
  width: auto;
  min-height: 0;
}

@media (max-width: 800px) {
  .customer-portal-hero,
  .customer-portal-grid,
  .customer-line-delivery {
    grid-template-columns: 1fr;
  }
  .customer-portal-stats,
  .customer-renewal-alerts,
  .customer-line-grid {
    grid-template-columns: 1fr 1fr;
  }
  .customer-line-delivery img {
    margin: 0 auto;
  }
  .customer-account-form {
    grid-template-columns: 1fr;
  }
  .customer-renew-form {
    grid-template-columns: 1fr;
  }
  .customer-topup-request-form {
    max-width: none;
  }
}

/* Channel child management: tighter, aligned cards */
#sub-channels {
  display: grid;
  gap: 14px;
}
#sub-channels .compact-section-title {
  margin-bottom: 0;
}
#sub-channels .channel-sub-grid {
  grid-template-columns: minmax(420px, 760px) minmax(280px, 1fr);
  gap: 12px;
  margin-top: 0;
}
#sub-channels .channel-sub-grid > .compact-panel:only-child {
  grid-column: 1 / -1;
  max-width: 760px;
}
#sub-channels .compact-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
#sub-channels .compact-panel > summary {
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}
#sub-channels .channel-sub-form {
  padding: 0 14px 14px;
}
#sub-channels .channel-sub-form .form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
#sub-channels .channel-sub-form input,
#sub-channels .channel-sub-form button {
  min-height: 36px;
}
#sub-channels .channel-sub-form label {
  min-width: 0;
}
#sub-channels .channel-inline-check {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
#sub-channels .channel-sub-list {
  display: grid;
  gap: 10px;
  margin-top: 0;
  border-top: 0;
}
#sub-channels .channel-sub-channel-fold {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}
#sub-channels .channel-sub-channel-fold summary {
  min-height: 62px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
  gap: 14px;
}
#sub-channels .channel-sub-channel-fold .channel-fold-main {
  padding-left: 28px;
}
#sub-channels .channel-sub-channel-fold .channel-fold-main b {
  font-size: 16px;
}
#sub-channels .channel-sub-channel-fold .channel-fold-side {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 10px;
  justify-items: end;
  align-items: center;
}
#sub-channels .channel-sub-channel-fold .channel-fold-side strong {
  font-size: 18px;
  color: #0f766e;
}
#sub-channels .channel-sub-channel-fold .channel-fold-side span {
  grid-column: 1 / -1;
  font-size: 12px;
}
#sub-channels .channel-sub-body {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px 14px 42px;
  border-top: 1px solid var(--border);
  background: #fff;
}
#sub-channels .channel-fold-meta {
  padding: 9px 10px;
  border: 1px solid #e5edf7;
  border-radius: 8px;
  background: #f8fafc;
}
#sub-channels .channel-fold-meta span {
  margin-bottom: 2px;
}
#sub-channels .channel-fold-meta b {
  font-size: 14px;
}
#sub-channels .channel-sub-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(260px, .78fr) minmax(300px, 1.22fr);
  gap: 10px;
  align-items: start;
  margin-top: 2px;
}
#sub-channels .channel-sub-mini-form {
  grid-template-columns: minmax(100px, .45fr) minmax(120px, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}
#sub-channels .channel-sub-mini-form input,
#sub-channels .channel-sub-mini-form button {
  min-height: 34px;
}
#sub-channels .channel-sub-price-panel {
  min-height: 56px;
  padding: 0;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}
#sub-channels .channel-sub-price-panel > summary {
  min-height: 54px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
}
#sub-channels .channel-sub-price-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 10px 10px;
}
#sub-channels + .card .channel-price-list {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}
#sub-channels + .card .channel-price-row {
  grid-template-columns: minmax(0, 1fr) minmax(210px, auto);
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 8px;
}
#sub-channels + .card .channel-price-row > div:last-child {
  text-align: right;
}
#sub-channels + .card .channel-price-row strong {
  color: #0f766e;
  font-size: 16px;
}

@media (max-width: 1100px) {
  #sub-channels .channel-sub-grid,
  #sub-channels .channel-sub-actions {
    grid-template-columns: 1fr;
  }
  #sub-channels .channel-sub-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  #sub-channels .channel-sub-grid,
  #sub-channels .channel-sub-form .form-grid-2,
  #sub-channels .channel-sub-body,
  #sub-channels .channel-sub-price-form,
  #sub-channels .channel-sub-mini-form,
  #sub-channels + .card .channel-price-row {
    grid-template-columns: 1fr;
  }
  #sub-channels .channel-sub-channel-fold summary {
    grid-template-columns: 1fr;
  }
  #sub-channels .channel-sub-channel-fold .channel-fold-side {
    justify-items: start;
  }
  #sub-channels + .card .channel-price-row > div:last-child {
    text-align: left;
  }
}

.delivery-center-stats .card {
  text-decoration: none;
}
.delivery-center-stats .active-stat {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, .18), 0 10px 22px rgba(37, 99, 235, .12);
}
.delivery-center-list {
  display: grid;
  gap: 12px;
}
.delivery-task-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}
.delivery-task-main {
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr);
  gap: 14px;
  align-items: start;
}
.delivery-task-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 18px;
}
.delivery-task-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.delivery-task-meta div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 10px;
}
.delivery-task-meta span {
  display: block;
  color: #64748b;
  font-size: 12px;
  margin-bottom: 3px;
}
.delivery-task-meta b {
  display: block;
  word-break: break-all;
  font-size: 14px;
}
.delivery-message-details {
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
}
.delivery-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.delivery-task-actions form {
  margin: 0;
}
.delivery-task-actions button,
.delivery-task-actions .button-link {
  min-height: 36px;
  padding: 8px 12px;
}

@media (max-width: 980px) {
  .delivery-task-main,
  .delivery-task-meta {
    grid-template-columns: 1fr;
  }
}

.danger-inline {
  display: inline-block;
  position: relative;
}

.danger-inline summary {
  cursor: pointer;
  list-style: none;
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: #b91c1c;
  border-radius: 7px;
  padding: 8px 12px;
  font-weight: 800;
  white-space: nowrap;
}

.danger-inline summary::-webkit-details-marker {
  display: none;
}

.danger-inline[open] summary {
  border-color: #ef4444;
  background: #fee2e2;
}

.danger-inline form {
  display: grid;
  gap: 8px;
  min-width: 220px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #fecaca;
  background: #fffafa;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.danger-inline input {
  min-height: 38px;
  border: 1px solid #fca5a5;
  border-radius: 7px;
  padding: 0 10px;
}

.template-token-grid {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 8px 14px;
  align-items: center;
}

.template-token-grid code {
  background: #eef4ff;
  color: #1d4ed8;
  border-radius: 7px;
  padding: 8px 10px;
  font-weight: 800;
}

.template-token-grid span {
  color: #64748b;
  overflow-wrap: anywhere;
}

.copy-template-form {
  display: grid;
  gap: 14px;
}

.copy-template-card {
  display: grid;
  gap: 14px;
}

.copy-template-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.copy-template-head p {
  margin: 4px 0 0;
  color: #64748b;
}

.copy-template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.copy-template-grid label {
  display: grid;
  gap: 8px;
  color: #475569;
  font-weight: 800;
}

.copy-template-grid textarea,
.template-default textarea {
  width: 100%;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.template-default {
  margin-top: 10px;
}

.template-default summary {
  cursor: pointer;
  color: #2563eb;
  font-weight: 800;
}

.sticky-actions {
  position: sticky;
  bottom: 14px;
  display: flex;
  justify-content: flex-end;
  padding: 12px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  backdrop-filter: blur(8px);
}

@media (max-width: 900px) {
  .template-token-grid,
  .copy-template-grid {
    grid-template-columns: 1fr;
  }

  .copy-template-head {
    display: grid;
  }
}

@media (max-width: 520px) {
  .customer-auth-shell {
    padding: 14px;
  }
  .customer-auth-card,
  .customer-portal-hero,
  .customer-portal-section {
    padding: 16px;
    border-radius: 10px;
  }
  .customer-portal-shell {
    padding: 14px 10px 30px;
  }
  .customer-portal-stats {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }
  .customer-renewal-alerts {
    grid-template-columns: 1fr;
  }
  .customer-portal-stats div {
    padding: 11px;
  }
  .customer-portal-stats b {
    font-size: 22px;
  }
  .customer-section-head,
  .customer-line-main,
  .customer-mini-list > div {
    flex-direction: column;
    align-items: stretch;
  }
  .customer-line-grid {
    grid-template-columns: 1fr;
  }
  .customer-line-main h3 {
    font-size: 20px;
  }
  .customer-line-delivery > div .button-link {
    width: 100%;
  }
  .customer-renew-form button {
    width: 100%;
  }
}
.renewal-card.due-today { border-left-color: #d97706; background: #fffdf7; }
.renewal-card.overdue { border-left-color: #bd2525; background: #fff8f8; }
.renewal-card.upcoming { border-left-color: #1768e5; }
.renewal-main { flex: 1; min-width: 0; }
.renewal-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.renewal-heading h2 { margin: 0 0 6px; font-size: 20px; }
.renewal-heading p { margin: 0; color: var(--muted); }
.renewal-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 92px; padding: 7px 10px; border-radius: 999px;
  background: #eef2ff; color: #1d4ed8; font-weight: 700; white-space: nowrap;
}
.overdue .renewal-badge { background: #fee2e2; color: #b91c1c; }
.due-today .renewal-badge { background: #ffedd5; color: #b45309; }
.renewal-meta-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.renewal-meta-grid div {
  display: grid; gap: 5px; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 9px; background: white; min-width: 0;
}
.renewal-meta-grid span { color: var(--muted); font-size: 12px; }
.renewal-meta-grid b { overflow-wrap: anywhere; font-size: 14px; }
.renewal-copy-box {
  border: 1px solid var(--border); border-radius: 10px; background: #f8fafc;
  padding: 14px;
}
.renewal-copy-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.renewal-copy-text {
  min-height: 190px; background: white; line-height: 1.7; color: #172033;
}
.actions form { margin: 0; }
.search-form { display: flex; gap: 10px; align-items: center; }
.search-form input { max-width: 440px; }
.search-form a { color: #1768e5; }
.copy-source {
  position: fixed; left: -9999px; top: 0; width: 1px; height: 1px;
}
.copy-button.copied { background: #18864b; }
.admin-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.admin-tool-card {
  display: grid;
  gap: 16px;
  align-content: start;
}
.admin-tool-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
}
.admin-tool-card p {
  margin: 0;
  color: var(--muted);
}
.admin-tool-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.admin-tool-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef4ff;
  color: #1d5fd7;
  font-weight: 800;
  text-decoration: none;
}
.admin-tool-links a:hover {
  background: #dceafe;
}
@media (max-width: 900px) {
  .admin-tool-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .admin-tool-links {
    grid-template-columns: 1fr;
  }
}
.check-label { display: flex; align-items: center; gap: 8px; padding-bottom: 11px; }
.check-label input { width: auto; }
.table-actions { display: flex; gap: 8px; }
.table-actions form { margin: 0; }
.bulk-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.service-probe-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  border: 1px solid #dbe7fb; background: #f8fbff;
}
.service-probe-panel h2 { margin: 0 0 6px; font-size: 20px; }
.service-probe-panel p { margin: 0; line-height: 1.6; }
.service-probe-form { margin: 0; flex: 0 0 auto; }
.service-table-actions { justify-content: flex-end; }
.probe-status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 999px;
  background: #f1f5f9; color: #64748b; font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.probe-status i {
  width: 9px; height: 9px; border-radius: 999px;
  background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, .16);
}
.probe-ok {
  background: #ecfdf3; color: #166534;
}
.probe-ok i {
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
}
.probe-failed {
  background: #fef2f2; color: #991b1b;
}
.probe-failed i {
  background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
}
.delivery-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}
.delivery-pill.ok { background: #dcfce7; color: #166534; }
.delivery-pill.pending { background: #eff6ff; color: #1d4ed8; }
.delivery-pill.failed { background: #fee2e2; color: #991b1b; }
.delivery-pill.muted { background: #f1f5f9; color: #64748b; }
.delivery-error {
  margin-top: 6px;
  max-width: 260px;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.bulk-edit-panel {
  margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 9px; background: #f8fafc;
}
.bulk-edit-panel summary { cursor: pointer; font-weight: 700; }
.bulk-edit-grid {
  display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px; align-items: end; margin-top: 12px;
}
.bulk-edit-field { display: grid; gap: 6px; }
.bulk-edit-field > span { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bulk-edit-field > span input { width: auto; }
.bulk-edit-field small { color: var(--muted); }
.bulk-renew-grid {
  display: grid; grid-template-columns: 180px minmax(240px, 1fr) auto auto;
  gap: 10px; align-items: end; margin-top: 12px;
}
.sync-warning-card { border-color: #f5b942; background: #fffaf0; }
.sync-warning-card b { color: #b45309; }
.pending-sync-card summary { cursor: pointer; font-size: 18px; font-weight: 700; }
.pending-sync-card .hint { margin: 10px 0 14px; }
.pending-sync-row { background: #fffaf0; }
.table-scroll { overflow-x: auto; }
.hint { color: #687386; }
.customer-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  flex: 0 0 44px; background: #e6ebf3;
}
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  color: white; background: #1768e5; font-weight: 700;
}
.line-summary { max-width: 320px; white-space: normal; }
.template-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.template-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px;
  border-radius: 999px; background: #edf3ff; color: #22559a;
}
.template-chip form { margin: 0; display: inline; }
.chip-delete { background: transparent; color: #bd2525; padding: 0 3px; font-size: 18px; }
.delivery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.delivery-card {
  background: white; border-radius: 12px; padding: 20px;
  box-shadow: 0 4px 18px rgba(20, 35, 60, .06);
}
.delivery-header, .delivery-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.delivery-body { display: grid; grid-template-columns: 170px 1fr; gap: 18px; margin: 18px 0; }
.qr-image { width: 170px; height: 170px; object-fit: contain; border: 1px solid #edf0f5; }
.service-details { margin: 0; display: grid; gap: 7px; }
.service-details div { display: grid; grid-template-columns: 82px 1fr; gap: 8px; }
.service-details dt { color: #687386; }
.service-details dd { margin: 0; word-break: break-all; }
.status-badge { padding: 5px 9px; border-radius: 999px; background: #e8f8ef; color: #176b3a; }
.delivery-package-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin-bottom: 22px; padding: 24px; border-radius: 14px;
  background: linear-gradient(135deg, #f8fbff, #eef5ff);
  border: 1px solid #dbe8ff; box-shadow: 0 10px 30px rgba(23, 104, 229, .08);
}
.delivery-package-hero h1 { margin: 2px 0 8px; }
.delivery-package-hero p { margin: 0; color: #617086; }
.delivery-package-list { display: grid; gap: 18px; }
.delivery-package-card {
  background: white; border: 1px solid #e5eaf3; border-radius: 14px;
  padding: 22px; box-shadow: 0 8px 24px rgba(20,35,60,.06);
}
.delivery-package-title {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.delivery-package-title h2 { margin: 0 0 6px; }
.delivery-package-title p { margin: 0; color: #617086; }
.delivery-state-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 10px;
}
.delivery-card-actions {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
  flex: 0 0 auto;
}
.delivery-card-actions form { margin: 0; }
.delivery-card-actions button { min-height: 36px; padding: 8px 12px; }
.delivery-package-body {
  display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px;
  align-items: stretch;
}
.delivery-qr-panel {
  display: grid; justify-items: center; align-content: start; gap: 12px;
  padding: 18px; border-radius: 12px; background: #f8fafc; border: 1px solid #edf1f7;
}
.package-copy-panel { margin: 0; }
.delivery-code-details {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid #edf1f7;
}
.delivery-code-details summary { cursor: pointer; color: #526074; font-weight: 700; }
.delivery-node-code { margin: 12px 0; min-height: 78px; font-size: 13px; }
.delivery-meta-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  margin-top: 12px;
}
.delivery-meta-grid div {
  display: grid; gap: 5px; padding: 12px; background: #f8fafc;
  border: 1px solid #edf1f7; border-radius: 10px;
}
.delivery-meta-grid span { color: #687386; font-size: 13px; }
.delivery-meta-grid b { word-break: break-all; }
.renew-days-form { display: flex; align-items: end; gap: 8px; }
.renew-days-form input { width: 110px; }
.status-healthy { color: #18864b; }
.status-failed { color: #bd2525; }
.status-unknown { color: #687386; }
.status-asset { color: #526074; }
.status-protected { color: #7c3aed; font-weight: 700; }
.empty { text-align: center; color: #687386; padding: 50px; }
.compact-panel summary { cursor: pointer; font-size: 18px; font-weight: 700; }
.panel-content { margin-top: 18px; }
.service-filters {
  display: grid; grid-template-columns: 2fr repeat(4, 1fr) auto auto;
  gap: 10px; align-items: end;
}
.subscription-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.subscription-filters {
  display: grid; grid-template-columns: 2fr repeat(4, minmax(130px, 1fr)) auto auto;
  gap: 10px; align-items: end;
}
.order-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wallet-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.order-filters {
  display: grid; grid-template-columns: 2fr repeat(6, minmax(120px, 1fr)) auto auto;
  gap: 10px; align-items: end;
}
.channel-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.channel-filters {
  display: grid; grid-template-columns: 2fr 1fr auto auto;
  gap: 10px; align-items: end;
}
.channel-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px; align-items: end;
}
.channel-list { display: grid; gap: 14px; }
.channel-card { display: grid; gap: 14px; }
.channel-card-main {
  display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr);
  gap: 18px; align-items: center;
}
.channel-card h2 { margin: 0 0 6px; }
.channel-card p { margin: 0; color: var(--muted); }
.channel-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
}
.channel-metrics div {
  padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc;
}
.channel-metrics span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.channel-metrics b { overflow-wrap: anywhere; }
.channel-edit-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; align-items: end;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 700;
}
.checkbox-label input {
  width: 18px;
  height: 18px;
}
.channel-price-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}
.channel-price-panel summary { cursor: pointer; font-weight: 700; color: var(--text); }
.channel-bulk-price-panel {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.channel-bulk-price-panel summary { color: #1768e5; }
.channel-country-price-form {
  display: grid;
  grid-template-columns: 160px 180px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}
.channel-country-price-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}
.channel-country-price-head b {
  color: var(--text);
}
.channel-country-price-notes {
  min-width: 220px;
}
.channel-duration-price-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
}
.channel-duration-price-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.channel-duration-price-card strong {
  color: var(--primary);
}
.channel-duration-price-card label {
  font-size: 12px;
}
.channel-bulk-price-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}
.channel-plan-picker {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}
.channel-plan-checklist {
  max-height: 220px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
.channel-plan-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
  line-height: 1.35;
}
.channel-plan-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.channel-plan-option span {
  min-width: 0;
}
.channel-sub-product-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.channel-sub-product-title,
.channel-sub-product-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, auto);
  gap: 12px;
  align-items: center;
}
.channel-sub-product-title {
  color: var(--muted);
  font-size: 13px;
}
.channel-sub-product-row {
  padding: 8px 10px;
  border: 1px solid #edf1f5;
  border-radius: 7px;
  background: #f8fafc;
}
.channel-sub-product-row b,
.channel-sub-product-row strong {
  display: block;
  color: var(--text);
}
.channel-sub-product-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.channel-wallet-form {
  display: grid;
  grid-template-columns: minmax(140px, .7fr) minmax(130px, .6fr) minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}
.channel-wallet-ledger {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.channel-wallet-ledger > div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.channel-wallet-ledger b { color: #1768e5; }
.channel-wallet-ledger span,
.channel-wallet-ledger small { color: var(--muted); overflow-wrap: anywhere; }
.channel-price-form {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(130px, .8fr) minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}
.channel-price-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.channel-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(120px, .5fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.channel-price-row b,
.channel-price-row strong { display: block; }
.channel-price-row span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
button.danger-light {
  background: #fff1f2;
  color: #b42318;
  border: 1px solid #fecdd3;
  box-shadow: none;
}
button.danger-light:hover { background: #ffe4e6; }
.channel-actions, .inline-select-form {
  display: flex; gap: 10px; align-items: end; flex-wrap: wrap;
}
.inline-select-form select { min-width: 220px; }
.channel-assignment-card {
  display: flex; align-items: end; justify-content: space-between; gap: 16px;
}
.channel-assignment-card h2 { margin: 0 0 6px; }
.channel-assignment-card p { margin: 0; color: var(--muted); }
.wallet-form {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 2fr auto;
  gap: 10px; align-items: end;
}
.wallet-action-card h2 { margin-top: 0; }
.wallet-filters {
  display: grid; grid-template-columns: 2fr 1fr auto auto;
  gap: 10px; align-items: end;
}
.plan-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.plan-rule-card {
  border-left: 5px solid var(--primary); background: #f8fbff;
}
.plan-rule-card h2 { margin: 0 0 7px; }
.plan-rule-card p { margin: 0; color: var(--muted); line-height: 1.7; }
.plan-form {
  display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px; align-items: end;
}
.plan-filters {
  display: grid; grid-template-columns: 2fr 1fr 1fr auto auto;
  gap: 10px; align-items: end;
}
.purchase-flow-card { display: grid; gap: 18px; }
.purchase-steps {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.purchase-steps span {
  padding: 10px 12px; border-radius: 8px; background: #eff6ff;
  color: #1d4ed8; font-weight: 800; text-align: center;
}
.purchase-order-form {
  display: grid; grid-template-columns: minmax(260px, 1fr);
  gap: 18px;
}
.inline-create-customer {
  border: 1px dashed #cbd5e1; border-radius: 8px; padding: 10px 12px;
  background: #f8fafc;
}
.inline-create-customer summary {
  cursor: pointer; color: #1d4ed8; font-weight: 800;
}
.inline-create-grid {
  display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px; margin-top: 12px;
}
.purchase-section h2 { margin: 0 0 10px; font-size: 18px; }
.country-choice-groups { display: grid; gap: 16px; }
.country-group h3 {
  margin: 0 0 9px; padding-left: 10px; border-left: 4px solid #2563eb;
  font-size: 16px;
}
.choice-grid {
  display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}
.choice-button {
  min-height: 48px; border: 1px solid var(--border); background: #f8fafc;
  color: var(--text); box-shadow: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.choice-button input { width: 18px; height: 18px; margin: 0; }
.choice-button span { font-weight: 800; }
.choice-button:has(input:checked), .choice-button.active {
  background: #2563eb; color: #fff; border-color: #2563eb;
}
.choice-button:disabled { opacity: .45; cursor: not-allowed; }
.duration-select, .country-select { max-width: 520px; }
.empty-inline {
  color: var(--muted); padding: 12px; border: 1px dashed var(--border);
  border-radius: 8px; background: #f8fafc;
}
.purchase-summary {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .45fr);
  gap: 14px; padding: 16px; border: 1px solid #dbe7f7; border-radius: 8px;
  background: #f8fbff;
}
.purchase-summary span,
.purchase-summary small { display: block; color: var(--muted); }
.purchase-summary b { display: block; margin: 5px 0; font-size: 18px; }
.purchase-price { color: #15803d; font-size: 28px !important; }
.purchase-plan-details summary {
  cursor: pointer; font-weight: 800; color: var(--primary); margin-bottom: 12px;
}
.plan-table-card { padding: 12px 18px; }
.plan-table td { vertical-align: top; }
.plan-table td:nth-child(1) { min-width: 220px; }
.plan-table td:nth-child(5) { min-width: 160px; }
.plan-actions { min-width: 220px; }
.inline-plan-editor { margin-bottom: 8px; }
.inline-plan-editor summary {
  cursor: pointer; color: var(--primary); font-weight: 700; margin-bottom: 8px;
}
.plan-edit-form {
  display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; background: #f8fafc;
}
.plan-edit-form button { grid-column: span 2; }
.subscription-table-card { padding: 12px 18px; }
.order-table-card { padding: 12px 18px; }
.wallet-table-card { padding: 12px 18px; }
.subscription-table td { vertical-align: top; }
.order-table td { vertical-align: top; }
.wallet-table td { vertical-align: top; }
.subscription-table td:nth-child(2) { min-width: 210px; }
.subscription-table td:nth-child(5) { min-width: 210px; }
.order-table td:nth-child(1) { min-width: 180px; }
.order-table td:nth-child(3) { min-width: 240px; }
.wallet-table td:nth-child(1) { min-width: 180px; }
.wallet-table td:nth-child(3) { min-width: 220px; }
.subscription-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 6px; }
.subscription-meta span:not(.subscription-status) { color: var(--muted); font-size: 12px; }
.subscription-status {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 24px; padding: 4px 8px; border-radius: 999px;
  background: #eef2f7; color: #475569; font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.subscription-status.status-active { background: #ecfdf3; color: #166534; }
.subscription-status.status-expiring { background: #fff7ed; color: #b45309; }
.subscription-status.status-expired, .subscription-status.status-failed { background: #fef2f2; color: #991b1b; }
.subscription-status.status-nonrenewing { background: #f1f5f9; color: #475569; }
.subscription-status.status-suspended, .subscription-status.status-cancelled, .subscription-status.status-released { background: #f8fafc; color: #64748b; }
.subscription-status.status-provisioning { background: #eff6ff; color: #1d4ed8; }
.subscription-status.status-degraded, .status-warning { color: #b45309; }
.line-filters {
  display: grid; grid-template-columns: 2fr repeat(4, 1fr) auto auto;
  gap: 10px; align-items: end;
}
.asset-filters {
  display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px; align-items: end;
}
.asset-table td:nth-child(2) { min-width: 160px; }
.asset-table td:nth-child(4) { min-width: 145px; }
.table-count { color: #687386; font-size: 13px; padding: 4px 8px 10px; }
.node-table td small { color: #687386; }
.node-table td:nth-child(3) { min-width: 220px; max-width: 340px; }
.service-table-card { padding: 10px 18px; }
.compact-table th, .compact-table td { padding: 9px 8px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 20px; }
.pagination a { color: #1768e5; text-decoration: none; }
.pagination .current-page {
  background: #1768e5; color: white; padding: 6px 10px; border-radius: 6px;
}
.page-jump { display: flex; gap: 6px; align-items: center; }
.page-jump input { width: 72px; padding: 7px; }
.page-jump button { padding: 8px 10px; }
.service-dialog {
  width: min(840px, 92vw); max-height: 90vh; border: 0; border-radius: 14px;
  padding: 26px; box-shadow: 0 20px 70px rgba(10, 25, 50, .25);
}
.service-dialog::backdrop { background: rgba(10, 20, 35, .62); }
.dialog-close {
  position: absolute; right: 14px; top: 10px; background: transparent;
  color: #526074; font-size: 28px; padding: 4px 8px;
}
.dialog-service-body {
  display: grid; grid-template-columns: 300px 1fr; gap: 28px;
  align-items: center; margin: 24px 0;
}
.delivery-copy-panel {
  border: 1px solid var(--border); border-radius: 10px; background: #f8fafc;
  padding: 16px; margin: 4px 0 18px;
}
.delivery-copy-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 12px;
}
.delivery-copy-header h3 { margin: 0 0 4px; font-size: 18px; }
.delivery-copy-header p { margin: 0; color: var(--muted); font-size: 13px; }
.delivery-copy-text {
  min-height: 220px; background: white; line-height: 1.7; color: #172033;
}
.s5-qr-panel {
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center;
  padding: 16px; margin: 8px 0 20px; border: 1px solid var(--border);
  border-radius: 10px; background: #f8fafc;
}
.s5-qr-panel h3 { margin: 0 0 5px; font-size: 18px; }
.s5-qr-panel p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.s5-qr-body { display: flex; align-items: center; gap: 14px; }
.s5-qr-image { background: white; border-radius: 8px; }
.s5-qr-actions { display: grid; gap: 8px; }
.qr-image-large { width: 300px; height: 300px; object-fit: contain; }
.qr-placeholder {
  width: 300px; min-height: 220px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  border: 2px dashed #cfd7e5; border-radius: 10px; color: #687386;
  background: #f8faff;
}
.dialog-actions { display: flex; align-items: end; justify-content: space-between; gap: 15px; }
.inline-editor { margin-top: 20px; border-top: 1px solid #edf0f5; padding-top: 16px; }
.inline-editor summary { cursor: pointer; color: #1768e5; font-weight: 700; }
.wide-field { grid-column: span 2; }
.monitor-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
.monitor-card {
  border: 1px solid #e5eaf2; border-left-width: 5px; border-radius: 10px;
  padding: 15px; background: #fbfcff;
}
.monitor-card p { margin: 8px 0; color: #526074; word-break: break-all; }
.monitor-title { display: flex; justify-content: space-between; gap: 8px; }
.status-border-healthy { border-left-color: #18864b; }
.status-border-failed { border-left-color: #bd2525; }
.status-border-unknown, .status-border-asset { border-left-color: #8792a5; }
.monitor-error { color: #bd2525 !important; font-size: 13px; }
.fault-stat b { color: #bd2525 !important; }
.fault-overview { grid-template-columns: repeat(2, 1fr); }
.fault-link { text-decoration: none; border: 1px solid #f1c1bd; background: #fff7f6; }
.fault-link b { color: #bd2525 !important; }
.urgent-failure-row {
  background: linear-gradient(90deg, #fff0f0, #fff);
  box-shadow: inset 5px 0 #d92d20;
}
.urgent-badge {
  display: inline-block; padding: 4px 8px; border-radius: 999px;
  color: white; background: #d92d20; font-weight: 700; font-size: 12px;
}
.server-offline-card {
  background: #fff4f3; border-color: #f0aaa4; box-shadow: 0 6px 20px rgba(189, 37, 37, .12);
}
.monitor-filters {
  display: grid; grid-template-columns: 2fr 1fr 1fr auto auto;
  gap: 10px; align-items: end;
}
.fault-filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}
.fault-stats a {
  color: var(--text);
  text-decoration: none;
}
.fault-list {
  display: grid;
  gap: 12px;
}
.fault-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .42fr);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 5px solid #ef4444;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(20, 35, 60, .05);
}
.fault-card.supplier { border-left-color: #f59e0b; }
.fault-card.waiting { border-left-color: #3b82f6; }
.fault-card.handled { border-left-color: #22c55e; }
.fault-main h2 { margin: 8px 0 4px; }
.fault-main p { margin: 0; color: var(--muted); }
.fault-head,
.fault-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.fault-type,
.fault-state {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.fault-type { background: #eef2ff; color: #3730a3; }
.fault-state.state-open { background: #fee2e2; color: #991b1b; }
.fault-state.state-supplier { background: #fffbeb; color: #b45309; }
.fault-state.state-waiting { background: #eff6ff; color: #1d4ed8; }
.fault-state.state-handled { background: #dcfce7; color: #166534; }
.fault-meta { margin-top: 10px; color: var(--muted); font-size: 13px; }
.fault-error,
.fault-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.fault-error { background: #fff1f2; color: #b91c1c; }
.fault-note { background: #f8fafc; color: #475569; }
.fault-actions {
  display: grid;
  align-content: start;
  gap: 8px;
}
.fault-actions form { margin: 0; }
.fault-actions button,
.fault-actions .button-link {
  width: 100%;
  text-align: center;
}
.fault-action-form {
  display: grid;
  gap: 8px;
}
.reminder-filters { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.reminder-filters label { max-width: 130px; }
.active-filter { background: #1768e5; }
.mobile-asset-list { display: none; }
.asset-mobile-card {
  background: white; border: 1px solid #e1e7f0; border-left: 5px solid #8792a5;
  border-radius: 12px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(20, 35, 60, .07);
}
.asset-mobile-card p { margin: 9px 0; }
.asset-address { font-size: 17px; color: #172033; word-break: break-all; }
.asset-mobile-grid {
  display: grid; grid-template-columns: 72px 1fr; gap: 8px 10px;
  padding: 12px 0; border-top: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5;
}
.asset-mobile-grid span { color: #687386; }
.urgent-failure-card { border-left-color: #d92d20; background: #fff5f4; }
.nezha-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin-top: 16px;
}
.nezha-card { border: 1px solid #e5eaf2; border-radius: 10px; padding: 14px; }
.nezha-card p { margin: 8px 0; color: #526074; }
.nezha-metrics { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.nezha-metrics span { color: #687386; font-size: 13px; }
.server-address { color: #10274a !important; font-weight: 700; }
.server-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px;
  padding: 10px 0; margin: 8px 0; border-top: 1px solid #edf0f5;
  border-bottom: 1px solid #edf0f5; color: #526074; font-size: 13px;
}
.unloaded-list { display: grid; gap: 8px; margin-top: 12px; }
.unloaded-list span { padding: 9px 11px; border-radius: 7px; background: #f4f6fa; }
@media (max-width: 800px) {
  header { align-items: flex-start; flex-direction: column; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  nav { width: 100%; gap: 8px 14px; }
  nav a, nav button.link { font-size: 14px; }
  main { width: 96%; margin: 18px auto; }
  .stats, .grid-form, .finance-stats, .fault-overview { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .ops-hero { align-items: stretch; flex-direction: column; padding: 20px; }
  .ops-hero h1 { font-size: 28px; }
  .ops-focus-grid { grid-template-columns: 1fr 1fr; }
  .ops-metric-panel { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  .reminder, .title-row { align-items: stretch; flex-direction: column; }
  .delivery-grid { grid-template-columns: 1fr; }
  .service-filters { grid-template-columns: 1fr 1fr; }
  .subscription-filters { grid-template-columns: 1fr 1fr; }
  .order-filters { grid-template-columns: 1fr 1fr; }
  .channel-filters, .channel-form, .channel-card-main, .channel-edit-form, .channel-price-form, .channel-wallet-form { grid-template-columns: 1fr 1fr; }
  .channel-metrics { grid-template-columns: 1fr 1fr; }
  .channel-assignment-card { align-items: stretch; flex-direction: column; }
  .plan-form, .plan-filters { grid-template-columns: 1fr 1fr; }
  .plan-edit-form { grid-template-columns: 1fr; }
  .plan-edit-form button { grid-column: span 1; }
  .line-filters { grid-template-columns: 1fr 1fr; }
  .asset-filters { grid-template-columns: 1fr 1fr; }
  .monitor-grid { grid-template-columns: 1fr 1fr; }
  .nezha-grid { grid-template-columns: 1fr 1fr; }
  .monitor-filters { grid-template-columns: 1fr 1fr; }
  .fault-filters { grid-template-columns: 1fr 1fr; }
  .fault-card { grid-template-columns: 1fr; }
  .dialog-service-body { grid-template-columns: 1fr; }
  .delivery-copy-header { align-items: stretch; flex-direction: column; }
  .delivery-package-hero,
  .delivery-package-title {
    align-items: stretch;
    flex-direction: column;
  }
  .delivery-card-actions { justify-content: flex-start; }
  .delivery-package-body { grid-template-columns: 1fr; }
  .s5-qr-panel { grid-template-columns: 1fr; }
  .qr-image-large { width: min(300px, 100%); height: auto; }
  .renewal-card { flex-direction: column; }
  .renewal-meta-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .stats, .grid-form, .finance-stats, .fault-overview { grid-template-columns: 1fr; }
  .dashboard-page { gap: 10px; }
  .ops-hero {
    gap: 12px;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(29, 78, 216, .18);
  }
  .ops-hero h1 { font-size: 23px; line-height: 1.18; margin: 4px 0 6px; }
  .ops-hero p { font-size: 13px; line-height: 1.45; }
  .ops-hero .button-link {
    width: 100%;
    text-align: center;
    padding: 10px 12px;
  }
  .section-kicker { font-size: 12px; }
  .ops-focus-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .ops-focus-card {
    min-height: 92px;
    padding: 12px;
    gap: 5px;
    border-radius: 9px;
  }
  .ops-focus-card span { font-size: 12px; }
  .ops-focus-card b { font-size: 22px; line-height: 1.15; overflow-wrap: anywhere; }
  .ops-focus-card small { font-size: 11px; line-height: 1.25; }
  .ops-action-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow: visible;
    padding: 0;
  }
  .ops-action-strip .button-link {
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
  }
  .ops-metric-panel { gap: 8px; }
  .ops-metric-panel > div { padding: 12px; }
  .ops-metric-panel b { font-size: 20px; }
  .delivery-body { grid-template-columns: 1fr; }
  .delivery-actions, .renew-days-form { align-items: stretch; flex-direction: column; }
  .asset-filters, .service-filters, .subscription-filters, .order-filters, .wallet-form, .wallet-filters, .plan-form, .plan-filters, .purchase-steps, .choice-grid, .purchase-summary, .inline-create-grid, .line-filters, .monitor-grid { grid-template-columns: 1fr; }
  .nezha-grid { grid-template-columns: 1fr; }
  .pagination { flex-wrap: wrap; }
  .monitor-filters { grid-template-columns: 1fr; }
  .fault-filters { grid-template-columns: 1fr; }
  .fault-card { padding: 14px; }
  .fault-actions { gap: 7px; }
  .asset-table { display: none; }
  .mobile-asset-list { display: block; }
  .asset-stats { grid-template-columns: 1fr 1fr; }
  .asset-stats b { font-size: 25px; }
  .wide-field { grid-column: span 1; }
  .service-dialog { width: 96vw; padding: 18px; }
  .renewal-heading, .renewal-copy-title { align-items: stretch; flex-direction: column; }
  .renewal-meta-grid { grid-template-columns: 1fr; }
  .s5-qr-body { align-items: stretch; flex-direction: column; }
  .s5-qr-image { width: 170px; height: 170px; }
  button, .button-link { min-height: 42px; }
}
@media (max-width: 360px) {
  .ops-focus-grid { grid-template-columns: 1fr; }
  .ops-action-strip { grid-template-columns: 1fr; }
  .ops-hero h1 { font-size: 21px; }
}

/* 2026 dashboard shell */
:root {
  --sidebar: #111827;
  --sidebar-muted: #94a3b8;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --border: #e5eaf1;
  --text: #172033;
  --muted: #64748b;
  background: var(--canvas);
}
body { background: var(--canvas); color: var(--text); min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 238px; z-index: 30;
  display: flex; flex-direction: column; padding: 20px 14px;
  background: var(--sidebar); color: white;
}
.brand-block { display: flex; align-items: center; gap: 12px; padding: 2px 10px 22px; }
.brand-block div { display: grid; gap: 2px; }
.brand-block b { font-size: 18px; letter-spacing: .2px; }
.brand-block small, .sidebar-user small { color: var(--sidebar-muted); }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px; background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  font-weight: 800; box-shadow: 0 8px 22px rgba(37, 99, 235, .35);
}
.side-nav {
  display: flex; flex-direction: column; gap: 4px; flex: 1;
  overflow-y: auto; padding-right: 4px;
}
.nav-section {
  margin: 14px 10px 5px; color: var(--sidebar-muted);
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
}
.nav-section:first-child { margin-top: 0; }
.side-nav a {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: #cbd5e1; font-size: 14px; transition: .18s ease;
}
.side-nav a:hover { background: rgba(255,255,255,.07); color: white; }
.side-nav a.active { background: #2563eb; color: white; box-shadow: 0 5px 16px rgba(37,99,235,.28); }
.nav-group {
  display: block;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  overflow: hidden;
}
.nav-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 10px;
  color: #e2e8f0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
  content: "v";
  color: var(--sidebar-muted);
  transition: transform .18s ease;
}
.nav-group[open] summary::after { transform: rotate(180deg); }
.nav-group[open] {
  background: rgba(255,255,255,.045);
  border-color: rgba(148,163,184,.22);
}
.nav-group a {
  display: block;
  margin: 0 6px 6px;
  padding: 8px 10px;
}
.nav-group a:first-of-type { margin-top: 2px; }
.side-nav {
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  overflow-x: hidden;
}
.side-nav > a,
.side-nav > .nav-section {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.side-nav > a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid rgba(255,255,255,.1); padding: 16px 8px 0;
}
.sidebar-user div { display: grid; gap: 2px; min-width: 0; }
.sidebar-user button.link { color: #cbd5e1; font-size: 13px; }
.app-shell { margin-left: 238px; min-height: 100vh; }
.topbar {
  min-height: 58px; padding: 0 28px; display: flex; align-items: center;
  justify-content: flex-end; background: rgba(255,255,255,.92); color: var(--muted);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(12px);
}
.mobile-menu { display: none; }
main { width: auto; max-width: 1520px; margin: 0 auto; padding: 28px 32px 44px; }
h1 { font-size: 28px; letter-spacing: -.5px; margin-bottom: 7px; }
h2 { margin-top: 0; }
.title-row > div > p { color: var(--muted); margin: 0 0 4px; }
.card, .delivery-card {
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03), 0 8px 24px rgba(15, 23, 42, .035);
}
.toolbar-card { padding: 14px 16px; }
button { background: var(--primary); border-radius: 8px; font-weight: 600; }
button:hover { filter: brightness(.96); }
input, select, textarea { border-color: #dbe1ea; border-radius: 8px; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(37,99,235,.12); border-color: #60a5fa;
}
.button-link { background: var(--primary); border-radius: 8px; font-weight: 600; }
.secondary-link, button.secondary { background: #eef2f7; color: #334155; }
.text-link { color: var(--primary); text-decoration: none; }
table { font-size: 14px; }
th { background: #f8fafc; color: #64748b; font-weight: 600; }
tr:hover td { background: #fbfdff; }
.stats { gap: 14px; }
.stats .card { padding: 18px; }
.stats b { font-size: 28px; }
.workflow-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 16px 18px;
}
.workflow-card h2 { margin-bottom: 4px; }
.workflow-card p { margin: 0; }
.workflow-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; flex-wrap: wrap;
}
.workflow-actions .button-link { white-space: nowrap; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 18px;
  align-items: start;
}
.dashboard-page { display: grid; gap: 16px; }
.ops-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 24px; border-radius: 12px; color: white;
  background: linear-gradient(135deg, #1659d8 0%, #1d4ed8 52%, #0f766e 100%);
  box-shadow: 0 12px 26px rgba(29, 78, 216, .22);
}
.ops-hero h1 { margin: 6px 0 8px; font-size: 34px; letter-spacing: 0; }
.ops-hero p { margin: 0; color: rgba(255,255,255,.82); }
.ops-hero .button-link { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.32); }
.section-kicker { color: rgba(255,255,255,.78); font-weight: 700; }
.ops-focus-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
.ops-focus-card {
  display: grid; gap: 8px; min-height: 118px; padding: 18px;
  border: 1px solid var(--border); border-radius: 10px; background: white;
  text-decoration: none; color: var(--text);
  box-shadow: 0 4px 18px rgba(20, 35, 60, .05);
}
.ops-focus-card span, .ops-metric-panel span { color: var(--muted); font-weight: 600; }
.ops-focus-card b { font-size: 28px; color: #1768e5; }
.ops-focus-card small, .ops-metric-panel small, .compact-order-row small, .channel-rank-row small { color: var(--muted); }
.ops-action-strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 8px;
}
.ops-action-strip .button-link { flex: 0 0 auto; }
.todo-panel {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(20, 35, 60, .05);
}
.todo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.todo-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
}
.todo-card.primary { background: #eff6ff; border-color: #bfdbfe; }
.todo-card.warning { background: #fffbeb; border-color: #fde68a; }
.todo-card.danger { background: #fff1f2; border-color: #fecdd3; }
.todo-card.success { background: #f0fdf4; border-color: #bbf7d0; }
.todo-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
.todo-card-head span { color: #64748b; font-weight: 800; }
.todo-card-head b {
  font-size: 26px;
  line-height: 1;
  color: #1768e5;
}
.todo-card.warning .todo-card-head b { color: #d97706; }
.todo-card.danger .todo-card-head b { color: #dc2626; }
.todo-card.success .todo-card-head b { color: #16834a; }
.todo-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}
.todo-item {
  display: grid;
  gap: 2px;
  padding-top: 7px;
  border-top: 1px solid rgba(148, 163, 184, .28);
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.todo-item strong,
.todo-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo-item small,
.todo-empty {
  color: var(--muted);
  font-size: 12px;
}
.todo-empty {
  padding-top: 7px;
  border-top: 1px solid rgba(148, 163, 184, .28);
}
.ops-metric-panel {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.ops-metric-panel > div {
  display: grid; gap: 6px; padding: 16px 18px; border-radius: 10px;
  background: #fff; border: 1px solid var(--border);
}
.ops-metric-panel b { font-size: 24px; color: #18864b; }
.refined-dashboard-grid { margin-top: 2px; }
.compact-section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.compact-section-title h2 { margin: 0; }
.compact-section-title a, .compact-section-title span { color: var(--muted); text-decoration: none; font-size: 13px; }
.compact-order-list, .channel-rank-list { display: grid; }
.compact-order-row, .channel-rank-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px;
  align-items: center; padding: 12px 0; border-bottom: 1px solid #edf0f5;
  color: var(--text); text-decoration: none;
}
.compact-order-row:last-child, .channel-rank-row:last-child { border-bottom: 0; }
.compact-order-row > div, .channel-rank-row > div { display: grid; gap: 4px; min-width: 0; }
.compact-order-row b, .compact-order-row small { overflow-wrap: anywhere; }
.channel-rank-row strong { color: #1768e5; }
.flash { border: 1px solid transparent; }
.flash.success { border-color: #b7ebcb; }
.flash.error { border-color: #f3b8b8; }
.split-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.customer-list-card { padding: 0; overflow: hidden; }
.simple-list-header, .simple-customer-row {
  display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 1fr) 110px 110px 105px;
  gap: 18px; align-items: center; padding: 13px 18px;
}
.simple-list-header {
  background: #f8fafc; color: var(--muted); font-size: 13px;
  font-weight: 600; border-bottom: 1px solid var(--border);
}
.simple-customer-row { border-bottom: 1px solid #edf1f5; }
.simple-customer-row:last-child { border-bottom: 0; }
.simple-customer-row:hover { background: #fbfdff; }
.customer-link { color: var(--text); text-decoration: none; }
.customer-cell div, .customer-meta, .simple-customer-row > div { display: grid; gap: 3px; }
.customer-cell small, .customer-meta small, .simple-customer-row small { color: var(--muted); }
.profile-avatar {
  width: 68px; height: 68px; border-radius: 18px; object-fit: cover;
  display: inline-grid; place-items: center; font-size: 24px;
}
.customer-profile h1 { margin: 0 0 6px; }
.customer-profile p { color: var(--muted); margin: 0; }
.customer-profile { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.customer-row-actions { display: flex !important; align-items: center; gap: 6px; }
.customer-row-actions form, .suggestion-list form { margin: 0; }
.customer-row-actions button, .customer-row-actions .button-link {
  padding: 8px 10px; min-height: 36px; font-size: 13px;
}
.page-back { margin-bottom: 14px; }
.page-back a { color: var(--primary); text-decoration: none; }
.customer-service-list { display: grid; gap: 9px; }
.customer-service-item {
  display: grid; grid-template-columns: minmax(220px, 1.4fr) 1fr 1fr 120px 90px;
  gap: 16px; align-items: center; padding: 14px;
  border: 1px solid var(--border); border-radius: 9px; background: #fbfcfe;
}
.customer-service-item > div { display: grid; gap: 4px; min-width: 0; }
.customer-service-item span, .customer-service-item small { color: var(--muted); font-size: 13px; }
.customer-service-item b { overflow-wrap: anywhere; }
.matched-lines-card { border-color: #93c5fd; background: #f8fbff; }
.matched-line-item { background: #fff; border-color: #bfdbfe; }
.matched-line-item form { margin: 0; }
.matched-line-item button { white-space: nowrap; }
.quick-price-form { margin: 0; }
.quick-price-form label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.quick-price-form label > span { display: flex; gap: 6px; }
.quick-price-form input { width: 92px; min-width: 0; }
.quick-price-form button { padding: 8px 10px; white-space: nowrap; }
.account-list { display: grid; gap: 10px; }
.account-row {
  display: grid; grid-template-columns: 1fr 1fr 150px 1fr 90px auto;
  gap: 12px; align-items: end; padding: 14px;
  border: 1px solid var(--border); border-radius: 10px;
}
.account-row > div { display: grid; gap: 3px; align-self: center; }
.account-row small { color: var(--muted); }
.toggle-label { display: flex; align-items: center; gap: 7px; min-height: 42px; }
.toggle-label input { width: auto; }
.unmatched-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.matching-list { padding: 0; overflow: hidden; }
.matching-row {
  display: grid; grid-template-columns: 1.4fr 1fr 140px auto;
  align-items: center; gap: 18px; padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.matching-row:last-child { border-bottom: 0; }
.matching-row > div { display: grid; gap: 4px; min-width: 0; }
.matching-row span, .matching-row small { color: var(--muted); font-size: 13px; }
.matching-row b { overflow-wrap: anywhere; }
.compact-dialog { width: min(620px, 94vw); }
.suggestion-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.suggestion-chip {
  padding: 5px 8px; min-height: 0; border-radius: 999px;
  background: var(--primary-soft); color: #1d4ed8; font-size: 12px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.exact-suggestion { background: #dcfce7; color: #15803d; }
.nezha-card { background: var(--surface); box-shadow: 0 4px 16px rgba(15,23,42,.035); }
.nezha-card:hover { border-color: #cbd5e1; transform: translateY(-1px); }
.status-badge { display: inline-block; width: fit-content; font-size: 12px; font-weight: 600; }
.login {
  margin: 12vh auto; border-top: 4px solid var(--primary); padding: 30px;
}
.role-viewer main form[method="post"] { display: none !important; }
.role-viewer main details:has(form[method="post"]) { display: none; }
.snapshot-note { color: var(--muted); font-size: 13px; }
.usage-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.usage-stats .card { display: grid; gap: 3px; }
.usage-stats small { color: var(--muted); font-size: 12px; }
.usage-filters {
  display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px; align-items: end;
}
.usage-filters button, .usage-filters > a { align-self: end; }
.selected-resource-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-color: #93c5fd; background: #f8fbff;
}
.selected-resource-card h2 { margin-bottom: 5px; }
.selected-resource-card p { margin: 0; color: var(--muted); }
.backup-stats { grid-template-columns: repeat(3, 1fr); }
.migration-card, .backup-package-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.migration-card p, .backup-package-row small { color: var(--muted); }
.backup-package-row {
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.backup-package-row > div { display: grid; gap: 4px; }
.restore-command {
  padding: 14px; border-radius: 8px; overflow-x: auto;
  background: #0f172a; color: #e2e8f0;
}
.remote-migration-form { margin-top: 16px; }
.form-actions { display: flex; gap: 10px; }
.migration-job-list { display: grid; gap: 10px; }
.migration-job {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px;
  align-items: center; padding: 14px; border: 1px solid var(--border);
  border-radius: 9px; background: #fbfcfe;
}
.migration-job > div { display: grid; gap: 4px; }
.migration-job small { color: var(--muted); }
.migration-job pre {
  grid-column: 1 / -1; white-space: pre-wrap; color: #b42318;
  background: #fff1f0; padding: 10px; border-radius: 7px;
}
.usage-table-card { padding: 10px 18px; overflow: hidden; }
.usage-table td { vertical-align: middle; }
.usage-table td:nth-child(3), .usage-table td:nth-child(4), .usage-table td:nth-child(5) {
  display: table-cell;
}
.usage-table td > small, .usage-table td > span:not(.resource-kind):not(.trend):not(.load-badge) {
  display: block; color: var(--muted); font-size: 12px; margin-top: 3px;
}
.plain-list { margin: 10px 0 16px; padding-left: 18px; }
.feishu-status-card {
  display: grid; grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.2fr);
  gap: 18px; align-items: start;
}
.feishu-status-card h2 { margin-bottom: 6px; }
.feishu-config-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.feishu-config-grid div {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #f8fafc;
}
.feishu-config-grid span {
  display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px;
}
.feishu-config-grid b { overflow-wrap: anywhere; }
.feishu-preview-card table { min-width: 980px; }
.feishu-preview-card td { max-width: 260px; overflow-wrap: anywhere; }
.ip-address { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.resource-kind {
  display: inline-block; padding: 5px 8px; border-radius: 7px;
  background: #eef2ff; color: #4338ca; font-size: 12px; font-weight: 600;
}
.usage-count { font-size: 22px; color: var(--text); }
.trend, .load-badge {
  display: inline-block; padding: 5px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.trend-up { color: #b42318; background: #fee4e2; }
.trend-down { color: #027a48; background: #d1fadf; }
.trend-flat, .trend-new { color: #475467; background: #f2f4f7; }
.load-unused { color: #175cd3; background: #dbeafe; }
.load-light { color: #027a48; background: #d1fadf; }
.load-balanced { color: #344054; background: #eaecf0; }
.load-high { color: #b42318; background: #fee4e2; }
.usage-row.usage-high td { background: #fffafa; }
.outbound-list {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; max-height: 520px; overflow: auto;
}
.outbound-item {
  display: grid; gap: 3px; padding: 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe;
}
.outbound-item b, .outbound-item span { overflow-wrap: anywhere; }
.outbound-item small { color: var(--muted); }
.api-control-card { margin-bottom: 18px; }
.api-step-header {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px;
}
.api-step-header span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 999px;
  background: #1768e5; color: #fff; font-weight: 800; flex: 0 0 auto;
}
.api-step-header h2 { margin: 0 0 3px; font-size: 18px; }
.api-step-header p { margin: 0; }
.inline-action-form { margin: 12px 0 0; display: flex; justify-content: flex-end; }
.api-panel-picker {
  display: grid; grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 18px; align-items: end;
}
.panel-health {
  display: grid; gap: 5px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: #f8fafc;
}
.panel-health small { color: var(--muted); overflow-wrap: anywhere; }
.api-node-layout {
  display: grid; grid-template-columns: minmax(340px, .9fr) minmax(460px, 1.1fr);
  gap: 22px; align-items: start;
}
.api-node-layout .s5-picker-card { order: 1; }
.api-node-layout > section:first-child { order: 2; }
.api-node-form .selected-s5-summary {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px; border-radius: 10px; background: #f8fbff; border: 1px solid #bfdbfe;
}
.selected-s5-summary span { color: var(--muted); }
.selected-s5-summary b { overflow-wrap: anywhere; }
.compact-title-row { margin-bottom: 10px; }
.api-s5-search {
  position: sticky; top: 10px; z-index: 2;
  margin-bottom: 12px; padding: 10px;
  border: 1px solid #dbe7f7; border-radius: 8px; background: #fff;
}
.api-s5-search input { flex: 1; max-width: none; }
.inline-tool-panel {
  border: 1px solid var(--border); border-radius: 10px; background: #f8fafc;
  padding: 12px 14px; margin-bottom: 14px;
}
.inline-tool-panel summary { cursor: pointer; font-weight: 700; }
.s5-qr-tool { margin-top: 14px; margin-bottom: 0; background: #fff; }
.s5-preview-list {
  display: grid; gap: 12px; margin: 0 0 16px;
}
.s5-preview-card {
  display: grid; grid-template-columns: 170px minmax(0, 1fr);
  gap: 14px; align-items: start;
  padding: 14px; border: 1px solid #dbe5f2; border-radius: 8px; background: #fff;
}
.s5-preview-qr {
  width: 170px; height: 170px; display: grid; place-items: center;
  border: 1px solid #edf1f5; border-radius: 8px; background: #fff;
}
.s5-preview-qr .qr-image {
  width: 156px; height: 156px; border: 0;
}
.s5-preview-content {
  display: grid; gap: 8px; min-width: 0;
}
.s5-preview-content b,
.s5-preview-content small {
  overflow-wrap: anywhere;
}
.s5-preview-content small {
  color: var(--muted);
}
.s5-remark-form {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px; align-items: end;
}
.s5-remark-form label {
  margin: 0;
}
.s5-remark-form button {
  min-height: 40px; white-space: nowrap;
}
.s5-choice-list {
  display: grid; gap: 8px; max-height: 720px; overflow: auto; padding-right: 4px;
}
.s5-choice {
  display: grid; grid-template-columns: auto minmax(180px, 1fr) repeat(3, 72px) auto;
  gap: 10px; align-items: center; padding: 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe;
  cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.s5-choice:hover { border-color: #bfdbfe; background: #f8fbff; transform: translateY(-1px); }
.s5-choice.selected { border-color: var(--primary); background: #eff6ff; }
.s5-choice input { width: 18px; height: 18px; }
.s5-choice span { min-width: 0; }
.s5-choice b { display: block; overflow-wrap: anywhere; }
.s5-choice small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.s5-usage {
  display: grid; justify-items: center; padding: 7px;
  border-radius: 9px; background: #fff; border: 1px solid #edf1f5;
}
.s5-usage b { font-size: 18px; }
.s5-choice-actions { display: flex; justify-content: flex-end; }
.s5-choice-actions button { padding: 7px 9px; min-height: 32px; font-size: 12px; }
.qr-only-dialog { width: min(360px, 92vw); text-align: center; }
.qr-only-dialog .qr-image-large {
  width: min(280px, 80vw); height: min(280px, 80vw); object-fit: contain;
  margin: 12px auto; display: block;
}
.table-actions form { display: inline-block; margin: 0; }
.traffic-table td small {
  display: block; color: var(--muted); margin-top: 2px;
}
.traffic-row.traffic-high td {
  background: #fff5f5;
}
.traffic-row.traffic-warn td {
  background: #fffbeb;
}
.traffic-chart-button {
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}
.traffic-chart-dialog {
  width: min(1040px, 94vw);
}
.traffic-chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin: 12px 0;
}
.traffic-chart-toolbar label {
  margin: 0;
  min-width: 180px;
}
.traffic-chart-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.traffic-chart-box canvas {
  display: block;
  width: 100%;
  height: 360px;
}
.traffic-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}
.traffic-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.traffic-chart-legend i {
  width: 20px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}
.legend-upload { background: #2563eb; }
.legend-download { background: #16a34a; }
.legend-client { background: #f59e0b; }
.danger-text { color: #b42318; }
.badge-danger {
  color: #b42318; background: #fee4e2;
}
.badge-warning {
  color: #92400e; background: #fef3c7;
}
.support-form {
  display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px; align-items: end;
}
.support-wide { grid-column: 1 / -1; }
.support-table td small {
  display: block; color: var(--muted); margin-top: 3px;
}
.support-detail-grid {
  display: grid; grid-template-columns: minmax(320px, .9fr) minmax(320px, 1.1fr);
  gap: 18px; align-items: start;
}
.detail-list {
  display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px;
}
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button-row form { display: flex; gap: 8px; align-items: center; margin: 0; }
.diagnosis-summary {
  padding: 14px; border-radius: 12px; background: #f8fafc;
  border: 1px solid var(--border); line-height: 1.6;
}
.reply-box { width: 100%; resize: vertical; }
.check-list { display: grid; gap: 10px; }
.check-item {
  display: grid; grid-template-columns: 140px 80px 1fr; gap: 12px;
  align-items: start; padding: 12px; border: 1px solid var(--border);
  border-radius: 12px; background: #fff;
}
.check-item span {
  display: inline-block; text-align: center; border-radius: 999px;
  padding: 3px 8px; font-size: 12px; font-weight: 700;
}
.check-item p { margin: 0; overflow-wrap: anywhere; }
.check-ok span { color: #027a48; background: #d1fadf; }
.check-warn span { color: #92400e; background: #fef3c7; }
.check-fail span { color: #b42318; background: #fee4e2; }
.public-help {
  width: min(1040px, 100%); margin: 0 auto 40px;
}
.help-hero {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  gap: 22px; align-items: stretch; margin-bottom: 22px;
}
.help-hero > div:first-child {
  padding: 34px; border-radius: 22px;
  background: linear-gradient(135deg, #10213d, #1d63e9);
  color: #fff; box-shadow: 0 18px 45px rgba(23,104,229,.22);
}
.help-hero h1 { margin: 6px 0 12px; font-size: clamp(30px, 5vw, 52px); }
.help-hero p { margin: 0; color: rgba(255,255,255,.86); line-height: 1.8; }
.eyebrow {
  display: inline-flex; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,.14); font-size: 13px; letter-spacing: .04em;
}
.help-card {
  display: block; color: inherit; text-decoration: none;
  background: #fff; border: 1px solid #e5eaf3; border-radius: 18px;
  padding: 20px; box-shadow: 0 8px 28px rgba(20,35,60,.06);
}
.help-card span {
  display: inline-flex; width: 36px; height: 36px; align-items: center;
  justify-content: center; border-radius: 12px; background: #edf3ff;
  color: #1768e5; font-weight: 800; margin-bottom: 12px;
}
.help-card b { display: block; font-size: 20px; margin-bottom: 8px; }
.help-card p, .quick-card li { color: #526074; line-height: 1.7; }
.quick-card ol { margin: 12px 0 0; padding-left: 22px; }
.help-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.help-section {
  background: #fff; border: 1px solid #e5eaf3; border-radius: 18px;
  padding: 24px; margin-bottom: 18px; box-shadow: 0 8px 28px rgba(20,35,60,.05);
}
.help-section h2 { margin-top: 0; }
.step-list { display: grid; gap: 12px; }
.step-list > div {
  padding: 14px 16px; border-radius: 14px; background: #f8fafc;
  border: 1px solid #edf0f5;
}
.step-list b { display: block; margin-bottom: 6px; }
.step-list p { margin: 0; color: #526074; line-height: 1.8; }
.copy-panel pre {
  white-space: pre-wrap; margin: 0; padding: 16px; border-radius: 14px;
  background: #101828; color: #e6edf8; line-height: 1.8; overflow-x: auto;
}
.warning-box {
  padding: 14px 16px; border-radius: 14px; margin-bottom: 14px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12;
}
.warning-box b { display: block; margin-bottom: 6px; }
.warning-box p { margin: 0; line-height: 1.8; }
.help-footer-note ul { margin-bottom: 0; line-height: 1.9; color: #526074; }

.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 18px 22px;
  background: #fff;
  border: 1px solid #e5eaf3;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20,35,60,.06);
}
.tool-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.tool-heading h1 { margin: 0 0 4px; }
.tool-heading p { margin: 0; color: #617086; line-height: 1.6; }
.tool-mark {
  display: inline-flex;
  width: 54px;
  height: 54px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: #2f6df6;
  color: #fff;
  font-weight: 800;
}
.tool-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  background: #f2f6fc;
  border-radius: 10px;
  white-space: nowrap;
}
.tool-tabs a {
  padding: 10px 18px;
  border-radius: 8px;
  color: #5d6b7c;
  text-decoration: none;
  font-weight: 700;
}
.tool-tabs a.active {
  color: #1768e5;
  background: #fff;
  box-shadow: 0 4px 14px rgba(20,35,60,.08);
}
.tool-panel { margin-bottom: 16px; }
.warning-note {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-left: 4px solid #fbbf24;
  border-radius: 8px;
  background: #fffbeb;
  color: #6b5b19;
  font-weight: 700;
}
.format-note {
  padding: 12px 14px;
  border-left: 4px solid #3b82f6;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
}
.tool-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-title-row h2 { margin: 0; }
.status-pill {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.status-pill.ok {
  background: #dcfce7;
  color: #166534;
}
.status-pill.failed {
  background: #fee2e2;
  color: #991b1b;
}
.s5-test-table td { vertical-align: top; }

@media (max-width: 1050px) {
  .customer-service-item { grid-template-columns: 1.2fr 1fr 1fr; }
  .customer-service-item .status-badge { justify-self: start; }
  .account-row { grid-template-columns: 1fr 1fr 1fr; }
  .usage-stats { grid-template-columns: repeat(3, 1fr); }
  .usage-filters { grid-template-columns: 1fr 1fr; }
  .outbound-list { grid-template-columns: 1fr 1fr; }
  .api-node-layout { grid-template-columns: 1fr; }
  .bulk-edit-grid { grid-template-columns: 1fr 1fr; }
  .bulk-renew-grid { grid-template-columns: 1fr 1fr; }
  .support-form { grid-template-columns: 1fr 1fr; }
  .support-detail-grid { grid-template-columns: 1fr; }
  .help-hero { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 35px rgba(15,23,42,.18); }
  .sidebar-open .sidebar { transform: translateX(0); }
  .app-shell { margin-left: 0; }
  .topbar { min-height: 54px; justify-content: space-between; padding: 0 16px; }
  .mobile-menu { display: inline-block; padding: 7px 11px; }
  main { padding: 18px 14px 34px; }
  .split-panel { grid-template-columns: 1fr; }
  .simple-list-header { display: none; }
  .simple-customer-row {
    grid-template-columns: 1fr auto; gap: 12px; padding: 15px;
  }
  .simple-customer-row .customer-meta { grid-column: 1; }
  .simple-customer-row > div:nth-child(3), .simple-customer-row > div:nth-child(4) { display: none; }
  .simple-customer-row .button-link { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .customer-service-item { grid-template-columns: 1fr 1fr; }
  .unmatched-summary { align-items: stretch; flex-direction: column; }
  .matching-row { grid-template-columns: 1fr auto; }
  .matching-row > div:nth-child(2), .matching-row > div:nth-child(3) { grid-column: 1; }
  .matching-row button { grid-column: 2; grid-row: 1 / span 3; }
  .customer-profile { align-items: stretch; flex-direction: column; }
  .usage-stats { grid-template-columns: 1fr 1fr; }
  .usage-table-card { padding: 8px 12px; overflow-x: auto; }
  .usage-table { min-width: 1100px; }
  .api-panel-picker { grid-template-columns: 1fr; }
  .api-node-layout { display: flex; flex-direction: column; }
  .api-node-layout .s5-picker-card { order: 1; }
  .api-node-layout > section:first-child { order: 2; }
  .workflow-card { align-items: stretch; flex-direction: column; }
  .workflow-actions { justify-content: flex-start; }
  .inline-action-form { justify-content: stretch; }
  .inline-action-form button { width: 100%; }
  .api-s5-search { position: static; padding: 0; border: 0; background: transparent; }
  .s5-preview-card { grid-template-columns: 1fr; }
  .s5-preview-qr { margin: 0 auto; }
  .s5-remark-form { grid-template-columns: 1fr; }
  .s5-choice { grid-template-columns: auto minmax(0, 1fr); }
  .s5-usage { display: none; }
  .s5-choice-actions { grid-column: 2; justify-content: flex-start; }
  .s5-choice-actions button { min-height: 30px; padding: 5px 8px; }
}
@media (max-width: 500px) {
  h1 { font-size: 24px; }
  .customer-service-item, .account-row { grid-template-columns: 1fr; }
  .search-form { align-items: stretch; flex-wrap: wrap; }
  .search-form input { max-width: none; flex: 1 1 100%; }
  .stats .card { padding: 16px; }
  .usage-filters, .usage-stats { grid-template-columns: 1fr; }
  .outbound-list { grid-template-columns: 1fr; }
  .bulk-edit-grid { grid-template-columns: 1fr; }
  .bulk-renew-grid { grid-template-columns: 1fr; }
  .support-form { grid-template-columns: 1fr; }
  .channel-stats, .channel-filters, .channel-form, .channel-card-main, .channel-edit-form, .channel-metrics, .channel-price-form, .channel-price-row, .channel-wallet-form { grid-template-columns: 1fr; }
  .channel-actions, .inline-select-form { align-items: stretch; flex-direction: column; }
  .inline-select-form select, .inline-select-form button, .channel-actions .button-link { width: 100%; }
  .check-item { grid-template-columns: 1fr; }
  .button-row, .button-row form { align-items: stretch; flex-direction: column; }
  .help-grid { grid-template-columns: 1fr; }
  .help-section, .help-hero > div:first-child, .help-card { padding: 18px; }
  .tool-header { align-items: stretch; flex-direction: column; }
  .tool-tabs { width: 100%; }
  .tool-tabs a { flex: 1; text-align: center; }
  .tool-form-grid { grid-template-columns: 1fr; }
  .section-title-row { align-items: flex-start; flex-direction: column; }
  .service-probe-panel { align-items: stretch; flex-direction: column; }
  .service-probe-form button { width: 100%; }
}

/* Renewal workbench */
.renewal-stats a.card {
  color: inherit;
  text-decoration: none;
}
.renewal-stats .active-card {
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 8px 26px rgba(37, 99, 235, .12);
}
.renewal-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px auto auto;
  gap: 12px;
  align-items: end;
}
.renewal-list {
  display: grid;
  gap: 14px;
}
.renewal-work-card {
  border-left: 4px solid transparent;
}
.renewal-work-card.is-today {
  border-left-color: #f59e0b;
}
.renewal-work-card.is-overdue {
  border-left-color: #dc2626;
}
.renewal-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
}
.renewal-customer h2 {
  margin: 0 0 4px;
  font-size: 20px;
}
.renewal-customer p {
  margin: 0;
  color: var(--muted);
}
.renewal-service-title {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0 12px;
  font-size: 18px;
}
.renewal-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.renewal-meta-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
.renewal-meta-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}
.renewal-meta-grid b {
  display: block;
  overflow-wrap: anywhere;
}
.renewal-actions-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}
.renewal-order-form {
  display: grid;
  gap: 12px;
}
.renewal-duration-select {
  margin: 0;
}
.renewal-duration-select select {
  min-height: 48px;
  font-weight: 800;
  color: #0f172a;
}
.renewal-submit-row,
.renewal-link-row {
  display: grid;
  gap: 8px;
}
.renewal-submit-row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.renewal-link-row { grid-template-columns: 1fr 1fr; }
.renewal-submit-row button,
.renewal-link-row .button-link {
  min-width: 0;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}
.renewal-submit-row .admin-charge-button {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}
.renewal-nonrenew-form {
  display: grid;
}
.danger-text,
.danger-outline {
  color: #b91c1c;
}
.danger-outline {
  border-color: #fecaca;
  background: #fff5f5;
}
.danger-outline:hover {
  border-color: #ef4444;
  background: #fee2e2;
}
.renewal-muted-panel {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}
.renewal-muted-panel b,
.renewal-muted-panel span {
  display: block;
}
.empty-state-card {
  text-align: center;
  padding: 34px;
}

@media (max-width: 1050px) {
  .renewal-card-main {
    grid-template-columns: 1fr;
  }
  .renewal-actions-panel {
    max-width: none;
  }
}

@media (max-width: 800px) {
  .renewal-filters {
    grid-template-columns: 1fr;
  }
  .renewal-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.channel-portal-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.channel-portal-stats .card {
  min-height: 112px;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 0;
}
.channel-portal-stats .card::after {
  content: "";
  position: absolute;
  inset: auto 16px 14px auto;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  opacity: .16;
}
.channel-portal-stats .card:nth-child(1) {
  background: linear-gradient(135deg, #eff6ff, #ffffff 62%);
}
.channel-portal-stats .card:nth-child(1)::after { background: #2563eb; }
.channel-portal-stats .card:nth-child(1) b { color: #1d4ed8; }
.channel-portal-stats .card:nth-child(2) {
  background: linear-gradient(135deg, #eefdf7, #ffffff 62%);
}
.channel-portal-stats .card:nth-child(2)::after { background: #059669; }
.channel-portal-stats .card:nth-child(2) b { color: #047857; }
.channel-portal-stats .card:nth-child(3) {
  background: linear-gradient(135deg, #fff7ed, #ffffff 62%);
}
.channel-portal-stats .card:nth-child(3)::after { background: #ea580c; }
.channel-portal-stats .card:nth-child(3) b { color: #c2410c; }
.channel-portal-stats .card:nth-child(4) {
  background: linear-gradient(135deg, #ecfeff, #ffffff 62%);
}
.channel-portal-stats .card:nth-child(4)::after { background: #0891b2; }
.channel-portal-stats .card:nth-child(4) b { color: #0e7490; }
.channel-portal-stats .card:nth-child(5) {
  background: linear-gradient(135deg, #f8fafc, #ffffff 62%);
}
.channel-portal-stats .card:nth-child(5)::after { background: #64748b; }
.channel-portal-stats .card:nth-child(5) b { color: #334155; }
.channel-portal-stats .card:nth-child(6) {
  background: linear-gradient(135deg, #f0fdf4, #ffffff 62%);
}
.channel-portal-stats .card:nth-child(6)::after { background: #16a34a; }
.channel-portal-stats .card:nth-child(6) b { color: #15803d; }
.channel-business-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: -8px;
  margin-bottom: 18px;
  padding: 0;
  overflow: hidden;
}
.channel-business-strip div {
  min-width: 0;
  min-height: 86px;
  padding: 16px 18px;
  border-right: 1px solid var(--border);
  display: grid;
  align-content: center;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}
.channel-business-strip div:last-child { border-right: 0; }
.channel-business-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}
.channel-business-strip b {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 18px;
}
.channel-portal-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
}
.channel-people-grid {
  grid-template-columns: minmax(300px, .7fr) minmax(0, 1.3fr);
}
.role-channel .side-nav a { color: #e2e8f0; }
.role-channel main form[method="post"] { display: none !important; }
.role-channel main form.channel-allowed-form { display: grid !important; }
.channel-action-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  align-items: stretch;
  gap: 14px;
}
.channel-action-grid > article:nth-child(2) {
  order: 1;
  grid-row: span 2;
}
.channel-action-grid > article:nth-child(1) { order: 2; }
.channel-action-grid > article:nth-child(4) { order: 3; }
.channel-action-grid > article:nth-child(3) {
  order: 4;
  grid-column: 1 / -1;
}
.channel-action-grid > .card {
  min-height: 100%;
  display: grid;
  align-content: start;
}
.channel-action-grid .compact-section-title {
  min-height: 38px;
  align-items: start;
}
.channel-customer-form,
.channel-order-form {
  gap: 10px;
}
.channel-customer-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.channel-customer-mode label {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 800;
}
.channel-customer-mode input {
  width: auto !important;
  margin-right: 8px;
}
.channel-new-customer-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
.channel-new-customer-fields[hidden] {
  display: none !important;
}
.channel-new-customer-wide {
  grid-column: 1 / -1;
}
.channel-wallet-topup-card {
  gap: 9px;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.channel-order-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
.channel-order-summary span,
.channel-order-summary small {
  display: block;
  color: var(--muted);
}
.channel-order-summary b {
  display: block;
  margin: 4px 0;
}
.channel-order-summary strong {
  color: var(--success);
  font-size: 22px;
  white-space: nowrap;
}
.mini-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  margin-top: 6px;
  border-radius: 6px;
  background: #eef4ff;
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}
.mini-link:hover {
  background: #dbeafe;
}
.channel-delivery-row {
  grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
  gap: 18px;
  align-items: center;
}
.channel-delivery-row > div:first-child b {
  overflow-wrap: anywhere;
}
.channel-delivery-actions {
  display: grid;
  grid-template-columns: auto auto auto auto;
  gap: 8px;
  align-items: center;
  justify-content: end;
  text-align: right;
}
.channel-delivery-actions strong {
  grid-column: 1 / -1;
  font-size: 18px;
}
.channel-delivery-actions > small {
  grid-column: 1 / -1;
}
.channel-delivery-actions .mini-link,
.channel-delivery-actions .delivery-pill,
.channel-delivery-actions .probe-status,
.channel-delivery-actions button {
  margin-top: 0;
  min-height: 34px;
  white-space: nowrap;
}
.inline-mini-form {
  display: inline-grid !important;
  margin: 0;
}
.channel-people-grid > article:nth-child(2) {
  order: -1;
}
.channel-portal-grid .compact-section-title .mini-link {
  margin-top: 0;
}
.channel-fold-row {
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.channel-fold-row:last-child {
  border-bottom: 0;
}
.channel-fold-row summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 8px 0;
}
.channel-fold-row summary::-webkit-details-marker {
  display: none;
}
.channel-fold-row summary::before {
  content: "›";
  width: 18px;
  height: 18px;
  font-size: 14px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-weight: 900;
  transform: rotate(0deg);
  transition: transform .16s ease;
  grid-row: 1;
  grid-column: 1;
  justify-self: start;
}
.channel-fold-row[open] summary::before {
  transform: rotate(90deg);
}
.channel-fold-main {
  min-width: 0;
  padding-left: 26px;
  grid-column: 1;
  display: grid;
  gap: 2px;
}
.channel-fold-main b {
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.2;
}
.channel-fold-main small { font-size: 12px; }
.channel-fold-main small,
.channel-fold-side span,
.channel-fold-meta span,
.channel-fold-meta small {
  color: var(--muted);
}
.channel-fold-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}
.channel-fold-side strong {
  font-size: 16px;
  color: var(--text);
}
.channel-fold-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  padding: 0 0 10px 26px;
}
.channel-fold-meta {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.channel-fold-meta span,
.channel-fold-meta b,
.channel-fold-meta small {
  display: block;
  overflow-wrap: anywhere;
}
.channel-fold-meta span {
  font-size: 11px;
}
.channel-fold-meta b {
  font-size: 13px;
  line-height: 1.3;
}
.channel-fold-error {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff5f5;
}
.channel-fold-error b {
  color: #b91c1c;
}
.channel-fold-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.channel-fold-actions .mini-link,
.channel-fold-actions .copy-button,
.channel-fold-actions button {
  min-height: 30px;
  padding: 5px 10px;
  margin-top: 0;
  font-size: 13px;
}
.channel-fold-actions .copy-button {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.channel-customer-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
}
.channel-customer-actions > strong,
.channel-customer-actions > small,
.channel-customer-actions > .mini-link {
  grid-column: 1;
}
.channel-customer-topup-form {
  grid-column: 2;
  grid-row: 1 / span 3;
  display: grid !important;
  grid-template-columns: minmax(88px, .45fr) minmax(96px, .75fr) auto;
  gap: 6px;
  align-items: center;
}
.channel-customer-topup-form input,
.channel-customer-topup-form button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}
.channel-topup-requests {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  background: linear-gradient(135deg, #fffbeb, #ffffff 68%);
  box-shadow: 0 8px 22px rgba(245, 158, 11, .12);
}
.channel-topup-requests > strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: #92400e;
}
.channel-topup-requests > strong::before {
  content: "!";
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}
.channel-sub-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr);
  gap: 14px;
  align-items: start;
  margin-top: 12px;
}
.channel-sub-form,
.channel-sub-price-form {
  gap: 10px;
}
.channel-inline-check {
  align-self: end;
  min-height: 42px;
}
.channel-sub-list {
  margin-top: 14px;
  border-top: 1px solid var(--border);
}
.channel-sub-body {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.channel-sub-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: start;
  margin-top: 4px;
}
.channel-sub-mini-form {
  display: grid !important;
  grid-template-columns: minmax(120px, .45fr) minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.channel-sub-mini-form input,
.channel-sub-mini-form button,
.channel-sub-price-form input,
.channel-sub-price-form select,
.channel-sub-price-form button {
  min-height: 34px;
}
.channel-sub-price-panel {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafc;
}
.channel-sub-price-panel summary {
  font-size: 14px;
}
.channel-sub-price-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.channel-sub-price-form button {
  grid-column: 1 / -1;
}
.channel-topup-request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fff;
}
.channel-topup-request-row b,
.channel-topup-request-row small {
  display: block;
  overflow-wrap: anywhere;
}
.channel-topup-request-row small {
  color: var(--muted);
  font-size: 12px;
}
.channel-topup-request-row b {
  font-size: 15px;
}
.channel-topup-request-actions {
  display: grid !important;
  gap: 8px;
  align-items: center;
}
.channel-topup-request-actions button {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
  white-space: nowrap;
}
.channel-topup-request-actions button[name="action"][value="approve"] {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}
.channel-expiry-todos {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: linear-gradient(135deg, #eff6ff, #ffffff 70%);
}
.channel-expiry-todos > strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1d4ed8;
  font-size: 15px;
}
.channel-expiry-todos > strong::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, .12);
}
.channel-expiry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fff;
}
.channel-expiry-row b,
.channel-expiry-row small {
  display: block;
  overflow-wrap: anywhere;
}
.channel-expiry-row small {
  color: var(--muted);
  font-size: 12px;
}
.executor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}
.executor-card {
  display: grid;
  gap: 14px;
}
.executor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.executor-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}
.compact-form {
  display: grid;
  gap: 12px;
}
.form-grid {
  display: grid;
  gap: 10px;
}
.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.checkbox-line {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 12px;
}
.checkbox-line input {
  width: auto;
}
.actions.right {
  justify-content: flex-end;
}
.executor-test {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
}
.executor-test.success {
  background: #ecfdf5;
  border-color: #bbf7d0;
}
.executor-test.failed {
  background: #fff1f2;
  border-color: #fecdd3;
}
.audit-detail {
  margin-top: 6px;
}
.audit-detail summary {
  cursor: pointer;
  color: #2563eb;
  font-weight: 700;
}
.audit-detail pre {
  max-width: 520px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #dfe7f3;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  white-space: pre-wrap;
}
.channel-customer-fold .channel-fold-body {
  grid-template-columns: minmax(0, .7fr) minmax(0, .7fr);
}
.channel-customer-fold .channel-fold-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

@media (max-width: 800px) {
  .executor-grid,
  .form-grid.three,
  .form-grid.four {
    grid-template-columns: 1fr;
  }
  .executor-head,
  .actions.right {
    align-items: stretch;
    flex-direction: column;
  }
  .channel-portal-stats { grid-template-columns: 1fr 1fr; }
  .channel-business-strip { grid-template-columns: 1fr 1fr; }
  .channel-business-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 0 10px;
    background: transparent;
  }
  .channel-business-strip div:last-child { border-bottom: 0; }
  .channel-action-grid,
  .channel-sub-grid,
  .channel-sub-actions,
  .channel-sub-price-form,
  .channel-sub-mini-form,
  .channel-customer-mode,
  .channel-new-customer-fields,
  .form-grid-2 { grid-template-columns: 1fr; }
  .channel-sub-body { grid-template-columns: 1fr 1fr; }
  .channel-action-grid > article:nth-child(2),
  .channel-action-grid > article:nth-child(3) {
    grid-row: auto;
    grid-column: auto;
  }
  .channel-order-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .channel-delivery-row {
    grid-template-columns: 1fr;
  }
  .channel-delivery-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    text-align: left;
  }
  .channel-delivery-actions strong,
  .channel-delivery-actions > small {
    grid-column: 1 / -1;
  }
  .channel-fold-row summary {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
  }
  .channel-fold-side {
    justify-content: space-between;
    padding-left: 32px;
    width: 100%;
  }
  .channel-fold-body {
    grid-template-columns: 1fr;
    padding-left: 0;
  }
  .channel-fold-error {
    grid-column: auto;
  }
  .channel-fold-actions {
    justify-content: stretch;
  }
  .channel-customer-fold .channel-fold-actions {
    grid-template-columns: 1fr;
  }
  .channel-fold-actions .mini-link,
  .channel-fold-actions .inline-mini-form,
  .channel-fold-actions button {
    width: 100%;
  }
  .channel-customer-actions,
  .channel-customer-topup-form {
    grid-template-columns: 1fr;
  }
  .channel-topup-request-row,
  .channel-expiry-row,
  .channel-topup-request-actions {
    grid-template-columns: 1fr;
  }
  .channel-topup-request-actions {
    display: grid !important;
  }
  .channel-customer-topup-form {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }
}

@media (max-width: 500px) {
  .channel-portal-stats,
  .channel-portal-grid,
  .channel-business-strip { grid-template-columns: 1fr; }
  .channel-portal-stats .card {
    min-height: 92px;
  }
  .channel-business-strip div {
    min-height: 72px;
  }
}

@media (max-width: 500px) {
  .renewal-meta-grid,
  .renewal-submit-row,
  .renewal-link-row {
    grid-template-columns: 1fr;
  }
  .renewal-service-title {
    font-size: 16px;
  }
  .renewal-work-card {
    padding: 14px;
  }
  .renewal-submit-row,
  .renewal-link-row {
    flex-direction: column;
  }
  .renewal-submit-row button,
  .renewal-link-row .button-link {
    width: 100%;
  }
}

/* Final mobile overrides for the operations dashboard. Keep this at the end. */
@media (max-width: 500px) {
  .dashboard-page {
    gap: 10px;
  }
  .dashboard-page .card {
    padding: 16px;
    margin-bottom: 12px;
  }
  .ops-hero {
    gap: 10px;
    padding: 15px;
    border-radius: 10px;
  }
  .ops-hero h1 {
    font-size: 22px;
    line-height: 1.18;
    margin: 4px 0 6px;
  }
  .ops-hero p {
    font-size: 13px;
    line-height: 1.42;
  }
  .ops-hero .button-link {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    text-align: center;
  }
  .section-kicker {
    font-size: 12px;
  }
  .ops-focus-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .ops-focus-card {
    min-height: 88px;
    padding: 11px;
    gap: 4px;
    border-radius: 9px;
  }
  .ops-focus-card span {
    font-size: 12px;
  }
  .ops-focus-card b {
    font-size: 21px;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }
  .ops-focus-card small {
    font-size: 11px;
    line-height: 1.25;
  }
  .ops-action-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow: visible;
    padding: 0;
  }
  .ops-action-strip .button-link {
    min-height: 40px;
    padding: 9px 8px;
    text-align: center;
    font-size: 13px;
  }
  .todo-panel {
    padding: 13px;
    border-radius: 10px;
  }
  .todo-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .todo-card {
    padding: 10px;
    border-radius: 9px;
  }
  .todo-card-head span {
    font-size: 12px;
  }
  .todo-card-head b {
    font-size: 22px;
  }
  .todo-list {
    gap: 5px;
    margin-top: 8px;
  }
  .todo-item {
    padding-top: 6px;
  }
  .todo-item strong {
    font-size: 13px;
    line-height: 1.25;
  }
  .todo-item small,
  .todo-empty {
    font-size: 11px;
    line-height: 1.25;
  }
  .ops-metric-panel {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .ops-metric-panel > div {
    padding: 12px;
    gap: 4px;
  }
  .ops-metric-panel b {
    font-size: 20px;
    line-height: 1.18;
  }
  .ops-metric-panel small {
    font-size: 12px;
    line-height: 1.35;
  }
  .dashboard-grid,
  .refined-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .compact-section-title {
    margin-bottom: 8px;
  }
  .compact-order-row,
  .channel-rank-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 0;
  }
  .compact-order-row > div:last-child,
  .channel-rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .compact-order-row b,
  .compact-order-row small,
  .channel-rank-row b,
  .channel-rank-row small {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .ops-focus-grid,
  .ops-action-strip,
  .todo-grid {
    grid-template-columns: 1fr;
  }
}

/* Compact operations layout. Keep after page-specific rules so it wins gently. */
@media (min-width: 801px) {
  .sidebar {
    width: 214px;
    padding: 14px 10px;
  }
  .brand-block {
    gap: 10px;
    padding: 0 8px 14px;
  }
  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }
  .brand-block b {
    font-size: 17px;
  }
  .brand-block small,
  .sidebar-user small {
    font-size: 12px;
  }
  .side-nav {
    gap: 5px;
  }
  .nav-section {
    margin: 10px 8px 4px;
    font-size: 10px;
  }
  .side-nav a {
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13px;
  }
  .nav-group {
    border-radius: 8px;
  }
  .nav-group summary {
    min-height: 36px;
    line-height: 36px;
    padding: 0 9px;
    font-size: 12px;
  }
  .nav-group a {
    margin: 0 5px 5px;
    padding: 7px 9px;
  }
  .sidebar-user {
    padding: 12px 8px 0;
  }
  .app-shell {
    margin-left: 214px;
  }
  .topbar {
    min-height: 44px;
    padding: 0 22px;
    font-size: 13px;
  }
  main {
    max-width: 1360px;
    padding: 18px 22px 30px;
  }
  h1 {
    font-size: 24px;
    margin-bottom: 4px;
  }
  h2 {
    font-size: 18px;
  }
  .title-row {
    gap: 12px;
    margin-bottom: 10px;
  }
  .title-row > div > p {
    font-size: 13px;
    line-height: 1.45;
  }
  .card,
  .delivery-card {
    border-radius: 9px;
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .025), 0 5px 16px rgba(15, 23, 42, .028);
  }
  .stats {
    gap: 10px;
    margin-bottom: 14px;
  }
  .stats .card {
    padding: 13px 14px;
  }
  .stats b {
    font-size: 23px;
    line-height: 1.1;
  }
  .stats span {
    margin-top: 4px;
    font-size: 13px;
  }
  label {
    gap: 5px;
    font-size: 13px;
  }
  input,
  select,
  textarea {
    min-height: 36px;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 14px;
  }
  textarea {
    line-height: 1.45;
  }
  button,
  .button-link {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 14px;
  }
  th,
  td {
    padding: 9px 8px;
  }
  table {
    font-size: 13px;
  }
  .flash {
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  .channel-list {
    gap: 10px;
  }
  .channel-card {
    gap: 10px;
  }
  .channel-card-main {
    grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr);
    gap: 12px;
  }
  .channel-card h2 {
    font-size: 18px;
    margin-bottom: 4px;
  }
  .channel-card p {
    font-size: 13px;
    line-height: 1.45;
  }
  .channel-metrics {
    gap: 8px;
  }
  .channel-metrics div {
    padding: 9px 10px;
    border-radius: 7px;
  }
  .channel-price-panel {
    padding: 8px 10px;
    border-radius: 7px;
  }
  .channel-price-panel summary {
    font-size: 14px;
  }
  .channel-bulk-price-panel {
    padding: 8px;
  }
  .channel-country-price-form,
  .channel-duration-price-grid {
    grid-template-columns: 1fr;
  }
  .channel-country-price-head {
    display: grid;
  }
  .channel-bulk-price-form,
  .channel-price-form,
  .channel-wallet-form,
  .channel-edit-form,
  .channel-form {
    gap: 7px;
  }
  .channel-price-list,
  .channel-wallet-ledger {
    max-height: 360px;
    overflow: auto;
    padding-right: 3px;
  }
  .channel-price-row {
    padding: 8px;
  }
}

@media (max-width: 800px) {
  main {
    padding: 14px 10px 24px;
  }
  .card,
  .delivery-card {
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
  }
  .topbar {
    min-height: 48px;
    padding: 0 12px;
  }
  .title-row {
    gap: 8px;
    margin-bottom: 10px;
  }
  .title-row h1 {
    font-size: 22px;
  }
  .stats {
    gap: 8px;
    margin-bottom: 12px;
  }
  .stats .card {
    padding: 12px;
  }
  .stats b {
    font-size: 22px;
  }
  .stats span {
    font-size: 12px;
  }
  .channel-price-panel {
    padding: 10px;
  }
  .channel-price-list,
  .channel-wallet-ledger {
    max-height: 340px;
    overflow: auto;
  }
}

/* Channel console compact reset - final override */
.role-channel .channel-action-grid {
  grid-template-columns: minmax(440px, 1.25fr) minmax(340px, .75fr);
  align-items: start;
  gap: 12px;
}
.role-channel .channel-action-grid > article:nth-child(2) {
  order: 1;
  grid-row: auto;
}
.role-channel .channel-action-grid > article:nth-child(4) {
  order: 2;
}
.role-channel .channel-action-grid > article:nth-child(1) {
  order: 3;
}
.role-channel .channel-action-grid > article:nth-child(3) {
  order: 4;
  grid-column: 1 / -1;
  padding: 12px 14px;
}
.role-channel .channel-action-grid > .card {
  min-height: 0;
  display: block;
}
.role-channel .channel-action-grid .compact-section-title {
  min-height: 0;
  margin-bottom: 10px;
}
.role-channel .channel-order-form,
.role-channel .channel-wallet-topup-card,
.role-channel .channel-customer-form {
  gap: 8px;
}
.role-channel .channel-order-form label,
.role-channel .channel-wallet-topup-card label,
.role-channel .channel-customer-form label {
  font-size: 12px;
}
.role-channel .channel-order-form input,
.role-channel .channel-order-form select,
.role-channel .channel-wallet-topup-card input,
.role-channel .channel-wallet-topup-card select,
.role-channel .channel-customer-form input,
.role-channel .channel-customer-form select {
  min-height: 38px;
}
.role-channel .channel-order-summary {
  padding: 10px;
}
.role-channel .channel-order-summary strong {
  font-size: 24px;
}
.role-channel .channel-action-grid > article:nth-child(3) .compact-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  margin-top: 8px;
  padding: 0;
}
.role-channel .channel-action-grid > article:nth-child(3) .compact-panel > summary {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
}
.role-channel .channel-action-grid > article:nth-child(3) .panel-content {
  padding: 10px 12px 12px;
}
.role-channel .channel-action-grid > article:nth-child(3) .channel-wallet-topup-card {
  grid-template-columns: minmax(260px, 1.5fr) minmax(120px, .5fr) auto;
  align-items: end;
}
.role-channel .channel-action-grid > article:nth-child(3) .channel-wallet-topup-card button {
  min-height: 38px;
}
.role-channel .channel-action-grid > article:nth-child(3) > .hint {
  margin: 8px 0 0;
}
.role-channel #sub-channels {
  padding: 14px;
}
.role-channel #sub-channels .compact-section-title {
  margin-bottom: 10px;
}
.role-channel #sub-channels .channel-sub-grid {
  grid-template-columns: minmax(360px, 680px);
  max-width: 720px;
  gap: 10px;
}
.role-channel #sub-channels .channel-sub-form {
  gap: 8px;
}
.role-channel #sub-channels .channel-sub-form .form-grid-2 {
  gap: 8px;
}
.role-channel #sub-channels .channel-sub-form input,
.role-channel #sub-channels .channel-sub-form button {
  min-height: 38px;
}
.role-channel #sub-channels .channel-sub-list {
  margin-top: 12px;
}
.role-channel #sub-channels .channel-sub-channel-fold {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
  overflow: hidden;
  background: #fff;
}
.role-channel #sub-channels .channel-sub-channel-fold summary {
  min-height: 58px;
  padding: 10px 12px 10px 42px;
  background: #f8fafc;
}
.role-channel #sub-channels .channel-sub-channel-fold summary::before {
  left: 12px;
}
.role-channel #sub-channels .channel-sub-body {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 10px 12px 12px;
  gap: 8px;
}
.role-channel #sub-channels .channel-sub-actions {
  grid-template-columns: minmax(260px, 420px) minmax(260px, 1fr);
  gap: 10px;
}
.role-channel #sub-channels .channel-sub-mini-form {
  grid-template-columns: minmax(110px, .45fr) minmax(140px, 1fr) auto;
}
.role-channel #sub-channels .channel-sub-price-panel {
  padding: 0;
}
.role-channel #sub-channels .channel-sub-price-panel > summary {
  padding: 8px 10px;
}
.role-channel #sub-channels .channel-sub-price-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 8px 10px 10px;
}
.role-channel #sub-channels .channel-sub-price-form button {
  grid-column: auto;
}
.role-channel .channel-people-grid {
  grid-template-columns: minmax(360px, .72fr) minmax(0, 1.28fr);
}
.role-channel .channel-people-grid > article:nth-child(2) {
  order: 0;
}
.role-channel .channel-price-list {
  max-height: 360px;
  overflow: auto;
}
.role-channel .channel-price-row {
  min-height: 56px;
  padding: 10px 12px;
}

@media (max-width: 980px) {
  .role-channel .channel-action-grid,
  .role-channel .channel-portal-grid,
  .role-channel .channel-people-grid,
  .role-channel #sub-channels .channel-sub-actions,
  .role-channel #sub-channels .channel-sub-price-form {
    grid-template-columns: 1fr;
  }
  .role-channel #sub-channels .channel-sub-grid {
    max-width: none;
    grid-template-columns: 1fr;
  }
}

/* self-iteration-4: channel dashboard layout refinement */
.role-channel .channel-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}
.role-channel .channel-workspace-grid > .card {
  padding: 20px;
  border-radius: 12px;
  border-color: #dce4f0;
  box-shadow: 0 18px 50px rgba(20,35,60,.08);
}
.role-channel .channel-workspace-grid .compact-section-title h2,
.role-channel .channel-data-grid .compact-section-title h2 {
  font-size: 22px;
  font-weight: 900;
}
.role-channel .channel-order-card {
  order: 1 !important;
  grid-column: 1;
  grid-row: span 2 !important;
}
.role-channel .channel-wallet-card {
  order: 2 !important;
  grid-column: 2;
}
.role-channel .channel-price-card {
  order: 3 !important;
  grid-column: 1 / -1 !important;
}
.role-channel .channel-create-customer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.role-channel .channel-workspace-grid > .channel-create-customer-modal {
  padding: 20px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.role-channel .channel-create-customer-modal[hidden] {
  display: none !important;
}
.role-channel .channel-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .46);
}
.role-channel .channel-modal-panel {
  position: relative;
  z-index: 1;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  margin: 0 auto;
  padding: 20px;
  border: 1px solid #dce4f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(20,35,60,.08);
}
.role-channel .channel-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  background: #eef4ff;
  color: #334155;
}
.modal-open {
  overflow: hidden;
}
.role-channel .channel-form-section {
  display: grid;
  gap: 16px;
  padding: 16px 0 18px;
  border-bottom: 1px solid #dce4f0;
}
.role-channel .channel-form-section:first-of-type {
  padding-top: 0;
}
.role-channel .channel-form-section-last {
  border-bottom: 0;
  padding-bottom: 0;
}
.role-channel .channel-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
}
.role-channel .channel-section-heading b {
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
}
.role-channel .channel-section-heading span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.role-channel .channel-order-form,
.role-channel .channel-wallet-topup-card,
.role-channel .channel-customer-form {
  gap: 16px;
}
.role-channel .channel-order-form label,
.role-channel .channel-wallet-topup-card label,
.role-channel .channel-customer-form label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
}
.role-channel .channel-order-form input,
.role-channel .channel-order-form select,
.role-channel .channel-wallet-topup-card input,
.role-channel .channel-wallet-topup-card select,
.role-channel .channel-customer-form input,
.role-channel .channel-customer-form select {
  min-height: 42px;
  width: 100%;
}
.role-channel .channel-customer-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.role-channel .channel-customer-mode label {
  min-height: 48px;
  margin: 0;
}
.role-channel .channel-new-customer-fields:not([hidden]) {
  position: fixed;
  z-index: 1001;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
  border: 1px solid #dce4f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(20,35,60,.08);
}
.role-channel .channel-inline-modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  background: #eef4ff;
  color: #64748b;
}
.role-channel .channel-new-customer-fields:not([hidden])::before {
  content: "新建客户并下单";
  grid-column: 1 / -1;
  display: block;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
  font-size: 20px;
  font-weight: 900;
}
.role-channel .channel-order-summary {
  padding: 18px 20px;
  border-color: #dce4f0;
  border-radius: 12px;
  background: #f8fafc;
}
.role-channel .channel-order-summary strong {
  font-size: 32px;
  color: #15803d;
}
.role-channel .channel-submit-order,
.role-channel #channel-submit-order,
.role-channel .channel-wallet-topup-card > button,
.role-channel .channel-customer-form > button {
  width: 100%;
  min-height: 46px;
}
.role-channel .channel-wallet-card .channel-wallet-topup-card {
  gap: 12px;
}
.role-channel .channel-wallet-card .hint {
  margin: 4px 0 0;
}
.role-channel .channel-price-card .compact-panel {
  border: 1px solid #dce4f0;
  border-radius: 8px;
  background: #f8fafc;
}
.role-channel .channel-price-card .compact-panel + .compact-panel {
  margin-top: 10px;
}
.role-channel .channel-price-card .compact-panel > summary {
  padding: 10px 12px;
  font-size: 15px;
}
.role-channel .channel-price-card .panel-content {
  padding: 14px;
}
.role-channel .channel-data-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}
.role-channel .channel-data-grid > .card {
  min-height: 260px;
  padding: 20px;
}
.role-channel .channel-data-grid .compact-order-list,
.role-channel .channel-data-grid .channel-wallet-ledger {
  max-height: 360px;
  overflow: auto;
}
.role-channel .channel-data-grid .channel-fold-row summary {
  min-height: 48px;
}
.role-channel .channel-wallet-ledger {
  gap: 8px;
}
.role-channel .channel-wallet-ledger > div {
  padding: 10px 12px;
}

@media (max-width: 980px) {
  .role-channel .channel-workspace-grid,
  .role-channel .channel-data-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .role-channel .channel-order-card,
  .role-channel .channel-wallet-card,
  .role-channel .channel-price-card {
    grid-column: 1 !important;
    grid-row: auto;
  }
  .role-channel .channel-order-card {
    order: 1 !important;
  }
  .role-channel .channel-wallet-card {
    order: 2 !important;
  }
  .role-channel .channel-price-card {
    order: 3 !important;
  }
}

@media (max-width: 768px) {
  .role-channel .channel-workspace-grid,
  .role-channel .channel-data-grid {
    margin-top: 16px;
  }
  .role-channel .channel-workspace-grid > .card,
  .role-channel .channel-data-grid > .card {
    padding: 16px;
  }
  .role-channel .channel-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .role-channel .channel-section-heading span {
    text-align: left;
  }
  .role-channel .channel-customer-mode,
  .role-channel .channel-new-customer-fields:not([hidden]),
  .role-channel .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .role-channel .channel-order-summary {
    display: grid;
  }
  .role-channel .channel-order-summary strong {
    font-size: 28px;
  }
.role-channel .channel-modal-panel {
    padding: 16px;
  }
}

/* self-iteration-4: order center channel visibility hints */
.order-stats .card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

/* self-iteration-4: customer line service operations */
.line-service-title-actions {
  align-items: center;
  justify-content: flex-end;
}
.manual-origin-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}
.customer-service-item .table-actions {
  align-items: center;
  gap: 8px;
}
.customer-service-item .table-actions > .button-link,
.customer-service-item .table-actions > button,
.customer-service-item .table-actions > form > button,
.customer-service-item .danger-inline > summary {
  min-width: 74px;
  min-height: 38px;
  justify-content: center;
  text-align: center;
}
.history-service-actions {
  justify-content: flex-end;
}
.secondary-danger {
  background: #fff;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.line-duplicate-tools {
  display: grid;
  grid-template-columns: 160px minmax(180px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #dce4f0;
  border-radius: 12px;
  background: #f8fafc;
}
.line-duplicate-tools label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}
.line-service-dialog .dialog-service-body {
  display: grid;
  gap: 18px;
}
.line-service-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.line-service-form .wide-field {
  grid-column: 1 / -1;
}
.line-service-form textarea {
  resize: vertical;
}
.line-service-form input[readonly] {
  background: #f8fafc;
  color: #64748b;
}
@media (max-width: 820px) {
  .line-duplicate-tools,
  .line-service-form {
    grid-template-columns: 1fr;
  }
  .line-service-title-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .customer-service-item .table-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .traffic-chart-dialog {
    width: 96vw;
    padding: 14px;
  }
  .traffic-chart-toolbar {
    display: grid;
    align-items: stretch;
  }
  .traffic-chart-box canvas {
    height: 280px;
  }
}
