:root {
  --bg: #f2f3f5;
  --surface: #fff;
  --text: #181a1d;
  --muted: #71767e;
  --line: #dde0e4;
  --accent: #ec7926;
  --accent-dark: #c95c0e;
  --success: #16834b;
  --shadow: 0 28px 80px rgba(20, 24, 30, .12);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, Montserrat, system-ui, -apple-system, sans-serif;
}

.auth-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1.1fr .9fr;
}

.intro-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(40px, 8vw, 120px);
  background:
    radial-gradient(circle at 20% 15%, rgba(236,121,38,.2), transparent 28rem),
    #181a1d;
  color: #fff;
}

.brand-mark,
.brand-small {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  font-weight: 850;
}

.brand-mark {
  width: 92px;
  height: 92px;
  margin-bottom: 50px;
  border-radius: 24px;
  font-size: 31px;
}

.brand-small {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.intro-panel h1 {
  margin: 14px 0 25px;
  font-size: clamp(52px, 7vw, 94px);
  line-height: .9;
  letter-spacing: -.06em;
}

.intro-panel p,
.welcome p,
.module-card p {
  color: var(--muted);
  line-height: 1.65;
}

.intro-panel p {
  max-width: 620px;
  color: #adb2b9;
  font-size: 19px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 35px;
}

.login-box {
  width: min(440px, 100%);
  padding: 48px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-box h2 {
  margin: 12px 0 8px;
  font-size: 34px;
  letter-spacing: -.04em;
}

.login-intro {
  margin: 0 0 30px;
  color: var(--muted);
}

label {
  display: block;
  margin: 19px 0 8px;
  font-size: 14px;
  font-weight: 750;
}

input {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(236,121,38,.12);
}

:focus-visible { outline: 3px solid rgba(201,92,14,.5); outline-offset: 3px; }
.auth-link { display: block; margin-top: 20px; color: var(--accent-dark); font-weight: 750; text-align: center; }
.auth-link-secondary { margin-top: 12px; color: var(--muted); font-size: 14px; }
.field-help { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.alert-success { border-color: #9fd6b8; color: #126c3e; background: #eefaf3; }

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

form button {
  width: 100%;
  margin-top: 25px;
  padding: 15px;
  border-radius: 12px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

form button:hover { background: var(--accent-dark); }

small {
  display: block;
  margin-top: 24px;
  color: var(--muted);
  line-height: 1.5;
}

.alert {
  margin-bottom: 20px;
  padding: 13px 15px;
  border: 1px solid #efc3be;
  border-radius: 12px;
  color: #9b241c;
  background: #fff0ee;
  font-size: 14px;
  font-weight: 700;
}

.dashboard-body { background: #f4f5f7; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand,
.account {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand {
  color: var(--text);
  text-decoration: none;
}

.account {
  color: var(--muted);
  font-size: 14px;
}

.logout-button {
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text);
  background: #f0f1f3;
  font-weight: 750;
}

.dashboard {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 65px 0;
}

.welcome {
  padding: clamp(30px, 5vw, 55px);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(20,24,30,.07);
}

.welcome h1 {
  margin: 12px 0 15px;
  font-size: clamp(38px, 6vw, 68px);
  letter-spacing: -.055em;
}

.welcome p {
  max-width: 700px;
  margin: 0;
  font-size: 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.module-card {
  min-height: 235px;
  padding: 27px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
}

.module-number {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .14em;
}

.module-card h2 {
  margin: 29px 0 10px;
  font-size: 20px;
}

.badge {
  display: inline-block;
  margin-top: 14px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #f0f1f3;
  font-size: 12px;
  font-weight: 750;
}

.system-card {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
}

.system-card div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--success);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(22,131,75,.12);
}

@media (max-width: 950px) {
  .auth-layout { grid-template-columns: 1fr; }
  .intro-panel { min-height: 42vh; }
  .brand-mark { margin-bottom: 28px; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .intro-panel { padding: 38px 25px; }
  .login-panel { padding: 18px; }
  .login-box { padding: 32px 23px; }
  .topbar { padding: 14px 18px; }
  .brand strong { display: none; }
  .account { align-items: flex-end; flex-direction: column; gap: 6px; }
  .dashboard { width: min(100% - 24px, 1180px); padding: 24px 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .system-card { flex-direction: column; }
}

/* ===== DASHBOARD SIDEBAR START ===== */

.dashboard-body {
  min-height: 100vh;
  background: #f3f4f6;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 25px 18px 18px;
  overflow-y: auto;
  color: #fff;
  background:
    radial-gradient(
      circle at 10% 0,
      rgba(236, 121, 38, .16),
      transparent 280px
    ),
    #181a1d;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 58px;
  padding: 0 10px 22px;
}

.sidebar-logo {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #ec7926, #c95c0e);
  font-size: 15px;
  font-weight: 850;
}

.sidebar-brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: -.01em;
}

.sidebar-brand span {
  display: block;
  margin-top: 3px;
  color: #92979f;
  font-size: 12px;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-link {
  display: grid;
  min-height: 48px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  color: #b9bdc3;
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
  transition:
    background .18s ease,
    color .18s ease,
    transform .18s ease;
}

.sidebar-link.active {
  color: #fff;
  background: #ec7926;
  box-shadow: 0 9px 24px rgba(236, 121, 38, .23);
}

.sidebar-link:not(.sidebar-link-disabled):hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
  transform: translateX(2px);
}

.sidebar-link.active:hover {
  background: #ec7926;
}

.sidebar-link-disabled {
  cursor: default;
  opacity: .72;
}

.sidebar-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  font-size: 10px;
  font-weight: 850;
}

.sidebar-link.active .sidebar-icon {
  background: rgba(255, 255, 255, .18);
}

.sidebar-link small {
  margin: 0;
  padding: 4px 6px;
  border-radius: 999px;
  color: #868b92;
  background: rgba(255, 255, 255, .06);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.sidebar-separator {
  height: 1px;
  margin: 12px 10px;
  background: rgba(255, 255, 255, .08);
}

.sidebar-account {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  padding: 15px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-user-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: #ec7926;
  background: rgba(236, 121, 38, .13);
  font-size: 12px;
  font-weight: 850;
}

.sidebar-user-data {
  min-width: 0;
}

.sidebar-user-data strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-data span {
  display: block;
  margin-top: 3px;
  color: #777d85;
  font-size: 10px;
}

.sidebar-logout {
  padding: 8px 10px;
  border-radius: 9px;
  color: #c7c9cd;
  background: rgba(255, 255, 255, .07);
  font-size: 11px;
  font-weight: 750;
}

.sidebar-logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, .13);
}

.app-content {
  min-width: 0;
  padding: 48px clamp(24px, 4vw, 62px) 28px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  gap: 35px;
  align-items: flex-start;
  max-width: 1350px;
  margin: 0 auto 30px;
}

.content-eyebrow {
  display: block;
  margin-bottom: 9px;
  color: #dc6815;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.content-header h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1;
  letter-spacing: -.055em;
}

.content-header p {
  max-width: 680px;
  margin: 16px 0 0;
  color: #757a82;
  font-size: 16px;
  line-height: 1.6;
}

.header-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 11px 14px;
  border: 1px solid #dce1e4;
  border-radius: 999px;
  color: #16834b;
  background: #fff;
  font-size: 12px;
  font-weight: 750;
}

.summary-grid {
  display: grid;
  max-width: 1350px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0 auto;
}

.summary-card {
  min-height: 170px;
  padding: 23px;
  border: 1px solid #dde1e5;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 32px rgba(20, 24, 30, .035);
}

.summary-label {
  display: block;
  color: #777c84;
  font-size: 12px;
  font-weight: 720;
}

.summary-card strong {
  display: block;
  margin: 22px 0 8px;
  font-size: 43px;
  line-height: 1;
  letter-spacing: -.045em;
}

.summary-card small {
  margin: 0;
  color: #9a9ea4;
  font-size: 11px;
}

.dashboard-section {
  max-width: 1350px;
  margin: 22px auto 0;
  padding: 28px;
  border: 1px solid #dde1e5;
  border-radius: 20px;
  background: #fff;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -.035em;
}

.module-list {
  display: flex;
  flex-direction: column;
}

.module-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 98px;
  padding: 18px 4px;
  border-top: 1px solid #eceef0;
}

.module-row:first-child {
  border-top: 0;
}

.module-row-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: #dc6815;
  background: #fff3ea;
  font-size: 11px;
  font-weight: 850;
}

.module-row-content h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.module-row-content p {
  margin: 0;
  color: #7b8087;
  font-size: 13px;
  line-height: 1.5;
}

.module-status {
  padding: 7px 10px;
  border-radius: 999px;
  color: #787d84;
  background: #f0f1f3;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.module-status-disabled {
  color: #a55a25;
  background: #fff2e8;
}

.content-footer {
  display: flex;
  max-width: 1350px;
  justify-content: space-between;
  gap: 20px;
  margin: 22px auto 0;
  padding: 0 4px;
  color: #92969d;
  font-size: 11px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 235px minmax(0, 1fr);
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 16px;
  }

  .sidebar-brand {
    padding-bottom: 14px;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    overflow-x: auto;
    padding: 13px 0 5px;
  }

  .sidebar-link {
    min-width: 150px;
  }

  .sidebar-separator {
    display: none;
  }

  .sidebar-account {
    margin-top: 12px;
    padding-top: 12px;
  }

  .app-content {
    padding: 28px 15px;
  }

  .content-header {
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-section {
    padding: 20px 16px;
  }

  .module-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .module-status {
    grid-column: 2;
    justify-self: start;
  }

  .content-footer {
    flex-direction: column;
  }
}

/* ===== DASHBOARD SIDEBAR END ===== */

/* ===== USER MANAGEMENT START ===== */

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar-icon i,
.module-row-number i {
  font-size: 17px;
  font-weight: 400;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sidebar-logout i {
  font-size: 15px;
}

.button-primary,
.button-secondary,
.icon-button,
.dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 11px;
  font-weight: 800;
  transition: background .18s ease, transform .18s ease, opacity .18s ease;
}

.button-primary {
  min-height: 46px;
  padding: 0 17px;
  color: #fff;
  background: var(--accent);
}

.button-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.button-secondary {
  min-height: 44px;
  padding: 0 16px;
  color: #4f545b;
  background: #eff1f3;
}

.button-secondary:hover {
  background: #e4e7ea;
}

.button-primary:disabled,
.button-secondary:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: .55;
  transform: none;
}

