/**
 * ============================================================
 * Domotica Feroby v2.0 — BMS Core
 * ============================================================
 * @file        public/css/components.css
 * @version     1.0.0
 * @date        2026-09-08
 * @author      Feroby
 * @copyright   Copyright (c) 2026 Feroby. All rights reserved.
 * ------------------------------------------------------------
 * DESCRIZIONE:
 *   Libreria di componenti UI riutilizzabili. Ogni componente
 *   usa esclusivamente i token del design-system.css.
 *   Incluso dopo design-system.css.
 * ------------------------------------------------------------
 * COMPONENTI:
 *   - Card (base, hover, glow, full-off overlay)
 *   - Badge (status, season, alert)
 *   - Button (primary, secondary, danger, icon, pill)
 *   - Toggle switch
 *   - Input, Select, Range slider
 *   - Pill selector (season/mode selector)
 *   - Navigation: sidebar item, bottom nav item
 *   - Modal / Drawer
 *   - Toast notification
 *   - Gauge circolare (CSS only)
 *   - Progress bar
 *   - Topbar strip
 *   - Alert banner (warning, all-manual)
 * ------------------------------------------------------------
 * SCOPO:
 *   Garantire coerenza visiva in tutta l'applicazione BMS.
 *   Zero dipendenze da framework esterni (no Tailwind, no Bootstrap).
 * ------------------------------------------------------------
 * CHANGELOG:
 *   1.0.0 — 2026-09-08 — Creazione iniziale
 * ============================================================
 */

/* ─────────────────────────────────────────────────────────
   CARD
   ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition-base);
  background: linear-gradient(135deg, rgba(79, 142, 247, 0.04) 0%, rgba(6, 182, 212, 0.02) 100%);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card:hover::before {
  opacity: 1;
}

.card-sm {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
}

.card-lg {
  padding: var(--space-8);
}

/* Card con glow colorato */
.card.glow-blue {
  border-color: rgba(79, 142, 247, 0.3);
  box-shadow: var(--shadow-glow-blue);
}

.card.glow-green {
  border-color: rgba(34, 197, 94, 0.3);
  box-shadow: var(--shadow-glow-green);
}

.card.glow-amber {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: var(--shadow-glow-amber);
}

.card.glow-red {
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: var(--shadow-glow-red);
}

/* Card cliccabile */
.card-clickable {
  cursor: pointer;
  user-select: none;
}

/* Overlay Full OFF */
.card.full-off {
  opacity: 0.45;
  pointer-events: none;
}

.card.full-off::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(239, 68, 68, 0.04);
  border-radius: inherit;
}

/* Card header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ─────────────────────────────────────────────────────────
   BADGE
   ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2em 0.65em;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-blue {
  background: rgba(79, 142, 247, 0.15);
  color: var(--accent-blue-light);
  border: 1px solid rgba(79, 142, 247, 0.25);
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-purple {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-grey {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Badge stagione */
.badge-inverno {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-estate {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.badge-interstagione {
  background: rgba(134, 239, 172, 0.12);
  color: #86efac;
  border: 1px solid rgba(134, 239, 172, 0.25);
}

.badge-full-off {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: pulseGlowAmber 2s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────────────
   BUTTON
   ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-lg);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Ripple effect */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition-fast);
}

.btn:active::after {
  background: rgba(255, 255, 255, 0.08);
}

/* Varianti */
.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(79, 142, 247, 0.35);
}

.btn-primary:hover {
  background: var(--accent-blue-light);
  border-color: var(--accent-blue-light);
  box-shadow: 0 4px 16px rgba(79, 142, 247, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--accent-red-dark);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--accent-green);
  color: #0a0e14;
  border-color: var(--accent-green);
}

.btn-success:hover {
  background: var(--accent-green-dark);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Dimensioni */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-3) var(--space-8);
  font-size: var(--text-base);
}

.btn-icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
}

.btn-icon-lg {
  padding: var(--space-3);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
}

/* ─────────────────────────────────────────────────────────
   TOGGLE SWITCH
   ───────────────────────────────────────────────────────── */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  display: none;
}

.toggle-track {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition-spring), background var(--transition-base);
}

.toggle-input:checked+.toggle-track {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow-blue);
}

.toggle-input:checked+.toggle-track .toggle-thumb {
  transform: translateX(22px);
  background: #fff;
}

/* Toggle varianti colori */
.toggle-green .toggle-input:checked+.toggle-track {
  background: var(--accent-green);
  border-color: var(--accent-green);
  box-shadow: var(--shadow-glow-green);
}

.toggle-amber .toggle-input:checked+.toggle-track {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
  box-shadow: var(--shadow-glow-amber);
}

