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

/* ======================================================
   EGOV CANTIERI PRO — Portal Theme
   Professional · Accessible · Enterprise
====================================================== */

/* ============================
   DESIGN TOKENS
============================ */
:root {
  /* Palette */
  --primary-50:  #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;

  --success-50:  #f0fdf4;
  --success-100: #dcfce7;
  --success-600: #16a34a;
  --success-700: #15803d;

  --warning-50:  #fffbeb;
  --warning-100: #fef3c7;
  --warning-600: #d97706;
  --warning-700: #b45309;

  --danger-50:   #fef2f2;
  --danger-100:  #fee2e2;
  --danger-600:  #dc2626;
  --danger-700:  #b91c1c;

  --orange-50:   #fff7ed;
  --orange-100:  #ffedd5;
  --orange-500:  #f97316;
  --orange-700:  #c2410c;

  --info-50:     #eff6ff;
  --info-100:    #dbeafe;
  --info-500:    #3b82f6;

  /* Neutrals */
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-300:  #d1d5db;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-600:  #4b5563;
  --gray-700:  #374151;
  --gray-800:  #1f2937;
  --gray-900:  #111827;

  /* Semantic aliases */
  --bg:             var(--gray-50);
  --card-bg:        #ffffff;
  --border:         var(--gray-200);
  --text:           var(--gray-900);
  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-600);
  --muted:          var(--gray-500);
  --primary:        var(--primary-600);
  --danger:         var(--danger-600);

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.06), 0 4px 6px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.08), 0 8px 10px rgba(0,0,0,.04);

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --transition: all .15s var(--ease);
}

/* ============================
   RESET
============================ */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Smooth page load */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.content { animation: fadeIn .3s var(--ease); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Material Icons utility */
.mi {
  font-family: 'Material Icons Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
  vertical-align: middle;
}
.mi-sm { font-size: 16px; }
.mi-lg { font-size: 24px; }
.mi-xl { font-size: 32px; }

/* ============================
   LAYOUT
============================ */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================
   HEADER
============================ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
  color: #fff;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .mi {
  font-size: 22px;
  opacity: 0.9;
}

.user {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: rgba(255,255,255,.85);
}

/* ============================
   CONTENT AREA
============================ */
.content {
  flex: 1;
  padding: 28px 32px 48px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.content h2 {
  margin: 0 0 4px 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-800);
}

.content > p {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: var(--muted);
}

/* ============================
   GRID (Dashboard cards)
============================ */
.grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ============================
   CARDS
============================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .15s var(--ease),
              box-shadow .15s var(--ease),
              border-color .15s var(--ease);
  outline: none;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-200);
  border-left: 3px solid var(--primary-500);
}

.card .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: var(--primary-50);
}
.card .icon .mi {
  font-size: 24px;
  color: var(--primary-600);
}

.card .title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
  color: var(--gray-800);
}

.card .desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* Detail-grid cards (no pointer) */
.detail-grid .card,
section.card {
  cursor: default;
}

.detail-grid .card:hover,
section.card:hover {
  transform: none;
}

.card.full { grid-column: 1 / -1; }

/* ============================
   BUTTONS
============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: var(--gray-700);
  transition: all .12s var(--ease);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn:active { transform: scale(.97); }

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

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

.btn.primary:hover {
  background: var(--primary-700);
  border-color: var(--primary-700);
}

.btn.red {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn.red:hover {
  background: var(--danger-700);
  border-color: var(--danger-700);
}

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

.btn.success:hover {
  background: var(--success-700);
  border-color: var(--success-700);
}

.btn.warning {
  background: var(--warning-600);
  color: #fff;
  border-color: var(--warning-600);
}

/* [FIX 2026-04-30 PEC-PRO UI] btn.outline ora è context-aware:
   - default (su sfondo chiaro/content): testo scuro su bg bianco con bordo blu primary
   - dentro .header (sfondo scuro/dark bar): testo bianco trasparente come prima
   Senza questo fix il bottone "Apri"/"Reset" e simili erano invisibili
   sulle card bianche perché il testo era bianco su bianco. */
