/* =============================================
   HSE Copilot — Design System
   ============================================= */

/* --- CSS Custom Properties (Dark — default) --- */
:root {
  /* === Hitachi Energy Brand === */
  --hse-primary: #C8102E;
  --hse-primary-hover: #A50D24;
  --hse-primary-active: #8E0B1F;
  --hse-red-dark: #8E0B1F;
  --hse-primary-light: rgba(200, 16, 46, 0.08);
  --hse-primary-glow: rgba(200, 16, 46, 0.12);

  /* Bordeaux (deep accent) */
  --hse-accent: #7A0019;
  --hse-accent-hover: #5E0013;
  --hse-bordeaux: #6E0417;

  /* Controlled steel — the ONLY non-red accent (replaces all random blues).
     Legacy --hse-blue* names are repointed here so old references stay coherent.
     Lightened to #4A7DAF for WCAG AA on dark surfaces (5.2:1 on #16181D). */
  --hse-steel:       #4A7DAF;
  --hse-steel-dark:  #37618E;
  --hse-steel-light: rgba(74, 125, 175, 0.18);
  --hse-blue:        #4A7DAF;
  --hse-blue-dark:   #37618E;
  --hse-blue-light:  rgba(74, 125, 175, 0.18);

  /* Cool neutral gray scale */
  --hse-gray-50:  #F6F7F9;
  --hse-gray-100: #EEF0F3;
  --hse-gray-200: #E2E5EA;
  --hse-gray-300: #CBD1D9;
  --hse-gray-400: #9AA2AD;
  --hse-gray-500: #6B7280;
  --hse-gray-600: #4B5158;
  --hse-gray-700: #33383F;
  --hse-gray:       #9AA2AD;
  --hse-gray-dark:  #4B5158;

  /* === Sidebar — always anthracite, independent of light/dark theme === */
  --hse-bg-sidebar:          #16181D;
  --hse-sidebar-surface-2:   #1C1F26;
  --hse-sidebar-text:        #C7CBD1;
  --hse-sidebar-text-heading:#F5F6F8;
  --hse-sidebar-text-muted:  #7E858F;
  --hse-sidebar-border:      rgba(255, 255, 255, 0.08);
  --hse-sidebar-hover:       rgba(255, 255, 255, 0.06);
  --hse-sidebar-active-bg:   rgba(200, 16, 46, 0.15);
  --hse-sidebar-active-text: #E5626B;

  /* === Surfaces (Dark — default) === */
  --hse-bg-body: #0C0D10;
  --hse-bg-card: #16181D;
  --hse-bg-card-hover: #1C1F26;
  --hse-bg-subtle: #1C1F26;
  --hse-bg-input: #1A1C22;
  --hse-bg: #16181D;
  --hse-bg-header: rgba(12, 13, 16, 0.85);
  --hse-bg-popup: #16181D;
  --hse-bg-modal: #16181D;

  /* Borders */
  --hse-border: rgba(255, 255, 255, 0.08);
  --hse-border-hover: rgba(255, 255, 255, 0.16);
  --hse-border-active: var(--hse-primary);

  /* Text */
  --hse-text: #E4E7EB;
  --hse-text-secondary: #A6ADB7;
  --hse-text-muted: #737B85;
  --hse-text-heading: #F5F6F8;

  /* Status */
  --hse-success: #2E9E52;
  --hse-success-bg: rgba(46, 158, 82, 0.14);
  --hse-warning: #E0A400;
  --hse-warning-bg: rgba(224, 164, 0, 0.14);
  --hse-danger: #E5484D;
  --hse-danger-bg: rgba(229, 72, 77, 0.14);
  --hse-info: #4A7DAF;
  --hse-info-bg: rgba(74, 125, 175, 0.16);

  /* GAP semantic (aligned to output.py DOC4 Excel color codes) */
  --gap-coperto:  #2E7D46;
  --gap-parziale: #E0A400;
  --gap-assente:  #C62828;
  --gap-aggiunta: #37618E;
  --gap-na:       #8B9199;
  --gap-nv:       #D97706;

  /* Type scale */
  --fs-xs: 0.72rem;
  --fs-sm: 0.82rem;
  --fs-base: 0.9rem;
  --fs-md: 1rem;
  --fs-lg: 1.15rem;
  --fs-xl: 1.4rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.1rem;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;

  /* Layout */
  --hse-sidebar-w: 264px;
  --hse-sidebar-collapsed-w: 74px;
  --hse-header-h: 64px;
  --hse-radius:    12px;
  --hse-radius-sm:  8px;
  --hse-radius-lg: 16px;
  --hse-radius-xl: 22px;
  --hse-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --hse-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --hse-ease-out:   cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --hse-shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.40);
  --hse-shadow:      0 4px 18px rgba(0, 0, 0, 0.38);
  --hse-shadow-lg:   0 16px 42px rgba(0, 0, 0, 0.48);
  --hse-shadow-glow: 0 4px 16px rgba(200, 16, 46, 0.32);
  --hse-shadow-steel-glow: 0 4px 16px rgba(74, 125, 175, 0.28);
  --hse-shadow-card: 0 0 0 1px rgba(255,255,255,0.05), 0 4px 18px rgba(0,0,0,0.38);

  /* Glass surface tokens (dark only) */
  --hse-glass-bg:     rgba(22, 24, 29, 0.72);
  --hse-glass-border: rgba(255, 255, 255, 0.09);
  --hse-glass-blur:   blur(14px);

  /* Extended border system */
  --hse-border-subtle: rgba(255, 255, 255, 0.06);
  --hse-border-strong: rgba(255, 255, 255, 0.18);

  /* Font */
  --hse-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --hse-font-heading: 'Archivo', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

/* --- Light Theme --- */
[data-theme="light"] {
  --hse-primary: #C8102E;
  --hse-primary-hover: #A50D24;
  --hse-primary-active: #8E0B1F;
  --hse-primary-light: rgba(200, 16, 46, 0.07);
  --hse-primary-glow: rgba(16, 24, 40, 0.10);
  --hse-accent: #7A0019;
  --hse-accent-hover: #5E0013;

  /* Steel: darker for WCAG AA on white (6.4:1 on #FFF) */
  --hse-steel:       #2B5F8F;
  --hse-steel-dark:  #1E4A73;
  --hse-steel-light: rgba(43, 95, 143, 0.12);
  --hse-blue:        #2B5F8F;
  --hse-blue-dark:   #1E4A73;
  --hse-blue-light:  rgba(43, 95, 143, 0.12);
  --hse-info:        #2B5F8F;
  --hse-info-bg:     rgba(43, 95, 143, 0.10);

  /* Surfaces — cool off-white body, white cards. Sidebar tokens intentionally
     NOT overridden here so the sidebar stays anthracite in light theme. */
  --hse-bg-body:       #F4F5F7;
  --hse-bg-card:       #FFFFFF;
  --hse-bg-card-hover: #F8F9FB;
  --hse-bg-subtle:     #EEF0F3;
  --hse-bg-input:      #FFFFFF;
  --hse-bg:            #FFFFFF;
  --hse-bg-header:     rgba(244, 245, 247, 0.90);
  --hse-bg-popup:      #FFFFFF;
  --hse-bg-modal:      #FFFFFF;

  --hse-border:        rgba(15, 20, 30, 0.08);
  --hse-border-hover:  rgba(15, 20, 30, 0.16);
  --hse-border-subtle: rgba(15, 20, 35, 0.05);
  --hse-border-strong: rgba(15, 20, 35, 0.16);

  --hse-text: #1E232B;
  --hse-text-secondary: #4B5158;
  --hse-text-muted: #7A828C;
  --hse-text-heading: #0E1116;

  --hse-success-bg: rgba(46, 125, 70, 0.10);
  --hse-warning-bg: rgba(224, 164, 0, 0.12);
  --hse-danger-bg:  rgba(198, 40, 40, 0.10);
  --hse-info-bg:    rgba(43, 95, 143, 0.10);

  --hse-shadow-sm:         0 1px 2px rgba(16, 24, 40, 0.05);
  --hse-shadow:            0 2px 8px rgba(16, 24, 40, 0.06);
  --hse-shadow-lg:         0 12px 28px rgba(16, 24, 40, 0.10);
  --hse-shadow-glow:       0 4px 14px rgba(200, 16, 46, 0.22);
  --hse-shadow-steel-glow: 0 4px 14px rgba(43, 95, 143, 0.18);
  --hse-shadow-card:       0 2px 8px rgba(16, 24, 40, 0.08);

  /* Glass — in light mode no glass: solid white + shadow-based elevation */
  --hse-glass-bg:     #FFFFFF;
  --hse-glass-border: rgba(15, 20, 30, 0.10);
  --hse-glass-blur:   blur(0px);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

[data-theme="light"] ::selection {
  background: var(--hse-primary-light);
  color: var(--hse-text-heading);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--hse-font);
  background-color: var(--hse-bg-body);
  background-image: none;
  color: var(--hse-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--hse-font-heading);
  font-weight: 700;
  font-stretch: 110%;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 80% 50% at 15% -10%,
      rgba(200, 16, 46, 0.055) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 110%,
      rgba(74, 125, 175, 0.050) 0%, transparent 55%);
  background-attachment: fixed;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 70% 50% at 8% -5%,
      rgba(200, 16, 46, 0.025) 0%, transparent 55%),
    radial-gradient(ellipse 50% 35% at 92% 105%,
      rgba(74, 125, 175, 0.020) 0%, transparent 50%);
}

