:root {
  --fluent-font-family: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --fluent-bg: #f8f9fa;
  --fluent-surface: #ffffff;
  --fluent-surface-alt: #fafafa;
  --fluent-border: #e0e0e0;
  --fluent-text: #212121;
  --fluent-text-muted: #616161;
  --fluent-primary: #1a1a2e;
  --fluent-primary-hover: #283046;
  --fluent-success: #2e7d32;
  --fluent-danger: #c62828;
  --fluent-radius: 6px;
  --fluent-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --fluent-shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.08);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
  font-family: var(--fluent-font-family);
  background-color: var(--fluent-bg);
  color: var(--fluent-text);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Applica il font corporate solo ai contenuti testuali DevExtreme.
   Il precedente override globale su .dx-widget * sovrascriveva DXIcons
   e trasformava le icone in quadratini vuoti. */
.dx-widget,
.dx-widget input,
.dx-widget textarea,
.dx-widget select,
.dx-widget .dx-button-text,
.dx-widget .dx-toolbar-label,
.dx-widget .dx-item-content,
.dx-widget .dx-list-item-content,
.dx-widget .dx-menu-item-text,
.dx-widget .dx-treeview-item-content,
.dx-widget .dx-tab-text,
.dx-widget .dx-field-item-label-text,
.dx-widget .dx-field-item-help-text,
.dx-widget .dx-placeholder,
.dx-widget .dx-texteditor-input,
.dx-widget .dx-datagrid-text-content,
.dx-popup-wrapper .dx-overlay-content,
.dx-toast-content,
.dx-loadpanel-content {
  font-family: var(--fluent-font-family) !important;
}

/* Ripristina il font glyph di DevExtreme per icone, checkbox, sort e affordance di grid/editor. */
.dx-icon,
.dx-icon::before,
.dx-icon::after,
.dx-checkbox-icon,
.dx-checkbox-icon::before,
.dx-datagrid .dx-sort-up::before,
.dx-datagrid .dx-sort-down::before,
.dx-treelist-container .dx-sort-up::before,
.dx-treelist-container .dx-sort-down::before,
.dx-header-filter::before,
.dx-header-filter-indicator::before,
.dx-menu-item-popout::before,
.dx-dropdowneditor-icon::before {
  font-family: DXIcons, sans-serif !important;
}

a {
  color: var(--fluent-primary);
}

a:hover {
  color: var(--fluent-primary-hover);
}

.app-header {
  background-color: var(--fluent-surface);
  border-bottom: 1px solid var(--fluent-border);
  box-shadow: var(--fluent-shadow-soft);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1.25rem;
  min-height: 52px;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-header-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fluent-text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-welcome {
  color: var(--fluent-text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
}

.app-header-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--fluent-radius);
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  cursor: pointer;
  color: var(--fluent-text);
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.app-header-user-btn:hover,
.app-header-user-btn:focus {
  background-color: var(--fluent-surface-alt);
  border-color: var(--fluent-border);
}

.app-header-user-btn::after {
  content: "";
  border: 4px solid transparent;
  border-top-color: var(--fluent-text-muted);
  margin-left: 0.15rem;
  transform: translateY(2px);
}

.app-header-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--fluent-primary);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  flex: 0 0 28px;
}

.app-header-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fluent-text);
}

.app-header-user .dropdown-menu {
  border-radius: var(--fluent-radius);
  border: 1px solid var(--fluent-border);
  box-shadow: var(--fluent-shadow);
  padding: 0.35rem;
  min-width: 180px;
}

.dropdown-icon {
  width: 16px;
  height: 16px;
  margin-right: 0.5rem;
  color: var(--fluent-text-muted);
}

.dropdown-item {
  display: flex;
  align-items: center;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  color: var(--fluent-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--fluent-surface-alt);
  color: var(--fluent-text);
}

.container,
.container-fluid {
  padding-top: 1rem;
}

.card {
  background-color: var(--fluent-surface);
  border: 1px solid var(--fluent-border);
  border-radius: var(--fluent-radius);
  box-shadow: var(--fluent-shadow-soft);
}

