/* ── Design tokens, reset e base element styles in shared/styles-base.css ── */

/* ───────────────────────────────────────────────────────────────
   BASE (app-oneri specific)
─────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: #f1f5f9;
  border: 1px solid var(--c-border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--c-text);
}

/* ───────────────────────────────────────────────────────────────
   LAYOUT
─────────────────────────────────────────────────────────────── */
.shell {
  display: flex;
  min-height: 100vh;
}

/* ───────────────────────────────────────────────────────────────
   SIDEBAR
─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-sidebar);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--c-sidebar-border);
}

.sidebar-brand {
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--c-sidebar-border);
}

.sidebar-logo {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 4px;
}

.sidebar-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-sidebar-active);
  line-height: 1.3;
}

.sidebar-subtitle {
  display: block;
  font-size: 12px;
  color: var(--c-sidebar-muted);
  margin-top: 2px;
}

.sidebar-anno {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 10px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #7dd3fc;
}

/* Stepper */
.stepper {
  flex: 1;
  padding: 20px 0 24px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.stepper::before {
  content: '';
  position: absolute;
  left: 39px;
  top: 47px;
  bottom: 51px;
  width: 2px;
  background: var(--c-sidebar-border);
  z-index: 0;
}

.step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 20px 10px 24px;
  cursor: default;
  transition: background .15s;
}

.step--clickable { cursor: pointer; }
.step--clickable:hover { background: rgb(255 255 255 / .04); }
.step--active { background: rgb(249 115 22 / .08); }
.step--active:hover { background: rgb(249 115 22 / .12); }

/* Connector line — single vertical line behind all indicators */

.step-indicator {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
  transition: background .2s, border-color .2s;
  border: 2px solid var(--c-sidebar-muted);
  color: var(--c-sidebar-muted);
  background: var(--c-sidebar);
}

.step--active .step-indicator {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
  box-shadow: 0 0 0 4px rgb(249 115 22 / .22);
}

.step--done .step-indicator {
  background: var(--c-success);
  border-color: var(--c-success);
  color: #fff;
}

.step--partial .step-indicator {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.step--registry .step-indicator {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
}

.step--locked .step-indicator {
  border-color: var(--c-sidebar-border);
  color: var(--c-sidebar-border);
  background: var(--c-sidebar);
}

.step--summary .step-indicator {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.step-info {
  padding-top: 5px;
  min-width: 0;
}

.step-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-sidebar-text);
  transition: color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step--active .step-name    { color: #fed7aa; }
.step--done .step-name      { color: #6ee7b7; }
.step--partial .step-name   { color: #fcd34d; }
.step--registry .step-name  { color: #7dd3fc; }
.step--locked .step-name    { color: var(--c-sidebar-border); }
.step--summary .step-name   { color: #c4b5fd; }

.step--summary.step--active .step-indicator {
  background: #6d28d9;
  border-color: #6d28d9;
  color: #fff;
}
.step--summary.step--active .step-name { color: #ede9fe; }
.step--summary.step--done .step-indicator {
  background: #5b21b6;
  border-color: #5b21b6;
  color: #ddd6fe;
}
.step--summary.step--done .step-name { color: #ddd6fe; }
.step--summary.step--partial .step-indicator {
  background: transparent;
  border-color: #7c3aed;
  color: #c4b5fd;
}
.step--summary.step--partial .step-name { color: #c4b5fd; }

.step-desc {
  display: block;
  font-size: 11px;
  color: #6b82a8;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step--active .step-desc    { color: rgba(255,255,255,0.75); }
.step--done .step-desc      { color: #6b82a8; }
.step--summary .step-desc   { color: #a78bfa; }

.step-lock {
  margin-left: auto;
  font-size: 10px;
  color: var(--c-sidebar-border);
  padding-top: 7px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--c-sidebar-border);
  font-size: 11px;
  color: var(--c-sidebar-muted);
  line-height: 1.6;
}

/* ───────────────────────────────────────────────────────────────
   MAIN CONTENT
─────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  padding: 0 48px 64px;
}

/* ───────────────────────────────────────────────────────────────
   PAGE HEADER — unified sticky bar for all pages
─────────────────────────────────────────────────────────────── */
.page-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -48px;
  padding: 0 48px;
  height: 64px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 1px 4px rgb(0 0 0 / .06);
  flex-shrink: 0;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ph-sep {
  width: 1px;
  height: 20px;
  background: var(--c-border-strong);
  flex-shrink: 0;
}

.page-intro {
  padding-top: 28px;
  margin-bottom: 28px;
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--c-text-muted);
  font-weight: 500;
  letter-spacing: .02em;
  white-space: nowrap;
}

.page-breadcrumb-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 14px;
  color: var(--c-text-muted);
  margin-top: 6px;
  font-weight: 400;
}

/* ───────────────────────────────────────────────────────────────
   CARDS
─────────────────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ───────────────────────────────────────────────────────────────
   UPLOAD CARD (Setup page)
─────────────────────────────────────────────────────────────── */
.upload-card {
  background: var(--c-surface);
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  max-width: 560px;
  transition: border-color .2s;
}

.upload-card:hover { border-color: var(--c-accent); }

.upload-card.has-success  { border-color: var(--c-success); border-style: solid; }
.upload-card.has-error    { border-color: var(--c-error);   border-style: solid; }
.upload-card.has-dragging {
  border-color: var(--c-accent);
  border-style: solid;
  background: var(--c-accent-subtle);
  transform: scale(1.01);
}

.upload-icon {
  width: 64px;
  height: 64px;
  background: var(--c-accent-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 4px;
}

.upload-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-text);
}

.upload-desc {
  font-size: 14px;
  color: var(--c-text-muted);
  max-width: 360px;
  line-height: 1.6;
}

/* Hidden real file input, custom label as button */
.file-input-hidden { display: none; }

.file-label { cursor: pointer; }

/* File status indicators */
.file-status {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  text-align: left;
  line-height: 1.5;
}

.file-status--idle {
  background: var(--c-bg);
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
}

.file-status--success {
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid #a7f3d0;
}

.file-status--error {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border: 1px solid var(--c-error-border);
}

.file-status__icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.file-status__body { min-width: 0; }

.file-status__name { font-weight: 600; display: block; }
.file-status__detail { font-size: 12px; display: block; margin-top: 2px; }

.file-status__error-pre {
  font-family: var(--font);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-size: 12.5px;
}

/* ───────────────────────────────────────────────────────────────
   INFO BOX
─────────────────────────────────────────────────────────────── */
.info-box {
  background: #f8faff;
  border: 1px solid #c7d7f5;
  border-left: 4px solid var(--c-accent);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.info-box h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-accent-dark);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.info-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.info-box li {
  font-size: 13px;
  color: #334b7a;
  padding-left: 14px;
  position: relative;
  line-height: 1.5;
}

.info-box li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--c-accent);
  font-weight: 700;
}

/* ───────────────────────────────────────────────────────────────
   STATS GRID
─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -.02em;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.stat-card--active  .stat-value { color: var(--c-success); }
.stat-card--inactive .stat-value { color: var(--c-text-muted); }
.stat-card--manual   .stat-value { color: var(--c-manual-text); }

/* ───────────────────────────────────────────────────────────────
   CONTROLS BAR
─────────────────────────────────────────────────────────────── */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.input-filter {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 10px center / 16px no-repeat;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.input-filter:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgb(14 165 233 / .15);
}

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

/* ───────────────────────────────────────────────────────────────
   ADD FORM CARD
─────────────────────────────────────────────────────────────── */
.add-form-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-accent);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.add-form-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 120px 1fr;
  gap: 16px;
  align-items: start;
}

.form-field { display: flex; flex-direction: column; gap: 5px; }

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  width: 100%;
}

.input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgb(14 165 233 / .15);
}

.input--error {
  border-color: var(--c-error) !important;
  box-shadow: 0 0 0 3px rgb(239 68 68 / .12);
}

.select {
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

.select:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgb(14 165 233 / .15);
}

.select--error {
  border-color: var(--c-error) !important;
  box-shadow: 0 0 0 3px rgb(239 68 68 / .12);
}

.field-error {
  font-size: 12px;
  color: var(--c-error);
  font-weight: 500;
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--c-border);
}

/* ───────────────────────────────────────────────────────────────
   TABLE
─────────────────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead {
  background: #f8fafc;
  border-bottom: 1px solid var(--c-border);
}

.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--c-text-muted);
  white-space: nowrap;
}

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

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

.table tbody tr {
  transition: background .1s;
}

.table tbody tr:hover { background: #f8fafc; }

/* Row states */
.tr--inactive td { color: var(--c-inactive-text); }
.tr--inactive { background: var(--c-inactive-bg) !important; }

.tr--manual {
  background: var(--c-manual-bg) !important;
}

/* Border on first cell (border-left on tr doesn't work with border-collapse) */
.tr--manual td:first-child {
  border-left: 3px solid var(--c-manual-border);
}

.tr--manual.tr--inactive {
  background: #f0fdf8 !important;
  opacity: .85;
}

.tr--inactive .tr-name { text-decoration: line-through; text-decoration-color: #cbd5e1; }

/* ───────────────────────────────────────────────────────────────
   BADGES
─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .03em;
}

.badge--active {
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid #a7f3d0;
}

.badge--inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.badge--manual {
  background: var(--c-manual-bg);
  color: var(--c-manual-text);
  border: 1px solid var(--c-manual-border);
}

.badge--neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge--contract-modified {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.select--sm {
  height: 30px;
  padding: 0 28px 0 8px;
  font-size: 13px;
  width: auto;
}

/* ───────────────────────────────────────────────────────────────
   BUTTONS
─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  height: 38px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, opacity .15s, transform .1s;
  white-space: nowrap;
  outline: none;
  text-decoration: none;
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary {
  background: var(--c-accent);
  color: #fff;
}
.btn--primary:hover:not(:disabled) { background: var(--c-accent-dark); }
.btn--primary:focus { box-shadow: 0 0 0 3px rgb(14 165 233 / .3); }

.btn--secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
}
.btn--secondary:hover:not(:disabled) { background: var(--c-bg); }

.btn--ghost {
  background: transparent;
  color: var(--c-text-muted);
  border: 1px solid transparent;
}
.btn--ghost:hover:not(:disabled) { background: var(--c-bg); color: var(--c-text); }

.btn--success {
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid #a7f3d0;
}
.btn--success:hover:not(:disabled) { background: #d1fae5; }

.btn--warning {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.btn--warning:hover:not(:disabled) { background: #ffedd5; }

.btn--danger {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border: 1px solid var(--c-error-border);
}
.btn--danger:hover:not(:disabled) { background: #fee2e2; }

.bulk-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.btn--bulk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 20px;
  border: 1.5px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}
.btn--bulk:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.btn--bulk-warn {
  border-color: var(--c-warning);
  color: var(--c-warning-text);
}
.btn--bulk-warn:not(:disabled):hover {
  background: var(--c-warning-bg);
}
.btn--bulk-success {
  border-color: var(--c-success);
  color: var(--c-success-text);
}
.btn--bulk-success:not(:disabled):hover {
  background: var(--c-success-bg);
}

.btn--sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn--lg {
  height: 46px;
  padding: 0 28px;
  font-size: 15px;
}

.btn:disabled, .btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  transition: color .15s;
}
.back-link:hover { color: var(--c-text); }

/* ───────────────────────────────────────────────────────────────
   EMPTY STATE
─────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  gap: 12px;
  text-align: center;
}

.empty-state-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 4px;
  opacity: .5;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text-muted);
}

.empty-state-desc {
  font-size: 13px;
  color: var(--c-text-muted);
  max-width: 320px;
  line-height: 1.6;
}

/* ───────────────────────────────────────────────────────────────
   DIVIDER / SPACER
─────────────────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; }
.stack--gap-4  { gap: 4px; }
.stack--gap-8  { gap: 8px; }
.stack--gap-16 { gap: 16px; }
.stack--gap-24 { gap: 24px; }
.stack--gap-32 { gap: 32px; }

/* ───────────────────────────────────────────────────────────────
   SETUP PAGE
─────────────────────────────────────────────────────────────── */
/* ── Setup: identità utente autenticato ── */
.setup-user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  margin-bottom: 4px;
}

.setup-user-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  flex-shrink: 0;
}

.setup-user-bar__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.setup-user-bar__name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-user-bar__email {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-user-bar__badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: #16a34a;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Setup: azione caricamento esplicito ── */
.setup-load-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px;
  background: var(--c-surface);
  border: 2px dashed var(--c-border);
  border-radius: 12px;
}