a {
  color: var(--hse-primary);
  text-decoration: none;
  transition: color var(--hse-transition);
}

a:hover {
  color: var(--hse-primary-hover);
}

/* --- Accessibility: visible keyboard focus + reduced motion --- */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
.hse-btn:focus-visible,
.btn:focus-visible,
.hse-sidebar-link:focus-visible,
.hse-sidebar-user:focus-visible,
.exp-tab:focus-visible,
.bl-tab:focus-visible,
.hse-checkbox:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--hse-primary);
  outline-offset: 2px;
  border-radius: var(--hse-radius-sm);
}

/* Keep the anthracite sidebar focus ring legible on dark */
.hse-sidebar-link:focus-visible,
.hse-sidebar-user:focus-visible,
.hse-sidebar-brand-collapse:focus-visible {
  outline-color: var(--hse-sidebar-active-text);
}

@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;
  }
}

::selection {
  background: var(--hse-primary-light);
  color: var(--hse-text-heading);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Layout --- */
.hse-layout {
  display: flex;
  min-height: 100vh;
}

.hse-main-wrapper {
  flex: 1;
  min-width: 0;
  margin-left: var(--hse-sidebar-w);
  transition: margin-left var(--hse-transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hse-main-content {
  flex: 1;
  min-width: 0;
  padding: 2rem;
  padding-top: calc(var(--hse-header-h) + 2rem);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* --- Sidebar --- */
.hse-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--hse-sidebar-w);
  height: 100vh;
  background: var(--hse-bg-sidebar);
  border-right: 1px solid var(--hse-sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width var(--hse-transition), transform var(--hse-transition);
  overflow: visible;
}

/* Right edge gradient decorativo */
.hse-sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(200, 16, 46, 0.28) 25%,
    rgba(74, 125, 175, 0.20) 75%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

.hse-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--hse-sidebar-border);
  min-height: 64px;
  position: relative;
  overflow: hidden;
}

.hse-sidebar-brand::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 120px; height: 64px;
  background: radial-gradient(ellipse, rgba(200, 16, 46, 0.10) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
}

/* Accenture logo — sempre visibile */
.hse-brand-accenture {
  height: 22px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
}

/* Separatore verticale */
.hse-brand-divider {
  width: 1px;
  height: 28px;
  background: var(--hse-border-hover);
  margin: 0 14px;
  flex-shrink: 0;
  transition: opacity var(--hse-transition);
}

/* App brand mark */
.hse-brand-app {
  height: 20px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  transition: opacity var(--hse-transition);
  /* In dark mode il grigio #a8a8a7 ha contrasto basso: lo rendiamo più leggibile */
  filter: brightness(1.0);
}

[data-theme="dark"] .hse-brand-app {
  filter: brightness(1.6) contrast(1.05);
}

/* Brand collapse toggle */
.hse-sidebar-brand-collapse {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--hse-sidebar-border);
  color: var(--hse-sidebar-text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  transition: all var(--hse-transition);
}

.hse-sidebar-brand-collapse:hover {
  background: var(--hse-sidebar-hover);
  color: var(--hse-sidebar-text-heading);
  border-color: var(--hse-sidebar-active-text);
  transform: scale(1.1);
}

.hse-sidebar-brand-collapse i {
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1;
}

/* Collapsed: only sidebar-scoped brand elements get hidden (header logos are unaffected) */
body.sidebar-collapsed .hse-sidebar .hse-brand-accenture,
body.sidebar-collapsed .hse-sidebar .hse-brand-divider,
body.sidebar-collapsed .hse-sidebar .hse-brand-app {
  opacity: 0;
  width: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

body.sidebar-collapsed .hse-sidebar-brand {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .hse-sidebar-brand-collapse {
  margin-left: 0;
}

.hse-sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.hse-sidebar-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--hse-sidebar-text-muted);
  padding: 16px 12px 6px;
  white-space: nowrap;
}

.hse-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--hse-radius-sm);
  color: var(--hse-sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s var(--hse-spring);
  white-space: nowrap;
  position: relative;
  margin-bottom: 2px;
}

.hse-sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.2s var(--hse-spring);
}

.hse-sidebar-link:hover {
  background: var(--hse-sidebar-hover);
  color: var(--hse-sidebar-text-heading);
  padding-left: 16px;
}

.hse-sidebar-link:hover i {
  color: var(--hse-sidebar-active-text);
  transform: scale(1.12);
}

.hse-sidebar-link.active {
  background: linear-gradient(90deg,
    rgba(200, 16, 46, 0.22) 0%,
    rgba(200, 16, 46, 0.08) 55%,
    transparent 100%
  );
  color: var(--hse-sidebar-active-text);
  font-weight: 600;
}

.hse-sidebar-link.active i {
  color: var(--hse-sidebar-active-text);
}

.hse-sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: linear-gradient(180deg, var(--hse-primary), var(--hse-sidebar-active-text));
  border-radius: 0 5px 5px 0;
  box-shadow: 0 0 12px rgba(229, 98, 107, 0.55);
}

.hse-sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--hse-sidebar-border);
  position: relative;
}

.hse-sidebar-admin-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: var(--hse-radius-sm);
  color: var(--hse-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--hse-transition);
  white-space: nowrap;
  position: relative;
  margin-bottom: 6px;
  text-decoration: none;
}

.hse-sidebar-admin-link i {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  color: var(--hse-text-muted);
  transition: color var(--hse-transition);
}

.hse-sidebar-admin-link:hover {
  background: var(--hse-primary-light);
  color: var(--hse-text-heading);
}

.hse-sidebar-admin-link:hover i {
  color: var(--hse-primary);
}

.hse-sidebar-admin-link.active {
  background: var(--hse-primary-light);
  color: var(--hse-primary);
  font-weight: 600;
}

.hse-sidebar-admin-link.active i {
  color: var(--hse-primary);
}

.hse-sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 7px;
  border-radius: var(--hse-radius-sm);
  cursor: pointer;
  color: var(--hse-sidebar-text);
  transition: all var(--hse-transition);
}

.hse-sidebar-user:hover {
  background: var(--hse-sidebar-hover);
  box-shadow: inset 3px 0 0 var(--hse-sidebar-active-text);
}

.hse-sidebar-user:hover .hse-sidebar-user-name {
  color: var(--hse-sidebar-text-heading);
}

.hse-sidebar-user:hover .hse-sidebar-user-more {
  color: var(--hse-sidebar-active-text);
  opacity: 1;
}

.hse-sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--hse-sidebar-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}

.hse-sidebar-user-info {
  overflow: hidden;
  white-space: nowrap;
}

.hse-sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hse-sidebar-text-heading);
  text-overflow: ellipsis;
  overflow: hidden;
}