.card-header {
  background-color: var(--fluent-surface-alt);
  border-bottom: 1px solid var(--fluent-border);
  font-weight: 600;
}

.form-control,
.form-select,
.input-group-text {
  border-radius: var(--fluent-radius);
  border-color: var(--fluent-border);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--fluent-primary);
  box-shadow: 0 0 0 0.2rem rgba(0, 120, 212, 0.2);
}

.btn {
  border-radius: var(--fluent-radius);
  font-weight: 600;
}

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

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

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

.btn-danger {
  background-color: var(--fluent-danger);
  border-color: var(--fluent-danger);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(0, 120, 212, 0.25);
}

.table {
  color: var(--fluent-text);
}

.table > :not(caption) > * > * {
  background-color: var(--fluent-surface);
  border-bottom-color: var(--fluent-border);
}

.badge {
  border-radius: 999px;
}

.footer {
  background-color: var(--fluent-surface);
  border-top: 1px solid var(--fluent-border);
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--fluent-bg);
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.app-sidebar {
  width: 240px;
  background-color: #1a1a2e;
  border-right: 1px solid #141425;
  box-shadow: none;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 280ms var(--ease-drawer), padding 280ms var(--ease-drawer);
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f5f5f5;
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}

.sidebar-brand-text {
  white-space: nowrap;
}

.sidebar-toggle {
  background: transparent;
  border: 1px solid #2a2a42;
  color: #e0e0e0;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 1rem;
  line-height: 1;
}

.sidebar-toggle-mobile {
  display: none;
  margin-right: 0.5rem;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
  background-color: #2a2a42;
  color: #ffffff;
}

.app-sidebar .sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-sidebar .sidebar-nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a8aa0;
  padding: 0.5rem 0.75rem 0.25rem;
}

.app-sidebar .sidebar-link {
  text-decoration: none !important;
  color: #d4d4e0 !important;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-weight: 400;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 150ms var(--ease-out);
  border-left: 2px solid transparent;
  transform-origin: left center;
}

@media (hover: hover) and (pointer: fine) {
  .app-sidebar .sidebar-link:active {
    transform: scale(0.97);
  }
}

.app-sidebar .sidebar-link-text {
  color: #d4d4e0 !important;
}

.app-sidebar .sidebar-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: #b0b0c4 !important;
}

.app-sidebar .sidebar-link-icon svg {
  width: 20px;
  height: 20px;
}

.app-sidebar .sidebar-link:hover,
.app-sidebar .sidebar-link:focus {
  background-color: #2a2a42;
  color: #ffffff !important;
}

.app-sidebar .sidebar-link:hover .sidebar-link-icon,
.app-sidebar .sidebar-link:focus .sidebar-link-icon {
  color: #e8e8f0 !important;
}

.app-sidebar .sidebar-link:hover .sidebar-link-text,
.app-sidebar .sidebar-link:focus .sidebar-link-text {
  color: #ffffff !important;
}

.app-sidebar .sidebar-link-active {
  background-color: #2a2a42;
  color: #ffffff !important;
  border-left-color: #ffffff;
}

.app-sidebar .sidebar-link-active .sidebar-link-icon {
  color: #ffffff !important;
}

.app-sidebar .sidebar-link-active .sidebar-link-text {
  color: #ffffff !important;
}

.app-shell.sidebar-collapsed .app-sidebar {
  width: 72px;
  padding: 1.5rem 0.5rem;
}