.setup-load-hint {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  margin: 0;
}

.btn--xl {
  padding: 12px 24px;
  font-size: 0.95rem;
  gap: 10px;
}

/* ── Setup layout ── */
.setup-layout {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.setup-cta {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ───────────────────────────────────────────────────────────────
   COLLABORATORI PAGE
─────────────────────────────────────────────────────────────── */
.collabs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.collabs-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 28px;
}

/* ───────────────────────────────────────────────────────────────
   RESPONSIVE
─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid  { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .shell { flex-direction: column; }

  .sidebar {
    display: none;
  }

  .page {
    padding: 24px 20px 48px;
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .form-grid  { grid-template-columns: 1fr; }
  .collabs-header { flex-direction: column; align-items: stretch; }
  .collabs-header-actions { padding-top: 0; flex-direction: column; }
  .controls-bar { flex-direction: column; align-items: stretch; }
  .input-filter { max-width: 100%; }

  /* Mobile sidebar strip */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--c-sidebar);
    color: var(--c-sidebar-active);
    font-size: 14px;
    font-weight: 600;
  }
  .mobile-header-badge {
    background: var(--c-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
  }
  .mobile-header-anno {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: #7dd3fc;
    letter-spacing: 0.05em;
    background: rgba(14, 165, 233, 0.10);
    border: 1px solid rgba(14, 165, 233, 0.18);
    border-radius: 999px;
    padding: 2px 8px;
  }
}

@media (min-width: 769px) {
  .mobile-header { display: none; }
}

/* Badge status variants are defined in the Allocazione CdL section below */

/* ───────────────────────────────────────────────────────────────
   SETUP PAGE — two-column upload grid
─────────────────────────────────────────────────────────────── */
.setup-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.setup-upload-grid--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.upload-card--hierarchy {
  border-color: #6366f1;
}
.upload-card--hierarchy:hover { border-color: #4f46e5; }
.upload-card--hierarchy.has-success  { border-color: var(--c-success); border-style: solid; }
.upload-card--hierarchy.has-error    { border-color: var(--c-error);   border-style: solid; }
.upload-card--hierarchy.has-dragging {
  border-color: #4f46e5;
  border-style: solid;
  background: #ede9fe;
  transform: scale(1.01);
}

.upload-card--assignments {
  border-color: #059669;
}
.upload-card--assignments:hover { border-color: #047857; }
.upload-card--assignments.has-success  { border-color: var(--c-success); border-style: solid; }
.upload-card--assignments.has-error    { border-color: var(--c-error);   border-style: solid; }
.upload-card--assignments.has-dragging {
  border-color: #047857;
  border-style: solid;
  background: #d1fae5;
  transform: scale(1.01);
}

.setup-cta {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.setup-cta-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.cta-hint {
  font-size: 12px;
  color: var(--c-text-muted);
}

@media (max-width: 900px) {
  .setup-upload-grid { grid-template-columns: 1fr; }
  .setup-cta { flex-direction: column; }
}

/* ───────────────────────────────────────────────────────────────
   GERARCHIA PAGE — header
─────────────────────────────────────────────────────────────── */
.hier-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.hier-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 30px;
  flex-shrink: 0;
}

/* ───────────────────────────────────────────────────────────────
   CORSO DI LAUREA CARD
─────────────────────────────────────────────────────────────── */
.cdl-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 5px solid var(--c-accent);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.cdl-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.cdl-acronym-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.cdl-name-block {
  min-width: 0;
}

.cdl-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cdl-id {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 2px;
}

.cdl-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  white-space: nowrap;
}

.meta-chip strong {
  color: var(--c-text);
  font-weight: 700;
}

.meta-chip--ects-total {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}

.meta-chip--ects-total strong { color: #1e40af; }

/* ───────────────────────────────────────────────────────────────
   MODULES SECTION
─────────────────────────────────────────────────────────────── */
.modules-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading {
  font-size: 17px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text);
}

.modules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modules-empty-state {
  background: var(--c-surface);
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

/* ───────────────────────────────────────────────────────────────
   MODULE ITEM & ACCORDION
─────────────────────────────────────────────────────────────── */
.module-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}

.module-item:hover {
  border-color: var(--c-border-strong);
}

.module-item--open {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgb(14 165 233 / .08), var(--shadow-sm);
}

.module-item--deleted {
  background: #f8f9fa;
  border-color: #e2e6ea;
  border-left: 3px solid #ced4da;
  box-shadow: none;
  opacity: 0.55;
  pointer-events: none;
}

.module-item--deleted .module-accordion-header {
  cursor: default;
  padding: 10px 18px;
}

.module-item--deleted .btn-ripristina {
  pointer-events: all;
}

.badge--eliminato {
  background: #f1f3f5;
  color: #868e96;
  border: 1px solid #dee2e6;
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
}

.module-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}

.module-accordion-header:hover {
  background: #f8fafc;
}

.module-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.module-chevron {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--c-text-muted);
  transition: transform .2s ease;
}

.module-chevron svg {
  width: 14px;
  height: 14px;
}

.module-chevron--open {
  transform: rotate(90deg);
  color: var(--c-accent);
}

.module-acronym {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-accent-dark);
  background: var(--c-accent-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.module-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.module-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.module-header-right .module-meta-pill--semestre-text {
  min-width: 96px;
  justify-content: center;
}

.module-header-right .module-meta-pill--durata {
  min-width: 88px;
  justify-content: center;
}

.module-header-right .mod-pill {
  min-width: 88px;
  justify-content: center;
}

.module-header-right .mod-pill::before {
  content: none;
}

.module-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--c-text-muted);
  white-space: nowrap;
  border: 1px solid var(--c-border);
}

.module-meta-pill--ects {
  background: var(--c-accent-subtle);
  color: var(--c-accent-dark);
  border-color: #bae6fd;
  font-weight: 700;
}

.module-meta-pill--anno {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.module-meta-pill--durata {
  background: #f5f3ff;
  color: #5b21b6;
  border-color: #ddd6fe;
  font-weight: 600;
  text-transform: capitalize;
}

.module-meta-pill--corsi {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
  font-weight: 600;
}

.module-meta-pill--sem-1 { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.module-meta-pill--sem-2 { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.module-meta-pill--sem-3 { background: #fefce8; color: #854d0e; border-color: #fde68a; }
.module-meta-pill--sem-4 { background: #fdf4ff; color: #6b21a8; border-color: #e9d5ff; }
.module-meta-pill--sem-5 { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.module-meta-pill--sem-6 { background: #f0fdfa; color: #134e4a; border-color: #99f6e4; }
.module-meta-pill--erog-sa   { background: #faf5ff; color: #581c87; border-color: #d8b4fe; }
.module-meta-pill--erog-sp   { background: #fdf2f8; color: #831843; border-color: #f9a8d4; }
.module-meta-pill--erog-sasp { background: #f0f4ff; color: #312e81; border-color: #c7d2fe; }

.module-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Delete disabled hint */
.module-delete-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #92400e;
  padding: 7px 18px;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
}

/* ───────────────────────────────────────────────────────────────
   MODULE BODY (accordion content)
─────────────────────────────────────────────────────────────── */
.module-body {
  border-top: 2px solid var(--c-accent-subtle);
  padding: 16px 18px 20px;
  background: #f8fafc;
}

.module-body-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.courses-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-muted);
}

/* ───────────────────────────────────────────────────────────────
   COURSE ITEMS
─────────────────────────────────────────────────────────────── */
.courses-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.course-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 3px solid #e9d5ff;
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-left-color .15s;
}

.course-item:hover {
  border-left-color: #7c3aed;
}

.course-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
}

.course-row:hover {
  background: #f8fafc;
}

.course-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.course-acronym {
  font-size: 12px;
  font-weight: 700;
  color: #6d28d9;
  background: #f5f3ff;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.course-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-id {
  font-size: 11px;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.course-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.courses-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  color: var(--c-text-muted);
  font-size: 13px;
  background: var(--c-surface);
  border: 1px dashed var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

/* ───────────────────────────────────────────────────────────────
   CRUD FORM PANELS (inline)
─────────────────────────────────────────────────────────────── */
.crud-form-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-accent);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.crud-form-panel--nested {
  border-top-color: #6366f1;
  margin: 10px 0;
}

.crud-form-panel--course {
  border-top-color: #7c3aed;
  margin: 8px 0;
  padding: 14px 18px;
}

.crud-form-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.form-grid-5 {
  display: grid;
  grid-template-columns: 1fr 2fr 80px 1fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE CDL — Page wrapper
─────────────────────────────────────────────────────────────── */
.page--alloc {}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE CDL — Sticky header
─────────────────────────────────────────────────────────────── */
.alloc-sticky-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 2px 8px -2px rgb(0 0 0 / .08);
  padding: 12px 48px 14px;
  margin: 0 -48px 28px; /* bleed to match page horizontal padding */
}

.alloc-sticky-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.alloc-sticky-left .back-link {
  margin-bottom: 0;
  flex-shrink: 0;
}

.alloc-sticky-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.alloc-cdl-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 13px;
  color: var(--c-text);
  font-weight: 500;
}

.alloc-cdl-chip-acronym {
  font-weight: 700;
  color: #059669;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #d1fae5;
  padding: 2px 7px;
  border-radius: 4px;
}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE CDL — Status badge (header)
─────────────────────────────────────────────────────────────── */
.badge--status-complete {
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid #a7f3d0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.badge--status-incomplete {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.badge--status-invalid {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE CDL — Status banner
─────────────────────────────────────────────────────────────── */
.alloc-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 13.5px;
  margin-bottom: 28px;
  line-height: 1.6;
  font-weight: 500;
}

.alloc-banner--complete {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  color: #14532d;
}

.alloc-banner--complete svg {
  color: #16a34a;
  flex-shrink: 0;
  margin-top: 2px;
}

.alloc-banner--warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef9c3 100%);
  border: 1px solid #fbbf24;
  color: #78350f;
}

.alloc-banner--warning svg {
  color: #d97706;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE CDL — Roles grid
─────────────────────────────────────────────────────────────── */
.roles-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.role-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .15s ease;
  position: relative;
  padding-top: 3px; /* space for the colored stripe */
}

/* Colored top stripe — semantically clear status indicator */
.role-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--c-border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1;
}

.role-card--covered::before { background: #10b981; }
.role-card--missing::before { background: #f59e0b; }
.role-card--invalid::before { background: #ef4444; }

/* Subtle tinted header backgrounds per state */
.role-card--covered .role-card-header { background: linear-gradient(to bottom, #f0fdf4, #fff); }
.role-card--missing .role-card-header { background: linear-gradient(to bottom, #fffbeb, #fff); }
.role-card--invalid .role-card-header { background: linear-gradient(to bottom, #fef2f2, #fff); }

.role-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.role-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--c-border);
}

.role-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.25;
  letter-spacing: -.01em;
}

.role-card-meta {
  font-size: 11.5px;
  color: var(--c-text-muted);
  margin-top: 4px;
  line-height: 1.7;
}

.role-card-meta code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  background: #f1f5f9;
  border: 1px solid var(--c-border);
  padding: 1px 5px;
  border-radius: 3px;
  color: #334155;
}

.role-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.role-count-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-muted);
  white-space: nowrap;
  letter-spacing: .02em;
}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE CDL — Assignment list
─────────────────────────────────────────────────────────────── */
.role-assignments {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.role-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 16px;
  font-size: 13px;
  color: var(--c-text-muted);
  text-align: center;
}

.role-empty svg {
  opacity: .35;
  margin-bottom: 2px;
}

.role-empty-text {
  font-weight: 500;
  color: var(--c-text-muted);
}

.role-empty-hint {
  font-size: 12px;
  color: #94a3b8;
}

.role-add-action {
  padding: 10px 16px;
  border-top: 1px solid var(--c-border);
  background: #fafbfc;
}

.assignment-item {
  border-bottom: 1px solid var(--c-border);
  padding: 12px 16px 10px;
  transition: background .12s;
}

.assignment-item:hover {
  background: #f8fafc;
}

.assignment-item--invalid {
  background: #fff8f8;
  border-left: 3px solid #fca5a5;
}

.assignment-item--invalid:hover {
  background: #fff1f1;
}

/* Card "fantasma" per una proposta di Creazione ancora in attesa/rifiutata
   (change assignment-approval-workflow) — non è un'assegnazione reale, resta
   visivamente distinta e non entra nei conteggi di copertura/validazione. */
.assignment-item--ghost {
  background: repeating-linear-gradient(135deg, #fafafa, #fafafa 8px, #f3f4f6 8px, #f3f4f6 16px);
  border-left: 3px dashed var(--c-accent);
  opacity: .85;
}

.assignment-item--ghost:hover {
  opacity: 1;
}

.assignment-item--rivedere {
  background: #fffbeb;
  border-left: 3px solid #fbbf24;
}

.assignment-item--rivedere:hover {
  background: #fef3c7;
}

/* Badge base condiviso tra Da rivedere, Da assegnare e workflow approvativo */
.badge--rivedere,
.badge--da-assegnare,
.approval-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Badge "In approvazione"/"Rifiutata" sulle card di assegnazione esistenti
   (change assignment-approval-workflow) — stessa base di badge--rivedere.
   "In approvazione" usa il blu accent (non l'ambra di badge--rivedere): le
   due card possono comparire fianco a fianco sulla stessa assegnazione, e
   sono semanticamente diverse (un promemoria personale vs. uno stato di
   workflow) — stesso colore le renderebbe indistinguibili a colpo d'occhio. */
.approval-badge--pending {
  background: var(--c-accent-subtle);
  color: var(--c-accent-dark);
  border: 1px solid var(--c-accent);
}

.approval-badge--rejected {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border: 1px solid var(--c-error-border);
}

.badge--rivedere {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge--da-assegnare {
  background: #fef9c3;
  color: #78350f;
  border: 1.5px dashed #f59e0b;
}

/* Toggle pill inline nella card (sostituisce btn--rivedere-toggle) */
.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
  user-select: none;
}

.toggle-pill:hover {
  background: #fffbeb;
  border-color: #d97706;
  color: #92400e;
}

.toggle-pill--on {
  border-color: #d97706;
  background: #fef3c7;
  color: #92400e;
}

.toggle-pill--on:hover {
  background: #fde68a;
}

.toggle-pill__track {
  position: relative;
  display: inline-block;
  width: 26px;
  height: 14px;
  border-radius: 7px;
  background: var(--c-border);
  transition: background .15s;
  flex-shrink: 0;
}

.toggle-pill__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .15s;
}

.toggle-pill--on .toggle-pill__track {
  background: #d97706;
}

.toggle-pill--on .toggle-pill__thumb {
  transform: translateX(12px);
}

.assignment-item--da-assegnare { border-left-color: #f59e0b; background: #fffbeb; }
.badge--da-assegnare-form { flex: 1; justify-content: center; height: 36px; box-sizing: border-box; }
.btn--da-assegnare {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: #fef3c7; color: #92400e; border: 1.5px dashed #f59e0b;
  transition: background 0.15s;
  height: 36px;
  box-sizing: border-box;
}
.btn--da-assegnare:hover { background: #fde68a; }
.btn--da-assegnare-active { background: #fde68a; border-color: #d97706; color: #78350f; }

/* Nota nella card allocazione */
.assignment-note {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--c-text-muted);
  padding: 2px 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.assignment-note__icon {
  flex-shrink: 0;
  opacity: .6;
}

.assignment-note__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-collab-row { display: flex; align-items: flex-end; gap: 8px; }
.form-collab-row .select { flex: 1; }
.form-collab-row .collab-picker { flex: 1; }

.form-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
}

.form-toggle-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  cursor: pointer;
  user-select: none;
}

.form-toggle-checkbox {
  width: 15px;
  height: 15px;
  accent-color: #d97706;
  cursor: pointer;
}

/* Toggle switch per "Da rivedere" nel form */
.form-toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
}

.form-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.form-toggle-switch__track {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--c-border);
  transition: background .15s;
  cursor: pointer;
}

.form-toggle-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
}

.form-toggle-switch input:checked + .form-toggle-switch__track {
  background: #d97706;
}

.form-toggle-switch input:checked + .form-toggle-switch__track::after {
  transform: translateX(14px);
}

.assignment-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.assignment-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.assignment-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assignment-meta {
  font-size: 12px;
  color: var(--c-text-muted);
  letter-spacing: .01em;
}

.assignment-alloc {
  font-size: 12.5px;
  color: #334155;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: 2px 7px;
  display: inline-flex;
  align-self: flex-start;
  margin-top: 3px;
}

.assignment-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.assignment-invalid-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: #dc2626;
  font-weight: 600;
  white-space: nowrap;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 2px 8px;
}

.assignment-actions {
  display: flex;
  gap: 5px;
}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE CDL — Calc accordion
─────────────────────────────────────────────────────────────── */
.calc-accordion {
  margin-top: 8px;
}

.calc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-text-muted);
  padding: 3px 0;
  transition: color .15s;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.calc-toggle:hover { color: var(--c-accent); }

.calc-chevron {
  transition: transform .2s ease;
  flex-shrink: 0;
}

.calc-chevron--open {
  transform: rotate(90deg);
}

.calc-details {
  margin-top: 6px;
  background: #f8fafc;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--c-text-muted);
}

.calc-row:not(:last-child) {
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--c-border);
}

