
/* F.I.G.H. Release 1.3.1 - sistema UI condiviso */
:root {
  --ui-navy: #071b42;
  --ui-blue: #004aad;
  --ui-blue-2: #0b63ce;
  --ui-sky: #eaf3ff;
  --ui-canvas: #f4f7fb;
  --ui-card: #ffffff;
  --ui-line: #dbe4f0;
  --ui-line-strong: #c8d5e6;
  --ui-text: #15233b;
  --ui-muted: #66758b;
  --ui-success: #0b7a49;
  --ui-warning: #b76a00;
  --ui-danger: #b42318;
  --ui-shadow-sm: 0 3px 12px rgba(7,27,66,.06);
  --ui-shadow: 0 10px 28px rgba(7,27,66,.08);
  --ui-radius: 14px;
  --ui-radius-sm: 10px;
}

html { scroll-behavior: smooth; }
body.ui-v131 {
  background: var(--ui-canvas) !important;
  color: var(--ui-text) !important;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif !important;
  font-size: 15px;
  line-height: 1.48;
}
body.ui-v131 * { box-sizing: border-box; }
body.ui-v131 h1, body.ui-v131 h2, body.ui-v131 h3,
body.ui-v131 h4, body.ui-v131 h5, body.ui-v131 h6 {
  color: var(--ui-navy) !important;
  font-weight: 700 !important;
  letter-spacing: -.015em;
}
body.ui-v131 .small-muted,
body.ui-v131 .text-secondary { color: var(--ui-muted) !important; }

/* Testata pagina */
body.ui-v131 .app-container > .d-flex.justify-content-between:first-child,
body.ui-v131 .app-container > .card-soft:first-child {
  position: relative;
}
body.ui-v131 .app-container > .d-flex.justify-content-between:first-child {
  padding: 20px 22px;
  margin-bottom: 22px !important;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow-sm);
}
body.ui-v131 .app-container > .d-flex.justify-content-between:first-child::before,
body.ui-v131 .app-container > .card-soft:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--ui-blue-2), var(--ui-blue));
}
body.ui-v131 .app-container h1.h3,
body.ui-v131 .app-container h1 {
  margin: 0 0 4px !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: clamp(1.55rem, 2vw, 2rem) !important;
}

/* Card e sezioni */
body.ui-v131 .card,
body.ui-v131 .card-soft,
body.ui-v131 .form-section-card {
  background: var(--ui-card) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  box-shadow: var(--ui-shadow-sm) !important;
}
body.ui-v131 .card-soft:hover,
body.ui-v131 .form-section-card:hover { border-color: var(--ui-line-strong) !important; }
body.ui-v131 .form-section-card {
  padding: 22px 24px !important;
  overflow: hidden;
}
body.ui-v131 .form-section-title,
body.ui-v131 .section-title {
  display: flex !important;
  align-items: center;
  min-height: 48px;
  margin: -22px -24px 22px !important;
  padding: 13px 18px !important;
  background: linear-gradient(135deg, #073b82 0%, #0759bb 100%) !important;
  border: 0 !important;
  border-radius: var(--ui-radius) var(--ui-radius) 0 0 !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: .035em !important;
  text-transform: uppercase;
}
body.ui-v131 .form-section-title::before,
body.ui-v131 .section-title::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 9px;
  border-radius: 999px;
  background: #73b7ff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.12);
}

