/* ═══════════════════════════════════════════════════
   Company Detail — Two-Pane Layout
   ═══════════════════════════════════════════════════ */

/* Page container */
.company-detail-page {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  gap: 16px;
}

/* ── Left pane (1/4 width) ── */
.company-detail-left {
  display: flex;
  flex-direction: column;
  flex: 0 0 25%;
  min-height: 0;
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: var(--header-shadow);
  overflow: hidden;
}

/* ── Right pane (3/4 width) ── */
.company-detail-right {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: var(--header-shadow);
  overflow: hidden;
}

/* ── Pane header (reusable for both panes) ── */
.detail-pane-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.detail-pane-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Back button ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.back-btn:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  border-color: var(--input-focus-border);
}

/* ═══════════════════════════════════════════════════
   Right Pane — Tab Bar
   ═══════════════════════════════════════════════════ */

.tab-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.tab-btn {
  position: relative;
  padding: 14px 16px 12px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
  white-space: nowrap;
}

.tab-btn::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background 0.15s;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--text-primary);
  font-weight: 600;
}

.tab-btn.active::after {
  background: var(--input-focus-border);
}

.tab-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 10px;
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.tab-btn.active .tab-count-badge {
  background: var(--input-focus-border);
  color: #fff;
}

.tab-placeholder {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════
   Overview Tab
   ═══════════════════════════════════════════════════ */

.overview-tab {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.overview-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.overview-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.overview-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.overview-detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.overview-detail-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.overview-detail-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

.overview-detail-value.mono {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 11px;
}

.overview-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.overview-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  text-align: center;
}

.overview-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.overview-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.overview-placeholder {
  margin: 0;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-base);
  border: 1px dashed var(--border-default);
  border-radius: 8px;
}

/* ── Pane body (reusable for both panes) ── */
.detail-pane-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  min-height: 0;
}

.company-detail-left .detail-pane-body {
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════════
   Left Pane — Company Profile
   ═══════════════════════════════════════════════════ */

/* Profile header (avatar + name + status) */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  margin-top: 16px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    var(--avatar-gradient-from),
    var(--avatar-gradient-to)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-initials {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1;
}

.profile-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  word-break: break-word;
}

.profile-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 20px;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.profile-status.active {
  background: var(--status-active-bg);
  color: var(--status-active-color);
}

.profile-status.inactive {
  background: var(--status-inactive-bg);
  color: var(--status-inactive-color);
}

.profile-status.pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-color);
}

.profile-status.neutral {
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
}

/* Info rows */
.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.info-row:hover {
  background: var(--nav-hover-bg);
}

.info-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
  stroke: var(--text-muted);
  margin-top: 2px;
}

.info-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.info-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.info-value.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: -0.02em;
}

.info-value.address-multiline {
  line-height: 1.6;
}

.site-select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  background: var(--bg-secondary, #f9fafb);
  color: var(--text-primary, #111827);
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 6px;
}

.site-select:focus {
  outline: none;
  border-color: var(--accent-color, #6366f1);
}

.info-value.site-phone {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Primary contact section */
.primary-contact-section {
  margin-top: 8px;
  padding-top: 4px;
}

.primary-contact-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 8px;
  color: var(--text-muted);
}

.primary-contact-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.primary-contact-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--nav-hover-bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.primary-contact-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-contact-inactive {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
}

.primary-contact-title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

.primary-contact-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.primary-contact-detail svg {
  flex-shrink: 0;
  color: var(--text-muted);
  stroke: var(--text-muted);
}

.primary-contact-link {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.primary-contact-link:hover {
  text-decoration: underline;
}

/* Side pane bottom identifier */
.side-pane-identifier {
  margin-top: auto;
  padding: 12px 16px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--text-faint);
  text-align: center;
  letter-spacing: -0.02em;
  opacity: 0.6;
  user-select: all;
}

/* Empty state */
.profile-empty {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 48px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════
   Tab Content — Shared
   ═══════════════════════════════════════════════════ */

.tab-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.tab-empty p {
  margin: 0;
}

.tab-empty-icon {
  width: 40px;
  height: 40px;
  color: var(--text-faint);
}

/* ── Tab bar spacer (pushes action button to the right) ── */
.tab-bar-spacer {
  flex: 1;
}

/* ── Create Credential button (sits inside tab bar) ── */
.create-credential-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  margin: auto 0;
  background: var(--accent-color, #0066cc);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.15s,
    filter 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1;
}

.create-credential-btn:hover {
  filter: brightness(1.12);
}

/* ═══════════════════════════════════════════════════
   Tab Content — Configurations
   ═══════════════════════════════════════════════════ */

/* Split container */
.config-split {
  display: flex;
  gap: 0;
  height: 100%;
  min-height: 0;
}

.config-split.expanded {
  gap: 16px;
}

.config-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: flex 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1 1 100%;
  min-width: 0;
  overflow-y: auto;
}

.config-list.collapsed {
  flex: 0 0 220px;
  max-width: 220px;
  gap: 6px;
}

.config-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card-bg);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  transition:
    border-color 0.15s,
    background 0.15s,
    padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.config-list.collapsed .config-item {
  padding: 10px 12px;
  gap: 0;
}

.config-item:hover {
  border-color: var(--card-hover-border);
  background: var(--card-hover-bg);
}

.config-item.selected {
  border-color: var(--input-focus-border);
  background: var(--card-hover-bg);
  border-radius: 14px;
}

.config-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.config-name-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.config-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.config-status-dot.dot-active {
  background: var(--status-active-color);
  box-shadow: 0 0 0 2px var(--status-active-bg);
}

.config-status-dot.dot-inactive {
  background: var(--status-inactive-color);
  box-shadow: 0 0 0 2px var(--status-inactive-bg);
}

.config-status-dot.dot-reserved {
  background: var(--status-reserved-color);
  box-shadow: 0 0 0 2px var(--status-reserved-bg);
}

.config-status-dot.dot-pending {
  background: var(--status-pending-color);
  box-shadow: 0 0 0 2px var(--status-pending-bg);
}

.config-status-dot.dot-neutral {
  background: var(--status-neutral-dot);
  box-shadow: 0 0 0 2px var(--status-neutral-dot-ring);
}

/* Config header badges wrapper */
.config-header-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Config status badge (in list items) */
.config-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.config-status-badge.status-active {
  background: var(--status-active-bg);
  color: var(--status-active-color);
}

.config-status-badge.status-inactive {
  background: var(--status-inactive-bg);
  color: var(--status-inactive-color);
}

.config-status-badge.status-reserved {
  background: var(--status-reserved-bg);
  color: var(--status-reserved-color);
}

.config-status-badge.status-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-color);
}

