:root {
  --dist-primary: #5d3d68;
  --dist-primary-hover: #4a3154;
  --dist-primary-muted: #a799b7;
  --dist-primary-soft: rgba(93, 61, 104, 0.08);
  --dist-radius-lg: 10px;
  --dist-radius-rounded-5: 0.5rem;
  --dist-radius-pill: 999px;
}

.dist-theme-prosperity {
  --dist-primary: #5d3d68;
  --dist-primary-hover: #4a3154;
  --dist-primary-muted: #a799b7;
  --dist-primary-soft: rgba(93, 61, 104, 0.08);
  --dist-radius-lg: 10px;
  --dist-radius-rounded-5: 0.5rem;
  --dist-radius-pill: 999px;
}

.dist-theme-gradingly {
  --dist-primary: #2B85F0;
  --dist-primary-hover: #1976D2;
  --dist-primary-muted: #90C2FF;
  --dist-primary-soft: rgba(25, 118, 210, 0.08);
  --dist-radius-lg: 12px;
  --dist-radius-rounded-5: 0.5rem;
  --dist-radius-pill: 999px;
}

.dist-rounded-5 {
  border-radius: var(--dist-radius-rounded-5, 0.5rem) !important;
}

.dist-dashboard {
  --dist-chrome-offset: 3.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #111827;
  background: #fff;
  box-sizing: border-box;
  height: calc(100vh - var(--dist-chrome-offset));
  max-height: calc(100vh - var(--dist-chrome-offset));
  min-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dist-dash-split {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.dist-dash-left {
  width: 55%;
  min-width: 420px;
  border-right: none;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
  min-height: 0;
  align-self: stretch;
}

.dist-dash-divider {
  flex: 0 0 1px;
  width: 1px;
  align-self: stretch;
  background: #e5e7eb;
}

.dist-dash-right {
  width: 45%;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
  min-height: 0;
  align-self: stretch;
}

.dist-detail-mount {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dist-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.dist-search-wrap {
  position: relative;
  width: 200px;
  max-width: 100%;
}

.dist-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: 0.45;
  pointer-events: none;
}

.dist-search-input {
  width: 100%;
  height: 36px;
  padding-left: 2.25rem;
  padding-right: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: var(--dist-radius-rounded-5);
  font-size: 0.875rem;
  background: #fff;
}

.dist-filter-group {
  display: inline-flex;
  background: #f3f4f6;
  padding: 3px;
  border-radius: var(--dist-radius-rounded-5);
  gap: 2px;
}

.dist-filter-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
  border-radius: calc(var(--dist-radius-rounded-5) * 0.65);
  cursor: pointer;
}

.dist-filter-btn:hover {
  color: #374151;
}

.dist-filter-btn.is-active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dist-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 36px;
  padding: 0 1rem;
  background: var(--dist-primary);
  color: #fff !important;
  border: none;
  border-radius: var(--dist-radius-rounded-5);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}

.dist-btn-primary:hover {
  background: var(--dist-primary-hover);
  color: #fff;
}

.dist-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.dist-school-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dist-school-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  white-space: nowrap;
  box-shadow: 0 1px 0 #e5e7eb;
}

.dist-th-sort {
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

.dist-th-sort-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dist-th-sort-label {
  pointer-events: none;
}

.dist-sort-icons {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-top: 1px;
  color: #4b5563;
  pointer-events: none;
}

.dist-sort-icons .dist-sort-chevron {
  font-size: 0.58rem;
  line-height: 0.65;
  height: 0.65em;
  display: block;
}

.dist-th-actions {
  pointer-events: none;
}

.dist-school-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
}

.dist-school-table tbody tr:hover {
  background: #fafafa;
}

.dist-school-table tbody tr.is-selected {
  background: var(--dist-primary-soft);
  box-shadow: inset 3px 0 0 var(--dist-primary);
}

.dist-school-table td {
  padding: 0.65rem 1rem;
  vertical-align: middle;
}

.dist-school-name {
  font-weight: 600;
  color: #111827;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dist-school-admin {
  font-size: 0.75rem;
  color: #9ca3af;
}

.dist-usage-bar {
  width: 96px;
  height: 6px;
  background: #e5e7eb;
  border-radius: var(--dist-radius-pill);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
}

