/* ═══════════════════════════════════════════════════════════
   ORBRT — Page-specific Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Dashboard ─────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 32px;
  gap: 12px;
  position: relative;
}
.dashboard-grid > .card,
.dashboard-grid > .stat-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  min-height: 0;
  min-width: 0;  /* prevent content from stretching grid columns */
  position: relative;
  overflow: visible;  /* allow dropdown menus to extend outside card bounds */
}
.dashboard-grid > .card > .card-body {
  flex: 1;
  overflow-x: auto;   /* horizontal scroll for wide tables instead of stretching */
  overflow-y: auto;
  min-height: 0;
  min-width: 0;
}

.full-width {
  grid-column: 1 / -1;
}

/* ── Card resize handle ──────── */
.card-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  cursor: se-resize;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.card-resize-handle::before {
  content: '';
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent-muted);
  border-bottom: 2px solid var(--accent-muted);
  border-radius: 0 0 2px 0;
}

.dashboard-grid > .card:hover .card-resize-handle,
.dashboard-grid > .stat-card:hover .card-resize-handle {
  opacity: 1;
}

/* Grid overlay — mirrors exact grid layout for perfect alignment.
   grid-template-columns is set by JS to match current responsive column count */
.resize-grid-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 32px;
  gap: 12px;
  z-index: 15;
  pointer-events: none;
}
.resize-grid-cell {
  border: 1px dashed var(--border-subtle);
  border-radius: 2px;
  opacity: 0.25;
}

/* Card while actively being resized — unified for .card and .stat-card */
.card-resizing,
.stat-card.card-resizing {
  z-index: 20;
  outline: 2px dashed var(--accent-primary);
  outline-offset: -1px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 4px rgba(61, 220, 132, 0.08);
  opacity: 0.7;
  transition: none;  /* instant feedback during resize */
}

/* Red outline when resize would overflow/collide */
.card-resizing-overflow,
.stat-card.card-resizing-overflow {
  z-index: 20;
  outline: 2px dashed var(--status-error, #f44);
  outline-offset: -1px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 4px rgba(244, 68, 68, 0.12);
  opacity: 0.7;
  transition: none;
}

/* Body no-select during resize */
.is-resizing {
  user-select: none;
  cursor: se-resize !important;
}

.is-resizing * {
  cursor: se-resize !important;
}

/* ── Drag & drop reorder ──────── */
.dashboard-grid > .card[draggable="true"],
.dashboard-grid > .stat-card[draggable="true"] {
  cursor: grab;
}
.card-dragging {
  opacity: 0.25 !important;
  outline: 2px dashed var(--accent-muted);
}
.card-drag-ghost {
  border: 2px dashed var(--accent-primary);
  background: rgba(61, 220, 132, 0.06);
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 10;
}
.card-drag-ghost.invalid {
  border-color: var(--status-error);
  background: rgba(244, 68, 68, 0.06);
}
.card-drag-ghost.swap {
  border-color: rgba(96, 165, 250, 0.7);
  background: rgba(96, 165, 250, 0.08);
}

/* ── Dashboard responsive — graduated column reduction ──
   JS sets grid-template-columns dynamically via _gridCols.
   CSS handles overflow and hides resize handles at small sizes.
   Tiers: ≥1200px → 12col, ≥960px → 8col, ≥720px → 6col, ≥480px → 4col, <480px → 2col */

/* Cards that span full width at their breakpoint get horizontal scroll */
.dashboard-grid > .card > .card-body {
  min-width: 0;
}

@media (max-width: 1199px) {
  .dashboard-grid > .card,
  .dashboard-grid > .stat-card {
    overflow: visible;
  }
}

/* Hide resize handles on smaller grids — resizing is confusing with few columns */
@media (max-width: 719px) {
  .card-resize-handle {
    display: none;
  }
}

/* At 2-col, force stat-cards to minimum height auto so they don't collapse */
@media (max-width: 479px) {
  .dashboard-grid {
    grid-auto-rows: minmax(32px, auto);
  }
  .dashboard-grid > .stat-card {
    min-height: auto;
  }
}

/* Filter button group (e.g. security threat chart window toggle) */
.filter-group {
  display: flex;
  gap: 4px;
}

/* Chart placeholder */
.chart-area {
  height: 200px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-end;
  padding: 16px;
  gap: 3px;
  position: relative;
  overflow: hidden;
}

.chart-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(61, 220, 132, 0.03) 100%);
  pointer-events: none;
}

.chart-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: var(--accent-dim);
  transition: height var(--transition-base);
  min-height: 4px;
  position: relative;
  z-index: 1;
}

