.crm-app {
  background: #f4f6fa;
}

body[data-layout-page="crm-accounts"] [hidden] {
  display: none !important;
}

.crm-page,
.crm-detail-page {
  min-height: calc(100vh - var(--app-chrome-height, 131px));
  padding: 12px 10px 60px;
}

.crm-shell,
.crm-detail-shell {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
}

.crm-heading {
  display: block;
  margin-bottom: 14px;
  padding: 4px 4px 6px;
}

.crm-heading h1 {
  margin: 0;
  color: #0f172a;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.crm-heading p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 800;
}

.crm-filter-card,
.crm-tag-filter-card,
.crm-table-card,
.detail-work-card,
.detail-side-card {
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.055);
}

.crm-filter-card {
  padding: 18px;
}

.crm-filter-grid,
.crm-filter-advanced {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px 18px;
  align-items: end;
}

.crm-filter-advanced {
  margin-top: 14px;
}

.crm-filter-advanced[hidden] {
  display: none;
}

.crm-field {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.crm-field > span {
  color: #475569;
  font-size: 12px;
  font-weight: 950;
}

.crm-field input,
.crm-field select,
.date-range,
.select-combo,
.filter-search-input {
  width: 100%;
  height: 40px;
  min-width: 0;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.crm-field input,
.crm-field select {
  padding: 0 14px;
}

.crm-field input::placeholder,
.date-range input::placeholder,
.select-combo input::placeholder,
.filter-search-input input::placeholder {
  color: #a8b2c3;
}

.date-range,
.select-combo,
.phone-input,
.filter-search-input {
  display: flex;
  align-items: center;
}

.filter-search-input {
  gap: 9px;
  padding: 0 12px;
}

.filter-search-input svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #64748b;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.filter-search-input input {
  height: 100%;
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
}

.date-range {
  padding: 0 8px 0 0;
}

.date-range input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 12px;
}

.date-range i {
  width: 1px;
  height: 22px;
  background: #c5cedb;
}

.date-range svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #9ba7ba;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.select-combo {
  overflow: hidden;
}

.select-combo input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 14px;
}

.select-combo button {
  height: 100%;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 0;
  border-left: 1px solid #d8e1ef;
  background: #fff;
  color: var(--blue-ink);
  font-weight: 850;
}

.crm-filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e8edf5;
}

.crm-filter-action-group,
.crm-filter-toggle {
  display: inline-flex;
  align-items: center;
}

.crm-filter-action-group {
  gap: 10px;
}

.crm-filter-actions .primary-action,
.crm-filter-actions .secondary-action {
  min-width: 92px;
  height: 38px;
  border-radius: 5px;
}

.crm-filter-actions .primary-action {
  padding: 0 14px;
}

.crm-filter-toggle {
  height: 38px;
  justify-content: center;
  gap: 7px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--blue-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.crm-filter-toggle:hover {
  background: rgba(37, 99, 235, 0.08);
}

.crm-filter-toggle:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 1px;
}

.crm-filter-toggle-count {
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue-ink);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.crm-filter-toggle.has-active-filter .crm-filter-toggle-count {
  background: var(--blue-ink);
  color: #fff;
}

.advanced-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  transition: transform 0.16s ease;
}

.crm-filter-card.is-expanded .advanced-toggle svg {
  transform: rotate(180deg);
}

.crm-tag-filter-card {
  margin-top: 14px;
  padding: 12px 14px;
}

.tag-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tag-filter-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 950;
}

.tag-filter-title-row {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.tag-reset-link {
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--blue-ink);
  font-size: 12px;
  font-weight: 900;
}

.tag-reset-link:hover {
  background: #eff6ff;
}

.tag-filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.tag-filter-actions .icon-action {
  width: 32px;
  height: 32px;
  color: #64748b;
}

.tag-filter-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.tag-filter-grid::-webkit-scrollbar {
  display: none;
}

.tag-filter-item {
  width: 176px;
  min-width: 176px;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.tag-filter-item:hover,
.tag-filter-item.active {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

.tag-filter-item.active {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px var(--blue);
}

.tag-filter-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--blue-ink);
}

.tag-filter-icon svg,
.tag-filter-info,
.crm-table-toolbar svg,
.crm-action-menu svg,
.row-more svg,
.detail-side-card svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.tag-filter-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  flex: 1 1 auto;
}

.tag-filter-copy strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  line-height: 1;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-filter-copy small {
  overflow: hidden;
  color: #747b86;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-filter-info {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e1ef;
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-size: 11px;
  font-style: italic;
  font-weight: 950;
  line-height: 1;
  stroke: none;
}

.tag-filter-item.green {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.tag-filter-item.green .tag-filter-icon {
  background: #d1fae5;
  color: #059669;
}

.tag-filter-item.amber {
  border-color: #fde68a;
  background: #fffbeb;
}

.tag-filter-item.amber .tag-filter-icon {
  background: #fef3c7;
  color: #b45309;
}

.tag-filter-item.purple {
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.tag-filter-item.purple .tag-filter-icon {
  background: #ede9fe;
  color: #7c3aed;
}

.tag-filter-item.slate {
  background: #f8fafc;
}

.crm-table-card {
  margin-top: 18px;
  overflow: hidden;
}

.crm-table-toolbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid #edf1f7;
}

.crm-table-toolbar .toolbar-left,
.crm-table-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.crm-table-toolbar .primary-action,
.crm-table-toolbar .secondary-action {
  height: 42px;
  border-radius: 8px;
}

.column-menu {
  position: relative;
  display: inline-flex;
}

.column-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 15;
  width: 238px;
  padding: 8px;
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
}

.column-menu-head {
  display: grid;
  gap: 3px;
  padding: 8px 8px 9px;
  border-bottom: 1px solid #edf1f7;
}

.column-menu-head strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
}

.column-menu-head span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.column-menu-list {
  max-height: 318px;
  display: grid;
  gap: 2px;
  overflow: auto;
  padding-top: 6px;
}

.column-menu-item {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  border-radius: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.column-menu-item:hover {
  background: #eff6ff;
}

.column-menu-item input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue-ink);
}

.column-menu-item span {
  flex: 1 1 auto;
}

.column-menu-item small {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 850;
}

.column-menu-item.is-locked {
  color: #64748b;
  cursor: default;
}

.column-menu-item.is-locked:hover {
  background: transparent;
}

.crm-table-wrap {
  overflow: auto;
}

.crm-table {
  width: 100%;
  min-width: 1480px;
  border-collapse: collapse;
  color: #0f172a;
}

.crm-table th,
.crm-table td {
  padding: 14px 13px;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.crm-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

.crm-table td {
  background: #fff;
  font-size: 14px;
  line-height: 1.35;
  max-width: 180px;
}

.crm-table tbody tr:hover td {
  background: #fbfdff;
}

.crm-table th.actions-column,
.crm-table td.actions-cell {
  position: sticky;
  right: 0;
  min-width: 92px;
  width: 92px;
  background: #fff;
  box-shadow: -10px 0 18px rgba(15, 23, 42, 0.06);
}

.crm-table th.actions-column {
  z-index: 6;
  background: #f8fafc;
}

.crm-table td.actions-cell {
  z-index: 4;
}

.crm-table tbody tr:hover td.actions-cell {
  background: #fbfdff;
}

.crm-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #0b7cff;
}

.account-name,
.parent-account {
  display: grid;
  gap: 4px;
  line-height: 1.28;
}

