/* ============================================================
   Salumitalia Ispezioni — Design System
   Brand colors estratti dal logo ufficiale:
   - Rosso Salumitalia #E31837
   - Nero/grafite (testo) #1a1a1a
   - Verde tricolore (accento) #008C44
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');

:root {
  /* === BRAND SALUMITALIA === */
  --sl-red: #E31837;             /* rosso del logo (banner "CONSORZI INDICAZIONE GEOGRAFICA") */
  --sl-red-dark: #b8132c;        /* hover */
  --sl-red-darker: #8e0e22;
  --sl-red-light: #f04a64;
  --sl-red-ultra-light: #fcebee;

  /* Nero/Grafite (testo del logo, header) */
  --sl-dark: #1a1a1a;
  --sl-dark-light: #2c2c2c;
  --sl-dark-lighter: #3a3a3a;

  /* Verde tricolore (accento sul puntino della "i") */
  --sl-green: #008C44;
  --sl-green-dark: #006e35;

  /* Bianco/Crema */
  --sl-white: #ffffff;
  --sl-cream: #fafafa;
  --sl-gray: #9aa6b2;
  --sl-gray-light: #e0e0e0;
  --sl-gray-ultra-light: #f5f5f5;
  --sl-text-dark: #1a1a1a;
  --sl-text-muted: #6c7a8d;

  /* Stato */
  --sl-success: #2BA56F;
  --sl-warning: #E0A030;
  --sl-info: #428bca;
  --sl-danger: #d9534f;

  /* Layout */
  --sl-sidebar-width: 250px;
  --sl-sidebar-collapsed-width: 60px;
  --sl-topbar-height: 60px;

  /* Ombre */
  --sl-shadow-sm: 0 1px 3px rgba(26, 26, 26, 0.08);
  --sl-shadow: 0 2px 10px rgba(26, 26, 26, 0.10);
  --sl-shadow-lg: 0 10px 30px rgba(26, 26, 26, 0.18);

  /* Raggi */
  --sl-radius: 6px;
  --sl-radius-sm: 4px;
  --sl-radius-lg: 12px;

  --sl-font-sans: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === OVERRIDE RADZEN === */
:root {
  --rz-primary: #E31837;
  --rz-primary-dark: #b8132c;
  --rz-primary-darker: #8e0e22;
  --rz-primary-light: #f04a64;
  --rz-secondary: #1a1a1a;
  --rz-base-100: #f5f5f5;
  --rz-base-200: #fcebee;
  --rz-base-300: #e0e0e0;
  --rz-base-background-color: #fafafa;
  --rz-surface-background-color: #ffffff;
  --rz-text-color: #1a1a1a;
  --rz-text-secondary-color: #6c7a8d;
  --rz-text-h-color: #1a1a1a;
  --rz-border-radius: 6px;
  --rz-text-font-family: 'Open Sans', sans-serif;
}

/* === RESET === */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--sl-font-sans);
  color: var(--sl-text-dark);
  background: var(--sl-cream);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--sl-dark); font-weight: 700; margin: 0 0 .6em 0; }

a { color: var(--sl-red); text-decoration: none; }
a:hover { color: var(--sl-red-dark); }

/* === LAYOUT === */
.sl-app { display: flex; min-height: 100vh; position: relative; }

/* SIDEBAR — nascosta di default, slide-in quando .active */
.sl-sidebar {
  width: var(--sl-sidebar-width);
  background: var(--sl-dark);
  color: var(--sl-white);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform .22s ease;
  overflow-y: auto; overflow-x: hidden;
}
.sl-sidebar.active {
  transform: translateX(0);
}

.sl-brand {
  height: var(--sl-topbar-height);
  display: flex; align-items: center;
  padding: 0 16px;
  background: linear-gradient(180deg, #000 0%, var(--sl-dark) 100%);
  border-bottom: 2px solid var(--sl-red);
  flex-shrink: 0;
}
.sl-brand-logo {
  display: flex; align-items: center; gap: 10px; width: 100%;
}
.sl-brand-icon {
  width: 40px; height: 40px;
  border-radius: var(--sl-radius);
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
}
.sl-brand-text {
  font-size: 15px; font-weight: 700; letter-spacing: .3px; line-height: 1.15;
}
.sl-brand-text small {
  display: block; font-size: 11px; font-weight: 400; opacity: .65; letter-spacing: 0;
}

/* Nav */
.sl-nav { flex: 1; padding: 8px 0; }
.sl-nav ul { list-style: none; margin: 0; padding: 0; }

.sl-nav-item > a,
.sl-nav-item > .sl-nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  color: #c1c8d2;
  cursor: pointer;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  font-size: 14px; white-space: nowrap;
  text-decoration: none;
}
.sl-nav-item > a:hover,
.sl-nav-item > .sl-nav-link:hover {
  background: rgba(227,24,55,.10);
  color: #fff;
  border-left-color: var(--sl-red);
}
.sl-nav-item.active > a,
.sl-nav-item > a.active,
.sl-nav-item.active > .sl-nav-link {
  background: rgba(227,24,55,.18);
  color: #fff;
  border-left-color: var(--sl-red);
}
.sl-nav-item .sl-nav-icon {
  width: 20px; text-align: center; font-size: 16px; flex-shrink: 0;
}
.sl-nav-item .sl-nav-text { flex: 1; }
.sl-nav-item .sl-nav-arrow {
  font-size: 11px; transition: transform .15s;
}
.sl-nav-item.expanded > .sl-nav-link .sl-nav-arrow { transform: rotate(90deg); }