.calc-value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--c-text);
  font-weight: 600;
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 3px;
}

.calc-placeholder {
  font-size: 12px;
  color: var(--c-text-muted);
  font-style: italic;
}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE CDL — Inline form
─────────────────────────────────────────────────────────────── */
.calc-preview-section {
  margin-top: 14px;
}

.cdl-form-panel {
  border-top: 2px solid var(--c-accent);
  background: linear-gradient(to bottom, #f0f9ff, #f8fafc);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cdl-notes-textarea {
  width: 100%;
  resize: vertical;
  min-height: 58px;
  line-height: 1.5;
  font-family: inherit;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.cdl-notes-textarea:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgb(14 165 233 / .15);
}

.notes-counter {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 3px;
  user-select: none;
  transition: color 0.15s ease;
}
.notes-counter--warn {
  color: var(--c-warning);
  font-weight: 500;
}
.notes-counter--error {
  color: var(--c-error);
  font-weight: 600;
}

.cdl-form-fixed-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cdl-fixed-field {
  font-size: 12px;
  color: #334155;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 4px 12px;
  font-weight: 500;
}

/* Badge "Opzionale" inline nel titolo delle role-card */
.role-optional-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  vertical-align: middle;
  margin-left: 7px;
  line-height: 1.6;
}

/* CdL form senza la select tipo allocazione — ridotto a 2 colonne */
.cdl-form-panel .form-grid-3 {
  grid-template-columns: 1fr 1fr;
}

/* ───────────────────────────────────────────────────────────────
   NAVIGATION FORWARD BUTTON (Collaboratori → Gerarchia)
─────────────────────────────────────────────────────────────── */
.page-nav-forward {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ───────────────────────────────────────────────────────────────
   RESPONSIVE — Gerarchia
─────────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  /* Hide the less critical pills at medium-wide screens */
  .module-meta-pill--semestre-text { display: none; }
}

@media (max-width: 1024px) {
  .form-grid-5 { grid-template-columns: 1fr 1fr 80px 1fr; }
  .module-header-right { display: none; }
}

@media (max-width: 768px) {
  .cdl-card { flex-direction: column; align-items: flex-start; }
  .hier-header { flex-direction: column; align-items: stretch; }
  .hier-header-actions { padding-top: 0; }
  .form-grid-2, .form-grid-3, .form-grid-5 { grid-template-columns: 1fr; }
  .module-header-right { display: none; }
  .module-header-actions { flex-wrap: wrap; }
}

/* ───────────────────────────────────────────────────────────────
   RESPONSIVE — Allocazione CdL
─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .setup-upload-grid--3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .page { padding: 0 16px 48px; }
  .page-header { margin: 0 -16px; padding: 0 16px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .page-header-right { flex-wrap: wrap; }
  .ph-sep { display: none; }
  .page-intro { padding-top: 20px; margin-bottom: 20px; }
  .setup-upload-grid--3 { grid-template-columns: 1fr; }
  .alloc-sticky-header { position: static; margin: 0 -20px 20px; padding: 12px 20px 14px; }
  .alloc-sticky-left { flex-direction: column; align-items: flex-start; gap: 8px; }
  .alloc-sticky-right { width: 100%; justify-content: space-between; }
  .assignment-row { flex-direction: column; gap: 8px; }
  .assignment-right { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .role-card-header { flex-direction: column; gap: 8px; }
  .role-card-badges { flex-direction: row; align-items: center; }
  .assignment-alloc { align-self: auto; }
}

/* ───────────────────────────────────────────────────────────────
   ALLOCAZIONE MODULI E CORSI — Layout pagina
─────────────────────────────────────────────────────────────── */
.alloc-mc-page {}

.alloc-mc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.alloc-mc-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 30px;
  flex-shrink: 0;
}

.alloc-mc-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.alloc-mc-progress-label {
  font-size: 12px;
  color: var(--c-text-muted);
  white-space: nowrap;
  font-weight: 600;
}

.alloc-mc-progress-bar-wrap {
  flex: 1;
  max-width: 200px;
  height: 5px;
  background: var(--c-border);
  border-radius: 9999px;
  overflow: hidden;
}

.alloc-mc-progress-bar {
  height: 100%;
  background: var(--c-success);
  border-radius: 9999px;
  transition: width 300ms ease-out;
}

/* Two-column layout */
/* ── Year cards — replaces sidebar ── */
.year-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 36px;
}

.year-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-radius: var(--radius-lg);
  text-decoration: none;
  cursor: pointer;
  transition: filter .15s, transform .12s;
  background: #e2e8f0;
  color: #475569;
  border: none;
}

.year-card:hover {
  filter: brightness(.96);
  transform: translateY(-2px);
}

.year-card--ok      { background: #dcfce7; color: #14532d; }
.year-card--partial { background: #fef3c7; color: #78350f; }
.year-card--empty   { background: #e2e8f0; color: #475569; }

.year-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.year-card-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  opacity: .7;
}

.year-card-pct {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
  align-self: flex-end;
}

.year-card-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.year-card-count {
  font-size: 13px;
  font-weight: 600;
  opacity: .75;
}

.year-card-bar-wrap {
  height: 5px;
  background: rgb(0 0 0 / .12);
  border-radius: 9999px;
  overflow: hidden;
}

.year-card-bar {
  height: 100%;
  background: currentColor;
  opacity: .6;
  border-radius: 9999px;
  transition: width .4s ease;
}

@media (max-width: 700px) {
  .year-cards { grid-template-columns: 1fr; }
  .year-card { flex-direction: row; align-items: center; gap: 16px; padding: 14px 16px; }
  .year-card-top { flex-direction: column; gap: 2px; min-width: 60px; }
  .year-card-bottom { flex: 1; }
}

.alloc-mc-layout {}

.alloc-mc-year-nav {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
  height: fit-content;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--c-border);
}

.alloc-mc-year-nav-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}

.alloc-mc-year-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.alloc-mc-year-nav-link:hover {
  background: var(--c-accent-subtle);
  color: var(--c-accent-dark);
}

.alloc-mc-year-nav-link.is-active {
  background: var(--c-accent-subtle);
  color: var(--c-accent-dark);
  font-weight: 700;
}

.alloc-mc-year-nav-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-muted);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 9999px;
  padding: 1px 7px;
}

.alloc-mc-year-nav-divider {
  height: 1px;
  background: var(--c-border);
  margin: 10px 0;
}

.alloc-mc-global-progress {
  padding: 10px;
  background: var(--c-bg);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
}

.alloc-mc-global-progress-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.alloc-mc-global-progress-numbers {
  font-size: 20px;
  font-weight: 800;
  color: var(--c-text);
  line-height: 1;
  font-family: var(--font-mono);
}

.alloc-mc-global-progress-numbers span {
  font-size: 13px;
  font-weight: 400;
  color: var(--c-text-muted);
}

.alloc-mc-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-bottom: 48px;
}

/* ── Year section ── */
.alloc-year-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alloc-year-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.alloc-year-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alloc-year-progress-bar-wrap {
  width: 120px;
  height: 4px;
  background: var(--c-border);
  border-radius: 9999px;
  overflow: hidden;
}

.alloc-year-progress-bar {
  height: 100%;
  background: var(--c-success);
  border-radius: 9999px;
  transition: width 300ms ease-out;
}

.alloc-year-progress-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  white-space: nowrap;
}

/* ── Module accordion ── */
.module-accordion {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left-width: 4px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}

.module-accordion:hover {
  border-color: var(--c-border-strong);
}

