:root {
  /* Palette */
  --bg:            #f1f5f9;            /* slate-100, leggermente piu freddo */
  --bg-gradient:   linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  --surface:       #ffffff;
  --surface-2:     #f3f4f6;
  --surface-hover: #f9fafb;
  --fg:            #0f172a;            /* slate-900 */
  --muted:         #64748b;            /* slate-500 */
  --border:        #e2e8f0;            /* slate-200 - piu morbido */
  --border-strong: #cbd5e1;
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --accent-soft:   #eff6ff;
  --danger:        #dc2626;
  --warning:       #d97706;
  --success:       #16a34a;
  /* Shadows */
  --shadow-sm:     0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow:        0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:     0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:     0 10px 30px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.05);
  /* Geometria */
  --radius:        8px;
  --radius-sm:     6px;
  --radius-lg:     12px;
  /* Motion */
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast:        120ms;
  --t-norm:        180ms;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--fg);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--accent-hover); }

/* Selezione testo */
::selection { background: rgba(37,99,235,0.18); color: var(--fg); }

/* ─── SIDEBAR (id=#topbar mantenuto per retro-compat) ─────── */
#topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  width: 240px;
  flex-shrink: 0;
  padding: 20px 16px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}
#topbar .brand {
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  padding: 4px 8px 12px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(135deg, #60a5fa, #c4b5fd);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
#topbar .brand strong { color: #fff; }
#topbar .evento-current {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
}
#topbar .evento-current .label {
  color: rgba(255,255,255,0.55);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}
#topbar .evento-current #evento-label {
  font-weight: 600;
  font-size: 14px;
  color: #f8fafc;
  word-break: break-word;
}
#topbar .evento-current #btn-switch-evento {
  align-self: flex-end;
  margin-top: -22px;
}
/* Nav verticale */
#topbar .user {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  flex: 1;     /* spinge il menu utente in fondo */
  color: rgba(255,255,255,0.7);
}

/* Ripristina il comportamento dell'attributo HTML `hidden` per gli ID con
   `display:flex` (la specificity ID-selector vince su quella di [hidden] di
   default, quindi senza questa regola la topbar resterebbe visibile). */
[hidden] { display: none !important; }

/* ─── MAIN ─────────────────────────────────────────────────── */
#view {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
  width: 100%;
}

