/* =============================================================================
   LIS Refertazione Lab — tema-em.css (31/10/2026)
   Tema grafico allineato a EndlessMed (valori dal foglio di stile di gp1.endlessmed.com).
   ── TUTTO e' sotto `html.tema-em`: con il tema spento questo file non fa nulla.
   ── Solo aspetto: nessun id, classe o comportamento cambia. I PDF dei referti NON
      dipendono da questo file (li genera il server).
   ── Colore principale = verde acqua del laboratorio, come EM fa per ogni modulo (il suo modulo
      «campioni» usa proprio #0d9488): i colori gia' scritti nelle pagine restano coerenti.
   ============================================================================= */

/* --- Poppins self-hosted (licenza SIL OFL 1.1) ------------------------------- */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/vendor/poppins/poppins-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/vendor/poppins/poppins-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/vendor/poppins/poppins-500-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/vendor/poppins/poppins-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/vendor/poppins/poppins-600-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/vendor/poppins/poppins-600-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/vendor/poppins/poppins-700-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/vendor/poppins/poppins-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* --- 1) BASE: variabili ------------------------------------------------------- */
html.tema-em {
  --color-primary: #0d9488;
  --color-primary-light: #14b8a6;
  --color-primary-dark: #0f766e;
  --color-primary-50: #f0fdfa;
  --color-primary-100: #ccfbf1;
  --color-primary-200: #99f6e4;
  --grad-primary: linear-gradient(135deg, #14b8a6, #0d9488);
  --grad-primary-hover: linear-gradient(135deg, #0d9488, #0f766e);

  /* 31/10/2026: i colori di STATO (successo, avviso, errore, info) restano quelli del LIS: l'utente
     e' abituato a quel codice. Il tema non li ridefinisce. */

  --color-bg: #f4f7fb;
  --color-surface: #ffffff;
  --color-surface-hover: #f3f7fd;
  --color-text: #1f2a44;
  --color-text-secondary: #6f7b92;
  --color-text-muted: #8a94a8;
  --color-border: #e5ebf4;
  --color-border-light: #eef2f8;
  --color-overlay: rgba(10, 25, 55, 0.48);
  --focus-ring: 0 0 0 3px rgba(13, 148, 136, 0.15);

  --sidebar-bg: linear-gradient(180deg, #12223e 0%, #182c4e 100%);
  --sidebar-text: #dbe7ff;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.09);
  --sidebar-active-accent: #ffffff;

  --font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-size-base: calc(13px*var(--fs,1));

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 11px;
  --radius-xl: 14px;
  --radius-2xl: 16px;
  --shadow-xs: 0 1px 2px rgba(24, 48, 88, 0.04);
  --shadow-sm: 0 2px 8px rgba(24, 48, 88, 0.06);
  --shadow-md: 0 6px 18px rgba(24, 48, 88, 0.07);
  --shadow-lg: 0 10px 28px rgba(24, 48, 88, 0.08);
  --shadow-xl: 0 18px 40px rgba(24, 48, 88, 0.12);
}
html.tema-em body { font-family: var(--font-family); background: var(--color-bg); color: var(--color-text); }
html.tema-em input, html.tema-em select, html.tema-em textarea, html.tema-em button { font-family: inherit; }

/* --- 2) GUSCIO: barra laterale e barra in alto -------------------------------- */
html.tema-em .sidebar { background: var(--sidebar-bg); }
html.tema-em .sidebar-header { border-bottom-color: rgba(255, 255, 255, 0.08); }
html.tema-em .sidebar-logo { background: var(--grad-primary); border-radius: 10px; }
/* Poppins e' piu' largo di Inter: senza questo «LIS Refertazione» veniva tagliato */
html.tema-em .sidebar-brand h2 { color: #fff; font-size: calc(14px*var(--fs,1)); letter-spacing: -0.01em; }
html.tema-em .sidebar-brand small { color: #9fb2d8; font-size: calc(10.5px*var(--fs,1)); opacity: 1; }
html.tema-em .sidebar-nav-label { color: #9fb2d8; }
html.tema-em .nav-item { border-radius: 11px; padding: 9px 12px; font-size: calc(13.5px*var(--fs,1)); color: var(--sidebar-text); }
html.tema-em .nav-item:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
html.tema-em .nav-item.active { background: rgba(255, 255, 255, 0.09); color: #fff; font-weight: 600; }
html.tema-em .nav-item.active::before { display: none; }
html.tema-em .nav-item.active svg { color: #fff; }
html.tema-em .sidebar-user { border-top: 1px solid rgba(255, 255, 255, 0.08); }
html.tema-em .sidebar-user-avatar { background: rgba(255, 255, 255, 0.12); color: #fff; }
html.tema-em .sidebar-user-role { color: #9fb2d8; }

html.tema-em .topbar {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border); box-shadow: none;
}
html.tema-em #mgr-topbar-title { font-weight: 600; color: var(--color-text); }
html.tema-em .breadcrumb a { color: var(--color-text-secondary); }
html.tema-em .breadcrumb a:hover { color: var(--color-primary); }
html.tema-em #topbar-guide-btn {
  background: #f3f7fd !important; color: var(--color-text) !important;
  border: 1px solid var(--color-border) !important; border-radius: 11px !important; font-weight: 600 !important;
}
html.tema-em .main-content { background: var(--color-bg); }

/* --- Pulsanti ------------------------------------------------------------------ */
html.tema-em .btn { border-radius: 11px; font-weight: 600; transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast); }
html.tema-em .btn:hover:not(:disabled) { transform: translateY(-1px); }
html.tema-em .btn:active:not(:disabled) { transform: scale(0.97); }
html.tema-em .btn-primary { background: var(--grad-primary); border-color: transparent; color: #fff; }
html.tema-em .btn-primary:hover:not(:disabled) { background: var(--grad-primary-hover); box-shadow: 0 6px 16px rgba(13, 148, 136, 0.25); }
html.tema-em .btn-success { background: linear-gradient(135deg, #1fb67a, #17a06b); border-color: transparent; color: #fff; }
html.tema-em .btn-success:hover:not(:disabled) { background: linear-gradient(135deg, #17a06b, #128a5b); box-shadow: 0 6px 16px rgba(31, 182, 122, 0.25); }
html.tema-em .btn-warning { background: linear-gradient(135deg, #f6a623, #e69516); border-color: transparent; color: #fff; }
html.tema-em .btn-warning:hover:not(:disabled) { background: linear-gradient(135deg, #e69516, #cf8410); box-shadow: 0 6px 16px rgba(246, 166, 35, 0.25); }
html.tema-em .btn-danger { background: linear-gradient(135deg, #eb5757, #d94545); border-color: transparent; color: #fff; }
html.tema-em .btn-danger:hover:not(:disabled) { background: linear-gradient(135deg, #d94545, #c23838); box-shadow: 0 6px 16px rgba(235, 87, 87, 0.25); }
html.tema-em .btn-secondary { background: #f3f7fd; border-color: var(--color-border); color: var(--color-text); }
html.tema-em .btn-secondary:hover:not(:disabled) { background: #e9f1fc; border-color: var(--color-primary-200); color: var(--color-primary-dark); }
html.tema-em .btn-outline { border-color: var(--color-border); color: var(--color-text); background: transparent; }
html.tema-em .btn-outline:hover:not(:disabled) { background: #f3f7fd; }
html.tema-em .btn-ghost:hover:not(:disabled) { background: #f3f7fd; }
html.tema-em .btn-sm { border-radius: 10px; }
html.tema-em .mgr-action-btn { border-radius: 11px !important; font-weight: 600 !important; }

/* --- Etichette di stato: NESSUNA modifica (31/10/2026, richiesta dell'utente: resta il codice colori del LIS) --- */

/* --- Schede, riquadri, tabelle --------------------------------------------------- */
html.tema-em .card, html.tema-em .stat-card, html.tema-em .recent-activity, html.tema-em .patient-card,
html.tema-em .patient-table-wrapper, html.tema-em .results-table-wrapper {
  border-radius: 14px; border-color: var(--color-border); box-shadow: 0 10px 28px rgba(24, 48, 88, 0.07);
}
html.tema-em .stat-card-icon { border-radius: 12px; }
html.tema-em .patient-table thead th, html.tema-em .results-table thead th {
  background: #f8fbff; color: var(--color-text-secondary); border-bottom: 1px solid var(--color-border);
  font-weight: 700; letter-spacing: 0.04em;
}
html.tema-em .patient-table tbody tr:nth-child(even) { background: #fbfcfe; }
html.tema-em .patient-table tbody tr:hover { background: rgba(20, 184, 166, 0.30); }
html.tema-em .patient-table tbody tr:hover > td:first-child { box-shadow: inset 4px 0 0 #0d9488; }
html.tema-em .patient-table tbody td { border-bottom-color: var(--color-border); }
html.tema-em .page-header h1 { font-weight: 600; }

/* --- 3) WORKLIST ------------------------------------------------------------------ */
html.tema-em .status-tabs { background: #f8fbff; border: 1px solid var(--color-border); border-radius: 12px; padding: 4px; gap: 4px; }
html.tema-em .status-tab { border-radius: 9px; color: var(--color-text-secondary); font-weight: 600; }
html.tema-em .status-tab:hover { background: #fff; color: var(--color-text); }
html.tema-em .status-tab.active { background: #fff; color: var(--color-text); box-shadow: 0 2px 8px rgba(24, 48, 88, 0.10); }
html.tema-em .status-tab .tab-count { background: #eef1f6; color: var(--color-text-secondary); }
html.tema-em .status-tab.active .tab-count { background: var(--color-primary); color: #fff; }
html.tema-em .search-bar input, html.tema-em .date-filter input[type="date"] {
  border: 1px solid #bfc7d2; border-radius: 8px;
}
html.tema-em .search-bar input:focus, html.tema-em .date-filter input[type="date"]:focus {
  border-color: var(--color-primary); box-shadow: var(--focus-ring); outline: none;
}
html.tema-em .search-type-btn.active { background: var(--color-primary); color: #fff; }
html.tema-em .btn-action { border-radius: 9px !important; font-weight: 600; }

/* --- 4) REFERTO (colori e forme; i significati restano: verde firma, arancio vidima, rosso annulla) */
html.tema-em .report-toolbar { border-radius: 14px; border-color: var(--color-border); box-shadow: 0 10px 28px rgba(24, 48, 88, 0.07); }
html.tema-em #btn-save-draft, html.tema-em #btn-preview-pdf, html.tema-em #btn-print { border-radius: 11px; }
html.tema-em #btn-partial-vidima { background: linear-gradient(135deg, #f6a623, #e69516) !important; border-radius: 11px !important; }
html.tema-em #btn-revert-report { background: linear-gradient(135deg, #f6a623, #e69516) !important; border-radius: 11px !important; }
html.tema-em #btn-rectify-report { background: linear-gradient(135deg, #eb5757, #d94545) !important; border-radius: 11px !important; }
html.tema-em .results-table .value-input { border-color: #bfc7d2; border-radius: 8px; }
html.tema-em .results-table .value-input:focus { border-color: var(--color-primary); box-shadow: var(--focus-ring); }
html.tema-em .results-table .group-header td { letter-spacing: 0.04em; }

/* --- 5) ALTRE PAGINE: tabelle DataTables (Nomenclatore, Non conformità, Notifiche ASL, Categorie,
   Strumenti…) e intestazioni di pagina. Solo aspetto: colonne, ordinamenti e filtri restano quelli. ---- */
html.tema-em table.dataTable { border-collapse: separate; border-spacing: 0; }
html.tema-em table.dataTable thead th, html.tema-em table.dataTable thead td {
  background: #f8fbff; color: var(--color-text-secondary); font-size: calc(11.5px*var(--fs,1)); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--color-border);
}
html.tema-em table.dataTable tbody td { border-top: 1px solid var(--color-border); }
html.tema-em table.dataTable.display tbody tr:hover > *, html.tema-em table.dataTable.hover tbody tr:hover > * {
  box-shadow: inset 0 0 0 9999px rgba(13, 148, 136, 0.05);
}
html.tema-em .dataTables_wrapper .dataTables_filter input,
html.tema-em .dataTables_wrapper .dataTables_length select {
  border: 1px solid #bfc7d2; border-radius: 8px; padding: 5px 10px; background: #fff;
}
html.tema-em .dataTables_wrapper .dataTables_filter input:focus { border-color: var(--color-primary); box-shadow: var(--focus-ring); outline: none; }
html.tema-em .dataTables_wrapper .dataTables_paginate .paginate_button { border-radius: 8px !important; border: 1px solid transparent !important; }
html.tema-em .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html.tema-em .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--color-primary) !important; color: #fff !important; border-color: var(--color-primary) !important;
}
html.tema-em .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
  background: #f3f7fd !important; color: var(--color-text) !important; border-color: var(--color-border) !important;
}
html.tema-em .dataTables_wrapper .dataTables_info { color: var(--color-text-secondary); }
html.tema-em #users-table thead th { background: #f8fbff; color: var(--color-text-secondary); }

/* --- Finestre di dialogo (SweetAlert2) e modali ------------------------------------ */
html.tema-em .swal2-container.swal2-backdrop-show { background: rgba(10, 25, 55, 0.48); }
html.tema-em .swal2-popup { border-radius: 14px; font-family: var(--font-family); color: var(--color-text); }
html.tema-em .swal2-title { font-size: 1.3rem; color: var(--color-text); }
html.tema-em .swal2-html-container { font-size: 0.92rem; }
html.tema-em .swal2-styled { border-radius: 11px !important; font-weight: 700 !important; font-size: 0.92rem !important; }
html.tema-em .swal2-styled.swal2-cancel { background: #f3f7fd !important; color: var(--color-text) !important; border: 1px solid var(--color-border) !important; }
html.tema-em .modal { border-radius: 14px; }
html.tema-em .modal-overlay { background: rgba(10, 25, 55, 0.48); }
html.tema-em .toast { border-radius: 12px; }

/* --- Barre di scorrimento sottili come EM --------------------------------------------- */
html.tema-em .sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }

/* --- 6) IMPAGINAZIONE COME EM (31/10/2026, foto di EntryMed fornita dall'utente) -----------------------
   Barra laterale «staccata» (riquadro blu notte arrotondato con margine), titolo di pagina grande in alto a
   sinistra col percorso sotto, pulsanti d'azione bianchi arrotondati in alto a destra, riquadro utente in fondo.
   Solo da 1025 px in su: tablet e telefono mantengono la barra a icone / a scomparsa di sempre. ------------ */
@media (min-width: 1025px) {
  html.tema-em { --topbar-height: 92px; --em-gap: 16px; }
  html.tema-em .sidebar {
    top: var(--em-gap); left: var(--em-gap); bottom: var(--em-gap);
    border-radius: 22px; box-shadow: 0 18px 40px rgba(18, 34, 62, 0.22);
  }
  html.tema-em .topbar {
    left: calc(var(--sidebar-width) + var(--em-gap) * 2); right: var(--em-gap);
    background: var(--color-bg); border-bottom: 0; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none; padding: var(--em-gap) 8px 0;
  }
  html.tema-em body.sidebar-collapsed .topbar { left: calc(var(--sidebar-collapsed-width) + var(--em-gap) * 2); }
  html.tema-em .main-content {
    margin-left: calc(var(--sidebar-width) + var(--em-gap) * 2);
    width: calc(100% - var(--sidebar-width) - var(--em-gap) * 3);
    padding-left: 8px; padding-right: 8px;
  }
  html.tema-em body.sidebar-collapsed .main-content {
    margin-left: calc(var(--sidebar-collapsed-width) + var(--em-gap) * 2);
    width: calc(100% - var(--sidebar-collapsed-width) - var(--em-gap) * 3);
  }
}
/* titolo di pagina grande + percorso come sottotitolo */
html.tema-em #mgr-topbar-title { font-size: calc(26px*var(--fs,1)) !important; font-weight: 700 !important; letter-spacing: -0.02em; color: #1f2a44 !important; line-height: 1.15; }
html.tema-em #mgr-topbar-titlewrap { gap: 3px; }
html.tema-em #mgr-topbar-titlewrap .breadcrumb, html.tema-em #mgr-topbar-titlewrap .breadcrumb a { font-size: calc(13px*var(--fs,1)); color: var(--color-text-secondary); }
/* pulsanti d'azione in alto: bianchi, arrotondati, icona + scritta (come «In preventivo», «Voucher», «Note paziente») */
html.tema-em .topbar-right { gap: 10px; }
html.tema-em .mgr-action-btn, html.tema-em #topbar-guide-btn, html.tema-em #topbar-testo-btn {
  background: #fff !important; color: #1f2a44 !important; border: 1px solid #e3e9f2 !important;
  border-radius: 12px !important; padding: 0 16px !important; height: 42px; font-weight: 600 !important;
  font-size: calc(13.5px*var(--fs,1)) !important; box-shadow: 0 1px 2px rgba(24, 48, 88, 0.06); margin-right: 0 !important;
}
html.tema-em .mgr-action-btn:hover, html.tema-em #topbar-guide-btn:hover, html.tema-em #topbar-testo-btn:hover { border-color: var(--color-primary-200) !important; box-shadow: 0 4px 12px rgba(24, 48, 88, 0.08); }
html.tema-em .mgr-action-btn svg, html.tema-em #topbar-guide-btn svg, html.tema-em #topbar-testo-btn svg { color: var(--color-primary); }
/* l'azione distruttiva resta rossa, ma come «Esci» di EM: chiara col testo rosso */
html.tema-em .mgr-action-btn[style*="eb5757"], html.tema-em .mgr-action-btn[style*="dc2626"] {
  background: #fff5f5 !important; color: #d94545 !important; border-color: #f5c6c6 !important;
}
html.tema-em .mgr-action-btn[style*="eb5757"] svg, html.tema-em .mgr-action-btn[style*="dc2626"] svg { color: #d94545; }
/* riquadro utente in fondo alla barra laterale */
html.tema-em .sidebar-user { margin: 10px 12px 14px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.07); padding: 12px; }
html.tema-em .sidebar-user-name { color: #fff; font-weight: 700; }
html.tema-em .sidebar-version { margin-top: -6px; color: #9fb2d8; opacity: 1; }
/* riquadri e intestazioni di tabella come EM */
html.tema-em .card, html.tema-em .patient-table-wrapper, html.tema-em .results-table-wrapper, html.tema-em .report-toolbar,
html.tema-em .patient-card { border-radius: 18px; border: 1px solid #e3e9f2; }
html.tema-em .patient-table thead th, html.tema-em .results-table thead th, html.tema-em table.dataTable thead th { background: #f1f5f9; }

/* --- Modalità scura: il tema EM non la sovrascrive (body.dark resta com'è) -------------- */
html.tema-em body.dark { background: var(--color-bg); }

/* 02/11/2026 fascia alta compatta della worklist: barra in alto da 92 a 60 px, titolo a 20 px col percorso accanto.
   :has() la limita a questa pagina: le altre e il referto restano in stile EntryMed. --topbar-height sposta da se'
   contenuto e fascia fissa. */
@media (min-width: 1025px) {
  html.tema-em:has(#worklist-patient-view) { --topbar-height: 60px; }
  html.tema-em:has(#worklist-patient-view) .topbar { padding-top: 10px; }
  html.tema-em:has(#worklist-patient-view) #mgr-topbar-title { font-size: calc(20px*var(--fs,1)) !important; }
  html.tema-em:has(#worklist-patient-view) #mgr-topbar-titlewrap { flex-direction: row !important; align-items: baseline; gap: 12px; white-space: nowrap; }
  html.tema-em:has(#worklist-patient-view) #topbar-guide-btn,
  html.tema-em:has(#worklist-patient-view) #topbar-testo-btn,
  html.tema-em:has(#worklist-patient-view) .mgr-action-btn { height: 36px !important; }
}
