:root {
  --ds-space-1: .25rem;
  --ds-space-2: .5rem;
  --ds-space-3: .75rem;
  --ds-space-4: 1rem;
  --ds-space-5: 1.25rem;
  --ds-space-6: 1.5rem;
  --ds-text-xs: .72rem;
  --ds-text-sm: .82rem;
  --ds-text-md: .94rem;
  --ds-text-lg: 1.08rem;
  --ds-text-xl: 1.35rem;
  --ds-radius-sm: .45rem;
  --ds-radius-md: .7rem;
  --ds-radius-lg: .95rem;
  --ds-radius-xl: 1.2rem;
  --ds-shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --ds-shadow-sm: 0 8px 20px rgba(15, 23, 42, .07);
  --ds-shadow-md: 0 16px 36px rgba(15, 23, 42, .09);
  --ds-surface-canvas: #f4f7fb;
  --ds-surface-base: #ffffff;
  --ds-surface-muted: #f8fafc;
  --ds-border: #d9e2ec;
  --ds-border-strong: #c6d3df;
  --ds-ink: #172033;
  --ds-ink-muted: #5f6f85;
  --ds-ink-soft: #7b8aa0;
  --ds-primary: #245b89;
  --ds-primary-strong: #17476e;
  --ds-primary-soft: #e7f0f6;
  --ds-accent: #2d8a8a;
  --ds-success: #25775a;
  --ds-warning: #a86613;
  --ds-danger: #b42318;
  --ds-expired: #8f2c1f;
  --ds-suspended: #475569;
  --ds-over-limit: #93370d;
  --admin-bg: var(--ds-surface-canvas);
  --admin-surface: var(--ds-surface-base);
  --admin-ink: var(--ds-ink);
  --admin-muted: var(--ds-ink-muted);
  --admin-primary: var(--ds-primary);
  --admin-sidebar: #102333;
  --admin-sidebar-soft: #17324a;
  --admin-sidebar-width: 232px;
  --bs-primary: var(--ds-primary);
  --bs-primary-rgb: 36, 91, 137;
  --bs-border-color: var(--ds-border);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 15px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--admin-bg);
  color: var(--admin-ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  overflow-x: hidden;
}

.btn-primary {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
}

.admin-shell {
  display: grid;
  grid-template-columns: var(--admin-sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: none;
  overflow-x: hidden;
}

.admin-sidebar {
  background: var(--admin-sidebar);
  color: #fff;
  padding: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #475569 transparent;
  width: var(--admin-sidebar-width);
}

.admin-sidebar::-webkit-scrollbar {
  width: 8px;
}

.admin-sidebar::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 999px;
}

.admin-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--admin-primary);
  color: #fff;
  font-weight: 800;
}

.brand-name {
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-caption {
  color: #94a3b8;
  font-size: .82rem;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  margin-top: 1.5rem;
  padding-bottom: 1rem;
}

.admin-nav a {
  color: #dbeafe;
  text-decoration: none;
  padding: .58rem .75rem;
  border-radius: 10px;
  font-size: .95rem;
}

.admin-nav a:hover {
  background: var(--admin-sidebar-soft);
  color: #fff;
}

.nav-group-label {
  color: #94a3b8;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin: .85rem .75rem .25rem;
  text-transform: uppercase;
}

[data-location-status] {
  grid-column: 1 / -1;
}

.is-loading-location [data-location-status]::before {
  content: "";
  display: inline-block;
  width: .8rem;
  height: .8rem;
  margin-right: .35rem;
  border: 2px solid #cbd5e1;
  border-top-color: var(--admin-primary);
  border-radius: 50%;
  vertical-align: -.12rem;
  animation: location-spin .7s linear infinite;
}

@keyframes location-spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-main {
  width: 100%;
  max-width: none;
  min-width: 0;
  overflow-x: hidden;
}

.admin-topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1.25rem, 2vw, 2rem);
  background: #1d4ed8;
  color: #fff;
}

.admin-topbar > div:first-of-type {
  flex: 1 1 260px;
  min-width: 0;
}

.admin-topbar h1 {
  font-size: 1.35rem;
  margin: 0;
}

.topbar-kicker,
.eyebrow {
  color: #bfdbfe;
  display: block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: flex-end;
  max-width: 100%;
  min-width: 0;
}

.topbar-actions form {
  margin: 0;
}

.profile-pill {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: .45rem .8rem;
}

.sidebar-toggle {
  display: none;
  background: rgba(255, 255, 255, .15);
  border: 0;
  border-radius: 10px;
  padding: .5rem;
}

.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px 0;
  background: #fff;
}

.admin-content {
  padding: clamp(1.25rem, 2vw, 2rem);
  width: 100%;
  max-width: none;
  min-width: 0;
  overflow-x: hidden;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 1rem;
}

.hero-card,
.metric-card,
.section-card {
  background: var(--admin-surface);
  border: 1px solid #dbe3ef;
  border-radius: 22px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
  padding: 1.4rem;
}

.hero-card h2 {
  font-size: 1.8rem;
  letter-spacing: -.04em;
  margin: .35rem 0 .75rem;
}

.hero-card p,
.metric-card p,
.section-heading p,
.empty-state p {
  color: var(--admin-muted);
  margin-bottom: 0;
}

.metric-card strong {
  display: block;
  font-size: 1.65rem;
  margin: .25rem 0;
}

.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
}

.scope-list span,
.endpoint-pill,
.status-pill {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1d4ed8;
  display: inline-flex;
  font-weight: 700;
  padding: .45rem .75rem;
}

.status-pill.status-active {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.status-pill.status-inactive {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #64748b;
}

.license-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: .35rem .65rem;
  text-transform: uppercase;
}

