:root {
  /* TEMA ISTITUZIONALE PA (Designers Italia / AgID) - DEFAULT */
  --bg-primary: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-glass: #ffffff;
  --border-glass: #cbd5e1;
  --border-hover: #94a3b8;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --card-shadow: 0 4px 12px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.04);
  --primary-color: #0066cc;
  --primary-hover: #0052a3;
  --primary-glow: rgba(0, 102, 204, 0.18);
  --success-color: #059669;
  --warning-color: #d97706;
  --danger-color: #dc2626;
  --font-sans: 'Titillium Web', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --table-head-bg: #f8fafc;
  --table-stripe-bg: #f8fafc;
  --input-bg: #ffffff;
  --input-color: #0f172a;
  --input-border: #cbd5e1;
  --input-focus-border: #0066cc;
  --input-focus-glow: rgba(0, 102, 204, 0.2);
  --badge-bg: #f1f5f9;
  --badge-border: #cbd5e1;
  --badge-color: #334155;
}

body.theme-dark {
  /* TEMA NOTTURNO / DARK */
  --bg-primary: #0b0f19;
  --bg-sidebar: #111827;
  --bg-glass: #182234;
  --border-glass: #283548;
  --border-hover: #3b4b66;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.25);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --table-head-bg: #151d2d;
  --table-stripe-bg: #131b29;
  --input-bg: #151d2d;
  --input-color: #f8fafc;
  --input-border: #334155;
  --input-focus-border: #3b82f6;
  --input-focus-glow: rgba(59, 130, 246, 0.3);
  --badge-bg: #1e293b;
  --badge-border: #334155;
  --badge-color: #cbd5e1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* STRISCIA TRICOLORE ISTITUZIONALE PA */
.pa-tricolor-stripe {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #008c45 0%, #008c45 33.3%, #ffffff 33.3%, #ffffff 66.6%, #cd212a 66.6%, #cd212a 100%);
  position: sticky;
  top: 0;
  z-index: 101;
}

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

/* SIDEBAR / NAVBAR ISTITUZIONALE FISSA */
.sidebar {
  position: sticky;
  top: 4px;
  z-index: 100;
  width: 100%;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.logo-icon-emblem {
  font-size: 1.6rem;
  line-height: 1;
}

.logo-text-group {
  display: flex;
  flex-direction: column;
}

.logo-text-group h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.logo-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.nav-menu {
  display: flex;
  flex-direction: row;
  gap: 0.35rem;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.nav-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  text-align: left;
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-btn:hover {
  background-color: rgba(0, 102, 204, 0.06);
  color: var(--primary-color);
  border-color: var(--border-glass);
}

.nav-btn.active {
  background-color: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.nav-right-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.theme-toggle-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

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

/* MAIN CONTENT */
.main-content {
  flex: 1;
  padding: 1.5rem 2rem 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

/* TOPBAR */
.topbar {
  display: flex;
  justify-content: flex-end;
}

.system-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-card {
  background-color: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  min-width: 170px;
  box-shadow: var(--card-shadow);
  transition: all 0.2s ease;
}

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

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.text-green { color: var(--success-color); }
.text-blue { color: var(--primary-color); }
.text-orange { color: var(--warning-color); }
.text-red { color: var(--danger-color); }

/* CONTENT PANEL */
.content-panel {
  flex: 1;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
}

.tab-content.active {
  display: flex;
}

.section-header h3 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--text-muted);
}

/* GLASS CONTAINER */
.glass {
  background-color: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

/* ATTI GRID */
.acts-grid {
  display: grid;
  grid-template-columns: 35fr 65fr;
  gap: 1.5rem;
}

.acts-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.acts-table th, .acts-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glass);
}

.acts-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.acts-table tbody tr {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.acts-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

/* BADGES */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-draft { background-color: rgba(148, 163, 184, 0.2); color: var(--text-muted); }
.badge-submitted { background-color: rgba(99, 102, 241, 0.2); color: var(--primary-color); }
.badge-analyzing { background-color: rgba(245, 158, 11, 0.2); color: var(--warning-color); }
.badge-review { background-color: rgba(16, 185, 129, 0.2); color: var(--success-color); }

/* ATTO DETAIL */
.act-detail-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  padding: 0.5rem;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border: 1px solid var(--border-glass);
}

.file-list li .file-type {
  font-weight: 600;
  color: var(--primary-color);
}

/* BUTTONS */
.btn {
  font-family: inherit;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
  background-color: #4f46e5;
  box-shadow: 0 0 20px var(--primary-glow);
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-success:hover {
  background-color: #059669;
}

/* FORM STYLING */
.form-container {
  width: 100%;
}

.upload-mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.radio-card {
  cursor: pointer;
}

.radio-card input {
  display: none;
}

.radio-card .card-content {
  border: 1px solid var(--border-glass);
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.3s ease;
}

.radio-card input:checked + .card-content {
  border-color: var(--primary-color);
  background-color: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

.mode-icon {
  font-size: 1.5rem;
}

.card-content strong {
  font-size: 0.95rem;
}

.card-content span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Upload layout */
.upload-top-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.upload-files-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-actions {
  margin-top: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
}

.form-group input[type="file"] {
  border: 1px dashed var(--border-glass);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.01);
  color: var(--text-muted);
  cursor: pointer;
}

/* FORM CONTROLS & INPUTS */
.form-input,
input[type="text"],
input[type="search"],
input[type="password"],
input[type="email"],
textarea {
  background-color: var(--input-bg);
  border: 1.5px solid var(--input-border);
  color: var(--input-color);
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.form-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.form-input:focus,
input[type="text"]:focus,
input[type="search"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--input-focus-glow);
  background-color: var(--input-bg);
}

.form-select {
  background-color: var(--input-bg);
  border: 1.5px solid var(--input-border);
  color: var(--input-color);
  padding: 0.65rem 2.2rem 0.65rem 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.theme-dark .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

.form-select:hover {
  border-color: var(--border-hover);
}

.form-select:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--input-focus-glow);
}

.form-select option {
  background-color: var(--input-bg);
  color: var(--input-color);
  padding: 0.5rem;
}

.help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* FINDINGS LIST & CARDS (ALTO CONTRASTO, COLORI VIVIDI) */
.findings-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.finding-card {
  border-left: 5px solid var(--primary-color);
  background-color: var(--bg-glass);
  padding: 1.15rem 1.35rem;
  border-radius: 0 10px 10px 0;
  border-top: 1px solid var(--border-glass);
  border-right: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
  box-shadow: var(--card-shadow);
  margin-bottom: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.finding-card:hover {
  transform: translateX(2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.finding-card.severity-BLOCKING {
  border-left-color: #dc2626;
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.05) 0%, var(--bg-glass) 30%);
}
body.theme-dark .finding-card.severity-BLOCKING {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12) 0%, var(--bg-glass) 30%);
}

.finding-card.severity-HIGH {
  border-left-color: #ea580c;
  background: linear-gradient(90deg, rgba(234, 88, 12, 0.05) 0%, var(--bg-glass) 30%);
}
body.theme-dark .finding-card.severity-HIGH {
  border-left-color: #f97316;
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.12) 0%, var(--bg-glass) 30%);
}