.module-accordion--complete { border-left-color: var(--c-success); }
.module-accordion--incomplete { border-left-color: var(--c-warning); }
.module-accordion--invalid { border-left-color: var(--c-error); }
.module-accordion--trasversale {
  border-left-color: #94a3b8;
  background: #f8fafc;
}
.module-accordion--trasversale .module-accordion-header {
  background: #f1f5f9;
}
.module-accordion--trasversale .module-accordion-header:hover {
  background: #e9eef5;
}
.module-accordion--trasversale .module-acronym {
  background: #e2e8f0;
  color: var(--c-text-muted);
}
.module-accordion--trasversale .module-name {
  color: var(--c-text-muted);
}
.badge--trasversale {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  background: #e2e8f0;
  color: var(--c-text-muted);
  border: 1px solid #cbd5e1;
}

.module-accordion--altro-cdl {
  border-left-color: #d97706;
  background: #fffbeb;
}
.module-accordion--altro-cdl .module-accordion-header {
  background: #fef3c7;
}
.module-accordion--altro-cdl .module-accordion-header:hover {
  background: #fde68a;
}
.module-accordion--altro-cdl .module-acronym {
  background: #fde68a;
  color: #92400e;
}
.module-accordion--altro-cdl .module-name {
  color: #92400e;
}
.badge--altro-cdl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  background: #fde68a;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.alloc-readonly-notice {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #92400e;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  border-bottom: 1px solid #fde68a;
}

.module-accordion.module-accordion--open {
  box-shadow: 0 0 0 3px rgb(14 165 233 / .08), var(--shadow-sm);
}

/* ── Module panel ── */
.module-panel {
  border-top: 2px solid var(--c-accent-subtle);
  background: #f8fafc;
  background: #fdfdfe;
}

.module-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--c-border);
}

.module-section:last-child {
  border-bottom: none;
}

.module-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.module-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-muted);
}

/* ── Status pills ── */
.mod-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mod-pill::before {
  content: '●';
  font-size: 7px;
}

.mod-pill--complete {
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid #a7f3d0;
}

.mod-pill--incomplete {
  background: var(--c-warning-bg);
  color: var(--c-warning-text);
  border: 1px solid #fde68a;
}

.mod-pill--incomplete::before { content: '◐'; }

.mod-pill--invalid {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border: 1px solid var(--c-error-border);
}

.mod-pill--invalid::before { content: '!'; font-size: 9px; font-weight: 900; }

/* ── Empty state ── */
.alloc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 16px;
  text-align: center;
  border: 1.5px dashed var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: var(--c-bg);
}

.alloc-empty-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
}

.alloc-empty-hint {
  font-size: 12px;
  color: #94a3b8;
}

/* ── Course card ── */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.course-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.course-card--complete { border-left-color: var(--c-success); }
.course-card--incomplete { border-left-color: var(--c-warning); }
.course-card--invalid { border-left-color: var(--c-error); }

.course-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background .1s;
}

.course-card-header:hover {
  background: #f8fafc;
}

.course-chevron {
  flex-shrink: 0;
  color: var(--c-text-muted);
  transition: transform .2s ease;
}

.course-chevron--open {
  transform: rotate(90deg);
}

.course-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text);
}

.course-panel {
  padding: 12px 14px;
  border-top: 1px solid var(--c-border);
  background: #fdfdfe;
}

/* ── Module form panel ── */
.module-form-panel {
  margin: 0 18px 14px;
  border: 2px solid var(--c-accent);
  border-radius: var(--radius);
  background: linear-gradient(to bottom, #f0f9ff, #f8fafc);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-form-panel--course {
  margin: 0 0 10px;
  border-color: #7c3aed;
  background: linear-gradient(to bottom, #f5f3ff, #fafaf9);
}

/* ── RESPONSIVE Allocazione Moduli/Corsi ── */
@media (max-width: 1024px) {
  .alloc-mc-year-nav { display: none; }
  .alloc-mc-layout { flex-direction: column; }
}

@media (max-width: 900px) {
  .alloc-mc-header { flex-direction: column; align-items: stretch; }
  .alloc-mc-header-actions { padding-top: 0; }
}

@media (max-width: 640px) {
  .alloc-mc-content { padding: 16px 12px 48px; }
}

/* ══════════════════════════════════════════════════════
   PAGE 6 — RIEPILOGO E DOWNLOAD
══════════════════════════════════════════════════════ */

.riepilogo-body {
  padding: 32px 40px 48px;
  max-width: 1100px;
  margin: 0 auto;
}

.riepilogo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 0;
}

.riepilogo-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s;
}

.riepilogo-card--ok      { border-color: var(--c-success); }
.riepilogo-card--partial { border-color: #f59e0b; }
.riepilogo-card--empty   { border-color: var(--c-border); }

.riepilogo-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.riepilogo-step-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: #0ea5e9;
  color: #fff;
  flex-shrink: 0;
}

.riepilogo-step-badge--alloc { background: #059669; }

.riepilogo-card-titles {
  flex: 1;
  min-width: 0;
}

.riepilogo-card-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
}

.riepilogo-card-sub {
  display: block;
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 1px;
}

.riepilogo-stats {
  display: flex;
  gap: 24px;
}

.riepilogo-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.riepilogo-stat span {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1;
}

.riepilogo-stat small {
  font-size: 11px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.riepilogo-stat--ok span { color: var(--c-success); }

.riepilogo-empty-hint {
  font-size: 13px;
  color: var(--c-text-muted);
  font-style: italic;
}

.riepilogo-card-actions {
  margin-top: auto;
  padding-top: 4px;
}

@media (max-width: 900px) {
  .riepilogo-body { padding: 20px 16px 40px; }
  .riepilogo-grid { grid-template-columns: 1fr; }
}

/* ── Riepilogo redesign ───────────────────────────────────────────── */

.recap-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.recap-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 18px;
}

.recap-card:last-child { margin-bottom: 0; }

.recap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-alt, #f8fafc);
}

.recap-card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.recap-card-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e0f2fe;
  color: #0369a1;
}

.recap-card-body {
  padding: 18px 20px;
}

/* Stats row */
.recap-stats-row {
  display: flex;
  gap: 24px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--c-border);
}

.recap-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recap-stat-num {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-text);
}

.recap-stat-lbl {
  font-size: 11px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Change lists */
.recap-change-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 12px 0 6px;
}

.recap-change-lbl:first-child { margin-top: 0; }

.recap-change-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
}

.recap-change-row:last-child { border-bottom: none; }

.recap-change-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.recap-change-row--added .recap-change-icon {
  background: #dcfce7;
  color: #16a34a;
}

.recap-change-row--removed .recap-change-icon {
  background: #fee2e2;
  color: #dc2626;
}

.recap-change-meta {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-left: auto;
}

.recap-no-changes {
  font-size: 13px;
  color: var(--c-text-muted);
  font-style: italic;
}

/* Gerarchia CdL info */
.recap-cdl-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--c-border);
}

.recap-cdl-badge {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  background: var(--c-accent);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.recap-cdl-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
}

/* Year table inside Gerarchia card */
.recap-year-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.recap-year-table td,
.recap-year-table th {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
}

.recap-year-table tr:last-child td { border-bottom: none; }

.recap-num {
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}

.recap-year-total td {
  font-weight: 700;
  color: var(--c-text);
  border-top: 2px solid var(--c-border-strong);
  border-bottom: none;
}

/* CdL roles */
.recap-roles {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.recap-role-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}

.recap-role-row:last-child { border-bottom: none; }

.recap-role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.recap-role-dot--ok  { background: var(--c-success, #16a34a); }
.recap-role-dot--miss { background: #ef4444; }

.recap-role-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  min-width: 200px;
}

.recap-role-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recap-person-pill {
  font-size: 12px;
  font-weight: 500;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 99px;
}

/* Modules & Courses per anno */
.recap-anno-block {
  margin-bottom: 24px;
}

.recap-anno-block:last-child { margin-bottom: 0; }

.recap-anno-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--c-border-strong);
}

.recap-anno-header span:last-child {
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--c-text-muted);
}

.recap-module-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.recap-module-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  padding: 5px 8px;
  border-bottom: 1px solid var(--c-border);
}

.recap-module-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}

.recap-module-table tr:last-child td { border-bottom: none; }

.recap-module-acronym {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text-muted);
}

.recap-module-fullname {
  font-size: 13px;
  color: var(--c-text);
}

.recap-th-center {
  text-align: center !important;
}

/* Download bar */
.recap-download-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  background: var(--c-surface-alt, #f8fafc);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  margin-top: 4px;
}

.recap-download-bar .btn { flex-shrink: 0; }

@media (max-width: 900px) {
  .recap-cols { grid-template-columns: 1fr; }
  .recap-role-name { min-width: 140px; }
  .recap-download-bar { flex-direction: column; align-items: flex-start; }
}

/* ───────────────────────────────────────────────────────────────
   PAGE 6 — RIEPILOGO ALLOCAZIONE COLLABORATORI
─────────────────────────────────────────────────────────────── */

/* Anomaly counter in header */
.anomaly-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border: 1px solid var(--c-error-border);
}

.no-anomaly-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid #a7f3d0;
}

/* Filter bar */
.alloc-filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.alloc-search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  position: relative;
}

.alloc-search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.alloc-search-wrap::before {
  content: '⌕';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--c-text-muted);
  pointer-events: none;
}

.alloc-search-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgb(14 165 233 / .15);
}

.alloc-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  cursor: pointer;
  user-select: none;
}

.alloc-toggle-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--c-accent);
  cursor: pointer;
}

/* Allocation status badges */
.alloc-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .03em;
  flex-shrink: 0;
}

.alloc-badge--empty {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.alloc-badge--under {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.alloc-badge--ok {
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid #a7f3d0;
}

.alloc-badge--over {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border: 1px solid var(--c-error-border);
}

/* Collaborator list */
.alloc-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

/* Empty state — matches role-empty pattern */
.alloc-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 24px;
  font-size: 13px;
  color: var(--c-text-muted);
  text-align: center;
}

.alloc-empty-state svg {
  opacity: .35;
  margin-bottom: 4px;
}

.alloc-empty-state-text {
  font-weight: 500;
  color: var(--c-text-muted);
}

.alloc-empty-state-hint {
  font-size: 12px;
  color: #94a3b8;
}

/* Collaborator card — matches role-card pattern */
.alloc-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .15s ease;
  position: relative;
  padding-top: 3px;
}

/* Colored top stripe */
.alloc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--c-border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1;
}

.alloc-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.alloc-card--over::before {
  background: #ef4444;
}

.alloc-card--over .alloc-card-header {
  background: linear-gradient(to bottom, #fef2f2, #fff);
}

.alloc-card--over .alloc-card-header:hover {
  background: linear-gradient(to bottom, #fee2e2, #fff);
}

/* Card header (clickable row) */
.alloc-card-header {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}

.alloc-card-header:hover { background: #f8fafc; }

.alloc-collab-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.alloc-name-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alloc-gdo-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-muted);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
}

/* Percentage group */
.alloc-pct-group {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
}

.alloc-pct-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 2px;
}

.alloc-pct-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-muted);
}

.alloc-pct-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
}

.alloc-pct-hours {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  display: flex;
  gap: 4px;
  align-items: center;
}

.alloc-pct-fte {
  color: #94a3b8;
}

.alloc-pct-item--total .alloc-pct-value {
  font-size: 15px;
  color: var(--c-accent-dark);
}

.alloc-card--over .alloc-pct-item--total .alloc-pct-value {
  color: var(--c-error);
}

/* Status area */
.alloc-status-area {
  flex-shrink: 0;
}

/* Progress bar */
.alloc-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 160px;
  max-width: 200px;
  flex-shrink: 0;
}

.alloc-bar-legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.alloc-bar-legend-s,
.alloc-bar-legend-o {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1;
}

.alloc-bar-legend-s {
  color: var(--c-accent-dark);
}

.alloc-bar-legend-s::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 4px;
  border-radius: 2px;
  background: var(--c-accent);
  flex-shrink: 0;
}

.alloc-bar-legend-o {
  color: #059669;
}

.alloc-bar-legend-o::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 4px;
  border-radius: 2px;
  background: var(--c-success);
  flex-shrink: 0;
}