.license-badge.license-active {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.license-badge.license-trial {
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #854d0e;
}

.license-badge.license-grace {
  background: #ffedd5;
  border: 1px solid #fdba74;
  color: #9a3412;
}

.license-badge.license-expired {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.plan-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .05em;
  padding: .35rem .65rem;
  text-transform: uppercase;
}

.plan-badge.plan-basic {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.plan-badge.plan-pro {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
}

.plan-badge.plan-enterprise {
  background: #f3e8ff;
  border: 1px solid #c084fc;
  color: #7e22ce;
}

.plan-badge.plan-trial {
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #854d0e;
}

.plan-badge.plan-default {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.plan-toggle-list {
  display: grid;
  gap: .75rem;
}

.plan-toggle-row {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: flex;
  gap: .75rem;
  padding: .8rem .9rem;
}

.plan-toggle-row span {
  display: flex;
  flex-direction: column;
}

.plan-toggle-row small {
  color: var(--admin-muted);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.license-badge.license-suspended {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.dashboard-metrics {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-card strong {
  display: block;
  font-size: 1.8rem;
  margin-top: .35rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: .35rem 0;
}

.endpoint-pill {
  border-radius: 12px;
  font-family: Consolas, monospace;
  margin-bottom: 1rem;
}

.empty-state {
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  padding: 2rem;
  text-align: center;
}

.admin-table {
  display: grid;
  gap: .75rem;
}

.admin-row {
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  padding: 1rem;
}

.admin-row span {
  color: var(--admin-muted);
  display: block;
}

.company-table-wrap {
  overflow-x: auto;
}

.company-table {
  min-width: 900px;
}

.company-table th {
  color: var(--admin-muted);
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.company-actions {
  align-items: center;
  display: inline-flex;
  gap: .5rem;
}

.company-actions form {
  margin: 0;
}

.clients-console,
.tenant-console {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: none;
  min-width: 0;
  overflow-wrap: anywhere;
}

.clients-hero,
.tenant-filter-panel,
.tenant-grid-card {
  background: var(--admin-surface);
  border: 1px solid #dbe3ef;
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
  padding: 1.25rem;
  width: 100%;
  max-width: none;
  min-width: 0;
  overflow-wrap: anywhere;
}

.clients-hero {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}

.clients-hero > * {
  min-width: 0;
}

.clients-hero > :first-child {
  flex: 1 1 360px;
}

.clients-hero h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -.05em;
  margin: .35rem 0 .5rem;
}

.clients-hero p,
.tenant-stat-card p,
.tenant-grid-toolbar p,
.tenant-muted,
.audit-mini,
.tenant-empty-filter p {
  color: var(--admin-muted);
}

.clients-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: flex-end;
  max-width: 100%;
  min-width: 0;
}

.clients-actions .btn {
  white-space: normal;
}

.tenant-stats,
.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-width: 100%;
  min-width: 0;
}

.tenant-stat-card {
  background: var(--ds-surface-base);
  border: 1px solid #dbe3ef;
  border-radius: 20px;
  min-width: 0;
  padding: 1rem;
}

.tenant-stat-card span,
.tenant-filter-panel label span,
.subscription-cell span {
  color: #64748b;
  display: block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tenant-stat-card strong {
  display: block;
  font-size: 1.45rem;
  letter-spacing: -.04em;
  margin: .3rem 0;
}

.tenant-stat-card.stat-warning {
  border-color: #fed7aa;
}

.tenant-filter-panel {
  display: grid;
  gap: 1rem;
}

.tenant-search {
  min-width: 0;
}

.tenant-search .form-control {
  min-height: 46px;
  width: 100%;
}

.tenant-filters,
.filters-grid {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-width: 100%;
  min-width: 0;
}

.tenant-filters label {
  min-width: 0;
}

.tenant-filters .form-select {
  min-width: 0;
  width: 100%;
}

.tenant-grid-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.tenant-grid-toolbar > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.tenant-grid-toolbar h3 {
  margin: 0 0 .25rem;
}

.tenant-page-size {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
  min-width: 0;
}

.tenant-page-size label {
  color: var(--admin-muted);
  font-weight: 700;
}

.tenant-grid-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.tenant-grid {
  display: grid;
  gap: .65rem;
  grid-template-columns: 1fr;
  width: 100%;
}

.tenant-grid-controls {
  align-items: center;
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: flex-end;
  max-width: 100%;
  min-width: 0;
}

.tenant-sort-actions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
  min-width: 0;
}

.tenant-card {
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .045);
  display: grid;
  gap: .5rem;
  max-width: 100%;
  min-width: 0;
  padding: .6rem;
}

.tenant-card-header {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  justify-content: space-between;
  min-width: 0;
}

.tenant-card-body {
  align-items: start;
  display: grid;
  gap: .45rem;
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr) minmax(260px, 1.2fr) minmax(180px, .8fr);
  min-width: 0;
}

.tenant-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  align-content: start;
  display: grid;
  gap: .3rem;
  min-width: 0;
  padding: .42rem .5rem;
}

.tenant-identity,
.tenant-company-block,
.tenant-status-block,
.tenant-alerts,
.audit-mini {
  display: grid;
  gap: .2rem;
  min-width: 0;
}

.tenant-identity strong {
  font-size: .98rem;
  line-height: 1.2;
}

.tenant-identity .tenant-section-label {
  display: none;
}

.tenant-identity span,
.tenant-identity small,
.tenant-muted {
  display: block;
  font-size: .75rem;
  line-height: 1.25;
}

.tenant-company {
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.2;
}

.tenant-section-label {
  color: #64748b;
  display: block;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .07em;
  line-height: 1.1;
  text-transform: uppercase;
}

.tenant-card .plan-badge {
  font-size: .7rem;
  letter-spacing: .045em;
  line-height: 1;
  padding: .25rem .5rem;
}

.plan-icon {
  align-items: center;
  background: rgba(255, 255, 255, .7);
  border-radius: 999px;
  display: inline-flex;
  height: 1rem;
  justify-content: center;
  margin-right: .25rem;
  width: 1rem;
}

.subscription-plan-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .45rem;
  min-width: 0;
}

