/* Reset e base ------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f5f7fa;
  color: #1c1e21;
  line-height: 1.5;
}

/* Layout ------------------------------------------------------------- */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar ------------------------------------------------------------ */
.sidebar {
  width: 260px;
  background: #1f2937;
  color: #fff;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.sidebar h2 {
  font-size: 20px;
  padding: 0 20px;
  margin-bottom: 20px;
}

.sidebar a {
  display: block;
  padding: 12px 20px;
  text-decoration: none;
  color: #e5e7eb;
  font-size: 15px;
  transition: 0.15s;
}

.sidebar a:hover {
  background: #374151;
  color: #fff;
}

.sidebar a.active {
  background: #0073e6;
  color: #fff;
}

/* Header ------------------------------------------------------------- */
.header {
  background: #ffffff;
  padding: 15px 25px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 22px;
  font-weight: 600;
}

.header-right {
  font-size: 14px;
  color: #4b5563;
}

/* Contenuto ---------------------------------------------------------- */
.content {
  flex: 1;
  padding: 25px;
}

/* Tabelle ------------------------------------------------------------ */
.table-container {
  background: #fff;
  padding: 25px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

table th {
  text-align: left;
  background: #f3f4f6;
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid #e5e7eb;
}

table td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}

.actions-col {
  padding-left: 4px;
  padding-right: 4px;
  width: 1%;
  white-space: nowrap;
}

table tr:hover td {
  background: #f9fafb;
}

/* Badge stati -------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-error {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e3a8a;
}

/* Pulsanti ----------------------------------------------------------- */
.btn {
  padding: 10px 16px;
  background: #0073e6;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  transition: 0.2s;
}

.btn:hover {
  background: #0055aa;
}

.btn-secondary {
  background: #6b7280;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* Cards -------------------------------------------------------------- */
.card {
  background: #fff;
  padding: 18px 22px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

/* Tabs --------------------------------------------------------------- */
.tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.tab {
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 600;
  color: #6b7280;
}

.tab.active {
  color: #0073e6;
  border-bottom: 3px solid #0073e6;
}

/* Note --------------------------------------------------------------- */
.note {
  background: #f9fafb;
  padding: 15px;
  border-left: 4px solid #0073e6;
  border-radius: 4px;
  margin-bottom: 15px;
}

.note small {
  color: #6b7280;
}

/* Mobile ------------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }

  .header h1 {
    font-size: 18px;
  }

  table td,
  table th {
    font-size: 13px;
  }
}

/* ------------------------------------------------------------------
 * Stile personalizzato SUAP/SUE
 * Ispirato al Design System di Designers Italia + Bootstrap Italia
 * ------------------------------------------------------------------ */

:root {
  --suap-primary: #0073e6;
  --suap-primary-dark: #0055aa;
  --suap-bg: #f5f7fa;
  --suap-border: #dde2e9;
  --suap-text-muted: #6b7280;
}

/* Base -------------------------------------------------------------- */
body.it-body {
  background-color: var(--suap-bg);
  color: #1b1b1b;
}

main.container {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

h3.mb-2,
h3.mb-3 {
  font-weight: 600;
  font-size: 1.4rem;
}

p.text-muted {
  color: var(--suap-text-muted) !important;
}

.card-width {
  width: 100%;
}

.card-flex {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  /* azzero i gutter Bootstrap dentro questa row */
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
}

/* tolgo il padding laterale dalle colonne dentro la griglia */
.card-flex>[class^="col-"],
.card-flex>[class*=" col-"] {
  padding-left: 0;
  padding-right: 0;
}

@media (max-width: 992px) {
  .card-flex {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .card-flex {
    grid-template-columns: 1fr;
  }
}

/* Navbar / header --------------------------------------------------- */
/* .it-header-wrapper .navbar {
  border-bottom: 1px solid var(--suap-border);
} */

.it-header-wrapper .navbar-brand strong {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.it-header-slim-wrapper {
  border-bottom: 1px solid var(--suap-border);
}

/* Sidebar (Bootstrap Italia) ---------------------------------------- */
.it-sidebar-wrapper.sidebar {
  border-right: 1px solid var(--suap-border);
  background: #ffffff;
}

.it-sidebar-wrapper .it-brand-wrapper {
  padding: 1rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--suap-border);
}

.it-sidebar-wrapper .it-brand-text h2 {
  font-size: 1.05rem;
  margin-bottom: 0;
}

.it-sidebar-wrapper .it-brand-text h3 {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--suap-text-muted);
}

.it-main-menu .it-menu__link {
  font-size: 0.95rem;
}

.it-main-menu .it-menu__link .icon {
  margin-right: 0.35rem;
}

/* Barra bianca sotto la voce ATTIVA (identico a Designers Italia, senza hover) */
.it-header-navbar-wrapper .navbar-nav .nav-link {
  position: relative;
  padding-bottom: 12px;
}

/* Non mostra nulla di default */
.it-header-navbar-wrapper .navbar-nav .nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 0;
  background-color: transparent;
}

/* SOLO la voce attiva mostra la barra bianca */
.it-header-navbar-wrapper .navbar-nav .nav-link.active::after {
  width: 100%;
  background-color: #ffffff;
  border-radius: 4px;
}

.navbar .navbar-collapsable .navbar-nav li.nav-item a.nav-link,
.navbar .navbar-collapsable .navbar-nav li.nav-item button.nav-link {
  border-bottom: 0px;
}

/* Cards / metriche dashboard ---------------------------------------- */
.card {
  border-radius: 4px;
  border: 1px solid var(--suap-border);
  background-color: #ffffff;
}

.card.shadow-sm {
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08) !important;
}

.card h6.text-secondary {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--suap-text-muted) !important;
}