.users-header {
  align-items: center;
}

.users-summary {
  display: grid;
  max-width: 1350px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0 auto;
}

.users-summary article {
  min-height: 116px;
  padding: 21px 23px;
  border: 1px solid #dde1e5;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 10px 32px rgba(20, 24, 30, .035);
}

.users-summary span {
  display: block;
  color: #777c84;
  font-size: 12px;
  font-weight: 720;
}

.users-summary strong {
  display: block;
  margin-top: 17px;
  font-size: 31px;
  line-height: 1;
  letter-spacing: -.04em;
}

.users-section {
  padding: 0;
  overflow: hidden;
}

.users-section-heading {
  align-items: center;
  margin: 0;
  padding: 27px 28px 22px;
}

.users-feedback {
  min-height: 34px;
  padding: 9px 12px;
  border-radius: 999px;
  color: #16834b;
  background: #edf8f2;
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
}

.users-feedback.visible {
  opacity: 1;
  transform: translateY(0);
}

.users-table-wrap {
  overflow-x: auto;
  border-top: 1px solid #eceef0;
}

.users-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: 17px 20px;
  border-bottom: 1px solid #eceef0;
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  color: #858a91;
  background: #fafbfc;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.users-table td {
  color: #5f646b;
  font-size: 12px;
}

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