/* KPI / riepiloghi */
body.ui-v131 .row > [class*="col-"] > .card-soft.h-100,
body.ui-v131 .row > [class*="col-"] > .card-soft.p-3 {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
body.ui-v131 .row > [class*="col-"] > .card-soft.h-100:hover,
body.ui-v131 .row > [class*="col-"] > .card-soft.p-3:hover {
  transform: translateY(-2px);
  border-color: #b8cce8 !important;
  box-shadow: var(--ui-shadow) !important;
}
body.ui-v131 .fs-4.fw-semibold,
body.ui-v131 .fs-2.fw-bold { color: var(--ui-navy); }

/* Form */
body.ui-v131 .form-label,
body.ui-v131 .field-label,
body.ui-v131 label:not(.form-check-label) {
  color: #253858 !important;
  font-size: 13px;
  font-weight: 700 !important;
  margin-bottom: 7px;
}
body.ui-v131 .form-control,
body.ui-v131 .form-select,
body.ui-v131 textarea.form-control {
  min-height: 44px;
  border: 1px solid #cdd8e7 !important;
  border-radius: var(--ui-radius-sm) !important;
  background-color: #fff !important;
  color: var(--ui-text) !important;
  box-shadow: 0 1px 2px rgba(7,27,66,.02) !important;
  transition: border-color .16s ease, box-shadow .16s ease;
}
body.ui-v131 textarea.form-control { min-height: 112px; }
body.ui-v131 .form-control:focus,
body.ui-v131 .form-select:focus {
  border-color: #5a96e4 !important;
  box-shadow: 0 0 0 4px rgba(11,99,206,.12) !important;
}
body.ui-v131 .form-control::placeholder { color: #98a5b6; }
body.ui-v131 .form-check-input {
  width: 1.15em;
  height: 1.15em;
  border-color: #9fb0c7;
}
body.ui-v131 .form-check-input:checked {
  background-color: var(--ui-blue);
  border-color: var(--ui-blue);
}
body.ui-v131 .category-chip,
body.ui-v131 .form-check.category-chip {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-sm);
  background: #f8fbff;
  transition: background .15s ease, border-color .15s ease;
}
body.ui-v131 .category-chip:hover { background: #eef6ff; border-color: #aac7ec; }
body.ui-v131 .field-card {
  background: #f8fbff !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius-sm) !important;
}

/* Pulsanti */
body.ui-v131 .btn {
  min-height: 40px;
  padding: 8px 15px;
  border-radius: 9px !important;
  font-weight: 700 !important;
  letter-spacing: -.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
body.ui-v131 .btn:hover { transform: translateY(-1px); }
body.ui-v131 .btn-primary-custom,
body.ui-v131 .btn-primary {
  color: #fff !important;
  background: linear-gradient(135deg, #0759bb, #003f97) !important;
  border-color: #064b9d !important;
  box-shadow: 0 5px 13px rgba(0,74,173,.18) !important;
}
body.ui-v131 .btn-primary-custom:hover,
body.ui-v131 .btn-primary:hover { background: linear-gradient(135deg, #064da4, #00367f) !important; }
body.ui-v131 .btn-light-custom,
body.ui-v131 .btn-light {
  color: #1e3d68 !important;
  background: #fff !important;
  border-color: #cbd7e6 !important;
  box-shadow: 0 2px 7px rgba(7,27,66,.04);
}
body.ui-v131 .btn-success { background: #0b7a49 !important; border-color: #09683e !important; color: #fff !important; }
body.ui-v131 .btn-warning { background: #fff5dc !important; border-color: #e3b451 !important; color: #805000 !important; }
body.ui-v131 .btn-danger,
body.ui-v131 .btn-danger-soft { background: #fff0ef !important; border-color: #e8aaa5 !important; color: var(--ui-danger) !important; }
body.ui-v131 .btn-sm { min-height: 34px; padding: 6px 11px; }

/* Tabelle */
body.ui-v131 .table-responsive { border-radius: var(--ui-radius); }
body.ui-v131 .table { margin-bottom: 0; border-color: var(--ui-line); }
body.ui-v131 .table thead th {
  padding: 13px 14px !important;
  color: #1f4475 !important;
  background: #edf5ff !important;
  border-bottom: 1px solid #c6d9ef !important;
  font-size: 12px;
  font-weight: 700 !important;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}
body.ui-v131 .table tbody td {
  padding: 13px 14px !important;
  vertical-align: middle;
  border-color: #e8eef6 !important;
}
body.ui-v131 .table tbody tr:nth-child(even) { background: #fbfdff; }
body.ui-v131 .table tbody tr:hover { background: #f0f6ff !important; }
body.ui-v131 .card-soft.overflow-hidden { overflow: hidden !important; }

/* Badge e stati */
body.ui-v131 .badge,
body.ui-v131 .badge-soft,
body.ui-v131 [class*="badge-"] {
  border-radius: 999px !important;
  font-weight: 700 !important;
  letter-spacing: .01em;
}
body.ui-v131 .badge-soft {
  padding: 6px 10px;
  background: #e9f6ef !important;
  color: #087247 !important;
  border: 1px solid #bde3cc !important;
}
body.ui-v131 .badge-expired { background: #fff0ef !important; color: #a9271e !important; border: 1px solid #efb8b4 !important; }

/* Alert e stati vuoti */
body.ui-v131 .alert {
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  box-shadow: var(--ui-shadow-sm);
}
body.ui-v131 .alert-success { background: #edf9f2 !important; border-color: #bfe5cd !important; color: #17613f !important; }
body.ui-v131 .alert-danger { background: #fff2f1 !important; border-color: #efc0bc !important; color: #8f241d !important; }
body.ui-v131 .alert-warning { background: #fff8e8 !important; border-color: #efd494 !important; color: #805300 !important; }
body.ui-v131 .card-soft.p-5.text-center { border-style: dashed !important; background: #fafcff !important; }

/* Popup / modal */
body.ui-v131 .modal-backdrop.show { opacity: .52; }
body.ui-v131 .modal-dialog { max-width: 560px; }
body.ui-v131 .modal-content {
  border: 0 !important;
  border-radius: 18px !important;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(3,16,42,.32) !important;
}
body.ui-v131 .modal-header {
  min-height: 68px;
  padding: 18px 24px !important;
  background: linear-gradient(135deg, #073b82, #0759bb) !important;
  color: #fff !important;
  border: 0 !important;
  justify-content: flex-start !important;
}
body.ui-v131 .modal-title { color: #fff !important; font-size: 1.3rem; font-weight: 700 !important; }
body.ui-v131 .modal-header .btn-close {
  filter: invert(1) grayscale(1) brightness(2);
  opacity: .9;
}
body.ui-v131 .modal-body {
  padding: 26px 28px !important;
  color: var(--ui-text);
  text-align: left !important;
}
body.ui-v131 .modal-footer {
  padding: 16px 24px 22px !important;
  border-top: 1px solid var(--ui-line) !important;
  background: #f9fbfe;
  justify-content: flex-end !important;
}

/* Navigazione locale e ancore */
body.ui-v131 a:not(.btn):not(.nav-btn):not(.nav-btn-active):not(.brand-link) { color: #0759bb; }
body.ui-v131 a:not(.btn):hover { color: #003f97; }

/* Visite e documenti */
body.ui-v131 .visit-row,
body.ui-v131 .document-row {
  border-bottom-color: #e5edf7 !important;
}
body.ui-v131 .visit-row:hover,
body.ui-v131 .document-row:hover { background: #f3f8ff; }
body.ui-v131 #privacy-consenso,
body.ui-v131 #documenti-pdf,
body.ui-v131 #anamnesi { scroll-margin-top: 24px; }

/* Responsive */
@media (max-width: 991px) {
  body.ui-v131 .app-container { padding: 20px 16px !important; }
  body.ui-v131 .app-container > .d-flex.justify-content-between:first-child { padding: 17px 18px; }
  body.ui-v131 .form-section-card { padding: 18px !important; }
  body.ui-v131 .form-section-title,
  body.ui-v131 .section-title { margin: -18px -18px 18px !important; }
}
@media (max-width: 575px) {
  body.ui-v131 { font-size: 14px; }
  body.ui-v131 .btn { width: 100%; }
  body.ui-v131 .d-flex.gap-2.flex-wrap > .btn,
  body.ui-v131 .d-flex.gap-2.flex-wrap > a.btn { width: auto; flex: 1 1 140px; }
  body.ui-v131 .table thead { display: none; }
  body.ui-v131 .table tbody tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--ui-line); }
  body.ui-v131 .table tbody td { display: block; border: 0 !important; padding: 5px 13px !important; }
}

/* Variante A: Sidebar istituzionale */
body.ui-sidebar .app-topbar { width: 268px !important; }
body.ui-sidebar .app-container { margin-left: 268px !important; padding: 28px 30px 44px !important; }
body.ui-sidebar .app-footer { margin-left: 268px !important; }
body.ui-sidebar .nav-btn, body.ui-sidebar .nav-btn-active, body.ui-sidebar .logout-btn {
  border-radius: 9px !important;
  margin-bottom: 2px;
}
body.ui-sidebar .nav-btn-active {
  background: linear-gradient(90deg, rgba(11,99,206,.95), rgba(0,63,151,.95)) !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.18) !important;
}
body.ui-sidebar .brand-logo { height: 96px !important; }
@media (max-width: 991px) {
 body.ui-sidebar .app-container, body.ui-sidebar .app-footer { margin-left: 0 !important; }
}
