﻿:root {
  /* ============================================================
       BRAND - IMPERIUM
       ============================================================ */

  --app-primary: #A126A3;
  --app-primary-dark: #7C1D82;
  --app-primary-darker: #5F1665;
  --app-primary-light: #E9D5EA;
  --app-primary-soft: #F7EFF8;
  --app-secondary: #FF6B22;
  --app-secondary-dark: #E95512;
  --app-secondary-light: #FFE1D1;
  --app-accent: #F34E5D;
  --app-accent-light: #FDE0E3;
  --app-honor-sigeg: #5D7B9D;
  --app-honor-sigeg-dark: #46627F;
  --app-honor-sigeg-darker: #344A61;
  --app-honor-sigeg-light: #B8C7D6;
  --app-honor-sigeg-soft: #DDE6EE;
  /*  --app-honor-sigeg: #5D7B9D;
  --app-honor-sigeg-dark: #46627F;
  --app-honor-sigeg-darker: #344A61;
  --app-honor-sigeg-light: #D6DEE7;
  --app-honor-sigeg-soft: #F1F4F7;*/
  /* ============================================================
       SUPERFICI
       ============================================================ */

  --app-bg: #F8F9FB;
  --app-surface: #FFFFFF;
  --app-surface-alt: #F3F4F6;
  --app-border: #E5E7EB;
  --app-border-strong: #D1D5DB;
  --bs-btn-font-size: .9rem;
  /* ============================================================
       TESTO
       ============================================================ */

  --app-text: #25232A;
  --app-font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  --app-font-size: .95rem;
  --app-font-size-grid: .9rem;
  --app-form-font-size: .9rem;
  --app-line-height: 1.5;
  --app-text-muted: #6B7280;
  --app-text-light: #9CA3AF;
  --app-primary-text: var(--app-primary-dark);
  --app-secondary-text: #A63C0B;
  --app-secondary-soft: #FFF4EE;
  --app-success-text: #0F5132;
  --app-warning-text: #7A4D00;
  --app-danger-text: #842029;
  --app-info-text: #075985;
  --app-white-text: #ffffff;
  /* ============================================================
       STATI
       ============================================================ */
  --app-success: #198754;
  --app-success-dark: #146C43;
  --app-success-light: #D1E7DD;
  --app-success-soft: #F0FAF4;
  --app-warning: #F59E0B;
  --app-warning-dark: #CD8600;
  --app-warning-light: #FFF3CD;
  --app-warning-soft: #FFF9E6;
  --app-danger: #DC3545;
  --app-danger-dark: #B02A37;
  --app-danger-light: #F8D7DA;
  --app-danger-soft: #FDF1F2;
  --app-info: #0EA5E9;
  --app-info-dark: #036A9C;
  --app-info-light: #D9F0FC;
  --app-info-soft: #F0F9FF;
  /* ============================================================
       UI
       ============================================================ */

  --app-radius-sm: .375rem;
  --app-radius: .5rem;
  --app-radius-lg: .75rem;
  --app-radius-xl: 1rem;
  --app-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --app-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  /* ============================================================
       SIDEBAR
       ============================================================ */

  --app-sidebar-width: 250px;
  --app-sidebar-collapsed-width: 68px;
  /* ============================================================
       BOOTSTRAP OVERRIDE
       ============================================================ */

  --bs-primary: var(--app-primary);
  --bs-primary-rgb: 161, 38, 163;
  --bs-secondary: var(--app-secondary);
  --bs-secondary-rgb: 255, 107, 34;
  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--app-text);
  --bs-body-font-family: var(--app-font-family);
  --bs-body-font-size: var(--app-font-size);
  --bs-body-line-height: var(--app-line-height);
  --bs-border-color: var(--app-border);
  --bs-link-color: var(--app-primary);
  --bs-link-hover-color: var(--app-primary-dark);
}


/* ============================================================
   BODY
   ============================================================ */

html,
body {
  margin: 0;
  min-height: 100%;
  background-color: var(--app-bg);
  color: var(--app-text);
  font-family: var(--app-font-family);
}

body {
  font-size: var(--app-font-size);
  line-height: var(--app-line-height);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

label,
.form-label,
.form-check-label {
  font-size: var(--app-form-font-size);
  line-height: 1.4;
}

.form-label {
  font-weight: 500;
}

.app-mobile-grid,
.table {
  font-size: var(--app-font-size-grid);
  line-height: var(--app-line-height);
}


.floating-back-button {
  position: fixed;
  top: auto;
  right: 25px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-width: 190px;
  /*height: 42px;*/
  background: var(--app-surface);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
  transition: min-width .2s ease, width .2s ease, padding .2s ease, border-radius .2s ease;
}

  .floating-back-button.compact {
    min-width: 42px;
    width: 42px;
    height:42px;
    padding-left: 0;
    padding-right: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

    .floating-back-button.compact i {
      width: auto;
      margin: 0;
      padding: 0;
      line-height: 1;
      display: block;
    }

  .floating-back-button .floating-back-text {
    opacity: 1;
    max-width: 160px;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity .15s ease, max-width .2s ease;
  }

  .floating-back-button.compact .floating-back-text {
    opacity: 0;
    max-width: 0;
    display: none;
  }

  .floating-back-button i {
    margin: 0;
    flex-shrink: 0;
  }

.scroll-top-button {
  position: fixed;
  right: 25px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

  .scroll-top-button.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

@media (max-width: 768px) {
  .floating-back-button {
    top: 70px;
    right: 12px;
  }

  .scroll-top-button {
    right: 12px;
    bottom: 16px;
  }
}


/* ============================================================
   BUTTON PRIMARY
   ============================================================ */
.btn {
  --bs-btn-font-size: .9rem;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--app-primary-dark);
  --bs-btn-hover-border-color: var(--app-primary-dark);
  --bs-btn-focus-shadow-rgb: 161, 38, 163;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--app-primary-darker);
  --bs-btn-active-border-color: var(--app-primary-darker);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--app-primary-light);
  --bs-btn-disabled-border-color: var(--app-primary-light);
}

