/* TV Gestor panel stylesheet — canonical admin/operator/reseller/seller surface. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/SpaceGrotesk-Regular.ttf') format('truetype');
}

@font-face {
  font-family: Roboto;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/Roboto-Regular.ttf') format('truetype');
}

@font-face {
  font-family: Roboto;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/Roboto-SemiBold.ttf') format('truetype');
}

:root {
  --ds-canvas: #f6f8fb;
  --ds-surface: #fff;
  --ds-surface-muted: #f8fafc;
  --ds-ink: #172337;
  --ds-ink-strong: #0f1d31;
  --ds-muted: #687990;
  --ds-subtle: #93a0b1;
  --ds-line: #e2e8f0;
  --ds-line-strong: #cbd6e3;
  --ds-brand: var(--console-accent, var(--public-accent, var(--brand-primary, #2563eb)));
  --ds-brand-deep: color-mix(in srgb, var(--ds-brand) 76%, #10213a);
  --ds-brand-soft: color-mix(in srgb, var(--ds-brand) 10%, #fff);
  --ds-brand-pale: color-mix(in srgb, var(--ds-brand) 4%, #fff);
  --ds-success: #087a59;
  --ds-success-bg: #e8f7f1;
  --ds-warning: #9a6409;
  --ds-warning-bg: #fff4dc;
  --ds-danger: #b33d52;
  --ds-danger-bg: #feecf0;
  --ds-radius-sm: 9px;
  --ds-radius: 14px;
  --ds-radius-lg: 18px;
  --ds-shadow: 0 2px 6px rgba(15, 29, 49, .035), 0 12px 30px rgba(15, 29, 49, .055);
  --ds-shadow-lg: 0 24px 70px rgba(15, 29, 49, .18);
  --ds-font: Roboto, "Segoe UI", sans-serif;
  --ds-display: "Space Grotesk", Roboto, sans-serif;

  /* Compatibility aliases for legacy route fragments that still consume the
     short token vocabulary. Keep them rooted in the active design tokens so
     unscoped utility blocks cannot drift from the visual system. */
  --canvas: var(--ds-canvas);
  --surface: var(--ds-surface);
  --surface-muted: var(--ds-surface-muted);
  --ink: var(--ds-ink);
  --ink-strong: var(--ds-ink-strong);
  --muted: var(--ds-muted);
  --subtle: var(--ds-subtle);
  --line: var(--ds-line);
  --line-strong: var(--ds-line-strong);
  --accent: var(--ds-brand);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ds-canvas);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  color: var(--ds-ink);
  background: var(--ds-canvas);
  font: 400 14px/1.5 var(--ds-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
  font-family: var(--ds-font);
}

button,
input,
select,
textarea {
  font-size: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  flex: 0 0 auto;
}

*[hidden] {
  display: none !important;
}

/* Console shell */
#app>.app-shell {
  --panel: var(--ds-surface);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--ds-canvas);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 248px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  overflow: hidden;
  color: #b6c2d2;
  background: #111d2f;
  border-right: 1px solid #203047;
}

.sidebar-top {
  min-width: 0;
}

.brand {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 9px 18px;
}

.brand-logo-horizontal {
  display: block;
  width: auto;
  max-width: 154px;
  max-height: 34px;
  object-fit: contain;
  object-position: left center;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  color: var(--ds-brand);
  background: #fff;
  border-radius: 10px;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  overflow: hidden;
  color: #f8fbff;
  font: 600 15px/1.15 var(--ds-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  color: #8291a6;
  font-size: 10px;
}

.sidebar-context {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 5px 18px;
  padding: 8px 10px;
  overflow: hidden;
  color: #aebbd0;
  background: #18263b;
  border: 1px solid #263a53;
  border-radius: var(--ds-radius-sm);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.context-dot,
.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #24b889;
  box-shadow: 0 0 0 3px rgba(36, 184, 137, .14);
}

.nav-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 12px;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.nav-group+.nav-group {
  margin-top: 8px;
}

.nav-group {
  padding: 0 0 8px;
  border-bottom: 1px solid rgba(133, 153, 180, .1);
}

.nav-group.has-active {
  border-bottom-color: rgba(99, 133, 174, .23);
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 25px;
  margin: 0 10px 4px;
  color: #7e93ad;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  pointer-events: none;
}

.nav-label .icon {
  width: 15px;
  height: 15px;
  padding: 2px;
  color: #8297b0;
  background: rgba(114, 139, 171, .1);
  border-radius: 4px;
}

.nav-group.has-active .nav-label {
  color: #afc0d5;
}

.nav-group.has-active .nav-label .icon {
  color: #a7bdd8;
  background: rgba(114, 151, 196, .16);
}

.nav-group>.nav-label {
  cursor: default;
}

.nav-group>.nav-label .icon {
  color: #6f86a3;
}

.nav-group-chevron {
  display: none;
}

.nav-group-items {
  display: grid;
  gap: 3px;
  margin-left: 11px;
  padding-left: 10px;
  border-left: 1px solid rgba(133, 153, 180, .16);
}

.nav-link {
  width: 100%;
  min-height: 36px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  color: #a5b4c8;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.nav-link:hover {
  color: #eef4fc;
  background: rgba(121, 149, 184, .11);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ds-brand) 29%, #162a48), color-mix(in srgb, var(--ds-brand) 17%, #15243b));
  box-shadow: inset 2px 0 0 var(--ds-brand), 0 3px 10px rgba(0, 0, 0, .12);
  font-weight: 650;
}

.nav-link .icon {
  flex: 0 0 17px;
  color: #7186a1;
}

.nav-link.active .icon,
.nav-link:hover .icon {
  color: color-mix(in srgb, var(--ds-brand) 66%, #d9e9ff);
}

.nav-active-dot {
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--ds-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-brand) 16%, transparent);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #26364c;
}

.profile-chip {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px;
}

.profile-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.profile-text strong,
.profile-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-text strong {
  color: #f4f7fb;
  font-size: 12px;
}

.profile-text small {
  color: #8594aa;
  font-size: 10px;
}

.avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.avatar.small {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
}

.main-shell {
  height: 100dvh;
  min-height: 0;
  margin-left: 248px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.topbar {
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(22px, 4vw, 52px);
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--ds-line);
  backdrop-filter: blur(14px);
}

.topbar-heading,
.topbar-actions,
.topbar-user,
.button-row {
  display: flex;
  align-items: center;
}

.toast-host {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 160;
  display: grid;
  gap: 9px;
  width: min(380px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  color: #17324a;
  background: #fff;
  border: 1px solid #d5e3ef;
  border-left: 3px solid var(--ds-success);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(18, 44, 72, .16);
  font-size: 12px;
  line-height: 1.4;
  animation: toast-in .18s ease both;
  pointer-events: auto;
}

.toast>svg {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--ds-success);
}

.toast.error {
  color: #64242b;
  border-color: #f1cdd1;
  border-left-color: var(--ds-danger);
  background: #fffafa;
}

.toast.error>svg {
  color: var(--ds-danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar-heading {
  min-width: 0;
  gap: 11px;
}

.topbar-heading>div {
  min-width: 0;
}

.breadcrumb {
  color: var(--ds-subtle);
  font-size: 11px;
}

.breadcrumb span {
  padding: 0 6px;
  color: #c3cedb;
}

.breadcrumb strong {
  color: var(--ds-muted);
  font-weight: 600;
}

.topbar h1 {
  margin: 0;
  overflow: hidden;
  color: var(--ds-ink-strong);
  font: 600 20px/1.15 var(--ds-display);
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  gap: 16px;
}

.topbar-user {
  gap: 8px;
  color: var(--ds-muted);
  font-size: 12px;
}

.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 10px;
  color: var(--ds-success);
  background: var(--ds-success-bg);
  border: 1px solid #c9eddf;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
}

.system-pill b {
  padding-left: 5px;
  color: #5f9584;
  font-weight: 500;
}

.online-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ds-muted);
  font-size: 11px;
}

.mobile-menu {
  display: none;
}

.page-content {
  width: 100%;
  max-width: 1760px;
  margin-inline: auto;
  padding: 28px clamp(22px, 3vw, 48px) 56px;
}

/* Shared page building blocks */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
  padding-bottom: 21px;
  border-bottom: 1px solid var(--ds-line);
}

.page-head-copy {
  min-width: 0;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--ds-brand-deep);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.page-head h2 {
  margin: 0 0 7px;
  color: var(--ds-ink-strong);
  font: 600 clamp(26px, 3vw, 36px)/1.06 var(--ds-display);
  letter-spacing: -.045em;
}

.page-head p {
  max-width: 720px;
  margin: 0;
  color: var(--ds-muted);
  font-size: 13px;
  line-height: 1.55;
}

.page-head-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--ds-radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 48%, var(--ds-line-strong));
  background: var(--ds-brand-pale);
  transform: translateY(-1px);
}

.btn.primary {
  color: #fff;
  background: var(--ds-brand);
  border-color: var(--ds-brand);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--ds-brand) 18%, transparent);
}

.btn.primary:hover {
  color: #fff;
  background: var(--ds-brand-deep);
  border-color: var(--ds-brand-deep);
}

.btn.secondary {
  color: #50647b;
}

.btn.danger {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
  border-color: #f7cfd8;
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
}

.btn.wide {
  width: 100%;
}

.icon-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: #76879d;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-sm);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.icon-button:hover {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-color: color-mix(in srgb, var(--ds-brand) 16%, transparent);
}

.icon-button.danger:hover {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
}

.metrics,
.page-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 20px;
  overflow: hidden;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.metric {
  min-width: 0;
  min-height: 94px;
  padding: 15px 18px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--ds-line);
  border-radius: 0;
  box-shadow: none;
}

.metric:last-child {
  border-right: 0;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ds-muted);
  font-size: 11px;
  font-weight: 600;
}

.metric-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
}

.metric-icon.blue {
  color: #2563eb;
  background: #eaf1ff;
}

.metric-icon.green {
  color: #087a59;
  background: #e6f7f0;
}

.metric-icon.amber {
  color: #9a6409;
  background: #fff2d7;
}

.metric-icon.pink {
  color: #ad4774;
  background: #fdebf3;
}

.metric-icon.purple {
  color: #6f42c1;
  background: #f0e9ff;
}

.metric-value {
  margin-top: 10px;
  color: var(--ds-ink-strong);
  font: 600 23px/1 var(--ds-display);
  letter-spacing: -.035em;
}

.metric-note {
  margin-top: 6px;
  color: var(--ds-subtle);
  font-size: 10px;
}

.panel,
.help-card,
.announcement-card,
.map-panel {
  min-width: 0;
  overflow: hidden;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.panel-head,
.map-panel-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ds-line);
}

.panel-title-block {
  min-width: 0;
}

.panel-head h3,
.map-panel-head h3 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 15px/1.25 var(--ds-display);
  letter-spacing: -.02em;
}

.panel-head p,
.map-panel-head p {
  margin: 5px 0 0;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.5;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 20px;
}

.page-workspace-grid,
.dashboard-lower-grid,
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .34fr);
  align-items: start;
  gap: 16px;
}

.page-workspace-main {
  min-width: 0;
}

.page-workspace-side {
  min-width: 0;
}

.context-rail {
  min-width: 0;
  padding: 22px;
  color: var(--ds-ink);
  background: #17283e;
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.context-rail .eyebrow {
  color: #93b8f7;
}

.context-rail h3 {
  margin: 0 0 10px;
  color: #fff;
  font: 600 19px/1.2 var(--ds-display);
}

.context-rail-body {
  color: #b8c6d8;
  font-size: 12px;
  line-height: 1.6;
}

.context-rail-body p {
  margin: 0;
}

.context-rail-facts {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #2d4058;
}

.context-rail-facts span {
  color: #a4b4c8;
  font-size: 11px;
}

.context-rail-facts b {
  color: #fff;
  font-size: 17px;
  margin-right: 4px;
}

.context-rail-actions {
  margin-top: 19px;
}

.context-rail .btn.secondary {
  color: #dae7f6;
  background: #213650;
  border-color: #36516f;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
}

.table-wrap-empty {
  overflow: hidden;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.data-table-empty {
  min-width: 0;
}

.data-table th {
  height: 43px;
  padding: 10px 19px;
  color: #7f8fa3;
  background: var(--ds-surface-muted);
  border-bottom: 1px solid var(--ds-line);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 19px;
  color: #596d84;
  border-bottom: 1px solid #edf1f5;
  font-size: 12px;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--ds-brand-pale);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table td strong {
  display: block;
  color: var(--ds-ink-strong);
  font-size: 12px;
}

.data-table td small {
  display: block;
  margin-top: 3px;
  color: var(--ds-subtle);
  font-size: 10px;
}

.cell-title,
.check-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.cell-title>span:last-child {
  min-width: 0;
}

.check-cell input,
.client-check-cell input,
input[type=checkbox] {
  accent-color: var(--ds-brand);
}

.table-actions,
.client-actions {
  white-space: nowrap;
  text-align: right;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 24px;
}

.data-table td.table-actions {
  min-width: 168px;
}

.data-table td.table-actions .icon-button,
.data-table td.client-actions .icon-button {
  margin-left: 2px;
}

.status-badge,
.capacity-pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.ok {
  color: var(--ds-success);
  background: var(--ds-success-bg);
}

.status-badge.warn {
  color: var(--ds-warning);
  background: var(--ds-warning-bg);
}

.status-badge.bad {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
}

.status-badge .status-dot {
  width: 5px;
  height: 5px;
  flex-basis: 5px;
  box-shadow: none;
}

.capacity-pill {
  color: var(--ds-success);
  background: var(--ds-success-bg);
}

.capacity-pill.full {
  color: var(--ds-warning);
  background: var(--ds-warning-bg);
}

.tag {
  color: #61748b;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 6px;
}

.empty-state {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  padding: 24px;
  color: var(--ds-muted);
  text-align: center;
}

.empty-icon,
.empty-modal-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 12px;
}

.empty-copy strong {
  color: var(--ds-ink);
  font-size: 13px;
}

.empty-copy p {
  margin: 4px 0 0;
  color: var(--ds-muted);
  font-size: 11px;
}

.empty-state-actions {
  margin-top: 5px;
}

.notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 14px;
  color: #526a83;
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: var(--ds-radius-sm);
  font-size: 12px;
  line-height: 1.5;
}

.notice strong {
  color: var(--ds-brand-deep);
}

.notice-warning {
  color: #7d5a15;
  background: var(--ds-warning-bg);
  border-color: #f1d79c;
}

/* Forms and filters */
.form-grid,
.filter-row,
.client-filter-grid,
.pricing-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: #53677f;
  font-size: 12px;
  font-weight: 600;
}

.field.full,
.form-section-last,
.filter-row>.full {
  grid-column: 1 / -1;
}

.full {
  grid-column: 1 / -1;
}

.field-help,
.field-optional {
  color: var(--ds-subtle);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.45;
}

.input,
.select,
.textarea,
input:not([type=checkbox]):not([type=radio]):not([type=file]),
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--ds-radius-sm);
  outline: 0;
}

.textarea,
textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.input:hover,
.select:hover,
.textarea:hover,
input:hover,
select:hover,
textarea:hover {
  border-color: #aebdcd;
}

.input:focus,
.select:focus,
.textarea:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-brand) 14%, transparent);
}

.input::placeholder,
textarea::placeholder {
  color: #a0adbc;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--ds-line);
  background: #fbfcfe;
}

.form-footer-equal>* {
  min-width: 112px;
}

.filter-panel {
  margin-bottom: 18px;
}

.filter-panel .panel-body {
  padding: 15px 20px;
}

.search-bar {
  width: min(360px, 100%);
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-bar .input {
  min-width: 0;
  flex: 1;
}

.bulk-toolbar,
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--ds-surface-muted);
  border-bottom: 1px solid var(--ds-line);
}

.bulk-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-selection-count {
  color: var(--ds-muted);
  font-size: 11px;
}

.readout {
  min-height: 43px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 9px 11px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
  font-size: 10px;
}

.readout strong {
  color: var(--ds-ink-strong);
  font-size: 12px;
}

.readout small {
  color: var(--ds-subtle);
  font-size: 10px;
}

.code-block {
  max-width: 100%;
  overflow: auto;
  margin-top: 14px;
  padding: 14px;
  color: #c8d8ee;
  background: #14253b;
  border-radius: var(--ds-radius-sm);
  white-space: pre-wrap;
  font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.technical-id {
  color: var(--ds-subtle) !important;
  font: 10px ui-monospace, SFMono-Regular, Consolas, monospace !important;
}

/* System status and dense operational filters */
.system-health-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ds-line);
}

.system-health-row strong {
  min-width: 0;
  flex: 1 1 220px;
  color: var(--ds-ink);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 600;
}

.system-health-list {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  color: var(--ds-muted);
  font-size: 11px;
}

.system-health-list span {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  line-height: 1.45;
}

.system-health-list b {
  color: var(--ds-ink);
  font-weight: 650;
  text-align: right;
}

.client-filter-body {
  display: grid;
  gap: 14px;
}

.client-filter-primary {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) repeat(2, minmax(190px, 1fr));
  gap: 12px;
  align-items: end;
}

.client-filter-primary>.select,
.client-filter-primary .input,
.client-filter-grid>.select,
.client-filter-grid .input,
.client-filter-grid .date-filter .input {
  min-height: 44px;
  height: 44px;
  box-sizing: border-box;
}

.client-filter-primary>* {
  min-width: 0;
}

.client-filter-primary .search-bar {
  width: auto;
}

.client-filter-advanced {
  border-top: 1px solid var(--ds-line);
}

.client-filter-advanced summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 2px 3px;
  color: var(--ds-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  list-style: none;
}

.client-filter-advanced summary::-webkit-details-marker {
  display: none;
}

.client-filter-advanced summary::after {
  content: '+';
  margin-left: auto;
  color: var(--ds-brand);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.client-filter-advanced[open] summary::after {
  content: '\2212';
}

.client-filter-advanced summary span {
  color: var(--ds-subtle);
  font-size: 10px;
  font-weight: 400;
}

.client-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px 12px;
  align-items: end;
  padding: 16px 0 2px;
}

.client-filter-grid .date-filter {
  min-height: 0;
  align-content: end;
}