.account-name strong,
.parent-account strong {
  max-width: 132px;
  overflow: hidden;
  color: #0f172a;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name small,
.parent-account small,
.contact-cell small,
.crm-table td small {
  display: block;
  margin-top: 4px;
  max-width: 132px;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-cell strong {
  display: inline-block;
  max-width: 132px;
  overflow: hidden;
  color: #0f172a;
  font-weight: 900;
  text-overflow: ellipsis;
  vertical-align: top;
}

.code-text {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  color: #475569;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  vertical-align: top;
}

.account-name strong,
.account-name small,
.parent-account strong,
.parent-account small,
.contact-cell strong,
.contact-cell small {
  overflow: visible;
}

.parent-account small {
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.crm-tooltip-trigger {
  position: relative;
  display: inline-block;
  max-width: 100%;
  cursor: help;
}

.crm-tooltip-trigger.code-text {
  overflow: visible;
}

.crm-tooltip-trigger::after {
  content: attr(data-full);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: min(360px, 70vw);
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
  font-family: var(--font-main, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.crm-tooltip-trigger::before {
  content: "";
  position: absolute;
  top: calc(100% + 3px);
  left: 16px;
  z-index: 21;
  width: 9px;
  height: 9px;
  background: #0f172a;
  opacity: 0;
  pointer-events: none;
  transform: rotate(45deg) translateY(-3px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.crm-tooltip-trigger:hover::after,
.crm-tooltip-trigger:focus-visible::after,
.crm-tooltip-trigger:hover::before,
.crm-tooltip-trigger:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

.switch-control.crm-switch {
  width: 43px;
  height: 24px;
}

.switch-control.crm-switch span {
  background: #cbd5e1;
}

.switch-control.crm-switch span::after {
  width: 20px;
  height: 20px;
  top: 2px;
  left: 2px;
}

.switch-control.crm-switch input:checked + span {
  background: #0578ff;
}

.switch-control.crm-switch input:checked + span::after {
  transform: translateX(19px);
}

.status-switch-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.status-cell {
  width: 80px;
}

.crm-tag-stack {
  max-width: 210px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.crm-tag {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.crm-tag.green {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.crm-tag.amber {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}

.crm-tag.purple {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: #7c3aed;
}

.crm-tag.red {
  border-color: #fecaca;
  background: #fff1f2;
  color: #dc2626;
}

.crm-tag.slate,
.crm-tag.muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.status-chip,
.account-chip,
.tiny-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.status-chip {
  background: #f1f5f9;
  color: #475569;
}

.status-chip.open {
  background: #ecfdf5;
  color: #047857;
}

.status-chip.cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.account-chip {
  background: #eff6ff;
  color: var(--blue-ink);
}

.account-chip.demo {
  background: #f5f3ff;
  color: #7c3aed;
}

.tiny-chip.green {
  background: #ecfdf5;
  color: #047857;
}

.tiny-chip.amber {
  background: #fffbeb;
  color: #b45309;
}

.tiny-chip.slate {
  background: #f1f5f9;
  color: #64748b;
}

.crm-action-group {
  position: relative;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.crm-action-main {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--blue-ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.crm-action-main:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.crm-action-menu {
  position: relative;
}

.crm-action-menu[open] {
  z-index: 12;
}

.crm-action-menu summary {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  list-style: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.crm-action-menu summary::-webkit-details-marker {
  display: none;
}

.crm-action-menu summary:hover,
.crm-action-menu[open] summary {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--blue-ink);
}

.crm-action-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 128px;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}

.crm-action-menu-panel button {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
  text-align: left;
}

.crm-action-menu-panel button:hover {
  background: #eff6ff;
  color: #0b7cff;
}

.crm-table tr:has(.crm-action-menu[open]) td.actions-cell {
  z-index: 10;
}

.crm-table-card .table-footer {
  margin-top: 0;
}

.crm-row-actions {
  display: none;
}

.crm-account-modal {
  width: min(1040px, calc(100vw - 48px));
  max-height: min(88vh, 920px);
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
}

.account-modal-header {
  min-height: auto;
  padding: 18px 22px;
  border-bottom: 1px solid #edf1f7;
}

.account-modal-header h2 {
  color: #0f172a;
  font-size: 22px;
  font-weight: 900;
}

.account-modal-close {
  flex: 0 0 auto;
}

.account-modal-close svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.account-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  background: #f8fafc;
}

.account-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 18px;
}

.account-form .field {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 8px;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.account-form .field > span {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  padding: 0;
  color: #0f172a;
  font-size: 13px;
  text-align: left;
  white-space: normal;
}

.account-form .field > span em {
  color: #94a3b8;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.account-form .field.required > span::before,
.account-form .field.required > span::after {
  content: none !important;
}

.account-form .field input,
.account-form .field select,
.phone-input,
.account-form .select-combo {
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.04);
}

.account-form .field input,
.account-form .field select {
  padding: 0 12px;
}

.account-form .field small,
.name-helper {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.name-helper {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1677ff;
  font-weight: 850;
  text-align: left;
}

.phone-input {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.phone-input select {
  width: 86px;
  flex: 0 0 86px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.phone-input input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.account-form .select-combo {
  overflow: hidden;
}

.account-form .select-combo input {
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.account-form .select-combo button {
  height: 100%;
  padding: 0 14px;
  border: 0;
  border-left: 1px solid var(--border);
  background: #fff;
  color: var(--blue-ink);
  font-size: 13px;
  font-weight: 850;
}

.modal-switch {
  margin-top: 2px;
}

.account-modal-footer {
  margin: 24px -24px -24px;
  padding: 16px 22px;
  border-top: 1px solid #edf1f7;
  background: #fff;
}

.account-modal-footer .secondary-action,
.account-modal-footer .primary-action {
  min-width: 96px;
}

.crm-tag-assign-modal {
  width: min(620px, calc(100vw - 32px));
  max-height: min(84vh, 760px);
  display: flex;
  flex-direction: column;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
}

.tag-assign-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid #edf1f7;
}

.tag-assign-header > div {
  display: grid;
  gap: 4px;
}

.tag-assign-header span {
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.tag-assign-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
  font-weight: 950;
}

.tag-assign-close {
  display: grid;
  place-items: center;
  color: #64748b;
}

.crm-tag-assign-modal form {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tag-assign-account {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 16px 16px 0;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  background: #f7faff;
}

.tag-assign-account > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.tag-assign-account strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 950;
}

.tag-assign-account span,
.tag-assign-account small {
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.tag-assign-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 700;
}

.tag-assign-note i {
  color: var(--blue-ink);
}

.tag-assign-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  overflow-y: auto;
  padding: 14px 16px 18px;
}

.tag-assign-option {
  position: relative;
  min-height: 64px;
  display: grid;
  grid-template-columns: 22px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.tag-assign-option:hover {
  border-color: #bfdbfe;
  background: #fbfdff;
}

.tag-assign-option.is-automatic {
  background: #f8fafc;
  cursor: default;
}

.tag-assign-option > input {
  position: absolute;
  opacity: 0;
}

.tag-assign-check {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: transparent;
  font-size: 12px;
}

.tag-assign-option > input:checked + .tag-assign-check {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.tag-assign-option > input:disabled + .tag-assign-check {
  opacity: 0.72;
}

.tag-assign-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.tag-assign-copy strong {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.tag-assign-copy small {
  overflow: hidden;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-assign-lock {
  color: #94a3b8;
}

.tag-assign-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
}

.tag-assign-footer {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid #edf1f7;
  background: #fff;
}

.tag-assign-footer > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-manage-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--blue-ink);
  font-size: 12px;
  font-weight: 900;
}

:root[data-theme="dark"] :is(.crm-tag-assign-modal, .tag-assign-header, .tag-assign-option, .tag-assign-footer) {
  border-color: var(--border);
  background: var(--surface-raised);
}

:root[data-theme="dark"] :is(.tag-assign-header h2, .tag-assign-account strong, .tag-assign-copy strong) {
  color: var(--text);
}

:root[data-theme="dark"] :is(.tag-assign-account, .tag-assign-note, .tag-assign-option.is-automatic) {
  border-color: var(--border);
  background: var(--surface-muted);
}

.crm-detail-page {
  background: var(--page-bg);
  color: var(--text);
}

.crm-detail-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 386px;
  gap: 16px;
  align-items: start;
}

.detail-main-column {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.detail-module-card,
.detail-side-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised, var(--surface));
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.detail-module-card {
  overflow: hidden;
}

.detail-module-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
}

.detail-module-head span,
.profile-card-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.detail-module-head h2,
.profile-card-head h2 {
  margin: 4px 0 0;
  color: var(--text-strong, var(--text));
  font-size: 17px;
  line-height: 1.2;
  font-weight: 950;
  letter-spacing: 0;
}

.detail-module-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: right;
}

.detail-metrics-card .detail-module-head {
  min-height: auto;
  padding: 14px 16px 6px;
  border-bottom: 0;
}

.detail-work-head {
  border-bottom: 0;
  padding-bottom: 10px;
}

.detail-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  padding: 4px 16px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.detail-kpi-item {
  min-height: 58px;
  display: grid;
  align-content: center;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: none;
}

.detail-kpi-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
}

.detail-kpi-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.detail-kpi-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.detail-kpi-copy strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-kpi-copy small {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 16px;
  line-height: 1.1;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-kpi-item.tone-success {
  border-color: rgba(5, 150, 105, 0.22);
  background: var(--success-soft);
}

.detail-kpi-item.tone-success .detail-kpi-icon {
  background: rgba(5, 150, 105, 0.12);
  color: var(--success);
}

.detail-kpi-item.tone-success .detail-kpi-copy small {
  color: var(--success);
}

.detail-kpi-item.tone-status .detail-kpi-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.detail-kpi-item.tone-purple .detail-kpi-icon {
  background: var(--purple-soft);
  color: var(--purple);
}

.detail-kpi-item.tone-slate .detail-kpi-icon {
  background: var(--surface-muted);
  color: var(--muted);
}

.detail-metric-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.detail-metric-actions[hidden] {
  display: none;
}

.detail-metric-actions .icon-action {
  width: 32px;
  height: 32px;
  color: var(--muted);
}

.detail-metric-actions .icon-action:hover {
  color: var(--blue);
}

.detail-metric-actions .icon-action:disabled {
  background: var(--surface-muted);
  color: var(--text-soft);
  cursor: not-allowed;
}

.detail-work-card {
  overflow: hidden;
}

.detail-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border-light);
  scrollbar-width: thin;
}

.detail-tabs button {
  min-width: max-content;
  height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.detail-tabs button:hover {
  background: var(--surface-hover);
  color: var(--blue);
}

.detail-tabs button.active {
  border-color: rgba(var(--blue-rgb), 0.26);
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: none;
}

.detail-tab-toolbar {
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.detail-tab-toolbar[hidden] {
  display: none;
}

.detail-tab-toolbar .purpose-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.detail-tab-toolbar .purpose-toggle button {
  height: 32px;
  min-width: 64px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.detail-tab-toolbar .purpose-toggle button.active {
  background: var(--blue);
  color: #fff;
}

.toolbar-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
}

.compact-date-range {
  width: 330px;
  height: 38px;
  border-color: var(--border);
  border-radius: 8px;
  background: var(--input-bg);
}

.compact-date-range input {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.add-follow {
  min-width: 88px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-left: auto;
  border-radius: 8px;
}

.add-follow svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.detail-tab-body {
  min-height: 250px;
  padding: 18px;
}

.detail-tab-panel {
  display: grid;
  gap: 16px;
}

.detail-tab-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.detail-tab-panel-head h3 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 16px;
  line-height: 1.2;
  font-weight: 950;
}

.detail-tab-panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.detail-empty-illustration {
  min-height: 166px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  text-align: center;
  font-weight: 850;
}

.detail-empty-illustration svg {
  width: 132px;
  height: 88px;
  margin: 0 auto 8px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  opacity: 0.72;
}

.detail-info-grid,
.detail-mini-table,
.activity-list {
  display: grid;
  gap: 10px;
}

.detail-info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-info-grid article,
.activity-row,
.detail-mini-table article {
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.detail-info-grid span,
.detail-mini-table span,
.activity-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.detail-info-grid strong,
.detail-mini-table strong,
.activity-row strong {
  display: block;
  min-width: 0;
  margin-top: 6px;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 15px;
  line-height: 1.35;
  font-weight: 950;
  text-overflow: ellipsis;
}

.account-operation-panel {
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.account-operation-list {
  display: grid;
}

.account-operation-option {
  position: relative;
  min-height: 64px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  cursor: pointer;
  transition: background 140ms ease;
}

.account-operation-option:last-child {
  border-bottom: 0;
}

.account-operation-option:hover {
  background: var(--surface-hover);
}

.account-operation-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.account-operation-check {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
  color: transparent;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.account-operation-check svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.account-operation-option input:checked + .account-operation-check {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 3px 8px color-mix(in srgb, var(--blue) 20%, transparent);
}

.account-operation-option input:focus-visible + .account-operation-check {
  outline: 3px solid color-mix(in srgb, var(--blue) 20%, transparent);
  outline-offset: 2px;
}

.account-operation-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.account-operation-copy strong {
  color: var(--text-strong, var(--text));
  font-size: 14px;
  line-height: 1.3;
  font-weight: 900;
}

.account-operation-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 750;
}

.account-operation-state {
  min-width: 50px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 850;
}

.account-operation-option.is-enabled .account-operation-state {
  background: var(--blue-soft);
  color: var(--blue);
}

.account-operation-hint {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 9px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 750;
}

.account-operation-hint svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.account-activity-table-card {
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.account-activity-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 210px) minmax(150px, 190px) auto;
  align-items: end;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}

.account-activity-filter-bar label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.account-activity-filter-bar input,
.account-activity-filter-bar select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  outline: none;
  background: var(--surface-muted);
  color: var(--text-strong, var(--text));
  font-size: 13px;
  font-weight: 850;
}

.account-activity-filter-bar input:focus,
.account-activity-filter-bar select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.12);
}

.account-activity-filter-bar .compact-action {
  min-width: 72px;
  height: 38px;
}

.account-activity-table-wrap {
  overflow-x: scroll;
  scrollbar-color: var(--border) var(--surface-muted);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

.account-activity-table-wrap::-webkit-scrollbar {
  height: 10px;
}

.account-activity-table-wrap::-webkit-scrollbar-track {
  background: var(--surface-muted);
}

.account-activity-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-muted);
  border-radius: 999px;
  background: var(--border);
}

.account-activity-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.account-activity-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
}

.account-activity-table th:nth-child(1),
.account-activity-table td:nth-child(1) {
  width: 220px;
}

.account-activity-table th:nth-child(2),
.account-activity-table td:nth-child(2) {
  width: 170px;
}

.account-activity-table th:nth-child(3),
.account-activity-table td:nth-child(3) {
  width: 120px;
}

.account-activity-table th:nth-child(4),
.account-activity-table td:nth-child(4) {
  width: 270px;
}

.account-activity-table th:nth-child(5),
.account-activity-table td:nth-child(5) {
  width: 160px;
}

.account-activity-table th:nth-child(6),
.account-activity-table td:nth-child(6) {
  width: 150px;
}

.account-activity-table th:nth-child(7),
.account-activity-table td:nth-child(7) {
  width: 90px;
}

.account-activity-table th,
.account-activity-table td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 850;
  text-align: left;
  vertical-align: middle;
}

.account-activity-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.account-activity-table tr:last-child td {
  border-bottom: 0;
}

.account-activity-table .account-activity-empty-row td {
  height: 120px;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
}

.account-activity-table td > strong {
  display: block;
  color: var(--text-strong, var(--text));
  font-weight: 950;
}

.account-activity-table td small {
  display: block;
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-device-cell,
.activity-ip-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-device-cell strong,
.activity-ip-cell span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-trust-chip {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(101, 163, 13, 0.45);
  border-radius: 6px;
  background: rgba(132, 204, 22, 0.12);
  color: #65a30d;
  font-size: 12px;
  font-weight: 950;
}

.activity-risk-badge {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 950;
}

.activity-risk-badge.red {
  border: 1px solid rgba(220, 38, 38, 0.42);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.activity-risk-badge.amber {
  border: 1px solid rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.activity-risk-badge.orange {
  border: 1px solid rgba(249, 115, 22, 0.36);
  background: rgba(249, 115, 22, 0.08);
  color: #ea580c;
}

.activity-risk-badge.green {
  border: 1px solid rgba(101, 163, 13, 0.42);
  background: rgba(132, 204, 22, 0.12);
  color: #65a30d;
}

.account-activity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.account-activity-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.account-activity-pager button {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.account-activity-pager button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.account-activity-pager button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.follow-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.follow-actions .primary-action,
.follow-actions .secondary-action {
  width: auto;
}

.detail-panel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.under-title-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -4px;
}

.detail-segmented {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.detail-segmented button {
  height: 32px;
  min-width: 58px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.detail-segmented button.active {
  background: var(--blue);
  color: #fff;
}

.compact-action {
  width: auto;
  min-width: 112px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  box-shadow: none;
}

.detail-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.detail-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 850;
  text-align: left;
  white-space: nowrap;
}

.detail-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.has-frozen-action-column .detail-action-column {
  position: sticky;
  right: 0;
  z-index: 2;
  border-left: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: var(--surface);
  box-shadow:
    -9px 0 14px -12px rgba(15, 23, 42, 0.42),
    inset 1px 0 0 color-mix(in srgb, var(--surface) 72%, transparent);
}

.has-frozen-action-column thead .detail-action-column {
  z-index: 3;
  background: var(--surface-muted);
}

.detail-table tr:last-child td {
  border-bottom: 0;
}

.detail-table strong {
  color: var(--text-strong, var(--text));
  font-weight: 950;
}

.rebate-settings-panel {
  width: 100%;
  display: grid;
  gap: 16px;
}

.rebate-level-control {
  width: min(100%, 580px);
  display: grid;
  grid-template-columns: 88px minmax(220px, 1fr);
  align-items: center;
  gap: 12px;
}

.rebate-level-control > span,
.rebate-source-row > label,
.rebate-rule-row > label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.rebate-level-control > span,
.rebate-source-row > label,
.rebate-rule-row > label {
  text-align: right;
}

.rebate-block {
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.rebate-block > header {
  min-height: 0;
  display: flex;
  align-items: center;
  padding: 18px 18px 0;
  border-bottom: 0;
  color: var(--text-strong, var(--text));
  font-size: 14px;
  font-weight: 950;
}

.rebate-source-form,
.rebate-level-form,
.rebate-rule-list {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.rebate-level-form {
  padding-top: 16px;
}

.rebate-source-form {
  gap: 12px;
}

.rebate-source-row {
  display: grid;
  grid-template-columns: 118px minmax(300px, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.rebate-source-row > label {
  padding-top: 9px;
}

.rebate-source-row small {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.rebate-wallet-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.rebate-wallet-options {
  display: grid;
  gap: 12px;
}

.rebate-wallet-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 900;
}

.rebate-wallet-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--blue);
}

.rebate-wallet-option-body,
.rebate-wallet-new-form {
  margin-left: 28px;
}

.rebate-wallet-picker {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
}

.rebate-wallet-token {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  background: #18b69a;
  color: #fff;
  font-size: 13px;
  font-weight: 950;
}

.rebate-wallet-token span {
  font-size: 18px;
  line-height: 1;
}

.rebate-wallet-placeholder {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.rebate-wallet-new-form {
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.rebate-wallet-row {
  display: grid;
  grid-template-columns: 180px minmax(280px, 760px) auto;
  align-items: center;
  gap: 12px;
}

.rebate-wallet-row > label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
  text-align: right;
}

.rebate-wallet-row > label i {
  color: var(--danger);
  font-style: normal;
}

.rebate-wallet-agent-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px 86px;
  gap: 0;
}

.rebate-wallet-agent-field input {
  border-radius: 7px 0 0 7px;
}

.rebate-wallet-agent-field .mini-action {
  height: 36px;
  min-width: 0;
  border-radius: 0;
}

.rebate-wallet-agent-field .mini-action:last-child {
  border-radius: 0 7px 7px 0;
}

.rebate-wallet-help {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.rebate-wallet-submit-row {
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.rebate-source-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rebate-light-action {
  height: 36px;
  min-width: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.rebate-light-action:hover {
  border-color: rgba(var(--blue-rgb), 0.36);
  background: var(--surface-hover);
  color: var(--blue);
}

.rebate-rule-row {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(280px, 1fr) minmax(92px, auto) 68px;
  align-items: start;
  gap: 14px;
  min-height: 42px;
}

.rebate-rule-row > label {
  min-width: 0;
  overflow: hidden;
  padding-top: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rebate-level-control select,
.rebate-source-row select,
.rebate-source-row input,
.rebate-wallet-row select,
.rebate-wallet-row input,
.rebate-rule-row select,
.rebate-manual-control input[type="text"],
.rebate-manual-control input:not([type]) {
  width: 100%;
  height: 36px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.rebate-level-control select,
.rebate-source-row select,
.rebate-wallet-row select,
.rebate-rule-row select {
  padding: 0 12px;
}

.rebate-source-row input,
.rebate-wallet-row input,
.rebate-manual-control input[type="text"],
.rebate-manual-control input:not([type]) {
  padding: 0 12px;
}

.rebate-level-control select:disabled,
.rebate-source-row select:disabled,
.rebate-source-row input:disabled,
.rebate-wallet-row select:disabled,
.rebate-wallet-row input:disabled,
.rebate-rule-row select:disabled,
.rebate-manual-control input:disabled {
  border-color: var(--border-light);
  background: var(--surface-muted);
  color: var(--text-soft);
  opacity: 1;
}

.rebate-unit {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
}

.rebate-row-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

.mini-action {
  min-width: 64px;
  height: 34px;
  padding: 0 13px;
  border-radius: 7px;
  box-shadow: none;
}

.rebate-manual-control {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(220px, 260px);
  align-items: start;
  gap: 10px;
}

.rebate-manual-control input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin-top: 10px;
  accent-color: var(--blue);
}

.rebate-manual-control > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.rebate-manual-control small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.text-action,
.inline-actions button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-icon-action {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--blue);
  box-shadow: none;
  font-size: 0;
}

.detail-icon-action:hover {
  border-color: rgba(var(--blue-rgb), 0.42);
  background: var(--surface-hover);
  color: var(--blue);
}

.detail-icon-action.primary-icon-action {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.detail-icon-action.primary-icon-action:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: #fff;
}

.detail-icon-action.danger-icon-action {
  border-color: rgba(220, 38, 38, 0.22);
  color: var(--danger);
}

.detail-icon-action.danger-icon-action:hover {
  border-color: rgba(220, 38, 38, 0.34);
  background: rgba(220, 38, 38, 0.06);
  color: var(--danger);
}

.detail-icon-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.inline-actions .detail-icon-action,
.manage-package-actions .detail-icon-action {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  padding: 0;
}

.code-text {
  color: var(--text-strong, var(--text));
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 850;
}

.follow-timeline {
  display: grid;
  gap: 0;
}

.follow-item {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 18px;
}

.follow-item::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 32px;
  bottom: 0;
  width: 2px;
  border-radius: 999px;
  background: var(--blue);
}

.follow-item:last-child::before {
  display: none;
}

.follow-dot {
  width: 34px;
  height: 34px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 1px rgba(var(--blue-rgb), 0.25);
}

.follow-item.is-remind .follow-dot {
  background: var(--warning);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25);
}

.follow-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

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

.follow-card-head strong {
  display: block;
  color: var(--text-strong, var(--text));
  font-size: 15px;
  line-height: 1.25;
  font-weight: 950;
}

.follow-card-head span,
.follow-meta-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.follow-card p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 800;
}

.follow-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.follow-meta-row span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface);
}

.kyc-overview-grid,
.promotion-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kyc-overview-grid article,
.promotion-summary-grid article,
.wallet-total-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.kyc-overview-grid span,
.promotion-summary-grid span,
.wallet-total-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.kyc-overview-grid strong,
.promotion-summary-grid strong,
.wallet-total-card strong {
  color: var(--text-strong, var(--text));
  font-size: 18px;
  line-height: 1.15;
  font-weight: 950;
}

.promotion-summary-grid small,
.wallet-total-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.kyc-card-list,
.kyc-simple-list {
  display: grid;
  gap: 10px;
}

.kyc-simple-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.kyc-simple-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.kyc-simple-main h4 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 15px;
  line-height: 1.2;
  font-weight: 950;
}

.kyc-simple-main span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kyc-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.kyc-card header,
.permission-scope-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.kyc-card h4,
.permission-scope-card h4,
.wallet-info-card h4 {
  margin: 0 0 8px;
  color: var(--text-strong, var(--text));
  font-size: 15px;
  line-height: 1.25;
  font-weight: 950;
}

.kyc-reason {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--danger);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.kyc-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kyc-meta-grid span {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.kyc-meta-grid strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.wallet-total-card {
  background: var(--blue-soft);
}

.wallet-total-card strong {
  color: var(--blue);
  font-size: 24px;
}

.wallet-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.wallet-info-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.wallet-info-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wallet-info-card > div h4 {
  margin: 0;
}

.wallet-info-card > div > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.wallet-info-card strong {
  color: var(--text-strong, var(--text));
  font-size: 21px;
  line-height: 1.15;
  font-weight: 950;
}

.wallet-info-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.permission-scope-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.promotion-detail-module {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

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

.promotion-module-head > div,
.promotion-detail-module header > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.promotion-module-head > div > span,
.promotion-detail-module header > div > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 950;
}

.promotion-module-head h4,
.promotion-detail-module header h4 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 20px;
  line-height: 1.2;
  font-weight: 950;
}

.promotion-detail-module header small,
.promotion-module-head small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
}

.promotion-package-list {
  display: grid;
  gap: 10px;
}

.assigned-permission-package {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.85fr);
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.assigned-permission-package > div:first-child {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.assigned-permission-package > div:first-child span,
.assigned-package-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.assigned-permission-package strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 15px;
  line-height: 1.25;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assigned-permission-package small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assigned-package-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.danger-action {
  color: var(--danger) !important;
}

.permission-package-manage-dialog {
  width: min(820px, 100%);
}

.permission-package-manage-dialog .modal-header {
  min-height: 68px;
  align-items: center;
  flex-direction: row;
  padding: 14px 20px;
}

.permission-package-manage-dialog .modal-header h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.permission-package-manage-dialog .modal-header p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.permission-package-manage-dialog .modal-footer {
  min-height: 62px;
  padding: 12px 18px;
}

.permission-package-manage-body {
  min-height: 0;
  max-height: min(68vh, 650px);
  display: grid;
  gap: 16px;
  overflow-y: auto;
  padding: 16px 18px;
  background: var(--surface-muted);
}

.permission-package-manage-list {
  display: grid;
  gap: 10px;
}

.permission-package-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
}

.permission-package-list-head > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.permission-package-list-head strong,
.permission-package-add-copy strong {
  color: var(--text-strong, var(--text));
  font-size: 13px;
  line-height: 1.3;
  font-weight: 950;
}

.permission-package-list-head span,
.permission-package-add-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 800;
}

.permission-package-list-head > span {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(47, 125, 246, 0.1);
  color: var(--primary);
  font-weight: 900;
}

.manage-package-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--surface);
}

.manage-package-title {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.manage-package-title > span,
.manage-package-title > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.manage-package-title > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 15px;
  line-height: 1.25;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-package-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  white-space: nowrap;
}

.permission-package-add-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(47, 125, 246, 0.22);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(47, 125, 246, 0.06);
}

.permission-package-add-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.permission-package-add-controls {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.permission-package-add-controls > .compact-action {
  min-width: 76px;
  height: 40px;
}

.permission-package-combobox {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.permission-package-combobox > input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-strong, var(--text));
  font-size: 13px;
  font-weight: 850;
}

.permission-package-combobox > input:focus {
  outline: 3px solid rgba(47, 125, 246, 0.12);
  border-color: var(--primary);
}

.permission-package-combobox > input:disabled {
  cursor: not-allowed;
  background: var(--surface-muted);
  color: var(--muted);
}

.permission-package-options {
  display: grid;
  gap: 4px;
  max-height: 270px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.permission-package-options[hidden] {
  display: none !important;
}

.permission-package-option {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.permission-package-option[hidden] {
  display: none !important;
}

.permission-package-option:hover,
.permission-package-option:focus-visible {
  outline: 0;
  background: rgba(47, 125, 246, 0.08);
}

.permission-package-option > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.permission-package-option strong {
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-package-option small,
.permission-package-options-empty {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  font-weight: 800;
}

.permission-package-options-empty {
  padding: 18px 10px;
  text-align: center;
}

.promotion-link-filter-bar label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.promotion-link-filter-bar input,
.promotion-link-filter-bar select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-strong, var(--text));
  font-weight: 850;
}

.promotion-permission-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.green-chip {
  border-color: rgba(22, 163, 74, 0.22);
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

.muted-chip {
  color: var(--muted);
}

.promotion-link-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px) auto;
  align-items: end;
  gap: 10px;
}

.promotion-link-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.promotion-detail-pager {
  background: var(--surface);
}

.promotion-empty-state {
  min-height: 94px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px dashed var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.permission-scope-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.permission-scope-grid.promotion-permission-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.permission-scope-grid > div {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.permission-scope-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.permission-scope-grid > div > div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.promotion-workspace {
  display: grid;
  gap: 16px;
}

.promotion-overview-section,
.promotion-section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.promotion-overview-section {
  display: grid;
}

.promotion-stat-strip dt,
.promotion-section-head > div > span,
.promotion-subsection-head span,
.promotion-permission-row > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 950;
}

.promotion-stat-strip small,
.promotion-section-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 850;
}

.promotion-stat-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.promotion-stat-strip > div {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px 18px;
  border-left: 1px solid var(--border-light);
}

.promotion-stat-strip > div:first-child {
  border-left: 0;
}

.promotion-stat-strip dd {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 19px;
  line-height: 1.15;
  font-weight: 950;
}

.promotion-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-muted);
}

.promotion-section-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.promotion-section-head h4 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 17px;
  line-height: 1.2;
  font-weight: 950;
}