.app-shell.sidebar-collapsed .sidebar-brand {
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-brand-text {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-nav-label {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 0.6rem 0.4rem;
  border-left-color: transparent;
}

.app-shell.sidebar-collapsed .sidebar-link-active {
  border-left-color: #ffffff;
}

.app-shell.sidebar-collapsed .sidebar-link-text {
  display: none;
}

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

.app-footer {
  width: 100%;
}

.app-main {
  flex: 1;
  padding: 1.5rem;
}

@media (max-width: 991.98px) {
  .app-body {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--fluent-border);
  }

  .app-shell.sidebar-collapsed .app-sidebar {
    width: 100%;
    display: none;
  }

  .sidebar-toggle-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-header-inner {
    padding: 0.45rem 0.75rem;
  }

  .app-header-welcome {
    display: none;
  }

  .app-header-user-name {
    display: none;
  }
}

.metratore-timeline-label {
  font-size: 0.75rem;
  color: var(--fluent-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.metratore-timeline {
  position: relative;
  height: 14px;
  margin-bottom: 0.75rem;
}

.metratore-timeline-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background-color: var(--fluent-border);
  transform: translateY(-50%);
}

.metratore-timeline-events {
  position: relative;
  height: 14px;
}

.metratore-event {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background-color: var(--fluent-primary);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--fluent-surface);
}

.metratore-event.tipo-Difetto {
  background-color: var(--fluent-danger);
}

.metratore-event.tipo-Altezza {
  background-color: var(--fluent-success);
}

.account-overview-shell {
  --text-color-1: rgba(255, 255, 255, 1);
  --text-color-2: rgba(54, 54, 64, 1);
  --disabled-color: rgba(255, 255, 255, 0.38);
  --background-color-1: rgba(159, 213, 161, 1);
  --background-color-2: rgba(255, 181, 127, 1);
  --scheduler-surface: #23252e;
  --scheduler-border: rgba(255, 255, 255, 0.12);
  --scheduler-button-border: rgba(255, 255, 255, 0.2);
  --scheduler-button-hover: rgba(255, 255, 255, 0.08);
  --scheduler-avatar-text: #2c3240;
  border-radius: 12px;
  overflow: hidden;
  background: var(--scheduler-surface);
}

.account-overview-shell.account-theme-light {
  --text-color-1: rgba(0, 0, 0, 0.6);
  --text-color-2: rgba(255, 255, 255, 1);
  --disabled-color: rgba(0, 0, 0, 0.38);
  --background-color-1: rgba(50, 134, 56, 1);
  --background-color-2: rgba(194, 81, 0, 1);
  --scheduler-surface: #fbfbfd;
  --scheduler-border: rgba(0, 0, 0, 0.12);
  --scheduler-button-border: rgba(0, 0, 0, 0.14);
  --scheduler-button-hover: rgba(0, 0, 0, 0.04);
  --scheduler-avatar-text: #ffffff;
}

.account-theme-toolbar {
  display: flex;
  justify-content: flex-end;
}

.account-theme-toolbar .form-check-label {
  display: inline-flex;
  gap: 0.35rem;
  font-weight: 600;
}

.account-overview-shell .account-overview-scheduler,
.account-overview-shell .dx-scheduler,
.account-overview-shell .dx-scheduler-header,
.account-overview-shell .dx-scheduler-work-space,
.account-overview-shell .dx-scheduler-date-table-scrollable,
.account-overview-shell .dx-scheduler-header-panel,
.account-overview-shell .dx-scrollable-content,
.account-overview-shell .dx-scheduler-date-table,
.account-overview-shell .dx-scheduler-time-panel,
.account-overview-shell .dx-scheduler-time-panel-table {
  background-color: var(--scheduler-surface);
  color: var(--text-color-1);
}

.account-overview-shell .dx-scheduler-header,
.account-overview-shell .dx-scheduler-navigator,
.account-overview-shell .dx-scheduler-date-table,
.account-overview-shell .dx-scheduler-header-panel,
.account-overview-shell .dx-scheduler-group-header {
  border-color: var(--scheduler-border);
}

.account-overview-shell .dx-toolbar .dx-button,
.account-overview-shell .dx-toolbar .dx-button .dx-icon,
.account-overview-shell .dx-toolbar-label {
  color: var(--text-color-1);
}

.account-overview-shell .dx-toolbar .dx-button {
  background-color: transparent;
  border-color: var(--scheduler-button-border);
}

.account-overview-shell .dx-toolbar .dx-button.dx-state-hover,
.account-overview-shell .dx-toolbar .dx-button.dx-state-focused {
  background-color: var(--scheduler-button-hover);
}

.account-overview-shell .dx-scheduler-group-header,
.account-overview-shell .dx-scheduler-date-table-cell {
  position: relative;
}

.account-overview-shell .dx-scheduler-group-header-content {
  padding-left: 8px;
}

.account-overview-shell .dx-scheduler-date-table-other-month.dx-scheduler-date-table-cell {
  opacity: 1;
  color: var(--disabled-color) !important;
}

.account-overview-shell .dx-scheduler-work-space-month .dx-scheduler-date-table-cell {
  color: var(--text-color-1);
}

.account-overview-shell .dx-scheduler-work-space-month .dx-scheduler-date-table-cell,
.account-overview-shell .dx-scheduler-header-panel-cell,
.account-overview-shell .dx-scheduler-group-header {
  border-color: var(--scheduler-border);
  background-color: var(--scheduler-surface);
}

.account-overview-shell .dx-scheduler-work-space-month .dx-scheduler-appointment,
.account-overview-shell .dx-scheduler-work-space-month .dx-scheduler-appointment.dx-state-focused {
  color: var(--text-color-2);
  line-height: 22px;
  border: none;
  border-radius: 8px;
  box-shadow: none;
}

.account-overview-shell .dx-scheduler-work-space-month .dx-scheduler-appointment .dx-scheduler-appointment-content {
  padding-top: 0;
  font-weight: 600;
}

.account-overview-shell .dx-scheduler-date-table-cell .dx-template-wrapper {
  position: absolute;
  inset: 0;
  padding-right: 6px;
}

.account-overview-shell .account-resource-card {
  position: relative;
  min-height: 140px;
}

.account-overview-shell .avatar {
  width: 112px;
  overflow: hidden;
  position: relative;
  height: 112px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(232, 235, 242, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 0 12px;
}

.account-overview-shell .avatar-initials {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--scheduler-avatar-text);
  letter-spacing: 0.08em;
}

.account-overview-shell .name {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.account-overview-shell .name h2 {
  color: var(--text-color-2);
  font-size: 2rem;
  text-align: left;
  padding: 0 0 0 142px;
  margin: 0;
  height: 52px;
  line-height: 52px;
  font-weight: 700;
}

.account-overview-shell .info {
  width: auto;
  text-align: left;
  height: 100%;
  font-size: 0.95rem;
  line-height: 1.4;
  font-weight: 600;
  padding: 18px 20px 18px 142px;
}

.account-overview-shell .day-cell {
  width: 100%;
  height: 100%;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 48px 48px;
}

.account-overview-shell .dx-scheduler-appointment {
  color: rgba(255, 255, 255, 1);
}

.account-overview-shell .employee-1 {
  background-color: rgba(55, 126, 58, 0.08);
}

.account-overview-shell .employee-2 {
  background-color: rgba(194, 81, 0, 0.08);
}

.account-overview-shell .employee-weekend-1 {
  background-color: rgba(55, 126, 58, 0.12);
}

.account-overview-shell .employee-weekend-2 {
  background-color: rgba(194, 81, 0, 0.12);
}

.account-overview-shell.account-theme-light .employee-1 {
  background-color: rgba(50, 134, 56, 0.08);
}

.account-overview-shell.account-theme-light .employee-weekend-1 {
  background-color: rgba(50, 134, 56, 0.12);
}

.account-overview-shell .training-background-0 {
  background-image:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.12) 0 18%, transparent 19% 100%),
    radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.08) 0 10%, transparent 11% 100%);
}