.config-status-badge.status-neutral {
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
}

.config-item.config-inactive {
  opacity: 0.55;
}

.config-item.config-inactive:hover {
  opacity: 0.8;
}

.config-item.config-inactive.selected {
  opacity: 0.85;
}

.config-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.config-list.collapsed .config-name {
  font-size: 13px;
}

.config-type-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 20px;
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
  white-space: nowrap;
  flex-shrink: 0;
}

.config-description {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.config-kv {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--nav-hover-bg);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  overflow-x: auto;
}

.config-key {
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

.config-key::after {
  content: ":";
  margin-left: 2px;
}

.config-value {
  color: var(--text-primary);
  word-break: break-all;
}

.config-date {
  font-size: 11px;
  color: var(--text-faint);
}

/* ═══════════════════════════════════════════════════
   Config Detail Panel (right side)
   ═══════════════════════════════════════════════════ */

.config-detail-panel {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
}

/* Fade-in animation via {#key} */
.config-detail-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  animation: configFadeIn 0.3s ease-out;
}

@keyframes configFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.config-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.config-detail-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-detail-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.config-detail-close:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  border-color: var(--input-focus-border);
}

/* ── Detail header actions group ── */
.config-detail-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Credential action buttons (edit/delete in detail header) ── */
.cred-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.cred-action-edit:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  border-color: var(--input-focus-border);
}

.cred-action-delete:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.3);
}

/* ── Three-dot menu on credential cards ── */
.cred-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
}

.cred-menu-btn:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.cred-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.cred-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 140px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 50;
  padding: 4px;
  animation: credMenuIn 0.1s ease;
}

@keyframes credMenuIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cred-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s;
}

.cred-dropdown-item:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
}

.cred-dropdown-item-danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}

.cred-dropdown-sep {
  height: 1px;
  margin: 3px 6px;
  background: var(--border-subtle);
}

.config-detail-json {
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-y: auto;
  flex: 1;
}

/* ═══════════════════════════════════════════════════
   Config Detail — Structured Questions View
   ═══════════════════════════════════════════════════ */

/* Header with badges */
.config-detail-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.config-detail-meta-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.config-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.config-badge.type {
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
}

.config-badge.active-badge,
.config-badge.status-active {
  background: var(--status-active-bg);
  color: var(--status-active-color);
}

.config-badge.inactive-badge,
.config-badge.status-inactive {
  background: var(--status-inactive-bg);
  color: var(--status-inactive-color);
}

.config-badge.status-reserved {
  background: var(--status-reserved-bg);
  color: var(--status-reserved-color);
}

.config-badge.status-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-color);
}

.config-badge.status-neutral {
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
}

/* Serial number */
.config-serial {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: var(--nav-hover-bg);
  font-size: 13px;
}

.config-serial-label {
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.config-serial-value {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--text-primary);
  font-size: 12px;
  word-break: break-all;
}

/* Notes */
.config-notes {
  margin-bottom: 20px;
}

.config-notes-text {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Section title */
.config-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.config-section-title svg {
  color: var(--text-faint);
  flex-shrink: 0;
}

/* Questions grid */
.config-questions {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.questions-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.question-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}

.question-row:hover {
  background: var(--nav-hover-bg);
}

.question-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Credential field label row with inline indicators */
.cred-field-label-row {
  display: flex;
  align-items: center;
  gap: 3px;
}

.cred-required-star {
  color: #dc2626;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: -1px;
}

.cred-lock-icon {
  color: #4a9a6b;
  flex-shrink: 0;
  margin-left: 1px;
  opacity: 0.7;
}

/* URL and email value links */
.cred-url-value,
.cred-email-value {
  color: var(--accent-color, #0066cc);
  text-decoration: none;
  transition: color 0.12s;
  word-break: break-all;
}

.cred-url-value:hover,
.cred-email-value:hover {
  text-decoration: underline;
  color: var(--accent-color-hover, #0055aa);
}

.question-value-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.question-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.question-row:not(.has-answer) .question-value {
  color: var(--text-faint);
  font-style: italic;
  font-weight: 400;
}

.question-value.textarea-value {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--nav-hover-bg);
  width: 100%;
}

.question-row:hover .question-value.textarea-value {
  background: var(--card-bg);
}

.question-value.password-value {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.05em;
}

.question-value.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  letter-spacing: 0.03em;
}

.cred-revealed-value.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  letter-spacing: 0.03em;
}

/* Password toggle */
.password-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.password-toggle:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  border-color: var(--input-focus-border);
}