.promotion-section-head p {
  margin: 0;
}

.promotion-section-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.promotion-access-section {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.promotion-access-card {
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: var(--surface);
}

.promotion-access-compact-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
}

.promotion-access-compact-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.promotion-access-compact-copy > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 900;
}

.promotion-access-compact-copy > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 14px;
  line-height: 1.3;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-access-compact-copy > small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 800;
}

.promotion-access-compact-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.promotion-access-compact-actions .detail-icon-action {
  width: 30px;
  height: 30px;
  background: var(--surface-muted);
}

.promotion-access-compact-actions .promotion-access-details-toggle {
  width: auto;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
}

.promotion-access-details-dialog {
  width: min(760px, 100%);
}

.promotion-access-details-dialog .modal-header {
  min-height: 62px;
  align-items: center;
  flex-direction: row;
  padding: 14px 20px;
}

.promotion-access-details-dialog .modal-header > div {
  min-width: 0;
}

.promotion-access-details-dialog .modal-header h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 850;
}

.promotion-access-details-dialog .modal-header p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.promotion-access-details-body {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface-muted);
}

.promotion-access-details-dialog .promotion-access-details-body {
  min-height: 0;
  max-height: min(62vh, 560px);
  overflow: auto;
  padding: 14px 18px;
}

.promotion-access-details-dialog .modal-footer {
  min-height: 62px;
  padding: 12px 18px;
}

.promotion-access-package,
.promotion-access-scope {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.promotion-access-package > p {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
}

.promotion-access-detail-head,
.promotion-access-scope-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.promotion-access-detail-head span,
.promotion-access-scope-head span,
.promotion-scope-group > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 950;
}

.promotion-package-token-list,
.promotion-scope-group > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.promotion-package-token-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.promotion-package-token {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--blue-rgb), 0.16);
  border-radius: 7px;
  background: rgba(var(--blue-rgb), 0.045);
}

.promotion-package-token strong {
  color: var(--text-strong, var(--text));
  font-size: 14px;
  line-height: 1.25;
  font-weight: 950;
}

.promotion-package-token small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 850;
}

.promotion-package-token.is-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.promotion-package-union-state {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.promotion-package-union-state.is-active {
  color: #0a8f5a;
}

.promotion-access-scope-head {
  align-items: flex-start;
}

.promotion-access-scope-head > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.promotion-access-scope-head small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
}

.promotion-access-scope-head strong {
  color: var(--text-strong, var(--text));
  font-size: 13px;
  line-height: 1.2;
  font-weight: 950;
  white-space: nowrap;
}

.promotion-scope-groups {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.promotion-scope-group {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  border-radius: 7px;
  background: var(--surface-muted);
}

.promotion-scope-group-actions {
  grid-column: 1 / -1;
}

.promotion-scope-group-account-types,
.promotion-scope-group-leverage,
.promotion-scope-group-other {
  grid-column: 1 / -1;
}

.promotion-scope-server-groups,
.promotion-scope-other-groups {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.promotion-scope-server-groups {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.promotion-access-server-list {
  width: 100%;
  gap: 8px;
}

.promotion-scope-group-account-types > div {
  display: block;
  width: 100%;
}

.promotion-access-server-panel {
  gap: 8px;
  padding: 10px 12px;
  border-color: var(--border-light);
  border-radius: 7px;
  background: var(--surface);
}

.promotion-access-server-panel header {
  align-items: center;
  padding-bottom: 8px;
}

.promotion-access-server-panel header > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.promotion-access-server-panel header strong {
  font-size: 12px;
}

.promotion-access-server-account-types {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.promotion-access-server-account-types > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 900;
}

.promotion-access-server-account-types > div {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.promotion-scope-server-group,
.promotion-scope-other-group {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--surface);
}

.promotion-scope-server-head {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.promotion-scope-server-head strong {
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 12px;
  line-height: 1.25;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-scope-server-head small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 800;
}

.promotion-scope-group-other > div {
  display: block;
  width: 100%;
}

.promotion-scope-other-groups {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.promotion-scope-other-group {
  gap: 8px;
  padding: 9px;
  border-color: #dbe7fb;
  background: #fbfdff;
}

.promotion-scope-other-group header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.promotion-scope-other-group header strong {
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 11px;
  line-height: 1.2;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-scope-other-group header b {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--blue-ink);
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
}

.promotion-scope-other-values {
  min-width: 0;
  display: flex;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 5px;
}

.promotion-scope-other-values .resource-chip {
  font-size: 11px;
}

.promotion-access-section .promotion-section-head {
  align-items: center;
  padding: 0 0 10px;
  border-bottom: 0;
  background: transparent;
}

.promotion-access-section .promotion-section-head h4 {
  font-size: 15px;
}

.promotion-access-section .promotion-section-actions {
  gap: 8px;
}

.promotion-access-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.78fr) minmax(0, 1.5fr);
}

.promotion-access-section .promotion-access-layout {
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.promotion-access-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px 18px 18px;
}

.promotion-access-section .promotion-access-column {
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  padding: 12px 0;
}

.promotion-access-column + .promotion-access-column {
  border-left: 1px solid var(--border-light);
}

.promotion-access-section .promotion-access-column + .promotion-access-column {
  border-top: 1px solid var(--border-light);
  border-left: 0;
}

.promotion-subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.promotion-subsection-head strong {
  color: var(--text-strong, var(--text));
  font-size: 13px;
  line-height: 1.2;
  font-weight: 950;
}

.promotion-package-list {
  display: grid;
  gap: 0;
}

.assigned-permission-package {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border: 0;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  background: transparent;
}

.promotion-access-section .assigned-permission-package {
  padding: 0;
}

.assigned-permission-package:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.assigned-package-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.promotion-access-section .assigned-package-main {
  gap: 3px;
}

.assigned-package-main span,
.assigned-package-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.assigned-package-meta {
  justify-content: flex-end;
}

.assigned-permission-package strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 14px;
  line-height: 1.25;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assigned-permission-package small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}

.promotion-access-section .promotion-permission-grid {
  display: flex;
  align-items: flex-start;
  gap: 9px 18px;
  flex-wrap: wrap;
}

.promotion-permission-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: flex-start;
  gap: 10px;
}

.promotion-access-section .promotion-permission-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.promotion-access-section .promotion-permission-row-wide {
  grid-column: auto;
}

.promotion-permission-row > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.promotion-permission-row-wide {
  grid-column: 1 / -1;
}

.promotion-links-body {
  display: grid;
  gap: 0;
  padding: 0;
}

.promotion-links-module .promotion-links-head {
  align-items: center;
  padding: 8px 14px;
  border-bottom: 0;
  background: var(--surface);
}

.promotion-links-module .promotion-links-head h4 {
  font-size: 13px;
}

.promotion-links-module .promotion-links-head .compact-action {
  min-width: auto;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.promotion-link-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 14px 0;
}

.promotion-link-scope-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.promotion-link-scope-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.promotion-link-add-action {
  min-width: auto;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12px;
}

.promotion-link-add-action svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.promotion-link-scope-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 104px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.promotion-link-scope-tabs button:focus-visible {
  outline: 2px solid rgba(var(--blue-rgb), 0.35);
  outline-offset: 1px;
}

.promotion-link-scope-tabs button.active {
  border-color: rgba(var(--blue-rgb), 0.18);
  background: var(--surface);
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.promotion-link-scope-tabs small {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: inherit;
  font-size: 10px;
  line-height: 1.3;
  text-align: center;
}

.promotion-link-scope-tabs button.active small {
  background: rgba(var(--blue-rgb), 0.1);
}

.promotion-link-visibility-note {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(var(--blue-rgb), 0.035);
}

.promotion-link-visibility-note strong {
  color: var(--text-strong, var(--text));
  font-size: 12px;
  line-height: 1.3;
  font-weight: 950;
}

.promotion-link-visibility-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
}

.promotion-links-module .promotion-link-filter-bar {
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}

.promotion-links-module .promotion-link-filter-bar label {
  gap: 0;
}

.promotion-links-module .promotion-link-filter-bar label > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.promotion-links-module .promotion-link-filter-bar input,
.promotion-links-module .promotion-link-filter-bar select {
  height: 36px;
  border-color: transparent;
  border-radius: 6px;
  background: var(--surface-muted);
}

.promotion-links-module .promotion-link-filter-bar .compact-action {
  min-width: 72px;
  height: 36px;
  border-radius: 6px;
}

.promotion-links-module .detail-table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.promotion-links-module .detail-table {
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.promotion-links-module .detail-table th,
.promotion-links-module .detail-table td {
  padding: 11px 14px;
}

.promotion-links-module .detail-table th {
  background: transparent;
}

.promotion-links-module .detail-table th:last-child,
.promotion-links-module .detail-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -8px 0 12px -12px rgba(15, 23, 42, 0.42);
}

.promotion-links-module .detail-table th:last-child {
  z-index: 3;
  background: var(--surface-muted);
}

.promotion-links-module .detail-table tr:hover td {
  background: var(--surface-hover);
}

.promotion-links-module .detail-table tr:hover td:last-child {
  background: var(--surface-hover);
}

.promotion-links-module .promotion-link-table-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

.promotion-links-module .promotion-detail-pager {
  background: transparent;
}

.promotion-link-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.promotion-link-actions .text-action {
  padding: 0;
  font-size: 12px;
}

.promotion-link-actions .danger-text-action {
  color: var(--danger);
}

.link-name-cell {
  display: grid;
  gap: 4px;
}

.link-name-cell small {
  max-width: 320px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
}

.promotion-link-create-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: min(900px, calc(100vh - 32px));
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.promotion-link-create-dialog .modal-header {
  min-height: 70px;
  align-items: center;
  flex: 0 0 auto;
  flex-direction: row;
  padding: 15px 20px;
}

.promotion-link-create-dialog .modal-header > div {
  min-width: 0;
}

.promotion-link-create-dialog .modal-header h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.promotion-link-create-dialog .modal-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.promotion-link-create-form {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.promotion-link-create-body {
  min-height: 0;
  overflow: auto;
  padding: 16px 18px;
  background: var(--surface-muted);
}

.promotion-link-create-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.45fr);
  align-items: start;
  gap: 14px;
}

.promotion-link-create-main,
.promotion-link-create-resources {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--surface);
}

.promotion-create-owner-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(var(--blue-rgb), 0.14);
  border-radius: 9px;
  background: rgba(var(--blue-rgb), 0.045);
}

.promotion-create-owner-card > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.promotion-create-link-type legend,
.promotion-create-link-preview > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  font-weight: 850;
}