.account-overview-shell .training-background-1 {
  background-image:
    linear-gradient(135deg, transparent 38%, rgba(255, 255, 255, 0.1) 39%, rgba(255, 255, 255, 0.1) 47%, transparent 48%),
    linear-gradient(45deg, transparent 58%, rgba(255, 255, 255, 0.08) 59%, rgba(255, 255, 255, 0.08) 66%, transparent 67%);
}

.account-overview-shell .training-background-2 {
  background-image:
    linear-gradient(transparent 54%, rgba(255, 255, 255, 0.08) 55%, rgba(255, 255, 255, 0.08) 61%, transparent 62%),
    radial-gradient(circle at 65% 35%, rgba(255, 255, 255, 0.1) 0 13%, transparent 14% 100%);
}

@media (max-width: 991.98px) {
  .account-overview-shell .avatar {
    width: 72px;
    height: 72px;
  }

  .account-overview-shell .avatar-initials {
    font-size: 1.5rem;
  }

  .account-overview-shell .name h2 {
    font-size: 1.35rem;
    padding-left: 98px;
    height: 44px;
    line-height: 44px;
  }

  .account-overview-shell .info {
    padding: 12px 14px 12px 98px;
    font-size: 0.8rem;
  }
}

/* Schermografica pezza (Controllo Pezze > Mappa) */
.cpz-map {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
  overflow: auto;
}