.users-table tbody tr:hover td {
  background: #fcfcfd;
}

.table-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 11px;
  color: #dc6815;
  background: #fff1e7;
  font-size: 11px;
  font-weight: 850;
}

.table-user strong,
.table-user span {
  display: block;
}

.table-user strong {
  color: #202226;
  font-size: 12px;
}

.table-user div > span {
  margin-top: 4px;
  color: #989ca2;
  font-size: 10px;
}

.role-badge,
.status-badge,
.access-complete,
.permission-tags span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.role-badge,
.status-badge,
.access-complete {
  padding: 7px 9px;
}

.role-superadmin {
  color: #923d00;
  background: #fff0e4;
}

.role-admin {
  color: #284f8b;
  background: #edf4ff;
}

.role-collaboratore {
  color: #5f566f;
  background: #f2eff7;
}

.status-active {
  color: #16834b;
  background: #edf8f2;
}

.status-inactive {
  color: #8a4a27;
  background: #fff1e9;
}

.access-complete {
  color: #246344;
  background: #edf8f2;
}

.permission-tags {
  display: flex;
  max-width: 320px;
  flex-wrap: wrap;
  gap: 5px;
}

.permission-tags span {
  padding: 6px 8px;
  color: #656a72;
  background: #f0f2f4;
}