/* No questions placeholder */
.config-no-questions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 16px;
  color: var(--text-faint);
  font-size: 13px;
  flex: 1;
}

.config-no-questions p {
  margin: 0;
}

/* Footer metadata */
.config-info-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.config-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
}

.config-info-item svg {
  flex-shrink: 0;
  color: var(--text-faint);
}

.config-info-item strong {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Secure value inline loading spinner */
.cred-secure-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}

.cred-secure-spinner .spin-icon {
  animation: cred-spin 0.8s linear infinite;
}

.spin-icon {
  animation: cred-spin 0.8s linear infinite;
}

@keyframes cred-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Countdown ring (30s auto-hide indicator) */
.cred-countdown-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cred-countdown-ring {
  transform: rotate(-90deg);
  color: var(--input-focus-border, #0066cc);
}

.cred-countdown-arc {
  animation: cred-countdown 30s linear forwards;
}

@keyframes cred-countdown {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: 50.265;
  }
}

/* Delete confirmation dialog */
.delete-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  animation: deleteOverlayIn 0.15s ease;
}

@keyframes deleteOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.delete-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 28px 32px 24px;
  max-width: 400px;
  width: 90vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: deleteDialogIn 0.2s ease;
}

@keyframes deleteDialogIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.delete-dialog-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.delete-dialog-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.delete-dialog-msg {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 20px;
  line-height: 1.5;
}

.delete-dialog-msg strong {
  color: var(--text-primary);
  font-weight: 600;
}

.delete-dialog-error {
  font-size: 13px;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 16px;
}

.delete-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.delete-dialog-btn {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border-subtle);
}

.delete-dialog-btn.cancel {
  background: var(--bg-surface);
  color: var(--text-secondary);
}

.delete-dialog-btn.cancel:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
}

.delete-dialog-btn.confirm {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}

.delete-dialog-btn.confirm:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.delete-dialog-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Edit credential mode */
.cred-edit-name-input {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--nav-hover-bg);
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 10px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.cred-edit-name-input:focus {
  border-color: var(--input-focus-border, #0066cc);
}

.cred-edit-field-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--nav-hover-bg);
  border: 1.5px solid var(--border-subtle);
  border-radius: 6px;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  transition: border-color 0.15s;
}

.cred-edit-field-input:focus {
  border-color: var(--input-focus-border, #0066cc);
}

.cred-edit-field-input::placeholder {
  color: var(--text-muted);
  font-family: inherit;
  font-style: italic;
}

.cred-edit-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  font-size: 13px;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 8px;
}

/* ── Credential notes ── */
.cred-notes-section {
  margin-bottom: 20px;
}

.cred-notes-text {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.cred-notes-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.cred-edit-notes-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--nav-hover-bg);
  border: 1.5px solid var(--border-subtle);
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.cred-edit-notes-input:focus {
  border-color: var(--input-focus-border, #0066cc);
}

.cred-edit-notes-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.cred-action-btn.cred-action-save {
  color: #16a34a;
}

.cred-action-btn.cred-action-save:hover {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
}

.cred-action-btn.cred-action-cancel {
  color: var(--text-muted);
}

.cred-action-btn.cred-action-cancel:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
}

.cred-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
   Bottom Sheet (iOS-style slide-up panel)
   ═══════════════════════════════════════════════════ */

/* Desktop: the overlay wrapper is invisible; detail panel renders inline */
.bottom-sheet-overlay {
  display: contents;
}

.bottom-sheet-handle {
  display: none;
}

.bottom-sheet-panel {
  display: contents;
}

.bottom-sheet-body {
  display: contents;
}

/* ═══════════════════════════════════════════════════
   Contacts Tab
   ═══════════════════════════════════════════════════ */

.contacts-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contacts-section + .contacts-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.contacts-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contacts-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.contacts-section-title svg {
  color: var(--text-muted);
  stroke: var(--text-muted);
}

.contacts-section-inactive .contacts-section-title {
  color: var(--text-secondary);
}

.contacts-section-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
}

.contacts-section-count.inactive {
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
}

.contact-avatar-inactive {
  background: var(--text-faint);
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  transition:
    box-shadow 0.15s,
    border-color 0.15s;
}

.contact-card:hover {
  border-color: var(--input-focus-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.contact-card.contact-inactive {
  opacity: 0.55;
}

.contact-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-initials {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.contact-card-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.contact-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.contact-inactive-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--status-neutral-bg);
  color: var(--status-neutral-color);
}

.contact-title {
  font-size: 12px;
  color: var(--text-secondary);
}

.contact-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 44px;
  min-width: 0;
  overflow: hidden;
}

.contact-detail-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 0;
}

.contact-detail-row svg {
  flex-shrink: 0;
  color: var(--text-secondary);
  stroke: var(--text-secondary);
  width: 13px;
  height: 13px;
  min-width: 13px;
  min-height: 13px;
}