.hse-sidebar-user-role {
  font-size: 0.65rem;
  color: var(--hse-sidebar-text-muted);
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Collapsed sidebar */
body.sidebar-collapsed .hse-sidebar {
  width: var(--hse-sidebar-collapsed-w);
}

body.sidebar-collapsed .hse-main-wrapper {
  margin-left: var(--hse-sidebar-collapsed-w);
}

body.sidebar-collapsed .hse-sidebar-brand-text,
body.sidebar-collapsed .hse-sidebar-section-label,
body.sidebar-collapsed .hse-sidebar-user-info,
body.sidebar-collapsed .hse-sidebar-link span,
body.sidebar-collapsed .hse-sidebar-admin-link span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

body.sidebar-collapsed .hse-sidebar-link,
body.sidebar-collapsed .hse-sidebar-admin-link {
  justify-content: center;
  padding: 12px;
  gap: 0;
}

body.sidebar-collapsed .hse-sidebar-link i {
  font-size: 1.1rem;
}

body.sidebar-collapsed .hse-sidebar-user {
  justify-content: center;
  position: relative;
  padding: 12px;
  gap: 0;
}

/* Elegant tooltips for collapsed sidebar */
body.sidebar-collapsed .hse-sidebar-link::after,
body.sidebar-collapsed .hse-sidebar-admin-link::after,
body.sidebar-collapsed .hse-sidebar-user::after {
  content: attr(data-title);
  position: absolute;
  left: calc(100% + 15px);
  top: 50%;
  transform: translateY(-50%) translateX(-10px);
  background: var(--hse-bg-header);
  backdrop-filter: blur(12px);
  color: var(--hse-text-heading);
  padding: 8px 16px;
  border-radius: var(--hse-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: var(--hse-shadow-lg);
  border: 1px solid var(--hse-border);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
}

body.sidebar-collapsed .hse-sidebar-nav {
  overflow: visible;
}

body.sidebar-collapsed .hse-sidebar-user::after {
  content: attr(data-title);
}

body.sidebar-collapsed .hse-sidebar-link:hover::after,
body.sidebar-collapsed .hse-sidebar-admin-link:hover::after,
body.sidebar-collapsed .hse-sidebar-user:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* --- Header --- */
.hse-header {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--hse-sidebar-w);
  height: var(--hse-header-h);
  background: var(--hse-bg-header);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--hse-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1030;
  transition: left var(--hse-transition);
}

body.sidebar-collapsed .hse-header {
  left: var(--hse-sidebar-collapsed-w);
}

[data-theme="dark"] .hse-header {
  background: rgba(10, 11, 14, 0.82);
  border-bottom-color: var(--hse-glass-border);
}

[data-theme="light"] .hse-header {
  background: var(--hse-bg-header);
  border-bottom-color: rgba(15, 20, 35, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hse-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hse-header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--hse-text-heading);
  margin: 0;
}

.hse-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hse-header-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hse-border);
  background: transparent;
  color: var(--hse-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--hse-transition);
  position: relative;
  font-size: 1rem;
}

.hse-header-btn:hover {
  background: var(--hse-primary-light);
  color: var(--hse-primary);
  border-color: var(--hse-primary);
}

.hse-sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--hse-text-heading);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* --- Notification Bell Badge --- */
.hse-notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--hse-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--hse-bg-body);
  animation: hse-badge-pulse 2s ease-in-out infinite;
}

@keyframes hse-badge-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.hse-notification-badge:empty,
.hse-notification-badge[data-count="0"] {
  display: none;
}

/* --- Notification Popup --- */
.hse-notif-popup {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  background: var(--hse-bg-popup);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
  box-shadow: var(--hse-shadow-lg);
  z-index: 1060;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.hse-notif-popup.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hse-notif-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--hse-border);
}

.hse-notif-popup-header h6 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--hse-text-heading);
}

.hse-notif-popup-header a {
  font-size: 0.75rem;
  font-weight: 600;
}

.hse-notif-popup-body {
  max-height: 360px;
  overflow-y: auto;
}

.hse-notif-popup-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--hse-text-muted);
  font-size: 0.85rem;
}

.hse-notif-popup-empty i {
  display: block;
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.4;
}

.hse-notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hse-border);
  transition: background var(--hse-transition);
  cursor: pointer;
}

.hse-notif-item:last-child {
  border-bottom: none;
}

.hse-notif-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.hse-notif-item.unread {
  background: var(--hse-primary-light);
}

.hse-notif-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.hse-notif-item-icon.info {
  background: var(--hse-info-bg);
  color: var(--hse-info);
}

.hse-notif-item-icon.action {
  background: var(--hse-warning-bg);
  color: var(--hse-warning);
}

.hse-notif-item-content {
  flex: 1;
  min-width: 0;
}

.hse-notif-item-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hse-text-heading);
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hse-notif-item-desc {
  font-size: 0.75rem;
  color: var(--hse-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hse-notif-item-meta {
  font-size: 0.65rem;
  color: var(--hse-text-muted);
  margin-top: 4px;
}

.hse-notif-popup-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--hse-border);
  text-align: center;
}

.hse-notif-popup-footer a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hse-primary);
}

/* --- Cards --- */
.hse-card {
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
  padding: 24px;
  transition:
    border-color 0.25s var(--hse-ease-out),
    box-shadow   0.25s var(--hse-ease-out),
    transform    0.2s  var(--hse-spring);
}

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

[data-theme="dark"] .hse-card {
  background: var(--hse-glass-bg);
  border-color: var(--hse-glass-border);
  backdrop-filter: var(--hse-glass-blur);
  -webkit-backdrop-filter: var(--hse-glass-blur);
}

[data-theme="dark"] .hse-card:hover {
  background: rgba(28, 31, 38, 0.80);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.07), 0 8px 32px rgba(0,0,0,0.45);
  transform: translateY(-2px);
}

[data-theme="light"] .hse-card {
  background: #FFFFFF;
  border: 1px solid rgba(15, 20, 35, 0.08);
  box-shadow:
    0 1px 2px rgba(15, 20, 35, 0.05),
    0 4px 14px rgba(15, 20, 35, 0.04);
}

[data-theme="light"] .hse-card:hover {
  border-color: rgba(200, 16, 46, 0.18);
  box-shadow:
    0 1px 2px rgba(15, 20, 35, 0.06),
    0 6px 20px rgba(15, 20, 35, 0.08),
    0 0 0 3px rgba(200, 16, 46, 0.06);
  transform: translateY(-2px);
}

.hse-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.hse-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--hse-text-heading);
  margin: 0;
}

.hse-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--hse-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* --- Stat Cards --- */
.hse-stat-card {
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
  padding: 24px;
  transition: all var(--hse-transition);
  position: relative;
  overflow: hidden;
}

.hse-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stat-color, var(--hse-primary));
  opacity: 0;
  transition: opacity var(--hse-transition);
}

.hse-stat-card:hover {
  border-color: var(--hse-border-hover);
  box-shadow: var(--hse-shadow);
}

.hse-stat-card:hover::before {
  opacity: 1;
}

[data-theme="dark"] .hse-stat-card {
  background: var(--hse-glass-bg);
  border-color: var(--hse-glass-border);
  backdrop-filter: var(--hse-glass-blur);
  -webkit-backdrop-filter: var(--hse-glass-blur);
}

[data-theme="light"] .hse-stat-card {
  background: #FFFFFF;
  border: 1px solid rgba(15, 20, 35, 0.08);
  box-shadow: 0 2px 10px rgba(15, 20, 35, 0.05);
}

.hse-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--hse-text-heading);
  line-height: 1.1;
}

.hse-stat-label {
  font-size: 0.8rem;
  color: var(--hse-text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.hse-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--hse-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* --- Buttons --- */
.hse-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--hse-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--hse-font);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--hse-transition);
  white-space: nowrap;
}

.hse-btn-primary {
  background: var(--hse-primary);
  color: #ffffff;
  border-color: var(--hse-primary);
}

.hse-btn-primary:hover {
  background: var(--hse-primary-hover);
  color: #ffffff !important;
  box-shadow: var(--hse-shadow-glow);
  transform: translateY(-2px);
}

.hse-btn-primary:active {
  transform: scale(0.97) !important;
  transition-duration: 0.1s;
}

.hse-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.hse-btn-ghost:hover {
  background: var(--hse-primary-light);
  color: var(--hse-primary);
  border-color: rgba(200, 16, 46, 0.40);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.10);
}

.hse-btn-ghost:active {
  transform: scale(0.97) !important;
  transition-duration: 0.1s;
}