/* ─── BUTTONS ──────────────────────────────────────────────── */
button {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  box-shadow: var(--shadow-sm);
}
button:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--accent); color: var(--accent); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.25); border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
button.primary {
  background: linear-gradient(180deg, #3b82f6 0%, var(--accent) 100%);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37,99,235,0.25), 0 2px 4px rgba(37,99,235,0.18);
}
button.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-color: var(--accent-hover);
  color: #fff;
}
button.link {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--accent);
  text-decoration: none;
  font-size: inherit;
  font-weight: 500;
  box-shadow: none;
}
button.link:hover { background: transparent; color: var(--accent-hover); text-decoration: underline; }
button.danger-link, .danger-link { color: var(--danger); }
button.danger-link:hover, .danger-link:hover { color: #991b1b; }

/* ─── FORMS ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
input, select, textarea {
  font: inherit;
  color: var(--fg);
}
.field input, .field select, .field textarea,
input[type="text"], input[type="number"], input[type="date"], input[type="email"],
input[type="password"], input[type="datetime-local"], textarea, select {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.field input:hover, .field select:hover, .field textarea:hover,
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
.field input:focus, .field select:focus, .field textarea:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--surface-2); color: var(--muted); cursor: not-allowed;
}
.checkbox-inline { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.checkbox-inline input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ─── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--t-norm) var(--ease), transform var(--t-norm) var(--ease);
}

/* ─── LOGIN ────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 48px);
}
.login-card {
  width: 360px;
  max-width: 100%;
}
.login-card h1 { margin: 0 0 4px 0; color: var(--accent); font-size: 22px; }
.login-card .subtitle { color: var(--muted); margin-bottom: 24px; font-size: 13px; }
.login-card .error {
  background: #fee2e2;
  color: var(--danger);
  padding: 10px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
}

/* ─── EVENT PICKER ─────────────────────────────────────────── */
.picker-header { margin-bottom: 24px; }
.picker-header h1 { margin: 0 0 4px 0; color: var(--accent); font-size: 22px; }
.picker-header .subtitle { color: var(--muted); font-size: 13px; }

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.event-card {
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s, box-shadow 0.1s;
}
.event-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(37,99,235,0.12);
}
.event-card h2 { margin: 0 0 4px 0; font-size: 16px; color: var(--fg); }
.event-card .codice {
  display: inline-block;
  background: var(--surface-2);
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.event-card .stats {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}
.event-card .stats strong { color: var(--fg); font-size: 14px; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

/* ─── HOME PLACEHOLDER ─────────────────────────────────────── */
.home-card h1 { margin-top: 0; }
.home-card .placeholder {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.home-card .placeholder .item {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* ─── PAGE TITLE / SECTION TITLE ───────────────────────────── */
.page-title {
  margin: 0 0 16px 0;
  font-size: 22px;
  color: var(--accent);
}
.section-title {
  margin: 0 0 12px 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

/* ─── FILTERS GRID ─────────────────────────────────────────── */
.filters-card { margin-bottom: 16px; }
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.filters-grid .field { margin-bottom: 0; }
.filters-grid small.muted { color: var(--muted); font-size: 11px; margin-top: 2px; }
.filters-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: flex-end; }

/* ─── DATA TABLE ───────────────────────────────────────────── */
.results-card { margin-bottom: 16px; }
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}
.results-meta { color: var(--muted); font-size: 13px; }

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  overflow: hidden;
  border-radius: var(--radius);
}
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr { transition: background var(--t-fast) var(--ease); }
.data-table tbody tr.row-clickable { cursor: pointer; }
.data-table tbody tr.row-clickable:hover { background: var(--accent-soft); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.row-deleted td { color: var(--muted); text-decoration: line-through; }
.data-table .main-cell .primary-text { color: var(--fg); font-weight: 500; }
.data-table .main-cell .secondary-text {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Wrapper: tabella scorrevole orizzontalmente su schermi piccoli */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─── PAGER ────────────────────────────────────────────────── */
.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 12px 0 4px 0;
}
.pager-info { color: var(--muted); font-size: 13px; }

/* ─── BADGE ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
  border: 1px solid transparent;
}
.badge-sponsor { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge-ok      { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.badge-deleted { background: #fee2e2; color: var(--danger); border-color: #fecaca; }
/* Tipo partecipazione: E (Espositore) verde · V (Visitatore) blu — compatti */
.badge-tipo-e { background: #16a34a; color: #fff; border-color: #15803d; min-width: 22px; justify-content: center; }
.badge-tipo-v { background: #2563eb; color: #fff; border-color: #1d4ed8; min-width: 22px; justify-content: center; }

/* ─── AZIENDA DETAIL ───────────────────────────────────────── */
.detail-toolbar { margin-bottom: 12px; }
.detail-header { margin-bottom: 12px; }
.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title h1 { margin: 0; font-size: 22px; }
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 12px;
}
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.meta-value { font-size: 14px; color: var(--fg); }

.tab-strip {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tab:hover { background: var(--surface-2); color: var(--fg); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
  background: transparent;
}
.tab-body {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Key-value grid per anagrafica.
   Ogni riga e una "cella" della griglia con label SOPRA e valore SOTTO, cosi
   l accoppiata etichetta+valore non puo mai essere spezzata fra due righe. */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px 24px;
  align-items: start;
}
.kv-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 6px;
  border-bottom: 1px dotted var(--border);
  min-width: 0;        /* permette al testo lungo di andare a capo */
}
.kv-row .kv-key {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
}
.kv-row .kv-val {
  font-size: 14px;
  color: var(--fg);
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.kv-section {
  grid-column: 1 / -1;
  margin: 16px 0 4px 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.kv-full {
  grid-column: 1 / -1;
  white-space: pre-wrap;
  background: var(--surface-2);
  padding: 10px;
  border-radius: var(--radius);
}

/* ─── ESITO TAB ────────────────────────────────────────────── */
.esito-list { display: flex; flex-direction: column; gap: 10px; }
.esito-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.esito-row-head {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 12px;
  align-items: center;
}
.esito-edizione { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.esito-stato { display: flex; align-items: center; gap: 8px; }
.esito-pill {
  color: #fff;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.esito-actions { display: flex; gap: 12px; }
.esito-row-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.esito-row-note {
  margin-top: 8px;
  white-space: pre-wrap;
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
}

/* Dropdown "+ Aggiungi esito/scheda per edizione" in fondo ai tab */
.esito-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px 0;
  border-top: 1px dashed var(--border);
  margin-top: 8px;
}
.esito-add select { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); }

/* Form inline esito (e altri tab futuri) */
.esito-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.form-grid .field { margin-bottom: 0; }
.form-grid .field-wide { grid-column: 1 / -1; }
.form-grid .field-check {
  display: flex;
  align-items: flex-end;
  padding-bottom: 8px;
}
.form-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

button.link.danger-link { color: var(--danger); }
button.link.danger-link:hover { color: #991b1b; }

/* ─── COMMERCIALE TAB ─────────────────────────────────────── */
.comm-tab { display: flex; flex-direction: column; gap: 16px; }
.comm-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.comm-toolbar .muted { margin-left: auto; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }

.comm-form { padding: 16px; border: 2px solid var(--accent); }
.comm-form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
}

.comm-timeline { display: flex; flex-direction: column; gap: 8px; }
.comm-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: flex-start;
}
.comm-row-pending { border-left: 4px solid var(--accent); }

.comm-row-date {
  text-align: center;
  border-right: 1px solid var(--border);
  padding-right: 12px;
}
.comm-date-day  { font-weight: 600; font-size: 13px; color: var(--fg); }
.comm-date-time { font-size: 11px;  color: var(--muted); }

.comm-row-head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.comm-row-who { font-size: 13px; margin-bottom: 4px; }
.comm-row-note {
  font-size: 13px;
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: var(--radius);
  white-space: pre-wrap;
}
.comm-row-foot { font-size: 11px; margin-top: 4px; }
.comm-row-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.comm-tipo {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--fg);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.comm-tipo-chiamata { background: #dbeafe; color: #1e40af; }
.comm-tipo-email    { background: #e0e7ff; color: #4338ca; }
.comm-tipo-visita   { background: #d1fae5; color: #065f46; }
.comm-tipo-whatsapp { background: #d1fae5; color: #065f46; }
.comm-tipo-altro    { background: #f3f4f6; color: #374151; }
.comm-esito {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 6px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* ─── REFERENTI TAB ───────────────────────────────────────── */
.ref-tab { display: flex; flex-direction: column; gap: 16px; }
.ref-list { display: flex; flex-direction: column; gap: 8px; }
.ref-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ref-row:hover { background: #f0f9ff; }
.ref-row-expanded {
  display: block;
  cursor: default;
  border: 2px solid var(--accent);
}
.ref-row-expanded:hover { background: var(--surface); }
.ref-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ref-row-main { display: flex; align-items: center; gap: 8px; }
.ref-row-meta { display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }

.ref-form-card { padding: 16px; border: 2px solid var(--accent); margin-bottom: 16px; }
.ref-detail .form-grid { margin-bottom: 16px; }

.recapiti-list { display: flex; flex-direction: column; gap: 6px; }
.recapito-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.recapito-new {
  background: transparent;
  border: 1px dashed var(--border);
  justify-content: flex-start;
}
.recapito-main { display: flex; align-items: center; gap: 8px; flex: 1; }
.recapito-meta { color: var(--muted); font-size: 12px; }
.recapito-actions { display: flex; gap: 8px; }
.recapito-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}
.recapito-form input, .recapito-form select {
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.recapito-form input[name="valore"] { flex: 1; min-width: 140px; }
.recapito-form input[name="etichetta"] { width: 120px; }
.recapito-form .checkbox-inline { font-size: 12px; }

/* ─── MERCEOLOGIA TAB ─────────────────────────────────────── */
.merc-tab { display: flex; flex-direction: column; gap: 12px; }
.merc-add { display: flex; align-items: center; gap: 8px; }
.merc-list { display: flex; flex-direction: column; gap: 6px; }
.merc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.merc-row-main { border-left: 4px solid var(--success); background: #f0fdf4; }
.merc-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.merc-actions { display: flex; gap: 12px; }

/* ─── CATALOGO TAB ────────────────────────────────────────── */
.cat-tab { display: flex; flex-direction: column; gap: 12px; }
.cat-card { padding: 14px 18px; }
.cat-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.cat-card-head .spacer { flex: 1; }
.cat-card-actions { display: flex; gap: 12px; }
.cat-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 4px 24px;
  margin-top: 8px;
}
.cat-line { display: flex; gap: 8px; font-size: 13px; padding: 4px 0; border-bottom: 1px dotted var(--border); }
.cat-line-k { color: var(--muted); min-width: 110px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.cat-line-v { color: var(--fg); }
.cat-descr {
  grid-column: 1 / -1;
  white-space: pre-wrap;
  margin-top: 8px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-size: 13px;
}
.cat-approval-meta { font-size: 11px; margin-top: 8px; }
.cat-edit { border: 2px solid var(--accent); }

/* ─── RAPPRESENTANZA TAB ──────────────────────────────────── */
.rapp-tab { display: flex; flex-direction: column; gap: 12px; }
.rapp-search-wrap { position: relative; flex: 1; max-width: 360px; }
.rapp-search {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.rapp-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 10;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 2px;
}
.rapp-search-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.rapp-search-item:last-child { border-bottom: none; }
.rapp-search-item:hover { background: var(--surface-2); }
.rapp-list { display: flex; flex-direction: column; gap: 6px; }
.rapp-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rapp-row:hover { background: #f0f9ff; }
.rapp-row-expanded {
  display: block;
  cursor: default;
  border: 2px solid var(--accent);
}
.rapp-row-expanded:hover { background: var(--surface); }
.rapp-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.rapp-main { display: flex; align-items: center; gap: 8px; }
.rapp-edizioni { margin-top: 8px; }
.rapp-row-foot { margin-top: 12px; }

/* ─── PAGE HEADER + AZIENDA FORM ──────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-header .page-title { margin: 0; }

.detail-toolbar .spacer { flex: 1; }
.detail-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.azienda-form { padding: 20px; }
.azienda-form .kv-section {
  grid-column: unset;
  margin: 20px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.azienda-form .form-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.azienda-form textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }

/* ─── ADMIN LOOKUP ────────────────────────────────────────── */
.admin-tab-strip {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: 0;
}
.admin-card { border-top-left-radius: 0; border-top-right-radius: 0; padding: 16px; }
.admin-form { border: 2px solid var(--accent); padding: 16px; margin: 8px 0; }
/* Nav links sidebar — voci verticali dashboard-style */
#topbar .user a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: capitalize;
  font-size: 13.5px;
  letter-spacing: 0.1px;
  font-weight: 500;
  padding: 9px 12px;
  background: transparent;
  color: rgba(255,255,255,0.72);
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
  position: relative;
}
#topbar .user a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-color: rgba(255,255,255,0.08);
  text-decoration: none;
}
/* Voce selezionata = colore pieno accent */
#topbar .user a.active {
  background: linear-gradient(135deg, var(--accent), #4338ca);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(37,99,235,0.30);
}

/* Servizi: accent viola, distintivo come una capability di linea */
#topbar .user a#link-services {
  background: rgba(124,58,237,0.12);
  color: #c4b5fd;
  border-color: rgba(124,58,237,0.25);
}
#topbar .user a#link-services:hover,
#topbar .user a#link-services.active {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(124,58,237,0.35);
}

/* Contabilita': accent oro/ambra, distintivo come l'admin (ruolo capability) */
#topbar .user a#link-accounting {
  background: rgba(217,119,6,0.12);
  color: #fcd34d;
  border-color: rgba(217,119,6,0.25);
}
#topbar .user a#link-accounting:hover,
#topbar .user a#link-accounting.active {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(217,119,6,0.35);
}

/* Admin: rosso, sempre evidenziato */
#topbar .user a#link-admin {
  background: rgba(220,38,38,0.12);
  color: #fca5a5;
  border-color: rgba(220,38,38,0.25);
}
#topbar .user a#link-admin:hover,
#topbar .user a#link-admin.active {
  background: linear-gradient(135deg, var(--danger), #b91c1c);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(220,38,38,0.35);
}

/* Follow-up: comportamento speciale quando ci sono scaduti */
#link-followup {
  position: relative;
}
#link-followup.has-overdue {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  animation: followup-pulse 2s ease-in-out infinite;
}
#link-followup.has-overdue:hover { background: #991b1b; border-color: #991b1b; }
#link-followup .followup-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  min-width: 18px;
  text-align: center;
}
@keyframes followup-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.7); }
  50%       { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

/* ─── DASHBOARD ────────────────────────────────────────────── */
.dash-top-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.dash-top { padding: 16px; }
.dash-top-item {
  display: grid;
  grid-template-columns: 1.5fr 2fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.dash-top-item:last-child { border-bottom: none; }
.dash-top-label { color: var(--fg); overflow: hidden; text-overflow: ellipsis; }
.dash-top-bar-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.dash-top-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}
.dash-top-count { font-weight: 600; color: var(--accent); min-width: 24px; text-align: right; }

.conv-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}
.conv-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}
.conv-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}
.conv-bar-pct { font-size: 12px; color: var(--muted); min-width: 50px; text-align: right; }