.btn.outline {
  background: #ffffff;
  color: var(--primary-700, #1d4ed8);
  border-color: var(--primary-500, #3b82f6);
}
.btn.outline:hover {
  background: var(--primary-50, #eff6ff);
  border-color: var(--primary-600, #2563eb);
  color: var(--primary-800, #1e40af);
}

/* Mantieni lo stile chiaro/trasparente SOLO dentro l'header */
.header .btn.outline,
.header-left .btn.outline,
.header-center .btn.outline,
.header-right .btn.outline {
  background: transparent;
  color: rgba(255,255,255,.9);
  border-color: rgba(255,255,255,.3);
}
.header .btn.outline:hover,
.header-left .btn.outline:hover,
.header-center .btn.outline:hover,
.header-right .btn.outline:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.5);
  color: #fff;
}

.btn.small {
  padding: 5px 10px;
  font-size: 12px;
}

.btn.icon-btn {
  padding: 6px;
  min-width: 32px;
  min-height: 32px;
}

.btn.full-width { width: 100%; }

/* ============================
   FORM ELEMENTS
============================ */
.input, .select, input[type="text"], input[type="email"],
input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
  outline: none;
}

.input:focus, .select:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px var(--primary-100);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

label input, label select, label textarea {
  margin-top: 4px;
  width: 100%;
  font-weight: 400;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

legend {
  padding: 0 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--gray-700);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.form-card {
  max-width: 820px;
  margin: 0 auto;
}

fieldset label { margin-bottom: 14px; }
fieldset input[type="file"] { margin-top: 6px; }

.hint {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.45;
}

/* ============================
   TOOLBAR
============================ */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ============================
   TABLES
============================ */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.table th,
.table td {
  padding: 11px 14px;
  font-size: 13px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}

.table th {
  background: var(--gray-50);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--gray-500);
  border-bottom: 2px solid var(--border);
}

.table tbody tr {
  transition: background .1s var(--ease);
}

.table tbody tr:hover {
  background: var(--primary-50);
}

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

.actions { white-space: nowrap; }
.actions button { margin-right: 6px; }

/* ============================
   BADGES
============================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  text-transform: uppercase;
  line-height: 1.5;
  white-space: nowrap;
}

/* Badge variants */
.badge.success,
.badge.ACCETTATO,
.badge.SUPERATA,
.badge.IDONEA,
.badge.VERIFICATO {
  background: var(--success-100);
  color: var(--success-700);
}

.badge.warning,
.badge.IN_ATTESA,
.badge.PROPOSTO,
.badge.IN_VERIFICA,
.badge.PRESENTE {
  background: var(--warning-100);
  color: var(--warning-700);
}

.badge.danger,
.badge.RESPINTO,
.badge.RESPINTA,
.badge.NON_SUPERATA,
.badge.NON_IDONEA {
  background: var(--danger-100);
  color: var(--danger-700);
}

.badge.orange,
.badge.ACCETTATO_CON_RISERVA,
.badge.IN_SCADENZA,
.badge.IDONEA_CON_RISERVA {
  background: var(--orange-100);
  color: var(--orange-700);
}

.badge.SCADUTA {
  background: var(--danger-100);
  color: var(--danger-700);
  font-weight: 800;
}

.badge.info,
.badge.ACCETTATO_FIRMATO {
  background: var(--info-100);
  color: var(--primary-700);
}

.badge.secondary {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ============================
   DETAIL GRID
============================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-grid .card {
  padding: 24px;
}

.detail-grid .card h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-100);
}

/* Key-value pairs */
.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}

.kv:last-child { border-bottom: none; }

.kv > span { color: var(--gray-500); font-size: 13px; }
.kv > strong { text-align: right; }

/* ============================
   TIMELINE / AUDIT
============================ */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline li {
  position: relative;
  padding: 12px 0 12px 24px;
  border-left: 2px solid var(--gray-200);
  font-size: 13px;
  line-height: 1.5;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-500);
}

.timeline li strong {
  display: block;
  color: var(--gray-800);
}

/* ============================
   ATTACHMENTS LIST
============================ */
.allegati-lista {
  list-style: none;
  padding: 0;
  margin: 0;
}

.allegati-lista li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background .1s var(--ease);
}

.allegati-lista li:hover {
  background: var(--gray-50);
}

.allegati-lista a {
  color: var(--primary);
  font-weight: 500;
}

.allegati-lista a:hover {
  text-decoration: underline;
}

/* ============================
   STATO ICONA (inline)
============================ */
.stato-icona {
  margin-right: 4px;
  font-size: 14px;
}

/* ============================
   KPI CARDS (Idoneità dashboard)
============================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .12s var(--ease);
}

.kpi-card:hover {
  box-shadow: var(--shadow-sm);
}

.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}

.kpi-card .kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}

.kpi-card.kpi-success .kpi-value { color: var(--success-600); }
.kpi-card.kpi-warning .kpi-value { color: var(--warning-600); }
.kpi-card.kpi-danger  .kpi-value { color: var(--danger-600); }
.kpi-card.kpi-info    .kpi-value { color: var(--primary-600); }
.kpi-card.kpi-orange  .kpi-value { color: var(--orange-500); }

/* Risk gauge */
.risk-gauge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.risk-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s var(--ease);
}

.risk-bar-fill.low    { background: var(--success-600); }
.risk-bar-fill.medium { background: var(--warning-600); }
.risk-bar-fill.high   { background: var(--danger-600); }