.contact-link {
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.contact-link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .bottom-sheet-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    z-index: 150;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    pointer-events: none;
  }

  .bottom-sheet-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
  }

  .bottom-sheet-panel {
    display: flex;
    width: 100%;
    height: calc(75vh - 56px - env(safe-area-inset-bottom, 0px));
    max-height: calc(75vh - 56px - env(safe-area-inset-bottom, 0px));
    background: var(--bg-surface);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
  }

  .bottom-sheet-overlay.active .bottom-sheet-panel {
    transform: translateY(0);
  }

  /* Drag handle */
  .bottom-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    flex-shrink: 0;
    cursor: grab;
  }

  .bottom-sheet-handle::after {
    content: "";
    width: 36px;
    height: 5px;
    border-radius: 3px;
    background: var(--text-faint);
    opacity: 0.4;
  }

  .bottom-sheet-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0;
  }

  /* Show the detail panel inside the bottom sheet */
  .bottom-sheet-body .config-detail-panel {
    display: flex !important;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .bottom-sheet-body .config-detail-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ═══════════════════════════════════════════════════
   Mobile — Company Detail Responsive
   ═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Stack the two panes vertically */
  .company-detail-page {
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Left pane becomes a compact card at the top */
  .company-detail-left {
    flex: 0 0 auto;
    border-radius: 10px;
  }

  .company-detail-left .detail-pane-body {
    padding: 12px 16px;
  }

  .profile-header {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    margin-top: 8px;
  }

  .profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .profile-initials {
    font-size: 16px;
  }

  .profile-name {
    font-size: 16px;
    text-align: left;
  }

  .profile-info {
    gap: 0;
  }

  .info-row {
    padding: 6px 4px;
  }

  /* Right pane fills remaining space */
  .company-detail-right {
    flex: 1;
    min-height: 0;
    border-radius: 10px;
  }

  .detail-pane-header {
    padding: 12px 16px 10px;
    gap: 8px;
  }

  .detail-pane-title {
    font-size: 16px;
  }

  /* Tab bar: scrollable on mobile */
  .tab-bar {
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    padding: 10px 12px 8px;
    font-size: 12px;
  }

  .detail-pane-body {
    padding: 12px 14px;
  }

  /* Config split: full-width list, no side-by-side on mobile */
  .config-split {
    flex-direction: column;
  }

  .config-split.expanded {
    gap: 0;
  }

  .config-list {
    flex: none !important;
    max-width: none !important;
    width: 100%;
  }

  .config-list.collapsed {
    flex: none;
    max-width: none;
  }

  /* Hide the inline detail panel on mobile — the bottom sheet is used instead */
  .config-detail-panel {
    display: none;
  }

  /* Collapsed config items still show full info on mobile */
  .config-list.collapsed .config-item {
    padding: 14px 16px;
    gap: 8px;
  }

  .config-list.collapsed .config-name {
    font-size: 14px;
  }

  /* Card items */
  .config-item {
    padding: 12px 14px;
  }

  /* Create credential button: tighter on mobile */
  .create-credential-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Bottom sheet detail content overrides */
  .bottom-sheet-body .config-detail-content {
    animation: none;
    padding: 8px 16px 24px;
  }

  .bottom-sheet-body .config-detail-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .bottom-sheet-body .config-detail-title {
    font-size: 15px;
  }

  /* Bottom sheet footer spacing */
  .bottom-sheet-body .config-info-footer {
    padding-bottom: 8px;
  }

  /* Credential dropdown menus in collapsed list: full width items on mobile */
  .cred-dropdown-menu {
    min-width: 120px;
  }

  /* Delete overlay adapts for safe areas */
  .delete-overlay {
    align-items: flex-end;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .delete-dialog {
    border-radius: 14px 14px 0 0;
    max-width: 100%;
    width: 100%;
    padding: 24px 20px 20px;
    animation: deleteSheetIn 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }

  @keyframes deleteSheetIn {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
}

/* Desktop: hide mobile-only elements */
.mobile-nav-menu,
.mobile-content-header {
  display: none;
}

/* Small phones */
@media (max-width: 480px) {
  .company-detail-left .detail-pane-body {
    padding: 8px 12px;
  }

  .profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .profile-initials {
    font-size: 14px;
  }

  .profile-name {
    font-size: 14px;
  }

  .tab-btn {
    padding: 8px 10px 6px;
    font-size: 11px;
  }

  .detail-pane-body {
    padding: 10px 10px;
  }

  .config-item {
    padding: 10px 12px;
  }

  .bottom-sheet-body .config-detail-content {
    padding: 6px 12px 20px;
  }
}

/* ═══════════════════════════════════════════════════
   Mobile — Vertical Nav, Collapsible Header, Transitions
   ═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* ── Left pane collapse transition ── */
  .company-detail-left {
    transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
  }

  .company-detail-left.mobile-collapsed .detail-pane-body {
    padding: 8px 16px;
  }

  .company-detail-left.mobile-collapsed .profile-header {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
  }

  .company-detail-left.mobile-collapsed .profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .company-detail-left.mobile-collapsed .profile-initials {
    font-size: 13px;
  }

  .company-detail-left.mobile-collapsed .profile-name {
    font-size: 15px;
  }

  .company-detail-left.mobile-collapsed .profile-status,
  .company-detail-left.mobile-collapsed .profile-info,
  .company-detail-left.mobile-collapsed .back-btn {
    display: none;
  }

  /* ── Mobile vertical nav menu ── */
  .mobile-nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 6px;
    animation: mobileNavIn 0.3s ease-out;
  }

  @keyframes mobileNavIn {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
  }

  .mobile-nav-item:active {
    background: var(--nav-hover-bg);
    transform: scale(0.98);
  }

  .mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--nav-hover-bg);
    color: var(--text-secondary);
    flex-shrink: 0;
  }

  .mobile-nav-label {
    flex: 1;
  }

  .mobile-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--accent-color, #0066cc);
    color: white;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
  }

  .mobile-nav-chevron {
    color: var(--text-faint);
    flex-shrink: 0;
  }

  /* ── Hide right pane when showing mobile nav ── */
  .company-detail-right.mobile-hidden {
    display: none;
  }

  /* ── Hide desktop tab bar on mobile ── */
  .company-detail-right .tab-bar {
    display: none;
  }

  /* ── Mobile content header (back + title + action) ── */
  .mobile-content-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    animation: mobileContentIn 0.3s ease-out;
  }

  @keyframes mobileContentIn {
    from {
      opacity: 0;
      transform: translateX(-10px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .mobile-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
  }

  .mobile-back-btn:active {
    background: var(--nav-hover-bg);
    color: var(--text-primary);
  }

  .mobile-content-title {
    flex: 1;
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
  }

  .mobile-create-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
  }

  /* ── Right pane grows when tab is active ── */
  .company-detail-right {
    transition: flex 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  }
}