.data-table.compact th, .data-table.compact td { padding: 4px 6px; font-size: 12px; }

/* ─── FUNNEL ──────────────────────────────────────────────── */
.funnel-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.funnel-toolbar select {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 28px; font-weight: 600; color: var(--accent); margin-top: 4px; }
.kpi-hint  { font-size: 11px; color: var(--muted); margin-top: 4px; }

.funnel-bar-card { padding: 16px; margin-bottom: 16px; }
.funnel-bar {
  display: flex;
  height: 56px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 8px 0 16px 0;
}
.funnel-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: opacity 0.1s, filter 0.1s;
  overflow: hidden;
}
.funnel-seg:hover  { filter: brightness(1.08); }
.funnel-seg.selected { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4px var(--accent); }
.funnel-seg-lbl { padding: 0 8px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.funnel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.funnel-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.funnel-legend-item:hover { background: var(--surface-2); }
.funnel-legend-item.selected { background: #eff6ff; border: 1px solid var(--accent); padding: 3px 7px; }
.funnel-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.placeholder-tab { color: var(--muted); padding: 20px; text-align: center; }
.placeholder-tab p:first-child { color: var(--fg); font-size: 16px; }
.muted { color: var(--muted); font-size: 12px; }

/* ─── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--fg);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  font-size: 13px;
  z-index: 1000;
  max-width: 360px;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ─── ICON BUTTON (topbar) ─────────────────────────────────── */
#topbar .icon-btn {
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  background: transparent;
  color: rgba(255,255,255,0.55);
  border: 1px solid transparent;
  cursor: pointer;
  opacity: 1;
  box-shadow: none;
}
#topbar .icon-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.10);
}