.alloc-bar-track {
  flex: 1;
  height: 8px;
  background: var(--c-border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  position: relative;
}

.alloc-bar-s {
  height: 100%;
  background: var(--c-accent);
  border-radius: 4px 0 0 4px;
  transition: width .3s ease;
  flex-shrink: 0;
}

.alloc-bar-o {
  height: 100%;
  background: var(--c-success);
  transition: width .3s ease;
  flex-shrink: 0;
}

.alloc-bar-excess {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-error-text);
  background: var(--c-error-bg);
  border: 1px solid var(--c-error-border);
  border-radius: 4px;
  padding: 0 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Chevron */
.alloc-chevron {
  display: flex;
  align-items: center;
  color: var(--c-text-muted);
  transition: transform .2s;
  flex-shrink: 0;
}

.alloc-chevron--open { transform: rotate(90deg); }

/* Correction bar — matches role-add-action pattern */
/* Inline edit bar (visible when sopra-gdo) */
.alloc-inline-edit-bar {
  padding: 8px 16px;
  border-top: 1px solid var(--c-border);
  background: #fafbfc;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn--inline-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-accent);
  background: transparent;
  border: 1px solid var(--c-accent);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn--inline-edit:hover {
  background: var(--c-accent);
  color: #fff;
}

/* Inline input in drill-down rows */
.alloc-inline-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.alloc-inline-input {
  width: 64px;
  padding: 2px 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  border: 1px solid var(--c-accent);
  border-radius: 4px;
  color: var(--c-text);
  background: #fff;
  text-align: right;
}

.alloc-inline-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.alloc-inline-suffix {
  font-size: 11px;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
}

.alloc-inline-save-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--c-border);
  background: #f8fafc;
}

/* Drill-down panel */
.alloc-drill-panel {
  border-top: 1px solid var(--c-border);
  background: #fafafa;
  padding: 16px 18px;
}

.alloc-no-assignments {
  color: var(--c-text-muted);
  font-size: 13px;
  font-style: italic;
}

.alloc-group {
  margin-bottom: 14px;
}

.alloc-group:last-child { margin-bottom: 0; }

.alloc-group-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-muted);
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--c-border);
}

/* Structural group header distinct color */
.alloc-group--structural .alloc-group-header {
  color: var(--c-accent-dark);
  border-bottom-color: #bae6fd;
}

.alloc-group--operative .alloc-group-header {
  color: #059669;
  border-bottom-color: #a7f3d0;
}

.alloc-drill-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.alloc-drill-row:nth-child(odd) { background: rgba(0,0,0,.025); }

.alloc-drill-entity {
  font-weight: 600;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alloc-drill-role {
  color: var(--c-text-muted);
  white-space: nowrap;
}

.alloc-drill-task {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-text-muted);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

.alloc-drill-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
}

.alloc-drill-hours {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-text-muted);
  white-space: nowrap;
  font-style: italic;
}

.alloc-drill-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-accent-dark);
  white-space: nowrap;
  min-width: 72px;
  text-align: right;
}

/* Page nav bar (forward navigation) */
.alloc-page-nav {
  display: flex;
  justify-content: flex-end;
  padding-top: 24px;
  border-top: 1px solid var(--c-border);
  margin-top: 8px;
}

@media (max-width: 900px) {
  .alloc-card-header {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
  }
  .alloc-pct-group { display: none; }
  .alloc-bar-wrap { display: none; }
  .alloc-status-area { order: 2; }
  .alloc-chevron { order: 3; }

  .alloc-drill-row {
    grid-template-columns: 1fr auto auto;
    gap: 6px;
  }
  .alloc-drill-role,
  .alloc-drill-task,
  .alloc-drill-hours { display: none; }
}

@media (min-width: 1400px) {
  .alloc-bar-wrap { min-width: 220px; max-width: 280px; }
  .alloc-pct-group { gap: 28px; }
}

/* ───────────────────────────────────────────────────────────────
   RIEPILOGO ALLOCAZIONI GERARCHIA (step 7)
─────────────────────────────────────────────────────────────── */

.gal-body {
  padding-top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── KPI Cards ────────────────────────────────────────────── */

.gal-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.gal-kpi-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color .15s;
}

.gal-kpi-card--complete {
  border-color: #bbf7d0;
  background: linear-gradient(135deg, #f0fdf4 0%, #fff 60%);
}

.gal-kpi-card--issues {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #fff 60%);
}

.gal-kpi-card--empty {
  border-color: var(--c-border);
  background: var(--c-surface);
}

.gal-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--c-text-muted);
}

.gal-kpi-card--complete .gal-kpi-icon { background: #dcfce7; color: var(--c-success); }
.gal-kpi-card--issues .gal-kpi-icon   { background: #fef3c7; color: var(--c-warning); }

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

.gal-kpi-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  margin-bottom: 6px;
}

.gal-kpi-stats {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-bottom: 4px;
}

.gal-kpi-num {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--c-text);
}

.gal-kpi-of {
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-text-muted);
}

.gal-kpi-unit {
  font-size: .78rem;
  color: var(--c-text-muted);
  margin-left: 4px;
}

.gal-kpi-sub {
  font-size: .78rem;
  color: var(--c-text-muted);
}

.gal-kpi-sub--ok {
  color: var(--c-success);
  font-weight: 600;
}

/* ── Layout 2 colonne ────────────────────────────────────── */

.gal-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gal-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Section card ────────────────────────────────────────── */

.gal-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.gal-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}

.gal-section-title {
  font-weight: 600;
  font-size: .9rem;
  color: var(--c-text);
}

.gal-section-body {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Role rows (CdL) ─────────────────────────────────────── */

.gal-role-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}

.gal-role-row:last-child { border-bottom: none; }

.gal-role-name {
  font-size: .88rem;
  font-weight: 500;
  color: var(--c-text);
  min-width: 160px;
}

.gal-role-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.gal-role-empty {
  font-size: .82rem;
  color: var(--c-text-muted);
  font-style: italic;
}

.gal-role-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}

.gal-role-badge--covered  { background: #dcfce7; color: #166534; }
.gal-role-badge--missing  { background: #fef3c7; color: #92400e; }
.gal-role-badge--invalid  { background: #fee2e2; color: #991b1b; }

.gal-person-pill {
  font-size: .78rem;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 500;
}

.gal-nav-link {
  font-size: .75rem;
  color: var(--c-accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-left: auto;
  white-space: nowrap;
}
.gal-nav-link:hover { text-decoration: underline; }

/* ── Entity badges (module / course) ────────────────────── */

.gal-entity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.gal-entity-badge--complete   { background: #dcfce7; color: #166534; }
.gal-entity-badge--incomplete { background: #fef3c7; color: #92400e; }
.gal-entity-badge--invalid    { background: #fee2e2; color: #991b1b; }

/* ── Filter row ──────────────────────────────────────────── */

.gal-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gal-filter-label {
  font-size: .82rem;
  color: var(--c-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.gal-filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 3px;
}

.gal-filter-tab {
  font-size: .78rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}

.gal-filter-tab:hover { background: var(--c-surface); color: var(--c-text); }
.gal-filter-tab--active { background: var(--c-surface); color: var(--c-text); font-weight: 600; box-shadow: var(--shadow-sm); }

.gal-filter-empty {
  padding: 14px 18px;
  font-size: .85rem;
  color: var(--c-text-muted);
  font-style: italic;
  text-align: center;
}

/* ── Year accordion ──────────────────────────────────────── */

.gal-year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 12px;
  transition: background .12s;
}

.gal-year-header:hover { background: var(--c-bg); }

.gal-year-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gal-year-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gal-year-title {
  font-weight: 600;
  font-size: .9rem;
  color: var(--c-text);
}

.gal-year-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gal-year-progress-bar-outer {
  width: 100px;
  height: 6px;
  background: var(--c-border);
  border-radius: 100px;
  overflow: hidden;
}

.gal-year-progress-bar-inner {
  height: 100%;
  border-radius: 100px;
  transition: width .3s ease;
}

.gal-year-bar--complete { background: var(--c-success); }
.gal-year-bar--invalid  { background: var(--c-error); }
.gal-year-bar--partial  { background: var(--c-warning); }

.gal-year-progress-label {
  font-size: .78rem;
  color: var(--c-text-muted);
  white-space: nowrap;
}

.gal-year-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.gal-year-badge--invalid    { background: #fee2e2; color: #991b1b; }
.gal-year-badge--incomplete { background: #fef3c7; color: #92400e; }

/* ── Module rows ─────────────────────────────────────────── */

.gal-module-row {
  border-top: 1px solid var(--c-border);
}

.gal-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 10px 28px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 10px;
  transition: background .12s;
}

.gal-module-header:hover { background: #f8fafc; }

.gal-module-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.gal-module-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.gal-module-acronym {
  font-weight: 700;
  font-size: .85rem;
  color: var(--c-text);
  white-space: nowrap;
}

.gal-module-name {
  font-size: .82rem;
  color: var(--c-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gal-module-meta {
  font-size: .75rem;
  color: var(--c-text-muted);
}

.gal-module-go {
  font-size: .75rem;
  color: var(--c-accent);
  cursor: pointer;
  white-space: nowrap;
}
.gal-module-go:hover { text-decoration: underline; }

.gal-module-detail {
  padding: 10px 18px 14px 46px;
  background: #f8fafc;
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Detail rows ─────────────────────────────────────────── */

.gal-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gal-detail-label {
  font-size: .78rem;
  color: var(--c-text-muted);
  font-weight: 500;
  min-width: 90px;
}

/* ── Course rows ─────────────────────────────────────────── */

.gal-courses-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gal-course-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gal-course-acronym {
  font-size: .78rem;
  font-weight: 600;
  color: var(--c-text);
}

.gal-course-name {
  font-size: .78rem;
  color: var(--c-text-muted);
  flex: 1;
}

.gal-course-people {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── Issues panel ────────────────────────────────────────── */

.gal-issues-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 8px;
}

.gal-issues-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}

.gal-issues-title {
  font-weight: 600;
  font-size: .88rem;
  color: var(--c-text);
}

.gal-issues-count {
  background: var(--c-error);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.gal-no-issues {
  padding: 24px 16px;
  text-align: center;
  color: var(--c-success);
  font-size: .85rem;
  font-weight: 500;
}

.gal-no-issues-sub {
  color: var(--c-text-muted);
  font-size: .78rem;
  font-weight: 400;
  margin-top: 2px;
}

.gal-issue-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.gal-issue-item:last-child { border-bottom: none; }

.gal-issue-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gal-issue-badge {
  font-size: .67rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}

.gal-issue-badge--invalid    { background: #fee2e2; color: #991b1b; }
.gal-issue-badge--missing    { background: #fef3c7; color: #92400e; }
.gal-issue-badge--incomplete { background: #fef3c7; color: #92400e; }

.gal-issue-level {
  font-size: .75rem;
  color: var(--c-text-muted);
  font-weight: 500;
}

.gal-issue-entity {
  font-size: .82rem;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
}

.gal-issue-detail {
  font-size: .75rem;
  color: var(--c-text-muted);
}

.gal-issue-nav {
  font-size: .75rem;
  color: var(--c-accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  margin-top: 2px;
}
.gal-issue-nav:hover { text-decoration: underline; }

/* ── Footer nav ──────────────────────────────────────────── */

.page-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--c-border);
  margin-top: 8px;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 720px) {
  .gal-kpi-row {
    grid-template-columns: 1fr;
  }
  .gal-year-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .gal-year-header-right {
    flex-wrap: wrap;
  }
  .gal-module-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .gal-role-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .gal-nav-link { margin-left: 0; }
}

@media (min-width: 1400px) {
  .gal-layout { grid-template-columns: 1fr 340px; }
  .gal-kpi-row { gap: 20px; }
}

/* ───────────────────────────────────────────────────────────────
   FILTER BAR (gerarchia + allocazione moduli/corsi)
─────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 11px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* Vertical divider between filter groups */
.filter-group + .filter-group {
  padding-left: 20px;
  border-left: 1px solid var(--c-border);
}

.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  min-width: 56px;
}

.filter-input {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--c-border);
  border-radius: 5px;
  font-size: 12px;
  color: var(--c-text);
  background: var(--c-bg);
  outline: none;
  min-width: 110px;
  transition: border-color .12s;
}

.filter-input:focus {
  border-color: var(--c-accent);
}

.filter-input::placeholder {
  color: var(--c-text-muted);
  opacity: .7;
}

.sort-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
  letter-spacing: .03em;
}

.sort-toggle-btn:hover {
  background: var(--c-surface);
  color: var(--c-text);
}

.sort-toggle-btn--active {
  background: var(--c-accent-subtle);
  border-color: var(--c-accent);
  color: var(--c-accent-dark);
}

/* Info badge nei dettagli modulo (spostati dalla riga) */
.module-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 0 4px;
}

.module-detail-meta .module-meta-pill {
  font-size: 10px;
}

/* Segment control — anno */
.segment-control {
  display: flex;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-bg);
}

.segment-btn {
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  background: transparent;
  color: var(--c-text-muted);
  border: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  white-space: nowrap;
}
.segment-btn:not(:first-child) {
  border-left: 1px solid var(--c-border);
}
.segment-btn:hover:not(.segment-btn--active) {
  background: var(--c-surface);
  color: var(--c-text);
}
.segment-btn--active {
  background: var(--c-accent);
  color: #fff;
  font-weight: 600;
  /* absorb the divider on the left of the active button */
  margin-left: -1px;
  padding-left: 14px;
  position: relative;
  z-index: 1;
  box-shadow: 1px 0 0 var(--c-accent), -1px 0 0 var(--c-accent);
}

/* Chip group — semestre */
.chip-group {
  display: flex;
  gap: 5px;
}

.chip {
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  background: transparent;
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.chip:hover:not(.chip--active) {
  background: var(--c-bg);
  color: var(--c-text);
  border-color: var(--c-border-strong);
}
.chip--active {
  background: var(--c-accent-subtle);
  color: var(--c-accent-dark);
  border-color: #7dd3fc;
  font-weight: 600;
}
.chip--rivedere-active {
  background: #fef3c7;
  color: #92400e;
  border-color: #fbbf24;
  font-weight: 600;
}
.chip--da-assegnare-active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  font-weight: 600;
}

/* ── Gerarchia year sections ── */
.gerarchia-year-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}

.gerarchia-year-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 4px;
}

.gerarchia-year-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-accent-dark);
  background: var(--c-accent-subtle);
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 2px 9px;
}

/* Filter empty state */
.filter-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 32px;
  min-height: 160px;
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}

.filter-empty-state-text {
  font-size: 13.5px;
  color: var(--c-text-muted);
  line-height: 1.5;
}

/* Semestre alloc empty state (inside year sections after filter) */
.alloc-year-filter-empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--c-text-muted);
  background: var(--c-bg);
  border: 1px dashed var(--c-border);
  border-radius: var(--radius);
}

/* ───────────────────────────────────────────────────────────────
   BADGE NUOVO / MODIFICATO (change tracking gerarchia)
─────────────────────────────────────────────────────────────── */
.badge-nuovo,
.badge-modificato {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-nuovo {
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid var(--c-success);
}

.badge-modificato {
  background: var(--c-warning-bg);
  color: var(--c-warning-text);
  border: 1px solid var(--c-warning);
}

/* Corso generato automaticamente dall'adapter Moduli-senza-Corsi (change
   adapter-moduli-senza-corsi): stesso ritmo visivo di badge-nuovo/modificato
   ma bordo tratteggiato e colori neutri — non è un cambiamento fatto
   dall'utente né un avviso, solo un segnaposto in attesa di un corso vero. */
.badge-synthetic {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--c-bg);
  color: var(--c-text-muted);
  border: 1px dashed var(--c-border);
}

/* Legenda badge change tracking — annotazione discreta */
.change-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 5px 10px;
  background: transparent;
  font-size: 11.5px;
  color: var(--c-text-muted);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 4px;
}

.change-legend::before {
  content: '✦';
  font-size: 9px;
  opacity: .5;
}

.change-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ───────────────────────────────────────────────────────────────
   STATI GDO — riepilogo collaboratori
─────────────────────────────────────────────────────────────── */
.status-gdo-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-nessuna-allocazione { background: #f1f5f9;             color: var(--c-text-muted);   border: 1px solid var(--c-border-strong); }
.status-sotto-gdo           { background: var(--c-warning-bg); color: var(--c-warning-text); border: 1px solid var(--c-warning); }
.status-alla-gdo            { background: var(--c-success-bg); color: var(--c-success-text); border: 1px solid var(--c-success); }
.status-sopra-gdo           { background: var(--c-error-bg);   color: var(--c-error-text);   border: 1px solid var(--c-error); }

/* empty state dentro drill-down group */
.alloc-drill-group-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--c-text-muted);
  font-style: italic;
}