.sl-submenu {
  background: rgba(0,0,0,.30);
  max-height: 0; overflow: hidden;
  transition: max-height .25s ease;
}
.sl-nav-item.expanded > .sl-submenu { max-height: 800px; }
.sl-submenu li a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 48px;
  color: #98a3b1; font-size: 13px;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sl-submenu li a:hover {
  background: rgba(227,24,55,.08);
  color: #fff;
  border-left-color: var(--sl-red);
}
.sl-submenu li a.active {
  color: #fff;
  border-left-color: var(--sl-red);
  background: rgba(227,24,55,.12);
}
.sl-submenu .sl-nav-icon { font-size: 6px; width: 6px; }

/* Sidebar footer */
.sl-sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.sl-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--sl-red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sl-user-details { flex: 1; min-width: 0; }
.sl-user-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sl-user-role { font-size: 11px; color: #98a3b1; }
.sl-logout-btn {
  background: none; border: none; color: #c1c8d2;
  cursor: pointer; padding: 6px;
  border-radius: var(--sl-radius);
}
.sl-logout-btn:hover { background: var(--sl-red); color: #fff; }

/* MAIN AREA — si sposta a destra quando la sidebar è aperta (desktop push) */
.sl-main {
  flex: 1;
  margin-left: 0;
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left .22s ease;
}
.sl-app.sidebar-open .sl-main { margin-left: var(--sl-sidebar-width); }

/* TOPBAR */
.sl-topbar {
  height: var(--sl-topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--sl-gray-light);
  display: flex; align-items: center;
  padding: 0 24px;
  box-shadow: var(--sl-shadow-sm);
  position: sticky; top: 0; z-index: 100;
}
.sl-topbar-toggle {
  background: none; border: none;
  color: var(--sl-dark); font-size: 18px; cursor: pointer;
  padding: 8px; border-radius: var(--sl-radius); margin-right: 8px;
}
.sl-topbar-toggle:hover { background: var(--sl-gray-ultra-light); }
.sl-topbar-title { font-size: 18px; font-weight: 600; color: var(--sl-dark); flex: 1; }
.sl-topbar-right {
  display: flex; align-items: center; gap: 16px;
  color: var(--sl-text-muted); font-size: 13px;
}
.sl-topbar-badge {
  background: var(--sl-red-ultra-light);
  color: var(--sl-red);
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}

/* CONTENT */
.sl-content { padding: 24px; flex: 1; background: var(--sl-cream); }

/* PAGE HEADER */
.sl-page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sl-gray-light);
  gap: 16px; flex-wrap: wrap;
}
.sl-page-header h1 { font-size: 22px; margin: 0; }
.sl-page-header .sl-page-subtitle {
  color: var(--sl-text-muted); font-size: 13px; margin-top: 2px;
}
.sl-page-header-actions {
  display: flex; gap: 8px; align-items: center;
}

/* CARDS / PANELS */
.sl-panel {
  background: #fff;
  border-radius: var(--sl-radius-lg);
  box-shadow: var(--sl-shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.sl-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sl-gray-light);
  margin-bottom: 16px;
}
.sl-panel-title { font-weight: 600; font-size: 15px; color: var(--sl-dark); }