/* ============================================================
   BUTTON SECONDARY
   ============================================================ */

.btn-secondary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--app-secondary);
  --bs-btn-border-color: var(--app-secondary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--app-secondary-dark);
  --bs-btn-hover-border-color: var(--app-secondary-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--app-secondary-dark);
  --bs-btn-active-border-color: var(--app-secondary-dark);
}

/* ============================================================
   OUTLINE PRIMARY
   ============================================================ */

.btn-outline-primary {
  --bs-btn-color: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--app-primary);
  --bs-btn-hover-border-color: var(--app-primary);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
  --bs-btn-disabled-color: var(--app-primary);
  --bs-btn-disabled-border-color: var(--app-primary);
}

/* ============================================================
   OUTLINE SECONDARY
   ============================================================ */

.btn-outline-secondary {
  --bs-btn-color: var(--app-secondary);
  --bs-btn-border-color: var(--app-secondary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--app-secondary);
  --bs-btn-hover-border-color: var(--app-secondary);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--app-secondary-dark);
  --bs-btn-active-border-color: var(--app-secondary-dark);
  --bs-btn-disabled-color: var(--app-secondary);
  --bs-btn-disabled-border-color: var(--app-secondary);
}

/* ============================================================
   OUTLINE PRIMARY - OUTLINE SECONDARY - DISABLED
   ============================================================ */
.btn-outline-primary,
.btn-outline-secondary {
  --bs-btn-disabled-opacity: .5;
}

/* ============================================================
   BUTTON SOFT
   ============================================================ */

.btn-soft-primary {
  --bs-btn-color: var(--app-primary-dark);
  --bs-btn-bg: var(--app-primary-soft);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--app-primary-darker);
  --bs-btn-hover-bg: var(--app-primary-light);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 161, 38, 163;
  --bs-btn-active-color: var(--app-primary-darker);
  --bs-btn-active-bg: var(--app-primary-light);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--app-primary);
  --bs-btn-disabled-bg: var(--app-primary-soft);
  --bs-btn-disabled-border-color: transparent;
}

/* ============================================================
   BUTTON GHOST
   ============================================================ */

.btn-ghost-primary {
  --bs-btn-color: var(--app-primary);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--app-primary-dark);
  --bs-btn-hover-bg: var(--app-primary-light);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 161, 38, 163;
  --bs-btn-active-color: var(--app-primary-darker);
  --bs-btn-active-bg: var(--app-primary-light);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--app-primary-light);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: transparent;
}

/* ============================================================
   BUTTON LINK
   ============================================================ */

.btn-ghost-sigeg {
  --bs-btn-color: var(--app-honor-sigeg);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--app-honor-sigeg-dark);
  --bs-btn-hover-bg: var(--app-honor-sigeg-soft);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 93, 123, 157;
  --bs-btn-active-color: var(--app-honor-sigeg-darker);
  --bs-btn-active-bg: var(--app-honor-sigeg-soft);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--app-honor-sigeg-light);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: transparent;
}

.btn-link-primary {
  --bs-btn-color: var(--app-primary);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--app-primary-dark);
  --bs-btn-hover-bg: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--app-primary-darker);
  --bs-btn-active-bg: transparent;
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--app-primary-light);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: transparent;
  padding-left: .25rem;
  padding-right: .25rem;
  text-decoration: none;
}

  .btn-link-primary:hover {
    text-decoration: underline;
  }

/* ============================================================
   BUTTON GHOST DANGER
   ============================================================ */

.btn-ghost-danger {
  --bs-btn-color: var(--app-danger);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--app-danger);
  --bs-btn-hover-bg: var(--app-danger-light);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--app-danger);
  --bs-btn-active-bg: var(--app-danger-soft);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--app-text-light);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: transparent;
}

/* ============================================================
   BUTTON ICON
   ============================================================ */

.btn-icon {
  width: 38px;
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

  .btn-icon.btn-sm {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

.btn-sm {
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-padding-x: 0.5rem;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-border-radius: var(--bs-border-radius-sm);
}

/* ============================================================
   FORM
   ============================================================ */

.form-control,
.form-select {
  font-size: var(--app-form-font-size);
  border-color: var(--app-border);
  border-radius: var(--app-radius);
}

input,
select,
textarea,
.form-control-plaintext,
.input-group-text {
  font-size: var(--app-form-font-size);
}

input,
select,
textarea {
  font-family: var(--app-font-family);
}

  .form-control:focus,
  .form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem rgba(161, 38, 163, .15);
  }


/* ============================================================
   CARD
   ============================================================ */

.card {
  background-color: var(--app-surface);
  border-color: var(--app-border);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
}


/* ============================================================
   LAYOUT
   ============================================================ */

.app-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1.5rem;
  /*overflow: auto;*/
}