.hse-btn-danger {
  background: transparent;
  color: var(--hse-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.hse-btn-danger:hover {
  background: var(--hse-danger-bg);
  border-color: var(--hse-danger);
}

.hse-btn-success {
  background: var(--hse-success);
  color: #fff;
  border-color: var(--hse-success);
}

.hse-btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
}

.hse-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

/* Secondary button — filled neutral (the previously-missing variant) */
.hse-btn-secondary,
.btn-secondary {
  background: var(--hse-bg-subtle);
  color: var(--hse-text-heading);
  border-color: var(--hse-border);
}

.hse-btn-secondary:hover,
.btn-secondary:hover {
  background: var(--hse-bg-card-hover);
  border-color: var(--hse-steel);
  color: var(--hse-steel);
  box-shadow: var(--hse-shadow-steel-glow);
}

.hse-btn-secondary:active,
.btn-secondary:active {
  transform: scale(0.97) !important;
  transition-duration: 0.1s;
}

/* --- Legacy .btn* aliases → mapped onto the design-system buttons ---
   Several templates (gestione.html, nuova.html, errors/*) use .btn / .btn-primary
   which had no definition and rendered unstyled. These aliases fix that. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--hse-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--hse-font);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--hse-transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--hse-primary);
  color: #fff;
  border-color: var(--hse-primary);
}

.btn-primary:hover {
  background: var(--hse-primary-hover);
  color: #fff;
  box-shadow: var(--hse-shadow-glow);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: scale(0.97) !important;
  transition-duration: 0.1s;
}

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

.btn-ghost:hover {
  background: var(--hse-primary-light);
  color: var(--hse-primary);
  border-color: rgba(200, 16, 46, 0.40);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.10);
}

.btn:active,
.btn-ghost:active {
  transform: scale(0.97) !important;
  transition-duration: 0.1s;

}

.btn-danger {
  background: transparent;
  color: var(--hse-danger);
  border-color: rgba(229, 72, 77, 0.35);
}

.btn-danger:hover {
  background: var(--hse-danger-bg);
  border-color: var(--hse-danger);
}

.btn-lg {
  padding: 13px 26px;
  font-size: 0.95rem;
}

.btn:disabled,
.hse-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

[data-theme="light"] .hse-btn-ghost,
[data-theme="light"] .btn-ghost {
  border-color: rgba(15, 20, 35, 0.16);
  color: var(--hse-text-secondary);
}

[data-theme="light"] .hse-btn-ghost:hover,
[data-theme="light"] .btn-ghost:hover {
  border-color: rgba(200, 16, 46, 0.30);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.07);
}

[data-theme="light"] .hse-btn-primary:hover,
[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.22);
}

/* --- File-type badge (professional, replaces raw extensions) --- */
.hse-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--hse-bg-subtle);
  color: var(--hse-text-secondary);
  border: 1px solid var(--hse-border);
  line-height: 1.5;
  white-space: nowrap;
}

.hse-file-badge i { font-size: 0.82em; }
.hse-file-badge.pdf { color: #D0392B; border-color: rgba(208, 57, 43, 0.30); background: rgba(208, 57, 43, 0.08); }
.hse-file-badge.doc { color: #2B579A; border-color: rgba(43, 87, 154, 0.30); background: rgba(43, 87, 154, 0.08); }
.hse-file-badge.xls { color: #1D6F42; border-color: rgba(29, 111, 66, 0.30); background: rgba(29, 111, 66, 0.08); }
.hse-file-badge.zip { color: #B58100; border-color: rgba(181, 129, 0, 0.30); background: rgba(181, 129, 0, 0.10); }
.hse-file-badge.img { color: #7A5A0A; border-color: rgba(122, 90, 10, 0.30); background: rgba(122, 90, 10, 0.08); }

/* --- Breadcrumb --- */
.hse-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--hse-text-muted);
  margin-bottom: 0.5rem;
}

.hse-breadcrumb a {
  color: var(--hse-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: color var(--hse-transition);
}

.hse-breadcrumb a:hover { color: var(--hse-primary); }
.hse-breadcrumb .sep { font-size: 0.6rem; opacity: 0.6; }
.hse-breadcrumb .current { color: var(--hse-text-secondary); font-weight: 600; }

/* --- Badges --- */
.hse-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.hse-badge-primary {
  background: var(--hse-primary-light);
  color: var(--hse-primary);
}

.hse-badge-success {
  background: var(--hse-success-bg);
  color: var(--hse-success);
}

.hse-badge-warning {
  background: var(--hse-warning-bg);
  color: var(--hse-warning);
}

.hse-badge-danger {
  background: var(--hse-danger-bg);
  color: var(--hse-danger);
}

.hse-badge-info {
  background: var(--hse-info-bg);
  color: var(--hse-info);
}

.hse-badge-muted {
  background: rgba(100, 116, 139, 0.15);
  color: var(--hse-text-muted);
}

/* --- Tables --- */
.hse-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
}

.hse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.hse-table thead th {
  background: var(--hse-bg-subtle);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--hse-text-muted);
  border-bottom: 1px solid var(--hse-border);
  white-space: nowrap;
}

.hse-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--hse-border);
  color: var(--hse-text);
  vertical-align: middle;
}

.hse-table tbody tr {
  transition: background var(--hse-transition);
}

.hse-table tbody tr:hover {
  background: var(--hse-bg-subtle);
}

.hse-table tbody tr:last-child td {
  border-bottom: none;
}

/* --- Forms --- */
.hse-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--hse-bg-input);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-sm);
  color: var(--hse-text);
  font-size: 0.85rem;
  font-family: var(--hse-font);
  transition: all var(--hse-transition);
}

.hse-input:focus {
  outline: none;
  border-color: var(--hse-primary);
  box-shadow: 0 0 0 3px var(--hse-primary-light);
}

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

.hse-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--hse-text-secondary);
  margin-bottom: 6px;
}

.hse-input-group {
  position: relative;
  display: flex;
  align-items: center;
}


.hse-select {
  appearance: none;
  width: 100%;
  padding: 10px 36px 10px 14px;
  background: var(--hse-bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-sm);
  color: var(--hse-text);
  font-size: 0.85rem;
  font-family: var(--hse-font);
  cursor: pointer;
  transition: all var(--hse-transition);
}

.hse-select:focus {
  outline: none;
  border-color: var(--hse-primary);
  box-shadow: 0 0 0 3px var(--hse-primary-light);
}

/* --- Modals --- */
.hse-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.hse-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.hse-modal {
  background: var(--hse-bg-modal);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  transition:
    transform 0.32s var(--hse-spring),
    opacity   0.22s var(--hse-ease-out);
}

.hse-modal-overlay.show .hse-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

[data-theme="dark"] .hse-modal {
  background: rgba(16, 18, 23, 0.94);
  border-color: var(--hse-glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .hse-modal {
  box-shadow: 0 8px 32px rgba(15,20,35,0.14), 0 0 0 1px rgba(15,20,35,0.07);
}

.hse-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--hse-border);
}

.hse-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--hse-text-heading);
  margin: 0;
}

.hse-modal-close {
  background: transparent;
  border: none;
  color: var(--hse-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  transition: color var(--hse-transition);
}

.hse-modal-close:hover {
  color: var(--hse-text-heading);
}

.hse-modal-body {
  padding: 24px;
}

.hse-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--hse-border);
}

/* --- Toasts --- */
.hse-toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hse-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-sm);
  box-shadow: var(--hse-shadow-lg);
  min-width: 300px;
  max-width: 420px;
  animation: hse-slide-in 0.3s ease;
  border-left: 3px solid var(--hse-primary);
}

.hse-toast.success {
  border-left-color: var(--hse-success);
}

.hse-toast.danger {
  border-left-color: var(--hse-danger);
}

.hse-toast.warning {
  border-left-color: var(--hse-warning);
}

.hse-toast.info {
  border-left-color: var(--hse-info);
}

.hse-toast-message {
  flex: 1;
  font-size: 0.85rem;
  color: var(--hse-text);
}

.hse-toast-close {
  background: transparent;
  border: none;
  color: var(--hse-text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px;
}

@keyframes hse-slide-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes hse-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* --- Page Header --- */
.hse-page-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.hse-page-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hse-page-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--hse-primary-light);
  color: var(--hse-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.hse-page-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--hse-text-heading);
  margin: 0 0 4px;
}

.hse-page-subtitle {
  font-size: 0.85rem;
  color: var(--hse-text-secondary);
  margin: 0;
}