/* Safe area insets for bottom sheet */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .bottom-sheet-panel {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}

/* ═══════════════════════════════════════════════════
   Sub-Credentials — Table Layout
   ═══════════════════════════════════════════════════ */

.sub-creds-section {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.sub-creds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sub-creds-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.sub-creds-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 9px;
  background: var(--nav-active-bg);
  color: var(--text-secondary);
}

.sub-creds-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  font-size: 11px;
  color: var(--text-muted);
}

.sub-creds-empty {
  margin: 0;
  padding: 4px 0;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Table ── */
.sub-creds-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.sub-creds-table thead th {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.sub-creds-table thead th {
  display: table-cell;
}

.sub-creds-table thead th .cred-lock-icon {
  display: inline;
  vertical-align: -1px;
  margin-left: 2px;
}

.sub-creds-th-actions {
  width: 32px;
}

.sub-creds-table tbody td {
  padding: 5px 8px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-creds-table tbody tr:last-child td {
  border-bottom: none;
}

.sub-cred-row:hover td {
  background: var(--bg-hover);
}

.sub-cred-name-cell {
  font-weight: 600;
  white-space: nowrap;
  width: 20%;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.mono {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 10px;
}

.sub-cred-secure-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
}

.sub-cred-eye-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sub-cred-eye-btn:hover {
  color: var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent-blue) 20%, transparent);
}

.sub-cred-spinner {
  color: var(--text-muted);
  flex-shrink: 0;
}

.sub-cred-revealed {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.sub-cred-masked {
  color: var(--text-muted);
  letter-spacing: 1px;
}

.sub-cred-actions-cell {
  width: 32px;
  text-align: center;
  padding: 2px 4px;
}

.sub-cred-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-cred-remove-btn:hover:not(:disabled) {
  color: var(--status-error);
  background: color-mix(in srgb, var(--status-error) 8%, transparent);
  border-color: color-mix(in srgb, var(--status-error) 20%, transparent);
}

.sub-cred-remove-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Add button (header) ── */
.sub-cred-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px dashed var(--border-default);
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-cred-add-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 6%, transparent);
}

/* ── Inline add row ── */
.sub-cred-add-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--accent-blue);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-blue) 4%, var(--bg-surface));
}

.sub-cred-add-row-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sub-cred-add-input {
  flex: 1 1 120px;
  min-width: 0;
  padding: 5px 8px;
  font-size: 11px;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.sub-cred-add-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-blue) 12%, transparent);
}

.sub-cred-add-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sub-cred-add-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.sub-cred-add-error {
  color: var(--status-error);
  display: inline-flex;
  align-items: center;
}

.sub-cred-btn-cancel {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-cred-btn-cancel:hover:not(:disabled) {
  background: var(--bg-hover);
}

.sub-cred-btn-cancel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sub-cred-btn-save {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: var(--accent-blue);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-cred-btn-save:hover:not(:disabled) {
  filter: brightness(1.08);
}

.sub-cred-btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
   UniFi Tab — Sites Cards
   ═══════════════════════════════════════════════════ */

.unifi-sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
  padding: 8px 0;
}

.unifi-site-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 20px 20px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}

.unifi-site-card:hover {
  border-color: var(--input-focus-border);
  box-shadow: 0 2px 12px
    color-mix(in srgb, var(--input-focus-border) 10%, transparent);
}

.unifi-site-card:focus-visible {
  outline: 2px solid var(--input-focus-border);
  outline-offset: 2px;
}

.unifi-site-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.unifi-site-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.unifi-site-card-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unifi-site-card-id {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--text-muted);
  letter-spacing: -0.02em;
}