.promotion-create-owner-card strong {
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 14px;
  line-height: 1.25;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-create-owner-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-create-link-type {
  min-width: 0;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 11px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.promotion-create-link-type legend {
  padding: 0;
}

.promotion-create-link-type > p {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.promotion-create-link-type-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.promotion-create-link-type-option .promotion-create-option-check {
  border-radius: 50%;
}

.promotion-create-link-type-option input:checked + .promotion-create-option-check::after {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  transform: none;
}

.promotion-create-link-type-option.is-disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.promotion-create-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.promotion-create-field-grid .field {
  display: grid;
  gap: 6px;
}

.promotion-create-field-grid .field.full {
  grid-column: 1 / -1;
}

.promotion-create-field-grid > .promotion-create-owner-card {
  grid-column: 1 / -1;
}

.promotion-create-field-grid .field > span {
  color: var(--text-strong, var(--text));
  font-size: 12px;
  font-weight: 900;
}

.promotion-create-field-grid .field :is(input, select) {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-strong, var(--text));
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.promotion-create-field-grid .field :is(input, select):focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.1);
  outline: 0;
}

.promotion-create-counted-input {
  position: relative;
  min-width: 0;
}

.promotion-create-field-grid .promotion-create-counted-input > input {
  padding-right: 58px;
}

.promotion-create-counted-input > b {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 850;
  pointer-events: none;
  transform: translateY(-50%);
}

.promotion-create-field-grid .field > small {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.promotion-create-field-grid .field > small b {
  color: inherit;
  font-weight: 850;
}

.promotion-create-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.promotion-create-code-row input {
  min-width: 0;
  flex: 1 1 auto;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.promotion-create-code-row .secondary-action {
  min-width: 84px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0 12px;
  font-size: 12px;
}

.promotion-create-link-preview {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px dashed rgba(var(--blue-rgb), 0.28);
  border-radius: 8px;
  background: rgba(var(--blue-rgb), 0.035);
}

.promotion-create-link-preview strong {
  overflow: hidden;
  color: var(--blue);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-create-link-preview small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.promotion-create-resources-head,
.promotion-create-resource-block > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.promotion-create-resources-head > div,
.promotion-create-resource-block > header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.promotion-create-resources-head h3 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 14px;
  font-weight: 950;
}

.promotion-create-resources-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.promotion-create-resources-head .text-action {
  flex: 0 0 auto;
  font-size: 12px;
}

.promotion-create-resource-block {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
  transition: opacity 160ms ease;
}

.promotion-create-resource-block > header strong {
  color: var(--text-strong, var(--text));
  font-size: 12px;
  line-height: 1.3;
  font-weight: 950;
}

.promotion-create-other-permissions > header strong {
  font-size: 15px;
  line-height: 1.25;
}

.promotion-create-resource-block > header small,
.promotion-create-resource-block > header > span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  font-weight: 800;
}

.promotion-create-resource-block > header > span {
  flex: 0 0 auto;
}

.promotion-create-resource-block.is-disabled {
  opacity: 0.48;
}

.promotion-create-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.promotion-create-option-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.promotion-create-option {
  position: relative;
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
}

.promotion-create-option:has(input:checked) {
  border-color: rgba(var(--blue-rgb), 0.35);
  background: rgba(var(--blue-rgb), 0.055);
}

.promotion-create-option.is-outside-owner-permission:has(input:checked) {
  border-color: rgba(217, 119, 6, 0.42);
  background: rgba(217, 119, 6, 0.085);
  box-shadow: inset 3px 0 0 rgba(217, 119, 6, 0.5);
}

.promotion-create-option:focus-within {
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.1);
}

.promotion-create-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.promotion-create-option-check {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}

.promotion-create-option input:checked + .promotion-create-option-check {
  border-color: var(--blue);
  background: var(--blue);
}

.promotion-create-option.is-outside-owner-permission input:checked + .promotion-create-option-check {
  border-color: #d97706;
  background: #d97706;
}

.promotion-create-option input:checked + .promotion-create-option-check::after {
  width: 7px;
  height: 4px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: rotate(-45deg) translate(1px, -1px);
}

.promotion-create-option-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.promotion-create-option-copy strong {
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 11px;
  line-height: 1.25;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-create-option-copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 750;
}

.promotion-create-option-warning {
  display: none;
  color: #b45309;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 900;
}

.promotion-create-option.is-outside-owner-permission:has(input:checked) .promotion-create-option-warning {
  display: block;
}

.promotion-create-server-panels {
  display: grid;
  gap: 9px;
}

.promotion-create-server-empty {
  display: grid;
  gap: 3px;
  padding: 13px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.promotion-create-server-empty strong {
  color: var(--text-strong, var(--text));
  font-size: 12px;
  font-weight: 900;
}

.promotion-create-server-empty span {
  font-size: 10px;
  line-height: 1.35;
}

.promotion-create-server-empty.compact {
  padding: 10px;
}

.promotion-create-server-panel {
  overflow: hidden;
  border: 1px solid rgba(var(--blue-rgb), 0.2);
  border-radius: 8px;
  background: var(--surface);
}

.promotion-create-server-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(var(--blue-rgb), 0.13);
  background: rgba(var(--blue-rgb), 0.045);
}

.promotion-create-server-panel > header > div {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 2px 7px;
}

.promotion-create-server-panel > header span,
.promotion-create-server-panel > header small,
.promotion-create-server-panel > header b {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  font-weight: 800;
}

.promotion-create-server-panel > header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 12px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-create-server-panel > header small {
  grid-column: 1 / -1;
}

.promotion-create-server-panel > header b {
  flex: 0 0 auto;
}

.promotion-create-server-account-list {
  display: grid;
  gap: 7px;
  padding: 8px;
}

.promotion-create-server-account {
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  background: var(--surface-muted);
}

.promotion-create-server-account.is-selected {
  border-color: rgba(var(--blue-rgb), 0.3);
  background: rgba(var(--blue-rgb), 0.035);
}

.promotion-create-server-account.is-outside-owner-permission.is-selected {
  border-color: rgba(217, 119, 6, 0.42);
  background: rgba(217, 119, 6, 0.07);
  box-shadow: inset 3px 0 0 rgba(217, 119, 6, 0.5);
}

.promotion-create-server-account-head {
  position: relative;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  cursor: pointer;
}

.promotion-create-server-account-head > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.promotion-create-server-account-head > input:checked + .promotion-create-option-check {
  border-color: var(--blue);
  background: var(--blue);
}

.promotion-create-server-account.is-outside-owner-permission .promotion-create-server-account-head > input:checked + .promotion-create-option-check {
  border-color: #d97706;
  background: #d97706;
}

.promotion-create-server-account-head > input:checked + .promotion-create-option-check::after {
  width: 7px;
  height: 4px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: rotate(-45deg) translate(1px, -1px);
}

.promotion-create-server-account-head > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.promotion-create-server-account-head strong {
  color: var(--text-strong, var(--text));
  font-size: 11px;
  line-height: 1.25;
  font-weight: 900;
}

.promotion-create-server-account-head small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.promotion-create-server-account-head em {
  color: #b45309;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.promotion-create-account-leverages {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

.promotion-create-account-leverages[hidden] {
  display: none;
}

.promotion-create-account-leverages > div:first-child {
  display: grid;
  gap: 2px;
}

.promotion-create-account-leverages strong {
  color: var(--text-strong, var(--text));
  font-size: 10px;
  font-weight: 900;
}

.promotion-create-account-leverages small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
}

.promotion-create-account-leverage-options {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 6px;
}

.promotion-create-account-leverage-option {
  min-height: 34px;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 6px;
  padding: 5px 7px;
}

.promotion-create-account-leverage-option .promotion-create-option-check {
  width: 15px;
  height: 15px;
  border-radius: 4px;
}

.promotion-create-account-leverage-option .promotion-create-option-copy strong {
  font-size: 10px;
}

.promotion-create-other-permission-grid,
.promotion-create-optional-field {
  display: grid;
  gap: 9px;
}

.promotion-create-optional-field + .promotion-create-optional-field {
  padding-top: 9px;
  border-top: 1px solid var(--border-light);
}

.promotion-create-optional-field > div:first-child,
.promotion-create-role-field > span {
  display: grid;
  gap: 2px;
}

.promotion-create-optional-field strong {
  color: var(--text-strong, var(--text));
  font-size: 11px;
  font-weight: 900;
}

.promotion-create-optional-field small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.promotion-create-account-group-picker {
  display: grid;
  gap: 6px;
}

.promotion-create-account-group-trigger {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-strong, var(--text));
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.promotion-create-account-group-trigger:hover,
.promotion-create-account-group-trigger[aria-expanded="true"] {
  border-color: var(--blue);
}

.promotion-create-account-group-trigger:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.1);
  outline: 0;
}

.promotion-create-account-group-trigger i {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.16s ease;
}

.promotion-create-account-group-trigger[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.promotion-create-account-group-menu {
  max-height: 190px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(var(--blue-rgb), 0.22);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.promotion-create-account-group-menu[hidden] {
  display: none;
}

.promotion-create-account-group-option {
  position: relative;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.promotion-create-account-group-option:hover,
.promotion-create-account-group-option:focus-within {
  border-color: rgba(var(--blue-rgb), 0.18);
  background: rgba(var(--blue-rgb), 0.045);
}

.promotion-create-account-group-option:has(input:checked) {
  border-color: rgba(var(--blue-rgb), 0.24);
  background: rgba(var(--blue-rgb), 0.07);
}

.promotion-create-account-group-option.is-outside-owner-permission:has(input:checked) {
  border-color: rgba(217, 119, 6, 0.36);
  background: rgba(217, 119, 6, 0.07);
}

.promotion-create-account-group-option > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.promotion-create-account-group-option > input:checked + .promotion-create-option-check {
  border-color: var(--blue);
  background: var(--blue);
}

.promotion-create-account-group-option.is-outside-owner-permission > input:checked + .promotion-create-option-check {
  border-color: #d97706;
  background: #d97706;
}

.promotion-create-account-group-option > input:checked + .promotion-create-option-check::after {
  width: 7px;
  height: 4px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: rotate(-45deg) translate(1px, -1px);
}

.promotion-create-account-group-option > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.promotion-create-account-group-option strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-create-account-group-option.is-outside-owner-permission small {
  color: #b45309;
}

.promotion-create-account-group-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.promotion-create-account-group-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.promotion-create-account-group-selected[hidden] {
  display: none;
}

.promotion-create-account-group-chip {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px 4px 8px;
  border: 1px solid rgba(var(--blue-rgb), 0.2);
  border-radius: 999px;
  background: rgba(var(--blue-rgb), 0.07);
  color: var(--blue);
  font-size: 10px;
  font-weight: 850;
}

.promotion-create-account-group-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-create-account-group-chip button {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: currentColor;
  font: inherit;
  cursor: pointer;
}

.promotion-create-account-group-chip button:hover,
.promotion-create-account-group-chip button:focus-visible {
  background: rgba(var(--blue-rgb), 0.12);
  outline: 0;
}

.promotion-create-role-field select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-strong, var(--text));
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.promotion-create-role-field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.1);
  outline: 0;
}

.promotion-create-role-field select.is-outside-owner-permission {
  border-color: rgba(217, 119, 6, 0.42);
  background: rgba(217, 119, 6, 0.08);
  color: #b45309;
}

.promotion-create-resource-note {
  margin: -3px 0 0;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(217, 119, 6, 0.08);
  color: #b45309;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 850;
}

.promotion-create-resource-note[hidden] {
  display: none;
}

.promotion-link-create-error {
  flex: 0 0 auto;
  margin: 0;
  padding: 9px 20px;
  border-top: 1px solid rgba(220, 38, 38, 0.16);
  background: rgba(220, 38, 38, 0.06);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 850;
}

.promotion-link-create-error[hidden] {
  display: none;
}

.promotion-link-create-form .modal-footer {
  min-height: 64px;
  flex: 0 0 auto;
  padding: 12px 20px;
  background: var(--surface);
}

@media (min-width: 861px) and (min-height: 761px) {
  .promotion-link-create-body {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .promotion-link-create-layout {
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    align-items: stretch;
  }

  .promotion-link-create-main {
    align-self: start;
  }

  .promotion-link-create-resources {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 860px) {
  .promotion-link-create-layout {
    grid-template-columns: 1fr;
  }

  .promotion-link-create-dialog {
    max-height: calc(100vh - 20px);
  }
}

@media (max-width: 560px) {
  .promotion-link-create-modal {
    padding: 8px;
  }

  .promotion-link-create-dialog {
    width: 100%;
    max-width: 100%;
  }

  .promotion-link-create-body {
    padding: 10px;
  }

  .promotion-link-create-main,
  .promotion-link-create-resources {
    padding: 11px;
  }

  .promotion-create-owner-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .promotion-create-resources-head,
  .promotion-create-resource-block > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .promotion-create-link-type-options {
    grid-template-columns: 1fr;
  }

  .promotion-create-option-grid,
  .promotion-create-option-grid-compact {
    grid-template-columns: 1fr;
  }

  .promotion-create-server-panel > header,
  .promotion-create-account-leverages {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .promotion-create-server-panel > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .promotion-create-code-row {
    align-items: stretch;
    flex-direction: column;
  }

  .promotion-create-code-row .secondary-action {
    width: 100%;
  }
}

.follow-edit-dialog {
  width: min(600px, calc(100vw - 32px));
}

.follow-edit-dialog .modal-header {
  min-height: 62px;
  align-items: center;
  flex-direction: row;
  padding: 14px 20px;
}

.follow-edit-dialog .modal-header > div {
  min-width: 0;
}

.follow-edit-dialog .modal-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.follow-edit-dialog .modal-header h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 850;
}

.follow-edit-dialog .modal-header p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.follow-edit-form {
  padding: 16px 20px 0;
}

.follow-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.follow-form-grid .field.full {
  grid-column: 1 / -1;
}

.follow-edit-form .field {
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}

.follow-edit-form .field input,
.follow-edit-form .field select,
.follow-edit-form .field textarea {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.follow-edit-form .field input,
.follow-edit-form .field select {
  height: 40px;
  padding-inline: 11px;
}

.follow-edit-form .field textarea {
  padding: 10px 11px;
}

.follow-edit-form .modal-footer {
  margin: 16px -20px 0;
  padding: 12px 20px;
}

.follow-edit-form .primary-action,
.follow-edit-form .secondary-action {
  min-width: 84px;
  height: 36px;
  border-radius: 7px;
  font-size: 13px;
}

.detail-side-card {
  min-height: 0;
  position: sticky;
  top: calc(var(--app-chrome-height, 131px) + 12px);
  display: grid;
  gap: 12px;
  align-content: start;
  overflow: hidden;
  padding: 14px;
  box-shadow: none;
}

.profile-hero {
  min-height: 0;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  align-items: start;
  justify-items: start;
  gap: 12px;
  margin: -14px -14px 0;
  padding: 16px 14px 8px;
  text-align: left;
}

.profile-hero-main {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 9px;
}

.profile-title-row,
.profile-meta-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.profile-title-row {
  position: relative;
  padding-inline: 0;
}

.profile-title-row .profile-edit {
  margin-left: auto;
}

.profile-title-row h2 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-size: 24px;
  line-height: 1.08;
  font-weight: 950;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-placeholder {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(var(--blue-rgb), 0.42);
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 16px;
  font-weight: 950;
  letter-spacing: 0;
}

.profile-id {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-strong, var(--text));
  font-size: 14px;
  font-weight: 950;
}

.profile-id strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-id button,
.profile-edit {
  border: 0;
  background: transparent;
  color: var(--blue);
}

.profile-id button {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
}

.profile-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 900;
}

.profile-edit.detail-icon-action {
  width: 32px;
  height: 32px;
  display: inline-flex;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--blue);
}

.profile-edit.detail-icon-action:hover {
  border-color: rgba(var(--blue-rgb), 0.42);
  background: var(--surface-hover);
}

.profile-chip-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border-bottom: 0;
}

.profile-buttons .secondary-action {
  width: 100%;
  height: 38px;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  border-color: rgba(var(--blue-rgb), 0.38);
  border-radius: 7px;
  background: var(--surface);
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.profile-buttons .secondary-action:hover {
  background: var(--surface-hover);
  border-color: rgba(var(--blue-rgb), 0.52);
}

.profile-buttons .secondary-action svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.profile-panel {
  margin: 0;
  padding: 13px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
}

.profile-panel:last-child {
  border-bottom: 1px solid var(--border-light);
}

.profile-panel + .profile-panel {
  margin-top: 0;
}

.profile-panel h3 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 13px;
  line-height: 1.2;
  font-weight: 950;
}

.profile-note {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  text-align: left;
  font-size: 13px;
  font-weight: 850;
}

.profile-note:hover {
  border-color: rgba(var(--blue-rgb), 0.42);
  background: var(--surface-hover);
}

