/* ── Admin Views: Super Admin Matrix, Quotas, User Management & Tables ── */

/* ── Admin & Tables ──────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 10px;
}
th, td {
  text-align: start;
  padding: 14px 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--line-soft);
}
th {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  background: var(--tb-subtle);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
tr:last-child td { border-bottom: none; }
.badge {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--ok-bg);
  color: var(--ok-fg);
  font-family: var(--mono);
  font-weight: 500;
}
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.off { background: var(--tb-sunk); color: var(--text-3); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--line-strong);
  transition: .2s;
  border-radius: 22px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--brand-primary); }
input:checked + .slider:before { transform: translateX(16px); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 17, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  max-width: 480px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border: 1px solid var(--line);
}
.modal h3 { margin: 0 0 16px; font-size: 19px; }

/* ── Super Admin Tenant Control & Wizard Styles ────────────────────────── */
.modal-wizard {
  max-width: 820px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.wizard-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--tb-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.wizard-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}
.wizard-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: var(--tb-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Wizard Step Navigation */
.wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 12px;
  overflow-x: auto;
}
.wizard-step-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.wizard-step-btn:hover {
  background: var(--line-soft);
  color: var(--text-1);
}
.wizard-step-btn.active {
  background: var(--tb-brand-wash);
  color: var(--brand-text);
  border-color: rgba(114, 37, 61, 0.25);
}
.wizard-step-btn.done {
  color: var(--ok-fg);
}
.wizard-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--line);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.wizard-step-btn.active .wizard-step-num {
  background: var(--brand-primary);
  color: #fff;
}
.wizard-step-btn.done .wizard-step-num {
  background: var(--ok-fg);
  color: var(--tb-on-fill);
}

/* Preset Chips */
.preset-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}
.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--tb-subtle);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-chip:hover {
  background: var(--tb-sunk);
  color: var(--text-1);
  border-color: var(--text-3);
}
.preset-chip.active {
  background: var(--tb-brand-wash);
  border-color: var(--brand-primary);
  color: var(--brand-text);
  font-weight: 600;
}

/* Live Brand Preview Card */
.brand-preview-card {
  border-radius: 14px;
  padding: 16px 20px;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}
.brand-preview-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
}

/* Color Picker Row */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.color-input-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
}
.color-input-badge::-webkit-color-swatch-wrapper { padding: 0; }
.color-input-badge::-webkit-color-swatch { border: none; border-radius: 7px; }

/* Grid 2 Column form fields */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* Segmented selector */
.seg-select {
  display: flex;
  background: var(--tb-sunk);
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
  margin-bottom: 16px;
}
.seg-select-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.seg-select-btn.active {
  background: var(--surface);
  color: var(--text-1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Provisioning Progress Log */
.provision-log {
  background: #2A0B16;
  color: #F9FAFB;
  border-radius: 12px;
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  max-height: 260px;
  overflow-y: auto;
  line-height: 1.8;
  margin: 16px 0;
}
.provision-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.provision-step-item.pending { color: #9CA3AF; }
.provision-step-item.running { color: var(--tb-spice); }
.provision-step-item.done { color: #34D399; }
.provision-step-item.error { color: #F87171; }

/* Tenant Search & Filter Toolbar */
.tenant-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 18px 0 12px;
  flex-wrap: wrap;
}
.tenant-search-box {
  position: relative;
  max-width: 320px;
  width: 100%;
}
.tenant-search-box input {
  width: 100%;
  padding-left: 34px;
}
.tenant-search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

/* Connection Health Dot */
.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.health-dot.ok { background: #10B981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
.health-dot.err { background: #EF4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }
.health-dot.unknown { background: #9CA3AF; }

/* Credentials Success Box */
.creds-box {
  background: var(--tb-subtle);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 14px 0;
}
.creds-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0;
  font-size: 13px;
}

/* ── Custom Asset Upload Cards & Dropzones ───────────────────────────────── */
.upload-card {
  background: var(--tb-subtle);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.upload-card:hover {
  border-color: rgba(114, 37, 61, 0.4);
}
.upload-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.18s ease;
}
.dropzone:hover {
  border-color: var(--brand-primary);
  background: var(--tb-brand-wash);
}
.dropzone.dragover {
  border-color: var(--brand-primary);
  background: var(--tb-brand-wash);
  transform: scale(0.99);
}
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}
.dropzone-inner svg {
  color: var(--brand-text);
  opacity: 0.8;
}
.file-info-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ok-bg);
  border: 1px solid color-mix(in srgb, var(--ok-fg) 30%, transparent);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 12.5px;
}
.file-info-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.file-info-name {
  font-weight: 600;
  color: var(--ok-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.file-info-size {
  font-size: 11px;
  color: var(--ok-fg);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 99px;
  font-family: var(--mono);
}
.btn-remove-file {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-remove-file:hover {
  background: var(--danger-bg);
}

/* Details Modal Asset List Rows */
.asset-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}
.asset-row:last-child {
  border-bottom: none;
}

