/* =========================================================
   IdraPilot Admin — Design System 2026 v2 (Light Mode)
   Basato su Figma: sidebar scura, contenuto light, blu primario
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  /* Content background */
  --bg:          #F5F6FA;
  --bg-card:     #FFFFFF;
  --bg-card-hov: #F8F9FC;
  --bg-input:    #F1F3F9;

  /* Borders */
  --border:      #E4E7EF;
  --border-hov:  #C8CEDF;

  /* Text */
  --text:        #1A1F36;
  --text-muted:  #6B7690;
  --text-dim:    #9BA5BF;
  --text-ghost:  #C5CADC;

  /* Brand / Primary */
  --primary:        #4F6BF4;
  --primary-hover:  #3D58E0;
  --primary-light:  rgba(79,107,244,0.10);
  --primary-border: rgba(79,107,244,0.25);
  --brand-grad:     linear-gradient(135deg, #4F6BF4, #7C3AED);

  /* Sidebar (dark) */
  --sidebar-w:    240px;
  --sidebar-bg:   #111827;
  --sidebar-border: rgba(255,255,255,0.07);
  --sidebar-text:   #9CA3AF;
  --sidebar-active-bg:  rgba(79,107,244,0.15);
  --sidebar-active-col: #818CF8;

  /* Status colors */
  --green:   #10B981;
  --yellow:  #F59E0B;
  --red:     #EF4444;
  --blue:    #3B82F6;
  --purple:  #8B5CF6;
  --pink:    #EC4899;
  --orange:  #F97316;
  --sky:     #0EA5E9;

  /* Rounding */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   18px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px var(--border);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px var(--border);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.10), 0 0 0 1px var(--border);

  /* Transitions */
  --ease: 0.18s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hov); }

/* ── Layout ───────────────────────────────────────────────── */
.wrap { display: flex; min-height: 100vh; align-items: stretch; }

/* ── Sidebar (dark) ───────────────────────────────────────── */
aside {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: clip;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { color: white; }
.sidebar-logo-name {
  font-size: 0.925rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.02em;
  flex: 1;
}
.sidebar-logo-name span { color: #818CF8; }

/* Sidebar toggle */
.sidebar-toggle {
  width: 24px; height: 24px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--sidebar-text);
  flex-shrink: 0;
  margin-left: auto;
  transition: all var(--ease);
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.12); color: white; }
.sidebar-toggle svg { transition: transform var(--ease); }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 8px 0;
  display: flex;
  flex-direction: column;
}
.nav-section { margin-bottom: 2px; }
.nav-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 14px 10px 5px;
  display: block;
}
.nav-a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  color: var(--sidebar-text);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--ease);
  margin-bottom: 2px;
  position: relative;
}
.nav-a svg { flex-shrink: 0; opacity: 0.55; transition: opacity var(--ease); }
.nav-a:hover { background: rgba(255,255,255,0.06); color: #E5E7EB; }
.nav-a:hover svg { opacity: 0.85; }
.nav-a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-col);
  font-weight: 600;
}
.nav-a.active svg { opacity: 1; color: var(--sidebar-active-col); }
.nav-a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--sidebar-active-col);
}
.nav-a.nav-danger { color: #FCA5A5; }
.nav-a.nav-danger:hover { background: rgba(239,68,68,0.1); }

/* Footer user chip */
.sidebar-footer {
  padding: 10px 8px 14px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  margin-top: auto;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.04);
}
.sidebar-avatar {
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.625rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-size: 0.75rem; font-weight: 700; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.6rem; color: var(--sidebar-text); }