/* ─── USER MENU (sidebar bottom dropdown) ─────────────────── */
.user-menu {
  position: relative;
  margin-top: auto;          /* spinge in fondo alla sidebar */
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-menu-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  font: inherit;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-shadow: none;
  transition: background var(--t-fast) var(--ease);
}
.user-menu-btn:hover         { background: rgba(255,255,255,0.10); color: #fff; }
.user-menu-btn[aria-expanded="true"] { background: rgba(255,255,255,0.14); color: #fff; }
.user-menu-btn .user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #c4b5fd);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.user-menu-btn #user-label  { flex: 1; text-align: left; font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-btn .caret       { font-size: 10px; opacity: .7; }

/* Popup: si apre VERSO L ALTO partendo dal bottone in basso */
.user-menu-pop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 1000;
}
.user-menu-header {
  padding: 8px 10px 6px 10px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px dashed var(--border);
  margin-bottom: 4px;
  word-break: break-all;
}
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
}
.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger:hover { background: #fff1f2; }
.user-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── HELP / MANUALE ──────────────────────────────────────── */
.help-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}
.help-toc {
  position: sticky;
  top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  max-height: calc(100vh - 80px);
  overflow: auto;
}
.help-toc h3 { margin: 0 0 10px 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.help-toc ol { list-style: none; padding: 0; margin: 0; }
.help-toc li { margin: 4px 0; }
.help-toc a  { color: var(--fg); text-decoration: none; display: block; padding: 4px 6px; border-radius: 4px; }
.help-toc a:hover { background: var(--surface-2); color: var(--accent); }
.help-actions { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); }
.help-actions .btn-link {
  display: inline-block; padding: 6px 10px; border-radius: var(--radius);
  background: var(--accent); color: #fff; text-decoration: none; font-size: 12px;
}
.help-actions .btn-link:hover { filter: brightness(1.08); }