@media (max-width: 640px) {
  .hse-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .hse-page-header-title {
    width: 100%;
  }

  .hse-page-subtitle {
    white-space: normal;
    font-size: 0.8rem;
  }
}

/* --- Welcome Hero --- */
.hse-hero {
  background: linear-gradient(135deg, rgba(204, 0, 0, 0.08) 0%, rgba(168, 0, 0, 0.04) 100%);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-lg);
  padding: 32px;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.hse-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--hse-primary-glow) 0%, transparent 70%);
  opacity: 0.3;
  pointer-events: none;
}

.hse-hero-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--hse-text-heading);
  margin: 0 0 8px;
}

.hse-hero-subtitle {
  font-size: 0.95rem;
  color: var(--hse-text-secondary);
  margin: 0;
}

/* --- Grid helpers --- */
.hse-grid {
  display: grid;
  gap: 20px;
}

.hse-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.hse-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.hse-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* --- Filters Bar --- */
.hse-filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 16px 20px;
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
}

/* --- Notification Page Items --- */
.hse-notif-page-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
  transition: all var(--hse-transition);
  margin-bottom: 12px;
}

.hse-notif-page-item.unread {
  border-left: 3px solid var(--hse-primary);
  background: linear-gradient(90deg, var(--hse-primary-light) 0%, var(--hse-bg-card) 40%);
}

.hse-notif-page-item:hover {
  border-color: var(--hse-border-hover);
  box-shadow: var(--hse-shadow-sm);
}

.hse-notif-page-item .hse-notif-checkbox {
  margin-top: 4px;
}

.hse-notif-page-item-body {
  flex: 1;
  min-width: 0;
}

.hse-notif-page-item-body h6 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hse-text-heading);
  margin: 0 0 4px;
}

.hse-notif-page-item-body p {
  font-size: 0.82rem;
  color: var(--hse-text-secondary);
  margin: 0 0 8px;
  line-height: 1.5;
}

.hse-notif-page-item-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.72rem;
  color: var(--hse-text-muted);
}

.hse-notif-page-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* --- Empty State --- */
.hse-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--hse-text-muted);
}

.hse-empty-state i {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 16px;
  display: block;
}

.hse-empty-state h5 {
  font-size: 1rem;
  color: var(--hse-text-secondary);
  margin: 0 0 8px;
}

.hse-empty-state p {
  font-size: 0.85rem;
  margin: 0;
}

/* --- Pagination --- */
.hse-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}

.hse-pagination-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--hse-radius-sm);
  border: 1px solid var(--hse-border);
  background: transparent;
  color: var(--hse-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--hse-transition);
}

.hse-pagination-btn:hover {
  background: var(--hse-primary-light);
  color: var(--hse-primary);
  border-color: var(--hse-primary);
}

.hse-pagination-btn.active {
  background: var(--hse-primary);
  color: #fff;
  border-color: var(--hse-primary);
}

.hse-pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* --- Checkbox custom --- */
.hse-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--hse-border-hover);
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  transition: all var(--hse-transition);
  background: transparent;
}

.hse-checkbox:checked {
  background: var(--hse-primary);
  border-color: var(--hse-primary);
}

.hse-checkbox:checked::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
}

/* --- Flash Messages (premium override) --- */
.alert {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--hse-radius);
  border: 1px solid var(--hse-border);
  background: var(--hse-bg-card);
  color: var(--hse-text);
  padding: 16px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  animation: hse-slide-in 0.3s ease;
  box-shadow: var(--hse-shadow-sm);
  border-left: 4px solid var(--hse-primary);
}

.alert .alert-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.alert .alert-content {
  flex: 1;
  min-width: 0;
}

.alert .btn-close-alert {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--hse-text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--hse-transition);
}

.alert .btn-close-alert:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--hse-text-heading);
}

.alert-success {
  border-left-color: var(--hse-success);
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.06) 0%, var(--hse-bg-card) 40%);
}

.alert-success .alert-icon {
  background: var(--hse-success-bg);
  color: var(--hse-success);
}

.alert-danger {
  border-left-color: var(--hse-danger);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.06) 0%, var(--hse-bg-card) 40%);
}

.alert-danger .alert-icon {
  background: var(--hse-danger-bg);
  color: var(--hse-danger);
}

.alert-warning {
  border-left-color: var(--hse-warning);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.06) 0%, var(--hse-bg-card) 40%);
}

.alert-warning .alert-icon {
  background: var(--hse-warning-bg);
  color: var(--hse-warning);
}

.alert-info {
  border-left-color: var(--hse-info);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.06) 0%, var(--hse-bg-card) 40%);
}

.alert-info .alert-icon {
  background: var(--hse-info-bg);
  color: var(--hse-info);
}

/* --- Upload Modal z-index overlay --- */
#uploadDocModal.hse-modal-overlay {
  z-index: 1060;
}

/* --- Premium File Input --- */
.hse-file-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--hse-bg-input);
  border: 2px dashed var(--hse-border);
  border-radius: var(--hse-radius);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.hse-file-input-wrapper:hover {
  border-color: var(--hse-primary);
  background: var(--hse-primary-light);
}

.hse-file-input-wrapper.drag-over {
  border-color: var(--hse-primary);
  background: var(--hse-primary-light);
  box-shadow: 0 0 0 3px var(--hse-primary-glow);
}

.hse-file-input-wrapper input[type="file"] {
  display: none;
}

.hse-file-input-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--hse-radius-sm);
  border: 1px solid var(--hse-border);
  background: transparent;
  color: var(--hse-primary);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--hse-font);
  cursor: pointer;
  transition: all var(--hse-transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.hse-file-input-btn:hover {
  background: var(--hse-primary-light);
  border-color: var(--hse-primary);
}

.hse-file-input-btn i {
  font-size: 0.85rem;
}

.hse-file-input-name {
  font-size: 0.82rem;
  color: var(--hse-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.hse-file-input-name.has-file {
  color: var(--hse-text);
  font-weight: 500;
}

/* --- Quick Action Cards --- */
.hse-quick-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
  cursor: pointer;
  transition: all var(--hse-transition);
  text-decoration: none;
  color: var(--hse-text);
}

.hse-quick-action:hover {
  border-color: var(--hse-primary);
  background: var(--hse-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--hse-shadow);
  color: var(--hse-text-heading);
}

.hse-quick-action-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--hse-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.hse-quick-action-text h6 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hse-text-heading);
}

.hse-quick-action-text p {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--hse-text-muted);
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .hse-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  .hse-sidebar {
    transform: translateX(-100%);
    width: var(--hse-sidebar-w);
    box-shadow: var(--hse-shadow-lg);
  }

  .hse-sidebar.mobile-open {
    transform: translateX(0);
  }

  .hse-main-wrapper {
    margin-left: 0;
  }

  .hse-header {
    left: 0;
  }

  body.sidebar-collapsed .hse-header {
    left: 0;
  }

  body.sidebar-collapsed .hse-main-wrapper {
    margin-left: 0;
  }

  /* Override collapsed styles on mobile */
  body.sidebar-collapsed .hse-sidebar {
    width: var(--hse-sidebar-w);
  }

  body.sidebar-collapsed .hse-sidebar-brand {
    justify-content: flex-start;
    padding: 0 14px 0 18px;
  }

  body.sidebar-collapsed .hse-sidebar-menu-label {
    display: block !important;
  }

  /* Su mobile la sidebar "collapsed" è comunque a piena larghezza: logo visibile */
  body.sidebar-collapsed .hse-sidebar-logo {
    display: inline-flex;
  }

  body.sidebar-collapsed .hse-sidebar-brand-text,
  body.sidebar-collapsed .hse-sidebar-section-label,
  body.sidebar-collapsed .hse-sidebar-user-info,
  body.sidebar-collapsed .hse-sidebar-link span,
  body.sidebar-collapsed .hse-sidebar-admin-link span {
    opacity: 1;
    width: auto;
  }

  body.sidebar-collapsed .hse-sidebar-link,
  body.sidebar-collapsed .hse-sidebar-admin-link {
    justify-content: flex-start;
    padding: 10px 14px;
    gap: 12px;
  }

  body.sidebar-collapsed .hse-sidebar-link i,
  body.sidebar-collapsed .hse-sidebar-admin-link i {
    font-size: 1rem;
  }

  body.sidebar-collapsed .hse-sidebar-user {
    justify-content: flex-start;
    padding: 10px 14px 10px 7px;
    gap: 12px;
  }

  body.sidebar-collapsed .hse-sidebar-user-more {
    display: block;
  }

  body.sidebar-collapsed .hse-sidebar-link::after,
  body.sidebar-collapsed .hse-sidebar-admin-link::after,
  body.sidebar-collapsed .hse-sidebar-user::after {
    display: none !important;
  }

  body.sidebar-collapsed .hse-user-dropdown {
    width: auto;
    right: 10px;
    left: 10px;
  }

  .hse-sidebar-toggle {
    display: block;
  }

  /* Brand collapse button hidden on mobile (header burger handles it) */
  .hse-sidebar-brand-collapse {
    display: none !important;
  }

  .hse-header-brand {
    display: flex;
  }

  .hse-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .hse-main-content {
    padding: 1.5rem;
    padding-top: calc(var(--hse-header-h) + 1.5rem);
  }
}