/* ── Main area ────────────────────────────────────────────── */
.main { flex: 1; overflow: auto; display: flex; flex-direction: column; min-width: 0; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 13px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-title svg { color: var(--text-muted); }
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.topbar-breadcrumb a { color: var(--text-muted); transition: color var(--ease); }
.topbar-breadcrumb a:hover { color: var(--primary); }
.topbar-breadcrumb .sep { color: var(--text-ghost); }
.topbar-breadcrumb .current { color: var(--text); font-weight: 600; }
.topbar-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Content ──────────────────────────────────────────────── */
.content { padding: 24px 24px; flex: 1; }
.content-narrow { max-width: 780px; }

/* ── KPI Grid ─────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  transition: all var(--ease);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi:hover {
  border-color: var(--border-hov);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kpi-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.kpi-val {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 3px;
  color: var(--text);
}
.kpi-lbl {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi-trend {
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.kpi-clickable { cursor: pointer; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-hdr {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
}
.card-ttl {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-ttl svg { color: var(--text-muted); }
.card-body { padding: 20px; }
.card-sub { font-size: 0.7rem; color: var(--text-muted); }

/* Glow card — highlight sections */
.glow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.glow-card-inner { padding: 20px; }

/* Colored top-border variation */
.card-accent-blue  { border-top: 3px solid var(--primary); }
.card-accent-green { border-top: 3px solid var(--green); }
.card-accent-red   { border-top: 3px solid var(--red); }
.card-accent-yellow{ border-top: 3px solid var(--yellow); }

/* ── Chart Cards ──────────────────────────────────────────── */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(200px, 260px);
  gap: 12px;
  margin-bottom: 20px;
}
.chart-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.chart-title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 16px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #F8F9FC;
}
tbody td {
  padding: 11px 16px;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #F8F9FD; }
.td-name { font-weight: 600; color: var(--text); }
.td-sub { font-size: 0.6875rem; color: var(--text-muted); margin-top: 2px; }
.td-small { font-size: 0.75rem; color: var(--text-muted); }
.empty-row td { text-align: center; color: var(--text-muted); padding: 32px; font-size: 0.875rem; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
/* Status badges — light style */
.s-active    { background: #DCFCE7; color: #15803D; }
.s-trial     { background: #FEF3C7; color: #B45309; }
.s-suspended { background: #FEE2E2; color: #B91C1C; }
.s-cancelled { background: #F1F5F9; color: #64748B; }
.s-paid      { background: #DCFCE7; color: #15803D; }
.s-pending   { background: #FEF3C7; color: #B45309; }
.s-failed    { background: #FEE2E2; color: #B91C1C; }
.s-refunded  { background: #EDE9FE; color: #6D28D9; }
.s-bozza     { background: #F1F5F9; color: #64748B; }
.s-emessa    { background: #DBEAFE; color: #1D4ED8; }
.s-pagata    { background: #DCFCE7; color: #15803D; }
.s-annullata { background: #FEE2E2; color: #B91C1C; }

.plan-trial        { color: var(--yellow); font-weight: 700; }
.plan-active       { color: var(--primary); font-weight: 700; }
.plan-starter      { color: var(--blue); }
.plan-professional { color: var(--purple); }
.plan-enterprise   { color: var(--green); }

/* Trend badge */
.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 700;
}
.trend-up { background: #DCFCE7; color: #15803D; }
.trend-dn { background: #FEE2E2; color: #B91C1C; }

/* Days chip */
.days-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 700;
}
.days-red    { background: #FEE2E2; color: #B91C1C; }
.days-yellow { background: #FEF3C7; color: #B45309; }
.days-green  { background: #DCFCE7; color: #15803D; }

/* Upgrade pill */
.upgrade-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 600;
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

/* Status chip */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.chip-ok   { background: #DCFCE7; color: #15803D; }
.chip-warn { background: #FEF3C7; color: #B45309; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  transition: all var(--ease);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 2px rgba(79,107,244,0.3);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(79,107,244,0.35); transform: translateY(-1px); }

.btn-sm {
  padding: 5px 12px;
  border-radius: var(--r-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.btn-sm:hover { background: var(--bg); color: var(--text); border-color: var(--border-hov); }

.btn-pay      { background: #DCFCE7; color: #15803D; border-color: #BBF7D0; }
.btn-pay:hover { background: #BBF7D0; border-color: #86EFAC; }
.btn-invoice  { background: #DBEAFE; color: #1D4ED8; border-color: #BFDBFE; }
.btn-invoice:hover { background: #BFDBFE; border-color: #93C5FD; }
.btn-suspend  { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }
.btn-suspend:hover { background: #FECACA; border-color: #FCA5A5; }
.btn-reactivate { background: #DCFCE7; color: #15803D; border-color: #BBF7D0; }
.btn-reactivate:hover { background: #BBF7D0; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-save {
  padding: 10px 24px;
  background: var(--primary);
  border: none;
  border-radius: var(--r-md);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
  box-shadow: 0 1px 2px rgba(79,107,244,0.3);
}
.btn-save:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,107,244,0.35); }
.btn-test {
  padding: 10px 20px;
  background: #DCFCE7;
  border: 1px solid #BBF7D0;
  border-radius: var(--r-md);
  color: #15803D;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
}
.btn-test:hover { background: #BBF7D0; }
.btn-test:disabled { opacity: 0.4; cursor: not-allowed; }

/* New Tenant / primary action button */
.btn-new-tenant {
  background: var(--primary);
  color: white;
  padding: 7px 16px;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--ease);
  text-decoration: none;
}
.btn-new-tenant:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,107,244,0.3); }

/* Link style */
.link { color: var(--primary); font-weight: 500; transition: color var(--ease); }
.link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ── Forms ────────────────────────────────────────────────── */
label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-ghost); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,107,244,0.12);
}
select option { background: white; color: var(--text); }
.form-hint { font-size: 0.6875rem; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-row-3 { grid-template-columns: 2fr 1fr 1fr; }
.form-group { margin-bottom: 16px; }

/* ── Command Bar ─────────────────────────────────────────── */
.command-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.command-search {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.command-search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.command-search input {
  padding-left: 36px;
  background: var(--bg-card);
}

/* Filter pills */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--ease);
  text-decoration: none;
}
.filter-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border-hov); }
.filter-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
  font-weight: 600;
}

/* ── Tab switcher ─────────────────────────────────────────── */
.tab-group { display: flex; gap: 4px; }
.stat-tab {
  padding: 5px 13px;
  border-radius: var(--r-md);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--ease);
}
.stat-tab:hover { background: var(--bg); color: var(--text); }
.stat-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  font-weight: 600;
}

/* ── Progress Bar ─────────────────────────────────────────── */
.progress-bar-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-ok   { background: #F0FDF4; border: 1px solid #BBF7D0; color: #15803D; }
.alert-warn { background: #FFFBEB; border: 1px solid #FDE68A; color: #B45309; }
.alert-err  { background: #FEF2F2; border: 1px solid #FECACA; color: #B91C1C; }

/* ── Section title ────────────────────────────────────────── */
.section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Dashboard table tab system ───────────────────────────── */
.col-base, .col-operativo, .col-finanziario { display: none; }
.show-base .col-base, .show-operativo .col-operativo, .show-finanziario .col-finanziario { display: table-cell; }
.col-always { display: table-cell !important; }

/* ── Toast ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 17px;
  background: var(--text);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  font-size: 0.8125rem;
  font-weight: 500;
  color: white;
  max-width: 340px;
  animation: toast-in 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
  pointer-events: auto;
}
.toast.hiding { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ── Progress Ring ────────────────────────────────────────── */
.progress-ring-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.progress-ring-label {
  position: absolute;
  font-size: 0.6875rem;
  font-weight: 800;
  text-align: center;
  color: var(--text);
}

/* ── SMTP / Settings ──────────────────────────────────────── */
.test-box {
  margin-top: 20px;
  padding: 18px;
  background: #F8F9FC;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.test-box-ttl { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.test-row { display: flex; gap: 12px; align-items: flex-end; }
.test-row > div { flex: 1; }
.test-result { margin-top: 14px; padding: 12px; border-radius: var(--r-md); font-size: 0.8125rem; display: none; }
.test-result.ok   { background: #F0FDF4; border: 1px solid #BBF7D0; color: #15803D; }
.test-result.fail { background: #FEF2F2; border: 1px solid #FECACA; color: #B91C1C; }
.log-pre { margin-top: 10px; background: #1E1E2E; border-radius: var(--r-sm); padding: 10px; font-size: 0.6875rem; font-family: monospace; color: #94A3B8; max-height: 200px; overflow: auto; white-space: pre-wrap; }

/* ── Quick preset buttons ─────────────────────────────────── */
.preset-group { display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.preset-btn {
  padding:3px 10px;
  border-radius:var(--r-full);
  font-size:0.6875rem;
  font-weight:600;
  background: var(--bg);
  border:1px solid var(--border);
  color: var(--text-muted);
  cursor:pointer;
  transition: all var(--ease);
}
.preset-btn:hover { background:var(--primary-light); color:var(--primary); border-color:var(--primary-border); }

/* ── Actions row ─────────────────────────────────────────── */
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Sidebar collapsed state ──────────────────────────────── */
.wrap.sidebar-collapsed aside { width: 60px; }
.wrap.sidebar-collapsed .nav-label,
.wrap.sidebar-collapsed .sidebar-logo-name,
.wrap.sidebar-collapsed .sidebar-user-info,
.wrap.sidebar-collapsed .nav-a span { display: none; }
.wrap.sidebar-collapsed .nav-a { justify-content: center; padding: 8px; }
.wrap.sidebar-collapsed .nav-a.active::before { display: none; }
.wrap.sidebar-collapsed .sidebar-logo { justify-content: center; padding: 18px 0; }
.wrap.sidebar-collapsed .sidebar-user { justify-content: center; }
.wrap.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .chart-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
  .chart-row-2 { grid-template-columns: 1fr; }
  aside { width: 60px; }
  .nav-label, .sidebar-logo-name, .sidebar-user-info, .nav-a span { display: none; }
  .nav-a { justify-content: center; padding: 8px; }
  .sidebar-logo { justify-content: center; }
}

/* ── Sidebar aliases (compatibiltà _sidebar.php) ─────────── */
.nav-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 14px 10px 5px;
  display: block;
}
.nav-label-text { display: inline; /* testo span nei nav link */ }
.wrap.sidebar-collapsed .nav-label-text { display: none; }

.card.full { width: 100%; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