/* KPI cards */
.sl-kpi {
  border-radius: var(--sl-radius-lg);
  padding: 18px 20px;
  color: #fff;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.sl-kpi-label { font-size: 13px; opacity: .85; margin-bottom: 6px; }
.sl-kpi-value { font-size: 32px; font-weight: 700; line-height: 1; }
.sl-kpi-icon {
  position: absolute; right: 12px; bottom: 8px;
  font-size: 56px; opacity: .12;
}

.sl-kpi-red    { background: linear-gradient(135deg, #E31837 0%, #b8132c 100%); }
.sl-kpi-dark   { background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%); }
.sl-kpi-green  { background: linear-gradient(135deg, #2BA56F 0%, #1f8456 100%); }
.sl-kpi-orange { background: linear-gradient(135deg, #E0A030 0%, #b8821f 100%); }

/* RADZEN OVERRIDES */
.rz-data-grid {
  border-radius: var(--sl-radius);
  overflow: hidden;
  background: #fff;
}
.rz-grid-table thead { background: var(--sl-dark); }
.rz-grid-table thead th {
  color: #fff !important;
  font-weight: 600;
  white-space: normal !important;
  line-height: 1.2;
  vertical-align: middle;
}
.rz-grid-table thead th .rz-column-title { white-space: normal !important; }
.rz-grid-table thead th .rz-cell-data { color: #fff !important; }
.rz-grid-table thead th .rz-cell-filter-row input { font-weight: 400; }
.rz-grid-table tbody tr:hover { background: var(--sl-red-ultra-light); }

.rz-button.rz-primary {
  background: var(--sl-red); border-color: var(--sl-red);
}
.rz-button.rz-primary:hover {
  background: var(--sl-red-dark); border-color: var(--sl-red-dark);
}
.rz-button.rz-secondary {
  background: var(--sl-dark); border-color: var(--sl-dark); color: #fff;
}
.rz-button.rz-light {
  background: #fff; border-color: var(--sl-gray-light); color: var(--sl-dark);
}
.rz-button.rz-success { background: var(--sl-success); border-color: var(--sl-success); }

/* DataGrid container con scrollbar orizzontale sempre visibile */
.sl-grid-scroll { overflow-x: auto; }
.sl-grid-scroll::-webkit-scrollbar { height: 12px; }
.sl-grid-scroll::-webkit-scrollbar-thumb { background: var(--sl-gray-light); border-radius: 6px; }

/* Badge utility */
.sl-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.sl-badge-success { background: #e6f7ee; color: var(--sl-success); }
.sl-badge-danger  { background: #fde8e8; color: var(--sl-danger); }
.sl-badge-warning { background: #fdf2dd; color: var(--sl-warning); }
.sl-badge-info    { background: #e6f0fa; color: var(--sl-info); }
.sl-badge-dark    { background: #ebebeb; color: var(--sl-dark); }
.sl-badge-red     { background: #fcebee; color: var(--sl-red); }

/* Overlay — visibile solo su mobile, scuro dietro la sidebar quando aperta */
.sl-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
}

/* RESPONSIVE — su mobile la sidebar è overlay (non sposta il contenuto) */
@media (max-width: 768px) {
  .sl-app.sidebar-open .sl-main { margin-left: 0; }
  .sl-overlay { display: block; }
}

/* KPI cliccabile */
.sl-kpi-link {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.sl-kpi-link:hover { transform: translateY(-3px); box-shadow: var(--sl-shadow-lg); }

/* Quick links (stessa palette KPI) */
.sl-quick-link {
  border-radius: var(--sl-radius-lg);
  padding: 18px 20px;
  color: #fff;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  transition: transform .15s, box-shadow .15s;
  user-select: none;
}
.sl-quick-link:hover { transform: translateY(-3px); box-shadow: var(--sl-shadow-lg); }
.sl-ql-icon { font-size: 32px; opacity: .9; margin-bottom: 4px; }
.sl-ql-label { font-size: 15px; font-weight: 700; }
.sl-ql-sub { font-size: 12px; opacity: .8; }
.sl-ql-green { background: linear-gradient(135deg, #2BA56F 0%, #1f8456 100%); }
.sl-ql-orange { background: linear-gradient(135deg, #E0A030 0%, #b8821f 100%); }
.sl-ql-red    { background: linear-gradient(135deg, #E31837 0%, #b8132c 100%); }
.sl-ql-dark   { background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%); }

/* Filtri label */
.sl-filter-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--sl-text-muted); text-transform: uppercase;
  letter-spacing: .4px; margin-bottom: 4px;
}

/* Pannello statistiche esiti */
.sl-stat-panel {
  background: var(--sl-gray-ultra-light);
  border-radius: var(--sl-radius);
  padding: 16px;
  height: 100%;
}
.sl-stat-panel-title {
  font-size: 13px; font-weight: 700; color: var(--sl-dark);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--sl-red);
}
.sl-esiti-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.sl-esiti-table thead th {
  padding: 6px 10px; background: var(--sl-dark); color: #fff;
  font-weight: 600; text-align: center;
}
.sl-esiti-table thead th:first-child { text-align: left; }
.sl-esiti-table tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--sl-gray-light);
  vertical-align: middle;
}
.sl-esiti-table tbody td:nth-child(2),
.sl-esiti-table tbody td:nth-child(3) { text-align: center; }
.sl-esiti-table tbody tr:hover { background: rgba(227,24,55,.04); }
.sl-esiti-tot td {
  font-weight: 700; background: var(--sl-gray-light) !important;
  font-size: 14px;
}
.sl-esiti-tot td:nth-child(2),
.sl-esiti-tot td:nth-child(3) { text-align: center; }

/* Vademecum */
.sl-vademecum {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--sl-red-ultra-light);
  border-left: 3px solid var(--sl-red);
  border-radius: var(--sl-radius);
  font-size: 12px; color: var(--sl-dark);
  line-height: 1.7;
}

/* LOGIN LAYOUT */
/* ===== LOGIN PAGE ===== */
.sl-login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
  position: relative;
  padding: 32px 20px 20px;
  gap: 28px;
}
.sl-login-wrapper::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at top right, rgba(227,24,55,.25), transparent 60%);
  pointer-events: none;
}

/* Logo + tagline sopra le card */
.sl-login-logo-top {
  text-align: center;
  position: relative; z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.sl-login-logo-pill {
  background: rgba(255,255,255,.97);
  border-radius: 16px; 
  display: inline-block;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.sl-login-logo-pill img {
  max-width: 240px; height: auto;
  display: block;
}
.sl-login-tagline {
  color: #fff;
  font-size: 15px;
  line-height: 1.6;
}
.sl-login-tagline strong {
  font-size: 16px;
  font-weight: 700;
}
.sl-login-tagline-sub {
  font-style: italic;
  color: rgba(255,255,255,.65);
  font-size: 13px;
}
.sl-login-demo-note-top {
  background: rgba(227,24,55,.15);
  border: 1px solid rgba(227,24,55,.35);
  border-radius: var(--sl-radius);
  padding: 8px 18px;
  font-size: 12px;
  color: rgba(255,255,255,.8);
}

/* Contenitore due card */
.sl-login-container {
  display: flex;
  gap: 24px;
  width: 100%; max-width: 860px;
  position: relative; z-index: 1;
  align-items: stretch;
}
@media (max-width: 680px) {
  .sl-login-container { flex-direction: column; }
}

/* Card generica — usata da entrambi i pannelli */
.sl-login-card {
  background: #fff;
  border-radius: var(--sl-radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header colorato della card */
.sl-login-card-header {
  background: var(--sl-dark);
  padding: 28px 32px 24px;
  text-align: center;
}
.sl-login-card-icon {
  font-size: 32px;
  color: var(--sl-red);
  display: block;
  margin-bottom: 8px;
}
.sl-login-title {
  font-size: 18px; font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.sl-login-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,.6);
  font-style: italic;
  margin-bottom: 16px;
}
.sl-login-divider {
  width: 36px; height: 3px;
  background: var(--sl-red);
  border-radius: 2px;
  margin: 0 auto 0;
}

/* Corpo della card */
.sl-login-card-body {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Bottone allineato in fondo */
.sl-login-card-action {
  margin-top: auto;
  padding-top: 24px;
}

.sl-login-field { margin-bottom: 16px; }
.sl-login-field label {
  display: block;
  font-size: 12px; font-weight: 600;
  margin-bottom: 6px;
  color: var(--sl-text-muted);
  text-transform: uppercase; letter-spacing: .5px;
}

.sl-login-demo-note {
  background: var(--sl-red-ultra-light);
  border-left: 3px solid var(--sl-red);
  padding: 10px 14px;
  border-radius: var(--sl-radius);
  font-size: 12px; color: var(--sl-dark);
  margin-bottom: 20px;
}

.sl-login-card-body--center {
  justify-content: center;
  text-align: center;
}
.sl-login-public-text {
  font-size: 15px;
  color: var(--sl-dark);
  line-height: 1.85;
  text-align: center;
}

/* Footer sotto le card */
.sl-login-footer-global {
  font-size: 12px;
  color: rgba(255,255,255,.35);
  text-align: center;
  position: relative; z-index: 1;
}

/* ===== Avvio applicazione e messaggi di accesso ===== */
.sl-avvio {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--sl-bg, #f7f7f8);
}

.sl-avvio-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 40px;
    text-align: center;
    max-width: 460px;
}

.sl-avvio-logo { max-width: 180px; height: auto; }
.sl-avvio-testo { font-size: 15px; color: var(--sl-dark, #333); }
.sl-avvio-dettaglio { font-size: 13px; color: #777; line-height: 1.5; }

/* Errore di accesso nella pagina di login */
.sl-login-errore {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 4px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #a4232b;
    font-size: 13px;
}

/* Allegato non immagine mostrato come collegamento */
.sl-allegato-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--rz-base-300, #ddd);
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    color: var(--sl-dark, #333);
}

.sl-allegato-file:hover { background: var(--rz-base-50, #f5f5f5); }