.app-workspace {
  --user-banner-left: var(--app-sidebar-width);
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.app-sidebar.collapsed + .app-workspace {
  --user-banner-left: var(--app-sidebar-collapsed-width);
}

.app-workspace:has(> .user-banner) {
  padding-top: 64px;
}

@media (max-width: 600px) {
  .app-sidebar:not(.collapsed) + .app-workspace .user-banner-brand,
  .app-sidebar:not(.collapsed) + .app-workspace .user-banner-identity {
    display: none;
  }

  .app-sidebar:not(.collapsed) + .app-workspace .user-banner {
    justify-content: flex-end;
    gap: 0;
    padding: .5rem;
  }

  .app-sidebar:not(.collapsed) + .app-workspace .user-banner-account {
    padding: .25rem;
  }
}

@media (max-width: 360px) {
  .app-sidebar:not(.collapsed) + .app-workspace .user-banner-notifications {
    display: none;
  }
}


/* ============================================================
   NAV / SIDEBAR
   ============================================================ */

/*.app-sidebar {
  width: var(--app-sidebar-width);
  min-width: var(--app-sidebar-width);
  display: flex;
  flex-direction: column;
  background: linear-gradient( 180deg, var(--app-primary-darker) 0%, var(--app-primary) 40%, var(--app-primary-darker) 100% );
  color: #fff;
  overflow: hidden;
  transition: width .20s ease, min-width .20s ease;
}
*/

.app-sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--app-sidebar-width);
  min-width: var(--app-sidebar-width);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient( 180deg, var(--app-primary-darker) 0%, var(--app-primary) 40%, var(--app-primary-darker) 100% );
  color: #fff;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width .20s ease, min-width .20s ease;
  z-index: 100;
}

  .app-sidebar.collapsed {
    width: var(--app-sidebar-collapsed-width);
    min-width: var(--app-sidebar-collapsed-width);
  }


/* ============================================================
   SIDEBAR HEADER
   ============================================================ */

.app-sidebar-header {
  min-height: 68px;
}

.app-sidebar-brand {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}


/* ============================================================
   SIDEBAR TOGGLE
   ============================================================ */

.app-sidebar-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: var(--app-radius);
  background-color: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

  .app-sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .60);
    color: #fff;
  }

  .app-sidebar-toggle:active {
    background-color: rgba(255, 255, 255, .24);
    color: #fff;
  }

  .app-sidebar-toggle:focus,
  .app-sidebar-toggle:focus-visible {
    outline: none;
    box-shadow: none;
  }


/* ============================================================
   SIDEBAR NAVIGATION
   ============================================================ */

.app-sidebar .nav {
  min-width: 0;
}

.app-sidebar .nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, .82);
  border-radius: var(--app-radius);
  white-space: nowrap;
  overflow: hidden;
  transition: background-color .15s ease, color .15s ease;
}

  .app-sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, .10);
  }

  .app-sidebar .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, .18);
  }

.app-sidebar .menu-icon {
  width: 24px;
  min-width: 24px;
  text-align: center;
  font-size: 1rem;
}

.app-sidebar .menu-label {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity .15s ease;
}

.app-sidebar .menu-parent {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

.app-sidebar .menu-chevron {
  margin-left: auto;
  font-size: .7rem;
  opacity: .72;
}

.app-sidebar .menu-children {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin: .15rem 0 .3rem 1.1rem;
  padding-left: .65rem;
  border-left: 1px solid rgba(255, 255, 255, .2);
}

.app-sidebar .menu-child-link {
  min-height: 38px;
  padding-top: .4rem;
  padding-bottom: .4rem;
  font-size: .9rem;
}

  .app-sidebar .menu-child-link .menu-icon {
    width: 20px;
    min-width: 20px;
    font-size: .88rem;
  }

.app-sidebar .menu-grandchildren {
  margin-left: 1.35rem;
}

  .app-sidebar .menu-grandchildren .menu-child-link {
    min-height: 34px;
    font-size: .84rem;
  }


/* ============================================================
   Caricamento
   ============================================================ */
.auth-loading-modal {
  position: fixed;
  inset: 0;
  width: 20rem;
  height: fit-content;
  margin: 25vh auto;
  padding: 2rem;
  border: 0;
  border-radius: .5rem;
  background-color: #fff;
  box-shadow: 0 3px 6px 2px rgba(0, 0, 0, .3);
  z-index: 9999;
  text-align: center;
}

  .auth-loading-modal::backdrop {
    background-color: rgba(0, 0, 0, .4);
  }

  .auth-loading-modal .components-reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .auth-loading-modal .components-rejoining-animation {
    display: block;
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
  }

    .auth-loading-modal .components-rejoining-animation div {
      position: absolute;
      border: 3px solid var(--app-primary);
      opacity: 1;
      border-radius: 50%;
      animation: auth-rejoining-animation 1.5s cubic-bezier(0, .2, .8, 1) infinite;
    }

      .auth-loading-modal .components-rejoining-animation div:nth-child(2) {
        animation-delay: -.5s;
      }

.auth-loading-text {
  margin-top: 1rem;
  text-align: center;
  color: var(--app-text-muted);
}

@keyframes auth-rejoining-animation {
  0% {
    top: 40px;
    left: 40px;
    width: 0;
    height: 0;
    opacity: 0;
  }

  5% {
    top: 40px;
    left: 40px;
    width: 0;
    height: 0;
    opacity: 1;
  }

  100% {
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    opacity: 0;
  }
}



/* ============================================================
   SIDEBAR COLLAPSED
   ============================================================ */

.app-sidebar.collapsed .app-sidebar-header {
  justify-content: center;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.app-sidebar.collapsed .app-sidebar-toggle {
  margin-left: 0 !important;
}

.app-sidebar.collapsed .nav-link {
  justify-content: center;
  padding-left: .5rem;
  padding-right: .5rem;
}

.app-sidebar.collapsed .menu-label {
  display: none;
}


/* ============================================================
   SIDEBAR LOGOUT
   ============================================================ */

.app-sidebar-footer {
  margin-top: auto;
}

.app-sidebar-logout {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .30);
  border-radius: var(--app-radius);
  background-color: transparent;
  color: rgba(255, 255, 255, .88);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

  .app-sidebar-logout:hover {
    background-color: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .50);
    color: #fff;
  }

  .app-sidebar-logout:active {
    background-color: rgba(255, 255, 255, .16);
    color: #fff;
  }

  .app-sidebar-logout:focus,
  .app-sidebar-logout:focus-visible {
    outline: none;
    box-shadow: none;
  }

.app-sidebar.collapsed .app-sidebar-logout {
  padding-left: .5rem;
  padding-right: .5rem;
}

  .app-sidebar.collapsed .app-sidebar-logout .menu-label {
    display: none;
  }


/* ============================================================
   HEADER
   ============================================================ */

.app-header {
  background-color: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
}


/* ============================================================
   UTILITIES BRAND
   ============================================================ */

.text-app-primary {
  color: var(--app-primary) !important;
}

.text-app-secondary {
  color: var(--app-secondary) !important;
}

.bg-app-primary {
  background-color: var(--app-primary) !important;
}

.bg-app-primary-soft {
  background-color: var(--app-primary-soft) !important;
}

.bg-app-secondary {
  background-color: var(--app-secondary) !important;
}

.border-app-primary {
  border-color: var(--app-primary) !important;
}


/* ============================================================
   BADGE
   ============================================================ */

.badge-app-primary {
  color: #fff;
  background-color: var(--app-primary);
}

.badge-app-secondary {
  color: #fff;
  background-color: var(--app-secondary);
}


/* ============================================================
   AUTH LAYOUT
   ============================================================ */

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--app-bg);
}