.client-filter-grid .date-filter>span {
  min-height: 14px;
  display: block;
}

.client-filter-grid>* {
  min-width: 0;
}

.client-filter-grid .compact {
  width: 100%;
  max-width: none;
}

.client-filter-grid .date-filter {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--ds-muted);
  font-size: 10px;
  font-weight: 700;
}

.client-filter-grid .date-filter .input {
  min-width: 0;
  height: 44px;
}

.client-filter-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  justify-self: start;
  padding: 6px 10px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

/* MaxPlayer domains workspace */
.domain-page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
  padding: 24px 26px;
  border: 1px solid color-mix(in srgb, var(--ds-brand) 20%, var(--ds-line));
  border-radius: var(--ds-radius);
  background: linear-gradient(120deg, var(--ds-brand-pale), #fff 68%);
  box-shadow: var(--ds-shadow);
}

.domain-page-hero>div {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.domain-page-hero h3 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 21px/1.2 var(--ds-display);
  letter-spacing: -.02em;
}

.domain-page-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--ds-muted);
  font-size: 12px;
  line-height: 1.65;
}

.domain-provider-select {
  min-width: 0;
  margin: 0;
}

.domain-page-metrics {
  margin-bottom: 18px;
}

.domain-page-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) minmax(150px, .7fr) minmax(180px, .9fr);
  gap: 12px;
  align-items: end;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ds-line);
  background: var(--ds-surface-muted);
}

.domain-page-filters .field {
  min-width: 0;
  margin: 0;
}

.domain-page-filters .search-bar {
  min-width: 0;
}

.domain-table-name {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.domain-table-name>div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.domain-table-name strong {
  overflow: hidden;
  color: var(--ds-ink-strong);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-table-name small {
  overflow: hidden;
  color: var(--ds-muted);
  font: 500 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-table-icon {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--ds-brand);
  background: var(--ds-brand-soft);
}

.domain-usage {
  display: grid;
  gap: 2px;
  min-width: 100px;
}

.domain-usage strong {
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.domain-usage span,
.domain-usage small {
  color: var(--ds-muted);
  font-size: 10px;
}

.domain-usage small {
  margin-top: 2px;
}

.domain-page-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 20px;
}

.domain-page-group-card {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  background: #fff;
}

.domain-page-group-card>div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.domain-page-group-card strong {
  overflow: hidden;
  color: var(--ds-ink-strong);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-page-group-card small {
  color: var(--ds-muted);
  font-size: 10px;
}

.domain-group-actions {
  display: flex !important;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.domain-data-table .domain-table-name small {
  max-width: 260px;
  overflow-wrap: anywhere;
}

/* Credential editor inside the client modal */
.client-access-panel {
  overflow: hidden;
  border-color: var(--ds-line);
  background: #fff;
}

.client-access-panel>.panel-head {
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.client-access-panel>.panel-head>div {
  min-width: 0;
}

.client-access-panel>.panel-head p {
  max-width: 720px;
}

.client-access-content {
  display: grid;
  gap: 0;
}

.access-current,
.access-change {
  min-width: 0;
  padding: 22px 24px 24px;
}

.access-current {
  background: linear-gradient(180deg, #fbfdff, #fff);
}

.access-change {
  border-top: 1px solid var(--ds-line);
  background: #fff;
}

.access-subhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.access-subhead>div {
  min-width: 0;
}

.access-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--ds-brand-deep);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.access-subhead h4 {
  margin: 0 0 5px;
  color: var(--ds-ink-strong);
  font: 600 14px/1.3 var(--ds-display);
}

.access-subhead p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.5;
}

.access-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid #cfeadd;
  border-radius: 999px;
  color: #197958;
  background: #edf9f3;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.access-status-muted {
  border-color: var(--ds-line);
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
}

.client-access-panel .credential-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.client-access-panel .credential-field {
  min-width: 0;
  gap: 8px;
  color: #53657b;
  font-size: 11px;
  font-weight: 700;
}

.client-access-panel .credential-field>span {
  display: flex;
  align-items: baseline;
  min-height: 18px;
  gap: 4px;
  line-height: 1.35;
}

.client-access-panel .credential-field .field-optional {
  color: var(--ds-subtle);
  font-size: 10px;
  font-weight: 500;
}

.client-access-panel .copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.client-access-panel .copy-field .input {
  min-width: 0;
}

.client-access-panel .copy-field .icon-button {
  width: 36px;
  min-width: 36px;
  height: 43px;
  border-color: var(--ds-line);
  background: #fff;
}

.access-change-grid .full {
  grid-column: 1 / -1;
}

.access-guidance {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid #dce8f5;
  border-radius: 9px;
  color: var(--ds-muted);
  background: #f7faff;
}

.access-guidance-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 7px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
}

.access-guidance p {
  margin: 1px 0 0;
  font-size: 10px;
  line-height: 1.55;
}

.access-change-disclosure {
  margin-top: 16px;
  border-top: 1px solid var(--ds-line);
}

.access-change-disclosure>summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin-top: 12px;
  padding: 0 10px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  font-weight: 700;
}

.access-change-disclosure>summary::-webkit-details-marker {
  display: none;
}

.access-change-disclosure[open]>summary {
  color: var(--ds-ink);
  background: var(--ds-surface-muted);
}

.access-change-disclosure .access-change {
  padding: 18px 0 0;
  border-top: 0;
}

.due-date-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.renewal-price-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Keep native file uploads inside the visual language. */
#update-upload-form input[type=file] {
  min-height: 42px;
  padding: 5px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--ds-radius-sm);
  font-size: 11px;
}

#update-upload-form input[type=file]::file-selector-button {
  min-height: 30px;
  margin-right: 8px;
  padding: 5px 10px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line-strong);
  border-radius: 6px;
  font: 600 11px var(--ds-font);
  cursor: pointer;
}

#update-upload-form input[type=file]::file-selector-button:hover {
  color: var(--ds-brand-deep);
  border-color: var(--ds-brand);
  background: var(--ds-brand-pale);
}

.update-package-picker {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--ds-radius-sm);
}

.update-package-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;
}

.update-package-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ds-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modals */
html:has(.modal),
body:has(.modal) {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 23, 40, .64);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(640px, 100%);
  max-height: min(860px, calc(100dvh - 40px));
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d9e3ee;
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-lg);
}

.modal-card.modal-wide {
  width: min(940px, 100%);
}

.modal-head {
  min-height: 73px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--ds-line);
  background: #fff;
}

.modal-head h3 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 18px/1.2 var(--ds-display);
}

.modal-head .eyebrow {
  margin-bottom: 4px;
  font-size: 9px;
}

.modal-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #73849a;
  background: transparent;
  border: 0;
  border-radius: var(--ds-radius-sm);
}

.modal-close:hover {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
}

.modal-body {
  min-height: 0;
  overflow: hidden;
  padding: 20px;
}

.modal-body-framed {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.modal-scroll-content {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  padding: 20px 20px 40px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.modal-body>.form-footer,
.modal-body-framed>.form-footer {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.modal-body-framed>.form-footer {
  box-shadow: 0 -8px 18px rgba(15, 29, 49, .06);
}

.confirm-dialog-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 4px 0 18px;
}

.confirm-dialog-main h4 {
  margin: 0 0 4px;
  color: var(--ds-ink-strong);
  font: 600 16px var(--ds-display);
}

.confirm-dialog-main p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 12px;
}

.confirm-dialog-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  color: var(--ds-warning);
  background: var(--ds-warning-bg);
  border-radius: 11px;
}

.form-section {
  display: block;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--ds-line);
}

.form-section:last-child,
.form-section-last {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.modal .form-section-head {
  margin-bottom: 18px;
}

.modal .form-section-head h4 {
  margin: 0 0 6px;
  color: var(--ds-ink-strong);
  font: 600 14px/1.25 var(--ds-display);
}

.modal .form-section-head p {
  max-width: 620px;
  margin: 0;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.55;
}

.modal-stack {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.modal-stack>.field,
.modal-stack>.readout {
  grid-column: 1 / -1;
  width: 100%;
}

.modal-copy {
  display: grid;
  gap: 5px;
  margin-bottom: 18px;
  padding: 13px 14px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.5;
}

.modal-copy strong {
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.modal-copy span {
  color: var(--ds-muted);
}

.technical-selection-grid {
  align-items: start;
  gap: 14px;
}

.technical-selection-grid .field {
  min-width: 0;
}

.technical-selection-grid .field.full {
  grid-column: 1 / -1;
}

.technical-selection-summary {
  display: grid;
  gap: 3px;
  margin-top: 14px;
  padding: 11px 13px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  line-height: 1.35;
}

.technical-selection-summary>* {
  display: block;
  min-width: 0;
}

.technical-selection-summary span {
  color: var(--ds-subtle);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.technical-selection-summary strong {
  color: var(--ds-ink-strong);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.technical-selection-summary small {
  color: var(--ds-muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.technical-selection-summary.is-empty {
  color: var(--ds-warning-ink, #8a5b00);
  background: var(--ds-warning-bg, #fff7df);
  border-color: #f2d99a;
}

.technical-selection-summary.is-empty strong {
  color: #7a5000;
}

.field select:disabled {
  color: var(--ds-subtle);
  background: var(--ds-surface-muted);
  cursor: not-allowed;
}

.pricing-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.pricing-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pricing-choice {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 20px;
  align-items: start;
  gap: 10px;
  padding: 13px 14px;
  color: var(--ds-muted);
  background: #fff;
  border: 1px solid var(--ds-line-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.pricing-choice:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 48%, var(--ds-line-strong));
  background: var(--ds-brand-pale);
}

.pricing-choice.is-selected {
  color: var(--ds-ink);
  border-color: var(--ds-brand);
  background: var(--ds-brand-pale);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ds-brand) 12%, transparent);
}

.pricing-choice>input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pricing-choice-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 8px;
}

.pricing-choice-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.pricing-choice-copy strong {
  color: var(--ds-ink-strong);
  font-size: 12px;
  line-height: 1.3;
}

.pricing-choice-copy small {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.4;
}

.pricing-choice-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: transparent;
  border: 1px solid var(--ds-line-strong);
  border-radius: 50%;
}

.pricing-choice.is-selected .pricing-choice-check {
  color: #fff;
  background: var(--ds-brand);
  border-color: var(--ds-brand);
}

.provider-type-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.sigma-connection-grid>.field:first-child {
  grid-column: 1 / -1;
}

.referral-coupon-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  width: 100%;
}

.referral-coupon-row>.field {
  min-width: 0;
  width: 100%;
}

.referral-coupon-row>.field .input {
  width: 100%;
  box-sizing: border-box;
}

.permission-editor {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.permission-editor legend {
  padding: 0;
  color: var(--ds-ink-strong);
  font-size: 13px;
  font-weight: 650;
}

.permission-editor-help {
  margin: 5px 0 14px;
  color: var(--ds-muted);
  font-size: 11px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.permission-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ds-ink);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  cursor: pointer;
  font-size: 11px;
}

.permission-option:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 35%, var(--ds-line));
  background: var(--ds-brand-pale);
}

.permission-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  accent-color: var(--ds-brand);
}

.permission-option span {
  overflow-wrap: anywhere;
}

.permission-option input:focus-visible {
  outline: 2px solid var(--ds-brand);
  outline-offset: 2px;
}

.technical-number-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.technical-number-grid .field {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 42px minmax(15px, auto);
  gap: 7px;
}

.technical-number-grid .field .input,
.technical-number-grid .field .select {
  height: 42px;
  min-height: 42px;
}

.technical-number-grid .field-help {
  min-height: 15px;
}

.notice-section {
  margin-top: 18px;
}

.permission-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  color: var(--ds-ink);
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: 9px;
}

.permission-card>span {
  display: grid;
  gap: 3px;
}

.permission-card strong {
  color: var(--ds-ink-strong);
  font-size: 11px;
}

.permission-card small {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.45;
  font-weight: 400;
}

.security-password-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.member-form .form-grid>.field {
  min-height: 78px;
  align-content: start;
}

.member-form .form-grid>.field .field-help {
  min-height: 15px;
}

.member-form .form-grid>.field input {
  height: 44px;
  box-sizing: border-box;
}


.proxy-list {
  display: grid;
  gap: 9px;
}

.proxy-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 90px;
  padding: 20px;
  color: var(--ds-subtle);
  border: 1px dashed var(--ds-line-strong);
  border-radius: 9px;
  background: var(--ds-surface-muted);
  text-align: center;
}

.proxy-empty span {
  color: var(--ds-muted);
  font-size: 11px;
}

.proxy-empty small {
  color: var(--ds-subtle);
  font-size: 10px;
}

.proxy-row {
  overflow: hidden;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fff;
}

.proxy-row[open] {
  border-color: color-mix(in srgb, var(--ds-brand) 34%, var(--ds-line));
  box-shadow: 0 7px 20px rgba(25, 51, 88, .06);
}

.proxy-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.proxy-summary::-webkit-details-marker {
  display: none;
}

.proxy-summary-main,
.proxy-summary-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.proxy-summary-main>span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.proxy-summary-main strong {
  overflow: hidden;
  color: var(--ds-ink-strong);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-summary-main small {
  color: var(--ds-muted);
  font-size: 10px;
}

.proxy-summary-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 8px;
}

.proxy-summary-side {
  justify-content: flex-end;
  color: var(--ds-muted);
  font-size: 10px;
  white-space: nowrap;
}

.proxy-priority,
.proxy-summary-status {
  padding: 5px 7px;
  border-radius: 999px;
  background: var(--ds-surface-muted);
}

.proxy-summary-status.is-active {
  color: var(--ds-success);
  background: var(--ds-success-bg);
}

.proxy-chevron {
  transition: transform .15s ease;
}

.proxy-row[open] .proxy-chevron {
  transform: rotate(-90deg);
}

.proxy-editor {
  padding: 15px;
  border-top: 1px solid var(--ds-line);
  background: var(--ds-surface-muted);
}

.proxy-fields {
  gap: 12px;
}

.proxy-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--ds-line);
}

/* Login */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  overflow: auto;
  background: var(--ds-canvas);
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: clamp(34px, 5vw, 72px);
  color: #fff;
  background: #142943;
  border-right: 1px solid #263d59;
}

.login-brand .brand {
  padding: 0;
}

.login-brand .brand-copy strong {
  color: #fff;
}

.login-brand .eyebrow {
  color: #b7d0ff;
}

.login-brand h1 {
  max-width: 520px;
  margin: 30px 0 14px;
  font: 600 clamp(2.45rem, 4vw, 4.25rem)/1.03 var(--ds-display);
  letter-spacing: -.055em;
}

.login-brand p {
  max-width: 520px;
  margin: 0;
  color: #b9c8d9;
  font-size: 15px;
  line-height: 1.65;
}

.login-foot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #9eafc2;
  font-size: 12px;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 6vw, 88px);
  background: #f8fafc;
}

.login-card {
  width: min(430px, 100%);
  padding: 34px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-lg);
}

.login-card h2 {
  margin: 0 0 8px;
  color: var(--ds-ink-strong);
  font: 600 32px/1.1 var(--ds-display);
  letter-spacing: -.04em;
}

.login-card>p {
  margin: 0 0 25px;
  color: var(--ds-muted);
  font-size: 13px;
}

.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 22px;
  color: var(--ds-muted);
  font-size: 11px;
}

.remember-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.link-button,
.client-recovery-link {
  padding: 0;
  color: var(--ds-brand-deep);
  background: none;
  border: 0;
  font-size: 11px;
}

/* Portal */
body:has(.portal-shell),
body:has(.client-login-shell) {
  background: var(--ds-canvas);
}

.brand-bar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 6vw, 72px);
  background: #fff;
  border-bottom: 1px solid var(--ds-line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ds-ink-strong);
}

.brand-lockup .brand-logo-horizontal {
  max-width: 170px;
  max-height: 34px;
}

.brand-lockup .brand-fallback-mark,
.brand-lockup .brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 10px;
}

.brand-lockup strong {
  font: 600 15px var(--ds-display);
}

.brand-name-accessible {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.brand-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.secure-label {
  color: var(--ds-success);
  font-size: 11px;
}

.portal-alert-button,
.portal-logout {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  color: var(--ds-muted);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  font-size: 11px;
}

.portal-logout:hover,
.portal-alert-button:hover {
  color: var(--ds-brand-deep);
  border-color: color-mix(in srgb, var(--ds-brand) 32%, var(--ds-line));
  background: var(--ds-brand-pale);
}

.portal-shell {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding-bottom: 70px;
}

.portal-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 46px 0 24px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.portal-intro-copy {
  min-width: 0;
}

.portal-intro h1 {
  margin: 0 0 7px;
  color: var(--ds-ink-strong);
  font: 600 clamp(30px, 3vw, 38px)/1.06 var(--ds-display);
  letter-spacing: -.055em;
}

.portal-intro p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 13px;
}

.portal-intro-status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  color: var(--ds-muted);
}

.portal-intro-status-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ds-success);
  background: var(--ds-success-bg);
  border-radius: 50%;
}

.portal-intro-status strong,
.portal-intro-status small {
  display: block;
}

.portal-intro-status strong {
  color: var(--ds-ink);
  font-size: 12px;
}

.portal-intro-status small {
  margin-top: 2px;
  color: var(--ds-subtle);
  font-size: 10px;
}

.portal-tabs {
  display: flex;
  gap: 4px;
  overflow: auto;
  margin-bottom: 18px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
}

.portal-tabs button {
  min-height: 38px;
  padding: 8px 14px;
  color: var(--ds-muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
}

.portal-tabs button[aria-selected="true"] {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
}

.portal-tabs button:hover,
.portal-tabs button.active {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 16px;
  padding: 25px 27px;
  color: #fff;
  background: #172b46;
  border: 1px solid #294765;
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow);
}

.portal-hero h2 {
  margin: 0 0 7px;
  color: #fff;
  font: 600 25px/1.1 var(--ds-display);
  letter-spacing: -.035em;
}

.portal-hero p {
  margin: 0;
  color: #b7c7d9;
  font-size: 12px;
}

.portal-metric-strip,
.portal-action-grid,
.affiliate-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.portal-metric-strip {
  margin-bottom: 16px;
}