@media (max-width: 768px) {

  .hse-grid-2,
  .hse-grid-3,
  .hse-grid-4 {
    grid-template-columns: 1fr;
  }

  .hse-hero {
    padding: 24px;
  }

  .hse-hero-title {
    font-size: 1.2rem;
  }

  .hse-filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .hse-notif-popup {
    position: fixed;
    top: calc(var(--hse-header-h) + 10px);
    left: 16px;
    right: 16px;
    width: auto;
    transform: none;
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* --- Mobile overlay --- */
.hse-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1035;
}

@media (max-width: 992px) {
  .hse-sidebar.mobile-open~.hse-sidebar-overlay {
    display: block;
  }
}

/* --- Utility --- */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 16px;
}

/* --- Theme Toggle --- */
.hse-theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hse-border);
  background: transparent;
  color: var(--hse-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  transition: all var(--hse-transition);
  position: relative;
}

.hse-theme-toggle:hover {
  background: var(--hse-primary-light);
  color: var(--hse-primary);
  border-color: var(--hse-primary);
}

.hse-theme-toggle .fa-sun {
  display: none;
}

.hse-theme-toggle .fa-moon {
  display: inline;
}

[data-theme="light"] .hse-theme-toggle .fa-sun {
  display: inline;
}

[data-theme="light"] .hse-theme-toggle .fa-moon {
  display: none;
}

/* --- Header Brand --- */
.hse-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hse-header-app-logo {
  height: 18px;
  width: auto;
  object-fit: contain;
}

[data-theme="dark"] .hse-header-app-logo {
  filter: brightness(1.6) contrast(1.05);
}

.hse-header-brand-sep {
  color: var(--hse-border-hover);
  font-weight: 300;
  font-size: 1.1rem;
  line-height: 1;
}

.hse-header-brand-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--hse-text-heading);
}

/* --- User Dropdown --- */
.hse-sidebar-user {
  cursor: pointer;
  position: relative;
}

.hse-sidebar-user-more {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--hse-text-muted);
  opacity: 0;
  transition: opacity var(--hse-transition);
}

.hse-sidebar-user:hover .hse-sidebar-user-more {
  opacity: 1;
}

body.sidebar-collapsed .hse-sidebar-user-more {
  display: none;
}

.hse-user-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 10px;
  right: 10px;
  background: var(--hse-bg-popup);
  border: 1px solid var(--hse-border-hover);
  border-radius: var(--hse-radius);
  box-shadow: var(--hse-shadow-lg);
  padding: 6px;
  z-index: 1060;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s ease;
  backdrop-filter: blur(16px);
}

body.sidebar-collapsed .hse-user-dropdown {
  width: 240px;
  right: auto;
}

.hse-user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hse-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--hse-radius-sm);
  color: var(--hse-text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--hse-transition);
  cursor: pointer;
  text-decoration: none;
}

.hse-user-dropdown-item:hover {
  background: var(--hse-primary-light);
  color: var(--hse-text-heading);
}

.hse-user-dropdown-item i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
}

.hse-user-dropdown-logout {
  color: var(--hse-danger);
}

.hse-user-dropdown-logout:hover {
  background: var(--hse-danger-bg);
  color: var(--hse-danger);
}

.hse-user-dropdown-divider {
  height: 1px;
  background: var(--hse-border);
  margin: 4px 8px;
}

/* --- Theme Switch Toggle --- */
.hse-theme-row {
  justify-content: flex-start;
}

.hse-theme-switch {
  position: relative;
  width: 40px;
  height: 22px;
  margin-left: auto;
  flex-shrink: 0;
}

.hse-theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.hse-theme-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  transition: all 0.3s ease;
}

.hse-theme-switch-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--hse-text-secondary);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.hse-theme-switch input:checked+.hse-theme-switch-slider {
  background: var(--hse-primary-light);
}

.hse-theme-switch input:checked+.hse-theme-switch-slider::before {
  transform: translateX(18px);
  background: var(--hse-primary);
}

[data-theme="light"] .hse-theme-switch-slider {
  background: rgba(0, 0, 0, 0.1);
}

/* --- Login Page --- */
.hse-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hse-bg-body);
  position: relative;
  overflow: hidden;
  font-family: var(--hse-font);
}

.hse-login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(204, 0, 0, 0.18) 0%, transparent 65%);
  pointer-events: none;
  animation: hse-login-glow 6s ease-in-out infinite alternate;
}

.hse-login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(168, 0, 0, 0.12) 0%, transparent 65%);
  pointer-events: none;
  animation: hse-login-glow 8s ease-in-out infinite alternate-reverse;
}

@keyframes hse-login-glow {
  0% {
    opacity: 0.5;
    transform: scale(1);
  }

  100% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.hse-login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-lg);
  padding: 40px 36px;
  box-shadow: var(--hse-shadow-lg);
  animation: hse-login-appear 0.5s ease;
}

@keyframes hse-login-appear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hse-login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.hse-login-logo svg {
  height: 36px;
  width: auto;
}

.hse-login-logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--hse-text-heading);
}

.hse-login-form .hse-input {
  margin-bottom: 16px;
}

.hse-login-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--hse-radius-sm);
  background: var(--hse-primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--hse-font);
  cursor: pointer;
  transition: all var(--hse-transition);
}

.hse-login-btn:hover {
  background: var(--hse-primary-hover);
  box-shadow: var(--hse-shadow-glow);
  transform: translateY(-1px);
}

.hse-login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--hse-text-muted);
  font-size: 0.75rem;
}

.hse-login-divider::before,
.hse-login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hse-border);
}

.hse-login-sso {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-sm);
  background: transparent;
  color: var(--hse-text);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--hse-font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--hse-transition);
}

.hse-login-sso:hover {
  background: var(--hse-primary-light);
  border-color: var(--hse-primary);
  color: var(--hse-primary);
}

.hse-login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.72rem;
  color: var(--hse-text-muted);
}

@media (max-width: 480px) {
  .hse-login-card {
    margin: 16px;
    padding: 32px 24px;
  }
}

/* --- Nuovo Ordine Page --- */
.hse-doc-section {
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
  padding: 28px;
  margin-bottom: 20px;
}

.hse-doc-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--hse-text-heading);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--hse-primary-light);
}

.hse-doc-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--hse-text-heading);
  margin: 20px 0 10px;
}

.hse-doc-section p,
.hse-doc-section li {
  font-size: 0.85rem;
  color: var(--hse-text-secondary);
  line-height: 1.7;
}

.hse-doc-section ul {
  padding-left: 20px;
}

.hse-timeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
  margin: 20px 0;
  position: relative;
}

.hse-timeline-item {
  flex: 1;
  min-width: 100px;
  text-align: center;
  position: relative;
  padding: 16px 8px;
}

.hse-timeline-item::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--hse-border);
}

.hse-timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--hse-primary);
  border: 3px solid var(--hse-bg-card);
  position: relative;
  z-index: 1;
  margin: 0 auto 8px;
}

.hse-timeline-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--hse-text-heading);
  position: relative;
  z-index: 1;
}

.hse-timeline-date {
  font-size: 0.65rem;
  color: var(--hse-text-muted);
  position: relative;
  z-index: 1;
}

.hse-doc-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.75rem;
  color: var(--hse-text-muted);
  border-top: 1px solid var(--hse-border);
  margin-top: 32px;
}