.unifi-site-card-stats {
  display: flex;
  gap: 20px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.unifi-card-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.unifi-card-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.unifi-card-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

.unifi-card-stats-loading {
  display: flex;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.unifi-card-stat-placeholder {
  width: 40px;
  height: 12px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  animation: pulse 1.5s ease-in-out infinite;
}

.unifi-site-card-arrow {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.18s;
}

.unifi-site-card:hover .unifi-site-card-arrow {
  opacity: 0.7;
  color: var(--input-focus-border);
}

/* Health status badge (reused from cards) */
.unifi-site-card-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.unifi-site-card-status .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.unifi-site-card-status.status-ok {
  background: color-mix(
    in srgb,
    var(--status-success, #22c55e) 12%,
    transparent
  );
  color: var(--status-success, #22c55e);
}
.unifi-site-card-status.status-ok .status-dot {
  background: var(--status-success, #22c55e);
}

.unifi-site-card-status.status-warn {
  background: color-mix(
    in srgb,
    var(--status-warning, #f59e0b) 12%,
    transparent
  );
  color: var(--status-warning, #f59e0b);
}
.unifi-site-card-status.status-warn .status-dot {
  background: var(--status-warning, #f59e0b);
}

.unifi-site-card-status.status-error {
  background: color-mix(in srgb, var(--status-error, #ef4444) 12%, transparent);
  color: var(--status-error, #ef4444);
}
.unifi-site-card-status.status-error .status-dot {
  background: var(--status-error, #ef4444);
}

.unifi-site-card-status.status-unknown {
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  color: var(--text-muted);
}
.unifi-site-card-status.status-unknown .status-dot {
  background: var(--text-muted);
}

.unifi-site-card-status.status-loading {
  background: color-mix(in srgb, var(--text-muted) 8%, transparent);
  color: var(--text-muted);
  padding: 5px 10px;
}

/* ═══════════════════════════════════════════════════
   UniFi Tab — Management View
   ═══════════════════════════════════════════════════ */

.unifi-management {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  /* Fill the pane body: viewport minus page header, tab bar, and pane padding */
  height: calc(100vh - 160px);
}

.unifi-management-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0;
}

.unifi-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.unifi-back-btn:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  border-color: var(--input-focus-border);
}

.unifi-management-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.unifi-management-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unifi-management-site-id {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--text-muted);
}

.unifi-site-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.unifi-site-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
}

.unifi-site-menu-btn:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.unifi-site-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 150px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 50;
  padding: 4px;
  animation: credMenuIn 0.1s ease;
}

.unifi-site-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s;
}

.unifi-site-dropdown-item:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
}

.unifi-site-dropdown-item-danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}

.unifi-site-dropdown-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Management sub-tabs */
.unifi-mgmt-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.unifi-mgmt-tab {
  position: relative;
  padding: 10px 16px 8px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}

.unifi-mgmt-tab::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background 0.15s;
}

.unifi-mgmt-tab:hover {
  color: var(--text-primary);
}

.unifi-mgmt-tab.active {
  color: var(--text-primary);
  font-weight: 600;
}

.unifi-mgmt-tab.active::after {
  background: var(--input-focus-border);
}

.unifi-mgmt-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-top: 16px;
}

/* Loading & Empty states */
.unifi-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px;
  color: var(--text-secondary);
  font-size: 13px;
}

.unifi-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.unifi-empty-state p {
  margin: 0;
}

/* Overview */
.unifi-overview-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.unifi-overview-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unifi-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.unifi-health-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unifi-health-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
}

.unifi-health-status {
  font-size: 10px;
  line-height: 1;
}

.unifi-health-status.healthy {
  color: var(--status-active-color, #22c55e);
}

.unifi-health-status.unhealthy {
  color: var(--status-error, #ef4444);
}

.unifi-health-subsystem {
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.unifi-health-status-text {
  color: var(--text-muted);
  font-size: 12px;
}

.unifi-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.unifi-info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.unifi-info-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.unifi-info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

.unifi-info-value.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: -0.02em;
}

/* Devices */
.unifi-devices-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.unifi-devices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.unifi-devices-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-base) 50%, transparent);
  white-space: nowrap;
}

.unifi-devices-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.unifi-devices-table tbody tr:last-child {
  border-bottom: none;
}

.unifi-devices-table tbody tr:hover {
  background: color-mix(in srgb, var(--text-primary) 3%, transparent);
}

.unifi-devices-table td {
  padding: 10px 14px;
  color: var(--text-primary);
  white-space: nowrap;
  vertical-align: middle;
}

.unifi-device-status-cell {
  width: 42px;
  text-align: center;
}

.unifi-device-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.unifi-device-status-dot.online {
  background: var(--status-active-color, #22c55e);
  box-shadow: 0 0 4px var(--status-active-color, #22c55e);
}

.unifi-device-status-dot.offline {
  background: var(--text-muted);
}

.unifi-device-name-cell {
  font-weight: 600;
}

.unifi-device-model-cell {
  color: var(--text-secondary, var(--text-primary));
}

.unifi-device-mono-cell {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: -0.02em;
  color: var(--text-secondary, var(--text-primary));
}

.unifi-device-uptime-cell {
  color: var(--text-secondary, var(--text-primary));
}

/* WiFi Split-View */
.wifi-split-view {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-base);
  overscroll-behavior: contain;
}

.wifi-list-panel {
  flex: 1;
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: flex 0.25s ease;
}

.wifi-split-view.detail-open .wifi-list-panel {
  flex: 0 0 240px;
}

.wifi-list-count {
  font-size: 11px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 15%, transparent);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}

/* WiFi Table Layout */
.wifi-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-base), var(--bg-raised) 50%);
  position: sticky;
  top: 0;
  z-index: 3;
}

.wifi-table-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wifi-table-head {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  background: color-mix(in srgb, var(--text-primary) 3%, transparent);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 39px;
  z-index: 2;
}

.wifi-table-head .wifi-col {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wifi-table-body {
  display: flex;
  flex-direction: column;
}

.wifi-table-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.wifi-table-row:last-child {
  border-bottom: none;
}

.wifi-table-row:hover {
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
}

.wifi-table-row.active {
  background: color-mix(in srgb, var(--input-focus-border) 10%, transparent);
  box-shadow: inset 2px 0 0 var(--input-focus-border);
}

/* Column sizing */
.wifi-col {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-primary);
  min-width: 0;
}

.wifi-col-status {
  flex: 0 0 28px;
  justify-content: center;
}

.wifi-col-name {
  flex: 1.6;
  min-width: 0;
}

.wifi-col-vlan {
  flex: 1;
  min-width: 0;
}

.wifi-col-aps {
  flex: 1;
  justify-content: center;
}

.wifi-col-band {
  flex: 1;
  justify-content: center;
}

.wifi-col-clients {
  flex: 0.7;
  justify-content: center;
}

.wifi-col-security {
  flex: 1.3;
}