.portal-metric-strip>div,
.portal-action-card,
.portal-focus-card,
.section-panel,
.portal-help-card,
.affiliate-stat-card,
.affiliate-withdraw-panel,
.affiliate-how {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.portal-metric-strip>div {
  padding: 16px;
}

.portal-metric-strip strong {
  display: block;
  margin-top: 8px;
  color: var(--ds-ink-strong);
  font: 600 24px var(--ds-display);
}

.portal-metric-strip span {
  color: var(--ds-muted);
  font-size: 11px;
}

.portal-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.portal-action-card {
  min-height: 106px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 17px;
  color: var(--ds-ink);
  text-align: left;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.portal-action-card:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 40%, var(--ds-line));
  box-shadow: 0 14px 28px color-mix(in srgb, var(--ds-brand) 10%, transparent);
  transform: translateY(-1px);
}

.portal-action-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 9px;
}

.portal-action-card strong,
.portal-action-card small {
  display: block;
}

.portal-action-card strong {
  margin-bottom: 3px;
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.portal-action-card small {
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.45;
}

.portal-overview-lower,
.affiliate-lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .38fr);
  gap: 16px;
  align-items: start;
}

.section-panel {
  overflow: hidden;
}

.section-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ds-line);
}

.section-panel-head h2 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 16px var(--ds-display);
}

.section-panel-head p {
  margin: 4px 0 0;
  color: var(--ds-muted);
  font-size: 11px;
}

.section-panel> :not(.section-panel-head) {
  padding-left: 20px;
  padding-right: 20px;
}

.portal-notice-list,
.portal-help-library {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.portal-notice-card {
  padding: 14px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 10px;
}

.portal-notice-card h3 {
  margin: 9px 0 5px;
  color: var(--ds-ink-strong);
  font: 600 14px var(--ds-display);
}

.portal-notice-card p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.portal-notice-card small {
  display: block;
  margin-top: 10px;
  color: var(--ds-subtle);
  font-size: 10px;
}

.client-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 23, 40, .64);
  backdrop-filter: blur(6px);
}

html:has(.client-modal),
body:has(.client-modal) {
  overflow: hidden;
}

.client-modal-card {
  width: min(620px, 100%);
  max-height: min(860px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d9e3ee;
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-lg);
}

.client-modal-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--ds-line);
}

.client-modal-head h2 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 18px var(--ds-display);
}

.client-modal-body,
.portal-article-content {
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.close-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--ds-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.close-button:hover {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
}

/* Customer sign in */
.client-login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(400px, .96fr);
  background: var(--ds-canvas);
}

.client-login-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 7vw, 88px);
  color: #fff;
  background: #142943;
}

.client-login-visual .client-login-brand {
  max-width: 500px;
}

.client-login-brand-neutral {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.client-login-brand-neutral>span:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.client-login-brand-neutral strong {
  color: #fff;
  font: 600 16px/1.15 var(--ds-display);
}

.client-login-brand-neutral small {
  color: rgba(255, 255, 255, .66);
  font-size: 10px;
  line-height: 1.2;
}

.client-login-neutral-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  color: #b9d3ff;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 11px;
}

.client-login-visual h1 {
  margin: 30px 0 12px;
  color: #fff;
  font: 600 clamp(2.4rem, 5vw, 4.7rem)/1.02 var(--ds-display);
  letter-spacing: -.06em;
}

.client-login-visual p {
  max-width: 460px;
  margin: 0;
  color: #b9c8d9;
  font-size: 14px;
  line-height: 1.6;
}

.client-login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 6vw, 84px);
  background: #f8fafc;
}

.client-login-card {
  width: min(430px, 100%);
  padding: 34px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-lg);
}

.client-login-card h2 {
  margin: 0 0 8px;
  color: var(--ds-ink-strong);
  font: 600 30px var(--ds-display);
  letter-spacing: -.04em;
}

.client-login-card>p {
  margin: 0 0 24px;
  color: var(--ds-muted);
  font-size: 13px;
}

.portal-field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
  color: #53677f;
  font-size: 12px;
  font-weight: 600;
}

.portal-field input {
  min-height: 44px;
}

.client-login-submit {
  width: 100%;
  min-height: 44px;
}

.client-login-error,
.client-login-success {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11px;
}

.client-login-error {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
  border: 1px solid #f4cbd5;
}

.client-login-success {
  color: var(--ds-success);
  background: var(--ds-success-bg);
  border: 1px solid #c9eddf;
}

/* Migration workspace: keep operational status, route and cleanup steps readable. */
.migration-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.migration-overview>div {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-surface);
  box-shadow: var(--ds-shadow);
}

.migration-overview>div>div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.migration-overview strong {
  color: var(--ds-ink-strong);
  font: 700 20px/1 var(--ds-display);
}

.migration-overview small {
  color: var(--ds-muted);
  font-size: 10px;
}

.migration-overview-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
}

.migration-overview-icon.is-blue {
  color: var(--ds-brand);
  background: var(--ds-brand-soft);
}

.migration-overview-icon.is-green {
  color: #158263;
  background: #e8f8f1;
}

.migration-overview-icon.is-amber {
  color: #a36b11;
  background: #fff4dd;
}

.migration-top-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
}

.migration-top-note>div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.migration-top-note strong,
.migration-top-note span {
  display: block;
  line-height: 1.45;
}

.migration-top-note span {
  color: var(--ds-muted);
  font-size: 11px;
}

.migration-top-note .notice-icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--ds-brand);
  background: var(--ds-brand-soft);
}

.migration-history-panel {
  overflow: hidden;
}

.migration-batch-list {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--ds-surface-muted);
}

.migration-batch {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-surface);
  box-shadow: var(--ds-shadow);
}

.migration-batch-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--ds-line);
}

.migration-batch-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.migration-batch-title>div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.migration-batch-title strong {
  overflow: hidden;
  color: var(--ds-ink-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.migration-batch-title small {
  color: var(--ds-muted);
  font-size: 10px;
}

.migration-batch-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  color: var(--ds-brand);
  background: var(--ds-brand-soft);
  border-radius: 9px;
}

.migration-batch-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 18px 7px;
}

.migration-batch-intro>div:first-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.migration-batch-intro strong {
  color: var(--ds-ink-strong);
  font: 700 15px/1.2 var(--ds-display);
}

.migration-batch-intro p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.45;
}

.migration-sequence {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
  color: var(--ds-muted);
  font-size: 9px;
}

.migration-sequence span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.migration-sequence b {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--ds-brand);
  background: var(--ds-brand-soft);
  font-size: 9px;
}

.migration-sequence i {
  color: #b4c0cc;
  font-style: normal;
}

.migration-batch-route {
  display: block;
  padding: 10px 18px 4px;
}

.migration-route-stack {
  display: grid;
  gap: 9px;
}

.migration-route-block {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fbfcfe;
}

.migration-route-block-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: var(--ds-ink);
  font-size: 10px;
}

.migration-route-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  color: var(--ds-brand);
  background: var(--ds-brand-soft);
}

.migration-route-points {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.migration-route-point {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.migration-route-point small {
  color: var(--ds-subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.migration-route-point strong,
.migration-route-point span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.migration-route-point strong {
  color: #334d69;
  font: 700 11px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.migration-route-point span {
  color: var(--ds-muted);
  font-size: 9px;
}

.migration-route-arrow {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--ds-brand);
  background: var(--ds-brand-soft);
}

.migration-batch-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 18px;
}

.migration-batch-stats>div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #edf1f5;
  border-radius: 8px;
  background: #fff;
}

.migration-batch-stats span {
  color: var(--ds-muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.migration-batch-stats strong {
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.migration-batch-stats strong.is-success {
  color: #14795e;
}

.migration-batch-stats strong.is-failed {
  color: var(--ds-danger);
}

.migration-batch-progress {
  display: grid;
  gap: 6px;
  padding: 4px 18px 17px;
}

.migration-batch-progress .progress-track {
  margin: 0;
}

.migration-batch-progress>div:last-child {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.migration-batch-progress small {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.4;
}

.migration-batch-progress .error-note {
  max-width: 60%;
  color: var(--ds-danger);
  text-align: right;
}

.migration-details {
  border: 0;
  border-top: 1px solid var(--ds-line);
  border-radius: 0;
  overflow: hidden;
  background: #fff;
}

.migration-details>summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 0 18px;
  color: var(--ds-ink);
  background: #fbfcfe;
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  font-weight: 700;
}

.migration-details>summary::-webkit-details-marker {
  display: none;
}

.migration-details>summary span {
  flex: 1;
}

.migration-details>summary em {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  font-size: 9px;
  font-style: normal;
  font-weight: 750;
  white-space: nowrap;
}

.migration-details[open]>summary {
  border-bottom: 1px solid var(--ds-line);
  color: var(--ds-brand);
  background: var(--ds-brand-pale);
}

.migration-details>summary .icon {
  transition: transform .16s ease;
}

.migration-details[open]>summary .icon {
  transform: rotate(-90deg);
}

.migration-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ds-line);
}

.migration-detail-toolbar>div:first-child {
  display: grid;
  gap: 4px;
}

.migration-detail-toolbar strong {
  color: var(--ds-ink);
  font-size: 12px;
}

.migration-detail-toolbar span {
  color: var(--ds-muted);
  font-size: 10px;
}

.migration-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.migration-all-clear {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: #14795e !important;
  background: #e8f8f1;
  font-weight: 700;
}

.migration-items {
  display: grid;
  gap: 10px;
  padding: 14px 22px 22px;
  background: var(--ds-surface-muted);
}

.migration-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 62px;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fff;
}

.migration-item-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.migration-item-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.migration-item-name {
  min-width: 0;
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
}

.migration-item-name strong,
.migration-item-account {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.migration-item-name strong {
  color: var(--ds-ink);
  font-size: 12px;
}

.migration-item-account {
  color: var(--ds-muted);
  font: 600 10px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.migration-state {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 23px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}

.migration-state.is-success {
  color: #14795e;
  background: #e8f8f1;
}

.migration-state.is-failed {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
}

.migration-item-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  color: var(--ds-muted);
  font-size: 10px;
}

.migration-item-meta span+span {
  padding-left: 9px;
  border-left: 1px solid #dce4ed;
}

.migration-item-state {
  display: grid;
  justify-items: end;
  gap: 3px;
  padding-top: 2px;
  text-align: right;
}

.migration-item-state strong {
  color: var(--ds-ink);
  font-size: 16px;
}

.migration-item-state small {
  color: var(--ds-muted);
  font-size: 9px;
  white-space: nowrap;
}

.migration-safety-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 22px 0;
  padding: 12px 13px;
  border: 1px solid #d8e8e1;
  border-radius: 9px;
  color: #496b62;
  background: #f2faf6;
}

.migration-safety-note>div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.migration-safety-note strong {
  color: #286b59;
  font-size: 10px;
}

.migration-safety-note p {
  margin: 0;
  color: #67847b;
  font-size: 10px;
  line-height: 1.5;
}

.migration-safety-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  color: #18825f;
  background: #dff4e9;
}

.migration-empty {
  margin: 14px 22px 22px;
  padding: 28px;
  border: 1px dashed var(--ds-line-strong);
  border-radius: 10px;
  color: var(--ds-muted);
  background: #fbfcfe;
  text-align: center;
  font-size: 11px;
}

/* Communication templates: make ownership and editability explicit. */
.template-channel-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.template-library-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  padding: 22px 24px;
  border: 1px solid var(--ds-line);
  border-radius: 12px;
  background: linear-gradient(115deg, var(--ds-brand-pale), var(--ds-surface) 68%);
}

.template-library-intro.is-reseller {
  background: linear-gradient(115deg, #eef8f3, var(--ds-surface) 68%);
}

.template-library-intro-copy {
  min-width: 0;
}

.template-library-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ds-brand-deep);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.template-library-intro.is-reseller .template-library-kicker {
  color: var(--ds-success);
}

.template-library-intro h3 {
  margin: 10px 0 5px;
  color: var(--ds-ink-strong);
  font-size: 19px;
  line-height: 1.25;
}

.template-library-intro p,
.template-library-intro small {
  display: block;
  max-width: 680px;
  margin: 0;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.6;
}

.template-library-intro small {
  margin-top: 5px;
  font-size: 10px;
}

.template-library-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
}

.template-library-stats>div {
  display: grid;
  gap: 7px;
  min-width: 82px;
  padding: 11px 12px;
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--ds-surface) 90%, transparent);
}

.template-library-stats span {
  color: var(--ds-muted);
  font-size: 9px;
  line-height: 1.25;
}

.template-library-stats strong {
  color: var(--ds-ink-strong);
  font-size: 19px;
  line-height: 1;
}

.template-filter-panel {
  margin-bottom: 16px;
}

.template-filter-panel .panel-head {
  padding-bottom: 0;
}

.template-filter-panel .panel-head h3,
.template-filter-panel .panel-head p {
  margin: 0;
}

.template-filter-panel .panel-head p {
  margin-top: 4px;
  color: var(--ds-muted);
  font-size: 10px;
}

.template-filter-panel .panel-body {
  padding-top: 14px;
}

.template-management-filters {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 8px;
}

.template-management-filters .field {
  margin-bottom: 0;
}

.template-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 180px;
}

.template-scope-badge,
.template-readonly-action {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 3px 7px;
  border: 1px solid var(--ds-line-strong);
  border-radius: 999px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
  white-space: nowrap;
}

.template-scope-badge.is-global {
  color: var(--ds-brand-deep);
  border-color: color-mix(in srgb, var(--ds-brand) 24%, var(--ds-line));
  background: var(--ds-brand-soft);
}

.template-scope-badge.is-owned {
  color: var(--ds-success);
  border-color: #b9e5d4;
  background: var(--ds-success-bg);
}

.template-scope-badge.is-reference,
.template-readonly-action {
  color: var(--ds-warning);
  border-color: #efd797;
  background: var(--ds-warning-bg);
}

.template-readonly-action {
  font-weight: 600;
}

/* Common dense modules */
.api-doc-layout,
.white-label-layout,
.affiliate-layout,
.payments-layout,
.template-channel-layout,
.settings-stack {
  display: grid;
  gap: 16px;
}

.template-channel-layout {
  grid-template-columns: minmax(0, 1fr);
}

.api-documentation,
.article-view,
.content-section,
.help-card,
.announcement-card {
  min-width: 0;
}

.api-hero,
.operation-hero,
.hero-panel {
  padding: 24px 26px;
  color: #fff;
  background: #172b46;
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow);
}

.api-hero h2,
.operation-hero h2,
.hero-panel h2 {
  margin: 0;
  color: #fff;
  font: 600 25px var(--ds-display);
}

.api-hero p,
.operation-hero p,
.hero-panel p {
  color: #bdcada;
  font-size: 12px;
}

.help-grid,
.announcement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.help-card,
.announcement-card {
  padding: 18px;
}

.help-card h3,
.announcement-card h3 {
  margin: 12px 0 7px;
  color: var(--ds-ink-strong);
  font: 600 16px var(--ds-display);
}

.help-card p,
.announcement-card p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 12px;
  line-height: 1.6;
}

.help-card-footer,
.announcement-meta,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--ds-line);
}

.help-card-footer small,
.announcement-meta {
  color: var(--ds-subtle);
  font-size: 10px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  margin-bottom: 7px;
  background: #e8edf3;
  border-radius: 999px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--ds-brand);
  border-radius: inherit;
}

/* Operational dashboard */
.dashboard-actions,
.action-strip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.operation-hero {
  min-height: 138px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center;
  gap: 24px;
  overflow: hidden;
  margin-bottom: 16px;
}

.operation-hero-copy {
  position: relative;
  z-index: 1;
}

.operation-hero .hero-eyebrow {
  color: #8fb9ff;
}

.operation-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 15px;
  color: #aebfd2;
  font-size: 10px;
}

.operation-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.operation-hero-meta i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38d6a1;
}

.operation-hero-orbit {
  width: 96px;
  height: 96px;
  justify-self: end;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  box-shadow: inset 0 0 0 13px rgba(255, 255, 255, .03), inset 0 0 0 28px rgba(255, 255, 255, .025);
}

.operation-map {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  align-items: stretch;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-lower-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr);
  margin-bottom: 16px;
}

.map-index {
  color: var(--ds-brand-deep);
  font: 600 12px var(--ds-display);
}

.operation-node-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.operation-node {
  min-height: 82px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  padding: 12px;
  color: var(--ds-ink);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 11px;
  text-align: left;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.operation-node:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 38%, var(--ds-line));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--ds-brand) 8%, transparent);
  transform: translateY(-1px);
}

.operation-node-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #2563eb;
  background: #eaf1ff;
  border-radius: 10px;
}

.operation-node.teal .operation-node-icon {
  color: #087a59;
  background: var(--ds-success-bg);
}

.operation-node.amber .operation-node-icon {
  color: var(--ds-warning);
  background: var(--ds-warning-bg);
}

.operation-node.rose .operation-node-icon {
  color: #ad4774;
  background: #fdebf3;
}

.operation-node-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.operation-node-copy small,
.operation-node-copy em {
  overflow: hidden;
  color: var(--ds-muted);
  font-size: 10px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operation-node-copy strong {
  color: var(--ds-ink-strong);
  font: 600 15px var(--ds-display);
}

.operation-node-arrow {
  color: var(--ds-subtle);
}

.signal-list {
  display: grid;
  padding: 7px 14px 12px;
}

.signal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  padding: 12px 7px;
  color: var(--ds-ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ds-line);
  text-align: left;
}

.signal-row:last-child {
  border-bottom: 0;
}

.signal-row:hover {
  background: var(--ds-brand-pale);
}

.signal-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
}

.signal-row span i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ds-success);
}

.signal-row.warn span i {
  background: var(--ds-warning);
}

.signal-row.bad span i {
  background: var(--ds-danger);
}

.signal-row strong {
  font: 600 13px var(--ds-display);
}

.signal-row small {
  grid-column: 1 / -1;
  padding-left: 15px;
  color: var(--ds-muted);
  font-size: 10px;
}

.next-step-list {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.next-step-list button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 11px;
  color: var(--ds-ink);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  text-align: left;
}

.next-step-list button:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 34%, var(--ds-line));
  background: var(--ds-brand-pale);
}

.next-step-list button>span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 9px;
}

.next-step-list b {
  font-size: 11px;
}

