/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.btn:hover:not(:disabled) {
  filter: brightness(1.08);
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.45;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-success {
  background: var(--success);
  color: #0b1f0f;
}
.btn-danger {
  background: var(--danger);
  color: #2a0d0d;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
}
.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}
.btn-icon {
  width: 38px;
  padding: 0;
}

/* ---------- Inputs ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.input,
.select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder {
  color: var(--text-disabled);
}
.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* ---------- Stat tiles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.stat-tile-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-tile-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-tile-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-success {
  background: var(--success-soft);
  color: var(--success);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.status-dot.connecting {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 340px;
  max-width: calc(100vw - 32px);
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-elevated);
  font-size: 13px;
  animation: toast-in var(--dur-base) var(--ease);
}
.toast-title {
  font-weight: 700;
  margin-bottom: 2px;
}
.toast-body {
  color: var(--text-secondary);
  font-size: 12px;
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Placeholder de modulo pendiente ---------- */
.placeholder-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  text-align: center;
}
.placeholder-view svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
  margin-bottom: 6px;
}
.placeholder-view h2 {
  font-size: 16px;
  color: var(--text-secondary);
}

/* ---------- Utilidades ---------- */
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ---------- Campana de notificaciones (topbar) ---------- */
.notif-bell-wrap {
  position: relative;
}
.notif-bell-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.notif-bell-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.notif-bell-btn svg {
  width: 18px;
  height: 18px;
}
.notif-bell-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  z-index: 300;
  overflow: hidden;
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}
.notif-list {
  max-height: 360px;
  overflow-y: auto;
}
.notif-row {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}
.notif-row:last-child {
  border-bottom: none;
}
.notif-row .icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-row .icon svg {
  width: 13px;
  height: 13px;
}
.notif-row.connect .icon { background: var(--success-soft); color: var(--success); }
.notif-row.disconnect .icon { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.notif-row.plugin_loaded .icon { background: var(--accent-soft); color: var(--accent); }
.notif-row.plugin_unloaded .icon { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.notif-row.warning .icon { background: var(--warning-soft); color: var(--warning); }
.notif-row.error .icon,
.notif-row.exception .icon { background: var(--danger-soft); color: var(--danger); }
.notif-row .body {
  flex: 1;
  min-width: 0;
}
.notif-row .text {
  color: var(--text-primary);
  word-break: break-word;
}
.notif-row .ts {
  color: var(--text-disabled);
  font-size: 10.5px;
  margin-top: 2px;
}
.notif-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