.chart-bar:hover {
  background: var(--accent-muted);
}

/* Threat map simulation */
.threat-map {
  height: 180px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.threat-map .map-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 2px;
  padding: 16px;
  width: 100%;
  height: 100%;
}

.threat-map .map-cell {
  border-radius: 1px;
  transition: background var(--transition-fast);
}

.map-cell.active {
  background: var(--accent-dim);
}

.map-cell.hot {
  background: var(--status-warn);
  opacity: 0.6;
}

.map-cell.critical {
  background: var(--status-error);
  opacity: 0.5;
}

/* ── Identity / Users ──────────────────────────────────── */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell .user-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--surface-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.user-cell .user-info .user-display-name {
  font-weight: 500;
  color: var(--text-primary);
}

.user-cell .user-info .user-email {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* Role chips */
.role-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.role-admin {
  background: rgba(224, 82, 82, 0.1);
  color: var(--status-error);
}

.role-user {
  background: rgba(74, 158, 222, 0.1);
  color: var(--status-info);
}

.role-viewer {
  background: rgba(107, 107, 107, 0.12);
  color: var(--text-secondary);
}

.role-operator {
  background: rgba(230, 168, 23, 0.1);
  color: var(--status-warn);
}

/* ── Policy Table Extras ───────────────────────────────── */
.policy-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 3px;
}

.policy-action {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.policy-action.allow {
  color: var(--status-ok);
}

.policy-action.deny {
  color: var(--status-error);
}

/* Scope chips (policy table) */
.scope-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.scope-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
}
.scope-chip.scope-network {
  background: rgba(96, 165, 250, 0.10);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.20);
}
.scope-chip.scope-tenant {
  background: rgba(148, 163, 184, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.18);
}
.scope-chip.scope-group {
  background: rgba(61, 220, 132, 0.08);
  color: var(--accent-primary);
  border: 1px solid rgba(61, 220, 132, 0.18);
}
.scope-chip.scope-user {
  background: rgba(168, 85, 247, 0.08);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.18);
}
.scope-chip.scope-device {
  background: rgba(251, 191, 36, 0.08);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.18);
}
.scope-chip.scope-web {
  background: rgba(34, 211, 238, 0.08);
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.18);
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.scope-chip.scope-addr-group {
  background: rgba(244, 114, 182, 0.08);
  color: #f472b6;
  border: 1px solid rgba(244, 114, 182, 0.18);
}
.scope-chip.scope-port {
  background: rgba(251, 146, 60, 0.08);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.18);
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.scope-chip.scope-filter {
  background: rgba(251, 191, 36, 0.06);
  color: var(--status-warn);
  border: 1px dashed rgba(251, 191, 36, 0.25);
  font-size: 10.5px;
}
.scope-chip .scope-remove {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 4px;
  cursor: pointer;
  opacity: 0.6;
}
.scope-chip .scope-remove:hover { opacity: 1; }

/* Scope builder (modal) */
.scope-builder {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scope-builder-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.scope-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  padding: 6px 0 0 0;
}

/* Policy action toggle (modal) */
.policy-action-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.policy-action-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.policy-action-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.policy-action-btn.allow.active {
  border-color: rgba(61, 220, 132, 0.4);
  background: rgba(61, 220, 132, 0.08);
  color: var(--status-ok);
}
.policy-action-btn.deny.active {
  border-color: rgba(224, 82, 82, 0.4);
  background: rgba(224, 82, 82, 0.08);
  color: var(--status-error);
}
.policy-action-btn.route.active,
.policy-action-btn.nat.active,
.policy-action-btn.tunnel.active {
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.08);
  color: var(--status-info);
}
.policy-action-btn.quarantine.active {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
  color: var(--status-warn);
}

/* Small filter selects and inputs */
.form-select-sm {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 5px 24px 5px 8px;
  font-size: 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.form-select-sm:focus {
  outline: none;
  border-color: var(--accent-muted);
}
.form-input-sm {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  width: 160px;
}
.form-input-sm:focus {
  outline: none;
  border-color: var(--accent-muted);
}

/* Modal divider */
.modal-divider {
  border-top: 1px solid var(--border-subtle);
  margin: 16px 0;
}

/* ── Monitoring ────────────────────────────────────────── */
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border-subtle);
  line-height: 1.5;
}

.log-entry:hover {
  background: var(--surface-3);
}

.log-timestamp {
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
}

.log-level {
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
}

.log-level.info { background: rgba(74, 158, 222, 0.12); color: var(--status-info); }
.log-level.warn { background: rgba(230, 168, 23, 0.12); color: var(--status-warn); }
.log-level.error { background: rgba(224, 82, 82, 0.12); color: var(--status-error); }
.log-level.debug { background: rgba(107, 107, 107, 0.12); color: var(--text-secondary); }