.next-step-list small {
  grid-column: 2;
  color: var(--ds-muted);
  font-size: 10px;
}

.next-step-list button>svg {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--ds-subtle);
}

/* API documentation */
.api-page-stack {
  display: grid;
  gap: 16px;
}

.api-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.api-hero>div:first-child {
  min-width: 0;
}

.api-hero-endpoint {
  width: min(400px, 44%);
  min-width: 290px;
  display: grid;
  gap: 8px;
  padding: 15px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid #d8e3ee;
  border-radius: 10px;
}

.api-hero-endpoint>span {
  color: var(--ds-subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.api-hero-endpoint code {
  color: #294766;
  overflow-wrap: anywhere;
  font: 600 11px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.api-documentation .panel-body {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.doc-section {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 0 0 24px 42px;
  border-bottom: 1px solid var(--ds-line);
}

.doc-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.doc-kicker {
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--ds-brand-deep);
  font: 600 11px var(--ds-display);
}

.doc-section h3 {
  margin: 0 0 8px;
  color: var(--ds-ink-strong);
  font: 600 17px var(--ds-display);
}

.doc-section h4,
.doc-section h5 {
  margin: 18px 0 7px;
  color: var(--ds-ink-strong);
}

.doc-intro,
.doc-section p,
.doc-section li {
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.65;
}

.api-start-grid,
.api-status-grid,
.api-scope-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.api-start-grid>*,
.api-status-grid>*,
.api-scope-cards article {
  min-width: 0;
  padding: 11px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  font-size: 10px;
}

.api-status-grid span {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.api-status-grid b {
  color: #294766;
}

.api-route-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  margin-top: 14px;
}

.api-route-tool-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.api-route-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.api-route-doc {
  overflow: hidden;
  margin: 0;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
}

.api-route-doc[open] {
  border-color: color-mix(in srgb, var(--ds-brand) 30%, var(--ds-line));
  box-shadow: var(--ds-shadow);
}

.api-route-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  align-items: center;
  padding: 13px 14px;
  background: var(--ds-surface-muted);
  cursor: pointer;
  list-style: none;
}

.api-route-head::-webkit-details-marker {
  display: none;
}

.api-route-head>div {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.api-route-head>p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ds-muted);
  font-size: 10px;
}

.api-route-toggle {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--ds-muted);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 7px;
}

.api-route-body {
  padding: 15px;
}

.api-doc-table-wrap {
  overflow: auto;
}

.api-doc-table {
  width: 100%;
  border-collapse: collapse;
}

.api-doc-table th,
.api-doc-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--ds-line);
  color: var(--ds-muted);
  font-size: 10px;
  text-align: left;
  vertical-align: top;
}

.api-doc-table th {
  color: var(--ds-ink);
  background: var(--ds-surface-muted);
}

.api-note {
  padding: 10px 12px;
  color: var(--ds-muted);
  background: var(--ds-brand-pale);
  border-left: 3px solid var(--ds-brand);
}

.scope-fieldset {
  margin: 0;
  padding: 13px;
  border: 1px solid var(--ds-line);
  border-radius: 9px;
}

.scope-fieldset legend {
  padding: 0 6px;
  color: var(--ds-ink);
  font-size: 11px;
  font-weight: 600;
}

.scope-picker,
.scope-list {
  display: grid;
  gap: 8px;
}

.scope-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.scope-option span {
  display: grid;
  gap: 2px;
}

.scope-option strong {
  color: var(--ds-ink);
  font-size: 11px;
}

.scope-option small {
  color: var(--ds-muted);
  font-size: 10px;
}

/* Portal content */
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--ds-radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}

.button:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 42%, var(--ds-line-strong));
  background: var(--ds-brand-pale);
  transform: translateY(-1px);
}

.button.primary {
  color: #fff;
  background: var(--ds-brand);
  border-color: var(--ds-brand);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--ds-brand) 18%, transparent);
}

.button.primary:hover {
  color: #fff;
  background: var(--ds-brand-deep);
  border-color: var(--ds-brand-deep);
}

.button.secondary {
  color: #50647b;
}

.button.danger {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
  border-color: #f5ccd5;
}

.button.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
}

.portal-view {
  display: none;
  padding-top: 0;
}

.portal-view.active {
  display: block;
}

.portal-hero {
  min-height: 174px;
}

.portal-hero-copy {
  min-width: 0;
}

.hero-kicker {
  color: #a6b8cc;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.portal-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 13px;
  color: #bdcad9;
  font-size: 11px;
}

.portal-hero-meta strong {
  color: #fff;
}

.portal-hero-side {
  min-width: 190px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
}

.portal-hero-side span,
.portal-hero-side small {
  color: #b8c7d8;
  font-size: 10px;
}

.portal-hero-side strong {
  color: #fff;
  font: 600 22px var(--ds-display);
}

.portal-metric-strip>div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
}

.portal-metric-icon {
  grid-row: 1 / span 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 9px;
}

.portal-metric-strip>div strong {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-section-heading {
  margin: 24px 0 13px;
}

.portal-section-heading h2 {
  margin: 4px 0;
  color: var(--ds-ink-strong);
  font: 600 19px var(--ds-display);
}

.portal-section-heading p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 11px;
}

.portal-action-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portal-action-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: start;
}

.portal-action-card>span:nth-child(2) {
  min-width: 0;
}

.portal-action-card>b {
  color: var(--ds-brand-deep);
  font-size: 17px;
  font-weight: 400;
}

.portal-focus-card {
  padding: 20px;
}

.focus-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--ds-success);
  background: var(--ds-success-bg);
  border-radius: 50%;
}

.focus-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 0;
  color: var(--ds-muted);
  border-top: 1px solid var(--ds-line);
  font-size: 11px;
}

.focus-line strong {
  color: var(--ds-ink-strong);
  font-size: 12px;
  text-align: right;
}

.focus-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  margin-top: 13px;
  padding: 12px 13px;
  color: #7f611f;
  background: var(--ds-warning-bg);
  border: 1px solid #efd797;
  border-radius: 9px;
}

.focus-alert strong {
  font-size: 11px;
}

.focus-alert span {
  font-size: 10px;
}

.focus-alert .button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.portal-help-card {
  display: grid;
  align-content: center;
  padding: 20px;
}

.portal-help-card h2 {
  margin: 4px 0 7px;
  color: var(--ds-ink-strong);
  font: 600 18px var(--ds-display);
}

.portal-help-card p {
  margin: 0 0 15px;
  color: var(--ds-muted);
  font-size: 11px;
}

.portal-notice-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 13px;
  padding: 12px 13px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 9px;
}

.portal-notice-preview>div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.portal-notice-preview strong {
  color: var(--ds-ink);
  font-size: 11px;
}

.portal-notice-preview span {
  color: var(--ds-muted);
  font-size: 10px;
}

.portal-access-panel {
  display: grid;
  gap: 15px;
  padding: 17px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 11px;
}

.portal-access-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.portal-access-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 10px;
}

.portal-access-heading h3 {
  margin: 0 0 4px;
  color: var(--ds-ink-strong);
  font: 600 14px var(--ds-display);
}

.portal-access-heading p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 10px;
}

.portal-credential-list {
  display: grid;
  gap: 8px;
}

.portal-credential-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.portal-credential-label {
  color: var(--ds-muted);
  font-size: 10px;
  font-weight: 700;
}

.portal-credential-value {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.portal-credential-value code {
  min-width: 0;
  overflow: hidden;
  color: var(--ds-ink-strong);
  font: 600 12px ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-action {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  color: var(--ds-muted);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 7px;
}

.devices-panel {
  margin-top: 16px;
}

.device-list {
  display: grid;
  gap: 9px;
  padding-top: 15px;
  padding-bottom: 15px;
}

.device-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 10px;
}

.device-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 9px;
}

.device-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.device-main strong {
  overflow: hidden;
  color: var(--ds-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-main small {
  color: var(--ds-muted);
  font-size: 10px;
}

.device-actions {
  display: flex;
  gap: 7px;
}

.affiliate-view {
  display: grid;
  gap: 16px;
}

.affiliate-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 118px;
  padding: 25px;
  color: #fff;
  background: linear-gradient(135deg, #172b46, #213e63);
  border-radius: var(--ds-radius-lg);
}

.affiliate-hero-copy {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.affiliate-orbit {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  color: #fff;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 11px;
}

.affiliate-hero h2 {
  margin: 4px 0 7px;
  color: #fff;
  font: 600 23px var(--ds-display);
}

.affiliate-hero p {
  margin: 0;
  color: #bdcada;
  font-size: 11px;
}

.affiliate-code {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.affiliate-code code {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  overflow-wrap: anywhere;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  font: 600 11px ui-monospace, SFMono-Regular, Consolas, monospace;
}

.affiliate-hero .affiliate-code {
  width: min(270px, 100%);
  display: grid;
}

.affiliate-hero .affiliate-code code {
  color: #fff;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .18);
}

.affiliate-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.affiliate-stat-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 100px;
  padding: 16px;
}

.affiliate-stat-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 10px;
}

.affiliate-stat-card>div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.affiliate-stat-card small,
.affiliate-stat-card span {
  color: var(--ds-muted);
  font-size: 10px;
}

.affiliate-stat-card strong {
  color: var(--ds-ink-strong);
  overflow-wrap: anywhere;
  font-size: 15px;
}

.affiliate-balance-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 16px;
  align-items: center;
  margin: 16px 20px 0;
  padding: 14px 15px;
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: 9px;
}

.affiliate-balance-callout span,
.affiliate-balance-callout small {
  color: var(--ds-muted);
  font-size: 10px;
}

.affiliate-balance-callout strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--ds-ink-strong);
  font: 600 19px var(--ds-display);
}

.withdraw-box {
  padding: 16px 20px 20px;
}

.withdraw-box form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.affiliate-how {
  padding: 22px;
}

.affiliate-how h2 {
  margin: 4px 0 15px;
  color: var(--ds-ink-strong);
  font: 600 18px var(--ds-display);
}

.affiliate-how ol {
  display: grid;
  gap: 11px;
  margin: 0;
  padding-left: 22px;
  color: var(--ds-muted);
  font-size: 11px;
}

.payment-form {
  display: grid;
  gap: 13px;
}

.payment-form-heading,
.modal-intro,
.change-summary {
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  font-size: 11px;
}

.payment-field {
  display: grid;
  gap: 7px;
  color: var(--ds-ink);
  font-size: 11px;
  font-weight: 600;
}

.payment-balance-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: 9px;
}

.balance-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.balance-usage {
  display: grid;
  gap: 10px;
}

.payment-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--ds-line);
}

.payer-fields {
  display: grid;
  gap: 10px;
}

/* Configuration, white label and invitation workspaces */
.settings-stack,
.white-label-layout {
  display: grid;
  gap: 16px;
}

.white-label-layout {
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, .82fr);
  align-items: start;
}

.white-label-form-body {
  display: grid;
  gap: 26px;
}

.wl-section {
  display: grid;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ds-line);
}

.wl-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.wl-section-heading,
.form-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.wl-section-heading>div,
.form-section-head>div {
  min-width: 0;
}

.wl-step,
.section-index {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex: 0 0 27px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 8px;
  font: 600 11px var(--ds-display);
}

.wl-section-heading h4,
.form-section-head h4 {
  margin: 0 0 4px;
  color: var(--ds-ink-strong);
  font: 600 15px var(--ds-display);
}

.wl-section-heading p,
.form-section-head p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 11px;
}

.wl-palette-strip {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  font-size: 11px;
}

.wl-palette-strip>div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wl-palette-strip i {
  width: 26px;
  height: 26px;
  display: block;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 7px;
}

.wl-palette-strip b {
  color: var(--ds-success);
  font-size: 10px;
  font-weight: 600;
}

.wl-live-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ds-success);
  font-size: 10px;
  font-weight: 600;
}

.wl-live-status i,
.image-upload-status i {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
}

.image-upload-field {
  display: grid;
  gap: 11px;
  padding: 14px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 10px;
}

.image-upload-label {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.image-upload-label>div {
  display: grid;
  gap: 3px;
}

.image-upload-label>div>span {
  color: var(--ds-ink);
  font-size: 12px;
  font-weight: 600;
}

.image-upload-label>div>small,
.upload-help {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.45;
}

.image-upload-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ds-muted);
  font-size: 10px;
  white-space: nowrap;
}

.image-upload-status.is-ready {
  color: var(--ds-success);
}

.image-upload-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, .8fr);
  gap: 13px;
  align-items: center;
}

.image-preview {
  min-height: 96px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px dashed var(--ds-line-strong);
  border-radius: 9px;
}

.image-preview img {
  display: block;
  max-width: 100%;
  max-height: 86px;
  object-fit: contain;
}

.image-placeholder {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 14px;
  color: var(--ds-subtle);
  text-align: center;
}

.image-placeholder span {
  color: var(--ds-muted);
  font-size: 11px;
}

.image-placeholder small {
  font-size: 10px;
}

.image-upload-actions {
  display: grid;
  gap: 8px;
}

.image-upload-actions-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.image-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.admin-branding-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  color: var(--ds-muted);
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 16%, var(--ds-line));
  border-radius: 9px;
}

.admin-branding-note strong,
.admin-branding-note small {
  display: block;
}

.admin-branding-note strong {
  color: var(--ds-ink);
  font-size: 11px;
}

.admin-branding-note small {
  margin-top: 2px;
  font-size: 10px;
}

.media-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.white-label-preview-body-wrap {
  padding: 18px;
}

.white-label-preview {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 12px;
  box-shadow: var(--ds-shadow);
}

.white-label-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ds-line);
}

.white-label-preview-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.white-label-preview-brand strong {
  color: var(--ds-ink-strong);
  font-size: 11px;
}

.white-label-preview-logo {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  color: var(--ds-brand-deep);
  background: var(--wl-primary, var(--ds-brand-soft));
  border-radius: 7px;
}

.white-label-preview-logo img,
.preview-mini-logo img {
  max-width: 100%;
  max-height: 22px;
  object-fit: contain;
}

.white-label-preview-chip {
  color: var(--ds-muted);
  font-size: 9px;
}

.white-label-preview-shell {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 160px;
}

.white-label-preview-shell aside {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px 10px;
  color: #b7c4d6;
  background: #152943;
  font-size: 9px;
}

.white-label-preview-shell aside b {
  color: #fff;
  font-size: 10px;
}

.white-label-preview-shell aside span {
  padding: 5px 6px;
  border-radius: 5px;
}

.white-label-preview-shell aside .is-active {
  color: #fff;
  background: color-mix(in srgb, var(--wl-primary, var(--ds-brand)) 35%, transparent);
}

.white-label-preview-main {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 17px;
  color: var(--ds-ink);
  background: var(--ds-canvas);
}

.white-label-preview-kicker {
  color: var(--wl-primary, var(--ds-brand));
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .11em;
}

.white-label-preview-main>strong {
  font: 600 17px var(--ds-display);
}

.white-label-preview-main>small {
  color: var(--ds-muted);
  font-size: 9px;
}

.white-label-preview-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.white-label-preview-stats>div {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 7px;
}

.white-label-preview-stats small {
  color: var(--ds-muted);
  font-size: 8px;
}

.white-label-preview-stats strong {
  font-size: 10px;
}

.preview-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.preview-progress span {
  width: 58px;
  height: 5px;
  display: block;
  background: var(--ds-line);
  border-radius: 99px;
}

.preview-progress i {
  width: 64%;
  height: 100%;
  display: block;
  background: var(--wl-primary, var(--ds-brand));
  border-radius: inherit;
}

.preview-progress b {
  color: var(--ds-success);
  font-size: 8px;
}

.white-label-preview-button {
  justify-self: start;
  min-height: 27px;
  padding: 5px 8px;
  color: #fff;
  background: var(--wl-primary, var(--ds-brand));
  border: 0;
  border-radius: 6px;
  font-size: 9px;
}

.preview-caption {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 11px;
  color: var(--ds-success);
  font-size: 10px;
}

.preview-caption small {
  margin-left: auto;
  color: var(--ds-subtle);
}

/* Sub-reseller page */
.invite-workspace {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px 20px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.invite-workspace-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.invite-workspace-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 10px;
}

.invite-workspace h3 {
  margin: 2px 0 4px;
  color: var(--ds-ink-strong);
  font: 600 16px var(--ds-display);
}

.invite-workspace p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 11px;
}

.invite-workspace-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: 9px;
}

.invite-workspace-link>div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.invite-workspace-link span,
.invite-workspace-link small {
  color: var(--ds-muted);
  font-size: 10px;
}

.invite-workspace-link strong {
  overflow: hidden;
  color: var(--ds-ink-strong);
  font: 600 11px ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-workspace-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 3px;
  color: var(--ds-muted);
  font-size: 11px;
}

.invite-workspace-empty>span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 50%;
}

.invite-workspace-empty strong,
.invite-workspace-empty small {
  display: block;
}

.invite-workspace-empty strong {
  color: var(--ds-ink);
}

.invite-workspace-empty small {
  margin-top: 2px;
  color: var(--ds-muted);
  font-size: 10px;
}