.help-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 28px 28px 28px;
  line-height: 1.55;
}
.help-body section { padding: 10px 0 6px 0; }
.help-body section + section { border-top: 1px dashed var(--border); margin-top: 14px; }
.help-h2 { color: var(--accent); margin: 14px 0 8px 0; font-size: 20px; }
.help-h3 { margin: 14px 0 4px 0; font-size: 15px; }
.help-h4 { margin: 10px 0 2px 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.help-body p  { margin: .4em 0; }
.help-body ul, .help-body ol { margin: .3em 0 .6em 1.4em; }
.help-body code { background: var(--surface-2); padding: 1px 5px; border-radius: 3px; font-size: 12.5px; }
.help-table { margin: .5em 0; }

.help-note, .help-warn {
  border-left: 4px solid;
  padding: 8px 12px;
  margin: 10px 0;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
}
.help-note { background: #eff6ff; border-color: var(--accent); }
.help-warn { background: #fff7ed; border-color: #fb923c; }

@media (max-width: 1000px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; max-height: none; }
}

/* =========================================================== */
/* ─── SIDEBAR TOGGLE (mobile) ─────────────────────────────── */
/* =========================================================== */
.sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 18px;
  cursor: pointer;
  display: none;          /* visibile solo su mobile, via media query */
  align-items: center;
  justify-content: center;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 45;
  display: none;
}
body.sidebar-open .sidebar-backdrop { display: block; }

/* =========================================================== */
/* ─── RESPONSIVE — breakpoint medio (tablet) ──────────────── */
/* =========================================================== */
@media (max-width: 900px) {
  #view { padding: 18px 20px; }
  #topbar { width: 220px; padding: 18px 12px; }

  .page-title { font-size: 19px; }
  .filters-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
  .kv-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

  /* Tabelle: scroll orizzontale dentro alla card padre */
  .card .data-table,
  .results-card .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .funnel-toolbar { flex-wrap: wrap; gap: 8px 12px; }
  .comm-toolbar   { flex-wrap: wrap; gap: 8px 12px; }
}

/* =========================================================== */
/* ─── RESPONSIVE — breakpoint piccolo (mobile) ────────────── */
/* =========================================================== */
@media (max-width: 768px) {
  /* Sidebar diventa off-canvas drawer */
  .sidebar-toggle { display: inline-flex; }
  #topbar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    width: 260px;
    transform: translateX(-100%);
    transition: transform var(--t-norm) var(--ease);
  }
  body.sidebar-open #topbar { transform: translateX(0); }
  #view { padding: 56px 18px 24px 18px; /* spazio per il toggle in alto */ }
}