/* --- Mini Stat Cards (Home) --- */
.hse-stat-mini-card {
  text-align: center;
  padding: 16px;
  border-radius: var(--hse-radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--hse-border);
  transition: all var(--hse-transition);
}

.hse-stat-mini-card.success {
  background: var(--hse-success-bg);
  border-color: rgba(34, 197, 94, 0.2);
}

.hse-stat-mini-card.warning {
  background: var(--hse-warning-bg);
  border-color: rgba(245, 158, 11, 0.2);
}

.hse-stat-mini-val {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--hse-text-heading);
}

.hse-stat-mini-card.success .hse-stat-mini-val {
  color: var(--hse-success);
}

.hse-stat-mini-card.warning .hse-stat-mini-val {
  color: var(--hse-warning);
}

.hse-stat-mini-label {
  font-size: 0.7rem;
  color: var(--hse-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* PDF icon — use the native Font Awesome glyph (the previous PNG override
   pointed at a missing image and rendered blank). Tinted PDF-red. */
i.fas.fa-file-pdf {
  color: #D0392B;
}

/* ── Role Switcher ──────────────────────────────────────────────────── */
.hse-role-switcher {
  position: relative;
}

.hse-role-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--hse-border);
  background: var(--hse-bg-card);
  color: var(--hse-text-heading);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--hse-transition);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.hse-role-pill:hover {
  border-color: var(--hse-primary);
  background: var(--hse-primary-light);
  color: var(--hse-primary);
}

.hse-role-pill .hse-role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hse-role-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  z-index: 2000;
  overflow: hidden;
  animation: igFadeIn 0.12s ease;
}

.hse-role-dropdown-header {
  padding: 10px 14px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hse-text-muted);
  border-bottom: 1px solid var(--hse-border);
}

.hse-role-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--hse-transition);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--hse-text-heading);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.hse-role-option:hover {
  background: var(--hse-primary-light);
  color: var(--hse-primary);
}

.hse-role-option.active {
  color: var(--hse-primary);
  font-weight: 700;
}

.hse-role-option.active::after {
  content: '';
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hse-primary);
}

.hse-role-option .hse-role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hse-role-dot-admin      { background: #ef4444; }
.hse-role-dot-committente { background: #f59e0b; }
.hse-role-dot-generic    { background: #6b7280; }

/* ─── Upload Activity Tracker ─── */
.hse-upload-dock {
  position: fixed;
  top: calc(var(--hse-header-h) + 12px);
  right: 24px;
  z-index: 9991;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.hse-upload-dock-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--hse-bg-card);
  border: 1.5px solid var(--hse-border);
  box-shadow: var(--hse-shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  animation: hse-dock-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hse-dock-pop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

.hse-upload-dock-btn:hover {
  background: var(--hse-bg-card-hover);
  border-color: var(--hse-border-hover);
  transform: scale(1.06);
  box-shadow: var(--hse-shadow-lg), 0 0 0 3px var(--hse-primary-glow);
}

.hse-upload-dock-btn.uploading {
  border-color: var(--hse-primary);
  background: var(--hse-primary-light);
  box-shadow: var(--hse-shadow-lg), 0 0 16px var(--hse-primary-glow);
}

.hse-upload-dock-btn.processing {
  border-color: var(--hse-info);
  background: var(--hse-info-bg);
}

.hse-upload-dock-btn.all-done {
  border-color: var(--hse-success);
  background: var(--hse-success-bg);
}

.hse-upload-dock-btn i {
  font-size: 1.25rem;
  transition: color 0.2s;
}

.hse-upload-dock-btn.uploading i,
.hse-upload-dock-btn.processing i {
  color: var(--hse-primary);
}

.hse-upload-dock-btn.all-done i {
  color: var(--hse-success);
}

.hse-upload-dock-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--hse-primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--hse-bg-body);
  transition: background 0.3s;
}

.hse-upload-dock-badge.done {
  background: var(--hse-success);
}

.hse-upload-panel {
  width: 330px;
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
  box-shadow: var(--hse-shadow-lg);
  overflow: hidden;
  pointer-events: auto;
  animation: hse-panel-slide-in 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
  transform-origin: top right;
}

@keyframes hse-panel-slide-in {
  from { opacity: 0; transform: scale(0.88) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.hse-upload-panel-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--hse-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--hse-bg-card), var(--hse-bg-input));
}

.hse-upload-panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--hse-text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hse-upload-panel-title i {
  color: var(--hse-primary);
  font-size: 0.85rem;
}

.hse-upload-panel-close {
  background: transparent;
  border: none;
  color: var(--hse-text-muted);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0.78rem;
}

.hse-upload-panel-close:hover {
  background: var(--hse-border);
  color: var(--hse-text);
}

.hse-upload-panel-body {
  padding: 10px;
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hse-upload-panel-body::-webkit-scrollbar { width: 4px; }
.hse-upload-panel-body::-webkit-scrollbar-track { background: transparent; }
.hse-upload-panel-body::-webkit-scrollbar-thumb { background: var(--hse-border); border-radius: 2px; }

.hse-upload-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  background: var(--hse-bg-input);
  border-radius: var(--hse-radius-sm);
  border: 1px solid var(--hse-border);
  animation: hse-item-slide-in 0.2s ease;
  transition: border-color 0.3s;
}

@keyframes hse-item-slide-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.hse-upload-item.state-completed { border-color: rgba(34,197,94,0.25); }
.hse-upload-item.state-error     { border-color: rgba(239,68,68,0.25); }

.hse-upload-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  transition: all 0.3s;
}

.hse-upload-item-icon.state-uploading  { background: var(--hse-primary-light); color: var(--hse-primary); }
.hse-upload-item-icon.state-processing { background: var(--hse-info-bg); color: var(--hse-info); }
.hse-upload-item-icon.state-completed  { background: var(--hse-success-bg); color: var(--hse-success); }
.hse-upload-item-icon.state-error      { background: var(--hse-danger-bg); color: var(--hse-danger); }

.hse-upload-item-body {
  flex: 1;
  min-width: 0;
}

.hse-upload-item-name {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--hse-text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.hse-upload-item-status {
  font-size: 0.71rem;
  color: var(--hse-text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.hse-upload-item-status.state-uploading  { color: var(--hse-primary); }
.hse-upload-item-status.state-processing { color: var(--hse-info); }
.hse-upload-item-status.state-completed  { color: var(--hse-success); }
.hse-upload-item-status.state-error      { color: var(--hse-danger); }

/* ─── End Upload Activity Tracker ─── */

@keyframes igFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   IgPopup — Toast & Dialog System
   ============================================= */

/* --- TOAST --- */
.hse-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
}

.hse-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--hse-bg-card);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius);
  box-shadow: var(--hse-shadow-lg);
  min-width: 260px;
  max-width: 370px;
  pointer-events: all;
  animation: hse-toast-in 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.hse-toast.hse-toast-out {
  animation: hse-toast-out 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes hse-toast-in {
  from { opacity: 0; transform: translateX(44px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0)   scale(1);    }
}
@keyframes hse-toast-out {
  from { opacity: 1; transform: translateX(0)   scale(1);    }
  to   { opacity: 0; transform: translateX(44px) scale(0.95); }
}

.hse-toast.success { border-left: 3px solid var(--hse-success); }
.hse-toast.error   { border-left: 3px solid var(--hse-danger);  }
.hse-toast.warning { border-left: 3px solid var(--hse-warning); }
.hse-toast.info    { border-left: 3px solid var(--hse-info);    }

.hse-toast-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.hse-toast.success .hse-toast-icon { background: var(--hse-success-bg); color: var(--hse-success); }
.hse-toast.error   .hse-toast-icon { background: var(--hse-danger-bg);  color: var(--hse-danger);  }
.hse-toast.warning .hse-toast-icon { background: var(--hse-warning-bg); color: var(--hse-warning); }
.hse-toast.info    .hse-toast-icon { background: var(--hse-info-bg);    color: var(--hse-info);    }

.hse-toast-body  { flex: 1; min-width: 0; }
.hse-toast-title {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--hse-text-heading);
  margin-bottom: 1px;
}
.hse-toast-text {
  font-size: 0.75rem;
  color: var(--hse-text-secondary);
  line-height: 1.45;
}
.hse-toast-close {
  background: none;
  border: none;
  color: var(--hse-text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.72rem;
  flex-shrink: 0;
  line-height: 1;
  transition: color var(--hse-transition);
  margin-top: 1px;
}
.hse-toast-close:hover { color: var(--hse-text); }

/* --- DIALOG --- */
.hse-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.22s;
}
.hse-dialog-overlay.show { opacity: 1; }
.hse-dialog-overlay.show .hse-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.hse-dialog {
  background: var(--hse-bg-modal);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-lg);
  box-shadow: var(--hse-shadow-lg);
  width: 100%;
  max-width: 450px;
  transform: scale(0.88) translateY(24px);
  opacity: 0;
  transition:
    transform 0.35s var(--hse-spring),
    opacity   0.25s var(--hse-ease-out);
  overflow: hidden;
}

