:root {
  --background: 250 250 250;
  --foreground: 26 26 26;
  --card: 255 255 255;
  --card-foreground: 26 26 26;
  --primary: 211 47 47;
  --primary-hover: 183 28 28;
  --primary-foreground: 255 255 255;
  --muted: 240 240 240;
  --muted-foreground: 117 117 117;
  --border: 220 220 220;
  --ring: 211 47 47;
  --radius: 0.75rem;
}
.env-local { --env-color: 34 197 94; }
.env-staging { --env-color: 234 179 8; }
.env-production { --env-color: 239 68 68; }
.env-badge { background: rgb(var(--env-color)); color: #fff; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
.watermark { position: fixed; inset: 0; z-index: 0; opacity: 0.07; pointer-events: none; background-repeat: repeat; background-size: 220px 220px; }
.bg-background { background-color: rgb(var(--background)); }
.text-foreground { color: rgb(var(--foreground)); }
.bg-card { background-color: rgb(var(--card)); }
.text-muted-foreground { color: rgb(var(--muted-foreground)); }
.bg-primary { background-color: rgb(var(--primary)); }
.text-primary { color: rgb(var(--primary)); }
.text-white { color: #fff; }
.bg-primary-hover { background-color: rgb(var(--primary-hover)); }
.bg-muted { background-color: rgb(var(--muted)); }
.border-border { border-color: rgb(var(--border)); }
.font-sans { font-family: 'Inter', system-ui, sans-serif; }
.antialiased { -webkit-font-smoothing: antialiased; }
.min-h-screen { min-height: 100vh; }
.mt-auto { margin-top: auto; }
.flex { display: flex; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-12 { width: 3rem; }
.w-20 { width: 5rem; }
.w-64 { width: 16rem; }
.w-full { width: 100%; }
.w-auto { width: auto; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.h-auto { height: auto; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-7xl { max-width: 80rem; }
.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-4xl { font-size: 2.25rem; }
.text-6xl { font-size: 3.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.025em; }
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1); }
.overflow-hidden { overflow: hidden; }
.overflow-x-hidden { overflow-x: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transition-colors { transition: background-color 0.2s, color 0.2s; }
.backdrop-blur { backdrop-filter: blur(8px); }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-10000 { z-index: 10000; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.absolute { position: absolute; }
.relative { position: relative; }
.top-0 { top: 0; }
.top-4 { top: 1rem; }
.top-\[60px\] { top: 60px; }
.right-0 { right: 0; }
.right-4 { right: 1rem; }
.left-0 { left: 0; }
.bottom-0 { bottom: 0; }
.bottom-4 { bottom: 1rem; }
.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.underline { text-decoration: underline; }
body.impersonating {
  outline: 4px solid rgb(var(--primary));
  outline-offset: -4px;
}
body.impersonating .env-badge {
  background: rgb(var(--primary-hover)) !important;
}
.card {
  background-color: rgb(var(--card));
  border: 1px solid rgb(var(--border));
}
.prose { line-height: 1.7; }
.prose p { margin-bottom: 1rem; }
.flash { padding: 0.75rem 1rem; border-radius: 0.5rem; margin-bottom: 1rem; }
.flash-success { background: rgb(240 253 244); color: rgb(20 83 45); }
.flash-danger { background: rgb(254 242 242); color: rgb(127 29 29); }
.flash-warning { background: rgb(255 255 240); color: rgb(146 64 14); }
.flash-info { background: rgb(240 249 255); color: rgb(30 64 80); }
.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; }

.bg-white\/{90} { background-color: rgba(255, 255, 255, 0.9); }
.bg-primary\/{10} { background-color: rgba(211, 47, 47, 0.1); }
.bg-muted\/{50} { background-color: rgba(240, 240, 240, 0.5); }
.bg-primary\/{20} { background-color: rgba(211, 47, 47, 0.2); }
.border-primary\/{20} { border-color: rgba(211, 47, 47, 0.2); }
.border-primary\/{10} { border-color: rgba(211, 47, 47, 0.1); }
.text-red-600 { color: rgb(220 38 38); }
.bg-red-50 { background-color: rgb(254 242 242); }
.border-red-200 { border-color: rgb(254 226 226); }
.bg-green-50 { background-color: rgb(240 253 244); }
.border-green-200 { border-color: rgb(220 252 231); }
.bg-yellow-50 { background-color: rgb(255 255 240); }
.border-yellow-200 { border-color: rgb(255 253 208); }
.bg-blue-50 { background-color: rgb(240 249 255); }
.border-blue-200 { border-color: rgb(191 232 255); }

/* Layout responsive condiviso: le classi utility presenti nei template non
   richiedono un framework CSS esterno per funzionare. */
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
img, svg { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
main { width: 100%; min-width: 0; }
.brand-lockup { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; text-decoration: none; }
.brand-logo { display: block; width: auto; object-fit: contain; object-position: left center; flex: 0 0 auto; }
.brand-logo-public { height: 36px; max-width: min(43vw, 138px); }
.brand-logo-app { height: 32px; max-width: min(38vw, 146px); }
.brand-name { overflow: hidden; color: rgb(var(--foreground)); font-size: 1.05rem; font-weight: 750; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.public-nav-inner { display: flex; width: min(100% - 2rem, 80rem); min-height: 4.25rem; align-items: center; justify-content: space-between; gap: 1rem; margin-inline: auto; }
.public-links, .public-actions { display: flex; align-items: center; gap: clamp(.65rem, 1.5vw, 1.5rem); }
.public-links { color: rgb(var(--muted-foreground)); font-size: .875rem; }
.public-links a { color: inherit; text-decoration: none; white-space: nowrap; }
.public-links a:hover { color: rgb(var(--primary)); }
.public-actions > * { white-space: nowrap; }
.page-main { min-height: 65vh; }
.app-shell { display: flex; min-height: calc(100dvh - 4rem); }
.app-sidebar { position: sticky; top: 4rem; z-index: 30; display: flex; width: 16rem; height: calc(100dvh - 4rem); flex: 0 0 16rem; flex-direction: column; overflow-y: auto; border-right: 1px solid rgb(var(--border)); background: rgb(var(--card)); }
.app-main { flex: 1 1 auto; min-width: 0; min-height: calc(100dvh - 4rem); overflow-x: auto; padding: clamp(1rem, 2.5vw, 2rem); padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
.organization-chip { display: flex; min-width: 0; align-items: center; gap: .5rem; padding: .5rem .75rem; border: 1px solid rgb(var(--border)); border-radius: .75rem; background: rgb(var(--muted)); font-size: .875rem; }
.organization-chip span { max-width: 18rem; }
.desktop-account { display: flex; align-items: center; gap: .8rem; }
.menu-toggle, .mobile-logout { display: inline-flex; width: 2.75rem; height: 2.75rem; align-items: center; justify-content: center; border: 1px solid rgb(var(--border)); border-radius: .7rem; background: rgb(var(--card)); color: rgb(var(--foreground)); }
.mobile-logout { display: none; text-decoration: none; }
.mobile-nav { display: none; }
.sidebar-scrim { display: none; }
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.directory-toolbar { gap: 1rem; }
.directory-search { width: min(100%, 20rem); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.grid-cols-1 { grid-template-columns: minmax(0, 1fr); }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.overflow-hidden { overflow: hidden; }
.rounded-md { border-radius: .375rem; }
.rounded-lg { border-radius: .5rem; }
.rounded-xl { border-radius: .75rem; }
.border-collapse { border-collapse: collapse; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: .25rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: .5rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: .75rem; }
.max-w-xs { max-width: 20rem; }
.hover\:bg-muted:hover { background-color: rgb(var(--muted)); }
.hover\:text-primary:hover { color: rgb(var(--primary)); }
.border-primary\/20 { border-color: rgb(var(--primary) / .2); }
.bg-primary\/10 { background-color: rgb(var(--primary) / .1); }
.card { min-width: 0; }
table { border-collapse: collapse; }
td, th { overflow-wrap: anywhere; }
input, select, textarea { max-width: 100%; }

@media (max-width: 767px) {
  body { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)); }
  .public-nav-inner { min-height: 3.8rem; gap: .5rem; }
  .brand-logo-public { height: 32px; max-width: 34vw; }
  .brand-name { font-size: .95rem; }
  .public-links { display: none; }
  .public-actions { gap: .4rem; }
  .public-actions > * { padding: .55rem .75rem !important; font-size: .8rem !important; }
  body.impersonating .fixed.top-\[60px\] { position: relative !important; top: auto !important; padding: .65rem 1rem !important; }
  .env-badge { bottom: .35rem !important; right: .4rem !important; z-index: 51 !important; padding: .12rem .35rem !important; font-size: .55rem !important; }
  .app-shell { display: block; min-height: calc(100dvh - 7rem); }
  .app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 70; display: flex; width: min( min(19rem, 86vw), 20rem); height: 100dvh; padding-top: env(safe-area-inset-top); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 0 transparent; }
  .app-sidebar.is-open { transform: translateX(0); box-shadow: 0 0 2rem rgb(0 0 0 / .18); }
  body.navigation-open { overflow: hidden; }
  .app-sidebar nav a { min-height: 2.9rem; }
  .sidebar-scrim.is-visible { position: fixed; inset: 0; z-index: 60; display: block; width: 100%; height: 100%; border: 0; background: rgb(15 23 42 / .45); }
  .app-main { min-height: calc(100dvh - 7rem); padding: 1rem; padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
  .organization-chip { display: none; }
  .desktop-account { display: none; }
  .mobile-logout { display: inline-flex; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 50; display: flex; min-height: calc(4rem + env(safe-area-inset-bottom)); align-items: center; justify-content: space-around; padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom)); border-top: 1px solid rgb(var(--border)); background: rgb(var(--card) / .97); backdrop-filter: blur(14px); }
  .mobile-nav a { display: flex; min-width: 3.5rem; min-height: 3.2rem; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; font-size: .68rem; text-decoration: none; }
  .mobile-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-nav svg { width: 1.25rem; height: 1.25rem; }
  .app-main table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }
  .app-main table td, .app-main table th { white-space: nowrap; }
  .app-main [class~="grid"] { grid-template-columns: minmax(0, 1fr); }
  .app-main h1 { font-size: clamp(1.35rem, 6vw, 1.75rem); line-height: 1.2; }
  .app-main .flex.items-center.justify-between { flex-wrap: wrap; gap: .75rem; }
  .directory-toolbar { align-items: stretch; flex-direction: column; }
  .directory-search { width: 100%; }
  footer > div { padding-inline: 1rem; text-align: center; }
}

@media (min-width: 480px) and (max-width: 767px) {
  .app-main [class~="grid"].sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .app-shell { display: flex; }
  .app-sidebar { position: sticky; }
  .mobile-nav, .sidebar-scrim, .mobile-logout, .menu-toggle { display: none; }
  .app-main [class~="grid"].sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-main [class~="grid"].lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-main [class~="grid"].lg\:grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
}

@media (min-width: 1100px) {
  .app-main [class~="grid"].lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-main [class~="grid"].lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .public-links { gap: 1.5rem; }
}

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