.auth-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 2rem 1rem;
}


/* ============================================================
   AUTH HEADER
   ============================================================ */

.auth-header {
  width: 100%;
  margin-bottom: 1.75rem;
  text-align: center;
}

.auth-company-logo {
  display: block;
  width: auto;
  /*height: 115px;*/
  max-width: 250px;
  object-fit: contain;
  margin: 0 auto 1rem;
}

.auth-platform-title {
  color: var(--app-primary);
  font-size: 1.8rem;
  line-height: 1.25;
  font-weight: 600;
}

.auth-platform-subtitle {
  margin-top: .25rem;
  color: var(--app-secondary);
  font-size: 1.55rem;
  line-height: 1.25;
  font-weight: 600;
}


/* ============================================================
   LOGIN / MFA CARD
   ============================================================ */

.app-login-card {
  width: 100%;
  max-width: 420px;
  padding: 1.6rem 1.5rem 1.5rem;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-xl);
  box-shadow: 0 8px 24px rgba(37, 35, 42, .08), var(--app-shadow);
}

.app-login-logo {
  color: var(--app-primary);
  font-size: 3rem;
  line-height: 1;
}

.auth-login-title {
  margin: 0;
  color: var(--app-text);
  font-size: 1.75rem;
  font-weight: 600;
}

.auth-login-subtitle {
  margin-top: .25rem;
  color: var(--app-text-muted);
  font-size: .95rem;
}

.app-login-card .form-label {
  color: var(--app-text);
  font-weight: 500;
}

.app-login-card .form-control {
  min-height: 40px;
  background-color: var(--app-bg);
}

  .app-login-card .form-control:focus {
    background-color: var(--app-surface);
  }

.auth-forgot {
  color: var(--app-primary);
  font-size: .85rem;
  text-decoration: none;
}

  .auth-forgot:hover {
    color: var(--app-primary-dark);
    text-decoration: underline;
  }

/* ============================================================
   PAGE + FOOTER
   ============================================================ */

.app-footer {
  flex-shrink: 0;
  width: 100%;
  padding: .85rem 1rem;
  background-color: var(--app-primary-darker);
  color: rgba(255, 255, 255, .88);
  border-top: 3px solid var(--app-secondary);
  text-align: center;
  font-size: .78rem;
  line-height: 1.6;
}

  .app-footer strong {
    color: #fff;
  }

  .app-footer a {
    color: var(--app-secondary-light);
    text-decoration: none;
  }

    .app-footer a:hover {
      color: #fff;
      text-decoration: underline;
    }

/* ============================================================
   FOCUS ACCESSIBILITY
   ============================================================ */

a:focus,
a:focus-visible,
.nav-link:focus,
.nav-link:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

h1:focus,
h2:focus,
h3:focus,
h4:focus,
h5:focus,
h6:focus,
h1:focus-visible,
h2:focus-visible,
h3:focus-visible,
h4:focus-visible,
h5:focus-visible,
h6:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: 2px;
}

/* ============================================================
   FULLCALENDAR - IMPERIUM
   ============================================================ */