.finding-card.severity-ATTENTION {
  border-left-color: #d97706;
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.05) 0%, var(--bg-glass) 30%);
}
body.theme-dark .finding-card.severity-ATTENTION {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, var(--bg-glass) 30%);
}

.finding-card.severity-INFO {
  border-left-color: var(--primary-color);
  background: linear-gradient(90deg, rgba(0, 102, 204, 0.05) 0%, var(--bg-glass) 30%);
}
body.theme-dark .finding-card.severity-INFO {
  border-left-color: #3b82f6;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12) 0%, var(--bg-glass) 30%);
}

.finding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.finding-header h6 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.finding-body p {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 0.65rem;
}

.finding-evidence {
  font-size: 0.85rem;
  font-family: 'Consolas', 'Courier New', monospace;
  background-color: var(--badge-bg);
  border: 1px solid var(--badge-border);
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

/* MODELS GRID */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.model-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: space-between;
}

.model-header h4 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.model-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

/* PROGRESS BAR */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary-color);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--primary-glow);
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* CODA E BANNER */
.queue-status-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-glass);
}

.queue-status-banner.info {
  background-color: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.2);
}

.pulse-icon {
  width: 12px;
  height: 12px;
  background-color: var(--success-color);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
}

.queue-table th, .queue-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glass);
  text-align: left;
}

.queue-table th {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* MONITORAGGIO HARDWARE */
.hardware-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.temp-gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.temp-value-large {
  font-size: 3rem;
  font-weight: 700;
}

.temp-status {
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.temp-bar-bg {
  width: 80%;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.temp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success-color), var(--warning-color), var(--danger-color));
  width: 48%;
  transition: width 0.5s ease;
}

.specs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.specs-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.5rem;
}

.specs-list li span {
  color: var(--text-muted);
}

/* MIGRAZIONE PANEL */
.migration-log-panel {
  margin-top: 1.5rem;
  background-color: #05060b;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 1.25rem;
}

.migration-log-panel h5 {
  margin-bottom: 0.5rem;
}

.migration-log-panel pre {
  font-family: monospace;
  font-size: 0.85rem;
  color: #10b981;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-bottom: 1rem;
}

/* OVERLAYS */
.thermal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.overlay-content {
  max-width: 500px;
  text-align: center;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.danger-icon {
  font-size: 4rem;
  animation: jitter 0.5s infinite;
}

@keyframes jitter {
  0% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-2px, 2px) rotate(-1deg); }
  40% { transform: translate(2px, -2px) rotate(1deg); }
  60% { transform: translate(-2px, -2px) rotate(0deg); }
  80% { transform: translate(2px, 2px) rotate(-1deg); }
  100% { transform: translate(0, 0) rotate(1deg); }
}

/* GESTIONE ESITI - Azioni sui rilievi */
.finding-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-glass);
}