.muted-cell {
  color: #9a9ea4 !important;
}

.table-actions {
  width: 64px;
  text-align: right !important;
}

.icon-button,
.dialog-close {
  width: 36px;
  height: 36px;
  padding: 0;
  color: #5f646b;
  background: #f0f2f4;
}

.icon-button:hover,
.dialog-close:hover {
  color: #fff;
  background: var(--accent);
}

.users-loading {
  padding: 45px 20px !important;
  color: #92969d !important;
  text-align: center !important;
}

.user-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 34px 100px rgba(10, 13, 18, .3);
}

.user-dialog::backdrop {
  background: rgba(13, 16, 21, .62);
  backdrop-filter: blur(3px);
}

.user-form {
  padding: 28px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -.04em;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

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

.user-form input,
.user-form select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fafafa;
  font: inherit;
  outline: none;
}

.user-form select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #747980 50%),
    linear-gradient(135deg, #747980 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.user-form input:focus,
.user-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(236, 121, 38, .12);
}

.user-form input:disabled,
.user-form select:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.field-help {
  margin: 7px 0 0;
  font-size: 10px;
}

.form-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #efc3be;
  border-radius: 11px;
  color: #9b241c;
  background: #fff0ee;
  font-size: 12px;
  font-weight: 750;
}

.active-setting,
.full-access-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding: 17px;
  border: 1px solid #e3e6e9;
  border-radius: 14px;
  background: #fafbfc;
}

.active-setting strong,
.active-setting span,
.full-access-note strong,
.full-access-note span,
.permissions-heading strong,
.permissions-heading span {
  display: block;
}

.active-setting strong,
.full-access-note strong,
.permissions-heading strong {
  font-size: 13px;
}

.active-setting div > span,
.full-access-note div > span,
.permissions-heading div > span {
  margin-top: 4px;
  color: #858a91;
  font-size: 11px;
  line-height: 1.5;
}

.switch {
  position: relative;
  display: block;
  width: 46px;
  height: 26px;
  flex: 0 0 46px;
  margin: 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c8ccd1;
  transition: background .18s ease;
}

.switch span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(20, 24, 30, .2);
  content: '';
  transition: transform .18s ease;
}