.subscription-cell {
  display: grid;
  gap: .2rem .45rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.subscription-cell strong {
  display: block;
  font-size: .78rem;
  line-height: 1.2;
}

.subscription-cell span {
  font-size: .62rem;
  letter-spacing: .06em;
  line-height: 1.1;
}

.expiry-line {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 800;
  padding: .16rem .4rem;
  white-space: nowrap;
  width: fit-content;
}

.expiry-line.expiry-success {
  background: #dcfce7;
  color: #166534;
}

.expiry-line.expiry-warning {
  background: #ffedd5;
  color: #9a3412;
}

.expiry-line.expiry-danger {
  background: #fee2e2;
  color: #991b1b;
}

.expiry-progress {
  background: #e2e8f0;
  border-radius: 999px;
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
}

.expiry-progress-fill {
  display: block;
  height: 100%;
}

.expiry-progress-fill.expiry-success {
  background: #22c55e;
}

.expiry-progress-fill.expiry-warning {
  background: #f97316;
}

.expiry-progress-fill.expiry-danger {
  background: #ef4444;
}

.usage-grid {
  display: grid;
  gap: .25rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.usage-line {
  align-items: start;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  display: grid;
  gap: .08rem;
  min-width: 0;
  padding: .28rem .34rem;
}

.usage-line span {
  color: #64748b;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .05em;
  line-height: 1;
  text-transform: uppercase;
}

.usage-line strong {
  font-size: .72rem;
  line-height: 1.15;
}

.usage-warning {
  background: #fff7ed;
  border-color: #fed7aa;
}

.usage-failure {
  background: #fef2f2;
  border-color: #fecaca;
}

.usage-unknown {
  background: #f8fafc;
}

.health-badges {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: .18rem .22rem;
  min-width: 0;
}

.health-pill {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: .59rem;
  font-weight: 800;
  line-height: 1.05;
  max-width: 100%;
  overflow-wrap: normal;
  padding: .13rem .3rem;
  white-space: nowrap;
  word-break: normal;
}

.health-healthy {
  background: #dcfce7;
  color: #166534;
}

.health-warning {
  background: #ffedd5;
  color: #9a3412;
}

.health-failure {
  background: #fee2e2;
  color: #991b1b;
}

.health-unknown {
  background: #f1f5f9;
  color: #64748b;
}

.tenant-status,
.tenant-alert {
  border-radius: 999px;
  display: inline-flex;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: normal;
  padding: .22rem .45rem;
  white-space: nowrap;
  width: fit-content;
}

.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-trial {
  background: #fef9c3;
  color: #854d0e;
}

.status-suspended,
.status-archived {
  background: #f1f5f9;
  color: #475569;
}

.status-expired {
  background: #fee2e2;
  color: #991b1b;
}

.status-provisioning {
  background: #dbeafe;
  color: #1d4ed8;
}

.tenant-alert {
  font-size: .64rem;
}

.tenant-alert.alert-warning {
  background: #ffedd5;
  color: #9a3412;
}

.tenant-alert.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.audit-mini {
  font-size: .64rem;
  gap: .14rem;
  line-height: 1.18;
}

.tenant-identity {
  flex: 1 1 240px;
}

.tenant-company-block {
  flex: .85 1 190px;
}

.tenant-status-block {
  flex: 0 1 170px;
}

.tenant-actions {
  flex: 0 0 auto;
}

.subscription-block {
  align-self: start;
}

.usage-block {
  align-self: start;
  padding: .38rem .44rem;
}

.health-block {
  align-self: start;
}

.tenant-metadata {
  align-content: center;
  align-self: start;
  min-height: 0;
  padding: .36rem .42rem;
}

.tenant-action-menu form {
  margin: 0;
}

.tenant-actions,
.tenant-action-menu {
  display: inline-flex;
  justify-content: flex-end;
  max-width: 100%;
}

.tenant-actions {
  align-self: start;
  justify-self: end;
  min-width: max-content;
  position: relative;
}

.tenant-action-menu .dropdown-menu {
  max-width: min(18rem, calc(100vw - 2rem));
  overflow-wrap: anywhere;
}

.tenant-empty,
.tenant-empty-filter {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  padding: 2rem;
  text-align: center;
}

.tenant-pagination {
  align-items: center;
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.status-active {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.status-inactive {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #64748b;
}

.company-form {
  margin-top: 1rem;
}

.company-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.company-form-wide {
  grid-column: 1 / -1;
}

.location-form-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.location-field {
  min-width: 0;
}

.location-field-full {
  grid-column: 1 / -1;
}

.location-form-row .form-label {
  color: #334155;
  font-weight: 600;
  margin-bottom: .45rem;
}

.location-form-row .form-select {
  min-height: 44px;
  width: 100%;
}

.searchable-location {
  position: relative;
  width: 100%;
}

.searchable-location-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.searchable-location-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  cursor: pointer;
}

.searchable-location-toggle:disabled,
.searchable-location.is-disabled .searchable-location-toggle {
  cursor: not-allowed;
  opacity: .65;
}

.searchable-location-display.has-value {
  color: inherit;
}

.searchable-location-menu {
  position: absolute;
  top: calc(100% + .25rem);
  left: 0;
  right: 0;
  z-index: 1080;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: .5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  overflow: hidden;
}

.searchable-location-search {
  padding: .5rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.searchable-location-options {
  max-height: 220px;
  overflow-y: auto;
}

.searchable-location-option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: .55rem .75rem;
  color: #0f172a;
  cursor: pointer;
}

.searchable-location-option:hover,
.searchable-location-option.is-active {
  background: #eef2ff;
}

.searchable-location-option.is-selected {
  font-weight: 600;
  color: #1d4ed8;
}

.searchable-location-empty {
  padding: .75rem;
  color: #64748b;
  font-size: .875rem;
}

.form-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
}

.auth-body {
  background: #102333;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1.5rem;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 2rem;
  max-width: 1100px;
  width: 100%;
}

.auth-copy {
  align-self: center;
  color: #fff;
}

.auth-copy h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  letter-spacing: -.06em;
  margin: 2rem 0 1rem;
}

.auth-copy p {
  color: #dbeafe;
  max-width: 560px;
}

.auth-domain-note {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 14px;
  display: inline-flex;
  margin-top: 1rem;
  padding: .75rem 1rem;
}

.login-card {
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
  padding: 2rem;
}

@media (max-width: 1599px) {
  .tenant-stats,
  .stats-grid,
  .tenant-filters,
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tenant-card {
    gap: .55rem;
    padding: .55rem;
  }

  .tenant-card-header {
    gap: .6rem;
  }

  .tenant-card-body {
    gap: .5rem;
    grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr) minmax(260px, 1.2fr) minmax(180px, .8fr);
  }
}