@media (max-width: 600px) {
  body { font-size: 13.5px; }
  #view { padding: 56px 14px 18px 14px; }
  .card { padding: 14px; border-radius: var(--radius); }

  .page-title { font-size: 17px; margin-bottom: 12px; }
  .section-title { font-size: 12px; }

  .filters-grid { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; gap: 8px 0; }

  .event-grid { grid-template-columns: 1fr; }

  /* KPI dashboard: 2 colonne invece di N */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Detail toolbar / tab strip: scroll orizzontale invece di wrap */
  .tab-strip { padding-bottom: 2px; }
  .tab { padding: 8px 12px; font-size: 12.5px; }

  /* Modal/dropdown menu utente: full width meno gutter */
  .user-menu-pop { min-width: 200px; right: -8px; }

  /* Help page: TOC sopra al body */
  .help-toc h3 { font-size: 12px; }
  .help-body { padding: 4px 16px 18px 16px; }
  .help-body table { font-size: 12px; }

  button { padding: 8px 12px; }
}

/* =========================================================== */
/* ─── MOTION REDUCE ─────────────────────────────────────── */
/* =========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================== */
/* ─── DETTAGLI PARTICOLARI ─────────────────────────────── */
/* =========================================================== */

/* Login card: centratura migliore + ombra piu profonda */
.login-card {
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
}

/* Event picker: ombra al passaggio */
.event-card { border-radius: var(--radius-lg); }
.event-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

/* Select inline nel detail-header (cambio rapido commerciale) */
.azd-op-select {
  font: inherit;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: #fff;
  max-width: 260px;
}
.azd-op-select:hover  { border-color: var(--accent); }
.azd-op-select:focus  { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,0.18); }

/* Piccolo bottone matita / annulla nel detail-header per il cambio commerciale */
.azd-op-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  margin-left: 4px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  vertical-align: middle;
  box-shadow: none;
}
.azd-op-edit-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── RAPPRESENTANZA: layout 2 colonne ─────────────────────── */
.rapp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.rapp-two-col .rapp-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.rapp-col-title {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
/* Su schermi piu' stretti le due colonne si impilano */
@media (max-width: 1100px) {
  .rapp-two-col { grid-template-columns: 1fr; }
}

/* ─── FATTURAZIONE — righe rate ────────────────────────────── */
.data-table tbody tr.row-paid    { background: #f0fdf4; }   /* verde tenue */
.data-table tbody tr.row-paid:hover { background: #dcfce7; }
.data-table tbody tr.row-overdue { background: #fef2f2; }   /* rosso tenue */
.data-table tbody tr.row-overdue:hover { background: #fee2e2; }

/* KPI scaduto in danger */
.kpi-card.kpi-danger { border-color: rgba(220,38,38,0.35); }
.kpi-card.kpi-danger .kpi-value { color: var(--danger); }