.dist-usage-fill {
  display: block;
  height: 100%;
  max-width: 100%;
  background: var(--dist-primary, #5d3d68);
  border-radius: var(--dist-radius-pill);
}

.dist-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--dist-radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.dist-pill-invited {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #e5e7eb;
}

.dist-pill-trial {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.dist-pill-paid {
  background: #ecfdf5;
  color: #15803d;
  border-color: #bbf7d0;
}

.dist-pill-expired {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.dist-pill-dp {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

.dist-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--dist-radius-rounded-5);
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
}

.dist-icon-btn:hover {
  background: #f3f4f6;
  color: var(--dist-primary);
}

.dist-icon-reinvite {
  color: #64748b;
}

.dist-icon-reinvite:hover:not(.is-disabled) {
  color: var(--dist-primary);
  background: var(--dist-primary-soft);
}

.dist-icon-reinvite.is-disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.dist-icon-btn.dist-row-delete {
  color: #fca5a5;
}

.dist-icon-btn.dist-row-delete:hover {
  background: #fef2f2;
  color: #f87171;
}

.dist-icon-btn.danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

.dist-row-actions {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
}

/* Detail panel */
.dist-detail {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.dist-detail-head {
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.dist-detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dist-detail-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.25rem;
}

.dist-detail-sub {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.dist-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 1.5rem;
  gap: 0.25rem;
  flex-shrink: 0;
}

.dist-tab {
  border: none;
  background: none;
  padding: 0.75rem 0.65rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.dist-tab:hover {
  color: #374151;
}

.dist-tab.is-active {
  color: var(--dist-primary);
  border-bottom-color: var(--dist-primary);
}

.dist-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  font-size: 0.6875rem;
  border-radius: var(--dist-radius-rounded-5);
  background: #f3f4f6;
  color: #6b7280;
}

.dist-tab.is-active .dist-tab-badge {
  background: var(--dist-primary-soft);
  color: var(--dist-primary);
}

.dist-detail-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.dist-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin: 1.25rem 1.5rem 0.75rem;
}

.dist-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem 1rem;
  padding: 0 1.5rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

@media (max-width: 1100px) {
  .dist-overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dist-field-label {
  font-size: 0.75rem;
  color: #9ca3af;
}

.dist-field-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.dist-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0 1.5rem 1.25rem;
}

.dist-quick-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--dist-radius-rounded-5);
  background: #fff;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  text-align: left;
}

.dist-quick-card:hover {
  border-color: rgba(93, 61, 104, 0.25);
  background: var(--dist-primary-soft);
}

.dist-tab-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  flex-shrink: 0;
  background: #fff;
}

.dist-tab-panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.dist-codes-subnav {
  flex-shrink: 0;
  background: #fff;
}

.dist-tab-panel-head-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.dist-inner-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.80rem;
}

.dist-inner-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  padding: 0.5rem 0.65rem;
  font-size: 0.80rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  box-shadow: 0 1px 0 #e5e7eb;
}

.dist-inner-table tbody td {
  padding: 0.65rem 0.65rem;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.dist-inner-table tbody tr:hover {
  background: #fafafa;
}

.dist-text-danger {
  color: #dc2626 !important;
  font-weight: 600;
}

.dist-bundle-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  opacity: 0;
}

.dist-inner-table tr:hover .dist-bundle-actions {
  opacity: 1;
}

.dist-empty-illustration {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: #6b7280;
}

.dist-detail-body > .dist-empty-illustration {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 8rem;
}

.dist-empty-title {
  font-weight: 600;
  margin-top: 0.75rem;
  color: #374151;
}

.dist-empty-sub {
  font-size: 0.875rem;
  margin: 0.35rem 0 1rem;
  color: #9ca3af;
}

.dist-codes-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: none;
  background: none;
  color: var(--dist-primary);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.25rem 0;
}

.dist-code-row-link {
  cursor: pointer;
}

.dist-badge-claimed {
  background: #ecfdf5;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: var(--dist-radius-rounded-5);
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.dist-badge-unclaimed {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  border-radius: var(--dist-radius-rounded-5);
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
}

.dist-btn-report {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--dist-radius-rounded-5);
  background: #16a34a;
  color: #fff !important;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.dist-btn-report:hover {
  background: #15803d;
  color: #fff;
}

.dist-placeholder-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.dist-modal-shell .modal-content {
  border: none;
  border-radius: var(--dist-radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.dist-modal-header {
  background: var(--dist-primary, #5d3d68);
  color: #fff;
  padding: 1.1rem 1.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dist-modal-header-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
}

.dist-modal-header-sub {
  font-size: 0.875rem;
  margin: 0.25rem 0 0;
  opacity: 0.85;
  color: #fff;
}

.dist-modal-header .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.dist-modal-header .close {
  font-size: 1.6rem;
  font-weight: 300;
  line-height: 1;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
}

.dist-modal-body {
  background: #fff;
  padding: 1.25rem 1.25rem 0.5rem;
  max-height: min(70vh, 560px);
  overflow-y: auto;
}

.dist-modal-footer {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  padding: 1rem 1.25rem;
  gap: 0.75rem;
}

.dist-modal-footer:not(.row) {
  display: flex;
  justify-content: flex-end;
}

.dist-modal-footer.row {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
  justify-content: flex-start;
}

.dist-modal-footer.row > [class*="col-"] {
  box-sizing: border-box;
}

.dist-modal-footer .btn-outline-secondary {
  border-color: #d1d5db;
  color: #374151;
  border-radius: var(--dist-radius-rounded-5, 0.5rem);
}

.dist-modal-footer .btn {
  font-weight: 600;
  padding: 0.55rem 1rem;
}

.dist-btn-confirm-muted {
  background: var(--dist-primary, #5d3d68) !important;
  border: none;
  color: #fff !important;
}

.dist-btn-confirm-muted:hover {
  filter: brightness(0.95);
  color: #fff;
}