.switch input:checked + span {
  background: var(--success);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.switch input:disabled + span {
  cursor: not-allowed;
  opacity: .6;
}

.permissions-section {
  margin-top: 24px;
}

.permissions-heading {
  margin-bottom: 13px;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.permission-option {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 82px;
  margin: 0;
  padding: 13px;
  border: 1px solid #e1e4e7;
  border-radius: 13px;
  background: #fff;
  cursor: pointer;
}

.permission-option:hover {
  border-color: #efb388;
  background: #fffaf6;
}

.permission-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.permission-option:has(input:checked) {
  border-color: #ec7926;
  background: #fff7f1;
  box-shadow: 0 0 0 3px rgba(236, 121, 38, .09);
}

.permission-option-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: #dc6815;
  background: #fff0e4;
  font-size: 18px;
}

.permission-option strong,
.permission-option small {
  display: block;
}

.permission-option strong {
  color: #25282c;
  font-size: 12px;
}

.permission-option small {
  margin: 4px 0 0;
  color: #858a91;
  font-size: 10px;
  line-height: 1.4;
}

.full-access-note {
  justify-content: flex-start;
  color: #246344;
  background: #f3faf6;
}

.full-access-note > i {
  font-size: 24px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 27px;
  padding-top: 20px;
  border-top: 1px solid #eceef0;
}

.user-form .dialog-actions button {
  width: auto;
  margin-top: 0;
  padding-right: 17px;
  padding-left: 17px;
}

@media (max-width: 1100px) {
  .users-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .users-header {
    align-items: flex-start;
  }

  .users-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .users-feedback {
    align-self: stretch;
    text-align: center;
  }
}

@media (max-width: 620px) {
  .users-summary,
  .user-form-grid,
  .permissions-grid {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: auto;
  }

  .user-dialog {
    width: calc(100% - 18px);
    max-height: calc(100vh - 18px);
    border-radius: 17px;
  }

  .user-form {
    padding: 21px 17px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .user-form .dialog-actions button {
    width: 100%;
  }
}

/* ===== USER MANAGEMENT END ===== */

/* ===== MAIL SETTINGS START ===== */
.settings-warning {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid #e7c56d;
  border-radius: 14px;
  color: #765412;
  background: #fff8df;
  line-height: 1.5;
}

.settings-warning i { margin-top: 2px; font-size: 20px; }
.users-summary .summary-wide { grid-column: span 2; }
.users-summary .summary-wide strong { overflow: hidden; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.mail-list { display: grid; gap: 16px; }
.mail-card { padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.mail-card-heading, .mail-actions, .mail-badges { display: flex; align-items: center; gap: 10px; }
.mail-card-heading { justify-content: space-between; }
.mail-card h3 { margin: 0 0 5px; font-size: 20px; }
.mail-card p { margin: 0; color: var(--muted); }
.default-badge { padding: 7px 10px; border-radius: 999px; color: #8a5b00; background: #fff2c6; font-size: 12px; font-weight: 800; }
.mail-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 22px 0; padding: 18px; border-radius: 13px; background: #f6f7f8; }
.mail-detail-grid span, .mail-detail-grid strong { display: block; }
.mail-detail-grid span { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.mail-detail-grid strong { overflow-wrap: anywhere; font-size: 14px; }
.mail-test { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 13px; }
.mail-test.success { color: var(--success); }
.mail-test.failed { color: #a12b24; }
.mail-test span { margin-left: 5px; color: var(--muted); }
.mail-actions { flex-wrap: wrap; margin-top: 20px; }
.mail-actions button { display: inline-flex; gap: 7px; align-items: center; width: auto; margin: 0; padding: 9px 12px; }
.button-danger { border: 1px solid #efc3be; border-radius: 10px; color: #9b241c; background: #fff0ee; font-weight: 750; }
.mail-dialog { max-width: 820px; }
.mail-form-grid { grid-template-columns: repeat(2, 1fr); }
.mail-toggles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

@media (max-width: 760px) {
  .users-summary .summary-wide { grid-column: span 2; }
  .mail-detail-grid { grid-template-columns: repeat(2, 1fr); }
  .mail-card-heading { align-items: flex-start; flex-direction: column; }
  .mail-form-grid, .mail-toggles { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .users-summary .summary-wide { grid-column: auto; }
  .mail-detail-grid { grid-template-columns: 1fr; }
  .mail-actions { display: grid; grid-template-columns: 1fr; }
  .mail-actions button { justify-content: center; width: 100%; }
}
/* ===== MAIL SETTINGS END ===== */

/* ===== GESTIONALE UI REVISION ===== */
:root {
  --app-bg: #f5f6f8;
  --app-surface: #fff;
  --app-text: #202329;
  --app-muted: #626973;
  --app-border: #e0e3e7;
  --app-shadow: 0 4px 18px rgba(20, 24, 30, .045);
  --app-radius: 15px;
  --focus-ring: 0 0 0 4px rgba(236, 121, 38, .22);
  --sidebar-width: 256px;
  --content-max: 1320px;
}
.dashboard-body { color: var(--app-text); background: var(--app-bg); font-size: 14px; }
.dashboard-body .app-shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.dashboard-body .sidebar { width: var(--sidebar-width); padding: 20px 14px 16px; }
.dashboard-body .sidebar-brand { padding: 0 9px 17px; }
.dashboard-body .sidebar-logo { font-weight: 700; }
.dashboard-body .sidebar-nav { gap: 4px; padding-top: 12px; }

.activity-notice { padding: 12px 16px; border: 1px solid #d9e2ec; border-radius: 10px; background: #f8fafc; color: #475569; }
.activity-filters { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin: 22px 0; padding: 20px; background: #fff; border-radius: 14px; box-shadow: 0 8px 28px rgba(15,23,42,.06); }
.activity-filters label { display: grid; gap: 6px; font-size: .82rem; font-weight: 700; color: #475569; }.activity-filters input,.activity-filters select { min-height: 42px; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; }.activity-search { grid-column: span 2; }.activity-filter-actions { grid-column: 1/-1; display:flex; flex-wrap:wrap; gap:10px; }.activity-pagination { display:flex; align-items:center; justify-content:center; gap:16px; padding:20px; }.activity-badge { display:inline-flex; padding:5px 9px; border-radius:999px; font-weight:700; font-size:.78rem; }.activity-success{background:#dcfce7;color:#166534}.activity-failure{background:#fee2e2;color:#991b1b}.activity-warning{background:#ffedd5;color:#9a3412}.activity-details{display:grid;grid-template-columns:minmax(130px,1fr) 2fr;gap:10px 18px}.activity-details dt{font-weight:700}.activity-details dd{margin:0;overflow-wrap:anywhere}
@media (max-width: 900px) { .activity-filters{grid-template-columns:repeat(2,1fr)} .activity-table thead{display:none}.activity-table tr{display:block;margin:12px;border:1px solid #e2e8f0;border-radius:12px;padding:8px}.activity-table td{display:grid;grid-template-columns:120px 1fr;border:0;padding:8px}.activity-table td::before{content:attr(data-label);font-weight:700;color:#64748b} }
@media (max-width: 560px) { .activity-filters{grid-template-columns:1fr}.activity-search{grid-column:auto}.activity-table td{grid-template-columns:95px 1fr}.activity-details{grid-template-columns:1fr}.activity-details dd{margin-bottom:8px} }
.dashboard-body .sidebar-link { min-height: 44px; grid-template-columns: 30px minmax(0, 1fr); padding: 8px 11px; color: #c3c7cd; font-weight: 600; }
.dashboard-body .sidebar-link.active { background: #d96818; box-shadow: 0 3px 10px rgba(0,0,0,.14); }
.dashboard-body .sidebar-link-disabled { color: #92979f; opacity: 1; }
.dashboard-body .sidebar-account { padding: 14px 6px 0; }
.dashboard-body .sidebar-user-data strong { font-size: 12px; font-weight: 600; }
.dashboard-body .sidebar-user-data span { color: #9ba0a7; font-size: 11px; }
.dashboard-body .app-content { padding: 34px clamp(22px, 3.5vw, 50px) 26px; }
.dashboard-body .content-header,
.dashboard-body .summary-grid,
.dashboard-body .users-summary,
.dashboard-body .dashboard-section,
.dashboard-body .content-footer,
.dashboard-body .settings-hint { max-width: var(--content-max); }
.dashboard-body .content-header { margin-bottom: 22px; }
.dashboard-body .content-header h1 { font-size: clamp(40px, 4vw, 44px); font-weight: 700; letter-spacing: -.04em; }
.dashboard-body .content-header p { margin-top: 10px; color: var(--app-muted); font-size: 15px; line-height: 1.55; }
.dashboard-body .content-eyebrow { margin-bottom: 7px; font-weight: 700; }
.dashboard-body .summary-grid { gap: 14px; }
.dashboard-body .summary-card { position: relative; min-height: 124px; padding: 20px 21px; border-color: var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.dashboard-body .summary-icon { position: absolute; top: 18px; right: 19px; color: #d96818; font-size: 20px; }
.dashboard-body .summary-label { color: var(--app-muted); font-size: 13px; font-weight: 600; }
.dashboard-body .summary-card strong { margin: 13px 0 5px; font-size: 34px; font-weight: 700; }
.dashboard-body .summary-card small { color: #737a84; font-size: 12px; }
.dashboard-body .dashboard-section { margin-top: 20px; padding: 22px; border-color: var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.dashboard-body .section-heading h2 { font-size: 23px; font-weight: 700; }
.dashboard-body .module-row { min-height: 80px; padding: 13px 4px; }
.dashboard-body .module-row-content h3 { font-size: 17px; font-weight: 700; }
.dashboard-body .module-row-content p { color: var(--app-muted); font-size: 13px; }
.dashboard-body .module-status { font-size: 12px; font-weight: 600; }
.dashboard-body button, .dashboard-body a { -webkit-tap-highlight-color: transparent; }
.dashboard-body :focus-visible { outline: 2px solid #bc4f04; outline-offset: 3px; box-shadow: var(--focus-ring); }
.mobile-menu-button, .sidebar-close, .sidebar-overlay { display: none; }
.dashboard-body .button-primary, .dashboard-body .button-secondary, .dashboard-body .button-tertiary, .dashboard-body .button-danger { min-height: 43px; padding: 0 15px; font-weight: 650; }
.button-tertiary { border: 1px solid #efb98f; border-radius: 11px; color: #a84808; background: #fff8f2; }
.dashboard-body [aria-busy="true"] span::after { content: '…'; }
.dashboard-body button:disabled { cursor: not-allowed; opacity: .58; }
.dashboard-body .users-summary { gap: 14px; }
.dashboard-body .users-summary article { min-height: 108px; padding: 18px 20px; border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.dashboard-body .users-summary span { color: var(--app-muted); font-size: 13px; font-weight: 600; }
.dashboard-body .users-summary strong { margin-top: 13px; font-size: 32px; font-weight: 700; }
.dashboard-body .users-section-heading { padding: 21px 22px 17px; }
.dashboard-body .users-table { min-width: 900px; }
.dashboard-body .users-table th { color: #59616b; font-size: 11px; font-weight: 700; }
.dashboard-body .users-table td { color: #505862; font-size: 13px; }
.dashboard-body .table-user strong { font-size: 13px; }
.dashboard-body .table-user div > span { color: #747b85; font-size: 11px; }
.dashboard-body .role-badge, .dashboard-body .status-badge, .dashboard-body .access-complete, .dashboard-body .permission-tags span { font-size: 11px; font-weight: 650; }
.dashboard-body .user-dialog { width: min(700px, calc(100% - 28px)); border-radius: 18px; }
.dashboard-body .dialog-heading h2 { font-size: 25px; font-weight: 700; }
.dashboard-body .user-form label { font-weight: 600; }
.dashboard-body .field-help { font-size: 12px; }
.dashboard-body .permission-option small { font-size: 11px; }
.dashboard-body .switch input:focus-visible + span { outline: 2px solid #bc4f04; outline-offset: 3px; }
.settings-hint { display: flex; align-items: center; gap: 7px; margin: 10px auto 0; color: var(--app-muted); font-size: 13px; }
.mail-list { padding: 0 22px 22px; }
.mail-card { padding: 20px; border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.mail-card h3 { font-size: 18px; font-weight: 700; }
.mail-card p { font-size: 13px; }
.mail-detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; padding: 0; background: transparent; }
.mail-detail-group { min-width: 0; padding: 16px; border: 1px solid var(--app-border); border-radius: 12px; background: #fafbfc; }
.mail-detail-group h4 { display: flex; gap: 7px; align-items: center; margin: 0 0 13px; font-size: 14px; font-weight: 700; }
.mail-detail-group h4 i { color: #d96818; font-size: 17px; }
.mail-detail-group dl { display: grid; gap: 10px; margin: 0; }
.mail-detail-group dt { color: var(--app-muted); font-size: 11px; font-weight: 600; }
.mail-detail-group dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 500; line-height: 1.4; }
.mail-actions { align-items: center; }
.mail-actions button { min-height: 42px; }
.mail-danger-zone { margin-left: auto; padding-left: 14px; border-left: 1px solid var(--app-border); }
.default-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 650; }
.users-feedback[data-type="error"] { color: #9b241c; background: #fff0ee; }
.empty-state { display: grid; justify-items: center; gap: 7px; padding: 42px 20px; color: var(--app-muted); text-align: center; }
.empty-state i { color: #d96818; font-size: 28px; }.empty-state strong { color: var(--app-text); font-size: 16px; }
.form-section-heading { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--app-border); }
.form-section-heading:first-child { margin-top: 0; }.form-section-heading > i { color: #d96818; font-size: 20px; }.form-section-heading strong,.form-section-heading span { display: block; }.form-section-heading strong { font-size: 15px; }.form-section-heading span { margin-top: 2px; color: var(--app-muted); font-size: 12px; }.options-heading { margin-top: 22px; }
@media (max-width: 800px) {
  .dashboard-body .app-shell { display: block; }
  .mobile-menu-button { position: sticky; top: 0; z-index: 30; display: inline-flex; width: 100%; min-height: 52px; align-items: center; gap: 8px; padding: 0 18px; border-bottom: 1px solid var(--app-border); color: var(--app-text); background: rgba(255,255,255,.96); font-weight: 650; }
  .sidebar-overlay { position: fixed; z-index: 40; inset: 0; display: block; border: 0; background: rgba(12,15,20,.58); }
  .sidebar-overlay[hidden] { display: none; }
  .dashboard-body .sidebar { position: fixed; z-index: 50; top: 0; left: 0; width: min(320px, 88vw); height: 100dvh; transform: translateX(-105%); transition: transform .22s ease; }
  .menu-open { overflow: hidden; }.menu-open .sidebar { transform: translateX(0); }
  .sidebar-close { position: absolute; top: 14px; right: 12px; display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: #fff; background: rgba(255,255,255,.1); font-size: 21px; }
  .dashboard-body .sidebar-nav { display: flex; overflow: visible; }
  .dashboard-body .sidebar-link { min-width: 0; }
  .dashboard-body .sidebar-account { margin-top: auto; }
  .dashboard-body .app-content { padding: 28px 18px 22px; }
  .dashboard-body .content-header h1 { font-size: clamp(34px, 7vw, 38px); }
  .mail-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .dashboard-body .app-content { padding-inline: 13px; }
  .dashboard-body .content-header { gap: 18px; flex-direction: column; }
  .dashboard-body .content-header h1 { font-size: 30px; }
  .dashboard-body .summary-grid, .dashboard-body .users-summary { grid-template-columns: 1fr 1fr; }
  .dashboard-body .summary-card { min-height: 120px; padding: 17px; }
  .dashboard-body .dashboard-section { padding: 17px; }
  .dashboard-body .users-section { padding: 0; }
  .users-table-wrap { overflow: visible; border-top: 0; }
  .users-table { min-width: 0; }.users-table thead { display: none; }.users-table, .users-table tbody, .users-table tr, .users-table td { display: block; width: 100%; }
  .users-table tbody { display: grid; gap: 12px; padding: 0 13px 14px; }
  .users-table tr { padding: 14px; border: 1px solid var(--app-border); border-radius: 13px; background: #fff; }
  .users-table td { display: grid; grid-template-columns: minmax(105px, 35%) minmax(0, 1fr); align-items: start; padding: 9px 0; border: 0; }
  .users-table td::before { color: var(--app-muted); content: attr(data-label); font-size: 12px; font-weight: 600; }
  .users-table td:first-child { display: block; padding-top: 0; }.users-table td:first-child::before { display: none; }
  .users-table .table-actions { width: 100%; text-align: left !important; }.users-table .icon-button { width: auto; min-width: 44px; padding: 0 13px; }.users-table .icon-button::after { margin-left: 7px; content: 'Modifica'; }
  .users-loading { display: block !important; }.users-loading::before { display: none; }
  .mail-list { padding: 0 13px 13px; }.mail-card { padding: 16px; }.mail-actions { display: grid; grid-template-columns: 1fr; }.mail-actions button { justify-content: center; width: 100%; }.mail-danger-zone { margin: 5px 0 0; padding: 12px 0 0; border-top: 1px solid var(--app-border); border-left: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* ===== WHATSAPP SETTINGS START ===== */
.settings-channel-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; max-width: var(--content-max); margin: 26px auto 16px; }
.settings-channel-heading h2 { margin: 0; font-size: 25px; }
.settings-channel-heading p { max-width: 720px; margin: 7px 0 0; color: var(--app-muted); line-height: 1.5; }
.settings-info { display: flex; gap: 10px; align-items: flex-start; max-width: var(--content-max); margin: 0 auto 16px; padding: 14px 16px; border: 1px solid #b9d8c0; border-radius: 13px; color: #315e3a; background: #f1faf3; line-height: 1.5; }
.settings-info i { margin-top: 2px; font-size: 19px; }
.whatsapp-summary { margin-top: 0; }
.whatsapp-card .mail-actions { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--app-border); }
.whatsapp-card p { display: flex; align-items: center; gap: 4px; }
.whatsapp-card p i { color: #278b45; }
.whatsapp-heading { margin-top: 36px; }
@media (max-width: 620px) {
  .settings-channel-heading { align-items: stretch; flex-direction: column; }
  .settings-channel-heading .button-primary { justify-content: center; width: 100%; }
}
/* ===== WHATSAPP SETTINGS END ===== */