.pricing-summary-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.pricing-summary-inline>div {
  display: grid;
  gap: 3px;
  padding: 12px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.pricing-summary-inline span,
.pricing-summary-inline small {
  color: var(--ds-muted);
  font-size: 10px;
}

.pricing-summary-inline strong {
  color: var(--ds-ink-strong);
  font: 600 16px var(--ds-display);
}

.subreseller-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subreseller-data-grid {
  grid-template-columns: minmax(0, 1fr) minmax(260px, .35fr);
}

.compact-purchase-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.compact-purchase {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.compact-purchase>div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.compact-purchase strong {
  overflow: hidden;
  color: var(--ds-ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-purchase-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ds-muted);
  font-size: 10px;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1120px) {
  .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric:nth-child(n+3) {
    border-top: 1px solid var(--ds-line);
  }

  .page-workspace-grid,
  .dashboard-lower-grid,
  .grid-2,
  .portal-overview-lower,
  .affiliate-lower {
    grid-template-columns: 1fr;
  }

  .template-row-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .context-rail {
    order: -1;
  }

  .help-grid,
  .announcement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .migration-batch-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .main-shell {
    margin-left: 0;
  }

  .topbar {
    min-height: 60px;
  }

  .topbar-user,
  .system-pill span:not(.status-dot) {
    display: none;
  }

  .page-content {
    padding: 26px 20px 56px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .page-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .login-wrap,
  .client-login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand,
  .client-login-visual {
    min-height: 300px;
    padding: 30px 24px;
  }

  .login-brand h1,
  .client-login-visual h1 {
    margin-top: 24px;
    font-size: clamp(2.4rem, 10vw, 4rem);
  }

  .login-panel,
  .client-login-panel {
    padding: 26px 20px 42px;
  }

  .portal-shell {
    width: min(100% - 32px, 760px);
  }

  .portal-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-top: 34px;
  }

  .portal-action-grid,
  .portal-metric-strip,
  .affiliate-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .toast-host {
    right: 14px;
    bottom: 14px;
    width: calc(100vw - 28px);
  }

  .topbar {
    min-height: 60px;
    padding-inline: 14px;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .breadcrumb {
    display: none;
  }

  .page-content {
    padding-inline: 14px;
  }

  .metrics,
  .page-stat-grid,
  .form-grid,
  .filter-row,
  .client-filter-grid,
  .help-grid,
  .announcement-grid,
  .portal-action-grid,
  .portal-metric-strip,
  .affiliate-stat-grid {
    grid-template-columns: 1fr;
  }

  .metrics .metric,
  .page-stat-grid .metric {
    border-right: 0;
    border-top: 1px solid var(--ds-line);
  }

  .metrics .metric:first-child,
  .page-stat-grid .metric:first-child {
    border-top: 0;
  }

  .page-head h2 {
    font-size: 28px;
  }

  .page-head-actions,
  .page-head-actions .btn {
    width: 100%;
  }

  .panel-head,
  .map-panel-head,
  .section-panel-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 15px;
  }

  .panel-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .panel-body {
    padding: 15px;
  }

  .bulk-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 15px;
  }

  .bulk-toolbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .bulk-toolbar-actions .select {
    width: 100%;
    min-width: 0;
  }

  .bulk-selection-count {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .data-table {
    min-width: 600px;
  }

  .data-table-empty {
    min-width: 0;
  }

  .modal,
  .client-modal {
    padding: 10px;
    place-items: end center;
  }

  .modal-card,
  .client-modal-card {
    max-height: calc(100dvh - 20px);
    border-radius: 14px;
  }

  .modal-head,
  .client-modal-head {
    padding: 14px 15px;
  }

  .modal-body,
  .client-modal-body {
    padding: 0;
  }

  .modal-scroll-content {
    padding: 15px 15px 28px;
  }

  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .technical-number-grid {
    grid-template-columns: 1fr;
  }

  .form-footer {
    padding: 13px 15px 15px;
  }

  .form-footer-equal {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-footer-equal>* {
    min-width: 0;
  }

  .brand-bar {
    min-height: 60px;
    padding-inline: 15px;
  }

  .secure-label {
    display: none;
  }

  .portal-shell {
    width: calc(100% - 28px);
  }

  .portal-hero {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .portal-intro h1 {
    font-size: 34px;
  }

  .portal-tabs {
    margin-inline: -2px;
  }

  .client-login-card,
  .login-card {
    padding: 25px 20px;
  }

  .api-route-tools,
  .api-route-tools .search-bar,
  .api-route-tools .input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .api-route-tools .search-bar {
    flex: 1 1 100%;
  }

  .api-route-tool-actions {
    width: 100%;
  }

  .api-route-tool-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .client-filter-primary {
    grid-template-columns: minmax(0, 1fr);
  }

  .client-filter-primary .search-bar {
    grid-column: auto;
  }

  .client-filter-primary>.select {
    width: 100%;
  }

  .pricing-choice-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow: visible;
  }

  .data-table {
    min-width: 0;
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody,
  .data-table tr {
    display: block;
    width: 100%;
  }

  .data-table tbody tr {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ds-line);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    min-height: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border: 0;
    text-align: right;
  }

  .data-table td::before {
    flex: 0 0 40%;
    color: var(--ds-subtle);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-align: left;
    text-transform: uppercase;
  }

  .data-table td:first-child {
    padding-top: 3px;
  }

  .data-table td:last-child {
    padding-bottom: 3px;
  }

  .data-table td.table-actions,
  .data-table td.client-actions {
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .data-table td.table-actions::before,
  .data-table td.client-actions::before {
    align-self: center;
  }

  .data-table td>.cell-title,
  .data-table td>.check-cell,
  .data-table td>.client-status-cell,
  .data-table td>.client-plan-cell {
    max-width: 60%;
    text-align: left;
  }

  .data-table td[colspan] {
    display: block;
    text-align: center;
  }

  .data-table td[colspan]::before {
    display: none;
  }

  .data-table td[colspan] .empty-state {
    min-height: 132px;
    padding: 20px 14px;
    overflow-wrap: anywhere;
  }

  .data-table td[colspan] .empty-copy {
    max-width: 100%;
  }

  .action-strip,
  .detail-actions,
  .client-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 980px) {

  .operation-map,
  .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }

  .api-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .api-hero-endpoint {
    width: 100%;
    min-width: 0;
  }

  .api-start-grid,
  .api-status-grid,
  .api-scope-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .affiliate-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .affiliate-lower {
    grid-template-columns: 1fr;
  }

  .white-label-layout,
  .subreseller-data-grid {
    grid-template-columns: 1fr;
  }

  .white-label-preview-panel {
    order: -1;
  }
}

@media (max-width: 760px) {
  .domain-page-hero {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 19px;
  }

  .domain-page-hero h3 {
    font-size: 18px;
  }

  .domain-page-filters {
    grid-template-columns: 1fr;
    padding: 15px 16px;
  }

  .domain-page-group-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .domain-data-table {
    min-width: 0;
  }

  .domain-data-table tbody {
    display: grid;
    gap: 9px;
    padding: 12px;
  }

  .domain-data-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 11px 12px;
    border: 1px solid var(--ds-line);
    border-radius: 10px;
  }

  .domain-data-table td {
    display: grid;
    grid-template-columns: minmax(82px, 30%) minmax(0, 1fr);
    align-items: start;
    min-height: 0;
    padding: 6px 0;
    font-size: 11px;
    line-height: 1.35;
    text-align: left;
  }

  .domain-data-table td:first-child {
    display: block;
    padding: 0 0 10px;
    border-bottom: 1px solid var(--ds-line);
  }

  .domain-data-table td:nth-child(2),
  .domain-data-table td:nth-child(3),
  .domain-data-table td:nth-child(4),
  .domain-data-table td:nth-child(5) {
    display: grid;
    grid-template-columns: minmax(82px, 30%) minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    border-bottom: 0;
  }

  .domain-data-table td:nth-child(2)>*,
  .domain-data-table td:nth-child(3)>*,
  .domain-data-table td:nth-child(4)>*,
  .domain-data-table td:nth-child(5)>* {
    min-width: 0;
    max-width: 100%;
    justify-self: end;
    overflow-wrap: anywhere;
    text-align: right;
  }

  .domain-data-table td:last-child {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    grid-column: 1 / -1;
    padding-top: 10px;
    border-top: 1px solid var(--ds-line);
  }

  .domain-data-table td:last-child::before {
    display: none;
  }

  .domain-data-table .domain-table-name {
    align-items: flex-start;
  }

  .domain-data-table .domain-table-name strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .domain-data-table .domain-table-name small {
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .domain-data-table .table-actions {
    min-width: 0;
  }

  .domain-group-actions {
    margin-left: auto;
  }

  .client-access-panel>.panel-head,
  .access-current,
  .access-change {
    padding-left: 17px;
    padding-right: 17px;
  }

  .access-subhead {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .client-access-panel .credential-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .access-change-grid .full {
    grid-column: auto;
  }

  .due-date-preview-grid,
  .renewal-price-grid {
    grid-template-columns: 1fr;
  }

  .security-password-grid {
    grid-template-columns: 1fr;
  }

  .proxy-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .proxy-summary-side {
    width: 100%;
    justify-content: space-between;
  }

  .proxy-editor-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .proxy-remove {
    width: 100%;
  }

  .operation-hero {
    min-height: 0;
    grid-template-columns: 1fr;
    padding: 22px 20px;
  }

  .operation-hero-orbit {
    display: none;
  }

  .operation-node-grid {
    grid-template-columns: 1fr;
  }

  .api-documentation .panel-body {
    padding: 16px;
  }

  .doc-section {
    padding-left: 0;
  }

  .doc-section .doc-kicker {
    position: static;
    display: block;
    margin-bottom: 8px;
  }

  .api-start-grid,
  .api-status-grid,
  .api-scope-cards {
    grid-template-columns: 1fr;
  }

  .affiliate-hero {
    align-items: stretch;
    flex-direction: column;
    padding: 20px;
  }

  .affiliate-hero .affiliate-code {
    width: 100%;
  }

  .affiliate-stat-grid {
    grid-template-columns: 1fr;
  }

  .withdraw-box form {
    grid-template-columns: 1fr;
  }

  .withdraw-box form .button {
    width: 100%;
  }

  .client-filter-primary,
  .client-filter-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .client-filter-primary .search-bar {
    grid-column: auto;
  }

  .client-filter-advanced summary {
    min-height: 40px;
    padding-block: 10px;
  }

  .client-filter-advanced summary span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .client-filter-result {
    width: 100%;
  }

  .system-health-list span {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .system-health-list b {
    text-align: left;
  }

  .update-package-picker {
    align-items: stretch;
    flex-direction: column;
  }

  .update-package-button {
    width: 100%;
  }

  .update-package-name {
    min-height: 24px;
    display: flex;
    align-items: center;
    padding: 0 5px;
  }

  .device-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .device-status,
  .device-actions {
    grid-column: 2;
    min-width: 0;
  }

  .device-actions {
    display: flex;
    flex-wrap: wrap;
  }

  .device-actions .button {
    min-width: 0;
    flex: 1 1 120px;
  }

  .device-actions {
    width: 100%;
  }

  .device-actions .button {
    max-width: 100%;
  }

  .device-main strong,
  .device-main small {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .portal-credential-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .portal-credential-value {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .portal-credential-value code {
    flex: 1 1 160px;
  }

  .media-upload-grid,
  .pricing-summary-inline {
    grid-template-columns: 1fr;
  }

  .image-upload-control {
    grid-template-columns: 1fr;
  }

  .invite-workspace-head {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .invite-workspace-head .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .invite-workspace-link {
    align-items: stretch;
    flex-direction: column;
  }

  .invite-workspace-link .btn {
    width: 100%;
  }

  .migration-overview {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .migration-batch-intro {
    align-items: flex-start;
    flex-direction: column;
    padding: 15px 16px 6px;
  }

  .migration-sequence {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .migration-batch-route {
    padding: 10px 16px 4px;
  }

  .migration-route-points {
    grid-template-columns: 1fr;
  }

  .migration-route-arrow {
    margin: -2px auto;
    transform: rotate(90deg);
  }

  .migration-detail-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .migration-detail-actions {
    justify-content: stretch;
  }

  .migration-detail-actions .btn {
    flex: 1 1 150px;
  }

  .migration-items {
    padding: 12px 16px 16px;
  }

  .migration-item {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px;
    padding: 13px;
  }

  .migration-item-state {
    grid-column: 2;
    justify-items: start;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 0;
  }

  .migration-batch-progress>div:last-child {
    align-items: flex-start;
    flex-direction: column;
  }

  .migration-batch-progress .error-note {
    max-width: none;
    text-align: left;
  }

  .migration-safety-note {
    margin-left: 16px;
    margin-right: 16px;
  }

  .migration-sequence {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 5px;
  }

  .migration-sequence i {
    display: none;
  }
}

/* Upload cards need readable controls before the narrow-phone breakpoint. */
@media (max-width: 900px) {
  .media-upload-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  #client-search {
    font-size: 10px;
    letter-spacing: -.01em;
  }

  .migration-batch-stats {
    grid-template-columns: 1fr 1fr;
  }

  .migration-batch-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .migration-batch-title {
    flex: 1 1 150px;
  }

  .migration-batch-status {
    margin-left: auto;
  }

  .migration-details>summary {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .migration-details>summary em {
    grid-column: 2;
    justify-self: start;
    margin-left: 0;
  }
}

.settings-advanced {
  display: grid;
  gap: 0;
}

.settings-advanced>summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  list-style: none;
}

.settings-advanced>summary::-webkit-details-marker {
  display: none;
}

.settings-advanced>summary strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
}

.settings-advanced>summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.settings-advanced[open]>summary {
  border-radius: 14px 14px 0 0;
  border-bottom-color: transparent;
}

.settings-advanced>form {
  border-radius: 0 0 14px 14px;
}

/* Client portal safety net: scrolling belongs to the page on short screens,
   while dialogs keep one predictable internal scroll region. */
html,
body,
#app {
  min-width: 0;
  overflow-x: hidden;
}

body:has(.client-login-shell),
body:has(.portal-shell) {
  overflow-y: auto;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.btn[aria-busy="true"],
.button[aria-busy="true"] {
  position: relative;
  pointer-events: none;
}

.btn[aria-busy="true"]::after,
.button[aria-busy="true"]::after {
  width: 13px;
  height: 13px;
  content: '';
  display: inline-block;
  margin-left: 2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ui-spin .65s linear infinite;
}

@keyframes ui-spin {
  to {
    transform: rotate(360deg);
  }
}

.portal-notice-card.is-error {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
  border-color: #f1cdd1;
}

.notice-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  color: var(--ds-ink);
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.5;
}

.portal-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 23, 40, var(--popup-overlay-opacity, .58));
}

.portal-popup {
  position: relative;
  width: min(520px, 100%);
  max-height: min(720px, calc(100dvh - 32px));
  overflow: auto;
  padding: 26px;
  box-shadow: var(--ds-shadow-lg);
}

.portal-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ds-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 22px;
}

.portal-popup-close:hover {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
}

.client-login-shell {
  min-height: 100svh;
}

.client-login-visual,
.client-login-panel {
  min-width: 0;
}

.client-modal {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.client-modal-card {
  min-height: 0;
}

.client-modal-body,
.portal-article-content {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.client-modal-head h2,
.client-modal-body strong,
.client-modal-body span,
.portal-article-content {
  overflow-wrap: anywhere;
}

.client-modal-body input,
.client-modal-body select,
.client-modal-body textarea,
.payment-form input,
.payment-form select,
.payment-form textarea {
  max-width: 100%;
  min-width: 0;
}

.modal-footer {
  flex-wrap: wrap;
}

.modal-footer .button {
  min-width: 0;
}

@media (max-width: 760px) {
  .client-login-shell {
    min-height: 0;
  }

  .client-login-visual {
    min-height: 360px;
  }

  .client-modal {
    align-items: end;
    padding: 0;
  }

  .client-modal-card {
    max-height: 90svh;
  }

  .client-modal-head {
    flex: 0 0 auto;
  }

  .client-modal-body,
  .portal-article-content {
    max-height: calc(90svh - 76px);
  }

  .modal-footer {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 700px) {
  .client-login-visual {
    min-height: 0;
    padding-block: 28px;
  }

  .client-login-panel {
    align-items: flex-start;
    padding-block: 28px 42px;
  }
}

/* Detail workspaces: every emitted group must read as a component, never as loose text. */
.client-detail-form {
  display: grid;
  gap: 0;
}

.client-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  margin: 0 0 22px;
  padding: 16px 18px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
}

.client-summary-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-summary-main>div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.client-summary-main h3 {
  margin: 0;
  overflow: hidden;
  color: var(--ds-ink-strong);
  font: 600 16px/1.2 var(--ds-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-summary-main p {
  margin: 0;
  overflow: hidden;
  color: var(--ds-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 16%, var(--ds-line));
  border-radius: 12px;
  font: 600 14px var(--ds-display);
}

.client-summary-status {
  display: grid;
  justify-items: end;
  gap: 5px;
  flex: 0 0 auto;
}

.client-summary-status small {
  color: var(--ds-muted);
  font-size: 10px;
  white-space: nowrap;
}

.client-detail-form>.form-section {
  display: grid;
  gap: 18px;
  padding: 0 0 24px;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--ds-line);
}

.client-detail-form>.form-section:last-of-type {
  margin-bottom: 0;
}

.form-section {
  min-width: 0;
}

.form-section+.form-section {
  margin-top: 22px;
}

.form-section-last {
  padding-bottom: 0;
}

.form-section-head {
  min-width: 0;
}

.form-section-head .section-index {
  margin-left: auto;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 22px;
  padding: 14px 0 0;
  border-top: 1px solid var(--ds-line);
}

.detail-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.detail-action-group.detail-action-primary,
.detail-action-group.detail-action-danger {
  background: transparent;
  border-color: transparent;
}

.detail-action-label {
  color: var(--ds-subtle);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.detail-action-buttons {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.detail-action-buttons .btn {
  min-height: 36px;
}

.detail-action-danger {
  margin-left: auto;
  padding-left: 10px;
  border-left: 1px solid var(--ds-line) !important;
}

.detail-action-danger>.btn {
  justify-self: start;
}

.detail-actions-menu {
  position: relative;
  display: inline-block;
}

.detail-actions-menu>summary {
  list-style: none;
  cursor: pointer;
}

.detail-actions-menu>summary::-webkit-details-marker {
  display: none;
}

.detail-actions-menu-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 7px);
  z-index: 40;
  min-width: 210px;
  display: grid;
  gap: 3px;
  padding: 7px;
  background: var(--ds-surface, #fff);
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  box-shadow: var(--ds-shadow-lg);
}

.detail-actions-menu-popover .detail-menu-item {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  color: var(--ds-ink);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.detail-actions-menu-popover .detail-menu-item:hover,
.detail-actions-menu-popover .detail-menu-item:focus-visible {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-pale);
  outline: 0;
}

.detail-actions-menu-popover .detail-menu-item[data-action="delete-client"] {
  color: var(--ds-danger);
}

.detail-actions-menu-popover .detail-menu-item[data-action="delete-client"]:hover,
.detail-actions-menu-popover .detail-menu-item[data-action="delete-client"]:focus-visible {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
}

.detail-actions-menu[open]>summary {
  border-color: var(--ds-brand);
  color: var(--ds-brand-deep);
}

.renewal-confirm {
  overflow: visible;
}

.renewal-confirm .renewal-period-field {
  margin-bottom: 14px;
}

.renewal-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.renewal-summary .readout {
  min-width: 0;
  min-height: 78px;
}

.renewal-summary .readout span,
.renewal-impact small {
  display: block;
  color: var(--ds-subtle);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .02em;
}

.renewal-summary .readout strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.renewal-summary .readout small {
  display: block;
  overflow-wrap: anywhere;
}

.renewal-summary .renewal-preview-balance {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--ds-brand) 28%, var(--ds-line));
  background: color-mix(in srgb, var(--ds-brand) 5%, #fff);
}

.renewal-summary .renewal-preview-balance strong {
  color: var(--ds-brand-deep);
}

.renewal-impact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.renewal-impact>div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
}

.renewal-impact strong {
  display: block;
  color: var(--ds-ink-strong);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.renewal-impact .accent {
  background: var(--ds-brand-pale);
  border-color: color-mix(in srgb, var(--ds-brand) 26%, var(--ds-line));
}

.renewal-impact .accent strong {
  color: var(--ds-brand-deep);
}

.renewal-note {
  margin-top: 14px;
}

.notice-section {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 2px;
}

.notice-section strong {
  flex: 0 0 auto;
}

.notice-section strong+span {
  min-width: 0;
}

.client-access-panel {
  margin: 0 0 24px;
}

.client-access-panel .panel-head {
  min-height: 62px;
}

.client-metrics {
  margin: 0 0 24px;
}

@media (max-width: 600px) {
  .client-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .client-summary-status {
    width: 100%;
    align-items: flex-start;
    justify-items: start;
  }

  .client-summary-main p {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .detail-actions {
    align-items: stretch;
  }

  .detail-actions-menu {
    width: 100%;
  }

  .detail-actions-menu>summary {
    width: 100%;
    justify-content: center;
  }

  .detail-actions-menu-popover {
    position: static;
    margin-top: 7px;
    min-width: 0;
  }

  .detail-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .detail-action-buttons .btn,
  .detail-action-danger>.btn {
    width: 100%;
  }

  .notice-section {
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 430px) {
  .messaging-card {
    width: 100%;
    max-width: calc(100vw - 28px);
    min-width: 0;
    overflow: hidden;
  }

  .messaging-overview,
  .messaging-card-grid,
  .messaging-card,
  .messaging-card-actions {
    width: calc(100vw - 28px) !important;
    max-width: calc(100vw - 28px) !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .messaging-card .messaging-card-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    justify-content: start !important;
    justify-items: stretch;
    overflow: hidden;
    width: auto !important;
    max-width: 100% !important;
  }

  .messaging-card .messaging-card-actions .btn {
    display: flex;
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    box-sizing: border-box;
  }

  .messaging-card .messaging-card-actions {
    justify-self: stretch;
    align-self: stretch;
  }
}

.ticket-modal-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.ticket-chat-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-line);
}

.ticket-chat-title {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.ticket-chat-title h3 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 18px/1.25 var(--ds-display);
  overflow-wrap: anywhere;
}

.ticket-chat-title p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.ticket-chat-state {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.ticket-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 20px;
  background: var(--ds-surface-muted);
  border-bottom: 1px solid var(--ds-line);
}

.ticket-thread {
  min-height: 180px;
  flex: 1 1 auto;
  max-height: min(52svh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  background: color-mix(in srgb, var(--ds-brand-pale) 34%, var(--ds-canvas));
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.ticket-message-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticket-message {
  display: flex;
  max-width: 78%;
  min-width: 0;
}

.ticket-message--incoming {
  justify-self: start;
}

.ticket-message--outgoing {
  justify-self: end;
}

.ticket-bubble {
  min-width: 0;
  padding: 11px 13px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid #dfe6ef;
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 2px 8px rgba(20, 38, 64, .05);
}

.ticket-message--outgoing .ticket-bubble {
  color: var(--ds-ink-strong);
  background: #e7f0ff;
  border-color: #c6d9fb;
  border-radius: 14px 4px 14px 14px;
}

.ticket-message--incoming .ticket-message-head strong {
  color: #3f607e;
}

.ticket-message--outgoing .ticket-message-head {
  justify-content: flex-end;
}

.ticket-message--outgoing .ticket-message-head strong {
  color: var(--ds-brand-deep);
}

.ticket-message--outgoing .ticket-bubble p {
  color: #1e3653;
}

.ticket-message--internal {
  max-width: 100%;
  justify-self: stretch;
}

.ticket-message--internal .ticket-bubble {
  background: #fff8e6;
  border-color: #f1d79c;
  border-radius: 10px;
}

.ticket-message--internal .ticket-message-head {
  justify-content: flex-start;
}

.ticket-message--internal .ticket-message-head strong {
  color: #7e5e1a;
}

.ticket-message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--ds-muted);
  font-size: 10px;
}

.ticket-message-head strong {
  color: var(--ds-ink-strong);
  font-size: 11px;
}

.ticket-message-head time {
  color: var(--ds-subtle);
}

.ticket-internal-label {
  color: #86631a;
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.ticket-bubble p {
  margin: 7px 0 0;
  color: inherit;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ticket-empty,
.ticket-error {
  padding: 32px 16px;
  color: var(--ds-muted);
  text-align: center;
}

.ticket-reply {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0;
  padding: 14px 20px 0;
  background: var(--ds-surface);
  border-top: 1px solid var(--ds-line);
}

.ticket-reply .field {
  min-width: 0;
}

.ticket-reply textarea {
  min-height: 76px;
  max-height: 170px;
}

.ticket-internal-toggle {
  margin: 8px 0 0;
}

.ticket-composer-actions {
  margin: 10px -20px 0;
  padding: 12px 20px 16px;
}

.ticket-live-status {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--ds-muted);
  font-size: 10px;
}

.ticket-closed-copy {
  color: var(--ds-muted);
  font-size: 11px;
}

@media (max-width: 760px) {
  .ticket-chat-summary {
    flex-direction: column;
    gap: 10px;
    padding: 16px;
  }

  .ticket-chat-state {
    justify-content: flex-start;
  }

  .ticket-settings {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }

  .ticket-thread {
    max-height: calc(90svh - 270px);
    padding: 14px;
  }

  .ticket-message {
    max-width: 92%;
  }

  .ticket-reply {
    padding: 12px 14px 0;
  }

  .ticket-composer-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px -14px 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .ticket-composer-actions .btn {
    width: 100%;
  }
}

/* Keyboard focus and mobile console navigation */
:where(button, input, select, textarea, a, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ds-brand) 72%, #0b2545);
  outline-offset: 2px;
}

.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-brand) 22%, transparent);
}

.modal-body {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-body>.modal-scroll-content {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.mobile-backdrop {
  display: none;
}

@media (max-width: 840px),
(max-width: 1100px) and (orientation: landscape) {
  .mobile-menu {
    display: inline-grid;
  }

  .main-shell {
    margin-left: 0;
  }

  .sidebar {
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .2s ease, visibility .2s ease;
    box-shadow: 12px 0 30px rgba(10, 23, 40, .18);
  }

  .app-shell.sidebar-is-open .sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: block;
    visibility: hidden;
    opacity: 0;
    background: rgba(10, 23, 40, .48);
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }

  .app-shell.sidebar-is-open .mobile-backdrop {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  body:has(.app-shell.sidebar-is-open) {
    overflow: hidden;
  }
}

/* Keep the console usable on compact laptop widths: a persistent sidebar
   leaves table action cells unreachable before the mobile breakpoint. */
@media (min-width: 841px) and (max-width: 1100px) and (orientation: portrait) {
  .mobile-menu {
    display: inline-grid;
  }

  .main-shell {
    margin-left: 0;
  }

  .sidebar {
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .2s ease, visibility .2s ease;
    box-shadow: 12px 0 30px rgba(10, 23, 40, .18);
  }

  .app-shell.sidebar-is-open .sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: block;
    visibility: hidden;
    opacity: 0;
    background: rgba(10, 23, 40, .48);
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }

  .app-shell.sidebar-is-open .mobile-backdrop {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  body:has(.app-shell.sidebar-is-open) {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Active utility vocabulary. These classes are emitted by route renderers and
   must not depend on an unlinked historical stylesheet. */
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn.tertiary {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-pale);
  border-color: color-mix(in srgb, var(--ds-brand) 22%, var(--ds-line));
}

.btn.tertiary:hover {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-color: color-mix(in srgb, var(--ds-brand) 42%, var(--ds-line));
}

.muted {
  color: var(--ds-muted);
}

.text-danger,
.error-note {
  color: var(--ds-danger) !important;
}

.panel-kicker {
  display: block;
  min-height: 3px;
  margin-bottom: 5px;
  color: var(--ds-brand-deep);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.panel-kicker:empty {
  display: none;
}

.table-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 8px;
}

.table-icon.blue {
  color: #2563eb;
  background: #eaf1ff;
}

.technical-stack {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.technical-stack strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technical-stack small,
.cell-note {
  display: block;
  margin-top: 3px;
  color: var(--ds-subtle);
  font-size: 10px;
  line-height: 1.4;
}

.accent-note {
  color: var(--ds-brand-deep);
}

.warning-note {
  color: var(--ds-warning);
}

.notice-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.notice-stack .notice {
  min-width: 0;
}

.action-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.client-actions .action-strip {
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .button-row {
    width: 100%;
  }

  .button-row>.btn {
    flex: 1 1 auto;
  }

  .action-strip {
    justify-content: flex-start;
    max-width: 100%;
  }

  .action-strip .icon-button {
    flex: 0 0 34px;
  }

  .data-table td.table-actions,
  .data-table td.client-actions {
    min-width: 0;
    white-space: normal;
  }

  .data-table td.table-actions .action-strip,
  .data-table td.client-actions .action-strip {
    max-width: 100%;
  }

  .data-table td.table-actions .icon-button {
    flex: 0 0 30px;
    width: 30px;
    min-width: 30px;
    height: 30px;
  }

  .template-channel-layout .context-rail-actions .btn,
  .template-channel-layout .panel-actions .btn,
  .messaging-card-actions .btn {
    width: 100%;
  }
}

/* Shared console/portal pieces that must remain styled in the active sheet. */
.loading-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  gap: 9px;
  color: var(--ds-muted);
  font-size: 12px;
}

.spinner {
  width: 18px;
  height: 18px;
  display: inline-block;
  border: 2px solid var(--ds-line-strong);
  border-top-color: var(--ds-brand);
  border-radius: 50%;
  animation: ui-spin .65s linear infinite;
}

.client-action-menu {
  position: relative;
  display: inline-block;
}

.client-action-menu>summary {
  list-style: none;
}

.client-action-menu>summary::-webkit-details-marker {
  display: none;
}

.client-action-menu-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 170px;
  display: grid;
  gap: 3px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  box-shadow: var(--ds-shadow-lg);
}

.client-action-menu-popover button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--ds-ink);
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  font-size: 11px;
}

.client-action-menu-popover button:hover {
  background: var(--ds-brand-pale);
}

.client-action-menu-popover button.danger {
  color: var(--ds-danger);
}

.client-action-note {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--ds-muted);
  font-size: 11px;
}

.payment-box,
.payment-form,
.payment-summary,
.success-box {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 16px 20px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: var(--ds-surface-muted);
}

.payment-box-title,
.payment-summary>div,
.payment-balance-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.payment-kicker,
.payment-box-title small,
.payment-help,
.payment-summary small,
.success-box span {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.45;
}

.payment-box-title strong,
.payment-summary strong,
.success-box strong {
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.payment-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 20px 0;
  background: var(--ds-surface-muted);
}

.payment-summary>div {
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.payment-box {
  margin: 16px 20px;
  background: var(--ds-brand-pale);
  border-color: color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
}

.payment-qr-wrap {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.payment-qr {
  width: min(220px, 100%);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.success-box {
  color: var(--ds-success);
  background: var(--ds-success-bg);
  border-color: #c9eddf;
}

.access-button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 9px;
  text-align: left;
}

.access-button:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 35%, var(--ds-line));
  background: var(--ds-brand-pale);
}

.access-button-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 8px;
}

.access-button-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.access-button-copy strong {
  color: var(--ds-ink-strong);
  font-size: 12px;
}

.access-button-copy small {
  color: var(--ds-muted);
  font-size: 10px;
}

.access-button-arrow {
  color: var(--ds-brand-deep);
}

.is-loading {
  pointer-events: none;
}

@media (max-width: 600px) {
  .payment-summary {
    grid-template-columns: 1fr;
    margin-inline: 15px;
  }

  .payment-box {
    margin-inline: 15px;
  }
}

/* Active route workspaces: keep operational cards grouped, readable and responsive. */
.empty-workspace,
.empty-state-rich,
.help-empty-panel,
.article-empty-state {
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  min-height: 180px;
  padding: 28px 22px;
  color: var(--ds-muted);
  background: linear-gradient(145deg, var(--ds-surface-muted), #fff);
  border: 1px dashed var(--ds-line-strong);
  border-radius: var(--ds-radius);
  text-align: center;
}

.empty-workspace>*,
.empty-state-rich>*,
.help-empty-panel>*,
.article-empty-state>* {
  max-width: 100%;
}

.empty-workspace p,
.empty-state-rich p,
.help-empty-panel p,
.article-empty-state p {
  max-width: 48ch;
  margin: 0;
  color: var(--ds-muted);
  line-height: 1.55;
}

.empty-workspace strong,
.empty-state-rich strong,
.help-empty-panel strong,
.article-empty-state strong {
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.empty-workspace .empty-state-actions,
.empty-state-rich .empty-state-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.affiliate-rule-summary,
.seller-policy-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 20px;
  background: linear-gradient(145deg, #fff, var(--ds-brand-pale));
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: var(--ds-radius);
}

.affiliate-rule-summary>div,
.seller-policy-summary>div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.affiliate-rule-summary .eyebrow,
.seller-policy-summary .eyebrow {
  margin: 0;
}

.affiliate-rule-summary strong,
.seller-policy-summary strong {
  overflow-wrap: anywhere;
  color: var(--ds-ink-strong);
  font: 600 15px/1.3 var(--ds-display);
}

.affiliate-rule-summary small,
.seller-policy-summary small {
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.45;
}

.affiliate-rule-summary>.btn,
.seller-policy-summary>.btn {
  flex: 0 0 auto;
}

.sellers-policy-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 20px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 20px 22px;
  background: linear-gradient(145deg, #fff, var(--ds-brand-pale));
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.sellers-policy-panel>* {
  min-width: 0;
}

.seller-policy-summary {
  display: block;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.seller-page-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 9px;
}

.seller-page-actions .btn {
  width: 100%;
}

#affiliate-settings-form .form-grid {
  align-items: stretch;
}

#affiliate-settings-form .check-cell {
  min-height: 56px;
  padding: 13px 14px;
  align-items: center;
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: 9px;
}

#affiliate-settings-form .check-cell>span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

#affiliate-settings-form .check-cell strong {
  color: var(--ds-ink-strong);
  font-size: 12px;
}

#affiliate-settings-form .check-cell small {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.4;
}

#affiliate-settings-form .field {
  min-height: 78px;
  align-content: start;
}