.toggle-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.toggle-input:checked~.toggle-label {
  color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────
   PILL SELECTOR (Season / Mode)
   ───────────────────────────────────────────────────────── */
.pill-group {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.pill-item {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.pill-item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.pill-item.active-inverno {
  background: var(--accent-sky);
  color: #0a0e14;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.pill-item.active-estate {
  background: #fb923c;
  color: #0a0e14;
  box-shadow: 0 2px 8px rgba(251, 146, 60, 0.4);
}

.pill-item.active-inter {
  background: var(--accent-green);
  color: #0a0e14;
}

.pill-item.active-off {
  background: var(--accent-red);
  color: #fff;
  animation: pulseGlowAmber 2s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────────────
   FAN SPEED SELECTOR
   ───────────────────────────────────────────────────────── */
.speed-selector {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.speed-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.speed-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: var(--shadow-glow-blue);
}

.speed-btn.speed-off.active {
  background: var(--bg-elevated);
  border-color: var(--text-muted);
  color: var(--text-secondary);
  box-shadow: none;
}

/* ─────────────────────────────────────────────────────────
   INPUT / SELECT / RANGE
   ───────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237d8590' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}

/* Range slider */
.form-range {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  outline: none;
  appearance: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  box-shadow: var(--shadow-glow-blue);
  transition: transform var(--transition-fast);
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ─────────────────────────────────────────────────────────
   NAVIGATION — SIDEBAR
   ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  gap: var(--space-3);
}

.sidebar-logo-img {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 0 var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font);
  width: 100%;
}

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

.nav-item.active {
  background: rgba(79, 142, 247, 0.12);
  color: var(--accent-blue);
  border-color: rgba(79, 142, 247, 0.2);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent-blue);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(79, 142, 247, 0.5);
}

.nav-icon {
  font-size: 1.1em;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.sidebar-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

/* ─────────────────────────────────────────────────────────
   NAVIGATION — BOTTOM NAV (Mobile)
   ───────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: var(--z-sticky);
  backdrop-filter: blur(12px);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  text-decoration: none;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: color var(--transition-fast);
  position: relative;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font);
}

.bottom-nav-item:hover {
  color: var(--text-secondary);
}

.bottom-nav-item.active {
  color: var(--accent-blue);
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent-blue);
  border-radius: 0 0 2px 2px;
  box-shadow: 0 0 8px rgba(79, 142, 247, 0.5);
}

.bottom-nav-icon {
  font-size: 1.3em;
}

/* ─────────────────────────────────────────────────────────
   TOPBAR (Status Strip)
   ───────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  backdrop-filter: blur(12px);
}

.topbar-status-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
}

.topbar-status-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
}

.topbar-status-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.topbar-status-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-status-value.ok {
  color: var(--accent-green);
}

.topbar-status-value.warning {
  color: var(--accent-amber);
}

.topbar-status-value.error {
  color: var(--accent-red);
}

.topbar-divider {
  width: 1px;
  height: 30px;
  background: var(--border);
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   MODAL / DRAWER
   ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.25s ease;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font);
}

.modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Drawer (slide from bottom su mobile) */
.drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: var(--space-6);
  z-index: var(--z-modal);
  max-height: 85vh;
  overflow-y: auto;
  animation: slideInFromBottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-xl);
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.drawer-handle {
  width: 40px;
  height: 4px;
  background: var(--border-hover);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-6);
}

/* ─────────────────────────────────────────────────────────
   TOAST NOTIFICATION
   ───────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 360px;
}

@media (min-width: 769px) {
  .toast-container {
    bottom: var(--space-6);
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: slideInLeft 0.3s ease;
  cursor: pointer;
}

.toast-icon {
  font-size: 1.2em;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.toast-msg {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
}

.toast.toast-warning {
  border-color: rgba(245, 158, 11, 0.4);
}

.toast.toast-success {
  border-color: rgba(34, 197, 94, 0.4);
}

.toast.toast-info {
  border-color: rgba(79, 142, 247, 0.4);
}

/* ─────────────────────────────────────────────────────────
   PROGRESS BAR
   ───────────────────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-blue);
  transition: width 0.5s ease;
}

.progress-bar.green {
  background: var(--accent-green);
}

.progress-bar.amber {
  background: var(--accent-amber);
}

.progress-bar.red {
  background: var(--accent-red);
}

.progress-bar.gradient {
  background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-amber) 70%, var(--accent-red) 100%);
}

/* ─────────────────────────────────────────────────────────
   ALERT BANNER
   ───────────────────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid;
}

.alert-banner-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--accent-amber);
}

.alert-banner-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.alert-banner-info {
  background: rgba(79, 142, 247, 0.1);
  border-color: rgba(79, 142, 247, 0.3);
  color: var(--accent-blue);
}

/* ALL-MANUAL banner — triangolo + testo */
.all-manual-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: pulseGlowAmber 3s ease-in-out infinite;
}

.all-manual-icon {
  font-size: 1.4em;
  flex-shrink: 0;
}

.all-manual-text {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─────────────────────────────────────────────────────────
   DATA DISPLAY
   ───────────────────────────────────────────────────────── */
.metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.metric-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.metric-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.metric-value.green {
  color: var(--accent-green);
}

.metric-value.amber {
  color: var(--accent-amber);
}

.metric-value.red {
  color: var(--accent-red);
}

.metric-value.blue {
  color: var(--accent-blue);
}

.metric-unit {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 0.15em;
}

/* ─────────────────────────────────────────────────────────
   TAB SELECTOR
   ───────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-item {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border-top: none;
  border-left: none;
  border-right: none;
  background: transparent;
  font-family: var(--font);
}

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

.tab-item.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  font-weight: 600;
}

/* ─────────────────────────────────────────────────────────
   SEPARATOR / SECTION HEADER
   ───────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-title-sm {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─────────────────────────────────────────────────────────
   LOADING / SPINNER
   ───────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-hover);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
}