#calendar {
  color: var(--app-text);
}

  /* Titolo mese */
  #calendar [role="heading"] {
    color: var(--app-primary-darker) !important;
    font-weight: 600 !important;
  }

  #calendar [role="status"] {
    background: var(--app-primary-soft) !important;
    color: var(--app-primary-darker) !important;
    font-weight: 600 !important;
  }
  /* Bottoni Mese / Settimana / Giorno */
  #calendar button[role="tab"] {
    background: var(--app-primary) !important;
    background-color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #fff !important;
    box-shadow: none !important;
  }

    /* Vista attiva */
    #calendar button[role="tab"][aria-selected="true"] {
      background: var(--app-primary-darker) !important;
      background-color: var(--app-primary-darker) !important;
      border-color: var(--app-primary-darker) !important;
      color: #fff !important;
    }

    /* Hover viste */
    #calendar button[role="tab"]:hover {
      background: var(--app-primary-dark) !important;
      background-color: var(--app-primary-dark) !important;
      border-color: var(--app-primary-dark) !important;
    }

  .calendar-surface div:has(> button[role="tab"]) {
    gap: 5px;
  }  
  
  /* Precedente / Successivo */
  #calendar button[aria-label="Prec"],
  #calendar button[aria-label="Succ"] {
    background: var(--app-primary) !important;
    background-color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #fff !important;
  }

    /* Hover Precedente / Successivo */
    #calendar button[aria-label="Prec"]:hover,
    #calendar button[aria-label="Succ"]:hover {
      background: var(--app-primary-dark) !important;
      background-color: var(--app-primary-dark) !important;
      border-color: var(--app-primary-dark) !important;
      color: #fff !important;
    }

  #calendar button[aria-label="Oggi"] {
    background: var(--app-secondary) !important;
    background-color: var(--app-secondary) !important;
    border-color: var(--app-secondary) !important;
    color: #fff !important;
  }

    #calendar button[aria-label="Oggi"]:hover {
      background: var(--app-secondary-dark) !important;
      background-color: var(--app-secondary-dark) !important;
      border-color: var(--app-secondary-dark) !important;
      color: #fff !important;
    }

  /* Header giorni settimana */
  #calendar [role="columnheader"] {
    background: var(--app-primary-soft) !important;
    background-color: var(--app-primary-soft) !important;
    color: var(--app-primary-darker) !important;
    font-weight: 600 !important;
  }


  /* Link */
  #calendar a {
    color: var(--app-text) !important;
    text-decoration: none !important;
  }


  /* Giorno corrente */
  #calendar [aria-current="date"] {
    background-color: var(--app-primary-soft) !important;
    color: var(--app-primary-darker) !important;
    font-weight: 700 !important;
  }

/* ============================================================
   DASHBOARD
   ============================================================ */

.dashboard-stat-card {
  min-height: 150px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--app-radius-lg);
  color: #fff;
  box-shadow: var(--app-shadow-sm);
}

.dashboard-stat-primary {
  background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
}

.dashboard-stat-secondary {
  background: linear-gradient(135deg, var(--app-secondary), var(--app-secondary-dark));
}

.dashboard-stat-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.dashboard-stat-danger {
  background: linear-gradient(135deg, var(--app-accent), #d93c4a);
}

.dashboard-stat-icon {
  width: 58px;
  height: 58px;
  min-width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgba(255,255,255,.16);
  font-size: 1.5rem;
}

.dashboard-stat-content {
  flex: 1 1 auto;
}

.dashboard-stat-title {
  font-size: .95rem;
  font-weight: 600;
}

.dashboard-stat-value {
  margin-top: .2rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.dashboard-stat-progress {
  height: 4px;
  margin-top: .65rem;
  background-color: rgba(0,0,0,.15);
  border-radius: 999px;
  overflow: hidden;
}

.dashboard-stat-progress-bar {
  height: 100%;
  background-color: rgba(255,255,255,.75);
}

.dashboard-stat-footer {
  margin-top: .45rem;
  font-size: .85rem;
}


.dashboard-panel {
  height: 100%;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
  overflow: hidden;
}

.dashboard-panel-header {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--app-border);
  color: var(--app-primary-darker);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

.dashboard-panel-body {
  padding: 1rem;
}

.dashboard-activity-list {
  max-height: 997px;
  overflow-y: auto;
}

.dashboard-activity-item {
  display: flex;
  gap: .8rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--app-border);
}

  .dashboard-activity-item:last-child {
    border-bottom: 0;
  }

.dashboard-activity-icon {
  width: 38px;
  min-width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--app-primary-soft);
  color: var(--app-primary);
}

.dashboard-activity-title {
  font-size: .9rem;
}

.dashboard-activity-text {
  margin-top: .15rem;
  color: var(--app-text);
  font-size: .85rem;
}