#affiliate-settings-form .field.full {
  min-height: 0;
}


.messaging-overview {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.messaging-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}

.messaging-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  padding: 18px;
  background: linear-gradient(145deg, #fff, var(--ds-brand-pale));
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.messaging-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 12px;
}

.messaging-card-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.messaging-card-copy h3 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 15px/1.25 var(--ds-display);
}

.messaging-card-copy p {
  margin: 0 0 3px;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.5;
}

.messaging-card .button-row {
  grid-column: 1 / -1;
  justify-content: flex-start;
  padding-top: 5px;
}

.messaging-card .button-row .btn {
  min-width: 0;
}

.credit-tier-list,
.credit-tier-readonly-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.credit-tier-list {
  padding: 2px;
}

.credit-tier-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) 38px;
  align-items: end;
  gap: 12px;
  padding: 13px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 10px;
}

.credit-tier-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-bottom: 7px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.credit-tier-row .field {
  min-width: 0;
}

.credit-tier-row .icon-button {
  margin-bottom: 7px;
}

.credit-tier-empty {
  min-height: 148px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px 18px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border: 1px dashed color-mix(in srgb, var(--ds-brand) 30%, var(--ds-line));
  border-radius: 11px;
  text-align: center;
}

.credit-tier-empty-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 13px;
}

.credit-tier-empty strong {
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.credit-tier-readonly-list {
  padding: 18px 20px 20px;
}

.credit-tier-readonly {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
}

.credit-tier-readonly>span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
}

.credit-tier-readonly strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ds-ink);
  font-size: 12px;
}

.credit-tier-readonly b {
  color: var(--ds-brand-deep);
  font-size: 12px;
  white-space: nowrap;
}

.credit-tier-readonly>div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.credit-tier-readonly small {
  color: var(--ds-muted);
  font-size: 10px;
}

.credit-tier-base {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  background: var(--ds-brand-pale);
  border-color: color-mix(in srgb, var(--ds-brand) 20%, var(--ds-line));
}

.credit-tier-base-mark {
  color: var(--ds-brand-deep);
  font-size: 20px;
  text-align: center;
}

.credit-policy-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--ds-muted);
  font-size: 11px;
}

.credit-policy-meta span+span {
  padding-left: 14px;
  border-left: 1px solid var(--ds-line);
}

.credit-policy-meta strong {
  color: var(--ds-ink-strong);
  font-weight: 700;
}

@media (max-width: 560px) {
  .credit-policy-meta {
    display: grid;
    gap: 4px;
  }

  .credit-policy-meta span+span {
    padding-left: 0;
    border-left: 0;
  }

  .credit-tier-base {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .credit-tier-base b {
    grid-column: 2;
  }
}

.help-grid {
  min-width: 0;
  align-items: stretch;
}

.notice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  align-items: start;
}

.notice-grid-reseller {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.notice-grid-reseller .admin-notice-card {
  width: 100%;
}

.admin-notice-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 16px;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--ds-ink) 7%, transparent);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.admin-notice-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--ds-brand) 35%, var(--ds-line));
  box-shadow: 0 16px 34px color-mix(in srgb, var(--ds-ink) 12%, transparent);
}