.log-message {
  color: var(--text-primary);
  word-break: break-word;
  flex: 1;
}

.log-source {
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
}

/* ── Settings ──────────────────────────────────────────── */
.settings-section {
  margin-bottom: 32px;
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-default);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.setting-info {
  flex: 1;
}

.setting-label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.setting-control {
  flex-shrink: 0;
  margin-left: 24px;
}

/* Form inputs */
.form-input {
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12.5px;
  padding: 7px 10px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
  width: 200px;
}

.form-input:focus {
  border-color: var(--accent-muted);
}

.form-input.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.form-select {
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12.5px;
  padding: 7px 10px;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.form-select:focus {
  border-color: var(--accent-muted);
}

/* ── Devices ───────────────────────────────────────────── */
.device-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.device-cell .device-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
}

.device-cell .device-serial {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

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

.device-status-dot.online { background: var(--status-ok); }
.device-status-dot.warning { background: var(--status-warn); }
.device-status-dot.offline { background: var(--status-error); }

.device-type-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.device-type-chip.firewall {
  background: rgba(224, 82, 82, 0.1);
  color: var(--status-error);
}

.device-type-chip.switch {
  background: rgba(66, 153, 225, 0.1);
  color: var(--status-info);
}

.device-type-chip.ap {
  background: rgba(72, 187, 120, 0.1);
  color: var(--status-ok);
}

.device-type-chip.iot {
  background: rgba(159, 122, 234, 0.1);
  color: #9f7aea;
}

.device-type-chip.endpoint {
  background: rgba(107, 107, 107, 0.12);
  color: var(--text-secondary);
}

/* ── Utilization Cell ──────────────────────────────────── */
.utilization-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Modal Wide ────────────────────────────────────────── */
.modal-wide {
  max-width: 720px;
}

/* ── Network Switcher (Topbar) ─────────────────────────── */
.network-switcher {
  position: relative;
}

.network-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  transition: all var(--transition-fast);
}

.network-trigger:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.network-trigger-icon {
  width: 16px;
  height: 16px;
  stroke: var(--accent-primary);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.network-trigger-info {
  text-align: left;
}

.network-trigger-name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.2;
}

.network-trigger-label {
  display: block;
  font-size: 9px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.network-menu {
  min-width: 300px;
}

/* ═══════════════════════════════════════════════
   Auth Pages — Login / Onboarding
   ═══════════════════════════════════════════════ */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 48px;
  height: 48px;
  color: var(--accent-primary);
  margin: 0 auto 12px;
}
.auth-logo svg { width: 100%; height: 100%; }

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* Auth Card */
.auth-card {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}

.auth-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-align: center;
}

/* SSO Buttons */
.auth-sso-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-sso-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.auth-sso-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.auth-sso-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Auth Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}
.auth-divider span {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Magic Link Sent */
.auth-magic-sent {
  text-align: center;
  padding: 8px 0;
}
.auth-magic-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(61, 220, 132, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.auth-magic-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--status-ok);
  fill: none;
  stroke-width: 2;
}
.auth-magic-sent h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.auth-magic-sent p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Auth Footer */
.auth-footer {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  gap: 6px;
}
.auth-footer a {
  text-decoration: none;
  font-weight: 500;
}
.auth-footer a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════
   Onboarding — Step Indicator
   ═══════════════════════════════════════════════ */

.onboard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
  width: 100%;
}

.onboard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.onboard-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  transition: all var(--transition-base);
}
.onboard-step-num svg {
  width: 14px;
  height: 14px;
  stroke: var(--surface-0);
  fill: none;
  stroke-width: 2.5;
}

.onboard-step.active .onboard-step-num {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--surface-0);
}

.onboard-step.done .onboard-step-num {
  background: var(--accent-muted);
  border-color: var(--accent-muted);
}

.onboard-step-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.onboard-step.active .onboard-step-label {
  color: var(--text-secondary);
}

.onboard-step-line {
  width: 40px;
  height: 2px;
  background: var(--border-default);
  margin: 0 8px;
  margin-bottom: 18px;
  transition: background var(--transition-base);
}
.onboard-step-line.filled {
  background: var(--accent-muted);
}

/* IdP Selection List */
.auth-idp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-idp-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  color: var(--text-primary);
}
.auth-idp-option:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.auth-idp-option.selected {
  border-color: var(--accent-primary);
  background: rgba(61, 220, 132, 0.06);
}

.auth-idp-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.auth-idp-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-idp-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.auth-idp-desc {
  font-size: 11px;
  color: var(--text-tertiary);
}

