/* ==========================================================================
   RSU AZIENDALE - PORTALE RISERVATO DIPENDENTI
   Design System & Styling
   ========================================================================== */

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

:root {
  /* Color Palette - Dark Premium (Default) */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.75);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #0ea5e9;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(99, 102, 241, 0.3);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-color: #cbd5e1;
  --border-glow: rgba(99, 102, 241, 0.2);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ==========================================================================
   AUTHENTICATION / LOGIN GATE SCREEN
   ========================================================================== */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.15) 0%, rgba(15, 23, 42, 0.95) 70%);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 40px 32px;
  position: relative;
  overflow: hidden;
  animation: cardFadeUp 0.5s ease;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-primary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.93rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input,
.input-wrapper select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper input:focus,
.form-group textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: #ffffff;
  font-weight: 600;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.demo-credentials {
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.demo-credentials code {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ==========================================================================
   APP NAVBAR & HEADER
   ========================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-title-box {
  display: flex;
  flex-direction: column;
}

.nav-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.nav-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
}

.nav-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.user-menu-wrapper {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}


.user-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0 16px;
  height: 40px;
  box-sizing: border-box;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.user-badge:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

#userEmailSpan {
  display: flex;
  align-items: center;
  height: 100%;
  line-height: 1;
}

#userMenuChevron {
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center;
  transition: transform 0.2s ease;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: #1e293b;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
  padding: 6px;
  z-index: 99999;
  display: none;
}


.user-dropdown-menu.show {
  display: flex !important;
  flex-direction: column;
  gap: 4px;
}





.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary) !important;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.user-dropdown-item:hover {
  background: rgba(99, 102, 241, 0.15) !important;
  color: var(--accent-primary) !important;
}

.user-dropdown-item.danger {
  color: #f87171 !important;
}

.user-dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}


.theme-toggle-btn,
.logout-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover,
.logout-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* ==========================================================================
   HERO / HEADER BANNER
   ========================================================================== */

.hero-banner {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.8) 100%),
    radial-gradient(ellipse at top right, rgba(99, 102, 241, 0.25), transparent 60%);
  border-bottom: 1px solid var(--border-color);
  padding: 40px 24px;
}

.hero-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: center;
}

.hero-text h2 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff 30%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-text p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 650px;
  margin-bottom: 20px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-chip strong {
  color: var(--accent-success);
}

.global-search-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.global-search-box h4 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-input-group {
  position: relative;
}

.search-input-group input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.search-icon-svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ==========================================================================
   MAIN CONTENT & TABS CONTAINER
   ========================================================================== */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px 24px;
  width: 100%;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

/* Section Titles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.section-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.filter-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.filter-chip.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

/* ==========================================================================
   CARDS GRID (COMUNICATI & DELEGATI)
   ========================================================================== */

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 22px;
}

.comunicato-card-pro,
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.comunicato-card-pro::before,
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-primary);
  opacity: 0.85;
}

.comunicato-card-pro.cat-theme-accordi::before {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

.comunicato-card-pro.cat-theme-sicurezza::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.comunicato-card-pro.cat-theme-assemblee::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.comunicato-card-pro.cat-theme-welfare::before {
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
}

.comunicato-card-pro.cat-theme-altro::before {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.comunicato-card-pro.is-pinned,
.card.card-pinned {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.15);
}

.comunicato-card-pro.is-pinned::before,
.card.card-pinned::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #d97706);
  height: 4px;
}

.comunicato-card-pro:hover,
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.comunicato-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.comunicato-tags-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
}