.admin-notice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 0;
  padding: 15px 22px 13px;
  border-bottom: 1px solid var(--ds-line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ds-brand-pale) 34%, var(--ds-surface)), var(--ds-surface));
}

.admin-notice-card-badges {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.admin-notice-card-header time {
  flex: 0 0 auto;
  color: var(--ds-subtle);
  font-size: 10px;
  white-space: nowrap;
}

.notice-type-badge,
.notice-pin-badge,
.notice-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--ds-line);
  color: var(--ds-muted);
  background: var(--ds-surface);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.notice-card-info .notice-type-badge {
  color: #41688c;
  background: #f2f7fc;
  border-color: #dce8f3;
}

.notice-card-success .notice-type-badge {
  color: #31745d;
  background: #effaf5;
  border-color: #cfeee1;
}

.notice-card-warning .notice-type-badge {
  color: #89631a;
  background: #fff8e8;
  border-color: #f2dfaa;
}

.notice-card-maintenance .notice-type-badge {
  color: #74529b;
  background: #f7f0ff;
  border-color: #e4d5f5;
}

.notice-card-news .notice-type-badge {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-pale);
  border-color: color-mix(in srgb, var(--ds-brand) 22%, var(--ds-line));
}

.notice-pin-badge {
  color: var(--ds-brand-deep);
  border-color: color-mix(in srgb, var(--ds-brand) 26%, var(--ds-line));
  background: var(--ds-brand-soft);
}

.notice-status-badge.published {
  color: #31745d;
  background: #effaf5;
  border-color: #cfeee1;
}

.notice-status-badge.draft {
  color: #89631a;
  background: #fff8e8;
  border-color: #f2dfaa;
}

.notice-status-badge.archived {
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
}

.notice-card-body {
  display: grid;
  gap: 8px;
  flex: 0 1 auto;
  padding: 20px 24px 18px;
}

.notice-card-heading {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.notice-grid-reseller .notice-card-body {
  padding: 18px 24px 16px;
}

.notice-grid-reseller .notice-card-footer {
  padding-top: 10px;
  padding-bottom: 11px;
}

.notice-card-body h3 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 650 19px/1.2 var(--ds-display);
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}

.notice-summary {
  margin: 0;
  color: var(--ds-ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.notice-message {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ds-muted);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.notice-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 0;
  padding: 12px 22px 14px;
  border-top: 1px solid var(--ds-line);
  background: var(--ds-surface-muted);
}

.notice-audience {
  color: var(--ds-subtle);
  font-size: 10px;
  font-weight: 650;
}

.notice-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.notice-card-actions .btn {
  min-height: 30px;
}

@media (max-width: 900px) {
  .notice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .notice-card {
    min-height: 0;
  }

  .admin-notice-card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .admin-notice-card-header time {
    order: -1;
  }

  .notice-card-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .notice-card-actions {
    width: 100%;
    justify-content: stretch;
  }

  .notice-card-actions .btn {
    flex: 1 1 0;
  }
}

.reseller-notice-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 0 22px 0 0;
  overflow: hidden;
  color: var(--ds-ink-strong);
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 14px;
  box-shadow: 0 5px 16px color-mix(in srgb, var(--ds-ink) 5%, transparent);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.reseller-notice-card:hover,
.reseller-notice-card:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--ds-brand) 38%, var(--ds-line));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--ds-ink) 10%, transparent);
  outline: none;
}

.reseller-notice-accent {
  align-self: stretch;
  width: 6px;
  flex: 0 0 6px;
  background: var(--ds-brand);
}

.reseller-notice-card--success .reseller-notice-accent {
  background: #28a478;
}

.reseller-notice-card--warning .reseller-notice-accent {
  background: #d49b29;
}

.reseller-notice-card--maintenance .reseller-notice-accent {
  background: #8762bd;
}

.reseller-notice-card--news .reseller-notice-accent {
  background: #3f73d9;
}

.reseller-notice-card--success {
  background: #f4fbf7;
}

.reseller-notice-card--warning {
  background: #fffaf0;
}

.reseller-notice-card--maintenance {
  background: #faf7ff;
}

.reseller-notice-card--news {
  background: #f5f8ff;
}

.reseller-notice-content {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex: 1;
}

.reseller-notice-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.reseller-notice-heading h3 {
  margin: 0;
  overflow: hidden;
  color: var(--ds-ink-strong);
  font: 650 15px/1.35 var(--ds-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reseller-notice-content time {
  flex: 0 0 auto;
  color: var(--ds-subtle);
  font-size: 10px;
}

.reseller-notice-arrow {
  color: var(--ds-brand-deep);
  opacity: .65;
}

.notice-read-modal {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: none;
  padding: 22px 24px 24px;
  box-sizing: border-box;
}

.notice-read-summary {
  width: 100%;
  margin: 0;
  color: var(--ds-ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}

.notice-read-body {
  width: 100%;
  max-height: min(60vh, 520px);
  overflow: auto;
  color: var(--ds-muted);
  font-size: 13px;
  line-height: 1.75;
  white-space: normal;
}

@media (max-width: 620px) {
  .reseller-notice-card {
    min-height: 66px;
    padding-right: 14px;
  }

  .reseller-notice-content {
    display: grid;
    gap: 4px;
  }

  .reseller-notice-content time {
    font-size: 9px;
  }

  .reseller-notice-heading h3 {
    font-size: 14px;
  }

  .notice-read-modal {
    padding: 20px 16px;
  }

  .notice-read-body {
    max-height: 55vh;
  }
}

.article-editor-modal {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.article-editor {
  min-width: 0;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 240px;
  gap: 14px;
  align-items: stretch;
}

.builder-palette,
.builder-canvas,
.builder-inspector {
  min-width: 0;
  padding: 14px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
}

.builder-palette {
  display: grid;
  align-content: start;
  gap: 8px;
}

.builder-palette strong {
  color: var(--ds-ink-strong);
  font-size: 12px;
}

.builder-palette small {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.45;
}

.builder-tool {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  text-align: left;
  font-size: 11px;
}

.builder-tool:hover {
  color: var(--ds-brand-deep);
  border-color: color-mix(in srgb, var(--ds-brand) 35%, var(--ds-line));
  background: var(--ds-brand-pale);
}

.builder-canvas {
  min-height: 420px;
  background: linear-gradient(145deg, var(--ds-surface-muted), #fff);
}

.builder-block {
  min-width: 0;
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 11px;
  cursor: grab;
}

.builder-block:last-child {
  margin-bottom: 0;
}

.builder-block.is-selected {
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-brand) 14%, transparent);
}

.builder-block-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ds-subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.builder-block-toolbar>span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-block-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.builder-block-actions button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ds-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
}

.builder-block-actions button:hover {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-color: var(--ds-line);
}

.builder-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  color: var(--ds-muted);
  text-align: center;
}

.builder-empty strong {
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.builder-empty p {
  margin: 5px 0 0;
  font-size: 11px;
}

.builder-inspector {
  display: grid;
  align-content: start;
  gap: 12px;
}

.builder-inspector h4 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 14px/1.25 var(--ds-display);
}

.builder-inspector .field {
  gap: 6px;
}

.article-render {
  min-width: 0;
  display: grid;
  gap: 15px;
  overflow-wrap: anywhere;
}

.article-render h1,
.article-render h2,
.article-render h3,
.article-render h4 {
  margin: 0;
  color: var(--ds-ink-strong);
  font-family: var(--ds-display);
  line-height: 1.25;
}

.article-render p {
  margin: 0;
  color: var(--ds-muted);
  line-height: 1.65;
}

.article-render img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.article-render .columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.article-render .callout {
  padding: 14px;
  color: var(--ds-ink);
  background: var(--ds-brand-pale);
  border-left: 3px solid var(--ds-brand);
  border-radius: 9px;
}

.article-render .callout strong {
  color: var(--ds-ink-strong);
}

.article-render .callout p {
  margin-top: 5px;
}

.article-render blockquote {
  margin: 0;
  padding: 14px 16px;
  color: var(--ds-ink);
  background: var(--ds-surface-muted);
  border-left: 3px solid var(--ds-line-strong);
  border-radius: 0 9px 9px 0;
}

.article-render pre {
  max-width: 100%;
  overflow: auto;
  margin: 0;
  padding: 14px;
  color: #d5e3f3;
  background: #14253b;
  border-radius: 9px;
  font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.article-table-wrap {
  max-width: 100%;
  overflow: auto;
}

.article-render table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
}

.article-render th,
.article-render td {
  padding: 9px 10px;
  color: var(--ds-muted);
  border-bottom: 1px solid var(--ds-line);
  text-align: left;
  vertical-align: top;
  font-size: 11px;
}

.article-render th {
  color: var(--ds-ink);
  background: var(--ds-surface-muted);
  font-weight: 700;
}

@media (max-width: 980px) {
  .article-editor {
    grid-template-columns: 170px minmax(0, 1fr);
  }

  .builder-inspector {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .messaging-card-grid {
    grid-template-columns: 1fr;
  }

  .messaging-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .messaging-card .button-row {
    grid-column: 1 / -1;
    width: 100%;
  }

  .messaging-card .button-row .btn {
    flex: 1 1 150px;
    min-width: 0;
  }

  .messaging-card-actions {
    width: 100%;
    justify-content: stretch;
  }

  .messaging-card-actions .btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .messaging-card-actions {
    width: 100%;
    justify-content: stretch;
  }

  .messaging-card-actions .btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .template-channel-layout .page-head-actions .btn {
    max-width: 100%;
    min-width: 0;
  }

  .template-library-intro {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px;
  }

  .template-library-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .affiliate-rule-summary,
  .seller-policy-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .affiliate-rule-summary>.btn,
  .seller-policy-summary>.btn {
    width: 100%;
  }

  .sellers-policy-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 16px;
  }

  .seller-page-actions {
    justify-content: stretch;
  }

  .seller-page-actions .btn {
    width: 100%;
  }

  .credit-tier-row {
    grid-template-columns: 30px minmax(0, 1fr) 38px;
  }

  .credit-tier-row>.icon-button {
    grid-column: 3;
    grid-row: 1;
  }

  .credit-tier-row .field:nth-of-type(2) {
    grid-column: 2 / -1;
  }

  .credit-tier-readonly {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .credit-tier-readonly b {
    grid-column: 2;
  }

  .article-editor {
    grid-template-columns: 1fr;
  }

  .builder-palette {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .builder-palette strong,
  .builder-palette small {
    grid-column: 1 / -1;
  }

  .builder-canvas {
    min-height: 300px;
  }

  .article-render .columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .builder-palette {
    grid-template-columns: 1fr;
  }

  .builder-palette strong,
  .builder-palette small {
    grid-column: auto;
  }

  .credit-tier-readonly-list {
    padding-inline: 14px;
  }
}


/* Seller wallet and read-only reseller content */
.seller-wallet-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.seller-commissions-hero {
  margin-bottom: 0;
}

.seller-withdrawals-panel {
  width: 100%;
}

.content-section-full {
  width: 100%;
}

.announcement-grid-full {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-content-list-full {
  width: 100%;
}

/* Editorial and referral surfaces are part of the active console sheet. Keep
   sparse collections useful on wide screens and collapse them only when the
   content can no longer keep a readable measure. */
.content-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.content-overview-card {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 84px;
  padding: 16px 18px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: #fff;
  box-shadow: var(--ds-shadow);
}

.content-overview-card>div {
  min-width: 0;
}

.content-overview-card strong {
  display: block;
  color: var(--ds-ink-strong);
  font: 600 24px/1 var(--ds-display);
}

.content-overview-card small {
  display: block;
  margin-top: 5px;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.35;
}

.content-overview-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
}

.content-overview-icon.blue {
  color: #356dde;
  background: #edf3ff;
}

.content-overview-icon.purple {
  color: #765bd2;
  background: #f2efff;
}

.content-overview-icon.green {
  color: #188a67;
  background: #e8f8f1;
}

.content-section-full {
  width: 100%;
}

.content-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
}

.content-section-head>div {
  min-width: 0;
}

.content-section-head h3 {
  margin: 0 0 5px;
  color: var(--ds-ink-strong);
  font: 600 17px/1.25 var(--ds-display);
}

.content-section-head p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.5;
}

.portal-content-list {
  display: grid;
  gap: 10px;
  width: 100%;
}

.portal-content-list-full {
  width: 100%;
}

.portal-content-card {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: #fff;
  box-shadow: var(--ds-shadow);
}

.portal-content-card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
}

.portal-content-card-main {
  min-width: 0;
  flex: 1;
}

.portal-content-card-main h3 {
  margin: 7px 0 5px;
  color: var(--ds-ink-strong);
  font: 600 14px/1.25 var(--ds-display);
}

.portal-content-card-main p {
  margin: 0 0 6px;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.5;
}

.portal-content-card-main small {
  color: var(--ds-subtle);
  font-size: 10px;
}

/* The console referral workspace uses these classes without the historical
   admin stylesheet. Keep the rule, guidance and metrics as real components. */
.affiliate-layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr);
  align-items: stretch;
  gap: 16px;
}

.affiliate-rules-panel,
.affiliate-side-card,
.affiliate-data-panel {
  min-width: 0;
}

.affiliate-side-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  color: var(--ds-ink);
  background: linear-gradient(165deg, #fff, var(--ds-surface-muted));
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.affiliate-side-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 15px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 12px;
}

.affiliate-side-card h3 {
  margin: 3px 0 10px;
  color: var(--ds-ink-strong);
  font: 600 17px/1.25 var(--ds-display);
}

.affiliate-side-card ol {
  display: grid;
  gap: 13px;
  margin: 5px 0 22px;
  padding: 0;
  list-style: none;
}

.affiliate-side-card li {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: var(--ds-muted);
  font-size: 11px;
  line-height: 1.5;
}

.affiliate-side-card li b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  font-size: 10px;
}

.affiliate-side-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--ds-line);
}

.affiliate-side-footer span {
  color: var(--ds-muted);
  font-size: 10px;
}

.affiliate-side-footer strong {
  color: var(--ds-ink-strong);
  font-size: 17px;
}

.affiliate-stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin: 16px 0;
}

.affiliate-stat-card>div {
  min-width: 0;
}

.affiliate-code-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 16px 20px 20px;
  padding: 18px;
  background: var(--ds-brand-pale);
  border: 1px solid color-mix(in srgb, var(--ds-brand) 18%, var(--ds-line));
  border-radius: var(--ds-radius);
}

.affiliate-code-panel>div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.affiliate-code-panel strong {
  color: var(--ds-ink-strong);
  font: 650 20px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .04em;
  overflow-wrap: anywhere;
}

.affiliate-code-panel small {
  color: var(--ds-muted);
  font-size: 11px;
}

.affiliate-code-empty {
  background: var(--ds-surface-muted);
  border-color: var(--ds-line);
}

.renewal-price-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.affiliate-code-empty strong {
  font: 600 15px/1.3 var(--ds-display);
  letter-spacing: 0;
}

.affiliate-stat-card>div>span {
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 900px) {
  .affiliate-layout {
    grid-template-columns: 1fr;
  }

  .affiliate-side-card ol {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .content-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .affiliate-side-card ol {
    grid-template-columns: 1fr;
  }

  .content-overview-grid,
  .affiliate-stat-grid {
    grid-template-columns: 1fr;
  }
}

.form-feedback {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11px;
}

.form-feedback.error {
  color: var(--ds-danger);
  background: var(--ds-danger-bg);
  border: 1px solid #f5ccd5;
}

@media (max-width: 900px) {

  .seller-wallet-metrics,
  .announcement-grid-full {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {

  .seller-wallet-metrics,
  .announcement-grid-full {
    grid-template-columns: 1fr;
  }
}

/* Dedicated premium article workspace */
.article-editor-page {
  width: min(1500px, 100%);
  margin: -10px auto 0;
  display: grid;
  gap: 18px;
}

.article-editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 0;
  background: color-mix(in srgb, var(--ds-canvas) 94%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ds-line);
}

.article-editor-toolbar-main,
.article-editor-toolbar-actions,
.article-editor-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.article-editor-breadcrumb {
  color: var(--ds-muted);
  font-size: 11px;
}

.article-editor-breadcrumb strong {
  overflow: hidden;
  color: var(--ds-ink-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-editor-toolbar-actions>span {
  color: var(--ds-muted);
  font-size: 10px;
  white-space: nowrap;
}

.article-editor-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.article-editor-meta h2 {
  margin: 4px 0 5px;
  color: var(--ds-ink-strong);
  font: 600 25px/1.15 var(--ds-display);
}

.article-editor-meta p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 12px;
}

.editor-preview-toggle {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 9px;
}

.editor-preview-toggle button {
  padding: 7px 10px;
  color: var(--ds-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 10px;
}

.editor-preview-toggle button.is-active {
  color: var(--ds-brand-deep);
  background: #fff;
  box-shadow: var(--ds-shadow);
}

.article-editor-details {
  margin: 0;
}

.article-editor-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  padding: 0 18px 18px;
}

.article-editor-detail-grid .field:nth-child(2),
.article-editor-detail-grid .field:nth-child(4) {
  grid-column: span 2;
}

.article-editor-workspace {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr) 245px;
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.builder-palette,
.builder-canvas-shell,
.builder-inspector {
  min-width: 0;
  padding: 14px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
}

.builder-palette {
  display: grid;
  align-content: start;
  gap: 9px;
  position: sticky;
  top: 78px;
}

.builder-library-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  color: var(--ds-ink-strong);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.builder-palette small {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.45;
}

.builder-library-items {
  display: grid;
  gap: 7px;
}

.builder-palette.is-collapsed .builder-library-items,
.builder-palette.is-collapsed>small {
  display: none;
}

.builder-tool {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  text-align: left;
  font-size: 11px;
}

.builder-tool b {
  color: var(--ds-brand-deep);
  font-size: 14px;
}

.builder-tool:hover {
  color: var(--ds-brand-deep);
  border-color: color-mix(in srgb, var(--ds-brand) 35%, var(--ds-line));
  background: var(--ds-brand-pale);
}

.builder-canvas-shell {
  padding: 0;
  overflow: hidden;
  background: linear-gradient(145deg, var(--ds-surface-muted), #fff);
}

.builder-canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  color: var(--ds-muted);
  border-bottom: 1px solid var(--ds-line);
  font-size: 10px;
}

.builder-canvas-toolbar b {
  color: var(--ds-ink-strong);
}

.builder-canvas-toolbar span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-canvas {
  min-height: 520px;
  max-width: 100%;
  margin: 0 auto;
  padding: 18px;
  transition: max-width .2s ease;
}

.builder-canvas[data-preview-size="tablet"] {
  max-width: 760px;
}

.builder-canvas[data-preview-size="mobile"] {
  max-width: 420px;
}

.builder-block {
  min-width: 0;
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 11px;
  cursor: grab;
}

.builder-block:last-child {
  margin-bottom: 0;
}

.builder-block.is-selected {
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-brand) 14%, transparent);
}

.builder-block-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ds-subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.builder-block-toolbar>span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-block-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.builder-block-actions button {
  min-width: 25px;
  height: 25px;
  padding: 0 5px;
  color: var(--ds-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
}

.builder-block-actions button:first-child {
  padding-inline: 7px;
  font-size: 9px;
}

.builder-block-actions button:hover {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-color: var(--ds-line);
}

.builder-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  color: var(--ds-muted);
  text-align: center;
}

.builder-empty strong {
  color: var(--ds-ink-strong);
  font-size: 13px;
}

.builder-empty p {
  margin: 5px 0 0;
  font-size: 11px;
}

.builder-inspector {
  display: grid;
  align-content: start;
  gap: 12px;
  position: sticky;
  top: 78px;
}

.builder-inspector h4 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 14px/1.25 var(--ds-display);
}