.finding-actions .btn-sm {
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.finding-actions .btn-confirm {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.finding-actions .btn-confirm:hover {
  background-color: rgba(16, 185, 129, 0.3);
}

.finding-actions .btn-correct {
  background-color: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.finding-actions .btn-correct:hover {
  background-color: rgba(99, 102, 241, 0.3);
}

.finding-actions .btn-dismiss {
  background-color: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.finding-actions .btn-dismiss:hover {
  background-color: rgba(148, 163, 184, 0.2);
}

.finding-actions .btn-dismiss-rule {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.finding-actions .btn-dismiss-rule:hover {
  background-color: rgba(245, 158, 11, 0.25);
}

.finding-actions .btn-reopen {
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.finding-actions .btn-reopen:hover {
  background-color: rgba(99, 102, 241, 0.25);
}

.finding-actions .btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Dismissed finding card */
.finding-card.dismissed {
  opacity: 0.5;
  border-left-color: var(--text-muted);
}

.badge-dismissed {
  background-color: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.finding-meta {
  margin-top: 0.25rem;
}

.finding-meta small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Dismissed section (collapsible) */
.dismissed-section {
  margin-top: 1rem;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.75rem;
}

.dismissed-section summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.25rem 0;
}

.dismissed-section .finding-card {
  margin-top: 0.5rem;
}

/* SORTABLE TABLE HEADERS & ICONS */
th.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

th.sortable-th:hover {
  background: rgba(14, 165, 233, 0.12) !important;
  color: var(--primary-color, #0284c7) !important;
}

th.sortable-th .sort-icon {
  margin-left: 5px;
  font-size: 0.78rem;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: inline-block;
}

th.sortable-th:hover .sort-icon {
  opacity: 1;
  transform: scale(1.15);
}

th.sortable-th.sort-asc .sort-icon {
  opacity: 1;
  color: #0284c7;
}

th.sortable-th.sort-desc .sort-icon {
  opacity: 1;
  color: #0284c7;
}

/* Bottone Elimina Atto */
.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.3);
}

/* Sezione azioni atto (Analisi + Elimina) */
.analysis-action-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.analysis-action-section .btn-primary {
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

/* Giudizio complessivo LLM (non azionabile) */
.finding-card.judgement-card {
  border-left-color: var(--primary-color);
  background-color: rgba(99, 102, 241, 0.03);
  border-style: solid;
  border-left-width: 4px;
}

.finding-card.judgement-card .finding-body p {
  font-style: italic;
}

.badge-completed { background-color: rgba(16, 185, 129, 0.2); color: var(--success-color); }

/* EXPORT DOCX SECTION */
.export-section {
  display: flex;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1rem;
  background-color: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
}

.export-section.disabled {
  background-color: rgba(148, 163, 184, 0.03);
  border-color: rgba(148, 163, 184, 0.15);
}

.export-section .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* INFO ICON BUTTON */
.btn-info-icon {
  background: none;
  border: 1.5px solid var(--text-muted);
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-info-icon:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* INFO MODAL */
.info-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.info-modal {
  max-width: 600px;
  width: 90%;
  padding: 2rem;
  position: relative;
}

.info-modal h3 {
  margin-bottom: 1.25rem;
  font-size: 1.2rem;
}

.info-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.info-modal-close:hover {
  color: var(--text-primary);
}

.info-steps {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.info-steps ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.info-note {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.75rem;
  background-color: rgba(99, 102, 241, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

/* ANALYSIS PROGRESS BOX */
.analysis-progress-box {
  background-color: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.progress-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.progress-indicator strong {
  font-size: 0.95rem;
}

.progress-indicator p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.analysis-bar {
  animation: indeterminate 1.5s ease-in-out infinite;
  width: 40%;
}

@keyframes indeterminate {
  0% { margin-left: 0; width: 30%; }
  50% { margin-left: 30%; width: 40%; }
  100% { margin-left: 70%; width: 30%; }
}

/* ==========================================
   WIKI / KNOWLEDGE BASE
   ========================================== */
.wiki-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.wiki-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 12px;
}

.wiki-stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.wiki-stat-icon {
  font-size: 2rem;
}

.wiki-stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
  color: var(--text-primary);
}

.wiki-stat-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wiki-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  min-height: 580px;
}

@media (max-width: 900px) {
  .wiki-layout {
    grid-template-columns: 1fr;
  }
}

.wiki-sidebar-panel {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border-radius: 14px;
  max-height: 750px;
  overflow: hidden;
}

.wiki-search-box {
  margin-bottom: 0.75rem;
}

.wiki-filter-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-chip.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

.wiki-pages-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.25rem;
}

.wiki-page-item {
  padding: 0.85rem 1rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wiki-page-item:hover {
  background: rgba(0, 102, 204, 0.06);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.wiki-page-item.active {
  background: rgba(0, 102, 204, 0.1);
  border-color: var(--primary-color);
  border-left: 4px solid var(--primary-color);
}

.wiki-page-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.wiki-page-item-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wiki-page-item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.wiki-page-item-meta code {
  font-size: 0.72rem;
  background: var(--badge-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
}

.wiki-reader-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
  border-radius: 14px;
  max-height: 800px;
  overflow-y: auto;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
}

/* AI QUERY BOX */
.wiki-ai-query-box {
  padding: 1.25rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 102, 204, 0.06), rgba(5, 150, 105, 0.04));
  border: 1px solid var(--border-glass);
  box-shadow: var(--card-shadow);
}

.wiki-ai-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--primary-color);
  font-weight: 600;
}

.ai-sparkle {
  font-size: 1.2rem;
}

.wiki-ai-input-group {
  display: flex;
  gap: 0.5rem;
}

.wiki-ai-input-group input {
  flex: 1;
}

.wiki-ai-answer {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--table-head-bg);
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-primary);
  border-top: 1px solid var(--border-glass);
  border-right: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* WIKI ARTICLE VIEW */
.wiki-article-view {
  flex: 1;
}

.wiki-welcome-placeholder {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.wiki-welcome-placeholder h4 {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.wiki-doc-header {
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.wiki-doc-header h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.wiki-doc-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wiki-doc-body {
  line-height: 1.7;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.wiki-doc-body h1, .wiki-doc-body h2, .wiki-doc-body h3, .wiki-doc-body h4 {
  color: var(--text-primary);
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.wiki-doc-body h1 {
  font-size: 1.35rem;
  border-bottom: 2px solid var(--border-glass);
  padding-bottom: 0.4rem;
}

.wiki-doc-body h2 {
  font-size: 1.2rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.3rem;
  color: var(--primary-color);
}

.wiki-doc-body h3 {
  font-size: 1.05rem;
}

.wiki-doc-body p {
  margin-bottom: 0.85rem;
  color: var(--text-secondary);
}

.wiki-doc-body ul, .wiki-doc-body ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.wiki-doc-body li {
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

.wiki-doc-body code {
  background: var(--badge-bg);
  border: 1px solid var(--border-glass);
  color: var(--primary-color);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: monospace;
}

.wiki-doc-body pre {
  background: var(--table-head-bg);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.wiki-doc-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

.wiki-doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  overflow: hidden;
}

.wiki-doc-body th {
  background: var(--table-head-bg);
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-glass);
}

.wiki-doc-body td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.wiki-doc-body tr:nth-child(even) {
  background: var(--table-stripe-bg);
}

.wiki-doc-body tr:hover {
  background: rgba(0, 102, 204, 0.05);
}

.wiki-doc-body a.wikilink {
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.wiki-doc-body a.wikilink:hover {
  color: var(--primary-hover);
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  backdrop-filter: blur(16px);
  background: rgba(18, 21, 38, 0.92);
  border: 1px solid var(--border-glass);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

.toast.toast-fadeout {
  opacity: 0;
  transform: translateY(10px) scale(0.95);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.2rem;
}

.toast-message {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

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

.toast-close:hover {
  color: #fff;
}

.toast-success {
  border-left: 4px solid var(--success-color);
}
.toast-error {
  border-left: 4px solid var(--danger-color);
}
.toast-warning {
  border-left: 4px solid var(--warning-color);
}
.toast-info {
  border-left: 4px solid var(--primary-color);
}

/* ==========================================
   ACTS FILTER & SEARCH BAR (AMPIA & MODERNA)
   ========================================== */
.acts-filter-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.5rem;
  border-radius: 14px;
  margin-bottom: 1.5rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  box-shadow: var(--card-shadow);
  flex-wrap: wrap;
}

.filter-search-group {
  flex: 1 1 380px;
  position: relative;
  display: flex;
  align-items: center;
}

.filter-search-group .form-input {
  padding-left: 1rem;
  height: 46px;
  font-size: 0.95rem;
  border-radius: 10px;
  background-color: var(--input-bg);
  color: var(--input-color);
  border: 1.5px solid var(--input-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-select-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select-group .form-select {
  height: 46px;
  min-width: 175px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.5rem 2.2rem 0.5rem 1rem;
  background-color: var(--input-bg);
  color: var(--input-color);
  border: 1.5px solid var(--input-border);
}

.filter-stats-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--badge-color);
  background: var(--badge-bg);
  border: 1.5px solid var(--badge-border);
  padding: 0.55rem 1.15rem;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* TABLE FINDING PILLS (COLORI VIVIDI E AD ALTO CONTRASTO) */
.finding-pills {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

/* 🔴 BLOCCANTI */
.pill-blocking {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #f87171;
}
body.theme-dark .pill-blocking {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid #ef4444;
}

/* 🟡 ATTENZIONE / WARNING */
.pill-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
body.theme-dark .pill-warning {
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
  border: 1px solid #f59e0b;
}

/* ✏️ ORTOGRAFIA */
.pill-spell {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}
body.theme-dark .pill-spell {
  background: rgba(139, 92, 246, 0.25);
  color: #ddd6fe;
  border: 1px solid #8b5cf6;
}

/* 🟢 REGOLARE / OK */
.pill-ok {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}
body.theme-dark .pill-ok {
  background: rgba(16, 185, 129, 0.25);
  color: #a7f3d0;
  border: 1px solid #10b981;
}

/* ACT DETAIL QUICK ACTIONS & TOOLBAR */
.detail-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.act-quick-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.findings-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.findings-header-row h5 {
  margin-bottom: 0;
}

.findings-filter-chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.findings-filter-chips .filter-chip {
  background: var(--badge-bg);
  border: 1.5px solid var(--badge-border);
  color: var(--text-secondary);
  padding: 0.35rem 0.8rem;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.findings-filter-chips .filter-chip:hover {
  background: var(--input-bg);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.findings-filter-chips .filter-chip.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 2px 6px var(--primary-glow);
}

.findings-filter-chips .filter-chip.chip-blocking.active {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.findings-filter-chips .filter-chip.chip-warning.active {
  background: #d97706;
  color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.findings-filter-chips .filter-chip.chip-spell.active {
  background: #7c3aed;
  color: #ffffff;
  border-color: #7c3aed;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

.findings-filter-chips .filter-chip.chip-resolved.active {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

/* ==========================================
   CUSTOM MODALS (PREVIEW & AUDIT)
   ========================================== */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 15, 0.8);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease forwards;
}

.custom-modal {
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #0f1322;
  border: 1px solid var(--border-glass);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.15);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-title-group h3 {
  font-size: 1.15rem;
  margin: 0;
}

.modal-icon {
  font-size: 1.6rem;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.modal-actions-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.custom-modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}

.custom-modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.preview-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: #111422;
}

/* ==========================================
   OFFICIAL PAPER DOCUMENT STYLES
   ========================================== */
.official-paper {
  background: #ffffff;
  color: #1e293b;
  padding: 3rem 3.5rem;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: 'Times New Roman', Times, Georgia, serif;
  line-height: 1.65;
  font-size: 1.05rem;
  max-width: 800px;
  margin: 0 auto;
}

.official-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  gap: 1.5rem;
}

.official-logo-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.official-emblem {
  font-size: 2.6rem;
  line-height: 1;
}

.official-entity-text strong {
  display: block;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: #0f172a;
  text-transform: uppercase;
}

.official-entity-text span {
  display: block;
  font-size: 0.9rem;
  color: #475569;
}

.official-entity-text small {
  display: block;
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.official-act-meta {
  text-align: right;
  flex-shrink: 0;
}

.act-registry-badge {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  font-family: var(--font-sans);
  background: #f1f5f9;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.act-date-badge {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.35rem;
  font-family: var(--font-sans);
}

.official-subject-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 5px solid #2563eb;
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.75rem;
  border-radius: 4px;
}

.subject-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: #2563eb;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

.subject-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.official-body-content {
  text-align: justify;
  margin-bottom: 2rem;
  color: #1e293b;
}

.official-body-content h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  text-align: center;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #0f172a;
  font-size: 1.15rem;
  font-family: 'Times New Roman', Times, serif;
}

.official-body-content p {
  margin-bottom: 0.85rem;
  text-indent: 1.5rem;
}

.official-body-content p.lead-clause {
  font-weight: 600;
  text-indent: 0;
  margin-top: 1rem;
}

.official-body-content ol, .official-body-content ul {
  margin: 0.85rem 0 1.25rem 2.5rem;
}

.official-body-content li {
  margin-bottom: 0.5rem;
}

.official-footer-signature {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid #cbd5e1;
  padding-top: 1.5rem;
  margin-top: 2.5rem;
  gap: 1.5rem;
}

.sig-left {
  font-size: 0.72rem;
  color: #64748b;
  font-family: monospace;
  line-height: 1.4;
}

.sig-right {
  text-align: center;
  min-width: 250px;
}

.sig-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}

.sig-line {
  color: #94a3b8;
  margin: 0.85rem 0 0.25rem 0;
  letter-spacing: 2px;
}

.sig-subtitle {
  font-size: 0.75rem;
  font-style: italic;
  color: #64748b;
}

/* ==========================================
   AUDIT REPORT SHEET STYLES
   ========================================== */
.audit-paper {
  font-family: var(--font-sans) !important;
  font-size: 0.95rem;
  line-height: 1.5;
}

.audit-banner-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.audit-score-dial {
  text-align: right;
}

.score-badge-large {
  font-size: 1.6rem;
  font-weight: 800;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  display: inline-block;
}

.score-low {
  background: #dcfce7;
  color: #15803d;
}

.score-med {
  background: #fef3c7;
  color: #b45309;
}

.score-high {
  background: #fee2e2;
  color: #b91c1c;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem 0;
  font-size: 0.88rem;
}

.audit-table th {
  background: #f1f5f9;
  color: #334155;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border: 1px solid #cbd5e1;
  font-weight: 700;
}

.audit-table td {
  padding: 0.6rem 0.85rem;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  vertical-align: top;
}

/* ==========================================
   PRINT STYLESHEET
   ========================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .sidebar, .topbar, .modal-header, .acts-filter-bar, .act-quick-actions, .toast-container, #toast-container, .thermal-overlay {
    display: none !important;
  }

  .custom-modal-overlay {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    backdrop-filter: none !important;
  }

  .custom-modal {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    background: #fff !important;
  }

  .preview-scroll-body {
    padding: 0 !important;
    background: #fff !important;
  }

  .official-paper {
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
}

/* ==========================================
   FINANCIAL SUMMARY & THRESHOLDS BOX (D.LGS. 36/2023)
   ========================================== */
.financial-summary-box {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.financial-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.fin-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.fin-icon {
  font-size: 1.4rem;
}

.fin-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.financial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.fin-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.fin-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.fin-val {
  font-size: 1.05rem;
  color: #fff;
}

.financial-checks-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fin-check-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
}

.fin-check-pill.check-valid {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.fin-check-pill.check-invalid {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.fin-check-pill.check-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   STILI SEZIONE REGISTRAZIONE & UDITO NEURALE (AUDIO-PREATTI)
   ========================================================================== */

.audio-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.audio-auth-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.auth-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.dot-idle {
  background: #94a3b8;
}

.status-dot.dot-active {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-dot.dot-recording {
  background: #ef4444;
  box-shadow: 0 0 12px #ef4444;
  animation: pulseRecording 1s infinite alternate;
}

@keyframes pulseRecording {
  from { transform: scale(0.9); opacity: 0.7; }
  to { transform: scale(1.3); opacity: 1; }
}

.audio-source-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.audio-source-group select {
  min-width: 260px;
}

.audio-rup-meta {
  display: flex;
  gap: 0.5rem;
}

.scenarios-quick-bar {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.scenarios-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.scenarios-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.scenario-btn {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: normal;
  line-height: 1.3;
}

.scenario-btn.active, .scenario-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary-color);
  color: var(--text-color);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.recording-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}

@media (max-width: 1100px) {
  .recording-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.recording-left-col, .recording-right-col {
  padding: 1.25rem;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.subhead-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.subhead-title h4, .panel-subhead h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.live-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.red-rec-dot {
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulseRecording 0.8s infinite alternate;
}

.audio-timer {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.waveform-container {
  position: relative;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  overflow: hidden;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#audio-waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.waveform-overlay-info {
  position: absolute;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.audio-actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.transcript-box {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  height: 280px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.transcript-placeholder {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.transcript-messages-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transcript-msg {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--primary-color);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  animation: fadeInMsg 0.3s ease;
}

.transcript-msg.speaker-rup {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.transcript-msg.speaker-assessore {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.transcript-msg.speaker-segretario {
  border-left-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.05);
}

.msg-speaker-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.msg-text {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-color);
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.intent-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.intent-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}

.intent-card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
  margin-bottom: 0.25rem;
}

.intent-card-val {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.live-act-preview-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 280px;
}

.live-act-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--border-glass);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.live-act-preview-header h5 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-color);
}

.live-act-preview-header small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.live-act-actions {
  display: flex;
  gap: 0.35rem;
}

.live-act-preview-body {
  padding: 1rem;
  overflow-y: auto;
  max-height: 380px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.empty-act-placeholder {
  text-align: center;
  color: var(--text-muted);
  margin: 2rem auto;
}

.empty-act-placeholder span {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

.rendered-voice-act {
  background: #ffffff;
  color: #1e293b;
  padding: 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-family: 'Times New Roman', Times, serif;
}

.rendered-voice-act h3 {
  font-size: 1.05rem;
  text-align: center;
  margin-bottom: 0.75rem;
  color: #0f172a;
}

.rendered-voice-act .act-subject {
  font-weight: bold;
  margin-bottom: 1rem;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 0.5rem;
}

.rendered-voice-act .act-section-title {
  font-weight: bold;
  text-transform: uppercase;
  margin-top: 0.8rem;
  margin-bottom: 0.3rem;
  color: #1e3a8a;
  font-size: 0.85rem;
}

.rendered-voice-act p {
  margin-bottom: 0.6rem;
  text-align: justify;
  font-size: 0.9rem;
}

/* ==========================================
   7 UFFICI MULTI-AGENTE & TELEGRAM HUB
   ========================================== */
.offices-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.office-card {
  padding: 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.office-card:hover, .office-card.active {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
}

.office-card-icon {
  font-size: 2rem;
}

.office-card-info h5 {
  font-size: 1rem;
  margin: 0;
  color: var(--text-color);
}

.office-card-mgr {
  color: var(--text-muted);
  font-size: 0.8rem;
  display: block;
}

.office-card-bot {
  font-size: 0.75rem;
  color: #38bdf8;
  font-family: monospace;
  margin-top: 0.25rem;
}

.office-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.4rem;
}

.office-workspace-panel {
  padding: 1.5rem;
  border-radius: 14px;
}

.office-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1rem;
}

.office-title-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.office-big-icon {
  font-size: 2.5rem;
}

.office-bot-pill {
  display: inline-block;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  margin-top: 0.3rem;
}

.sub-agents-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sub-agent-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-color);
}

.telegram-chat-box {
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 380px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.chat-messages-scroll {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  padding: 0.8rem 1rem;
  border-radius: 10px;
  max-width: 85%;
  font-size: 0.88rem;
  line-height: 1.45;
}

.bot-bubble {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.25);
  align-self: flex-start;
}

.user-bubble {
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.5);
  align-self: flex-end;
}

.quick-commands-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.cmd-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: #38bdf8;
  padding: 0.25rem 0.6rem;
  border-radius: 14px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cmd-pill:hover {
  background: #38bdf8;
  color: #0f172a;
}

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-glass);
}

/* ==========================================
   SOMMA URGENZA (ART. 140 D.LGS. 36/2023)
   ========================================== */
.somma-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

@media (max-width: 1024px) {
  .somma-layout-grid {
    grid-template-columns: 1fr;
  }
}

.somma-form-card, .somma-preview-card {
  padding: 1.5rem;
  border-radius: 14px;
}

.financial-routes-selector {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.radio-card-su {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}

.radio-card-su:hover {
  background: rgba(255, 255, 255, 0.06);
}

.su-card-inner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.su-card-inner strong {
  font-size: 0.85rem;
  color: var(--text-color);
}

.su-card-inner span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.su-deadlines-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.deadline-pill {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pill-red {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.pill-yellow {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #fde047;
}

.pill-blue {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.su-docs-tab-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.5rem;
}

.su-doc-btn {
  background: none;
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.su-doc-btn.active, .su-doc-btn:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.rendered-su-paper {
  background: #ffffff;
  color: #0f172a;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  max-height: 520px;
  overflow-y: auto;
}

.su-paper-text {
  font-family: 'Times New Roman', serif;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0;
}

/* ==========================================
   USER SESSION WIDGET (HEADER NAVBAR)
   ========================================== */
.user-session-widget {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

body.theme-dark .user-session-widget {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.user-avatar-badge {
  font-size: 1.25rem;
  background: rgba(0, 102, 204, 0.15);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(0, 102, 204, 0.3);
  flex-shrink: 0;
}

.user-meta-group {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-meta-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

body.theme-dark .user-meta-name {
  color: #f8fafc;
}

.user-role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-top: 0.1rem;
}

/* COLORI DEGLI 11 RUOLI ISTITUZIONALI */
.role-amministratore, .role-admin { background: #e11d48; color: #fff; border: 1px solid #fda4af; }
.role-sviluppatore { background: #7c3aed; color: #fff; border: 1px solid #c4b5fd; }
.role-segretario_generale { background: #0284c7; color: #fff; border: 1px solid #7dd3fc; }
.role-sindaco { background: #059669; color: #fff; border: 1px solid #6ee7b7; }
.role-assessore { background: #d97706; color: #fff; border: 1px solid #fcd34d; }
.role-consigliere_maggioranza { background: #16a34a; color: #fff; border: 1px solid #86efac; }
.role-consigliere_minoranza { background: #ea580c; color: #fff; border: 1px solid #fdba74; }
.role-dirigente { background: #2563eb; color: #fff; border: 1px solid #93c5fd; }
.role-capo_area, .role-rup { background: #0d9488; color: #fff; border: 1px solid #5eead4; }
.role-istruttore { background: #475569; color: #fff; border: 1px solid #94a3b8; }
.role-cittadino { background: #52525b; color: #e4e4e7; border: 1px solid #71717a; }

.btn-outline-auth {
  background: rgba(0, 102, 204, 0.08);
  border: 1px solid var(--border-glass);
  color: #0066cc;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-outline-auth:hover {
  background: #0066cc;
  color: #fff;
}
body.theme-dark .btn-outline-auth {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #93c5fd;
}
body.theme-dark .btn-outline-auth:hover {
  background: #2563eb;
  color: #fff;
}

.btn-logout-icon {
  background: transparent;
  border: 1px solid transparent;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.btn-logout-icon:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ==========================================
   ADMIN SUBNAV & PANELS
   ========================================== */
/* ==========================================
   ADMIN SUBNAV & PANELS (CLAUDE-STYLE DESIGN)
   ========================================== */
.admin-subnav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.6rem;
  margin-bottom: 1.5rem;
  border-radius: 14px;
  background: var(--bg-glass, rgba(255, 255, 255, 0.8));
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.8));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.admin-subnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 1.15rem;
  border-radius: 10px;
  color: var(--text-muted, #64748b);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-subnav-btn:hover {
  background: rgba(14, 165, 233, 0.08);
  color: var(--text-color, #0f172a);
  transform: translateY(-1px);
}

.admin-subnav-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.admin-notice-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.2rem 1.6rem;
  border-radius: 14px;
  margin-bottom: 1.6rem;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(2, 132, 199, 0.03));
  border: 1px solid rgba(14, 165, 233, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
}

.notice-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.notice-text strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  margin-bottom: 0.3rem;
}

.notice-text p {
  font-size: 0.88rem;
  color: var(--text-muted, #64748b);
  margin: 0;
  line-height: 1.45;
}

/* ==========================================
   PLUGINS & FEATURE TOGGLE GRID (PREMIUM CARDS)
   ========================================== */
.plugins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.4rem;
}

.plugin-card {
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.9));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.plugin-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  border-color: rgba(14, 165, 233, 0.4);
}

.plugin-card.plugin-disabled {
  opacity: 0.65;
  background: rgba(241, 245, 249, 0.6);
  border-color: rgba(226, 232, 240, 0.8);
}

.plugin-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.plugin-icon-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.plugin-icon {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.08);
  flex-shrink: 0;
}

.plugin-title-box h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
}

.plugin-category {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #0284c7;
  background: rgba(14, 165, 233, 0.1);
  padding: 2px 8px;
  border-radius: 20px;
}

/* SWITCH TOGGLE (TACTILE IOS STYLE) */
.plugin-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.plugin-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .28s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 30px;
}

.plugin-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .28s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.plugin-switch input:checked + .plugin-slider {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.plugin-switch input:checked + .plugin-slider:before {
  transform: translateX(22px);
}

.plugin-switch input:disabled + .plugin-slider {
  cursor: not-allowed;
  opacity: 0.5;
}

.plugin-desc {
  font-size: 0.88rem;
  color: var(--text-muted, #64748b);
  line-height: 1.5;
  margin-bottom: 1.2rem;
  flex-grow: 1;
}

.plugin-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-glass, rgba(226, 232, 240, 0.7));
  padding-top: 0.85rem;
  font-size: 0.78rem;
}

/* ==========================================
   USERS MANAGEMENT TABLE
   ========================================== */
/* ==========================================
   USERS MANAGEMENT TABLE
   ========================================== */
.users-management-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: 14px;
  background: var(--bg-glass, rgba(255, 255, 255, 0.8));
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.8));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.users-table-container {
  overflow-x: auto;
  border-radius: 16px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.9));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.users-table th, .users-table td {
  padding: 0.85rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--border-glass, rgba(226, 232, 240, 0.7));
}

.users-table th {
  background: rgba(241, 245, 249, 0.8);
  color: var(--text-color, #0f172a);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================
   AUTH MODAL & QUICK ROLES GRID
   ========================================== */
.auth-modal-card {
  max-width: 720px;
  width: 95%;
}
.auth-tabs-bar {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1rem;
}
.auth-modal-card {
  max-width: 1260px !important;
  width: 96% !important;
  max-height: 92vh !important;
}

.auth-tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 1rem;
}

.auth-tab-btn {
  flex: 1;
  padding: 0.75rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}
.auth-intro-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.quick-switch-category-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.quick-cat-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.quick-cat-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.quick-cat-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(0, 102, 204, 0.4);
}

.roles-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.role-quick-card {
  padding: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.role-quick-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--border-glass);
  transition: background 0.2s ease;
}
.role-quick-card:hover {
  background: rgba(0, 102, 204, 0.12);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.role-quick-card:hover::before {
  background: var(--primary-color);
}
.role-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.role-card-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.role-card-icon {
  font-size: 1.3rem;
}
.role-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}
.role-card-cat-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}
.role-card-user {
  font-size: 0.76rem;
  color: var(--primary-light, #60a5fa);
  margin-bottom: 0.25rem;
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.role-card-office {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.role-card-desc {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.3;
}

/* ==========================================
   ROLE-PLUGIN MATRIX & ROLE SELECTOR STYLES
   ========================================== */
/* ==========================================
   ROLE-PLUGIN MATRIX & ROLE SELECTOR STYLES
   ========================================== */
.matrix-controls-toolbar {
  padding: 1rem 1.25rem;
  border-radius: 14px;
  margin-bottom: 1.5rem;
  background: var(--bg-glass, rgba(255, 255, 255, 0.8));
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.8));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.role-selector-pills-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.role-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 24px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.9));
  color: var(--text-color, #0f172a);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.role-pill-btn:hover {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.4);
  transform: translateY(-1px);
}

.role-pill-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.role-plugins-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.role-plugin-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.4rem;
  border-radius: 14px;
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.9));
  background: var(--bg-card, #ffffff);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.role-plugin-row-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  border-color: rgba(14, 165, 233, 0.3);
}

.role-plugin-row-card.plugin-perm-disabled {
  opacity: 0.6;
  background: rgba(241, 245, 249, 0.7);
}

.role-plugin-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.role-plugin-info .rpi-icon {
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.08);
}

.role-plugin-info h5 {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
}

.role-plugin-info small {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

.role-matrix-table-box {
  border-radius: 16px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.9));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.matrix-table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-glass, rgba(226, 232, 240, 0.8));
  background: rgba(14, 165, 233, 0.03);
}

.matrix-table-header-row h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
}

.matrix-table-responsive-wrapper {
  overflow-x: auto;
  max-height: 500px;
}

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

.role-matrix-table th, .role-matrix-table td {
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-glass, rgba(226, 232, 240, 0.7));
  border-right: 1px solid var(--border-glass, rgba(226, 232, 240, 0.5));
}

.role-matrix-table th:first-child, .role-matrix-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-card, #ffffff);
  z-index: 2;
  min-width: 230px;
  font-weight: 600;
  color: var(--text-color, #0f172a);
}

.role-matrix-table th {
  background: rgba(241, 245, 249, 0.8);
  color: var(--text-color, #0f172a);
  font-weight: 700;
  white-space: nowrap;
}
.matrix-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #10b981;
}

/* ==========================================
   BARRA LATERALE DI ESAME ATTO (INSPECTOR)
   ========================================== */
.act-rewrite-split-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.act-inspector-sidebar {
  width: 330px;
  flex-shrink: 0;
  border-radius: 12px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  position: sticky;
  top: 10px;
  max-height: 80vh;
  overflow-y: auto;
}

.inspector-jump-btn {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
  border-radius: 6px;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.inspector-jump-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #ffffff;
  transform: translateX(3px);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.inspector-jump-btn:active {
  transform: translateX(1px);
}

@media (max-width: 1024px) {
  .act-rewrite-split-layout {
    flex-direction: column;
  }
  .act-inspector-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }
}

/* ==========================================================================
   PORTALE "ZERO-BRAIN" WAUUU 3D & ENTE LOCALE HERO
   ========================================================================== */

.portal-hero-card {
  width: 100%;
  border-radius: 18px;
  background-size: cover;
  background-position: center;
  padding: 3.5rem 2.5rem 3rem 2.5rem;
  margin-bottom: 2.2rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.portal-hero-content {
  position: relative;
  z-index: 2;
}

.portal-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 6px 14px;
  border-radius: 30px;
  margin-bottom: 1rem;
}

.portal-hero-badge .badge-dot {
  width: 7px;
  height: 7px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px #38bdf8;
}

.portal-hero-title {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 3rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
  line-height: 1.15;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.portal-hero-subtitle {
  font-size: 1.2rem;
  color: #e2e8f0;
  margin: 0;
  font-weight: 400;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* GRIGLIA DELLE 3 GRANDI CARD 3D */
.portal-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.6rem;
  margin-bottom: 2.2rem;
}

.portal-card {
  background: var(--bg-glass, rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--border-glass, rgba(226, 232, 240, 0.8));
  border-radius: 20px;
  padding: 2rem 1.8rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

body.theme-dark .portal-card {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.portal-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  border-color: var(--primary-color, #0284c7);
}

body.theme-dark .portal-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.15);
}

.portal-card-image-wrap {
  width: 96px;
  height: 96px;
  margin-bottom: 1.4rem;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease;
}

.portal-card:hover .portal-card-image-wrap {
  transform: scale(1.08) rotate(-2deg);
}

.portal-card-3d-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portal-card-step-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.portal-card-heading {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  margin: 0 0 0.75rem 0;
  line-height: 1.25;
}

.portal-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted, #475569);
  line-height: 1.5;
  margin: 0 0 1.5rem 0;
  flex: 1;
}

.portal-card-footer {
  margin-top: auto;
}

.portal-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.portal-btn-primary {
  background: #f0fdf4;
  color: #16a34a;
  border: 1.5px solid #bbf7d0;
}
.portal-btn-primary:hover {
  background: #16a34a;
  color: #ffffff;
}

.portal-btn-pink {
  background: #fdf2f8;
  color: #db2777;
  border: 1.5px solid #fbcfe8;
}
.portal-btn-pink:hover {
  background: #db2777;
  color: #ffffff;
}

.portal-btn-cyan {
  background: #f0f9ff;
  color: #0284c7;
  border: 1.5px solid #bae6fd;
}
.portal-btn-cyan:hover {
  background: #0284c7;
  color: #ffffff;
}

/* BARRE DI STATO INFERIORI */
.portal-bottom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}

.portal-status-card {
  background: var(--bg-glass, rgba(255, 255, 255, 0.75));
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass, rgba(226, 232, 240, 0.8));
  border-radius: 14px;
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.25s ease;
}

body.theme-dark .portal-status-card {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.06);
}

.portal-status-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.portal-status-icon {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 132, 199, 0.08);
  border-radius: 10px;
}

.portal-status-alert {
  background: rgba(254, 242, 242, 0.85);
  border-color: rgba(254, 202, 202, 0.9);
}

body.theme-dark .portal-status-alert {
  background: rgba(153, 27, 27, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

.portal-status-icon-alert {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.12);
  border-radius: 10px;
}

.portal-status-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  margin: 0 0 2px 0;
}

.portal-status-sub {
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
  margin: 0;
}

/* ========================================================
   WIZARD STYLES (CLAUDE-STYLE ZERO-BRAIN STEPPER)
   ======================================================== */
.glass-premium {
  background: var(--bg-modal, #ffffff);
  backdrop-filter: blur(24px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  max-width: 720px;
  width: 100%;
  margin: auto;
  overflow: hidden;
  position: relative;
}

body.theme-dark .glass-premium {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
}

.wizard-container {
  padding: 2.2rem;
}

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.8rem;
}

.wizard-steps-indicator {
  flex: 1;
  max-width: 320px;
}

.step-badge-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.step-progress-bar {
  width: 100%;
  height: 5px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

body.theme-dark .step-progress-bar {
  background: #334155;
}

.step-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #06b6d4);
  border-radius: 10px;
  transition: width 0.4s ease;
}

.wizard-title {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
}

.wizard-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted, #64748b);
  margin: 0 0 1.8rem 0;
  line-height: 1.4;
}

.wizard-dropzone {
  border: 2px dashed #0284c7;
  background: rgba(240, 249, 255, 0.6);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

body.theme-dark .wizard-dropzone {
  background: rgba(2, 132, 199, 0.08);
  border-color: #38bdf8;
}

.wizard-dropzone:hover {
  background: rgba(224, 242, 254, 0.9);
  transform: scale(1.01);
}

.wz-dropzone-icon {
  font-size: 2.8rem;
  margin-bottom: 0.8rem;
}

.wz-dropzone-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  margin: 0 0 4px 0;
}

.wz-dropzone-sub {
  font-size: 0.9rem;
  color: var(--text-muted, #64748b);
  margin: 0;
}

.wizard-security-badges {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.wz-sec-badge {
  font-size: 0.85rem;
  color: var(--text-muted, #475569);
  font-weight: 500;
}

/* PASSO 2 CHECKLIST */
.wizard-checklist-box {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.wz-check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  color: var(--text-muted, #64748b);
  font-weight: 500;
  transition: all 0.3s ease;
}

.wz-check-item.active {
  color: var(--text-color, #0f172a);
  font-weight: 700;
}

.wz-check-item.done {
  color: #16a34a;
  font-weight: 600;
}

/* PASSO 3 SUMMARY CARD */
.wz-success-badge-icon {
  font-size: 3rem;
  color: #16a34a;
  margin-bottom: 0.5rem;
}

.wz-summary-card {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.8rem;
}

.wz-sum-type {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0284c7;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.wz-sum-subject {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  margin: 0 0 1rem 0;
  line-height: 1.35;
}

.wz-sum-meta-grid {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

.wz-meta-item {
  font-size: 0.9rem;
}

.wz-meta-k {
  color: var(--text-muted, #64748b);
  margin-right: 4px;
}

.wz-actions-row {
  display: flex;
  gap: 1rem;
}

.btn-stat-chip {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.2);
  color: #0284c7;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-stat-chip:hover {
  background: #0284c7;
  color: #ffffff;
}

/* ==========================================================================
   PREATTI CLEAN HEADER & DRAWER SYSTEM (CLAUDE-STYLE ELEGANCE)
   ========================================================================== */
.preatti-clean-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2.5rem;
  background: var(--bg-card, #ffffff);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-color, #0f172a);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #64748b;
  text-transform: uppercase;
  margin-top: 2px;
}

.header-right-tools {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.btn-clean-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 24px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-color, #334155);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clean-nav:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-clean-nav.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* DRAWER MODULI */
.modules-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.modules-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--bg-card, #ffffff);
  border-left: 1px solid var(--border-color, #e2e8f0);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

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

.drawer-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
}

.drawer-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
}

.drawer-menu-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--bg-secondary, #f8fafc);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer-nav-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateX(4px);
}

.drawer-icon {
  font-size: 1.3rem;
}

.drawer-text {
  display: flex;
  flex-direction: column;
}

.drawer-text strong {
  font-size: 0.9rem;
  color: var(--text-color, #0f172a);
}

.drawer-text small {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
}

/* ==========================================================================
   MODAL & WIZARD BACKDROP BASE SYSTEM
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeInModal 0.2s ease-out;
}

.wizard-container {
  width: 100%;
  max-width: 720px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 2rem;
  position: relative;
  animation: scaleUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUpModal {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   OFFICIAL DOCUMENT PAPER & PREVIEW MODAL STYLES
   ========================================================================== */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.preview-modal-card {
  width: 100%;
  max-width: 960px;
  max-height: 92vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.theme-dark .preview-modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.preview-scroll-body {
  overflow-y: auto;
  padding: 1.5rem 2rem;
  background: #e2e8f0;
  flex: 1;
}

body.theme-dark .preview-scroll-body {
  background: #090d16;
}

.official-paper {
  background: #ffffff;
  color: #0f172a;
  padding: 40px 50px;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  margin: 0 auto;
  max-width: 820px;
  font-family: 'Times New Roman', Times, Georgia, serif;
  font-size: 11.5pt;
  line-height: 1.6;
}

.official-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 14px;
  margin-bottom: 22px;
  gap: 15px;
}

.official-logo-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.official-entity-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.official-entity-text strong {
  font-size: 1.1rem;
  color: #0f172a;
  font-family: var(--font-sans);
  letter-spacing: 0.5px;
}

.official-entity-text span {
  font-size: 0.85rem;
  color: #475569;
  font-family: var(--font-sans);
  font-weight: 600;
}

.official-entity-text small {
  font-size: 0.82rem;
  color: #0284c7;
  font-family: var(--font-sans);
  font-weight: 700;
  margin-top: 2px;
}

.official-act-meta {
  text-align: right;
  font-family: var(--font-sans);
}

.act-registry-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0284c7;
  background: #e0f2fe;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}

.act-date-badge {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 4px;
  font-weight: 600;
}

.official-subject-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #0284c7;
  padding: 12px 18px;
  border-radius: 6px;
  margin-bottom: 24px;
}

.official-subject-box .subject-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: #0284c7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-sans);
}

.official-subject-box .subject-text {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 4px;
  line-height: 1.45;
}

.official-body-content {
  color: #1e293b;
  text-align: justify;
}

.official-body-content p {
  margin-bottom: 0.9rem;
  font-weight: 400;
}

.official-body-content p.lead-clause {
  font-weight: 400;
  color: #1e293b;
}

.official-body-content h4,
.official-body-content h5 {
  font-family: var(--font-sans);
}

.official-footer-signature {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

/* ==========================================================================
   DEDICATED PRINT STYLESHEET (@MEDIA PRINT)
   ========================================================================== */
@media print {
  /* 1. Nascondi tutto il layout applicativo e di sistema */
  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  body * {
    visibility: hidden;
  }

  /* 2. Rendi visibile SOLO la carta ufficiale dell'atto */
  #official-doc-paper,
  #official-doc-paper *,
  #official-turbo-paper,
  #official-turbo-paper * {
    visibility: visible;
  }

  #determina-preview-modal,
  #turbo-audit-modal {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
  }

  .preview-modal-card,
  .audit-modal-card {
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .preview-scroll-body {
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  .modal-header,
  .custom-modal-header,
  .modal-actions-top,
  .custom-modal-close,
  .btn,
  header,
  .app-header,
  .tabs-nav,
  .technical-topbar,
  .acts-layout,
  .modules-drawer-backdrop,
  .toast-container {
    display: none !important;
  }

  #official-doc-paper,
  #official-turbo-paper {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10mm 15mm 15mm 15mm !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: none !important;
    font-size: 11pt !important;
    line-height: 1.45 !important;
  }

  .official-subject-box {
    background: #f8fafc !important;
    border: 1px solid #94a3b8 !important;
    border-left: 4px solid #000000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .act-registry-badge {
    border: 1px solid #000000 !important;
    background: transparent !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .official-header,
  .official-subject-box,
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
  }

  .official-footer-signature {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  @page {
    size: A4 portrait;
    margin: 12mm 15mm 15mm 15mm;
  }
}

/* ==========================================================================
   STILI ASSISTENTE AI IN-APP, DRAWER FLOTTANTE & VIDEO PLAYER PROTETTO
   ========================================================================== */

/* Bottone Flottante In-App */
.assistant-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #7c3aed 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50px;
  padding: 12px 20px 12px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5), 0 0 20px rgba(124, 58, 237, 0.35);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: pulse-assistant 3s infinite;
}

.assistant-floating-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 30px -5px rgba(37, 99, 235, 0.7), 0 0 25px rgba(124, 58, 237, 0.5);
}

.assistant-btn-icon {
  font-size: 1.3rem;
  line-height: 1;
}

@keyframes pulse-assistant {
  0%, 100% { box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5), 0 0 20px rgba(124, 58, 237, 0.35); }
  50% { box-shadow: 0 10px 30px 0px rgba(37, 99, 235, 0.75), 0 0 30px rgba(124, 58, 237, 0.6); }
}

/* Drawer Laterale */
.assistant-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  justify-content: flex-end;
}

.assistant-drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

.assistant-drawer-content {
  position: relative;
  width: 440px;
  max-width: 95vw;
  height: 100%;
  background: #0f172a;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -15px 0 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 10001;
  animation: slide-in-drawer 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-in-drawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* Header Drawer */
.assistant-drawer-header {
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.assistant-header-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0284c7, #7c3aed);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.assistant-header-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
}

.assistant-header-sub {
  margin: 2px 0 0 0;
  font-size: 0.76rem;
  color: #94a3b8;
}

.assistant-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
}

.assistant-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Tabs */
.assistant-tabs-bar {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.assistant-tab-btn {
  flex: 1;
  padding: 10px 4px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.assistant-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.05);
}

/* Tab Panes */
.assistant-tab-pane {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Chat Tab Content */
.assistant-quick-prompts {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.quick-prompt-pill {
  padding: 6px 12px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 20px;
  color: #bae6fd;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.quick-prompt-pill:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
}

.assistant-messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.assistant-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
}

.assistant-msg.msg-user {
  align-self: flex-end;
}

.assistant-msg.msg-ai {
  align-self: flex-start;
}

.msg-bubble {
  padding: 12px 15px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.48;
}

.msg-user .msg-bubble {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.msg-ai .msg-bubble {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.msg-video-card {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.msg-video-info h5 {
  margin: 0;
  font-size: 0.8rem;
  color: #38bdf8;
}

.msg-video-info span {
  font-size: 0.72rem;
  color: #94a3b8;
}

.btn-watch-inline {
  padding: 5px 10px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Feedback & Actions */
.msg-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  padding-left: 4px;
}

.btn-feedback {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  transition: color 0.2s;
}

.btn-feedback:hover {
  color: #38bdf8;
}

.btn-feedback.active {
  color: #38bdf8;
}

/* Chat Bottom & Escalation */
.assistant-chat-bottom {
  padding: 12px 16px 16px 16px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.assistant-escalate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.75rem;
  color: #94a3b8;
}

.btn-escalate-human {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-escalate-human:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
}

.assistant-input-form {
  display: flex;
  gap: 8px;
}

.assistant-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.88rem;
}

.assistant-input:focus {
  outline: none;
  border-color: #38bdf8;
  background: rgba(30, 41, 59, 0.95);
}

.assistant-send-btn {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.assistant-send-btn:hover {
  transform: scale(1.05);
}

/* Tickets & Videos Panes */
.tickets-header-summary, .videos-header-desc {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.assistant-tickets-list, .assistant-videos-grid {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-card {
  padding: 12px 14px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.ticket-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(30, 41, 59, 0.85);
}

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

.ticket-status-pill {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}

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

.ticket-status-pill.status-escalated {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.ticket-status-pill.status-open {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Video Card */
.video-card-item {
  padding: 14px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-card-item h4 {
  margin: 0;
  font-size: 0.9rem;
  color: #38bdf8;
}

.video-card-item p {
  margin: 0;
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* Video Player Modal */
.video-modal-box {
  width: 720px;
  max-width: 95vw;
}

.video-player-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
  background: #020617;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-watermark-overlay {
  position: absolute;
  top: 14px;
  right: 16px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 10;
  user-select: none;
}

.video-placeholder-display {
  text-align: center;
  padding: 2rem;
}

.video-placeholder-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  color: #38bdf8;
}


