@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html,
body {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.valid.modified:not([type=checkbox]) {
  outline: 1px solid #26b050;
}

.invalid {
  outline: 1px solid red;
}

.validation-message {
  color: red;
}

.button-link {
  text-decoration: unset;
}

#blazor-error-ui {
  background: lightyellow;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
  display: none;
  left: 0;
  padding: .6rem 1.25rem .7rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

  #blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: .75rem;
    top: .5rem;
  }

/* ============ Pagine statistiche (Classi / Settori) ============ */

.page-head {
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}

.page-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #667085;
}

.filters-row-classi {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.filters-row-settori {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.kpi-row-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* ---- Heatmap ---- */

.heatmap-scroll {
  overflow-x: auto;
  margin-top: 8px;
}

table.heatmap {
  border-collapse: separate;
  border-spacing: 3px;
  width: auto;
}

table.heatmap th,
table.heatmap td {
  border: none;
  padding: 0;
}

table.heatmap thead th {
  font-size: 11px;
  color: #475569;
  font-weight: 700;
  text-align: center;
  vertical-align: bottom;
  padding: 0 2px 6px;
}

.heatmap .hm-rot {
  height: 96px;
  white-space: nowrap;
}

.heatmap .hm-rot span {
  display: inline-block;
  transform: rotate(-55deg);
  transform-origin: left bottom;
  width: 18px;
  font-weight: 600;
}

.heatmap .hm-stick {
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 2;
  text-align: left;
}

.heatmap .hm-name {
  font-size: 12px;
  color: #1f2937;
  padding-right: 12px;
  white-space: nowrap;
  font-weight: 500;
}

.heatmap .hm-cell {
  width: 40px;
  min-width: 40px;
  height: 30px;
  text-align: center;
  font-size: 12px;
  border-radius: 6px;
  color: #cbd5e1;
  background: #f8fafc;
}

.heatmap tbody td:last-child {
  text-align: center;
  font-size: 13px;
  padding-left: 8px;
}

/* ---- Istogramma distribuzione ---- */

.histogram {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 170px;
  margin-top: 12px;
  padding-bottom: 4px;
}

.histo-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.histo-bar-wrap {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 140px;
  width: 100%;
}

.histo-count {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 2px;
}

.histo-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 5px 5px 0 0;
  transition: height 0.2s;
}

.histo-bar.dist-red { background: #ef4444; }
.histo-bar.dist-orange { background: #f97316; }
.histo-bar.dist-green { background: #22c55e; }

.histo-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

/* ---- Badge rischio ---- */

.risk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.risk-badge.risk-high { background: #dc2626; }
.risk-badge.risk-med { background: #f97316; }
.risk-badge.risk-low { background: #16a34a; }
.risk-badge.risk-none { background: #cbd5e1; color: #475569; }

.rank-pos {
  font-weight: 800;
  color: #94a3b8;
  width: 28px;
}

.risk-clickable {
  cursor: pointer;
  user-select: none;
}

.risk-clickable:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, .25);
}

/* ---- Popup spiegazione rischio ---- */

.rischio-popup {
  font-size: 13px;
}

.rp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.rp-nome {
  font-size: 14px;
  color: #0f172a;
}

.rp-reason {
  margin: 0 0 10px;
  color: #334155;
  line-height: 1.4;
}

.rp-summary {
  background: #f8fafc;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: #475569;
  margin-bottom: 10px;
}

.rp-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rp-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 7px;
  background: #fff7ed;
}

.rp-list li.grave {
  background: #fef2f2;
}

.rp-mat {
  font-size: 12px;
  color: #1f2937;
  font-weight: 500;
}

.rp-val {
  font-weight: 800;
  font-size: 13px;
}

.rp-list li.lieve .rp-val { color: #ea580c; }
.rp-list li.grave .rp-val { color: #dc2626; }

.rp-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
}

.rp-list li.lieve .rp-tag { background: #ffedd5; color: #c2410c; }
.rp-list li.grave .rp-tag { background: #fee2e2; color: #b91c1c; }

.rp-none {
  color: #16a34a;
  font-weight: 600;
  margin-bottom: 10px;
}

.rp-formula {
  border-top: 1px solid #eef2f6;
  padding-top: 8px;
}

.rp-formula-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 5px;
}

.rp-rule {
  font-size: 12px;
  color: #64748b;
  padding: 3px 6px;
  border-radius: 6px;
}

.rp-rule b { color: #475569; }

.rp-rule.active {
  background: #eef2ff;
  color: #3730a3;
}

.rp-rule.active b { color: #3730a3; }

/* ---- Benchmark classi ---- */

.benchmark-table .bench-name { font-weight: 600; }
.benchmark-table .bench-bar-col { width: 30%; }

.bench-bar-track {
  background: #eef2f6;
  border-radius: 999px;
  height: 10px;
  width: 100%;
  overflow: hidden;
}

.bench-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s;
}

.comp-pos { color: #16a34a; font-weight: 700; }
.comp-neg { color: #dc2626; font-weight: 700; }

/* ---- Classi parallele ---- */

.parallele-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.parallele-group {
  border: 1px solid #eef2f6;
  border-radius: 12px;
  padding: 14px;
  background: #fbfdff;
}

.parallele-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef2f6;
}

.parallele-anno {
  font-weight: 800;
  font-size: 13px;
  color: #334155;
}

.parallele-media {
  font-size: 17px;
}

.parallele-row {
  display: grid;
  grid-template-columns: 56px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
}

.parallele-classe {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.parallele-val {
  font-size: 13px;
  text-align: right;
}

.count-chip {
  display: inline-block;
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 9px;
  margin-left: 6px;
}

@media (max-width: 900px) {
  .filters-row-classi,
  .filters-row-settori,
  .panel-grid-2,
  .kpi-row-5 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .filters-row-classi,
  .filters-row-settori,
  .panel-grid-2,
  .kpi-row-5 {
    grid-template-columns: 1fr;
  }
}

/* ============ Login ============ */

.empty-layout {
  min-height: 100vh;
  display: flex;
}

.auth-loading {
  margin: auto;
  padding: 40px;
  color: #667085;
  font-size: 14px;
}

.login-wrap {
  flex: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0f172a 0%, #2563eb 140%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #ffffff;
  border-radius: 18px;
  padding: 34px 30px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, .35);
}

.login-logo {
  display: block;
  width: 190px;
  max-width: 70%;
  height: auto;
  margin-bottom: 18px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 18px;
}

.login-brand b { color: #7c3aed; }

.login-spark {
  color: #8b5cf6;
  font-size: 20px;
}

.login-card h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  color: #0f172a;
}

.login-sub {
  margin: 4px 0 22px;
  font-size: 13px;
  color: #667085;
}

.login-field {
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #27364f;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.login-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}

.login-error {
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.login-btn {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  cursor: pointer;
  margin-top: 6px;
  transition: filter .15s;
}

.login-btn:hover { filter: brightness(1.07); }
.login-btn:disabled { opacity: .7; cursor: default; }

/* Pulsante logout in topbar */
.logout-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--bs-border-color, #e2e8f0);
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}

.logout-btn:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

/* ---- Sidebar navigation ---- */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px;
}

.sidebar-nav-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff !important;
}

.sidebar-nav-link.sidebar-active {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff !important;
}

.sidebar-nav-icon {
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-nav-link.sidebar-active .sidebar-nav-icon {
    opacity: 1;
}

/* Collassato: solo icone centrate */

.sidebar-nav.sidebar-nav-collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 10px 0;
}

.sidebar-nav.sidebar-nav-collapsed .sidebar-nav-label {
    display: none;
}

/* Layout generale */

.exec-dashboard {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 28px 50px;
  color: #071b3a;
  box-sizing: border-box;
}

/* Filtri */

.filters-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.7fr;
  gap: 18px;
  margin-bottom: 18px;
}

.filters-row-extended {
  grid-template-columns: 1fr 1fr 1fr 1.8fr;
}

.filters-row label,
.vote-filters-row label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #27364f;
  margin-bottom: 6px;
}

.vote-filters-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

/* Card comuni */

.student-card,
.kpi-card,
.panel-card {
  background: #ffffff;
  border: 1px solid #e6edf5;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(20, 31, 51, .08);
  margin-top: 20px;
}

/* Student card */

.student-card {
  display: grid;
  grid-template-columns: 64px 1.7fr 1fr;
  gap: 18px;
  align-items: center;
  padding: 22px 24px;
  margin-bottom: 18px;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2e83dc, #0e5fb5);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
}

.student-info h2 {
  margin: 0;
  font-size: 22px;
}

.student-info p {
  margin: 6px 0 0;
  font-size: 14px;
  color: #29415f;
}

.metric {
  min-height: 58px;
  border-left: 1px solid #edf1f6;
  padding-left: 18px;
}

  .metric span {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #33415c;
    margin-bottom: 8px;
  }

  .metric strong {
    font-size: 23px;
    color: #1266c3;
  }

  .metric small {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    color: #7d8ba1;
  }

.badge-risk {
  display: inline-block;
  background: #fff1c7;
  color: #a15c00;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 999px;
}

/* Colori utility */

.orange {
  color: #f97316 !important;
}

.red {
  color: #ef4444 !important;
}

.purple {
  color: #7c3aed !important;
}

/* KPI */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  min-height: 105px;
  text-align: center;
  padding: 18px 10px;
}

  .kpi-card span {
    font-size: 13px;
    font-weight: 700;
  }

  .kpi-card strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
    color: #1266c3;
  }

  .kpi-card small {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: #667085;
  }

/* Card AI */

.ai-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a, #2563eb);
  color: #ffffff;
}

  .ai-card span,
  .ai-card strong,
  .ai-card small {
    color: #ffffff !important;
  }

.ai-card-icon {
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.ai-open-button {
  margin-top: 12px;
  border: 0;
  background: #ffffff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
}

  .ai-open-button:hover {
    background: #eff6ff;
  }

/* Pannelli */

.panel-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
}

.panel-card {
  min-height: 225px;
  padding: 18px;
  min-width: 0; /* consente alle colonne grid di rispettare il rapporto fr */
}

  .panel-card h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 800;
  }

  .panel-card table {
    width: 100%;
    border-collapse: collapse;
  }

  .panel-card th {
    font-size: 11px;
    color: #667085;
    text-align: left;
    padding: 9px 8px;
    border-bottom: 1px solid #edf1f6;
  }

  .panel-card td {
    font-size: 13px;
    padding: 10px 8px;
    border-bottom: 1px solid #f2f4f7;
  }

.empty-panel {
  color: #667085;
  font-size: 13px;
  padding: 18px 0;
}

/* Grafico andamento */

.chart-subject-title {
  color: #2563eb;
  font-weight: 600;
}

.line-chart {
  width: 100%;
  height: 190px;
  margin-top: 12px;
}

  .line-chart line {
    stroke: #e5e7eb;
    stroke-width: 1;
  }

  .line-chart polyline {
    fill: none;
    stroke: #2563eb;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .line-chart .chart-point {
    fill: #2563eb;
    stroke: #ffffff;
    stroke-width: 2;
  }

  .line-chart .chart-label {
    fill: #374151;
    font-size: 12px;
    font-weight: 600;
  }

.months {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

/* Materie */

.subject-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.subject-badge {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

  .subject-badge:hover {
    background: #f3f4f6;
  }

  .subject-badge.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
  }

.clickable-row {
  cursor: pointer;
}

.selected-row {
  background: #eff6ff;
}

.spark {
  display: block;
  width: 78px;
  height: 14px;
  border-radius: 999px;
}

  .spark.score-red {
    background: #ef4444;
  }

  .spark.score-orange {
    background: #f97316;
  }

  .spark.score-green {
    background: #22c55e;
  }

/* Dettaglio materia */

.subject-detail {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.subject-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

  .subject-detail-header h4 {
    margin: 0;
    font-size: 14px;
  }

  .subject-detail-header small {
    color: #667085;
  }

.clear-subject {
  border: 0;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

  .clear-subject:hover {
    background: #e5e7eb;
  }

.subject-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

  .subject-summary div {
    border-radius: 14px;
    background: #f8fafc;
    padding: 10px 12px;
  }

  .subject-summary span {
    display: block;
    font-size: 11px;
    color: #667085;
  }

  .subject-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
    color: #1266c3;
  }

.formula-text {
  display: block;
  margin-top: 10px;
  color: #667085;
  font-size: 11px;
}

.type-average-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.type-average-badge {
  min-width: 90px;
  border-radius: 14px;
  padding: 10px 14px;
  color: #ffffff !important;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

  .type-average-badge span,
  .type-average-badge strong {
    color: #ffffff !important;
  }

  .type-average-badge span {
    font-size: 11px;
    opacity: .9;
    text-transform: uppercase;
  }

  .type-average-badge strong {
    font-size: 22px;
    line-height: 1;
  }

  .type-average-badge.score-green {
    background: linear-gradient(135deg, #16a34a, #4ade80);
  }

  .type-average-badge.score-orange {
    background: linear-gradient(135deg, #ea580c, #fb923c);
  }

  .type-average-badge.score-red {
    background: linear-gradient(135deg, #dc2626, #f87171);
  }

/* Assenze */

.absence-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.absence-kpi {
  border-radius: 14px;
  padding: 12px;
  color: #ffffff;
}

  .absence-kpi span,
  .absence-kpi strong,
  .absence-kpi small {
    color: #ffffff !important;
  }

  .absence-kpi span {
    display: block;
    font-size: 12px;
    opacity: .9;
  }

  .absence-kpi strong {
    display: block;
    font-size: 26px;
    line-height: 1.1;
    margin: 4px 0;
  }

  .absence-kpi small {
    display: block;
    font-size: 11px;
    opacity: .85;
  }

  .absence-kpi.hourly {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
  }

  .absence-kpi.daily {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
  }

  .absence-kpi.orange {
    background: linear-gradient(135deg, #ea580c, #fb923c);
  }

  .absence-kpi.blue {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
  }

  .absence-kpi.gray {
    background: linear-gradient(135deg, #475569, #94a3b8);
  }

/* Comportamento */

.behavior-kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.behavior-kpi {
  flex: 1;
  border-radius: 14px;
  padding: 12px;
  color: #ffffff !important;
}

  .behavior-kpi span,
  .behavior-kpi strong {
    color: #ffffff !important;
  }

  .behavior-kpi.positive {
    background: linear-gradient(135deg, #16a34a, #4ade80);
  }

  .behavior-kpi.negative {
    background: linear-gradient(135deg, #dc2626, #f87171);
  }

  .behavior-kpi.neutral {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
  }

  .behavior-kpi.gray-kpi {
    background: linear-gradient(135deg, #475569, #94a3b8);
  }

  .behavior-kpi .livello-text {
    font-size: 18px !important;
    line-height: 1.2;
  }

.behavior-level {
  margin-bottom: 14px;
  font-size: 14px;
}

.behavior-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  color: #ffffff !important;
  white-space: nowrap;
}

/* Tabella comportamento: compatta per stare nella colonna stretta */
.behavior-table {
  table-layout: fixed;
}

.behavior-table th,
.behavior-table td {
  padding: 8px 6px !important;
  word-break: break-word;
}

.behavior-table th:nth-child(1),
.behavior-table td:nth-child(1) { width: 13%; }   /* Data */
.behavior-table th:nth-child(2),
.behavior-table td:nth-child(2) { width: 37%; }   /* Tipo */
.behavior-table th:nth-child(3),
.behavior-table td:nth-child(3) { width: 28%; }   /* Docente */
.behavior-table th:nth-child(4),
.behavior-table td:nth-child(4) { width: 22%; }   /* Area */

.behavior-table .behavior-badge {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 10px;
  padding: 3px 8px;
  line-height: 1.2;
}

  .behavior-badge.score-green {
    background: #16a34a;
  }

  .behavior-badge.score-blue {
    background: #2563eb;
  }

  .behavior-badge.score-red {
    background: #dc2626;
  }

  .behavior-badge.score-gray {
    background: #64748b;
  }

.behavior-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.show-more-behavior {
  border: 0;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

  .show-more-behavior:hover {
    background: #e5e7eb;
  }

/* Popup AI / DxAIChat */

.ai-popup-content {
  height: 690px !important;
  max-height: 690px !important;
  overflow: hidden !important;
  padding: 16px !important;
  box-sizing: border-box !important;
}

.student-ai-chat {
  width: 100%;
  height: 700px;
}

.student-chat-ui-description {
  width: 100%;
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #1f2937;
  font-size: 20px;
  font-weight: 700;
}

.student-chat-disclaimer {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.4;
    color: #94a3b8;
    font-weight: lighter;
}

.student-ai-chat-content {
    font-family: "Inter", "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.8;
    font-weight: 400;
    color: #222;
    letter-spacing: -0.01em;
}

  .student-ai-chat-content p:last-child {
    margin-bottom: 0;
  }

  .student-ai-chat-content ul,
  .student-ai-chat-content ol {
    padding-left: 1.25rem;
  }

  .student-ai-chat-content table {
    width: 100%;
    border-collapse: collapse;
  }

  .student-ai-chat-content th,
  .student-ai-chat-content td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
  }

/* Stato vuoto */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #667085;
}

.empty-state-icon {
  font-size: 42px;
  margin-bottom: 14px;
}

.empty-state p {
  font-size: 15px;
  margin: 0;
}

/* Linea soglia 6 nel grafico */

.line-chart .threshold-line {
  stroke: #ef4444;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  opacity: .55;
}

.line-chart .threshold-label {
  fill: #ef4444;
  font-size: 11px;
  font-weight: 700;
  opacity: .7;
}

/* Responsive */

@media (max-width: 900px) {
  .exec-dashboard {
    padding: 16px 16px 40px;
  }

  .student-card {
    grid-template-columns: 64px 1fr;
  }

  .metric {
    border-left: 0;
    border-top: 1px solid #edf1f6;
    padding-left: 0;
    padding-top: 12px;
    grid-column: 1 / -1;
  }

  .filters-row,
  .filters-row-extended {
    grid-template-columns: 1fr 1fr;
  }

  .vote-filters-row {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-row {
    grid-template-columns: 1fr 1fr;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .absence-kpi-row {
    grid-template-columns: 1fr 1fr;
  }

  .subject-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .exec-dashboard {
    padding: 12px 12px 32px;
  }

  .filters-row,
  .filters-row-extended,
  .vote-filters-row,
  .kpi-row,
  .absence-kpi-row,
  .subject-summary {
    grid-template-columns: 1fr;
  }

  .student-card {
    grid-template-columns: 64px 1fr;
  }
}
.student-ai-chat-content img {
    max-width: 100%;
    display: block;
    margin: 12px 0;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}