.builder-inspector small {
  color: var(--ds-muted);
  font-size: 10px;
  line-height: 1.45;
}

.article-render [contenteditable="true"] {
  outline: 0;
  border-radius: 4px;
}

.article-render [contenteditable="true"]:hover,
.article-render [contenteditable="true"]:focus {
  background: var(--ds-brand-pale);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ds-brand) 15%, transparent);
}

@media (max-width: 1100px) {
  .article-editor-workspace {
    grid-template-columns: 175px minmax(0, 1fr);
  }

  .builder-inspector {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 760px) {

  .article-editor-toolbar,
  .article-editor-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .article-editor-toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .article-editor-toolbar-actions>span {
    margin-right: auto;
  }

  .article-editor-detail-grid {
    grid-template-columns: 1fr;
  }

  .article-editor-detail-grid .field:nth-child(2),
  .article-editor-detail-grid .field:nth-child(4) {
    grid-column: auto;
  }

  .article-editor-workspace {
    grid-template-columns: 1fr;
  }

  .builder-palette,
  .builder-inspector {
    position: static;
  }

  .builder-library-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .builder-library-items {
    grid-template-columns: 1fr;
  }

  .builder-canvas {
    padding: 10px;
  }

  .builder-block-actions button:first-child {
    display: none;
  }
}

/* Editor-specific compact behavior: preserve a readable canvas on laptop widths. */
.article-editor-page {
  min-width: 0;
  overflow: visible;
}

.article-editor-toolbar-main,
.article-editor-toolbar-actions {
  min-width: 0;
  flex-wrap: wrap;
}

.article-editor-toolbar-actions {
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .article-editor-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .builder-palette,
  .builder-inspector {
    position: static;
  }

  .builder-palette {
    order: 1;
  }

  .builder-canvas-shell {
    order: 2;
    min-width: 0;
  }

  .builder-inspector {
    order: 3;
  }

  .builder-library-items {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .builder-inspector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
  }

  .builder-inspector h4,
  .builder-inspector>.field-help,
  .builder-inspector>small {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1024px) {
  .article-editor-page {
    width: 100%;
  }

  .article-editor-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .article-editor-toolbar-main,
  .article-editor-toolbar-actions {
    width: 100%;
  }

  .article-editor-toolbar-actions {
    justify-content: flex-start;
  }

  .article-editor-toolbar-actions>span {
    margin-right: auto;
  }

  .article-editor-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-preview-toggle {
    align-self: flex-start;
  }

  .article-editor-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-editor-detail-grid .field:nth-child(2),
  .article-editor-detail-grid .field:nth-child(4) {
    grid-column: auto;
  }

  .builder-library-items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .builder-inspector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .article-editor-toolbar {
    padding-top: 4px;
  }

  .article-editor-toolbar-actions .btn {
    flex: 1 1 auto;
  }

  .article-editor-toolbar-actions>span {
    flex-basis: 100%;
  }

  .article-editor-detail-grid {
    grid-template-columns: 1fr;
    padding-inline: 14px;
  }

  .builder-library-items,
  .builder-inspector {
    grid-template-columns: 1fr;
  }

  .builder-canvas {
    padding: 10px;
  }

  .article-editor-meta h2 {
    font-size: 21px;
  }
}

body:has(.article-editor-page) .toast-host {
  top: 74px;
  right: 22px;
  bottom: auto;
}

@media (max-width: 560px) {
  body:has(.article-editor-page) .toast-host {
    top: 68px;
    right: 14px;
    width: calc(100vw - 28px);
  }
}

@media (max-width: 1120px) {
  .app-shell:has(.article-editor-page) .main-shell {
    margin-left: 0;
  }

  .app-shell:has(.article-editor-page) .sidebar {
    transform: translateX(-105%);
    visibility: hidden;
  }

  .app-shell:has(.article-editor-page) .mobile-backdrop {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

/* Schema-v2 canvas hierarchy and navigator. */
.builder-navigator {
  min-width: 150px;
  max-height: 520px;
  overflow: auto;
  padding: 14px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  position: sticky;
  top: 78px;
}

.builder-navigator h4 {
  margin: 0 0 10px;
  color: var(--ds-ink-strong);
  font: 600 14px/1.25 var(--ds-display);
}

.navigator-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 7px calc(8px + (var(--depth) * 14px));
  color: var(--ds-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  font-size: 11px;
}

.navigator-item:hover,
.navigator-item.is-selected {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
}

.navigator-icon {
  color: var(--ds-brand);
  font-weight: 700;
}

.builder-node {
  position: relative;
  min-width: 0;
}

.builder-node.is-selected {
  outline: 2px solid color-mix(in srgb, var(--ds-brand) 65%, transparent);
  outline-offset: 3px;
}

.article-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
  padding: 18px 14px 14px;
  background: color-mix(in srgb, var(--ds-brand-pale) 45%, #fff);
  border: 1px dashed var(--ds-line-strong);
  border-radius: 12px;
}

.article-column {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px dashed color-mix(in srgb, var(--ds-line-strong) 70%, transparent);
  border-radius: 9px;
}

.article-section>.article-column {
  width: 100%;
}

.builder-node-label {
  position: absolute;
  top: 5px;
  left: 8px;
  color: var(--ds-subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  pointer-events: none;
}

.article-section>.article-column {
  padding-top: 18px;
}

.builder-canvas.is-preview .builder-block-toolbar,
.builder-canvas.is-preview .builder-node-label {
  display: none;
}

.builder-canvas.is-preview .builder-node.is-selected {
  outline: 0;
}

@media (min-width: 1181px) {
  .article-editor-workspace {
    grid-template-columns: 190px minmax(0, 1fr) 245px 170px;
  }
}

@media (max-width: 1180px) {
  .builder-navigator {
    order: 4;
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .article-section {
    padding: 15px 9px 9px;
  }

  .article-column {
    padding: 8px;
  }

  .builder-navigator {
    min-width: 0;
  }
}

/* Consistent touch layouts across every panel route. */
@media (max-width: 760px) {
  html,
  body,
  #app {
    width: 100%;
    min-width: 320px;
    max-width: 100%;
    overflow-x: clip;
  }

  #app>.app-shell {
    height: 100dvh;
    min-height: 100svh;
    overflow: hidden;
  }

  .main-shell {
    width: 100%;
    height: 100dvh;
    min-height: 100svh;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
  }

  .topbar {
    min-height: 60px;
    gap: 10px;
    padding-inline: 14px;
  }

  .topbar-heading,
  .topbar-actions {
    min-width: 0;
  }

  .page-content {
    min-width: 0;
    padding: 22px 16px calc(32px + env(safe-area-inset-bottom));
  }

  .page-head {
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 16px;
  }

  .page-head h2 {
    font-size: clamp(24px, 7vw, 30px);
    overflow-wrap: anywhere;
  }

  .page-head p {
    font-size: 13px;
  }

  .page-head-actions,
  .page-head-actions>.button-row,
  .page-head-actions>.button-row>.btn {
    width: 100%;
  }

  .page-head-actions>.btn,
  .page-head-actions>.button-row>.btn {
    flex: 1 1 100%;
    min-width: 0;
  }

  .page-stat-grid,
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
    border-radius: 12px;
  }

  .page-stat-grid .metric,
  .metrics .metric {
    min-width: 0;
    min-height: 86px;
    padding: 13px;
    border: 0;
    border-right: 1px solid var(--ds-line);
    border-bottom: 1px solid var(--ds-line);
  }

  .page-stat-grid .metric:nth-child(2n),
  .metrics .metric:nth-child(2n) {
    border-right: 0;
  }

  .page-stat-grid .metric:last-child,
  .metrics .metric:last-child {
    border-bottom: 0;
  }

  .metric-value {
    font-size: clamp(19px, 6vw, 23px);
    overflow-wrap: anywhere;
  }

  .panel,
  .map-panel,
  .announcement-card,
  .help-card,
  .section-panel,
  .portal-action-card,
  .portal-focus-card,
  .portal-help-card,
  .affiliate-stat-card,
  .affiliate-withdraw-panel,
  .affiliate-how {
    min-width: 0;
    border-radius: 13px;
  }

  .panel-head,
  .map-panel-head,
  .section-panel-head {
    gap: 10px;
    padding: 15px 16px;
  }

  .panel-actions,
  .panel-actions>.button-row {
    min-width: 0;
    max-width: 100%;
  }

  .panel-body {
    min-width: 0;
    padding: 16px;
  }

  .panel-toolbar,
  .bulk-toolbar {
    gap: 10px;
    padding: 12px 14px;
  }

  .filter-panel .panel-body {
    padding: 14px;
  }

  .filter-row,
  .form-grid,
  .client-filter-grid,
  .pricing-summary-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }

  .field,
  .payment-field {
    min-width: 0;
  }

  .input,
  .select,
  .textarea,
  input:not([type=checkbox]):not([type=radio]):not([type=file]),
  select,
  textarea {
    min-width: 0;
    min-height: 44px;
    font-size: 16px;
  }

  .button-row,
  .page-head-actions,
  .panel-actions,
  .form-footer {
    flex-wrap: wrap;
  }

  .button-row>.btn,
  .panel-actions>.btn {
    min-width: 0;
    min-height: 44px;
  }

  .form-footer {
    gap: 9px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  }

  .form-footer>.btn,
  .form-footer>.button {
    flex: 1 1 100%;
    min-width: 0;
    min-height: 44px;
  }

  .table-wrap {
    max-width: 100%;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .data-table td,
  .data-table td strong,
  .data-table td small,
  .data-table td>span,
  .data-table td>a {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .data-table td.table-actions,
  .data-table td.client-actions {
    gap: 8px;
  }

  .data-table td.table-actions .icon-button,
  .data-table td.client-actions .icon-button,
  .icon-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .action-strip,
  .detail-actions,
  .client-actions {
    min-width: 0;
    flex-wrap: wrap;
  }

  .modal,
  .client-modal {
    align-items: end;
    justify-items: center;
    padding: 8px 8px env(safe-area-inset-bottom);
  }

  .modal-card,
  .modal-card.modal-wide,
  .client-modal-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top));
    border-radius: 18px 18px 12px 12px;
  }

  .modal-head,
  .client-modal-head {
    min-height: 64px;
    gap: 10px;
    padding: 14px 16px;
  }

  .modal-head h3,
  .client-modal-head h2 {
    font-size: 17px;
    overflow-wrap: anywhere;
  }

  .modal-body {
    min-height: 0;
    overflow: auto;
    padding: 16px;
    overscroll-behavior: contain;
  }

  .modal-body-framed {
    padding: 0;
  }

  .modal-scroll-content {
    padding: 16px 16px 24px;
  }

  .client-modal-content {
    min-height: 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .modal-footer,
  .client-modal .modal-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .modal-footer>.btn,
  .modal-footer>.button,
  .client-modal .modal-footer>.button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .portal-shell {
    width: calc(100% - 32px);
    max-width: 760px;
  }

  .portal-intro {
    gap: 10px;
    padding-top: 28px;
  }

  .portal-intro h1 {
    font-size: clamp(28px, 8vw, 36px);
    overflow-wrap: anywhere;
  }

  .portal-intro-status {
    padding-block: 4px;
  }

  .portal-tabs {
    position: sticky;
    top: 0;
    z-index: 8;
    max-width: 100%;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
    -webkit-overflow-scrolling: touch;
  }

  .portal-tabs button {
    min-height: 42px;
  }

  .portal-hero {
    gap: 16px;
    padding: 20px;
    border-radius: 16px;
  }

  .portal-hero h2 {
    font-size: clamp(21px, 6vw, 25px);
    overflow-wrap: anywhere;
  }

  .section-panel-head {
    align-items: flex-start;
  }

  .portal-notice-title-row,
  .portal-content-card,
  .affiliate-code-panel {
    min-width: 0;
  }

  .article-editor-page,
  .article-editor-workspace,
  .builder-canvas-shell {
    min-width: 0;
    max-width: 100%;
  }

  .article-editor-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  .page-content {
    padding-inline: 12px;
  }

  .page-stat-grid,
  .metrics,
  .portal-metric-strip,
  .affiliate-stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-stat-grid .metric,
  .metrics .metric {
    border-right: 0;
    border-bottom: 1px solid var(--ds-line);
  }

  .page-stat-grid .metric:last-child,
  .metrics .metric:last-child {
    border-bottom: 0;
  }

  .portal-shell {
    width: calc(100% - 24px);
  }

  .portal-metric-strip>div:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .brand-bar {
    gap: 8px;
    padding-inline: 12px;
  }

  .brand-lockup .brand-logo-horizontal {
    max-width: 132px;
  }

  .brand-bar-actions {
    gap: 6px;
  }

  .portal-alert-button,
  .portal-logout {
    min-width: 40px;
    justify-content: center;
    padding-inline: 8px;
  }

  .login-card,
  .client-login-card {
    padding: 22px 18px;
  }

  .login-brand,
  .client-login-visual {
    min-height: 260px;
    padding: 24px 18px;
  }

  .data-table td::before {
    flex-basis: 34%;
  }
}

.blog-admin-list,
.tutorial-library {
  display: grid;
  gap: 12px;
}

.blog-admin-card {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}

.blog-admin-card-copy,
.tutorial-card-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.blog-admin-badges,
.blog-admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.blog-admin-card h3 {
  margin: 0;
  color: var(--ds-ink-strong);
  font: 600 17px/1.3 var(--ds-display);
  overflow-wrap: anywhere;
}

.blog-admin-card small,
.tutorial-card small {
  color: var(--ds-muted);
  font-size: 11px;
}

.blog-editor-form {
  display: grid;
  gap: 14px;
}

.blog-editor-label {
  display: grid;
  gap: 3px;
  color: var(--ds-ink-strong);
  font-size: 12px;
}

.blog-editor-label span {
  color: var(--ds-muted);
  font-size: 11px;
  font-weight: 400;
}

.blog-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-line);
  border-radius: 10px 10px 0 0;
}

.blog-tool {
  min-height: 36px;
  padding: 6px 9px;
  color: var(--ds-ink);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
}

.blog-tool:hover {
  color: var(--ds-brand-deep);
  background: var(--ds-brand-pale);
  border-color: color-mix(in srgb, var(--ds-brand) 34%, var(--ds-line));
}

.blog-preview-toggle {
  margin-left: auto;
}

.blog-editor-stage {
  min-width: 0;
  min-height: 400px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
}

.blog-editor-canvas,
.blog-editor-preview {
  width: 100%;
  min-width: 0;
  min-height: 400px;
}

.blog-editor-canvas {
  padding: 20px;
  outline: 0;
  color: var(--ds-ink);
  font: 15px/1.7 var(--ds-font);
}

.blog-editor-canvas:focus {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ds-brand) 24%, transparent);
}

.blog-editor-canvas[hidden],
.blog-editor-preview[hidden] {
  display: none;
}

.blog-editor-preview {
  display: block;
  height: 480px;
  border: 0;
  background: #fff;
}

.blog-editor-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: #fff;
}

.blog-render,
.blog-editor-canvas {
  overflow-wrap: anywhere;
}

.blog-render h1,
.blog-render h2,
.blog-render h3,
.blog-editor-canvas h1,
.blog-editor-canvas h2,
.blog-editor-canvas h3 {
  color: var(--ds-ink-strong);
  line-height: 1.25;
}

.blog-render p,
.blog-editor-canvas p {
  margin: 0 0 1em;
}

.blog-render a:not(.blog-button),
.blog-editor-canvas a:not(.blog-button) {
  color: var(--ds-brand-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.blog-render img,
.blog-editor-canvas img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.blog-render figure,
.blog-editor-canvas figure {
  margin: 18px 0;
}

.blog-render blockquote,
.blog-editor-canvas blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  color: var(--ds-muted);
  background: var(--ds-surface-muted);
  border-left: 4px solid var(--ds-brand);
  border-radius: 0 9px 9px 0;
}

.blog-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.blog-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  color: #fff !important;
  background: var(--ds-brand);
  border-radius: 9px;
  font-weight: 600;
  text-decoration: none !important;
}

.blog-video {
  width: 100%;
  margin: 18px 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #0f1d31;
  border-radius: 12px;
}

.blog-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.tutorial-card {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px;
  color: var(--ds-ink);
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  text-align: left;
  box-shadow: var(--ds-shadow);
}

.tutorial-card:hover {
  border-color: color-mix(in srgb, var(--ds-brand) 34%, var(--ds-line));
  transform: translateY(-1px);
}

.tutorial-card>svg:last-child {
  margin-left: auto;
  color: var(--ds-brand-deep);
}

.tutorial-card-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  color: var(--ds-brand-deep);
  background: var(--ds-brand-soft);
  border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
}