/* ============================
   FILTER BAR
============================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
}

.filter-bar select {
  width: auto;
  min-width: 160px;
}

/* ============================
   TABS
============================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .12s var(--ease), border-color .12s var(--ease);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover { color: var(--gray-700); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ============================
   EMPTY STATE
============================ */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

.empty .empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: .5;
}

/* ============================
   LOGIN PAGE
============================ */
.login-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: var(--shadow-md);
}
.login-logo .mi {
  font-size: 32px;
  color: #fff;
}

.login-card h1 {
  margin: 0 0 6px 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-800);
}

.login-subtitle {
  font-size: 14px;
  color: var(--gray-500);
  margin: 0 0 28px 0;
}

.login-card input {
  margin-bottom: 14px;
  padding: 12px 14px;
  font-size: 15px;
}

.login-card .btn.primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
  min-height: 18px;
}

/* Footer */
.portal-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-100);
  margin-top: 40px;
}

/* ============================
   RESPONSIVE
============================ */
@media (max-width: 768px) {
  .header { padding: 0 16px; height: 52px; }
  .brand { font-size: 16px; }
  .content { padding: 20px 16px 40px; }
  .detail-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .table th, .table td { padding: 8px 10px; font-size: 12px; }
  .toolbar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .login-card { padding: 30px 24px; }
}

/* ============================
   PRINT
============================ */
/* ============================
   MODAL OVERLAY
============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 20px;
  z-index: 200;
  overflow-y: auto;
}

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 720px;
  box-shadow: var(--shadow-xl);
  animation: modalIn .2s var(--ease);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

/* ============================
   RUP DASHBOARD
============================ */

.rup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.rup-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.rup-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 0;
}

.rup-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.rup-card-body {
  padding: 12px 20px;
}

.rup-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.rup-stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rup-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.rup-card-footer {
  padding: 10px 20px 16px;
  display: flex;
  justify-content: flex-end;
}

/* Detail grid for RUP cantiere page */
.detail-grid {
  display: grid;
  gap: 20px;
}

.detail-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px;
}

.detail-section h4 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

/* Form grid for SAL insertion */
.form-grid {
  display: grid;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Timeline list */
.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  line-height: 1.5;
}

/* Responsive RUP */
@media (max-width: 768px) {
  .rup-grid {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr !important;
  }
  .form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================
   PRINT
============================ */
@media print {
  .header, .btn, .form-actions { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .rup-card { box-shadow: none; border: 1px solid #ddd; }
  .detail-section { box-shadow: none; border: 1px solid #ddd; }
}

/* [FIX 2026-05-14 TOPBAR-UNIFORM] Barra superiore uniforme su tutto il portal */
.header.egov-topbar-normalized,
.topbar.egov-topbar-normalized,
.admin-header.egov-topbar-normalized,
.dv-topbar.egov-topbar-normalized,
header.egov-topbar-normalized {
  min-height: 56px;
  gap: 16px;
}

.egov-topbar-normalized .brand {
  min-width: 0;
  white-space: nowrap;
}

.egov-topbar-actions,
.egov-topbar-normalized .user,
.egov-topbar-normalized .header-actions,
.egov-topbar-normalized .header-right,
.egov-topbar-normalized .topbar-actions,
.egov-topbar-normalized .dv-topbar-right {
  margin-left: auto;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  min-width: 0;
  flex-wrap: nowrap;
}

.egov-user-chip {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.94);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.egov-home-btn,
.egov-password-btn,
.egov-logout-btn {
  min-height: 30px;
  white-space: nowrap;
  text-decoration: none !important;
}

.egov-topbar-normalized .egov-home-btn,
.egov-topbar-normalized .egov-password-btn {
  background: rgba(255,255,255,.08) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,.34) !important;
  box-shadow: none !important;
}

.egov-topbar-normalized .egov-home-btn:hover,
.egov-topbar-normalized .egov-password-btn:hover {
  background: rgba(255,255,255,.16) !important;
  border-color: rgba(255,255,255,.55) !important;
}

.egov-topbar-normalized .egov-logout-btn {
  background: var(--danger-600, #dc2626) !important;
  color: #fff !important;
  border-color: var(--danger-600, #dc2626) !important;
}

.egov-topbar-normalized .egov-logout-btn:hover {
  background: var(--danger-700, #b91c1c) !important;
  border-color: var(--danger-700, #b91c1c) !important;
}

@media (max-width: 900px) {
  .egov-user-chip { max-width: 170px; }
  .egov-password-btn { max-width: 138px; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 640px) {
  .header.egov-topbar-normalized,
  .topbar.egov-topbar-normalized,
  .admin-header.egov-topbar-normalized,
  .dv-topbar.egov-topbar-normalized,
  header.egov-topbar-normalized {
    padding-left: 14px;
    padding-right: 14px;
  }
  .egov-topbar-actions { gap: 6px !important; }
  .egov-user-chip { display: none; }
  .egov-password-btn { display: none !important; }
}