[data-theme="dark"] .hse-dialog {
  background: rgba(18, 20, 26, 0.92);
  border-color: var(--hse-glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .hse-dialog {
  box-shadow: 0 12px 40px rgba(15,20,35,0.15), 0 0 0 1px rgba(15,20,35,0.07);
}

.hse-dialog-header {
  padding: 1.5rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.7rem;
}

.hse-dialog-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.hse-dialog-icon.success { background: var(--hse-success-bg); color: var(--hse-success); }
.hse-dialog-icon.error   { background: var(--hse-danger-bg);  color: var(--hse-danger);  }
.hse-dialog-icon.warning { background: var(--hse-warning-bg); color: var(--hse-warning); }
.hse-dialog-icon.info    { background: var(--hse-info-bg);    color: var(--hse-info);    }
.hse-dialog-icon.primary { background: var(--hse-primary-light); color: var(--hse-primary); }

.hse-dialog-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--hse-text-heading);
  letter-spacing: 0.03em;
}
.hse-dialog-title.danger { color: var(--hse-danger); }

.hse-dialog-subtitle {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--hse-text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

.hse-dialog-body {
  padding: 0.9rem 1.5rem;
  font-size: 0.83rem;
  color: var(--hse-text-secondary);
  line-height: 1.6;
  text-align: center;
}

.hse-dialog-input {
  width: 100%;
  margin-top: 0.7rem;
  padding: 0.52rem 0.8rem;
  background: var(--hse-bg-input);
  border: 1px solid var(--hse-border);
  border-radius: var(--hse-radius-sm);
  color: var(--hse-text);
  font-size: 0.83rem;
  font-family: var(--hse-font);
  transition: border-color var(--hse-transition);
  box-sizing: border-box;
}
.hse-dialog-input:focus { outline: none; border-color: var(--hse-primary); }
.hse-dialog-input.hse-input-error { border-color: var(--hse-danger); }

.hse-dialog-validation {
  font-size: 0.73rem;
  color: var(--hse-danger);
  margin-top: 0.3rem;
  min-height: 1em;
  text-align: center;
}

.hse-dialog-footer {
  padding: 0 1.5rem 1.4rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.hse-dialog-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.52rem 1.25rem;
  border-radius: var(--hse-radius-sm);
  border: none;
  font-size: 0.81rem;
  font-weight: 600;
  font-family: var(--hse-font);
  cursor: pointer;
  transition: all var(--hse-transition);
  min-width: 88px;
  justify-content: center;
}
.hse-dialog-btn.primary { background: var(--hse-primary); color: #fff; }
.hse-dialog-btn.primary:hover {
  background: var(--hse-primary-hover);
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.28);
  transform: translateY(-1px);
}
.hse-dialog-btn.primary:active { transform: scale(0.97) !important; }
.hse-dialog-btn.danger  { background: var(--hse-danger);  color: #fff; }
.hse-dialog-btn.danger:hover  { background: #dc2626; box-shadow: 0 4px 12px rgba(229,72,77,0.28); }
.hse-dialog-btn.cancel  { background: var(--hse-bg-input); color: var(--hse-text-secondary); border: 1px solid var(--hse-border); }
.hse-dialog-btn.cancel:hover  { background: var(--hse-bg-card-hover); color: var(--hse-text); }
.hse-dialog-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.hse-dialog-btn:active { transform: scale(0.97); }

.hse-dialog-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: hse-spin 0.55s linear infinite;
}
@keyframes hse-spin { to { transform: rotate(360deg); } }

/* =============================================================
   SKELETON LOADING — shimmer loader
   ============================================================= */
.hse-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--hse-bg-subtle);
  border-radius: var(--hse-radius-sm);
}
.hse-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.06) 40%,
    rgba(255,255,255,0.14) 50%,
    rgba(255,255,255,0.06) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: hse-shimmer 1.8s ease-in-out infinite;
}
@keyframes hse-shimmer {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}
[data-theme="light"] .hse-skeleton { background: #E6E8EC; }
[data-theme="light"] .hse-skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.65) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
}
.hse-skeleton-text { height: 0.85em; border-radius: 4px; margin-bottom: 0.5em; }
.hse-skeleton-text.wide  { width: 80%; }
.hse-skeleton-text.half  { width: 50%; }
.hse-skeleton-text.short { width: 35%; }

/* =============================================================
   PULSE RING — badge/indicatori critici
   ============================================================= */
@keyframes hse-pulse-critical {
  0%   { box-shadow: 0 0 0 0   rgba(229, 72, 77, 0.50); }
  60%  { box-shadow: 0 0 0 8px rgba(229, 72, 77, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(229, 72, 77, 0);    }
}
@keyframes hse-pulse-warning {
  0%   { box-shadow: 0 0 0 0   rgba(224, 164, 0, 0.50); }
  60%  { box-shadow: 0 0 0 8px rgba(224, 164, 0, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(224, 164, 0, 0);    }
}
@keyframes hse-pulse-steel {
  0%   { box-shadow: 0 0 0 0   rgba(74, 125, 175, 0.45); }
  60%  { box-shadow: 0 0 0 8px rgba(74, 125, 175, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(74, 125, 175, 0);    }
}
.hse-badge-pulse-danger  { animation: hse-pulse-critical 2.2s ease infinite; }
.hse-badge-pulse-warning { animation: hse-pulse-warning  2.2s ease infinite; }
.hse-badge-pulse-steel   { animation: hse-pulse-steel    2.4s ease infinite; }

/* =============================================================
   SIDE DRAWER
   ============================================================= */
.hse-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1200;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--hse-ease-out), visibility 0.28s;
}
.hse-drawer-overlay.show { opacity: 1; visibility: visible; }

.hse-drawer {
  width: min(520px, 94vw);
  height: 100%;
  background: var(--hse-bg-modal);
  border-left: 1px solid var(--hse-border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s var(--hse-spring);
  overflow: hidden;
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.25);
}
.hse-drawer-overlay.show .hse-drawer { transform: translateX(0); }

[data-theme="dark"] .hse-drawer {
  background: rgba(16, 18, 23, 0.94);
  border-left-color: var(--hse-glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
[data-theme="light"] .hse-drawer {
  box-shadow: -12px 0 40px rgba(15, 20, 35, 0.12);
}

.hse-drawer-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--hse-border);
  flex-shrink: 0;
}
.hse-drawer-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hse-primary), var(--hse-steel));
}
.hse-drawer-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--hse-text-heading);
  flex: 1;
  margin: 0;
}
.hse-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* =============================================================
   STEEL ACCENT UTILITIES
   ============================================================= */
.hse-badge-steel {
  background: var(--hse-steel-light);
  color: var(--hse-steel);
  border: 1px solid rgba(74, 125, 175, 0.22);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
}
[data-theme="light"] .hse-badge-steel {
  border-color: rgba(43, 95, 143, 0.22);
}

.hse-icon-steel {
  width: 36px;
  height: 36px;
  border-radius: var(--hse-radius-sm);
  background: var(--hse-steel-light);
  color: var(--hse-steel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.hse-section-label-steel {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--hse-steel);
  margin-bottom: 0.65rem;
}
.hse-section-label-steel::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--hse-steel-light), transparent);
}

.hse-meter-dual {
  height: 6px;
  border-radius: 3px;
  background: var(--hse-bg-subtle);
  overflow: hidden;
}
.hse-meter-dual-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--hse-steel), var(--hse-primary));
  transition: width 0.6s var(--hse-ease-out);
}