.card h2 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-top: 0.25rem;
  color: #1f2933;
}

/* Tabelle ----------------------------------------------------------- */
table.table {
  background-color: #ffffff;
  border-radius: 4px;
  overflow: hidden;
}

table.table thead th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--suap-text-muted);
  background-color: #f3f6fb;
  border-bottom: 2px solid var(--suap-border);
}

table.table tbody td {
  font-size: 0.9rem;
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background-color: #f5f7fb;
}

/* Badge stati ------------------------------------------------------- */
.badge.bg-primary {
  background-color: var(--suap-primary) !important;
}

.badge-success,
.badge-success.bg-success {
  background-color: #2e7d32 !important;
}

.badge-warning,
.badge-warning.bg-warning {
  background-color: #f59e0b !important;
}

.badge-danger,
.badge-danger.bg-danger {
  background-color: #dc2626 !important;
}

/* Pulsanti ---------------------------------------------------------- */
.btn-primary {
  background-color: var(--suap-primary);
  border-color: var(--suap-primary);
  border-radius: 4px;
  font-weight: 600;
  padding-inline: 1.25rem;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--suap-primary-dark);
  border-color: var(--suap-primary-dark);
}

.btn-outline-primary {
  color: var(--suap-primary);
  border-color: var(--suap-primary);
  border-radius: 4px;
  font-weight: 600;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: #ffffff;
  background-color: var(--suap-primary);
  border-color: var(--suap-primary);
}

.btn-danger {
  border-radius: 4px;
  font-weight: 600;
}

/* Form / filtri ----------------------------------------------------- */
.form-select {
  min-height: 2.5rem;
  border-bottom: 1px solid hsl(210, 17%, 44%);
}

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

form .form-control,
form .form-select {
  border-radius: 4px;
  border-color: var(--suap-border);
}

form .form-control:focus,
form .form-select:focus {
  border-color: var(--suap-primary);
  box-shadow: 0 0 0 0.15rem rgba(0, 102, 204, 0.15);
}

/* File input */
input[type="file"] {
  border-radius: 6px;
}

input[type="file"]::file-selector-button {
  background-color: #e5e7eb;
  color: #1b1b1b;
  border: 1px solid #cfd4dc;
  padding: 0.45rem 0.9rem;
  margin-right: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::file-selector-button:focus {
  background-color: #d8dce3;
  border-color: #c5cbd5;
}

/* Pratica inline edit */
.pratica-edit-form .form-control,
.pratica-edit-form .form-select,
.pratica-edit-form textarea {
  border: 0;
  border-bottom: 1px solid #d1d5dc;
  border-radius: 0;
  padding-left: 0;
  padding-right: 0;
  background-color: #f8f9fb;
  overflow: hidden;
}

.pratica-edit-form .form-control:focus,
.pratica-edit-form .form-select:focus,
.pratica-edit-form textarea:focus {
  border-bottom-color: var(--suap-primary);
  box-shadow: none;
  background-color: #ffffff;
}

.pratica-edit-form .form-control.filled,
.pratica-edit-form textarea.filled {
  background-color: #ffffff;
}

/* Accordion titles in pratica forms: keep text dark/neutral */
.pratica-edit-form .accordion .accordion-button,
.pratica-edit-form .accordion .accordion-button:not(.collapsed),
.pratica-edit-form .accordion .accordion-button:focus {
  color: #1c1e21 !important;
  text-decoration: none !important;
  --bs-accordion-btn-color: #1c1e21 !important;
  --bs-accordion-btn-active-color: #1c1e21 !important;
  --bs-accordion-btn-icon-color: #1c1e21 !important;
  --bs-accordion-btn-active-icon-color: #1c1e21 !important;
}

.titolo-pratica-wrap {
  word-break: break-word;
  overflow-wrap: break-word;
}

.status-pill {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  font-weight: 600;
  text-align: center;
  border: 0;
  background: #e5e7eb;
  color: #1b1b1b;
}

.status-in-attesa {
  background: #facc15;
  color: #1b1b1b;
}

.status-in-lavorazione {
  background: #198754;
  /* verde bootstrap-like */
  color: #0f172a;
}

.status-chiusa {
  background: #e5e7eb;
  color: #1b1b1b;
}

.pdf-preview-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

body button.accordion-button.collapsed,
button.accordion-button {
  color: #1b1b1b !important;
}

.preview-hero {
  position: relative;
  max-width: 1180px;
  margin: 0 auto 8px;
  padding: 0 12px;
}

.preview-title-wrap {
  word-break: break-word;
  overflow-wrap: break-word;
  display: inline-block;
  max-width: 100%;
  margin: 0;
  font-size: 1.3rem;
}

.preview-title-container {
  width: 100%;
}

.preview-hero .preview-export {
  align-self: flex-end;
}

.titolo-pratica-wrap {
  word-break: keep-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 340px);
  /* lascia spazio al gruppo pulsanti */
}