.cpz-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cpz-map-info {
  color: var(--fluent-text-muted);
  font-size: 0.85rem;
}

.cpz-map-zoom {
  display: flex;
  gap: 0.35rem;
}

.cpz-map-body {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.cpz-map-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Nastro e grafico mantengono la loro altezza naturale: se la finestra è bassa
   scorre il contenitore .cpz-map invece di comprimerli. */
.cpz-map-stage {
  flex: 0 0 auto;
  border: 1px solid var(--fluent-border);
  border-radius: var(--fluent-radius);
  background-color: var(--fluent-surface);
  overflow: hidden;
}

.cpz-map-chart {
  flex: 0 0 auto;
}

.cpz-map-detail {
  width: 280px;
  flex: 0 0 280px;
  border: 1px solid var(--fluent-border);
  border-radius: var(--fluent-radius);
  background-color: var(--fluent-surface-alt);
  padding: 0.65rem 0.75rem;
  overflow-y: auto;
}

.cpz-map-detail-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.cpz-map-detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.5rem;
  margin: 0;
  font-size: 0.82rem;
}

.cpz-map-detail-list dt {
  color: var(--fluent-text-muted);
  font-weight: 500;
}

.cpz-map-detail-list dd {
  margin: 0;
  word-break: break-word;
}

.cpz-map-detail-thumb {
  display: block;
  max-height: 96px;
  max-width: 100%;
  border: 1px solid var(--fluent-border);
  border-radius: 4px;
  cursor: zoom-in;
  margin-top: 0.6rem;
}

.cpz-map-hint,
.cpz-map-note {
  color: var(--fluent-text-muted);
  font-size: 0.78rem;
}

.cpz-map-svg {
  display: block;
  cursor: grab;
  user-select: none;
}

.cpz-map-svg.cpz-map-dragging {
  cursor: grabbing;
}

.cpz-map-fabric {
  fill: #eceff1;
  stroke: var(--fluent-border);
}

.cpz-map-usable {
  fill: rgba(26, 26, 46, 0.14);
  stroke: var(--fluent-primary);
  stroke-width: 1.5;
}

.cpz-map-axis-line {
  stroke: rgba(26, 26, 46, 0.35);
  stroke-dasharray: 4 4;
}

.cpz-map-tick {
  stroke: var(--fluent-text-muted);
}

.cpz-map-tick-label,
.cpz-map-side-label {
  fill: var(--fluent-text-muted);
  font-size: 11px;
}

.cpz-map-empty {
  fill: var(--fluent-text-muted);
  font-size: 13px;
}

.cpz-map-defect {
  fill: rgba(198, 40, 40, 0.55);
  stroke: var(--fluent-danger);
  cursor: pointer;
}

.cpz-map-defect-cluster {
  fill: rgba(198, 40, 40, 0.3);
}

.cpz-map-defect-selected {
  fill: rgba(198, 40, 40, 0.8);
  stroke-width: 2;
}

.cpz-map-badge-line {
  stroke: var(--fluent-danger);
}

.cpz-map-badge {
  cursor: pointer;
}

.cpz-map-badge circle {
  fill: var(--fluent-danger);
  stroke: var(--fluent-surface);
  stroke-width: 1.5;
}