.tag-accordi {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.tag-sicurezza {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-assemblee {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.tag-welfare {
  background: rgba(14, 165, 233, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.tag-altro {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-new {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(245, 158, 11, 0.22));
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-pinned {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.45);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.03em;
}

.comunicato-meta-row,
.card-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 2px 0;
  flex-wrap: wrap;
}

.comunicato-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta-dot {
  color: var(--border-color);
}

.comunicato-title,
.card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 4px 0 0 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.comunicato-title:hover,
.card-title:hover {
  color: var(--accent-primary);
}

.comunicato-excerpt,
.card-excerpt {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.comunicato-bottom-bar,
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.btn-read-comunicato {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-read-comunicato:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  transform: translateX(2px);
}

.comunicato-admin-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.admin-pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.admin-pill-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.admin-pill-btn.pin {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.admin-pill-btn.edit {
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.3);
}

.admin-pill-btn.delete {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}



.reaction-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  user-select: none;
}

.reaction-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.reaction-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #818cf8;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.reaction-count {
  font-size: 0.78rem;
  font-weight: 600;
}

/* Document Download & Preview Badges */
.doc-downloads-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Poll Progress Bars */
.poll-voted-bar-container {
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  height: 10px;
  overflow: hidden;
  position: relative;
  width: 100%;
  border: 1px solid var(--border-color);
}

.poll-voted-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-sm);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ==========================================================================
   DOCUMENTS & FAQ ACCORDIONS
   ========================================================================== */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--border-glow);
}