.profile-note.has-note {
  min-height: 64px;
  align-items: flex-start;
  background: var(--input-bg);
  color: var(--text-soft);
}

.profile-note span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-note.has-note span {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.45;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.profile-note svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--text);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.profile-note.has-note svg {
  margin-top: 2px;
}

.profile-login-panel header {
  display: flex;
  align-items: center;
  gap: 7px;
}

.profile-help {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--muted);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.profile-login-panel > strong {
  display: block;
  margin-top: 8px;
  color: var(--text-strong, var(--text));
  font-size: 18px;
  line-height: 1.25;
  font-weight: 950;
}

.profile-login-panel > strong.danger {
  color: var(--danger);
}

.profile-login-panel > strong.warning {
  color: var(--warning);
}

.profile-login-panel > strong.success {
  color: var(--success);
}

.profile-login-panel p {
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-freeze-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  color: var(--text-strong, var(--text));
  font-size: 13px;
  font-weight: 950;
}

.profile-freeze-row button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.profile-freeze-row button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.6;
}

.profile-list {
  display: grid;
  gap: 0;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.profile-list div {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 0;
}

.profile-list div:last-child {
  border-bottom: 0;
}

.profile-list strong {
  color: var(--muted);
  font-weight: 850;
}

.profile-list span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  font-weight: 900;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-parent-card {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 10px 12px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.profile-parent-card a {
  min-width: 0;
  overflow: hidden;
  color: var(--blue);
  font-size: 15px;
  font-weight: 950;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-parent-card > button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--input-bg);
  color: var(--text);
}

.profile-parent-card svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.profile-parent-card div {
  grid-column: 1 / -1;
  min-width: 0;
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.profile-parent-card div strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, var(--text));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-parent-empty {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.profile-edit-dialog {
  width: min(680px, 100%);
}

.profile-edit-form {
  padding: 18px 20px 0;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-edit-grid .field.full {
  grid-column: 1 / -1;
}

.profile-edit-form .modal-footer {
  margin: 18px -20px 0;
  padding: 14px 20px;
}

.profile-edit-form .primary-action,
.profile-edit-form .secondary-action {
  min-width: 88px;
  height: 38px;
  border-radius: 8px;
}

.customer-note-modal,
.password-reset-modal,
.temporary-unfreeze-modal,
.reset-auth-modal {
  background: rgba(15, 23, 42, 0.48);
}

.customer-note-dialog {
  width: min(520px, calc(100vw - 32px));
  overflow: hidden;
}

.customer-note-dialog .modal-header {
  min-height: 62px;
  align-items: center;
  flex-direction: row;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.customer-note-dialog .modal-header h2 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 18px;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: 0;
}

.customer-note-form {
  display: grid;
  grid-template-rows: auto auto;
}

.customer-note-body {
  padding: 22px 20px 24px;
}

.customer-note-field {
  position: relative;
  display: grid;
  gap: 8px;
}

.customer-note-field > span {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 800;
}

.customer-note-field textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
  padding: 11px 12px 32px;
  outline: none;
}

.customer-note-field textarea:focus {
  border-color: rgba(var(--blue-rgb), 0.72);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.12);
}

.customer-note-field textarea::placeholder {
  color: var(--muted);
  opacity: 0.78;
}

.customer-note-field em {
  position: absolute;
  right: 12px;
  bottom: 11px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 750;
}

.password-reset-dialog,
.temporary-unfreeze-dialog {
  width: min(520px, calc(100vw - 32px));
  overflow: hidden;
}

.reset-auth-dialog {
  width: min(520px, calc(100vw - 32px));
  overflow: hidden;
}

.password-reset-dialog .modal-header,
.temporary-unfreeze-dialog .modal-header,
.reset-auth-dialog .modal-header {
  min-height: 62px;
  align-items: center;
  flex-direction: row;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.password-reset-dialog .modal-header h2,
.temporary-unfreeze-dialog .modal-header h2,
.reset-auth-dialog .modal-header h2 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 18px;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: 0;
}

.reset-modal-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0;
}

.reset-modal-close:hover {
  color: var(--text-strong, var(--text));
}

.reset-modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.password-reset-form,
.temporary-unfreeze-form,
.reset-auth-form {
  display: grid;
  grid-template-rows: auto auto;
}

.password-reset-body {
  display: grid;
  gap: 16px;
  padding: 22px 20px 24px;
}

.reset-password-field {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
}

.reset-password-field span {
  line-height: 1.25;
}

.reset-password-field b {
  color: var(--danger);
  font-weight: 950;
}

.temporary-unfreeze-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 20px 22px 22px;
}

.temporary-unfreeze-body p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
}

.temporary-unfreeze-body small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 650;
}

.temporary-unfreeze-field {
  display: grid;
  gap: 8px;
  color: var(--text-strong, var(--text));
  font-size: 13px;
  font-weight: 800;
}

.temporary-unfreeze-stepper {
  height: 42px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
}

.temporary-unfreeze-stepper button {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--success);
}

.temporary-unfreeze-stepper button:hover {
  background: rgba(22, 163, 74, 0.08);
}

.temporary-unfreeze-stepper svg {
  width: 22px;
  height: 22px;
  padding: 3px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.temporary-unfreeze-stepper input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-strong, var(--text));
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  outline: none;
}

.temporary-unfreeze-stepper em {
  padding: 0 12px 0 6px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.reset-password-field input,
.reset-auth-field input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 0 12px;
}

.reset-password-field input::placeholder,
.reset-auth-field input::placeholder {
  color: var(--muted);
  opacity: 0.68;
}

.reset-auth-body {
  display: grid;
  gap: 16px;
  padding: 22px 20px 24px;
}

.reset-auth-body > strong {
  color: var(--text-strong, var(--text));
  font-size: 14px;
  line-height: 1.35;
  font-weight: 800;
}

.reset-auth-field {
  display: grid;
  gap: 8px;
  color: var(--text-strong, var(--text));
  font-size: 13px;
  font-weight: 800;
}

.auth-bind-link {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  padding: 0;
}

.auth-bind-link:hover {
  color: var(--blue-dark);
}

.password-reset-footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.password-reset-footer .primary-action,
.password-reset-footer .secondary-action {
  width: auto;
  min-width: 84px;
  height: 36px;
  border-radius: 7px;
  font-size: 13px;
}

.password-reset-footer .outline-action {
  border-color: var(--blue);
  color: var(--blue);
}

.message-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.32);
}

.message-drawer-backdrop[hidden] {
  display: none !important;
}

.message-drawer {
  width: min(760px, calc(100vw - 28px));
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  box-shadow: -18px 0 38px rgba(15, 23, 42, 0.16);
  transform-origin: right center;
  animation: messageDrawerIn 180ms ease-out;
}

@keyframes messageDrawerIn {
  from {
    transform: translateX(18px);
    opacity: 0.8;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.message-drawer-head {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
}

.message-drawer-head h2 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 24px;
  line-height: 1.1;
  font-weight: 950;
  letter-spacing: 0;
}

.message-window-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.message-window-actions button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.message-window-actions button:hover {
  background: var(--surface-hover);
  color: var(--blue);
}

.message-window-actions svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.message-form {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.message-form-body {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  align-content: start;
  padding: 24px 28px 26px;
  background: var(--surface-muted);
  scrollbar-width: thin;
}

.message-field,
.message-radio-field {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 7px;
  margin: 0;
  border: 0;
  padding: 0;
}

.message-field-wide {
  grid-column: 1 / -1;
}

.message-field > span,
.message-field-heading > span,
.message-radio-field legend {
  min-width: 0;
  color: var(--text-strong, var(--text));
  font-size: 13px;
  line-height: 1.3;
  font-weight: 900;
}

.message-field b,
.message-field-heading b,
.message-radio-field b {
  color: var(--danger);
  font-weight: 950;
}

.message-type-field {
  align-items: stretch;
}

.message-field-heading {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
}

.message-field-heading small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 750;
}

.message-field-heading small.has-selection {
  color: var(--blue);
}

.message-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.message-type-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
  --message-type-tone: var(--blue);
}

.message-type-option[data-tone="violet"] {
  --message-type-tone: #7c3aed;
}

.message-type-option[data-tone="cyan"] {
  --message-type-tone: #0891b2;
}

.message-type-option[data-tone="amber"] {
  --message-type-tone: #d97706;
}

.message-type-option[data-tone="red"] {
  --message-type-tone: var(--danger);
}

.message-type-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.message-type-card {
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-soft);
  padding: 0 10px;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.message-type-card > i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--message-type-tone);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--message-type-tone) 13%, transparent);
}

.message-type-card strong {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-type-card svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--message-type-tone);
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  opacity: 0;
  transform: scale(0.78);
  transition: opacity 120ms ease, transform 120ms ease;
}

.message-type-option:hover .message-type-card {
  border-color: color-mix(in srgb, var(--message-type-tone) 42%, var(--border));
  background: var(--surface-hover);
}

.message-type-option input:focus-visible + .message-type-card {
  outline: 3px solid color-mix(in srgb, var(--blue) 20%, transparent);
  outline-offset: 1px;
}

.message-type-option input:checked + .message-type-card {
  border-color: color-mix(in srgb, var(--message-type-tone) 58%, var(--border));
  background: color-mix(in srgb, var(--message-type-tone) 8%, var(--input-bg));
  color: var(--text-strong, var(--text));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--message-type-tone) 10%, transparent);
}

.message-type-option input:checked + .message-type-card svg {
  opacity: 1;
  transform: scale(1);
}

.message-field input,
.message-field select,
.message-email-control {
  width: 100%;
  height: 38px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.message-field input,
.message-field select {
  padding: 0 11px;
}

.message-field input::placeholder {
  color: var(--muted);
  opacity: 0.68;
}

.message-radio-field {
  align-items: center;
}

.message-radio-field legend {
  padding: 0;
}

.message-radio-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.message-radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 850;
}

.message-radio-group input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.message-schedule-field[hidden] {
  display: none;
}

.message-email-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
}

.message-email-chip {
  min-width: 0;
  max-width: 100%;
  height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(5, 150, 105, 0.24);
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success);
  padding: 0 9px;
}

.message-email-chip.is-empty {
  background: transparent;
  color: var(--muted);
  padding-left: 0;
}

.message-email-chip strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-content-field {
  align-items: start;
}

.message-content-field > span {
  padding-top: 0;
}

.message-editor {
  min-height: clamp(300px, 40vh, 400px);
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.message-editor:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent);
}

.message-editor-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  padding: 5px 7px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-muted);
  scrollbar-width: none;
}

.message-editor-toolbar::-webkit-scrollbar {
  display: none;
}

.message-editor-toolbar select,
.message-editor-toolbar button {
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.message-editor-toolbar select {
  width: 78px;
  padding: 0 7px;
  border-color: var(--border);
  background: var(--input-bg);
}

.message-editor-toolbar button {
  width: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.message-editor-toolbar button:hover,
.message-editor-toolbar button.is-active {
  border-color: color-mix(in srgb, var(--blue) 22%, var(--border));
  background: var(--blue-soft);
  color: var(--blue);
}

.message-editor-toolbar button:focus-visible,
.message-editor-toolbar select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 28%, transparent);
  outline-offset: 1px;
}

.message-editor-toolbar button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.message-editor-divider {
  width: 1px;
  height: 20px;
  flex: 0 0 auto;
  margin: 0 3px;
  background: var(--border);
}

.message-editor-body {
  min-height: 220px;
  overflow-y: auto;
  padding: 14px 15px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.58;
  font-weight: 500;
  outline: 0;
  white-space: pre-wrap;
}

.message-editor-body:empty::before {
  content: "请输入邮件内容";
  color: var(--muted);
  opacity: 0.68;
}

.message-editor-body :is(p, h2, h3, blockquote, ul, ol) {
  margin-block: 0 10px;
}

.message-editor-body h2 {
  font-size: 20px;
  line-height: 1.35;
}

.message-editor-body h3 {
  font-size: 16px;
  line-height: 1.4;
}

.message-editor-body blockquote {
  margin-inline: 0;
  border-left: 3px solid var(--blue);
  color: var(--text-soft);
  padding-left: 12px;
}

.message-editor-body :is(ul, ol) {
  padding-left: 24px;
}

.message-editor-body a {
  color: var(--blue);
  text-decoration: underline;
}