.cpz-map-badge text {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 600;
}

.cpz-map-badge-cluster circle {
  fill: var(--fluent-primary);
}

@media (max-width: 991.98px) {
  .cpz-map-body {
    flex-direction: column;
  }

  .cpz-map-detail {
    width: auto;
    flex: 0 0 auto;
  }
}

/* ===== Immagini difetti: anteprime nelle griglie ===== */
.cpz-defect-image-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  width: 64px;
}

.cpz-defect-image-thumb {
  max-height: 48px;
  max-width: 64px;
  border: 1px solid var(--fluent-border);
  border-radius: 4px;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background-color: var(--fluent-surface);
}

.cpz-defect-image-thumb:hover {
  transform: scale(1.04);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.cpz-defect-image-missing {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fluent-text-muted);
  border: 1px dashed var(--fluent-border);
  border-radius: 4px;
  background-color: var(--fluent-surface-alt);
  font-size: 14px;
}

/* ===== Lightbox immagine difetto ===== */
.cpz-img-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.72);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}

.cpz-img-modal-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: default;
}

.cpz-img-modal-img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  background-color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cpz-img-modal-cap {
  color: #f2f2f2;
  font-size: 0.85rem;
  max-width: 90vw;
  text-align: center;
  word-break: break-word;
}

/* Zoom/pan: nessuna selezione testo né drag nativo dell'immagine. */
.cpz-img-modal-img {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.cpz-img-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  cursor: default;
}

.cpz-img-modal-toolbar button {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  background-color: transparent;
  color: #f2f2f2;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
}

.cpz-img-modal-toolbar button:hover {
  border-color: rgba(255, 255, 255, 0.7);
  color: #ffffff;
}

.cpz-img-modal-toolbar button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
}

.cpz-img-modal-hint {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  margin-left: 0.4rem;
}

.cpz-img-modal-img.cpz-zoomable {
  cursor: grab;
}

.cpz-img-modal-img.cpz-zoomable.cpz-panning {
  cursor: grabbing;
}

/* ===== Titolo foto difetto nel dettaglio mappa ===== */
.cpz-map-detail-image-title {
  margin-top: 0.7rem;
  font-weight: 600;
  color: var(--fluent-text);
  font-size: 0.82rem;
}

/* ===== Overview / Minimap mappa ===== */
.cpz-map-overview-wrap {
  border: 1px solid var(--fluent-border);
  border-radius: var(--fluent-radius);
  background-color: var(--fluent-surface-alt);
  padding: 0.5rem 0.75rem 0.25rem 0.75rem;
  margin-bottom: 0.75rem;
}

.cpz-map-overview-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fluent-text);
  margin-bottom: 0.25rem;
}

.cpz-map-overview-hint {
  font-size: 0.72rem;
  color: var(--fluent-text-muted);
  margin-top: 0.2rem;
}

.cpz-map-overview {
  width: 100%;
}

.cpz-map-overview-svg {
  display: block;
  cursor: pointer;
  user-select: none;
}

.cpz-map-overview-band {
  fill: #eceff1;
  stroke: var(--fluent-border);
}

.cpz-map-overview-defect {
  fill: rgba(198, 40, 40, 0.55);
}

.cpz-map-overview-defect-selected {
  fill: rgba(26, 26, 46, 0.9);
}

.cpz-map-overview-window {
  fill: rgba(255, 152, 0, 0.22);
  stroke: #ff9800;
  stroke-width: 1.5;
  cursor: grab;
}

.cpz-map-overview-window:hover {
  fill: rgba(255, 152, 0, 0.32);
}

.cpz-map-overview-handle {
  fill: #ff9800;
  cursor: ew-resize;
}

.cpz-map-overview-label {
  font-size: 10.5px;
  fill: var(--fluent-text-muted);
  font-weight: 500;
}

/* Rispetta le preferenze di motion dell'utente */
@media (prefers-reduced-motion: reduce) {
  .app-sidebar {
    transition: none;
  }
  .app-sidebar .sidebar-link {
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  }
}