/* ═══════════════════════════════════════════════════════════════
   PAGINA STATISTICHE ALLOCAZIONI
═══════════════════════════════════════════════════════════════ */

/* ── Stepper: separatore e link statistiche ─────────────────── */
.stepper-separator {
  height: 1px;
  background: var(--c-sidebar-border);
  margin: 8px 16px;
  opacity: .5;
}

.step--stats { opacity: .7; }
.step--stats:hover { opacity: 1; background: rgba(255,255,255,.04) !important; }
.step--stats-active { opacity: 1; background: rgb(14 165 233 / .1) !important; }
.step--stats-active .step-name { color: #7dd3fc !important; }

.step-indicator--stats {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--c-sidebar-border);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-sidebar-text);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.step--stats-active .step-indicator--stats {
  background: var(--c-accent);
  color: #fff;
}

.sidebar-footer--stats {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-accent);
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .8;
}

/* ── KPI grid ───────────────────────────────────────────────── */
.stat-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card--kpi {
  border-top: 3px solid var(--c-border-strong);
}
.stat-card--hours { border-top-color: var(--c-accent); }
.stat-card--hours .stat-value { color: var(--c-accent-dark); }
.stat-card--ra    { border-top-color: #6366f1; }
.stat-card--ra    .stat-value { color: #4f46e5; }
.stat-card--fte   { border-top-color: var(--c-success); }
.stat-card--fte   .stat-value { color: #059669; }

/* ── Empty state ────────────────────────────────────────────── */
.stats-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  gap: 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
.stats-empty-icon { color: var(--c-text-muted); opacity: .3; }
.stats-empty-title { font-size: 15px; font-weight: 600; color: var(--c-text); }
.stats-empty-desc { font-size: 13px; color: var(--c-text-muted); max-width: 380px; line-height: 1.6; }

/* ── Statistiche per livello ────────────────────────────────── */
.stats-by-level {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.stats-level-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stats-level-section--aggregated {
  background: #f0f9ff;
  border-color: #bae6fd;
  grid-column: 1 / -1;
}

.stats-level-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.stats-level-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-level-total {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-accent);
}

.stats-level-tasks { display: flex; flex-direction: column; gap: 5px; }

.stats-level-task-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--c-text-muted);
}

.stats-level-task-hours { font-weight: 500; color: var(--c-text); }

.stats-level-empty {
  font-size: 12px;
  color: var(--c-text-muted);
  font-style: italic;
  margin: 0;
}

.stats-level-note {
  font-size: 11px;
  color: var(--c-text-muted);
  margin: 8px 0 0;
  font-style: italic;
}

/* ── Footer nav ─────────────────────────────────────────────── */
.stats-footer-nav {
  display: flex;
  justify-content: flex-start;
  padding-top: 4px;
  margin-bottom: 16px;
}

/* ── Breadcrumb stats variant ───────────────────────────────── */
.page-breadcrumb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--c-accent-subtle);
  color: var(--c-accent-dark);
  flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stat-kpi-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .filter-group + .filter-group {
    padding-left: 0;
    border-left: none;
    padding-top: 10px;
    border-top: 1px solid var(--c-border);
    width: 100%;
  }
}

/* ── Collab Picker ────────────────────────────────────────────── */

.collab-picker {
  position: relative;
  width: 100%;
}

.collab-picker__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  cursor: pointer;
  text-align: left;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.collab-picker__trigger:hover {
  border-color: var(--c-border-strong);
}
.collab-picker__trigger:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgb(14 165 233 / .15);
}
.collab-picker__trigger--error {
  border-color: var(--c-error) !important;
  box-shadow: 0 0 0 3px rgb(239 68 68 / .12);
}

.collab-picker__trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}
.collab-picker__trigger-text--placeholder {
  color: var(--c-text-muted);
}

.collab-picker__chevron {
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform .2s ease;
}
.collab-picker__chevron--open {
  transform: rotate(180deg);
}

.collab-picker__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ── Picker filters bar ─────────────────────────────────────── */

.picker-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}

.picker-search {
  height: 34px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--c-text);
  background: var(--c-surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E")
    10px center / 14px no-repeat;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.picker-search:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgb(14 165 233 / .15);
}
.picker-search::placeholder { color: var(--c-text-muted); }

.picker-filter-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.picker-filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 2px;
}
.picker-pill {
  padding: 3px 10px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--c-text-muted);
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
  line-height: 1.5;
}
.picker-pill:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
  background: var(--c-accent-subtle);
}
.picker-pill--active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}
.picker-pill--active:hover {
  background: var(--c-accent-dark);
  border-color: var(--c-accent-dark);
  color: #fff;
}

.picker-gdo-range {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.picker-gdo-input {
  height: 30px;
  width: 70px;
  padding: 0 8px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  transition: border-color .15s;
  min-width: 0;
}
.picker-gdo-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 2px rgb(14 165 233 / .15);
}
.picker-gdo-input::placeholder { color: var(--c-text-muted); }
.picker-gdo-sep {
  font-size: 12px;
  color: var(--c-text-muted);
}

/* ── Picker list ────────────────────────────────────────────── */

.picker-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
  overscroll-behavior: contain;
}
.picker-list::-webkit-scrollbar { width: 5px; }
.picker-list::-webkit-scrollbar-track { background: transparent; }
.picker-list::-webkit-scrollbar-thumb { background: var(--c-border-strong); border-radius: 999px; }

.picker-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 12px 7px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--c-border);
  transition: background .1s;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover {
  background: var(--c-accent-subtle);
  border-left-color: var(--c-accent);
}
.picker-item--selected {
  background: var(--c-accent-subtle);
  border-left-color: var(--c-accent);
}

.picker-item__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
}
.picker-item--selected .picker-item__name {
  color: var(--c-accent-dark);
}

.picker-item__meta {
  font-size: 11.5px;
  color: var(--c-text-muted);
  line-height: 1.3;
}

.picker-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--c-text-muted);
}

/* ───────────────────────────────────────────────────────────────
   LOGIN SCREEN
─────────────────────────────────────────────────────────────── */

.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--c-bg);
  background-image:
    radial-gradient(ellipse at 65% 15%, rgba(14,165,233,.07) 0%, transparent 55%),
    radial-gradient(ellipse at 15% 85%, rgba(14,165,233,.04) 0%, transparent 45%);
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-accent);
  border-radius: var(--radius-xl);
  padding: 44px 40px 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: login-appear .25s ease both;
}

@keyframes login-appear {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-brand {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 20px;
}

/* ───────────────────────────────────────────────────────────────
   NO ACCESS SCREEN — stessa geometria di .login-screen/.login-card
   (stesso "genere" di schermata bloccante: prima che l'app sia
   utilizzabile), ma classi indipendenti — così le due schermate
   possono evolvere separatamente, stesso principio già applicato
   per .access-denied-screen/.access-denied-card in app-riconciliazione.
   Tono "warning", non "error": non è un accesso negato per violazione
   di sicurezza, ma una configurazione ancora da completare (l'utente
   non è stato ancora associato a un Corso di Laurea).
─────────────────────────────────────────────────────────────── */
.no-access-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--c-bg);
}

.no-access-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-warning);
  border-radius: var(--radius-xl);
  padding: 44px 40px 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.no-access-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--c-warning-bg);
  color: var(--c-warning);
  margin-bottom: 16px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--c-text-muted);
  line-height: 1.55;
  margin-bottom: 28px;
}

.login-error {
  width: 100%;
  font-size: 12px;
  color: var(--c-error-text);
  background: var(--c-error-bg);
  border: 1px solid var(--c-error-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-mono);
  text-align: left;
  word-break: break-word;
  margin-bottom: 16px;
}

.btn--login-ms {
  width: 100%;
  justify-content: center;
  height: 44px;
  font-size: 14px;
  font-weight: 600;
  gap: 10px;
  border-radius: var(--radius);
  letter-spacing: 0.01em;
}

/* ───────────────────────────────────────────────────────────────
   APP CONTENT WRAPPER
─────────────────────────────────────────────────────────────── */

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

/* ───────────────────────────────────────────────────────────────
   CLOUD SYNC — overlay, stati, dirty badge
─────────────────────────────────────────────────────────────── */

.cloud-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.cloud-overlay__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.cloud-overlay__brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-bottom: 4px;
}

.cloud-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: cloud-spin 0.7s linear infinite;
}

.cloud-spinner--sm {
  width: 13px;
  height: 13px;
  border-width: 2px;
  border-color: rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: cloud-spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.cloud-overlay__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cloud-overlay__icon--error { background: var(--c-error-bg);   color: var(--c-error);   }
.cloud-overlay__icon--auth  { background: var(--c-warning-bg); color: var(--c-warning); }

.cloud-overlay__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: -0.01em;
}