@media (max-width: 1399px) {
  .tenant-stats,
  .stats-grid,
  .tenant-filters,
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-content {
    padding: 1.25rem;
  }

  .clients-hero {
    align-items: stretch;
  }

  .clients-actions {
    flex: 1 1 280px;
  }

  .tenant-grid-wrap {
    overflow: visible;
  }

  .tenant-card-body {
    grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr) minmax(260px, 1.2fr) minmax(180px, .8fr);
  }
}

@media (max-width: 1240px) {
  .tenant-card-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1099px) {
  .tenant-card-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .usage-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    display: none;
    height: auto;
    position: static;
    width: 100%;
  }

  .admin-main {
    width: 100%;
  }

  .admin-shell.sidebar-open .admin-sidebar {
    display: block;
  }

  .sidebar-toggle {
    display: inline-block;
  }

  .dashboard-grid,
  .auth-panel,
  .company-form-grid,
  .location-form-row {
    grid-template-columns: 1fr;
  }

  .clients-hero,
  .tenant-grid-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tenant-grid-controls,
  .tenant-sort-actions,
  .tenant-page-size {
    justify-content: flex-start;
  }

  .clients-actions {
    background: rgba(255, 255, 255, .96);
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    bottom: .75rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
    justify-content: stretch;
    padding: .65rem;
    position: sticky;
    z-index: 10;
  }

  .clients-actions .btn {
    flex: 1 1 auto;
  }

  .tenant-stats,
  .stats-grid,
  .tenant-filters,
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-form-wide {
    grid-column: auto;
  }
}

@media (max-width: 767.98px) {
  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .admin-content {
    padding: .85rem;
  }

  .clients-hero,
  .tenant-filter-panel,
  .tenant-grid-card {
    border-radius: 18px;
    padding: 1rem;
  }

  .tenant-stats,
  .stats-grid,
  .tenant-filters,
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .clients-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .clients-actions .btn-primary {
    grid-column: 1 / -1;
  }

  .tenant-card {
    border-radius: 18px;
    padding: .6rem;
  }

  .tenant-card-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .tenant-company-block,
  .tenant-status-block {
    grid-column: 1 / -1;
  }

  .tenant-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    min-width: max-content;
  }

  .tenant-action-menu {
    justify-content: flex-end;
  }

  .tenant-card-body {
    grid-template-columns: 1fr;
  }

  .usage-grid {
    grid-template-columns: 1fr;
  }

  .usage-line {
    min-width: 0;
    width: 100%;
  }

  .tenant-page-size {
    justify-content: flex-start;
  }

  .tenant-pagination {
    justify-content: center;
  }
}

/* ── Operational Intelligence ─────────────────────────────────────────────── */

.ops-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--admin-surface);
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.ops-header h2 {
  margin: .25rem 0 .35rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.ops-subtitle {
  margin: 0;
  color: var(--admin-muted);
  font-size: .88rem;
  max-width: 52rem;
}

.ops-header-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.ops-live-indicator {
  font-size: .75rem;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  padding: .3rem .65rem;
  border-radius: 999px;
}

.ops-live-indicator::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  margin-right: .4rem;
  animation: ops-pulse 2s infinite;
}

@keyframes ops-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.ops-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .75rem;
}

.ops-metric-card {
  background: var(--admin-surface);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: .85rem 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.ops-metric-card.ops-metric-primary {
  border-color: #c9ddeb;
  background: var(--ds-primary-soft);
}

.ops-metric-label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--admin-muted);
}

.ops-metric-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin: .15rem 0;
  line-height: 1.1;
}

.ops-metric-card p {
  margin: .2rem 0 0;
  font-size: .76rem;
  color: var(--admin-muted);
}

.ops-progress {
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  margin: .35rem 0;
  overflow: hidden;
}

.ops-progress-bar {
  height: 100%;
  background: var(--admin-primary);
  border-radius: 999px;
  transition: width .3s ease;
}

.ops-progress-bar.ops-progress-warn {
  background: #f59e0b;
}