.auth-idp-check {
  width: 20px;
  height: 20px;
}
.auth-idp-check svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent-primary);
  fill: none;
  stroke-width: 2;
}

/* Auth Responsive */
@media (max-width: 480px) {
  .auth-card {
    padding: 20px 16px;
  }
  .onboard-step-label {
    display: none;
  }
  .onboard-step-line {
    margin-bottom: 0;
  }
}

/* ═══════════════════════════════════════════════════════════
   Network Overview — Health Grid & Topology
   ═══════════════════════════════════════════════════════════ */

/* Mesh health summary grid */
.net-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}
.net-health-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.net-health-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.net-health-val.warn { color: var(--status-warn); }
.net-health-val.mono { font-family: var(--font-mono); font-size: 18px; }
.net-health-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.net-health-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.net-health-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.net-health-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.net-health-fill.fill-ok   { background: var(--status-ok); }
.net-health-fill.fill-warn { background: var(--status-warn); }
.net-health-fill.fill-error{ background: var(--status-error); }

/* View toggle (table / graph) */
.btn-group-toggle {
  display: inline-flex;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.btn-toggle {
  background: transparent;
  border: none;
  padding: 5px 10px;
  color: var(--text-tertiary);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}
.btn-toggle + .btn-toggle {
  border-left: 1px solid var(--border-default);
}
.btn-toggle:hover {
  color: var(--text-secondary);
  background: var(--surface-2);
}
.btn-toggle.active {
  background: var(--accent-muted-bg, rgba(74,158,222,0.1));
  color: var(--accent-primary);
}
.btn-toggle svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

/* Topology graph */
.topo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.topo-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-tertiary);
}
.topo-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.topo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.topo-dot.edge    { background: var(--accent-primary); }
.topo-dot.relay    { background: var(--status-warn); }
.topo-dot.endpoint { background: var(--text-tertiary); }
.topo-line {
  width: 16px;
  height: 2px;
  display: inline-block;
}
.topo-line.direct  { background: var(--status-ok); }
.topo-line.relayed {
  background: repeating-linear-gradient(90deg, var(--status-warn) 0 4px, transparent 4px 7px);
}

.topo-canvas {
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 340px;
  position: relative;
}
.topo-svg {
  width: 100%;
  height: 340px;
}
.topo-edge {
  stroke-width: 0.3;
}
.topo-edge.direct {
  stroke: var(--status-ok);
  opacity: 0.5;
}
.topo-edge.relayed {
  stroke: var(--status-warn);
  stroke-dasharray: 1.5 1;
  opacity: 0.6;
}
.topo-circle {
  transition: opacity 0.2s ease;
}
.topo-circle.edge    { fill: var(--accent-primary); stroke: rgba(74,158,222,0.3); stroke-width: 1; }
.topo-circle.relay    { fill: var(--status-warn); stroke: rgba(230,168,23,0.3); stroke-width: 0.8; }
.topo-circle.endpoint { fill: var(--text-tertiary); stroke: rgba(140,140,160,0.2); stroke-width: 0.4; }

/* Status overrides for topology nodes */
.topo-circle.degraded { fill: var(--status-warn) !important; stroke: rgba(230,168,23,0.4) !important; }
.topo-circle.offline  { fill: var(--status-error) !important; stroke: rgba(220,60,60,0.4) !important; opacity: 0.6; }

.topo-label {
  fill: var(--text-tertiary);
  font-size: 2.4px;
  font-family: var(--font-mono);
  text-anchor: middle;
  pointer-events: none;
}
.topo-node {
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.topo-node:hover .topo-circle {
  stroke-width: 2;
  filter: brightness(1.3);
}
.topo-node:hover .topo-label {
  fill: var(--text-primary);
}
.topo-node.dim {
  opacity: 0.15;
}
.topo-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 10px;
}

@media (max-width: 768px) {
  .net-health-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .topo-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .topo-svg {
    height: 240px;
  }
}

/* ═══════════════════════════════════════════════════════════
   Dynamic DNS & Uptime Monitoring
   ═══════════════════════════════════════════════════════════ */

/* DDNS target IP badges */
.ddns-targets {
  display: flex !important;
  flex-wrap: wrap;
  gap: 5px;
}
.ddns-ip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  white-space: nowrap;
  line-height: 1.4;
}
.ddns-ip.ok {
  border-color: rgba(61, 220, 132, 0.3);
  color: var(--status-ok);
  background: rgba(61, 220, 132, 0.08);
}
.ddns-ip.warn {
  border-color: rgba(255, 171, 0, 0.3);
  color: var(--status-warn);
  background: rgba(255, 171, 0, 0.08);
}
.ddns-ip.error {
  border-color: rgba(255, 82, 82, 0.3);
  color: var(--status-error);
  background: rgba(255, 82, 82, 0.08);
}