.wifi-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.25;
  flex-shrink: 0;
}

.wifi-status-dot.enabled {
  background: #22c55e;
  opacity: 1;
}

.wifi-network-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wifi-table-tag {
  font-size: 9px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.wifi-table-tag-guest {
  color: color-mix(in srgb, var(--input-focus-border) 80%, var(--text-primary));
  background: color-mix(in srgb, var(--input-focus-border) 12%, transparent);
}

.wifi-band-badge {
  font-size: 11px;
  color: var(--text-muted);
}

/* Detail Panel */
.wifi-detail-panel {
  flex: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    flex 0.25s ease,
    opacity 0.2s ease;
}

.wifi-split-view.detail-open .wifi-detail-panel {
  flex: 1;
  min-height: 0;
  opacity: 1;
  overflow-y: auto;
}

.wifi-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface, var(--bg-base));
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.wifi-detail-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition:
    color 0.15s,
    background 0.15s;
}

.wifi-detail-back:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.wifi-detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wifi-btn {
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition:
    background 0.15s,
    opacity 0.15s;
}

.wifi-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wifi-btn-ghost {
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.wifi-btn-ghost:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
  color: var(--text-primary);
}

.wifi-btn-primary {
  background: var(--accent-color, #0066cc);
  color: #fff;
}

.wifi-btn-primary:hover:not(:disabled) {
  opacity: 0.85;
}

.wifi-save-error {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--status-error, #ef4444);
  background: color-mix(in srgb, var(--status-error, #ef4444) 8%, transparent);
  border-bottom: 1px solid var(--border-subtle);
}

/* Detail Form */
.wifi-detail-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Group card */
.wifi-group-card {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
}

.wifi-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-base) 50%, var(--bg-surface));
}

.wifi-group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-color, #0066cc) 10%, transparent);
  color: var(--accent-color, #0066cc);
  flex-shrink: 0;
}

.wifi-group-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.wifi-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.wifi-group-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.wifi-group-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 0;
}

/* Unified field rows inside group cards */
.wifi-group-fields .wifi-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  transition: background 0.1s;
}

.wifi-group-fields .wifi-field:hover {
  background: color-mix(in srgb, var(--text-primary) 2%, transparent);
}

.wifi-group-fields .wifi-field-inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wifi-field-label-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.wifi-field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0;
  text-transform: none;
}

.wifi-field-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.wifi-field-input {
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.15s;
}

.wifi-field-input:focus {
  outline: none;
  border-color: var(--input-focus-border);
}

.wifi-field-input.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: -0.02em;
}

.wifi-field-select {
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.wifi-field-select:focus {
  outline: none;
  border-color: var(--input-focus-border);
}

.wifi-field-value {
  font-size: 13px;
  color: var(--text-primary);
}

.wifi-field-value.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: -0.02em;
}

.wifi-field-value.wifi-bool {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.wifi-field-value.wifi-bool.yes {
  color: var(--status-success);
}

/* Toggle switch */
.wifi-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.wifi-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.wifi-toggle-slider {
  width: 34px;
  height: 18px;
  background: var(--text-muted);
  opacity: 0.35;
  border-radius: 9px;
  position: relative;
  transition:
    background 0.2s,
    opacity 0.2s;
}

.wifi-toggle-slider::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.wifi-toggle input:checked + .wifi-toggle-slider {
  background: var(--accent-color, #0066cc);
  opacity: 1;
}

.wifi-toggle input:checked + .wifi-toggle-slider::after {
  transform: translateX(16px);
}

/* Passphrase */
.wifi-passphrase-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wifi-passphrase-wrap .wifi-field-input {
  flex: 1;
}

.wifi-reveal-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}

.wifi-reveal-btn:hover {
  color: var(--text-primary);
}

/* Manual / Auto mode toggle */
.wifi-mode-toggle-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 4px;
}

.wifi-mode-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.wifi-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-start;
}