.ops-table-compact {
  font-size: .84rem;
}

.ops-table-compact th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--admin-muted);
  font-weight: 600;
}

.health-badge, .risk-badge, .alert-badge, .license-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.health-healthy { background: #ecfdf5; color: #047857; }
.health-degraded { background: #fffbeb; color: #b45309; }
.health-unhealthy { background: #fef2f2; color: #b91c1c; }
.health-warning { background: #fff7ed; color: #c2410c; }
.health-neutral { background: #f1f5f9; color: #64748b; }

.risk-critical { background: #fef2f2; color: #991b1b; }
.risk-high { background: #fff7ed; color: #c2410c; }
.risk-medium { background: #fffbeb; color: #b45309; }
.risk-low { background: #ecfdf5; color: #047857; }

.alert-critical { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #b45309; }
.alert-info { background: #eff6ff; color: #1d4ed8; }

.license-archived { background: #f1f5f9; color: #475569; }

.health-score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  font-weight: 700;
  font-size: .82rem;
  background: #f1f5f9;
  border-radius: 8px;
  padding: .15rem .4rem;
}

.ops-alert-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.ops-alert-item {
  padding: .75rem .85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fafbfc;
}

.ops-alert-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
}

.ops-alert-item strong {
  display: block;
  font-size: .88rem;
  margin-bottom: .15rem;
}

.ops-alert-tenant {
  display: inline-block;
  margin-top: .35rem;
  font-size: .72rem;
  color: var(--admin-muted);
  background: #f1f5f9;
  padding: .1rem .4rem;
  border-radius: 4px;
}

.audit-action {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem;
  background: #f1f5f9;
  padding: .1rem .35rem;
  border-radius: 4px;
}

/* Enterprise Healthcare SaaS UI System */
.btn-primary {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--ds-primary-strong);
  border-color: var(--ds-primary-strong);
}

.btn,
.form-control,
.form-select {
  border-radius: var(--ds-radius-md);
}

.form-control,
.form-select {
  border-color: var(--ds-border);
  min-height: 2.3rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 .18rem rgba(36, 91, 137, .16);
}

.admin-sidebar {
  padding: .85rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  background: #dcebf3;
  border-radius: 12px;
  color: var(--admin-sidebar);
}

.admin-nav {
  margin-top: 1rem;
}

.admin-nav a {
  border-radius: var(--ds-radius-md);
  font-size: var(--ds-text-sm);
  padding: .46rem .62rem;
}

.admin-topbar {
  min-height: 58px;
  padding: .75rem clamp(1rem, 2vw, 1.5rem);
  background: var(--ds-surface-base);
  border-bottom: 1px solid var(--ds-border);
  color: var(--ds-ink);
}

.topbar-kicker,
.eyebrow {
  color: var(--ds-ink-soft);
}

.profile-pill,
.sidebar-toggle {
  background: var(--ds-surface-muted);
  border: 1px solid var(--ds-border);
  color: var(--ds-ink);
}

.sidebar-toggle span {
  background: var(--ds-ink);
}

.admin-content {
  padding: clamp(1rem, 1.6vw, 1.5rem);
}

.hero-card,
.metric-card,
.section-card,
.clients-hero,
.tenant-filter-panel,
.tenant-grid-card,
.ops-header,
.ops-metric-card {
  background: var(--ds-surface-base);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-xs);
  padding: var(--ds-space-4);
}

.ops-header {
  align-items: center;
}

.dashboard-grid,
.dashboard-metrics,
.tenant-stats,
.stats-grid,
.ops-metrics-grid {
  gap: var(--ds-space-3);
}

.tenant-stat-card {
  border: 1px solid var(--ds-border);
  border-left: 4px solid var(--ds-primary);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-xs);
  padding: var(--ds-space-4);
}

.tenant-stat-card.stat-warning {
  border-left-color: var(--ds-warning);
}

.tenant-stat-card strong,
.ops-metric-value,
.metric-card strong {
  color: var(--ds-ink);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.1;
}

.tenant-card {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-shadow-xs);
  padding: .55rem;
}

.tenant-section,
.usage-line,
.license-detail-tile {
  background: var(--ds-surface-muted);
  border-color: var(--ds-border);
}

.section-heading {
  align-items: flex-start;
  margin-bottom: var(--ds-space-3);
}

.company-table th,
.ops-table-compact th {
  color: var(--ds-ink-soft);
  font-size: var(--ds-text-xs);
  font-weight: 800;
}

.company-table td,
.company-table th,
.ops-table-compact td,
.ops-table-compact th {
  padding-bottom: .5rem;
  padding-top: .5rem;
}

.empty-state,
.tenant-empty,
.tenant-empty-filter {
  background: var(--ds-surface-muted);
  border-color: var(--ds-border-strong);
  border-radius: var(--ds-radius-lg);
  color: var(--ds-ink-muted);
  padding: var(--ds-space-6);
}

.scope-list span,
.endpoint-pill,
.status-pill,
.ops-alert-tenant,
.health-score-pill {
  background: var(--ds-primary-soft);
  border-color: #c9ddeb;
  color: var(--ds-primary);
}

.license-badge,
.plan-badge,
.health-badge,
.risk-badge,
.alert-badge,
.tenant-status,
.tenant-alert,
.health-pill,
.expiry-line {
  border-radius: 999px;
  font-weight: 800;
}

.license-active,
.health-healthy,
.risk-low,
.status-active,
.expiry-success {
  background: #e5f4ec;
  color: var(--ds-success);
}

.license-trial,
.status-provisioning,
.alert-info {
  background: var(--ds-primary-soft);
  color: var(--ds-primary);
}

.license-grace,
.health-degraded,
.health-warning,
.risk-medium,
.alert-warning,
.status-trial,
.expiry-warning,
.usage-warning {
  background: #fff4df;
  color: var(--ds-warning);
}

.license-expired,
.health-unhealthy,
.risk-critical,
.alert-critical,
.status-expired,
.expiry-danger,
.usage-failure {
  background: #fdecea;
  color: var(--ds-danger);
}

.license-suspended,
.license-archived,
.health-neutral,
.status-suspended,
.status-archived,
.usage-unknown {
  background: #eef2f6;
  color: var(--ds-suspended);
}

.plan-pro,
.plan-enterprise {
  background: var(--ds-primary-soft);
  border-color: #c9ddeb;
  color: var(--ds-primary);
}

.plan-basic,
.plan-default {
  background: var(--ds-surface-muted);
  border-color: var(--ds-border);
  color: var(--ds-ink-muted);
}

.ops-live-indicator {
  background: #e5f4ec;
  color: var(--ds-success);
}

.ops-live-indicator::before {
  background: var(--ds-success);
}

.ops-progress-bar {
  background: var(--ds-primary);
}

.ops-progress-bar.ops-progress-warn {
  background: var(--ds-warning);
}

.ops-alert-item {
  background: var(--ds-surface-muted);
  border-color: var(--ds-border);
}

/* Final production polish for the Operational Intelligence dashboard */
body {
  background:
    radial-gradient(circle at top left, rgba(36, 91, 137, .08), transparent 28rem),
    linear-gradient(180deg, #eef4f9 0%, #f6f9fc 42%, #f8fafc 100%);
  color: #111827;
  text-rendering: optimizeLegibility;
}

.admin-content {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 16rem);
}

.admin-content > .ops-header,
.admin-content > .ops-metrics-grid,
.admin-content > .ops-header ~ .row {
  max-width: 1680px;
  margin-left: auto;
  margin-right: auto;
}

.ops-header {
  position: relative;
  overflow: hidden;
  border: 1px solid #cbd8e6;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(247, 251, 253, .96)),
    var(--ds-surface-base);
  box-shadow: 0 16px 42px rgba(15, 23, 42, .085), 0 1px 0 rgba(255, 255, 255, .82) inset;
  padding: clamp(1.15rem, 2vw, 1.55rem) clamp(1.2rem, 2vw, 1.7rem);
}

.ops-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, #17476e, #2d8a8a, rgba(45, 138, 138, 0));
  opacity: .72;
}

.ops-header h2 {
  color: #0f2537;
  font-size: clamp(1.55rem, 2.2vw, 2.05rem);
  font-weight: 850;
  letter-spacing: -.045em;
  line-height: 1.08;
}

.ops-subtitle {
  color: #53657a;
  font-size: .95rem;
  line-height: 1.55;
}

.eyebrow {
  color: #49627a;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .105em;
}

.ops-live-indicator {
  border: 1px solid #b9e4d2;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .86) inset;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  padding: .38rem .72rem;
  white-space: nowrap;
}

.ops-metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .9rem;
}

.ops-metric-card {
  position: relative;
  min-height: 128px;
  overflow: hidden;
  border: 1px solid #d0dbe7;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .06), 0 1px 0 rgba(255, 255, 255, .9) inset;
  padding: 1rem 1.05rem .95rem;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.ops-metric-card::before {
  content: "";
  position: absolute;
  top: .95rem;
  right: 1rem;
  width: .48rem;
  height: .48rem;
  border-radius: 999px;
  background: #b9c8d7;
  box-shadow: 0 0 0 4px rgba(185, 200, 215, .18);
}

.ops-metric-card:hover {
  transform: translateY(-1px);
  border-color: #b9c9d9;
  box-shadow: 0 18px 38px rgba(15, 23, 42, .085), 0 1px 0 rgba(255, 255, 255, .92) inset;
}

.ops-metric-card.ops-metric-primary {
  border-color: #abc9df;
  background:
    linear-gradient(180deg, #f2f8fc 0%, #ffffff 100%);
}

.ops-metric-card.ops-metric-primary::before {
  background: var(--ds-accent);
  box-shadow: 0 0 0 4px rgba(45, 138, 138, .16);
}

.ops-metric-label {
  color: #52677d;
  font-size: .69rem;
  font-weight: 850;
  letter-spacing: .085em;
}

.ops-metric-value {
  color: #102333;
  font-size: clamp(1.85rem, 2.7vw, 2.35rem);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: .98;
  margin: .38rem 0 .28rem;
  font-variant-numeric: tabular-nums;
}

.ops-metric-card p {
  color: #607086;
  font-size: .78rem;
  font-weight: 650;
  line-height: 1.35;
}

.ops-progress {
  height: 6px;
  background: #e5edf4;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .08);
}

.ops-progress-bar {
  background: #245b89;
}

.ops-progress-bar.ops-progress-warn {
  background: #b7791f;
}

.section-card {
  border: 1px solid #ced9e5;
  border-radius: 20px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .065), 0 1px 0 rgba(255, 255, 255, .88) inset;
  padding: 1.15rem;
}

.section-card:hover {
  border-color: #bdcad8;
}

.section-heading {
  align-items: center;
  border-bottom: 1px solid #e4ebf2;
  margin: -.1rem 0 1rem;
  padding-bottom: .78rem;
}

.section-heading h3,
.section-heading h2 {
  color: #14283a;
  font-size: 1.02rem;
  font-weight: 850;
  letter-spacing: -.025em;
  margin: .22rem 0 0;
}

.company-table-wrap {
  border: 1px solid #e1e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .82);
}

.company-table {
  margin-bottom: 0;
}

.company-table th,
.ops-table-compact th {
  background: #f5f8fb;
  border-bottom-color: #dbe5ee;
  color: #596b80;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .085em;
  white-space: nowrap;
}

.company-table td,
.ops-table-compact td {
  border-color: #edf2f7;
  color: #25364a;
  font-size: .84rem;
  padding: .72rem .75rem;
  vertical-align: middle;
}

.company-table tbody tr {
  transition: background-color .14s ease;
}

.company-table tbody tr:hover {
  background: #f8fbfd;
}

.company-table td strong,
.ops-alert-item strong {
  color: #16293d;
  font-weight: 800;
  letter-spacing: -.01em;
}

.health-score-pill {
  min-width: 2.35rem;
  border: 1px solid #cbd8e6;
  border-radius: 10px;
  background: #f3f7fb;
  color: #17476e;
  font-weight: 850;
}

.health-badge,
.risk-badge,
.alert-badge,
.license-badge {
  border: 1px solid currentColor;
  border-color: rgba(15, 23, 42, .12);
  font-size: .66rem;
  font-weight: 850;
  letter-spacing: .055em;
  padding: .22rem .55rem;
}

.ops-alert-list {
  gap: .75rem;
}

.ops-alert-item {
  border: 1px solid #dce6ef;
  border-left: 3px solid #245b89;
  border-radius: 15px;
  background: #fbfdff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .045);
  padding: .85rem .95rem;
}

.ops-alert-head {
  gap: .65rem;
}

.ops-alert-item p {
  line-height: 1.45;
}

.ops-alert-tenant {
  border: 1px solid #d5e2ee;
  border-radius: 999px;
  color: #53677f;
  font-weight: 750;
  padding: .18rem .52rem;
}

.empty-state,
.tenant-empty,
.tenant-empty-filter {
  position: relative;
  border: 1px dashed #b8c7d6;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(246, 249, 252, .94));
  color: #5f7187;
  min-height: 132px;
  padding: 2.35rem 1.25rem 1.45rem;
}

.empty-state::before,
.tenant-empty::before,
.tenant-empty-filter::before {
  content: "";
  display: block;
  width: 34px;
  height: 34px;
  margin: 0 auto .75rem;
  border: 1px solid #cbd8e6;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #ffffff, #edf5f8);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.empty-state p,
.tenant-empty p,
.tenant-empty-filter p {
  color: #5f7187;
  font-size: .88rem;
  font-weight: 650;
}

.btn {
  border-radius: 10px;
  font-size: .84rem;
  font-weight: 750;
  letter-spacing: -.005em;
  padding: .42rem .72rem;
  box-shadow: none;
}

.btn-sm {
  border-radius: 9px;
  font-size: .78rem;
  padding: .32rem .58rem;
}

.btn-primary {
  background: #245b89;
  border-color: #245b89;
  box-shadow: 0 8px 18px rgba(36, 91, 137, .16);
}

.btn-primary:hover,
.btn-primary:focus {
  background: #17476e;
  border-color: #17476e;
  box-shadow: 0 10px 22px rgba(23, 71, 110, .2);
}

.btn-outline-light {
  border-color: #cbd8e6;
  color: #1f3448;
}

.btn-outline-light:hover,
.btn-outline-light:focus {
  background: #eef5f9;
  border-color: #b8c7d6;
  color: #102333;
}

.form-control,
.form-select {
  border-color: #cbd8e6;
  color: #1f3448;
  font-size: .88rem;
}

@media (min-width: 1600px) {
  .ops-metrics-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1399px) {
  .ops-metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
    gap: .78rem;
  }

  .ops-metric-card {
    min-height: 118px;
    padding: .9rem;
  }

  .ops-metric-value {
    font-size: clamp(1.6rem, 2.35vw, 2rem);
  }
}

@media (max-width: 1024px) {
  .ops-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-card {
    border-radius: 18px;
  }
}

@media (max-width: 767.98px) {
  .ops-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-metric-card {
    min-height: 112px;
  }

  .ops-metric-value {
    font-size: 1.55rem;
  }

  .section-heading {
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .ops-metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Delete Tenant Data modal ─────────────────────────────────────────────── */

.purge-modal .modal-dialog {
  max-width: 640px;
}

.purge-modal-content {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-md);
  overflow: hidden;
}

.purge-modal-hero {
  align-items: flex-start;
  background:
    linear-gradient(135deg, rgba(180, 35, 24, .08), rgba(180, 35, 24, .02) 42%, #fff 70%),
    var(--ds-surface-base);
  border-bottom: 1px solid var(--ds-border);
  display: grid;
  gap: .9rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 1.15rem 1.2rem 1rem;
}

.purge-modal-hero-icon {
  align-items: center;
  background: #fef3f2;
  border: 1px solid #f9d4d0;
  border-radius: .85rem;
  color: var(--ds-danger);
  display: inline-flex;
  flex: 0 0 auto;
  height: 2.5rem;
  justify-content: center;
  width: 2.5rem;
}

.purge-modal-kicker {
  color: var(--ds-danger);
  font-size: var(--ds-text-xs);
  font-weight: 800;
  letter-spacing: .08em;
  margin: 0 0 .2rem;
  text-transform: uppercase;
}

.purge-modal-hero .modal-title {
  color: var(--ds-ink);
  font-size: 1.2rem;
  font-weight: 750;
  margin: 0;
}

.purge-modal-lead {
  color: var(--ds-ink-muted);
  font-size: var(--ds-text-sm);
  line-height: 1.45;
  margin: .45rem 0 0;
}

.purge-modal-lead strong {
  color: var(--ds-ink);
}

.purge-modal-close {
  margin: .15rem .1rem 0 0;
}

.purge-modal-body {
  background: var(--ds-surface-muted);
  display: grid;
  gap: 1rem;
  padding: 1.1rem 1.2rem 1.15rem;
}

.purge-tenant-chip {
  align-items: center;
  background: var(--ds-surface-base);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .7rem;
  padding: .7rem .85rem;
}

.purge-tenant-chip-label {
  color: var(--ds-ink-soft);
  font-size: var(--ds-text-xs);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  width: 100%;
}

.purge-tenant-chip strong {
  color: var(--ds-ink);
  font-size: var(--ds-text-md);
  font-weight: 700;
}

.purge-code-pill {
  background: #f1f5f9;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  color: #334155;
  font-size: .72rem;
  font-weight: 650;
  padding: .22rem .55rem;
}

.purge-scope-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.purge-scope-card {
  background: var(--ds-surface-base);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  cursor: pointer;
  display: grid;
  gap: .35rem;
  padding: .85rem .9rem 1rem;
  position: relative;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.purge-scope-card.is-required {
  cursor: default;
}

.purge-scope-card.is-selected {
  background: #fff8f7;
  border-color: #f0b4ad;
  box-shadow: inset 0 0 0 1px rgba(180, 35, 24, .08);
}

.purge-scope-card:not(.is-required):hover {
  border-color: #c9d6e3;
}

.purge-scope-badge {
  color: var(--ds-danger);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.purge-scope-badge.optional {
  color: var(--ds-ink-soft);
}

.purge-scope-title {
  color: var(--ds-ink);
  font-size: var(--ds-text-md);
  font-weight: 720;
}

.purge-scope-desc {
  color: var(--ds-ink-muted);
  font-size: var(--ds-text-sm);
  line-height: 1.4;
}

.purge-scope-toggle {
  background: #e8eef4;
  border-radius: 999px;
  height: .95rem;
  justify-self: end;
  margin-top: .25rem;
  position: relative;
  width: 1.7rem;
}

.purge-scope-toggle::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--ds-shadow-xs);
  content: "";
  height: .72rem;
  left: .12rem;
  position: absolute;
  top: .115rem;
  transition: transform .15s ease, background .15s ease;
  width: .72rem;
}

.purge-scope-card.is-selected .purge-scope-toggle {
  background: var(--ds-danger);
}

.purge-scope-card.is-selected .purge-scope-toggle::after {
  transform: translateX(.72rem);
}

.purge-preserve-note {
  background: #eef6f2;
  border: 1px solid #cfe5d9;
  border-radius: var(--ds-radius-md);
  color: #2f5d49;
  font-size: var(--ds-text-sm);
  line-height: 1.4;
  padding: .7rem .85rem;
}

.purge-preserve-note strong {
  display: block;
  font-size: .68rem;
  letter-spacing: .07em;
  margin-bottom: .15rem;
  text-transform: uppercase;
}

.purge-confirm-block {
  background: var(--ds-surface-base);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  display: grid;
  gap: .45rem;
  padding: .85rem .9rem;
}

.purge-confirm-label {
  align-items: center;
  color: var(--ds-ink);
  display: flex;
  flex-wrap: wrap;
  font-size: var(--ds-text-sm);
  font-weight: 650;
  gap: .35rem .4rem;
  margin: 0;
}

.purge-confirm-code-group {
  align-items: center;
  display: inline-flex;
  gap: .35rem;
  max-width: 100%;
}

.purge-confirm-label code {
  background: #fef3f2;
  border: 1px solid #f9d4d0;
  border-radius: .35rem;
  color: var(--ds-danger);
  font-size: .78rem;
  max-width: min(100%, 28rem);
  overflow: hidden;
  padding: .08rem .3rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purge-copy-btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--ds-border-strong);
  border-radius: .4rem;
  color: var(--ds-primary-strong);
  cursor: pointer;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 700;
  gap: .28rem;
  line-height: 1;
  padding: .28rem .45rem;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.purge-copy-btn:hover,
.purge-copy-btn:focus-visible {
  background: var(--ds-primary-soft);
  border-color: #9bb6cb;
  color: var(--ds-primary-strong);
  outline: none;
}

.purge-copy-btn.is-copied {
  background: #eef6f2;
  border-color: #b6d7c6;
  color: var(--ds-success);
}

.purge-confirm-input {
  border-radius: var(--ds-radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .86rem;
  letter-spacing: .01em;
}

.purge-confirm-input.is-valid-match {
  background: #f3faf6;
  border-color: #86c5a8;
}

.purge-confirm-input.is-invalid-match {
  background: #fff7f6;
  border-color: #f0b4ad;
}

.purge-confirm-hint {
  color: var(--ds-danger);
  font-size: var(--ds-text-xs);
  font-weight: 650;
  margin: 0;
}

.purge-modal-footer {
  background: var(--ds-surface-base);
  border-top: 1px solid var(--ds-border);
  gap: .55rem;
  padding: .85rem 1.2rem 1rem;
}

.purge-submit-btn {
  background: var(--ds-danger);
  border-color: var(--ds-danger);
  color: #fff;
  font-weight: 650;
  min-width: 10.5rem;
}

.purge-submit-btn:hover:not(:disabled),
.purge-submit-btn:focus-visible:not(:disabled) {
  background: #911c13;
  border-color: #911c13;
  color: #fff;
}

.purge-submit-btn:disabled {
  background: #d7b0ab;
  border-color: #d7b0ab;
  color: #fff;
  opacity: 1;
}

@media (max-width: 767.98px) {
  .purge-modal-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .purge-modal-close {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .purge-scope-grid {
    grid-template-columns: 1fr;
  }
}