.cloud-overlay__subtitle {
  font-size: 13px;
  color: var(--c-text-muted);
  line-height: 1.5;
}

.cloud-overlay__error-detail {
  font-size: 12px;
  color: var(--c-text-secondary);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 9px 13px;
  font-family: 'DM Mono', monospace;
  text-align: left;
  width: 100%;
  word-break: break-word;
}

/* Dirty badge — sidebar */
.dirty-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px 3px 7px;
  border-radius: 20px;
  background: var(--c-warning-bg);
  color: var(--c-warning-text);
  letter-spacing: 0.01em;
  margin-top: 6px;
  align-self: flex-start;
}

.dirty-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-warning);
  flex-shrink: 0;
}

/* Connection status cards (setup page) */
.connection-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-width: 560px;
}

.connection-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s;
}

.connection-card.has-success { border-color: #86efac; }
.connection-card.has-error   { border-color: var(--c-error-border); }

.connection-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.connection-card__body {
  flex: 1;
  min-width: 0;
}

.connection-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 1px;
}

.connection-card__detail {
  font-size: 12px;
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-card__detail--error { color: var(--c-error); }

/* Avviso non bloccante — dati letti da Dataverse che violano una regola di
   validazione applicativa (vedi change dataverse-read-nonblocking-validation).
   Non un errore: i dati sono comunque caricati, questo è solo visibile. */
.connection-card__warning {
  margin-top: 4px;
  font-size: 11px;
  color: #92400e;
  white-space: normal;
}
.connection-card__warning summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.connection-card__warning summary::-webkit-details-marker { display: none; }
.connection-card__warning summary::before { content: "⚠ "; }
.connection-card__warning ul {
  margin: 4px 0 0;
  padding-left: 16px;
  max-height: 140px;
  overflow-y: auto;
}
.connection-card__warning li { margin-bottom: 2px; }

.connection-card__status { flex-shrink: 0; }

.badge--status-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.save-error-text {
  font-size: 11px;
  color: var(--c-error);
  max-width: 160px;
  text-align: right;
  line-height: 1.35;
}

/* ── Bottone salvataggio globale ─────────────────────────────────── */

.save-all-wrap {
  margin-top: 14px;
}

.btn-save-all {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--c-sidebar-border);
  border-radius: 9px;
  background: transparent;
  color: var(--c-sidebar-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: not-allowed;
  opacity: 0.4;
  transition: background 180ms ease, color 180ms ease,
              border-color 180ms ease, opacity 180ms ease,
              box-shadow 180ms ease;
}

.btn-save-all--active {
  background: #f59e0b;
  border-color: #d97706;
  color: #451a03;
  cursor: pointer;
  opacity: 1;
  box-shadow:
    0 0 0 1px rgba(217, 119, 6, 0.5),
    0 4px 16px rgba(245, 158, 11, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-save-all--active:hover {
  background: #d97706;
  border-color: #b45309;
  box-shadow:
    0 0 0 1px rgba(180, 83, 9, 0.6),
    0 6px 20px rgba(245, 158, 11, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn-save-all--loading {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-save-all--success {
  background: #16a34a;
  border-color: #15803d;
  color: #f0fdf4;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(21, 128, 61, 0.5), 0 4px 14px rgba(22, 163, 74, 0.35);
}

.btn-save-all--error {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fef2f2;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.5), 0 4px 14px rgba(220, 38, 38, 0.35);
}

.btn-save-all__icon,
.btn-save-all__spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-save-all__spinner {
  animation: spin 800ms linear infinite;
}

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

.btn-save-all__label {
  flex: 1;
  text-align: left;
  font-size: 12px;
}

.btn-save-all__badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #451a03;
  color: #fef3c7;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  animation: badge-pop 120ms ease-out;
}

@keyframes badge-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ── Banner promemoria salvataggio ───────────────────────────────── */

.save-reminder-banner {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: min(460px, calc(100vw - 48px));
  background: #f59e0b;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-radius: 12px;
  border: none;
  box-shadow:
    0 0 0 1px rgba(180, 83, 9, 0.4),
    0 8px 32px rgba(217, 119, 6, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.18);
  padding: 20px 22px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.save-reminder-banner__body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.save-reminder-banner__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #451a03;
  margin-top: 1px;
  opacity: 0.85;
}

.save-reminder-banner__text {
  font-size: 14px;
  color: #451a03;
  line-height: 1.5;
  margin: 0;
  font-weight: 600;
}

.save-reminder-banner__text strong {
  color: #1c0a00;
  font-weight: 800;
  font-size: 15px;
}

.save-reminder-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.save-reminder-banner__btn-primary {
  padding: 8px 18px;
  background: #451a03;
  color: #fef3c7;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 120ms ease, transform 80ms ease;
}

.save-reminder-banner__btn-primary:hover {
  background: #1c0a00;
  transform: translateY(-1px);
}

.save-reminder-banner__btn-ghost {
  padding: 8px 12px;
  background: rgba(69, 26, 3, 0.12);
  color: #451a03;
  border: 1px solid rgba(69, 26, 3, 0.2);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}

.save-reminder-banner__btn-ghost:hover {
  background: rgba(69, 26, 3, 0.22);
}

/* Transizioni Alpine per il banner */
.save-reminder-enter        { transition: opacity 220ms ease-out, transform 220ms ease-out; }
.save-reminder-enter-from   { opacity: 0; transform: translateY(12px); }
.save-reminder-enter-to     { opacity: 1; transform: translateY(0); }
.save-reminder-leave        { transition: opacity 180ms ease-in, transform 180ms ease-in; }
.save-reminder-leave-from   { opacity: 1; transform: translateY(0); }
.save-reminder-leave-to     { opacity: 0; transform: translateY(8px); }

@media (max-width: 480px) {
  .save-reminder-banner {
    bottom: 0;
    right: 0;
    left: 0;
    width: auto;
    border-radius: 12px 12px 0 0;
    padding: 18px 16px;
  }
}

/* ── Modale tipo contratto Da assegnare ─────────────────────── */

.modal-tipo-contratto-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-tipo-contratto-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(2px);
}

.modal-tipo-contratto-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.14), 0 4px 16px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
  overflow: hidden;
}

.modal-tipo-contratto-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 16px;
}

.modal-tipo-contratto-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d97706;
}

.modal-tipo-contratto-icon svg {
  width: 18px;
  height: 18px;
}

.modal-tipo-contratto-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 2px;
  line-height: 1.3;
}

.modal-tipo-contratto-subtitle {
  font-size: 11.5px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

.modal-tipo-contratto-options {
  padding: 0 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-tipo-contratto-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease;
  width: 100%;
}

.modal-tipo-contratto-option:hover {
  background: #f8fafc;
}

.modal-tipo-contratto-option--contratto:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.modal-tipo-contratto-option--mandato:hover {
  border-color: #fb923c;
  background: #fff7ed;
}

.modal-tipo-contratto-option-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: background 140ms ease, color 140ms ease;
}

.modal-tipo-contratto-option--contratto:hover .modal-tipo-contratto-option-icon {
  background: #dbeafe;
  color: #2563eb;
}

.modal-tipo-contratto-option--mandato:hover .modal-tipo-contratto-option-icon {
  background: #fed7aa;
  color: #ea580c;
}

.modal-tipo-contratto-option-icon svg {
  width: 15px;
  height: 15px;
}

.modal-tipo-contratto-option-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.modal-tipo-contratto-option-label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  transition: color 140ms ease;
}