.preview-divider {
  max-width: 1180px;
  margin: 0 auto 18px;
  border: 0;
  border-top: 1px solid #dfe3eb;
}

.preview-paperclip {
  font-size: 1.1rem;
  line-height: 1;
  color: #4b5563;
}

.pdf-page {
  width: 100%;
  max-width: 794px;
  /* A4-like width */
  min-height: 1100px;
  background: #fff;
  border: 1px solid #d4d7dd;
  border-radius: 6px;
  padding: 40px 52px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.pdf-section+.pdf-section {
  margin-top: 20px;
}

.pdf-subtitle {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 14px;
}

.pdf-label {
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 4px;
}

.pdf-field {
  background: transparent;
  border-radius: 0;
  padding: 0;
  min-height: 22px;
  color: #111827;
}

.pdf-field-multi {
  min-height: 60px;
}

.pdf-block {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.pdf-block-textarea {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0;
}

.pdf-input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid #dcdfe4;
  border-radius: 0;
  font-size: 0.9rem;
  color: #111827;
  padding: 2px 0;
  resize: none;
}

.flash-highlight {
  animation: flashPulse 0.8s ease-in-out 0s 2;
}

@keyframes flashPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.35);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(0, 102, 204, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 102, 204, 0);
  }
}

.pdf-text {
  font-size: 0.86rem;
  color: #111827;
  line-height: 1.45;
}

.pdf-text-small {
  font-size: 0.8rem;
  color: #111827;
  line-height: 1.3;
}

.pdf-sign-box {
  border: 1px solid #a7adb8;
  padding: 12px;
  border-radius: 2px;
  background: #ffffff;
}

/* Alert stile Designers Italia ------------------------------------- */
.it-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #b9c3cf;
  border-left-width: 8px;
  border-radius: 4px;
  background: #f5f6f8;
  color: #1c2b36;
}

.it-alert .it-alert-content {
  flex: 1;
}

.it-alert .it-alert-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  stroke: currentColor;
}

.it-alert-primary {
  border-left-color: #0066cc;
  color: #1c2b36;
}

.it-alert-info {
  border-left-color: #6b7280;
  color: #1c2b36;
}

.it-alert-success {
  border-left-color: #0f7a3a;
  color: #1c2b36;
}

.it-alert-warning {
  border-left-color: #b35a00;
  color: #1c2b36;
}

.it-alert-danger {
  border-left-color: #c1121f;
  color: #1c2b36;
}

.it-alert-primary .it-alert-icon svg {
  stroke: #0066cc;
}

.it-alert-info .it-alert-icon svg {
  stroke: #6b7280;
}

.it-alert-success .it-alert-icon svg {
  stroke: #0f7a3a;
}

.it-alert-warning .it-alert-icon svg {
  stroke: #b35a00;
}

.it-alert-danger .it-alert-icon svg {
  stroke: #c1121f;
}

/* Login ------------------------------------------------------------- */
body.it-body .login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.it-body .login-page .card {
  max-width: 420px;
  margin-inline: auto;
}

/* Footer ------------------------------------------------------------ */
.it-footer-main {
  border-top: 1px solid var(--suap-border);
}

.it-footer-main .small {
  color: #e5e7eb;
}

/* Utilità responsive ------------------------------------------------ */
@media (max-width: 768px) {
  main.container {
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
  }

  .card h2 {
    font-size: 1.6rem;
  }

  table.table thead {
    font-size: 0.7rem;
  }
}

/* Social header icons ------------------------------------------------ */
.it-header-wrapper .it-socials a {
  color: #ffffff;
}

.it-header-wrapper .it-socials .icon {
  fill: #ffffff;
  color: #ffffff;
}

/* Fix sovrapposizione social + ricerca su mobile */
@media (max-width: 768px) {
  .it-header-wrapper .it-right-zone {
    display: flex;
    align-items: center;
    gap: 14px;
    /* spazio tra social e icona ricerca */
  }

  .it-header-wrapper .it-socials {
    margin-right: 6px;
    /* piccolo margine per sicurezza */
  }

  .it-header-wrapper .it-search-wrapper {
    margin-left: 6px;
  }
}

/* Disattivo lo z-index delle etichette attive */
.form-label.active {
  z-index: auto !important;
}

.card::after {
  content: none !important;
  display: none !important;
}