.dashboard-activity-time {
  margin-top: .25rem;
  color: var(--app-text-light);
  font-size: .75rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {

  .app-main {
    padding: 1rem;
  }

  .auth-content {
    justify-content: flex-start;
    padding: 1.25rem .75rem;
  }

  .auth-company-logo {
    height: 85px;
  }

  .auth-platform-title {
    font-size: 1.35rem;
  }

  .auth-platform-subtitle {
    font-size: 1.15rem;
  }

  .app-login-card {
    max-width: 100%;
  }
}
/*==========================================================
              SWEETALERT
==========================================================*/
@keyframes app-swal-in {
  from {
    opacity: 0;
    transform: scale(.94);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes app-swal-out {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(.96);
  }
}

.app-swal-show {
  animation: app-swal-in .18s ease-out;
}

.app-swal-hide {
  animation: app-swal-out .14s ease-in;
}

.app-toast {
  --app-toast-progress: #64748b;
}

.app-toast-success {
  --app-toast-progress: #198754;
}

.app-toast-error {
  --app-toast-progress: #dc3545;
}

.app-toast-warning {
  --app-toast-progress: #d99a00;
}

.app-toast-info {
  --app-toast-progress: #0d6efd;
}

.app-toast-question {
  --app-toast-progress: var(--app-primary);
}

.app-toast .swal2-timer-progress-bar {
  height: .22rem;
  background-color: var(--app-toast-progress) !important;
  opacity: 1;
}

.swal2-confirm {
  background-color: var(--app-primary) !important;
  border-color: var(--app-primary) !important;
  color: #fff !important;
  box-shadow: none !important;
}

  .swal2-confirm:hover {
    background-color: var(--app-primary-dark) !important;
    border-color: var(--app-primary-dark) !important;
  }

  .swal2-confirm:focus {
    box-shadow: 0 0 0 .2rem rgba(161, 38, 163, .22) !important;
  }

.swal2-cancel {
  background-color: #fff !important;
  border: 1px solid var(--app-primary) !important;
  color: var(--app-primary) !important;
  box-shadow: none !important;
}

  .swal2-cancel:hover {
    background-color: var(--app-primary-soft) !important;
    color: var(--app-primary-dark) !important;
    border-color: var(--app-primary-dark) !important;
  }

  .swal2-cancel:focus {
    box-shadow: 0 0 0 .2rem rgba(161, 38, 163, .15) !important;
  }

.swal2-title {
  color: var(--app-primary-darker) !important;
}

/*.swal2-icon.swal2-success {
  border-color: var(--app-primary) !important;
  color: var(--app-primary) !important;
}

  .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(161, 38, 163, .25) !important;
  }

  .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: var(--app-primary) !important;
  }*/

.text-app-success {
  color: var(--app-success-text) !important;
}

.text-app-warning {
  color: var(--app-warning-text) !important;
}

.text-app-danger {
  color: var(--app-danger-text) !important;
}

.text-app-info {
  color: var(--app-info-text) !important;
}

/*==========================================================
              Formazione 81/08
==========================================================*/

.formazione-page {
  width: 100%;
  min-width: 0;
}

.formazione-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.formazione-menu {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--app-border, #dee2e6);
}

.formazione-menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--app-border, #dee2e6);
  border-radius: 8px;
  background-color: var(--app-surface, #ffffff);
  color: var(--app-text-muted, #64748b);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

  .formazione-menu-link i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 1.15rem;
    color: var(--app-primary, #a824b5);
    font-size: 0.95rem;
    line-height: 1;
  }

  .formazione-menu-link span {
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
  }

  .formazione-menu-link:hover {
    border-color: var(--app-primary, #a824b5);
    background-color: var(--app-primary-soft, #faf0fb);
    color: var(--app-primary, #a824b5);
    text-decoration: none;
  }

  .formazione-menu-link.active {
    border-color: var(--app-primary, #a824b5);
    background-color: var(--app-primary-soft, #faf0fb);
    color: var(--app-primary, #a824b5);
  }

    .formazione-menu-link.active i {
      color: var(--app-primary, #a824b5);
    }

  .formazione-menu-link:focus-visible {
    outline: 2px solid var(--app-primary-light, #d69adb);
    outline-offset: 2px;
  }

.formazione-contenuto {
  width: 100%;
  min-width: 0;
}

.formazione-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

  .formazione-section-header h2 {
    margin: 0;
    color: var(--app-text, #334155);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0;
  }

  .formazione-section-header span {
    display: block;
    margin-top: 0.2rem;
    color: var(--app-text-muted, #64748b);
    font-size: 0.8rem;
  }

.formazione-grid-wrapper {
  width: 100%;
  max-height: 65vh;
  overflow: auto;
  border: 1px solid var(--app-border, #dee2e6);
  border-radius: 8px;
  background-color: var(--app-surface, #ffffff);
}

.formazione-grid {
  min-width: 720px;
}

  .formazione-grid.formazione-grid-attestati {
    min-width: 1120px;
  }

  .formazione-grid.formazione-grid-figure {
    min-width: 1040px;
  }

.formazione-grid-head,
.formazione-grid-row {
  display: grid;
}

  .formazione-grid-head.formazione-grid-persone,
  .formazione-grid-row.formazione-grid-persone {
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(210px, 1.2fr) 100px;
  }

  .formazione-grid-head.formazione-grid-attestati,
  .formazione-grid-row.formazione-grid-attestati {
    grid-template-columns: minmax(145px, .75fr) minmax(190px, 1fr) minmax(110px, .65fr) minmax(100px, .6fr) minmax(280px, 2fr) 80px 80px;
  }

  .formazione-grid-head.formazione-grid-figure,
  .formazione-grid-row.formazione-grid-figure {
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(190px, 1.2fr) minmax(180px, 1fr) minmax(150px, .8fr) 100px;
  }

.formazione-grid-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: var(--app-surface-muted, #f6f7f9);
  color: var(--app-text, #334155);
  font-size: .82rem;
  font-weight: 600;
}

.formazione-grid-row {
  border-top: 1px solid var(--app-border-light, #edf0f3);
  color: var(--app-text, #334155);
  font-size: .875rem;
}

  .formazione-grid-head > span,
  .formazione-grid-row > span {
    min-width: 0;
    padding: .85rem .75rem;
  }

  .formazione-grid-row.formazione-grid-persone,
  .formazione-grid-row.formazione-grid-figure {
    cursor: pointer;
  }

    .formazione-grid-row.formazione-grid-persone:hover,
    .formazione-grid-row.formazione-grid-persone.selected,
    .formazione-grid-row.formazione-grid-figure:hover,
    .formazione-grid-row.formazione-grid-figure.selected {
      background-color: var(--app-primary-soft, #faf0fb);
    }

    .formazione-grid-row.formazione-grid-persone:focus-visible,
    .formazione-grid-row.formazione-grid-figure:focus-visible {
      outline: 2px solid var(--app-primary, #a824b5);
      outline-offset: -2px;
    }

.formazione-grid-empty {
  display: grid;
  min-height: 5.5rem;
  place-items: center;
  color: var(--app-text-muted, #64748b);
}

.formazione-search {
  position: relative;
  width: min(100%, 22rem);
}

  .formazione-search i {
    position: absolute;
    top: 50%;
    left: 0.85rem;
    color: var(--app-text-muted, #64748b);
    pointer-events: none;
    transform: translateY(-50%);
  }

  .formazione-search .form-control {
    min-height: 2.5rem;
    padding-left: 2.5rem;
  }

.formazione-persona-selezionata {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 0.85rem;
}

  .formazione-persona-selezionata h3 {
    margin: 0;
    color: var(--app-text, #334155);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0;
  }

  .formazione-persona-selezionata p {
    margin: 0.2rem 0 0;
    color: var(--app-text-muted, #64748b);
    font-size: 0.82rem;
  }

.formazione-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.formazione-file-name {
  display: block;
  max-width: 32rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .dashboard-activity-list {
    max-height: 500px;
    overflow-y: auto;
  }
  .formazione-header,
  .formazione-section-header,
  .formazione-persona-selezionata {
    align-items: stretch;
    flex-direction: column;
  }

  .formazione-menu {
    align-items: stretch;
    flex-direction: column;
  }

  .formazione-menu-link {
    width: 100%;
  }

  .formazione-search {
    width: 100%;
  }

  .formazione-section-header .btn,
  .formazione-persona-selezionata .btn {
    width: 100%;
  }

  .formazione-file-name {
    max-width: 15rem;
  }
}

.formazione-school-selector {
  width: min(100%, 30rem);
  /*margin: 0 auto 1.25rem;*/
}

.formazione-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 8rem;
  border: 1px dashed var(--app-border, #dee2e6);
  border-radius: 8px;
  color: var(--app-text-muted, #64748b);
}

  .formazione-empty-state i {
    color: var(--app-primary, #a824b5);
  }

.formazione-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.formazione-upload-panel {
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--app-border, #dee2e6);
  border-top: 3px solid var(--app-primary, #a824b5);
  border-radius: 8px;
  background-color: var(--app-surface, #ffffff);
}

.formazione-upload-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

  .formazione-upload-header h3 {
    margin: 0;
    color: var(--app-text, #334155);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0;
  }

.formazione-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.formazione-field {
  min-width: 0;
}

.formazione-field-wide,
.formazione-field-file {
  grid-column: span 2;
}

.formazione-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
}

.formazione-validation {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--app-danger-light, #f8d7da);
  border-radius: 6px;
  background-color: var(--app-danger-soft, #fdf1f2);
  color: var(--app-danger-dark, #b02a37);
  font-size: 0.85rem;
}

@media (max-width: 1100px) {
  .dashboard-activity-list {
    max-height: 700px;
    overflow-y: auto;
  }
  .formazione-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .formazione-toolbar,
  .formazione-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .formazione-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .formazione-field-wide,
  .formazione-field-file {
    grid-column: auto;
  }

  .formazione-form-actions .btn {
    width: 100%;
  }
}

/* Cell values stay transparent to the existing desktop grid layout. */
.app-mobile-value {
  display: contents !important;
  padding: 0 !important;
}

@media (max-width: 768px) {
  .app-mobile-grid,
  .app-mobile-scroll {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .app-mobile-scroll {
    overflow: visible !important;
  }

  .app-mobile-grid {
    padding: .5rem;
    overflow-x: hidden;
  }

  .app-mobile-head {
    display: none !important;
  }

  .app-mobile-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 0 .85rem;
    padding: .35rem;
    border: 1px solid var(--app-border) !important;
    border-radius: 6px;
    align-items: stretch;
  }

    .app-mobile-row:last-child {
      margin-bottom: 0;
    }

    .app-mobile-row > .app-mobile-cell {
      display: grid !important;
      grid-template-columns: minmax(0, 38%) minmax(0, 1fr) !important;
      align-items: baseline;
      justify-content: stretch;
      gap: .65rem;
      min-width: 0;
      padding: .55rem .5rem !important;
      border-left: 0 !important;
      border-radius: 0;
      text-align: left !important;
      white-space: normal !important;
      overflow: visible !important;
      overflow-wrap: anywhere;
    }

  .app-mobile-cell::before {
    content: attr(data-label);
    min-width: 0;
    color: var(--app-text-muted);
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .app-mobile-cell > .app-mobile-value {
    display: block !important;
    min-width: 0;
    max-width: 100%;
    padding: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .app-mobile-value :is(span, a) {
    white-space: normal !important;
    overflow-wrap: anywhere;
    text-overflow: clip !important;
  }

  .app-mobile-value :is(input:not([type="checkbox"]), select, textarea) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .app-mobile-row > .app-mobile-long,
  .app-mobile-row > .app-mobile-actions {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: .3rem;
  }

  .app-mobile-actions > .app-mobile-value {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
  }

  .app-mobile-actions .btn,
  .app-mobile-actions .documento-action {
    min-width: 44px;
    min-height: 44px;
  }

  .app-mobile-cell[data-label="Azioni"]:not(:has(button, a, input)) {
    display: none !important;
  }

  .lab-permissions-row.app-mobile-row > .app-mobile-cell:nth-child(6) {
    margin-top: .5rem;
    padding-top: .85rem !important;
    border-top: 2px solid var(--app-primary-light);
  }

  .lab-permissions-row.app-mobile-row input[type="checkbox"] {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 999px) {
  .app-mobile-grid,
  .app-mobile-scroll {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .app-mobile-scroll {
    overflow: visible !important;
  }

  .app-mobile-grid {
    padding: .5rem;
    overflow-x: hidden;
  }

  .app-mobile-head {
    display: none !important;
  }

  .app-mobile-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 0 .85rem;
    padding: .35rem;
    border: 1px solid var(--app-border) !important;
    border-radius: 6px;
    align-items: stretch;
  }

    .app-mobile-row:last-child {
      margin-bottom: 0;
    }

    .app-mobile-row > .app-mobile-cell {
      display: grid !important;
      grid-template-columns: minmax(0, 38%) minmax(0, 1fr) !important;
      align-items: baseline;
      justify-content: stretch;
      gap: .65rem;
      min-width: 0;
      padding: .55rem .5rem !important;
      border-left: 0 !important;
      border-radius: 0;
      text-align: left !important;
      white-space: normal !important;
      overflow: visible !important;
      overflow-wrap: anywhere;
    }

  .app-mobile-cell::before {
    content: attr(data-label);
    min-width: 0;
    color: var(--app-text-muted);
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .app-mobile-cell > .app-mobile-value {
    display: block !important;
    min-width: 0;
    max-width: 100%;
    padding: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .app-mobile-value :is(span, a) {
    white-space: normal !important;
    overflow-wrap: anywhere;
    text-overflow: clip !important;
  }

  .app-mobile-value :is(input:not([type="checkbox"]), select, textarea) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .app-mobile-row > .app-mobile-long,
  .app-mobile-row > .app-mobile-actions {
    gap: .65rem;
  }

  .app-mobile-actions > .app-mobile-value {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
  }

  .app-mobile-actions .btn,
  .app-mobile-actions .documento-action {
    min-width: 44px;
    min-height: 44px;
  }

  .app-mobile-cell[data-label="Azioni"]:not(:has(button, a, input)) {
    display: none !important;
  }

  .lab-permissions-row.app-mobile-row > .app-mobile-cell:nth-child(6) {
    margin-top: .5rem;
    padding-top: .85rem !important;
    border-top: 2px solid var(--app-primary-light);
  }

  .lab-permissions-row.app-mobile-row input[type="checkbox"] {
    width: 24px;
    height: 24px;
  }
}

/* Shared presentation: opt in through explicit app-* classes. */
.app-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--app-border);
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
  font-weight: 600;
}

.app-section-body {
  padding: 1.25rem;
}

.app-section {
  overflow: visible;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-sm);
}

.app-field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--app-text-muted);
  font-size: var(--app-form-font-size);
  font-weight: 500;
}

.app-empty-state {
  padding: 2rem;
  color: var(--app-text-muted);
  text-align: center;
}

.app-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.app-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.app-page-heading {
  min-width: 0;
  max-width: 100%;
  text-align: left;
}

.app-page-title {
  margin: 0px;
  color: var(--app-primary);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.app-page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--app-text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .app-page-header > .app-page-heading {
    align-self: stretch;
  }
}

.app-detail-context {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-honor-sigeg-soft);
  color: var(--app-honor-sigeg-darker);
}

.app-detail-context i {
  color: var(--app-honor-sigeg);
}

.app-detail-context-label {
  font-size: 0.72rem;
  color: var(--app-text-muted);
}

.app-detail-context-value {
  font-size: 0.88rem;
  font-weight: 600;
}

.app-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.app-detail-subtitle {
  margin-top: 0.2rem;
  color: var(--app-text-muted);
  font-size: 0.95rem;
}

.app-detail-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: .9rem;
  padding: 0px 0.75rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--app-border);
  background: var(--app-surface-alt);
}

.app-detail-tabs::-webkit-scrollbar {
  height: 4px;
}

.app-detail-tab {
  flex: 0 0 auto;
  padding: 0.85rem 1rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--app-text-muted);
  font-size: var(--app-form-font-size);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.app-detail-tab:hover {
  color: var(--app-primary);
  background: var(--app-primary-soft);
}

.app-detail-tab.active {
  color: var(--app-primary);
  border-bottom-color: var(--app-primary);
  font-weight: 600;
}

.app-detail-tab i {
  margin-right: 0.4rem;
}

.app-detail-content {
  padding: 1.5rem;
  min-height: 280px;
}

.app-detail-label,
.app-field label.app-detail-label {
  margin-bottom: 0.25rem;
  color: var(--app-text-muted);
  font-size: var(--app-form-font-size);
  font-weight: 600;
}

.app-detail-value {
  min-height: 1.5rem;
  color: var(--app-text);
  font-size: 0.95rem;
  font-weight: 500;
  word-break: break-word;
}

.app-detail-description {
  min-height: 130px;
  padding: 1rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface-alt);
  color: var(--app-text);
  line-height: 1.55;
  white-space: pre-wrap;
}

textarea.app-detail-description-edit {
  min-height: 160px;
  resize: vertical;
}

.app-detail-section-title {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--app-border);
  color: var(--app-primary);
  font-size: 1rem;
  font-weight: 600;
}

.app-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.35rem;
  color: var(--app-text-muted);
  font-size: 0.82rem;
}

.app-detail-field .form-control, .app-detail-field .form-select {
  border-color: var(--app-border-strong);
  border-radius: var(--app-radius);
  background-color: var(--app-surface);
}

.app-detail-field .form-control:focus, .app-detail-field .form-select:focus {
  border-color: var(--app-primary);
  box-shadow: rgba(161, 38, 163, 0.12) 0px 0px 0px 0.2rem;
}

.app-detail-field .form-control:disabled, .app-detail-field .form-select:disabled {
  background-color: var(--app-surface-alt);
  color: var(--app-text-muted);
}

.app-detail-card {
  width: 100%;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
  overflow: visible;
}
.app-notify-choices { display: grid; gap: .75rem; max-height: 55dvh; overflow: auto; text-align: left; font-size: .9rem; }
.app-notify-choice { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: .75rem; padding: .9rem; border: 1px solid var(--app-border); border-radius: 6px; cursor: pointer; }
.app-notify-choice:has(input:checked) { border-color: var(--app-primary); background: var(--app-surface-muted, #f5f6f8); }
.app-notify-choice input { margin-top: .25rem; accent-color: var(--app-primary); }
.app-notify-choice strong, .app-notify-choice-details { display: block; overflow-wrap: anywhere; }
.app-notify-choice-details { margin-top: .35rem; white-space: pre-line; font-weight: 400; }