.modal-tipo-contratto-option--contratto:hover .modal-tipo-contratto-option-label { color: #1d4ed8; }
.modal-tipo-contratto-option--mandato:hover .modal-tipo-contratto-option-label { color: #c2410c; }

.modal-tipo-contratto-option-desc {
  font-size: 11px;
  color: #94a3b8;
  transition: color 140ms ease;
}

.modal-tipo-contratto-option--contratto:hover .modal-tipo-contratto-option-desc { color: #60a5fa; }
.modal-tipo-contratto-option--mandato:hover .modal-tipo-contratto-option-desc { color: #fb923c; }

.modal-tipo-contratto-chevron {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: #cbd5e1;
  transition: color 140ms ease;
}

.modal-tipo-contratto-option--contratto:hover .modal-tipo-contratto-chevron { color: #93c5fd; }
.modal-tipo-contratto-option--mandato:hover .modal-tipo-contratto-chevron { color: #fdba74; }

.modal-tipo-contratto-footer {
  padding: 12px 20px 16px;
  display: flex;
  justify-content: center;
}

.modal-tipo-contratto-cancel {
  font-size: 12px;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 140ms ease;
}

.modal-tipo-contratto-cancel:hover { color: #475569; }

/* ── Segmented control tipo contratto nel form ──────────────── */

.da-assegnare-contract-type-control {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid #fcd34d;
}

.da-assegnare-contract-type-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 6px;
}

.da-assegnare-segmented {
  display: inline-flex;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 2px;
  gap: 2px;
}

.da-assegnare-seg-btn {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.da-assegnare-seg-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.da-assegnare-seg-btn--active-contratto {
  background: #2563eb !important;
  color: #fff !important;
}

.da-assegnare-seg-btn--active-mandato {
  background: #ea580c !important;
  color: #fff !important;
}

/* ── Badge tipo contratto nelle liste ───────────────────────── */

.da-assegnare-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.badge--da-assegnare-contratto {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  letter-spacing: 0.01em;
}

.badge--da-assegnare-mandato {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  background: #fed7aa;
  color: #c2410c;
  border: 1px solid #fdba74;
  letter-spacing: 0.01em;
}

.badge--da-assegnare-tipo-ignoto {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 500;
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  letter-spacing: 0.01em;
}

/* ── Non necessario — badge, chip, bottone ──────────────────── */

.badge--non-necessario {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #cbd5e1;
  letter-spacing: 0.01em;
}

.badge--non-necessario-form {
  font-size: 12px;
  padding: 3px 10px;
}

.btn--non-necessario {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px dashed #94a3b8;
  background: #f8fafc;
  color: #64748b;
  height: 36px;
  box-sizing: border-box;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}

.btn--non-necessario:hover {
  background: #f1f5f9;
  border-color: #64748b;
  color: #334155;
}

.btn--non-necessario-active {
  background: #e2e8f0;
  border-color: #94a3b8;
  border-style: solid;
  color: #475569;
}

.btn--non-necessario-active:hover {
  background: #cbd5e1;
  color: #334155;
}

.mod-pill--non-necessario {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* ── Statistiche box per livello ─────────────────────────── */

.stat-level-section-wrap { margin-bottom: 28px; }

.stat-level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas:
    "totale totale totale"
    "cdl    cdl    cdl"
    "anno1  anno2  anno3";
  gap: 12px;
  align-items: start;
}
.stat-level-box--totale { grid-area: totale; }
.stat-level-box--cdl    { grid-area: cdl; }
.stat-level-box--anno1  { grid-area: anno1; }
.stat-level-box--anno2  { grid-area: anno2; }
.stat-level-box--anno3  { grid-area: anno3; }

@media (max-width: 860px) {
  .stat-level-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "totale"
      "cdl"
      "anno1"
      "anno2"
      "anno3";
  }
}

.stat-level-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  font-size: 12px;
}

.stat-level-box__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid #e5e7eb;
}
.stat-level-box__header--clickable { cursor: pointer; user-select: none; }
.stat-level-box__header--clickable:hover { filter: brightness(0.97); }
.stat-level-box__header--clickable:hover .stat-level-box__expand-btn { filter: brightness(0.88); }

.stat-level-box__title { font-size: 13px; font-weight: 700; color: #1e293b; }

.stat-level-box__expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  pointer-events: none;
  transition: filter 120ms ease;
  color: #fff;
}
.stat-level-box--anno1 .stat-level-box__expand-btn { background: #2563eb; }
.stat-level-box--anno2 .stat-level-box__expand-btn { background: #16a34a; }
.stat-level-box--anno3 .stat-level-box__expand-btn { background: #9333ea; }
.stat-level-box__expand-btn--open { opacity: 0.82; }

.stat-level-box--cdl   .stat-level-box__header { background: #f1f5f9; }
.stat-level-box--anno1 .stat-level-box__header { background: #eff6ff; }
.stat-level-box--anno2 .stat-level-box__header { background: #f0fdf4; }
.stat-level-box--anno3 .stat-level-box__header { background: #fdf4ff; }
.stat-level-box--totale .stat-level-box__header { background: #1e293b; }
.stat-level-box--totale .stat-level-box__title { color: #f8fafc; }
.stat-level-box__totale-hint { font-size: 10px; font-weight: 500; color: #94a3b8; }

/* Toggle spostato in fondo al box — fascia piena */
.stat-level-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  padding: 7px 12px;
  border-top: 1px solid #f1f5f9;
  background: #fff;
  border-bottom-left-radius: 11px;
  border-bottom-right-radius: 11px;
  transition: background 120ms ease, color 120ms ease;
}
.stat-level-toggle:hover { background: #f8fafc; color: #334155; }
.stat-level-toggle input[type="checkbox"] { accent-color: #3b82f6; width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.stat-level-toggle__label { font-size: 10.5px; font-weight: 600; color: inherit; }

/* KPI grandi — valori principali più leggibili */
.stat-level-box__totals { display: flex; border-bottom: 2px solid #f1f5f9; }
.stat-level-box__total-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 14px 10px; gap: 4px; }
.stat-level-box__total-item + .stat-level-box__total-item { border-left: 1px solid #e5e7eb; }
.stat-level-box__total-value { font-size: 22px; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1; }
.stat-level-box__total-value--ra { font-size: 22px; font-weight: 700; color: #2563eb; letter-spacing: -0.02em; }
.stat-level-box__total-value--gdo { font-size: 22px; font-weight: 700; color: #7c3aed; letter-spacing: -0.02em; }
.stat-level-box__total-label { font-size: 10px; font-weight: 500; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* Sezioni breakdown — sfondo tenue, subordinato ai KPI */
/* Box larghi (Totale, CdL): le due section affiancate invece che impilate,
   altrimenti la tabella si stira su tutta la larghezza e perde leggibilità. */
.stat-level-box__sections { display: flex; gap: 16px; }
.stat-level-box__sections .stat-level-box__section { flex: 1 1 0; min-width: 0; }
@media (max-width: 860px) {
  .stat-level-box__sections { flex-direction: column; gap: 0; }
}

.stat-level-box__section { padding: 7px 12px; background: #fafafa; border-top: 1px solid #f1f5f9; border-bottom: none; }
.stat-level-box__section:last-of-type { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.stat-level-box__section-title { font-size: 9px; font-weight: 700; color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }

.stat-level-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 11px; }
.stat-level-table th { text-align: right; font-weight: 600; color: #cbd5e1; font-size: 9px; padding: 0 4px 2px; }
.stat-level-table th:first-child { text-align: left; }
.stat-level-table td { padding: 1.5px 4px; text-align: right; color: #475569; font-variant-numeric: tabular-nums; }
.stat-level-table td:first-child { text-align: left; color: #64748b; }

.stat-level-chevron { transition: transform 150ms ease; color: currentColor; }
.stat-level-chevron--open { transform: rotate(90deg); }

/* ── Accordion dettaglio moduli ──────────────────────────── */

.stat-module-accordion {
  margin-top: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}
.stat-module-accordion__header { padding: 10px 16px; background: #f8fafc; border-bottom: 1px solid #e5e7eb; }
.stat-module-accordion__title { font-size: 12px; font-weight: 600; color: #475569; }

.stat-module-list { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.stat-module-list th { padding: 7px 12px; text-align: right; font-size: 10px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #f1f5f9; background: #fafafa; }
.stat-module-list th:first-child { text-align: left; }
.stat-module-row td { padding: 7px 12px; border-bottom: 1px solid #f8fafc; vertical-align: middle; color: #334155; text-align: right; font-variant-numeric: tabular-nums; }
.stat-module-row td:first-child { text-align: left; }
.stat-module-row:last-child td { border-bottom: none; }
.stat-module-col--acronimo { width: 36%; }
.stat-module-col--num { width: 16%; }
.stat-module-col--pct { width: 16%; }
.stat-module-acronimo { display: block; font-weight: 600; font-size: 12px; color: #1e293b; }
.stat-module-nome { display: block; font-size: 10.5px; color: #94a3b8; }
.stat-module-pct { font-weight: 600; color: #2563eb; }
.stat-module-row--empty td { text-align: center; color: #94a3b8; font-style: italic; padding: 16px; }

.non-necessario-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 4px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.non-necessario-info-icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: #94a3b8;
}

.assignment-item--non-necessario {
  border-left: 3px solid #cbd5e1;
  background: #fafafa;
}

/* ── Bottone Crea trasversale ────────────────────────────── */

.btn--trasversale {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}

.btn--trasversale:hover:not(:disabled) {
  background: #d1fae5;
  border-color: #34d399;
  color: #064e3b;
}

.btn--trasversale-done,
.btn--trasversale:disabled {
  color: #6ee7b7;
  background: #f0fdf4;
  border-color: #bbf7d0;
  cursor: default;
  opacity: 0.7;
}

/* ── Flash card modulo appena creato ─────────────────────── */

@keyframes module-flash-new {
  0%   { box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.55), 0 0 16px rgba(52, 211, 153, 0.25); background-color: #f0fdf4; }
  60%  { box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.15); }
  100% { box-shadow: none; background-color: transparent; }
}

.module-card--new-trasversale {
  animation: module-flash-new 1.5s ease-out forwards;
}

/* ── Supervisore selector (step Connessione) ─────────────── */

.supervisore-selector {
  margin: 0 0 20px;
  padding: 16px 20px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
}

.supervisore-selector__header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #92400e;
  margin-bottom: 12px;
}

.supervisore-selector__loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #78716c;
  padding: 4px 0;
}

.supervisore-selector__error {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #b91c1c;
  padding: 4px 0;
  flex-wrap: wrap;
}

.supervisore-selector__empty {
  font-size: 13px;
  color: #78716c;
  padding: 4px 0;
  font-style: italic;
}

.supervisore-selector__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.supervisore-selector__label {
  font-size: 12.5px;
  font-weight: 600;
  color: #44403c;
}

.supervisore-selector__select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1.5px solid #fcd34d;
  background: #fff;
  font-size: 13px;
  color: #1c1917;
  cursor: pointer;
  outline: none;
  transition: border-color 130ms ease;
}

.supervisore-selector__select:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245,158,11,.15);
}

.supervisore-selector__cta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Banner amber post-caricamento */
.supervisore-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  font-size: 13px;
  color: #78350f;
  line-height: 1.45;
}

.supervisore-banner strong {
  font-weight: 700;
  color: #451a03;
}

/* Toggle readonly nella sezione supervisore */
.supervisore-readonly-toggle {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #fde68a;
}

/* Pannello amministrazione dati (Home) — allineamento ruoli da System of
   Record, visibile solo agli amministratori (myAccess.isAdmin). Trattamento
   neutro come le connection-card sotto (non ambra, riservata al contesto
   supervisore; non accent pieno, riservato alle azioni primarie della
   pagina) — è un'utility amministrativa occasionale, non un'azione
   principale né uno stato speciale della sessione. */
.admin-sync-panel {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
}

.admin-sync-panel__header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  margin-bottom: 10px;
}

/* Griglia fluida: 1 colonna su mobile, più colonne quando lo spazio lo
   consente, invece di continuare ad accodare azioni in verticale con
   divisori — cresce con il numero di azioni senza allungare il pannello. */
.admin-sync-panel__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.admin-sync-panel__action {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
}

.admin-sync-panel__body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-sync-panel__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-sync-panel__title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text);
}

.admin-sync-panel__hint {
  font-size: 12px;
  color: var(--c-text-muted);
}

.admin-sync-panel__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-sync-panel__result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.admin-sync-panel__result--success {
  background: var(--c-success-bg);
  color: var(--c-success-text);
}

.admin-sync-panel__result--error {
  background: var(--c-error-bg);
  color: var(--c-error-text);
}

/* Banner sola lettura globale */
.readonly-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fef3c7;
  border-top: 1px solid #fcd34d;
  color: #92400e;
  font-size: 13px;
  font-weight: 500;
}

/* Chip supervisore nello stepper */
.supervisore-chip {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  font-size: 10px;
  font-weight: 600;
  color: #92400e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Modale modifica tipo contratto collaboratore ──────────── */
.modal-modifica-contratto-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-modifica-contratto-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(2px);
}

.modal-modifica-contratto-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.14), 0 4px 16px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
  overflow: hidden;
}

.modal-modifica-contratto-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.modal-modifica-contratto-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
}

.modal-modifica-contratto-icon svg {
  width: 18px;
  height: 18px;
}

.modal-modifica-contratto-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 2px;
  line-height: 1.3;
}

.modal-modifica-contratto-subtitle {
  font-size: 11.5px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

.modal-modifica-contratto-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-modifica-contratto-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.modal-modifica-contratto-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid #f1f5f9;
}

/* ── Pagina Amministrazione ruoli ─────────────────────────── */

.role-admin-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 32px 16px;
  color: var(--c-text-muted);
  font-size: 13px;
}

.role-admin-table {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--c-border);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.role-admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) 2fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--c-surface);
}

.role-admin-upn {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  word-break: break-word;
}

.role-admin-role-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}

/* I due ruoli globali riusano il linguaggio amber già stabilito per la
   modalità supervisore — stesso significato: accesso a tutti i CdL. */
.role-admin-role-badge--global {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* I due ruoli CdL-specifici usano l'accento blu primario dell'app — lo
   stesso già usato per il lavoro ordinario sul CdL, non un accesso esteso. */
.role-admin-role-badge--cdl {
  background: var(--c-accent-subtle);
  color: var(--c-accent-dark);
  border: 1px solid #7dd3fc;
}

.role-admin-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.role-admin-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.role-admin-remove:hover {
  background: #fef2f2;
  color: var(--c-error);
  border-color: #fecaca;
}

.chip-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-surface);
}

.chip-input input {
  flex: 1 1 140px;
  min-width: 140px;
  border: none;
  outline: none;
  font-size: 13px;
  padding: 4px 2px;
  background: transparent;
}

.chip--removable {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: default;
  background: var(--c-accent-subtle);
  color: var(--c-accent-dark);
  border-color: #7dd3fc;
}

.chip--removable button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  opacity: .7;
}

.chip--removable button:hover { opacity: 1; }

.role-admin-save-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.role-admin-dirty-hint {
  font-size: 12px;
  color: var(--c-text-muted);
  font-style: italic;
}

@media (max-width: 640px) {
  .role-admin-row { grid-template-columns: 1fr; gap: 8px; }
  .role-admin-remove { justify-self: end; }
}

/* ── Pagina Amministrazione — Tab Sincronizzazioni (change pannello-admin-ruoli-sync) ── */

.sync-status-table {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--c-border);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.sync-status-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.3fr) minmax(100px, auto) minmax(160px, 1fr) minmax(150px, auto);
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--c-surface);
}

.sync-status-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
}

.sync-status-counters {
  font-size: 12.5px;
  color: var(--c-text-muted);
}

.sync-status-date {
  font-size: 12.5px;
  color: var(--c-text-muted);
  text-align: right;
}

@media (max-width: 640px) {
  .sync-status-row { grid-template-columns: 1fr; gap: 6px; }
  .sync-status-date { text-align: left; }
}

/* ── Workflow approvativo assegnazioni (change assignment-approval-workflow) ── */

.approval-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--c-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
}

.approval-queue-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.approval-queue-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.approval-queue-card--rejected {
  border-left-color: var(--c-error);
  opacity: .85;
}

.approval-queue-card--approved {
  border-left-color: var(--c-success);
  opacity: .85;
}

.approval-queue-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
}

.approval-queue-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.approval-queue-badge--create { background: var(--c-success-bg); color: var(--c-success-text); }
.approval-queue-badge--update { background: var(--c-warning-bg); color: var(--c-warning-text); }
.approval-queue-badge--delete { background: var(--c-error-bg);   color: var(--c-error-text); }
.approval-queue-badge--rejected { background: var(--c-error-bg); color: var(--c-error-text); }
.approval-queue-badge--approved { background: var(--c-success-bg); color: var(--c-success-text); }
.approval-queue-badge--pending-state { background: var(--c-accent-subtle); color: var(--c-accent-dark); }

.approval-queue-cdl {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
}

.approval-queue-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.approval-queue-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 13px;
}

.approval-queue-label {
  min-width: 90px;
  color: var(--c-text-muted);
}

.approval-queue-value {
  color: var(--c-text);
  font-weight: 500;
}

.approval-queue-value--before {
  color: var(--c-text-muted);
  font-weight: 400;
  text-decoration: line-through;
  text-decoration-color: var(--c-border);
}

.approval-queue-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--c-text-muted);
}

.approval-queue-meta--rejected {
  color: var(--c-error-text);
}

.approval-queue-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.approval-reject-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--c-border);
}