.wifi-mode-toggle button {
  padding: 5px 18px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.wifi-mode-toggle button + button {
  border-left: 1px solid var(--border-default);
}

.wifi-mode-toggle button.active {
  background: var(--accent-color, #0066cc);
  color: #fff;
}

.wifi-mode-toggle button:not(.active):hover {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.wifi-mode-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Placeholder */
.wifi-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 280px;
  gap: 12px;
  color: var(--text-muted);
  padding: 40px;
}

.wifi-detail-placeholder svg {
  opacity: 0.3;
}

.wifi-detail-placeholder p {
  font-size: 13px;
  margin: 0;
}

/* ═══════════════════════════════════ */
/* Bubble Select (horizontal pill)    */
/* ═══════════════════════════════════ */
.wifi-bubble-select {
  display: inline-flex;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-start;
}

.wifi-bubble {
  padding: 5px 16px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.wifi-bubble + .wifi-bubble {
  border-left: 1px solid var(--border-default);
}

.wifi-bubble.active {
  background: var(--accent-color, #0066cc);
  color: #fff;
}

.wifi-bubble:not(.active):hover {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

/* ═══════════════════════════════════ */
/* Broadcast Group Checklist          */
/* ═══════════════════════════════════ */
.wifi-group-checklist {
  margin-top: 8px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}

.wifi-group-checklist-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.wifi-group-checklist-empty {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.wifi-group-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.wifi-group-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.wifi-group-th-check,
.wifi-group-th-name {
  padding: 6px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
}

.wifi-group-th-check {
  width: 36px;
  padding-right: 0;
}

.wifi-group-row {
  transition: background 0.1s;
}

.wifi-group-row:not(:last-child) td {
  border-bottom: 1px solid
    color-mix(in srgb, var(--border-default) 50%, transparent);
}

.wifi-group-row:hover {
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
}

.wifi-group-row.checked {
  background: color-mix(in srgb, var(--accent-color, #0066cc) 6%, transparent);
}

.wifi-group-row-disabled {
  opacity: 0.4;
}

.wifi-group-row-disabled .wifi-group-td-check input {
  cursor: not-allowed;
}

.wifi-group-td-check,
.wifi-group-td-name {
  padding: 8px 12px;
  vertical-align: middle;
}

.wifi-group-td-check {
  width: 36px;
  padding-right: 0;
}

.wifi-group-td-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-color, #0066cc);
  cursor: pointer;
}

.wifi-group-td-check input[type="checkbox"]:disabled {
  cursor: default;
}

.wifi-group-td-name {
  font-weight: 500;
  color: var(--text-primary);
}

.wifi-group-td-name span {
  display: block;
}

.wifi-group-ap-mac {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-tertiary);
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  margin-top: 1px;
}

.wifi-group-th-meta {
  padding: 6px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
}

.wifi-group-td-meta {
  padding: 8px 12px;
  vertical-align: middle;
  font-size: 11px;
  color: var(--text-secondary);
}

.wifi-group-td-meta.mono {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 11px;
}

/* ═══════════════════════════════════ */
/* Radio Band Checkboxes              */
/* ═══════════════════════════════════ */
.wifi-radio-band-checks {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.wifi-radio-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.wifi-radio-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-color, #0066cc);
  cursor: pointer;
}

.wifi-radio-check.wifi-radio-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wifi-radio-check.wifi-radio-disabled input {
  cursor: not-allowed;
}

.wifi-todo-badge {
  font-size: 9px;
  font-weight: 700;
  color: #f59e0b;
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ═══════════════════════════════════ */
/* PPSK Section                       */
/* ═══════════════════════════════════ */
.wifi-ppsk-section {
  padding: 0 14px 10px;
}

.wifi-ppsk-loading,
.wifi-ppsk-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
}

.wifi-ppsk-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.wifi-ppsk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

.wifi-ppsk-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.wifi-ppsk-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wifi-ppsk-vlan,
.wifi-ppsk-mac {
  font-size: 10px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.wifi-ppsk-add {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.wifi-ppsk-add .wifi-field-input {
  flex: 1;
  min-width: 120px;
}

/* ═══════════════════════════════════ */
/* Sub-sections (for MAC, RADIUS etc) */
/* ═══════════════════════════════════ */
.wifi-sub-section {
  padding: 0 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wifi-sub-section .wifi-field {
  padding: 6px 0;
}

/* ═══════════════════════════════════ */
/* MAC Address List                   */
/* ═══════════════════════════════════ */
.wifi-mac-add {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.wifi-mac-add .wifi-field-input {
  flex: 1;
}

.wifi-mac-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wifi-mac-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 11px;
}

.wifi-mac-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.15s;
}

.wifi-mac-remove:hover {
  color: var(--status-error, #ef4444);
}

/* ═══════════════════════════════════ */
/* Speed Limit Row                    */
/* ═══════════════════════════════════ */
.wifi-speed-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.wifi-speed-row .wifi-field-select {
  flex: 1;
}

/* ═══════════════════════════════════ */
/* Inline Number + Unit               */
/* ═══════════════════════════════════ */
.wifi-inline-number {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wifi-inline-number .wifi-field-input {
  width: 100px;
}

.wifi-inline-unit {
  font-size: 12px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════ */
/* DTIM Inline Fields                 */
/* ═══════════════════════════════════ */
.wifi-dtim-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.wifi-dtim-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.wifi-dtim-field span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.wifi-dtim-field .wifi-field-input {
  width: 100%;
}

/* ═══════════════════════════════════ */
/* Group Key Interval row             */
/* ═══════════════════════════════════ */
.wifi-gki-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════ */
/* Disabled Field                     */
/* ═══════════════════════════════════ */
.wifi-field-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Greyed-out section (auto mode) */
.wifi-section-disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(30%);
}

.wifi-info-bubble {
  cursor: help;
  font-size: 12px;
}

/* ═══════════════════════════════════ */
/* Modal Overlay                      */
/* ═══════════════════════════════════ */
.wifi-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.wifi-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 20px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.wifi-modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.wifi-modal-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 16px;
}

.wifi-modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.wifi-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.wifi-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ═══════════════════════════════════ */
/* Split-view scroll & sticky sidebar */
/* ═══════════════════════════════════ */

/* Hide extra columns when detail panel is open */
.wifi-split-view.detail-open .wifi-col-vlan,
.wifi-split-view.detail-open .wifi-col-aps,
.wifi-split-view.detail-open .wifi-col-band,
.wifi-split-view.detail-open .wifi-col-clients,
.wifi-split-view.detail-open .wifi-col-security,
.wifi-split-view.detail-open .wifi-table-head {
  display: none;
}

.wifi-split-view.detail-open .wifi-table-tag {
  display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .wifi-split-view.detail-open .wifi-list-panel {
    display: none;
  }
  .wifi-split-view.detail-open .wifi-detail-panel {
    flex: 1;
    border-left: none;
  }
  .wifi-split-view .wifi-list-panel {
    flex: 1;
    border-right: none;
  }
  .wifi-detail-grid {
    grid-template-columns: 1fr;
  }
  .wifi-col-aps,
  .wifi-col-clients {
    display: none;
  }
}

/* Networks */
.unifi-networks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.unifi-network-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.unifi-network-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.unifi-network-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.unifi-network-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.unifi-network-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