/* Domain input with suffix */
.ddns-domain-input {
  display: flex;
  align-items: stretch;
}
.ddns-domain-input input {
  flex: 1;
  min-width: 0;
}
.ddns-domain-suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}
.ddns-domain-select {
  border-left: none !important;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  background-color: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0 28px 0 10px;
  min-width: 180px;
  cursor: pointer;
}

/* Monitor type toggle */
.ddns-type-toggle {
  display: flex;
  gap: 8px;
}
.ddns-type-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  padding: 10px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.ddns-type-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.ddns-type-btn.active {
  border-color: var(--accent-muted);
  background: rgba(61, 220, 132, 0.06);
  color: var(--accent-primary);
}

/* How-it-works compact strip */
.ddns-how-strip {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.ddns-how-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.ddns-how-item strong {
  color: var(--text-primary);
}
.ddns-how-item code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent-muted);
}
.ddns-how-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  min-width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(61, 220, 132, 0.12);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
}

/* Uptime bar */
.uptime-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.uptime-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  min-width: 80px;
}
.uptime-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
}
.uptime-fill.ok {
  background: var(--status-ok);
}
.uptime-fill.warn {
  background: var(--status-warn);
}
.uptime-fill.error {
  background: var(--status-error);
}
.uptime-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Row actions */
.row-actions {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 2px;
  justify-content: flex-end;
  white-space: nowrap;
}
.row-actions .btn {
  padding: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.row-actions svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Chip variants for monitor type */
.chip-cyan {
  background: rgba(0, 188, 212, 0.12);
  color: #00bcd4;
  border: 1px solid rgba(0, 188, 212, 0.2);
}
.chip-blue {
  background: rgba(66, 165, 245, 0.12);
  color: #42a5f5;
  border: 1px solid rgba(66, 165, 245, 0.2);
}

/* ── Format Option Buttons (Export Key, Policy Bundle) ─── */
.format-options {
  display: flex;
  gap: 10px;
}

.format-option {
  flex: 1;
  padding: 18px 14px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  border: 1px solid var(--border-default);
  background: var(--surface-3);
}

.format-option:hover {
  border-color: var(--accent-muted);
}

.format-option.active {
  border-color: var(--accent-primary);
  background: var(--accent-subtle);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.format-option-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.format-option.active .format-option-label {
  color: var(--accent-primary);
}

.format-option-desc {
  font-size: 10.5px;
  color: var(--text-tertiary);
}

/* ── Card Picker Modal (Dashboard) ─────────────────────── */
.card-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
}

.card-picker {
  position: fixed;
  z-index: 1001;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: calc(100% - 48px);
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.card-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.card-picker-header h3 {
  margin: 0;
  font-size: 15px;
}

.card-picker-body {
  overflow-y: auto;
  padding: 16px 20px;
}

.card-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.card-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
}

.card-picker-item:hover {
  border-color: var(--accent-muted);
}

.card-picker-item.active {
  background: var(--surface-3);
  border-color: var(--accent-dim);
}

.card-picker-item.active:hover {
  border-color: var(--accent-muted);
}

.card-picker-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-3);
  color: var(--text-tertiary);
}

.card-picker-item.active .card-picker-icon {
  background: var(--accent-subtle);
  color: var(--accent-primary);
}

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

.card-picker-info {
  flex: 1;
  min-width: 0;
}

.card-picker-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.card-picker-item.active .card-picker-name {
  color: var(--text-primary);
}

.card-picker-desc {
  font-size: 10.5px;
  color: var(--text-tertiary);
  line-height: 1.3;
}

.card-picker-status {
  flex-shrink: 0;
}

/* ── Stat cards in dashboard grid ──────────────────────── */
.dashboard-grid > .stat-card {
  margin-bottom: 0;
}

/* ── Catalog card placeholder icon ─────────────────────── */
.catalog-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--text-tertiary);
}

.catalog-card-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Notification Rows ────────────────────────────────────  */
.notification-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.1s;
}
.notification-row:hover {
  background: var(--surface-3);
}
.notification-row > svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.15s;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Responsive ──────────────────────────────────────────  */
@media (max-width: 1024px) {
  .ddns-how-strip {
    flex-direction: column;
    gap: 10px;
  }
}
@media (max-width: 768px) {
  .ddns-type-toggle {
    flex-direction: column;
  }
  .ddns-targets {
    flex-direction: column;
  }
}