.message-editor-status {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 10px;
  border-top: 1px solid var(--border-light);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.message-editor-status strong {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 11px;
}

.message-drawer-footer {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

.message-drawer-footer .primary-action,
.message-drawer-footer .secondary-action {
  width: 96px;
  height: 36px;
  border-radius: 7px;
}

@media (max-width: 1500px) {
  .tag-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .crm-detail-shell {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .detail-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .crm-filter-grid,
  .crm-filter-advanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .crm-detail-shell {
    grid-template-columns: 1fr;
  }

  .detail-side-card {
    position: static;
    order: -1;
  }

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

  .account-form-grid {
    column-gap: 42px;
  }

  .rebate-level-control {
    margin-left: 0;
  }

  .rebate-source-row {
    grid-template-columns: 118px minmax(240px, 1fr);
  }

  .rebate-wallet-row {
    grid-template-columns: 140px minmax(240px, 1fr) auto;
  }

  .rebate-rule-row {
    grid-template-columns: minmax(180px, 260px) minmax(240px, 1fr) minmax(86px, auto) 68px;
  }

  .rebate-source-actions {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .permission-package-manage-modal {
    padding: 10px;
  }

  .permission-package-manage-dialog {
    max-height: calc(100vh - 20px);
  }

  .permission-package-manage-body {
    max-height: none;
    padding: 12px;
  }

  .permission-package-add-copy,
  .permission-package-list-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .manage-package-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .permission-package-add-controls,
  .permission-package-option {
    grid-template-columns: 1fr;
  }

  .crm-page,
  .crm-detail-page {
    padding: 10px 8px 44px;
  }

  .crm-heading {
    padding: 22px 20px;
  }

  .crm-heading h1 {
    font-size: 32px;
  }

  .crm-heading p {
    margin-top: 10px;
    font-size: 15px;
  }

  .crm-filter-grid,
  .crm-filter-advanced,
  .tag-filter-grid,
  .account-form-grid,
  .detail-info-grid,
  .detail-kpi-grid,
  .kyc-overview-grid,
  .promotion-summary-grid,
  .promotion-stat-strip,
  .promotion-access-layout,
  .promotion-permission-grid,
  .permission-package-add-panel,
  .manage-package-row,
  .promotion-link-filter-bar,
  .account-activity-filter-bar,
  .kyc-meta-grid,
  .wallet-card-grid,
  .permission-scope-grid,
  .follow-form-grid {
    grid-template-columns: 1fr;
  }

  .permission-scope-grid.promotion-permission-grid,
  .assigned-permission-package {
    grid-template-columns: 1fr;
  }

  .promotion-overview-section {
    grid-template-columns: 1fr;
  }

  .promotion-stat-strip > div {
    border-left: 0;
    border-top: 1px solid var(--border-light);
  }

  .promotion-stat-strip > div:first-child {
    border-top: 0;
  }

  .promotion-access-column + .promotion-access-column {
    border-top: 1px solid var(--border-light);
    border-left: 0;
  }

  .promotion-access-section .promotion-access-column {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .promotion-access-detail-head,
  .promotion-access-scope-head {
    align-items: flex-start;
  }

  .promotion-access-compact-head,
  .promotion-access-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .promotion-access-compact-actions {
    justify-content: flex-start;
  }

  .promotion-scope-groups {
    grid-template-columns: 1fr;
  }

  .promotion-scope-server-groups,
  .promotion-scope-other-groups {
    grid-template-columns: 1fr;
  }

  .promotion-scope-group-actions {
    grid-column: auto;
  }

  .promotion-permission-row-wide {
    grid-column: auto;
  }

  .promotion-permission-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .assigned-package-meta {
    justify-content: flex-start;
  }

  .promotion-module-head,
  .promotion-section-head,
  .permission-scope-card header,
  .promotion-link-table-footer,
  .account-activity-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .promotion-section-actions {
    justify-content: flex-start;
  }

  .crm-field,
  .account-form .field {
    grid-template-columns: 1fr;
  }

  .crm-field > span,
  .account-form .field > span {
    padding-top: 0;
    text-align: left;
  }

  .crm-filter-actions,
  .tag-filter-head,
  .crm-table-toolbar,
  .detail-tab-toolbar,
  .profile-top {
    align-items: stretch;
    flex-direction: column;
  }

  .crm-filter-toggle,
  .crm-filter-action-group {
    width: 100%;
  }

  .crm-filter-action-group {
    flex-direction: column;
  }

  .message-drawer {
    width: 100vw;
    max-height: none;
    height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .message-drawer-head {
    padding: 14px 16px;
  }

  .message-drawer-head h2 {
    font-size: 18px;
  }

  .message-form-body {
    grid-template-columns: 1fr;
    gap: 13px;
    padding: 14px 16px 16px;
  }

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

  .message-field,
  .message-radio-field {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .message-content-field > span {
    padding-top: 0;
  }

  .message-editor {
    min-height: 252px;
    grid-template-rows: auto minmax(170px, 1fr) auto;
  }

  .message-editor-body {
    min-height: 170px;
  }

  .message-editor-toolbar {
    padding-inline: 6px;
  }

  .message-drawer-footer {
    justify-content: stretch;
    padding: 12px 16px;
  }

  .message-drawer-footer .primary-action,
  .message-drawer-footer .secondary-action {
    width: 100%;
  }

  .customer-note-dialog,
  .follow-edit-dialog,
  .password-reset-dialog,
  .temporary-unfreeze-dialog,
  .reset-auth-dialog {
    width: calc(100vw - 24px);
  }

  .follow-edit-form {
    padding-inline: 16px;
  }

  .follow-edit-form .modal-footer {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .follow-edit-form .primary-action,
  .follow-edit-form .secondary-action {
    flex: 1;
    min-width: 0;
  }

  .customer-note-body {
    padding: 18px 16px 20px;
  }

  .password-reset-body,
  .temporary-unfreeze-body,
  .reset-auth-body {
    padding-inline: 20px;
  }

  .temporary-unfreeze-stepper {
    grid-template-columns: 42px minmax(0, 1fr) 42px auto;
  }

  .password-reset-footer {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    justify-content: stretch;
    padding-inline: 18px;
  }

  .password-reset-footer .primary-action,
  .password-reset-footer .secondary-action {
    width: auto;
    flex: 1;
    min-width: 0;
  }

  .crm-filter-actions .primary-action,
  .crm-filter-actions .secondary-action,
  .crm-table-toolbar .primary-action,
  .crm-table-toolbar .secondary-action,
  .profile-buttons .secondary-action {
    width: 100%;
  }

  .column-menu {
    width: 100%;
  }

  .column-menu-panel {
    width: min(100%, 280px);
  }

  .crm-table-wrap {
    padding: 12px;
  }

  .crm-table {
    min-width: 0;
  }

  .crm-table thead {
    display: none;
  }

  .crm-table,
  .crm-table tbody,
  .crm-table tr,
  .crm-table td {
    display: block;
  }

  .crm-table tbody {
    display: grid;
    gap: 12px;
  }

  .crm-table tr {
    overflow: hidden;
    border: 1px solid #dce6f4;
    border-radius: 8px;
    background: #fff;
  }

  .crm-table td {
    max-width: none;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    white-space: normal;
  }

  .crm-table th.actions-column,
  .crm-table td.actions-cell {
    position: static;
    width: auto;
    min-width: 0;
    box-shadow: none;
  }

  .crm-table td::before {
    content: attr(data-label);
    flex: 0 0 104px;
    color: #64748b;
    font-size: 12px;
    font-weight: 950;
  }

  .crm-table .select-cell,
  .crm-table .index-cell {
    display: none;
  }

  .crm-link-actions {
    display: none;
  }

  .crm-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
  }

  .crm-account-modal {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
  }

  .account-form {
    padding: 18px;
  }

  .account-modal-footer {
    margin: 18px -18px -18px;
  }

  .detail-tab-toolbar {
    padding: 14px;
  }

  .compact-date-range {
    width: 100%;
  }

  .add-follow {
    margin-left: 0;
  }

  .follow-actions,
  .detail-panel-actions,
  .under-title-toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .under-title-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .follow-actions .primary-action,
  .follow-actions .secondary-action,
  .compact-action,
  .detail-segmented {
    width: 100%;
  }

  .detail-segmented button {
    flex: 1 1 0;
  }

  .kyc-simple-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .kyc-simple-main span {
    white-space: normal;
  }

  .detail-table {
    min-width: 0;
  }

  .detail-table thead {
    display: none;
  }

  .detail-table,
  .detail-table tbody,
  .detail-table tr,
  .detail-table td {
    display: block;
  }

  .detail-table tbody {
    display: grid;
    gap: 12px;
    padding: 12px;
  }

  .detail-table tr {
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--surface);
  }

  .detail-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    white-space: normal;
  }

  .detail-table td::before {
    content: attr(data-label);
    flex: 0 0 90px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 950;
  }

  .promotion-links-module .detail-table tbody {
    gap: 0;
    padding: 0;
  }

  .promotion-links-module .detail-table tr {
    border: 0;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
  }

  .promotion-links-module .detail-table td {
    padding: 10px 14px;
  }

  .detail-table.has-frozen-action-column .detail-action-column {
    position: static;
    border-left: 0;
    box-shadow: none;
    background: transparent;
  }

  .promotion-link-scope-tabs {
    width: 100%;
    max-width: none;
    margin: 0;
    gap: 4px;
  }

  .promotion-link-scope-row {
    align-items: stretch;
    flex-direction: column;
    margin: 10px 10px 0;
  }

  .promotion-link-scope-actions {
    justify-content: flex-end;
  }

  .promotion-link-scope-tabs button {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
  }

  .promotion-link-visibility-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .follow-item {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
  }

  .follow-item::before {
    left: 13px;
  }

  .follow-dot {
    width: 28px;
    height: 28px;
  }

  .detail-module-head,
  .profile-card-head,
  .detail-tab-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-module-head p {
    text-align: left;
  }

  .detail-tabs {
    padding-inline: 12px;
  }

  .rebate-level-control,
  .rebate-source-row,
  .rebate-wallet-row,
  .rebate-rule-row {
    grid-template-columns: 1fr;
  }

  .rebate-level-control {
    gap: 8px;
  }

  .rebate-level-control > span,
  .rebate-source-row > label,
  .rebate-wallet-row > label,
  .rebate-rule-row > label {
    padding-top: 0;
    text-align: left;
    white-space: normal;
  }

  .rebate-source-row small {
    grid-column: auto;
  }

  .rebate-wallet-option-body,
  .rebate-wallet-new-form {
    margin-left: 0;
  }

  .rebate-wallet-agent-field {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .rebate-wallet-agent-field input,
  .rebate-wallet-agent-field .mini-action,
  .rebate-wallet-agent-field .mini-action:last-child {
    border-radius: 7px;
  }

  .rebate-wallet-submit-row .compact-action {
    width: 100%;
  }

  .rebate-source-actions,
  .rebate-light-action,
  .rebate-row-action,
  .rebate-row-action .mini-action {
    width: 100%;
  }

  .rebate-source-actions {
    grid-column: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rebate-row-action {
    min-height: 0;
  }

  .rebate-unit {
    min-height: 0;
  }

  .rebate-manual-control {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .profile-top {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .profile-list span {
    text-align: left;
    white-space: normal;
  }

  .detail-metric-actions {
    align-self: flex-end;
  }
}

/* CRM account list density: keep the data-heavy workspace compact without
   changing the shared review, trading-account, or detail-page surfaces. */
body[data-layout-page="crm-accounts"] .crm-page {
  padding: 8px 10px 48px;
}

body[data-layout-page="crm-accounts"] .crm-heading {
  margin-bottom: 10px;
  padding: 2px 4px 4px;
}

body[data-layout-page="crm-accounts"] .crm-heading h1 {
  font-size: 26px;
  line-height: 1.18;
  font-weight: 800;
}

body[data-layout-page="crm-accounts"] .crm-heading p {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] :is(.crm-filter-card, .crm-tag-filter-card, .crm-table-card) {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.035);
}

body[data-layout-page="crm-accounts"] .crm-filter-card {
  padding: 14px;
}

body[data-layout-page="crm-accounts"] :is(.crm-filter-grid, .crm-filter-advanced) {
  gap: 10px 12px;
}

body[data-layout-page="crm-accounts"] .crm-filter-advanced {
  margin-top: 10px;
}

body[data-layout-page="crm-accounts"] .crm-field {
  gap: 6px;
  font-weight: 700;
}

body[data-layout-page="crm-accounts"] .crm-field > span {
  font-size: 11px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] :is(
  .crm-field input,
  .crm-field select,
  .date-range,
  .select-combo,
  .filter-search-input
) {
  height: 36px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] :is(.crm-field input, .crm-field select) {
  padding-inline: 12px;
}

body[data-layout-page="crm-accounts"] .filter-search-input {
  gap: 7px;
  padding-inline: 10px;
}

body[data-layout-page="crm-accounts"] .filter-search-input svg {
  width: 15px;
  height: 15px;
}

body[data-layout-page="crm-accounts"] .crm-filter-actions {
  margin-top: 12px;
  padding-top: 10px;
}

body[data-layout-page="crm-accounts"] .crm-filter-actions :is(.primary-action, .secondary-action) {
  min-width: 84px;
  height: 34px;
  border-radius: 6px;
  padding-inline: 12px;
  font-size: 12px;
}

body[data-layout-page="crm-accounts"] .crm-filter-toggle {
  height: 34px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] .crm-tag-filter-card {
  margin-top: 10px;
  padding: 10px 12px;
}

body[data-layout-page="crm-accounts"] .tag-filter-head {
  margin-bottom: 8px;
}

body[data-layout-page="crm-accounts"] .tag-filter-head h2 {
  font-size: 14px;
  font-weight: 800;
}

body[data-layout-page="crm-accounts"] .tag-filter-title-row {
  gap: 8px;
}

body[data-layout-page="crm-accounts"] .tag-reset-link {
  height: 24px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] .tag-filter-actions {
  gap: 6px;
}

body[data-layout-page="crm-accounts"] .tag-filter-actions .icon-action {
  width: 28px;
  height: 28px;
}

body[data-layout-page="crm-accounts"] .tag-filter-grid {
  gap: 7px;
  padding-bottom: 0;
}

body[data-layout-page="crm-accounts"] .tag-filter-item {
  width: 150px;
  min-width: 150px;
  min-height: 48px;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] .tag-filter-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

body[data-layout-page="crm-accounts"] .tag-filter-icon svg {
  width: 15px;
  height: 15px;
}

body[data-layout-page="crm-accounts"] .tag-filter-copy {
  gap: 2px;
}

body[data-layout-page="crm-accounts"] .tag-filter-copy strong {
  font-size: 12px;
  font-weight: 800;
}

body[data-layout-page="crm-accounts"] .tag-filter-copy small {
  font-size: 10px;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] .tag-filter-info {
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 800;
}

body[data-layout-page="crm-accounts"] .crm-table-card {
  margin-top: 12px;
}

body[data-layout-page="crm-accounts"] .crm-table-toolbar {
  min-height: 56px;
  gap: 12px;
  padding: 10px 12px;
}

body[data-layout-page="crm-accounts"] :is(.crm-table-toolbar .toolbar-left, .crm-table-toolbar .toolbar-right) {
  gap: 8px;
}

body[data-layout-page="crm-accounts"] .crm-table-toolbar :is(.primary-action, .secondary-action) {
  height: 34px;
  gap: 6px;
  padding-inline: 11px;
  border-radius: 6px;
  font-size: 12px;
}

body[data-layout-page="crm-accounts"] .crm-table-toolbar .icon-action {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

body[data-layout-page="crm-accounts"] .crm-table-toolbar svg {
  width: 15px;
  height: 15px;
}

body[data-layout-page="crm-accounts"] .crm-table :is(th, td) {
  padding: 10px;
}

body[data-layout-page="crm-accounts"] .crm-table th {
  font-size: 11px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] .crm-table td {
  font-size: 13px;
  line-height: 1.3;
}

body[data-layout-page="crm-accounts"] .crm-table :is(th.tag-column, td.tag-cell) {
  min-width: 190px;
}

body[data-layout-page="crm-accounts"] :is(.account-name, .parent-account) {
  gap: 2px;
}

body[data-layout-page="crm-accounts"] :is(
  .account-name strong,
  .parent-account strong,
  .contact-cell strong
) {
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] :is(
  .account-name small,
  .parent-account small,
  .contact-cell small,
  .crm-table td small
) {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] .crm-tag-stack {
  max-width: none;
  flex-wrap: nowrap;
}

body[data-layout-page="crm-accounts"] .crm-tag {
  min-height: 22px;
  padding-inline: 7px;
  font-size: 11px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] .switch-control.crm-switch {
  width: 38px;
  height: 22px;
}

body[data-layout-page="crm-accounts"] .switch-control.crm-switch span::after {
  width: 18px;
  height: 18px;
}

body[data-layout-page="crm-accounts"] .switch-control.crm-switch input:checked + span::after {
  transform: translateX(16px);
}

body[data-layout-page="crm-accounts"] :is(.status-chip, .account-chip, .tiny-chip) {
  min-height: 22px;
  padding-inline: 7px;
  font-size: 11px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] .crm-action-main {
  height: 28px;
  padding-inline: 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] .crm-action-menu summary {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

body[data-layout-page="crm-accounts"] .crm-table-card .table-footer {
  gap: 12px;
  padding: 10px 12px;
  font-size: 12px;
}

body[data-layout-page="crm-accounts"] .crm-table-card :is(.table-footer-left, .page-size) {
  gap: 8px;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] .crm-table-card .page-size select {
  height: 30px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] .crm-table-card .pager button {
  min-width: 32px;
  height: 30px;
  font-size: 12px;
}

body[data-layout-page="crm-accounts"] .crm-account-range-filter {
  position: relative;
  min-width: 0;
}

body[data-layout-page="crm-accounts"] .crm-account-range-filter.is-open {
  z-index: 30;
}

body[data-layout-page="crm-accounts"] .crm-account-range-combobox {
  position: relative;
  min-width: 0;
}

body[data-layout-page="crm-accounts"] .crm-account-range-input-wrap {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 9px;
  border: 1px solid var(--border, #d8e1ef);
  border-radius: 7px;
  background: var(--input-bg, #fff);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

body[data-layout-page="crm-accounts"] .crm-account-range-input-wrap:focus-within {
  border-color: rgba(var(--blue-rgb), 0.64);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.11);
}

body[data-layout-page="crm-accounts"] .crm-account-range-toggle svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: #94a3b8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

body[data-layout-page="crm-accounts"] .crm-account-range-selection-scope {
  min-width: 0;
  height: 20px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--blue-soft, #eaf1ff);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

body[data-layout-page="crm-accounts"] .crm-account-range-selection-scope.is-direct {
  background: var(--success-soft, #ecfdf5);
  color: var(--success, #047857);
}

body[data-layout-page="crm-accounts"] .crm-account-range-input-wrap input {
  width: 0;
  height: 34px;
  min-width: 0;
  flex: 1 1 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

body[data-layout-page="crm-accounts"] .crm-account-range-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0 7px 7px 0;
  background: transparent;
}

body[data-layout-page="crm-accounts"] .crm-account-range-toggle:hover {
  background: color-mix(in srgb, var(--blue) 7%, transparent);
}

body[data-layout-page="crm-accounts"] .crm-account-range-toggle svg {
  transition: transform 0.16s ease;
}

body[data-layout-page="crm-accounts"] .crm-account-range-filter.is-open .crm-account-range-toggle svg {
  transform: rotate(180deg);
}

body[data-layout-page="crm-accounts"] .crm-account-range-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  /* 浮层比筛选格子宽：格子只有 230px，邮箱一律被截成 "xxx@exa..."。
     不跟着格子拉通，改成固定 360 往右探出，窄屏再退回视口宽度。 */
  right: auto;
  z-index: 35;
  width: 300px;
  min-width: 100%;
  max-width: calc(100vw - 48px);
  max-height: 420px;
  /* 浮层自己不滚：口径胶囊钉在顶上、提示与关系树入口钉在底下，中间名单自己滚 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 7px;
  border: 1px solid var(--border, #d8e1ef);
  border-radius: 8px;
  background: var(--surface-raised, #fff);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

body[data-layout-page="crm-accounts"] .crm-account-range-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body[data-layout-page="crm-accounts"] .crm-account-range-scope {
  flex: none;
  /* 两颗按两字文案收窄，不再各占半个浮层宽 */
  display: inline-grid;
  grid-auto-flow: column;
  justify-content: start;
  /* 浮层是纵向 flex 容器，横向收窄要用 align-self，justify-self 在这里没用 */
  align-self: flex-start;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-muted, #f1f5f9);
}

body[data-layout-page="crm-accounts"] .crm-account-range-scope-option {
  height: 30px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted, #64748b);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

body[data-layout-page="crm-accounts"] :is(
  .crm-account-range-scope-option:hover,
  .crm-account-range-scope-option:focus-visible
) {
  outline: 0;
  color: var(--blue);
}

body[data-layout-page="crm-accounts"] .crm-account-range-scope-option.is-selected {
  background: var(--surface-raised, #fff);
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

body[data-layout-page="crm-accounts"] .crm-account-range-user-list {
  display: grid;
  gap: 4px;
}

body[data-layout-page="crm-accounts"] .crm-account-range-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  /* 一行是「标签 + 姓名/ID 两行文案」，给足上下内边距，
     行与行之间靠列表的 gap 分开，不靠挤 */
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text, #0f172a);
  font: inherit;
  text-align: left;
}

body[data-layout-page="crm-accounts"] :is(
  .crm-account-range-option:hover,
  .crm-account-range-option:focus-visible
) {
  outline: 0;
  background: color-mix(in srgb, var(--blue) 8%, transparent);
}

body[data-layout-page="crm-accounts"] .crm-account-range-option.is-selected {
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
}

body[data-layout-page="crm-accounts"] .crm-account-range-option.is-selected::after {
  content: "✓";
  flex: 0 0 auto;
  color: currentColor;
  font-size: 11px;
  font-weight: 900;
}

body[data-layout-page="crm-accounts"] .crm-account-range-option span {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-layout-page="crm-accounts"] .crm-account-range-option small {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted, #64748b);
  font-size: 10px;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] .crm-account-range-kind {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

body[data-layout-page="crm-accounts"] .crm-account-range-kind.is-agent {
  background: #fff7ed;
  color: #c2410c;
}

body[data-layout-page="crm-accounts"] .crm-account-range-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  line-height: 1.25;
}

body[data-layout-page="crm-accounts"] .crm-account-range-copy strong,
body[data-layout-page="crm-accounts"] .crm-account-range-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-layout-page="crm-accounts"] .crm-account-range-copy small {
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] .crm-account-range-empty {
  padding: 16px 9px;
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-action {
  flex: none;
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding: 0 9px;
  border: 0;
  border-top: 1px solid var(--border-light, #e8edf5);
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-action:hover,
body[data-layout-page="crm-accounts"] .crm-account-range-tree-action:focus-visible {
  outline: 0;
  background: color-mix(in srgb, var(--blue) 8%, transparent);
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-action svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-backdrop {
  padding: 26px;
  background: rgba(6, 6, 8, 0.56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

body.crm-account-range-tree-open {
  overflow: hidden;
}

/* 抽屉外壳照 .mft-sheet.is-wide 的度量：920 宽、86dvh 上限、14 圆角 */
body[data-layout-page="crm-accounts"] .crm-account-range-tree-modal {
  width: min(920px, 100%);
  max-height: min(86dvh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-raised, #fff);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border-light, #e8edf5);
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-header .modal-close {
  margin-left: auto;
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-soft, #f7faff);
  color: var(--muted, #64748b);
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-header .modal-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-header .modal-close:hover {
  color: var(--blue, #2563eb);
  border-color: rgba(37, 99, 235, 0.32);
  background: rgba(37, 99, 235, 0.1);
}

/* ==========================================================================
   账户范围-高级搜索：1:1 复刻 IB 端「客户交易历史 (Fusion)」的范围抽屉
   （ib-trading-fusion.css 的 .ibh-scope-* / .ibh-row / .ibh-check 那一套），
   尺寸、间距、圆角、层级引导线全部照搬，只把金色主题换成本页的蓝色：
     --gold      → var(--blue)          --gold-ink  → #fff
     --gold-deep → var(--blue-ink)      --gold-line → rgba(37,99,235,.32)
     --gold-tint → rgba(37,99,235,.10)
   ========================================================================== */
body[data-layout-page="crm-accounts"] .crm-account-range-tree-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 18px;
}

/* ---------- 抽屉标题下的状态行 ---------- */
body[data-layout-page="crm-accounts"] .crm-range-status {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-soft, #475569);
}

body[data-layout-page="crm-accounts"] .crm-range-chain {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 6px;
  min-width: 0;
}

body[data-layout-page="crm-accounts"] .crm-range-chain b {
  font-weight: 650;
  color: var(--text-soft, #475569);
}

body[data-layout-page="crm-accounts"] .crm-range-chain b.is-tail {
  font-weight: 750;
  color: var(--text-strong, #0f172a);
}

body[data-layout-page="crm-accounts"] .crm-range-chain i {
  font-style: normal;
  color: var(--muted, #64748b);
}

body[data-layout-page="crm-accounts"] .crm-range-status.is-drilled .crm-range-chain b.is-tail {
  color: var(--blue-ink, #1d4ed8);
}

body[data-layout-page="crm-accounts"] .crm-range-stats {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: var(--muted, #64748b);
}

body[data-layout-page="crm-accounts"] .crm-range-stats::before {
  content: "·";
  color: var(--border, #d8e1ef);
}

body[data-layout-page="crm-accounts"] .crm-range-stats b {
  font-weight: 750;
  color: var(--text-soft, #475569);
  font-variant-numeric: tabular-nums;
}

body[data-layout-page="crm-accounts"] .crm-range-clear {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.32);
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue-ink, #1d4ed8);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 650;
  transition: background 0.14s;
}

body[data-layout-page="crm-accounts"] .crm-range-clear[hidden] {
  display: none !important;
}

body[data-layout-page="crm-accounts"] .crm-range-clear:hover {
  background: var(--blue, #2563eb);
  color: #fff;
}

/* ---------- 搜索排在正文最上面 ---------- */
body[data-layout-page="crm-accounts"] .crm-range-search {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

body[data-layout-page="crm-accounts"] .crm-range-search > svg {
  position: absolute;
  left: 9px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--muted, #64748b);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

body[data-layout-page="crm-accounts"] .crm-range-search input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 30px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-raised, #fff);
  font-size: 12.5px;
  color: var(--text-strong, #0f172a);
}

body[data-layout-page="crm-accounts"] .crm-range-search:focus-within > svg {
  stroke: var(--blue, #2563eb);
}

body[data-layout-page="crm-accounts"] .crm-range-search input::-webkit-search-cancel-button {
  display: none;
}

body[data-layout-page="crm-accounts"] .crm-range-search input::placeholder {
  color: var(--muted, #64748b);
}

body[data-layout-page="crm-accounts"] .crm-range-search input:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.32);
  outline-offset: 1px;
}

body[data-layout-page="crm-accounts"] .crm-range-search > button {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  color: var(--muted, #64748b);
  background: var(--surface-muted, #f1f5f9);
  cursor: pointer;
}

body[data-layout-page="crm-accounts"] .crm-range-search > button[hidden] {
  display: none;
}

body[data-layout-page="crm-accounts"] .crm-range-search > button:hover {
  color: var(--text-strong, #0f172a);
}

body[data-layout-page="crm-accounts"] .crm-range-search > button svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
}

/* ---------- 命中数写在树上方 ---------- */
body[data-layout-page="crm-accounts"] .crm-range-hits {
  flex: none;
  margin: -6px 2px 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted, #64748b);
}

body[data-layout-page="crm-accounts"] .crm-range-hits[hidden] {
  display: none;
}

body[data-layout-page="crm-accounts"] .crm-range-hits b {
  font-weight: 750;
  color: var(--blue-ink, #1d4ed8);
  font-variant-numeric: tabular-nums;
}

/* ---------- 口径表单：口径占左半，开关占右半并与胶囊底边对齐 ---------- */
body[data-layout-page="crm-accounts"] .crm-range-form {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 10px 12px;
  margin-bottom: 14px;
}

body[data-layout-page="crm-accounts"] .crm-range-mode-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

body[data-layout-page="crm-accounts"] .crm-range-mode-field legend {
  padding: 0;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted, #64748b);
}

body[data-layout-page="crm-accounts"] .crm-range-mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body[data-layout-page="crm-accounts"] .crm-range-mode-option {
  position: relative;
  flex: 1 1 125px;
  min-width: 0;
  cursor: pointer;
}

body[data-layout-page="crm-accounts"] .crm-range-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body[data-layout-page="crm-accounts"] .crm-range-mode-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-soft, #f7faff);
  color: var(--muted, #64748b);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.16s, border-color 0.16s, background 0.16s, box-shadow 0.16s;
}

body[data-layout-page="crm-accounts"] .crm-range-mode-option:hover span {
  color: var(--text-strong, #0f172a);
  border-color: var(--border, #d8e1ef);
}

body[data-layout-page="crm-accounts"] .crm-range-mode-option input:checked + span {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(180deg, #3b82f6, var(--blue, #2563eb));
}

body[data-layout-page="crm-accounts"] .crm-range-mode-option input:focus-visible + span {
  outline: 2px solid rgba(37, 99, 235, 0.32);
  outline-offset: 2px;
}

body[data-layout-page="crm-accounts"] .crm-range-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-soft, #f7faff);
  color: var(--text-soft, #475569);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
}

body[data-layout-page="crm-accounts"] .crm-range-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body[data-layout-page="crm-accounts"] .crm-range-switch i {
  position: relative;
  flex: none;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: var(--border, #d8e1ef);
  transition: background 0.16s;
}

body[data-layout-page="crm-accounts"] .crm-range-switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s;
}

body[data-layout-page="crm-accounts"] .crm-range-switch input:checked + i {
  background: var(--blue, #2563eb);
}

body[data-layout-page="crm-accounts"] .crm-range-switch input:checked + i::after {
  transform: translateX(15px);
}

body[data-layout-page="crm-accounts"] .crm-range-switch input:focus-visible + i {
  outline: 2px solid rgba(37, 99, 235, 0.32);
  outline-offset: 2px;
}

/* ---------- 关系树面板：整块框起来，占满抽屉剩余高度 ---------- */
body[data-layout-page="crm-accounts"] .crm-range-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-soft, #f7faff);
}

body[data-layout-page="crm-accounts"] .crm-range-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

body[data-layout-page="crm-accounts"] .crm-range-panel-title {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}

body[data-layout-page="crm-accounts"] .crm-range-panel-title strong {
  font-size: 13px;
  font-weight: 750;
  color: var(--text-strong, #0f172a);
}

body[data-layout-page="crm-accounts"] .crm-range-panel-title small {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted, #64748b);
}

/* 图例里那一小块灰，对应树里 .is-dim 的行 */
body[data-layout-page="crm-accounts"] .crm-range-dim-key {
  display: inline-block;
  width: 16px;
  height: 8px;
  margin-right: 4px;
  border-radius: 3px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-muted, #f1f5f9);
  opacity: 0.55;
  vertical-align: middle;
}

body[data-layout-page="crm-accounts"] .crm-range-panel-tools {
  display: flex;
  gap: 6px;
  flex: none;
}

body[data-layout-page="crm-accounts"] .crm-range-panel-tools button {
  height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-raised, #fff);
  color: var(--text-soft, #475569);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: color 0.14s, border-color 0.14s;
}

body[data-layout-page="crm-accounts"] .crm-range-panel-tools button:hover {
  color: var(--blue, #2563eb);
  border-color: rgba(37, 99, 235, 0.32);
}

/* ---------- 客户关系树 ----------
   一行 = 箭头 | 勾选框 | 类型标签 | 主体。缩进靠 .crm-range-kids 自己的
   margin 叠加，顺便用虚线画出层级引导线，比给每层算 padding 更稳。 */
body[data-layout-page="crm-accounts"] .crm-account-range-tree-body {
  flex: 1;
  min-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-raised, #fff);
}

body[data-layout-page="crm-accounts"] .crm-range-node + body[data-layout-page="crm-accounts"] .crm-range-node {
  margin-top: 3px;
}

body[data-layout-page="crm-accounts"] .crm-range-kids {
  margin: 3px 0 3px 14px;
  padding-left: 12px;
  border-left: 1px dashed var(--border, #d8e1ef);
}

body[data-layout-page="crm-accounts"] .crm-range-row {
  display: grid;
  grid-template-columns: 20px 18px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.14s, border-color 0.14s;
}

body[data-layout-page="crm-accounts"] .crm-range-row:hover {
  background: var(--surface-muted, #f1f5f9);
}

/* 所有行一个模子：代理和客户不靠边框区分（那会让树一半有框一半没框），
   靠标签、缩进和层级引导线区分；底色和边框只留给「选中」和 hover */
body[data-layout-page="crm-accounts"] .crm-range-row.is-on {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.32);
}

/* 不在当前口径里的行：淡一档，但依旧可点 */
body[data-layout-page="crm-accounts"] .crm-range-row.is-dim {
  opacity: 0.5;
}

body[data-layout-page="crm-accounts"] .crm-range-row.is-dim:hover,
body[data-layout-page="crm-accounts"] .crm-range-row.is-on.is-dim {
  opacity: 1;
}

/* 叶子节点不画箭头，但要占住那 20px，否则同层的文字对不齐 */
body[data-layout-page="crm-accounts"] .crm-range-caret {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

body[data-layout-page="crm-accounts"] .crm-range-caret svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-layout-page="crm-accounts"] .crm-range-caret:hover {
  color: var(--blue, #2563eb);
  background: rgba(37, 99, 235, 0.1);
}

body[data-layout-page="crm-accounts"] .crm-range-caret.is-open svg {
  transform: rotate(90deg);
}

body[data-layout-page="crm-accounts"] .crm-range-caret.is-leaf {
  visibility: hidden;
}

/* 勾选框：方框本身是一颗按钮，行名点起来等效；半选画一横 */
body[data-layout-page="crm-accounts"] .crm-range-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 5px;
  border: 1.5px solid var(--border, #d8e1ef);
  background: var(--surface-raised, #fff);
  color: transparent;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, color 0.14s;
}

body[data-layout-page="crm-accounts"] .crm-range-check svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-layout-page="crm-accounts"] .crm-range-check:hover {
  border-color: var(--blue, #2563eb);
}

body[data-layout-page="crm-accounts"] .crm-range-check.is-on {
  border-color: var(--blue, #2563eb);
  background: var(--blue, #2563eb);
  color: #fff;
}

body[data-layout-page="crm-accounts"] .crm-range-check.is-part {
  border-color: var(--blue, #2563eb);
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue-ink, #1d4ed8);
}

body[data-layout-page="crm-accounts"] .crm-range-check.is-part svg {
  display: none;
}

body[data-layout-page="crm-accounts"] .crm-range-check.is-part::after {
  content: "";
  width: 9px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

body[data-layout-page="crm-accounts"] .crm-range-check:focus-visible,
body[data-layout-page="crm-accounts"] .crm-range-caret:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.32);
  outline-offset: 2px;
}

/* 类型标签 */
body[data-layout-page="crm-accounts"] .crm-range-tag {
  flex: none;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--text-soft, #475569);
  background: var(--surface-muted, #f1f5f9);
}

body[data-layout-page="crm-accounts"] .crm-range-tag.is-ib {
  color: var(--blue-ink, #1d4ed8);
  background: rgba(37, 99, 235, 0.1);
}

body[data-layout-page="crm-accounts"] .crm-range-row-main {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

body[data-layout-page="crm-accounts"] .crm-range-row-main strong {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-strong, #0f172a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-layout-page="crm-accounts"] .crm-range-row-main small {
  font-size: 11px;
  color: var(--muted, #64748b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 层级徽标：跟在名字后面，比名字轻一档，不抢主体 */
body[data-layout-page="crm-accounts"] .crm-range-level {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-light, #e8edf5);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted, #64748b);
  vertical-align: 1px;
}

body[data-layout-page="crm-accounts"] .crm-range-hitflag {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--blue, #2563eb);
  vertical-align: 1px;
}

body[data-layout-page="crm-accounts"] .crm-range-hit {
  padding: 0 1px;
  border-radius: 3px;
  color: var(--blue-ink, #1d4ed8);
  background: rgba(37, 99, 235, 0.1);
  box-shadow: inset 0 -1px 0 rgba(37, 99, 235, 0.32);
}

/* ---------- 深色：theme.css 有一条通吃全部 button 的暗色规则
   （:root[data-theme="dark"] :is(button, input, select, …)），
   它和 body[data-layout-page] .xxx 同权重但排在后面，会把这里的
   勾选框 / 箭头 / 小按钮全部刷成输入框底色——勾没勾都一个样。
   所以这几颗按钮的暗色态必须带 :root[data-theme="dark"] 再声明一次。 ---------- */
:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-check {
  background-color: var(--surface-raised, #151f2f);
  border-color: var(--border, #253247);
  color: transparent;
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-check.is-on {
  background-color: var(--blue, #2563eb);
  border-color: var(--blue, #2563eb);
  color: #fff;
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-check.is-part {
  background-color: rgba(37, 99, 235, 0.24);
  border-color: var(--blue, #2563eb);
  color: #93c5fd;
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-check:hover {
  border-color: var(--blue, #2563eb);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-caret,
:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-row-main {
  background-color: transparent;
  border-color: transparent;
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-caret {
  color: var(--muted, #9aa8bd);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-caret:hover {
  color: #93c5fd;
  background-color: rgba(37, 99, 235, 0.18);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-panel-tools button {
  background-color: var(--surface-raised, #151f2f);
  border-color: var(--border-light, #1e293b);
  color: var(--text-soft, #cbd5e1);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-panel-tools button:hover {
  color: #93c5fd;
  border-color: rgba(37, 99, 235, 0.42);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-clear {
  background-color: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.42);
  color: #93c5fd;
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-clear:hover {
  background-color: var(--blue, #2563eb);
  color: #fff;
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-search > button {
  background-color: var(--surface-muted, #1e293b);
  border-color: transparent;
  color: var(--muted, #9aa8bd);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-row.is-on {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.42);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-hit {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.2);
  box-shadow: inset 0 -1px 0 rgba(37, 99, 235, 0.42);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-hitflag {
  color: #fff;
  background: var(--blue, #2563eb);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-tag.is-ib {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.18);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-status.is-drilled .crm-range-chain b.is-tail,
:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-hits b {
  color: #93c5fd;
}

/* 口径胶囊那颗 span 不是 button，通吃规则碰不到它，但选中态的渐变
   在深色下要压暗一点，否则亮度跳得太远 */
:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-mode-option span {
  background: var(--surface-muted, #1e293b);
  border-color: var(--border-light, #1e293b);
}

:root[data-theme="dark"] body[data-layout-page="crm-accounts"] .crm-range-mode-option input:checked + span {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(180deg, #2f6fe0, #1d4ed8);
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-empty,body[data-layout-page="crm-accounts"] .crm-account-range-tree-empty,
body[data-layout-page="crm-accounts"] .crm-account-range-tree-footer {
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 650;
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-empty {
  padding: 54px 16px;
  text-align: center;
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-soft, #f7faff);
}

body[data-layout-page="crm-accounts"] .crm-account-range-tree-footer > button {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
}

@media (max-width: 640px) {
  body[data-layout-page="crm-accounts"] .crm-range-form {
    align-items: stretch;
    flex-direction: column;
  }

  body[data-layout-page="crm-accounts"] .crm-range-mode-options {
    border-radius: 10px;
  }

  body[data-layout-page="crm-accounts"] .crm-range-mode-option,
  body[data-layout-page="crm-accounts"] .crm-range-mode-option span {
    width: 100%;
    justify-content: center;
  }

  body[data-layout-page="crm-accounts"] .crm-account-range-tree-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  body[data-layout-page="crm-accounts"] .crm-page {
    padding: 8px 8px 40px;
  }

  body[data-layout-page="crm-accounts"] .crm-heading {
    padding: 12px 10px;
  }

  body[data-layout-page="crm-accounts"] .crm-heading h1 {
    font-size: 24px;
  }

  body[data-layout-page="crm-accounts"] .crm-account-range-input-wrap {
    height: 40px;
  }

  body[data-layout-page="crm-accounts"] .crm-account-range-toggle {
    width: 38px;
    height: 38px;
  }

  body[data-layout-page="crm-accounts"] :is(
    .crm-field input,
    .crm-field select,
    .date-range,
    .select-combo,
    .filter-search-input,
    .crm-filter-actions .primary-action,
    .crm-filter-actions .secondary-action,
    .crm-table-toolbar .primary-action,
    .crm-table-toolbar .secondary-action
  ) {
    height: 40px;
  }

  body[data-layout-page="crm-accounts"] .crm-table :is(th.tag-column, td.tag-cell) {
    min-width: 0;
  }

  body[data-layout-page="crm-accounts"] .crm-tag-stack {
    max-width: 210px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  body[data-layout-page="crm-accounts"] .crm-table td {
    padding: 10px 12px;
  }
}

/* CRM promotion-link delete flow mirrors the promotion center's source migration dialog. */
body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal {
  width: min(520px, calc(100vw - 32px));
  border-color: #f2d6d8;
  border-radius: 16px;
  box-shadow: 0 28px 70px rgba(127, 29, 29, 0.2);
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-header {
  padding: 20px 22px 17px;
  background: linear-gradient(180deg, #fffafa 0%, #fff 100%);
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-header .summary-kicker {
  color: #b4232c;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-header h2 {
  margin-top: 5px;
  font-size: 20px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-header p {
  margin-top: 6px;
  font-size: 12px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-body {
  display: grid;
  gap: 14px;
  padding: 18px 22px 20px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-warning {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid #fecdd3;
  border-radius: 11px;
  background: #fff4f5;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-warning-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #ffe1e5;
  color: #c62835;
  font-size: 14px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-warning strong {
  display: block;
  color: #9f1d2b;
  font-size: 13px;
  line-height: 1.35;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-warning p {
  margin: 5px 0 0;
  color: #8f4a52;
  font-size: 12px;
  line-height: 1.6;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-target {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: 1px solid #e5ebf4;
  border-radius: 10px;
  background: #f8fafc;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-target-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eaf2ff;
  color: var(--blue);
  font-size: 16px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-target > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-target small {
  color: #7b8799;
  font-size: 10px;
  font-weight: 800;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-target strong,
body[data-layout-page="crm-account-detail"] .crm-promo-delete-target > div > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-target strong {
  color: #172033;
  font-size: 13px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-target > div > span {
  color: #64748b;
  font-size: 11px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-replacement {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #dbe7fb;
  border-radius: 10px;
  background: #f8fbff;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-replacement-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-replacement-head > div {
  display: grid;
  gap: 3px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-replacement-head small,
body[data-layout-page="crm-account-detail"] .crm-promo-delete-select-field > span {
  color: #6f7d92;
  font-size: 10px;
  font-weight: 800;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-replacement-head strong {
  color: #172033;
  font-size: 13px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-replacement-optional {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #cfe0fb;
  border-radius: 999px;
  background: #eef5ff;
  color: var(--blue);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-search-field {
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #fff;
  color: #8a97aa;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-search-field:focus-within,
body[data-layout-page="crm-account-detail"] .crm-promo-delete-select-field:focus-within {
  border-color: #8eb5f8;
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.1);
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-search-field i {
  flex: 0 0 auto;
  font-size: 13px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-search-field input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #172033;
  font: inherit;
  font-size: 12px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-search-field input::placeholder {
  color: #9aa6b8;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-select-field {
  min-width: 0;
  display: grid;
  gap: 5px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-select-field select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  outline: 0;
  background: #fff;
  color: #172033;
  font: inherit;
  font-size: 12px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-replacement-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: #748198;
  font-size: 10px;
  line-height: 1.4;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-replacement-hint i {
  color: #6d9ff1;
  font-size: 12px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #7b8799;
  font-size: 11px;
  line-height: 1.45;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-note i {
  color: #8b98aa;
  font-size: 13px;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal .modal-footer {
  padding: 14px 22px;
  background: #fff;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal .danger-action {
  min-width: 104px;
  gap: 7px;
  color: #fff !important;
  -webkit-text-fill-color: #fff;
}

body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal .crm-promo-delete-confirm-label {
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  line-height: 1;
}

@media (max-width: 760px) {
  body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-header,
  body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-header {
    position: relative;
    align-items: flex-start;
    flex-direction: row;
    padding-right: 58px;
  }

  body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-header .modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    margin: 0;
  }

  body[data-layout-page="crm-account-detail"] .crm-promo-delete-modal-body {
    padding: 14px 16px 16px;
  }

  body[data-layout-page="crm-account-detail"] .crm-promo-delete-warning {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    padding: 11px;
  }

  body[data-layout-page="crm-account-detail"] .crm-promo-delete-warning p {
    font-size: 11px;
  }
}

/* ==========================================================================
   客户归属：CRM 列表的归属列、详情页「客户归属」卡片、调整归属组织弹窗
   颜色只用主题 token 和既有胶囊（.crm-tag），暗色模式跟着 theme.css 走。
   ========================================================================== */
/* .parent-account 的文字默认 overflow: visible（为 tooltip 让路），归属列要自己截断，路径太长只看 title */
.crm-attribution-cell {
  min-width: 0;
}

.crm-attribution-cell strong,
.crm-attribution-cell small {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 组织路径、归属原因是中文说明，不沿用上级列的等宽字体；只有销售 id 保持等宽 */
.crm-attribution-cell small {
  font-family: inherit;
}

.crm-attribution-cell small.is-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* 截断的文字最小宽度会被表格自动布局压到几乎为 0，列宽要自己撑住 */
.crm-table td.attribution-cell {
  min-width: 124px;
}

.crm-table td.attribution-cell.is-source {
  min-width: 168px;
}

.crm-table td.attribution-cell.is-source .crm-attribution-cell :is(strong, small) {
  max-width: 190px;
}

.detail-attribution-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.detail-attribution-actions .secondary-action {
  height: 34px;
  gap: 6px;
  padding-inline: 12px;
  border-radius: 7px;
  font-size: 13px;
}

.detail-attribution-actions .secondary-action svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.detail-attribution-actions .secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.detail-attribution-body {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
}

.detail-attribution-grid article {
  min-width: 0;
  padding: 12px 14px;
}

.detail-attribution-grid strong {
  margin-top: 5px;
  font-size: 14px;
  white-space: nowrap;
}

.detail-attribution-grid strong .crm-tag {
  font-style: normal;
  vertical-align: middle;
}

.detail-attribution-grid small {
  display: block;
  min-width: 0;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-attribution-link {
  color: var(--blue);
  text-decoration: none;
}

.detail-attribution-link:hover {
  text-decoration: underline;
}

.detail-attribution-reason {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.detail-attribution-reason span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-attribution-reason p {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.detail-attribution-history {
  display: grid;
  gap: 10px;
}

.detail-attribution-history > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.detail-attribution-history h3 {
  margin: 0;
  color: var(--text-strong, var(--text));
  font-size: 14px;
  font-weight: 950;
}

.detail-attribution-history > header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.detail-attribution-history .profile-parent-empty {
  margin-top: 0;
}

/* 归属历史：比跟进时间线更紧凑的一条竖线，点的颜色区分动作（注册/补录、分配、释放/上浮、调整/绑定 IB） */
.attribution-timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attribution-timeline-item {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 0 0 14px 24px;
}

.attribution-timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: 3px solid var(--surface-raised, var(--surface));
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 1px rgba(var(--blue-rgb), 0.3);
}

.attribution-timeline-item::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 19px;
  bottom: 2px;
  width: 2px;
  border-radius: 999px;
  background: var(--border-light);
}

.attribution-timeline-item:last-child {
  padding-bottom: 0;
}

.attribution-timeline-item:last-child::after {
  display: none;
}

.attribution-timeline-item.is-green::before {
  background: var(--success);
}

.attribution-timeline-item.is-amber::before {
  background: var(--warning);
}

.attribution-timeline-item.is-purple::before {
  background: var(--purple);
}

.attribution-timeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.attribution-timeline-head strong {
  color: var(--text-strong, var(--text));
  font-size: 13px;
  font-weight: 950;
}

.attribution-timeline-head time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.attribution-timeline-item .follow-meta-row {
  gap: 6px;
}

.attribution-timeline-item .follow-meta-row span {
  min-height: 22px;
  padding: 0 8px;
  background: var(--surface-muted);
  color: var(--text-soft, var(--text));
}

.attribution-timeline-item p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.attribution-timeline-item > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.attribution-history-toggle {
  justify-self: start;
  padding: 0;
}

.attribution-move-dialog .field select option:disabled {
  color: var(--muted);
}

.attribution-move-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text-soft, var(--muted));
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.attribution-move-note.is-warning {
  border-color: rgba(194, 65, 12, 0.28);
  background: var(--warning-soft);
  color: var(--warning);
}

:root[data-theme="dark"] .attribution-move-note.is-warning {
  border-color: rgba(251, 146, 60, 0.28);
}

.attribution-move-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 850;
}

.attribution-move-error[hidden] {
  display: none;
}

@media (max-width: 1180px) {
  .detail-attribution-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 这段在文件末尾，要把上面 1180 的两列在手机上再压回一列 */
@media (max-width: 760px) {
  .detail-attribution-grid {
    grid-template-columns: 1fr;
  }

  .detail-attribution-actions {
    width: 100%;
    justify-content: space-between;
  }

  .detail-attribution-body {
    padding: 12px;
  }

  .detail-attribution-reason {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .attribution-timeline-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

/* ==========================================================================
   数据权限：当前操作员提示 / 策略缺失时的空列表 / 详情页的「不存在 · 无权查看」
   ========================================================================== */
.crm-scope-hint {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  max-width: 100%;
  margin: 8px 0 0;
  padding: 5px 10px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft, var(--muted));
  font-size: 12px;
  line-height: 1.4;
  font-weight: 650;
}

.crm-scope-hint[hidden] {
  display: none;
}

body[data-layout-page="crm-accounts"] .crm-heading .crm-scope-hint {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 650;
}

.crm-scope-hint strong,
.crm-scope-hint b {
  color: var(--text-strong, var(--text));
  font-weight: 800;
}

.crm-scope-hint i {
  color: var(--icon-muted, var(--muted));
  font-style: normal;
}

.crm-scope-hint em {
  padding-left: 6px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-style: normal;
  overflow-wrap: anywhere;
}

.crm-scope-hint.is-closed {
  border-color: rgba(220, 38, 38, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.crm-scope-hint.is-closed :is(strong, b, em) {
  color: var(--danger);
}

.crm-scope-empty {
  display: grid;
  gap: 6px;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.crm-scope-empty strong {
  color: var(--text-strong, var(--text));
  font-size: 15px;
  font-weight: 850;
}

.crm-scope-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  font-weight: 600;
}

.crm-scope-empty.is-closed strong {
  color: var(--danger);
}

.crm-detail-shell.is-access-state {
  display: block;
}

.detail-access-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 640px;
  margin: 48px auto;
  padding: 36px 28px;
  text-align: center;
}

.detail-access-state .detail-access-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--blue-soft);
  color: var(--blue);
}

.detail-access-state.is-denied .detail-access-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.detail-access-state .detail-access-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-access-state h1 {
  margin: 4px 0 0;
  color: var(--text-strong, var(--text));
  font-size: 22px;
  line-height: 1.3;
  font-weight: 850;
}

.detail-access-state p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail-access-state .crm-scope-hint {
  margin-top: 2px;
}

.detail-access-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.detail-access-actions a {
  text-decoration: none;
}

@media (max-width: 760px) {
  .crm-scope-hint {
    border-radius: 12px;
  }

  /* 窄屏上数据范围说明自成一行，去掉行首那道分隔线 */
  .crm-scope-hint em {
    flex-basis: 100%;
    padding-left: 0;
    border-left: 0;
  }

  .detail-access-state {
    margin: 16px auto;
    padding: 28px 16px;
  }

  .detail-access-state h1 {
    font-size: 19px;
  }
}