.faq-question {
  padding: 18px 24px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-answer {
  padding: 0 24px 20px;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.6;
  display: none;
  border-top: 1px dashed var(--border-color);
  padding-top: 16px;
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-icon-chevron {
  transition: transform var(--transition-fast);
}

.faq-item.open .faq-icon-chevron {
  transform: rotate(180deg);
}

/* ==========================================================================
   DOCUMENTI & DIRITTI - ULTRA PROFESSIONAL MODERN CARDS SYSTEM
   ========================================================================== */

.doc-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.doc-filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.doc-filter-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.doc-filter-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.doc-filter-pill.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #a5b4fc;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.doc-filter-pill.active .doc-filter-count {
  background: var(--accent-primary);
  color: #ffffff;
}

.doc-filter-pill[data-cat="contratti"].active {
  background: rgba(99, 102, 241, 0.22);
  border-color: #6366f1;
  color: #a5b4fc;
}

.doc-filter-pill[data-cat="contratti"].active .doc-filter-count {
  background: #6366f1;
}

.doc-filter-pill[data-cat="accordi"].active {
  background: rgba(16, 185, 129, 0.22);
  border-color: #10b981;
  color: #6ee7b7;
}

.doc-filter-pill[data-cat="accordi"].active .doc-filter-count {
  background: #10b981;
}

.doc-filter-pill[data-cat="modulistica"].active {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fcd34d;
}

.doc-filter-pill[data-cat="modulistica"].active .doc-filter-count {
  background: #f59e0b;
}

.doc-filter-pill[data-cat="sicurezza"].active {
  background: rgba(236, 72, 153, 0.22);
  border-color: #ec4899;
  color: #f9a8d4;
}

.doc-filter-pill[data-cat="sicurezza"].active .doc-filter-count {
  background: #ec4899;
  color: #ffffff;
}

.doc-filter-pill[data-cat="assemblee"].active {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fcd34d;
}

.doc-filter-pill[data-cat="assemblee"].active .doc-filter-count {
  background: #f59e0b;
  color: #ffffff;
}

.doc-filter-pill[data-cat="welfare"].active {
  background: rgba(14, 165, 233, 0.22);
  border-color: #0ea5e9;
  color: #7dd3fc;
}

.doc-filter-pill[data-cat="welfare"].active .doc-filter-count {
  background: #0ea5e9;
  color: #ffffff;
}

.doc-filter-pill[data-cat="altro"].active {
  background: rgba(139, 92, 246, 0.22);
  border-color: #8b5cf6;
  color: #c4b5fd;
}

.doc-filter-pill[data-cat="altro"].active .doc-filter-count {
  background: #8b5cf6;
  color: #ffffff;
}

/* Griglia Card Documenti */
.doc-grid-pro {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.doc-card-pro {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.doc-card-pro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-primary);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.doc-card-pro.cat-theme-contratti::before {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

.doc-card-pro.cat-theme-accordi::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.doc-card-pro.cat-theme-modulistica::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.doc-card-pro.cat-theme-sicurezza::before {
  background: linear-gradient(90deg, #ec4899, #f472b6);
}

.doc-card-pro:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.doc-card-pro.cat-theme-contratti:hover {
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

.doc-card-pro.cat-theme-accordi:hover {
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
}

.doc-card-pro.cat-theme-modulistica:hover {
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.4);
}

.doc-card-pro.cat-theme-sicurezza:hover {
  box-shadow: 0 10px 30px rgba(236, 72, 153, 0.2);
  border-color: rgba(236, 72, 153, 0.4);
}

/* Sezione Superiore Card */
.doc-card-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.doc-file-badge {
  width: 52px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease;
}

.doc-card-pro:hover .doc-file-badge {
  transform: scale(1.05);
}

.doc-file-badge.pdf {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.doc-file-badge.docx,
.doc-file-badge.doc {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

.doc-file-badge.xlsx,
.doc-file-badge.xls {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.doc-file-badge.zip {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.35);
  color: #c084fc;
}

.doc-ext-text {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1;
}

.doc-card-header-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.doc-cat-tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
}

.doc-cat-tag.cat-contratti {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.doc-cat-tag.cat-accordi {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.doc-cat-tag.cat-modulistica {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.doc-cat-tag.cat-sicurezza {
  background: rgba(236, 72, 153, 0.15);
  color: #f9a8d4;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.doc-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
  word-break: break-word;
}

/* Chips Metadati */
.doc-card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
}

.doc-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 6px;
}

.doc-meta-chip svg {
  color: var(--text-muted);
}

.doc-chip-downloads {
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.08);
}

.doc-chip-downloads svg {
  color: #818cf8;
}

/* Azioni Card */
.doc-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-doc-preview {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s ease;
}

.btn-doc-preview:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-doc-download {
  flex: 1.2;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: #ffffff !important;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
}

.btn-doc-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}

@media (max-width: 600px) {
  .doc-grid-pro {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ==========================================================================
   SPORTELLO SEGNALAZIONI (FORM)
   ========================================================================== */

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 720px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

.confidential-notice {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent-success);
  font-size: 0.88rem;
}

/* ==========================================================================
   SONDAGGI (POLLS)
   ========================================================================== */

.poll-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 720px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

.poll-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.poll-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.poll-option-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.poll-option-btn:hover {
  border-color: var(--accent-primary);
}

.poll-option-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  z-index: 2;
}

.poll-progress-bg {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: rgba(99, 102, 241, 0.18);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

/* ==========================================================================
   MODAL WINDOWS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}


.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-backdrop.open .modal-box {
  transform: translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Footer */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-top: 1px solid var(--border-color);
  padding: 12px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Keyframe Animations */
@keyframes cardFadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Hamburger & Mobile Drawer Styles */
.menu-toggle-btn {
  display: none;
  /* Hide on desktop */
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.menu-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-primary);
}

.mobile-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer-box {
  width: 290px;
  height: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer-backdrop.open .mobile-drawer-box {
  transform: translateX(0);
}

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

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.8rem;
  cursor: pointer;
}

.mobile-drawer-list {
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.drawer-tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: all var(--transition-fast);
}

.drawer-tab-btn svg {
  color: var(--text-muted);
}

.drawer-tab-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
}

.drawer-tab-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.drawer-tab-btn.active svg {
  color: #fff;
}

/* Responsive adjustments */
@media (max-width: 840px) {
  .navbar {
    padding: 0 16px;
    justify-content: space-between;
    height: 64px;
  }

  .menu-toggle-btn {
    display: flex;
    /* Show hamburger on mobile */
  }

  .nav-tabs {
    display: none !important;
    /* Hide horizontal tabs on mobile */
  }

  .global-search-trigger {
    display: none !important;
    /* Hide global search on navbar in mobile/responsive mode */
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  .main-content {
    padding: 16px;
    padding-bottom: 40px;
    /* Reset space for mobile */
  }

  .grid-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hero-text h2 {
    font-size: 1.6rem;
  }

  /* Form and cards margins */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Mobile search alignment */
  div[style*="justify-content: flex-end"] {
    justify-content: center !important;
    padding: 0 16px !important;
  }

  div[style*="width: 280px"] {
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  .menu-btn-text {
    display: none;
    /* Hide text on tiny screens, show only hamburger icon */
  }

  .modal-box {
    padding: 20px;
    width: 95%;
  }

  .doc-item {
    padding: 12px 14px;
    gap: 10px;
  }

  .doc-icon {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
}

/* Custom Toast Notification System */
#customToastContainer {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 380px;
  width: 90%;
}

.custom-toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  animation: toastEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

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

.custom-toast.error {
  border-left-color: var(--accent-danger);
}

.custom-toast-content {
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.4;
}

.custom-toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.custom-toast-close:hover {
  color: var(--text-primary);
}

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

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

@keyframes toastExit {
  from {
    transform: translateY(0);
    opacity: 1;
  }

  to {
    transform: translateY(-20px);
    opacity: 0;
  }
}

/* Whitelist User Item Styling and Responsiveness */
.whitelist-user-item {
  display: flex;
  justify-content: space-between;
  align-items: left;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 8px;
  text-align: left;
  gap: 12px;
  transition: all 0.2s;
}

.whitelist-user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  min-width: 0;
  flex-grow: 1;
}

.whitelist-user-name {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-word;
}

.whitelist-user-email {
  color: var(--text-secondary);
  font-size: 0.82rem;
  word-break: break-all;
}

.whitelist-user-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

@media (max-width: 580px) {
  .whitelist-user-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .whitelist-user-actions {
    align-self: flex-end;
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
  }
}

/* ==========================================================================
   ENHANCED SPORTELLO & TICKET THREAD STYLES
   ========================================================================== */
.badge-priority {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-priority-urgente {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: pulse-urgent 2s infinite;
}

.badge-priority-alta {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.badge-priority-media {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.badge-priority-bassa {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

@keyframes pulse-urgent {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
  }
}

.badge-anonymous {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ticket-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(14, 165, 233, 0.45);
  padding: 6px 12px;
  border-radius: 8px;
  color: #38bdf8;
  font-size: 0.82rem;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.ticket-attachment-pill:hover {
  background: rgba(14, 165, 233, 0.28);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

[data-theme="light"] .ticket-attachment-pill {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}

[data-theme="light"] .ticket-attachment-pill:hover {
  background: #bae6fd;
  border-color: #0284c7;
  color: #0c4a6e;
}

.ticket-thread-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.ticket-msg-bubble {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ticket-msg-bubble.from-worker {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid #64748b;
  color: var(--text-primary);
}

.ticket-msg-bubble.from-delegate {
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--accent-primary);
  color: var(--text-primary);
}

.ticket-msg-bubble.from-admin {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
  color: var(--text-primary);
}

.ticket-msg-bubble.from-internal-note {
  background: rgba(245, 158, 11, 0.12);
  border-left: 3px solid #f59e0b;
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-left: 4px solid #f59e0b;
  color: var(--text-primary);
}

.ticket-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  gap: 8px;
}

.nav-badge-count {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: pulse-urgent 2s infinite;
}

.badge-unread-ticket {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-assigned {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-unassigned {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   SPORTELLO DEL LAVORATORE - STILE PROFESSIONALE TICKETING & HELP DESK
   ========================================================================== */

.ticket-pro-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.ticket-pro-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md);
}

.ticket-pro-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}

.ticket-pro-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.ticket-pro-tags-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ticket-id-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  font-size: 0.78rem;
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.ticket-pro-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2px 0 0 0;
  line-height: 1.4;
}

.ticket-meta-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.ticket-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.ticket-delegate-assign-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

.ticket-pro-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ticket-desc-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.6;
  /*white-space: pre-wrap;*/
}

.ticket-thread-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.ticket-thread-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticket-thread-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding: 10px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  scroll-behavior: smooth;
}

.ticket-thread-timeline::-webkit-scrollbar {
  width: 5px;
}

.ticket-thread-timeline::-webkit-scrollbar-track {
  background: transparent;
}

.ticket-thread-timeline::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.ticket-thread-timeline::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.ticket-msg-bubble {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  line-height: 1.45;
  transition: background 0.2s ease;
}

.ticket-msg-bubble.from-worker {
  background: rgba(99, 102, 241, 0.07);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-left: 3px solid var(--accent-primary);
}

.ticket-msg-bubble.from-delegate {
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-left: 3px solid #10b981;
}

.ticket-msg-bubble.from-admin {
  background: rgba(139, 92, 246, 0.07);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-left: 3px solid #8b5cf6;
}

.ticket-msg-bubble.from-internal-note {
  background: rgba(245, 158, 11, 0.07);
  border: 1px dashed rgba(245, 158, 11, 0.35);
  border-left: 3px solid #f59e0b;
}

.ticket-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.76rem;
  gap: 8px;
}

.ticket-msg-header span {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.ticket-reply-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 4px;
}

/* Status Badges */
.badge-status-nuova {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-weight: 700;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-status-in_gestione {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-weight: 700;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-status-chiusa {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-weight: 700;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Filter Bar Pro */
.ticket-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.ticket-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.ticket-filter-search-wrapper {
  position: relative;
  flex: 2 1 220px;
  min-width: 180px;
}

.ticket-filter-select {
  flex: 1 1 130px;
  min-width: 120px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.ticket-filter-select:focus {
  border-color: var(--accent-primary);
}

/* Lightbox & Instant Attachment Preview */
.attachment-preview-modal-box {
  max-width: 900px;
  width: 95%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.attachment-preview-body {
  flex: 1;
  min-height: 250px;
  max-height: 72vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 12px;
}

.attachment-preview-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.attachment-preview-iframe {
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: 6px;
}

/* Badge Nuovo Comunicato */
.badge-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

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

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

.card-reading-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Document Category Pills */
.doc-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.doc-filter-pill {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.doc-filter-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.doc-filter-pill.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Global Search Trigger & Modal */
.global-search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

@media screen and (max-width: 992px) {

  .global-search-trigger,
  button.global-search-trigger,
  .desktop-only-search {
    display: none !important;
  }
}

.global-search-trigger:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.global-search-kbd {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 600;
}

.global-search-modal {
  max-width: 650px;
  width: 92%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.global-search-input-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.global-search-input-box input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 1.05rem;
  color: var(--text-primary);
  outline: none;
}

.global-search-results-area {
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px 16px;
}

.search-category-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 12px 0 6px 4px;
}

.search-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  color: var(--text-primary);
}

.search-result-row:hover {
  background: var(--bg-card-hover);
}

.search-result-icon {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-primary);
}

.search-result-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.search-result-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Notification Button in User Badge & Header */
.user-badge-notif-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  margin: 0 4px;
  transition: all 0.2s ease;
  line-height: 1;
}

.user-badge-notif-btn:hover {
  transform: scale(1.12);
  background: var(--bg-card-hover);
}

.user-badge-notif-btn.is-active {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.user-badge-notif-btn.is-disabled {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  opacity: 0.9;
}

.btn-notification-bell {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-notification-bell:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.btn-notification-bell.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Responsive Mobile Search and Sandwich Drawer Footer */
.drawer-search-btn:hover {
  border-color: var(--accent-primary) !important;
  background: var(--bg-card-hover) !important;
}

@media (max-width: 900px) {
  .global-search-trigger {
    display: none !important;
  }
}