@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&family=Playfair+Display:wght@400;500;600;700&display=swap");

/* Legacy tokens — src/index.css + tailwind theme */
:root {
  --background: 210 20% 98%;
  --foreground: 215 30% 15%;
  --card: 0 0% 100%;
  --card-foreground: 215 30% 15%;
  --primary: 215 60% 22%;
  --primary-foreground: 0 0% 100%;
  --secondary: 210 15% 93%;
  --secondary-foreground: 215 30% 15%;
  --muted: 210 15% 95%;
  --muted-foreground: 215 10% 45%;
  --accent: 28 85% 55%;
  --accent-foreground: 0 0% 100%;
  --border: 214 20% 88%;
  --input: 214 20% 88%;
  --destructive: 0 72% 38%;
  --destructive-muted: 0 86% 96%;
  --destructive-border: 0 55% 82%;
  --radius: 0.375rem;
  --font-heading: "Playfair Display", Georgia, serif;
  --font-body: "Open Sans", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Layout — .container-narrow, .section-padding from index.css @layer utilities */
.container-narrow {
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
}

.section-padding {
  padding: 4rem 1rem;
}

@media (min-width: 768px) {
  .section-padding {
    padding: 6rem 2rem;
  }
}

/* Flex column layout like Layout.tsx */
.site-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
}

/* Top bar — Header.tsx (hidden < md) */
.site-topbar {
  display: none;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

@media (min-width: 768px) {
  .site-topbar {
    display: block;
  }
}

.site-topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 72rem;
  margin: 0 auto;
}

.site-topbar-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-topbar-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.2s;
}

.site-topbar-links a:hover {
  color: hsl(var(--accent));
}

.icon-sm {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.lang-switch button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  transition: background 0.2s, color 0.2s;
}

.lang-switch button:hover {
  color: hsl(var(--accent));
}

.lang-switch button.is-active {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.lang-switch .sep {
  opacity: 0.5;
}

/* Sticky header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: hsl(0 0% 100% / 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border-bottom: 1px solid hsl(var(--border));
  transition: box-shadow 0.35s ease, background 0.35s ease;
}

.site-header.is-scrolled {
  box-shadow: 0 8px 24px -4px rgb(0 0 0 / 0.12);
  background: hsl(0 0% 100% / 0.98);
}

.site-header-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .site-header-inner {
    height: 5rem;
  }
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo-mark {
  width: 2.5rem;
  height: 2.5rem;
  background: hsl(var(--primary));
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--primary-foreground));
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
}

.site-logo-text .brand-main {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  color: hsl(var(--foreground));
}

.site-logo-text .brand-accent {
  color: hsl(var(--accent));
  margin-left: 0.25rem;
}

.site-logo-tagline {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  display: none;
}

@media (min-width: 640px) {
  .site-logo-tagline {
    display: block;
  }
}

/* Desktop nav */
.site-nav-desktop {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

@media (min-width: 768px) {
  .site-nav-desktop {
    display: flex;
  }
}

.site-nav-desktop a {
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
  color: hsl(var(--foreground));
}

.site-nav-desktop a:hover {
  color: hsl(var(--accent));
}

.site-nav-desktop a.is-active {
  color: hsl(var(--accent));
  font-weight: 600;
}

/* Mobile controls */
.site-nav-mobile-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .site-nav-mobile-toggle {
    display: none;
  }
}

.lang-switch--mobile {
  font-size: 0.75rem;
}

.lang-switch--mobile button {
  padding: 0.125rem 0.375rem;
}

.menu-btn {
  border: none;
  background: transparent;
  padding: 0.5rem;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.icon-md {
  width: 1.25rem;
  height: 1.25rem;
}

/* Mobile menu panel */
.site-nav-mobile {
  display: none;
  border-top: 1px solid hsl(var(--border));
  padding: 0 1rem 1rem;
  background: hsl(var(--card));
}

.site-nav-mobile.is-open {
  display: block;
}

@media (min-width: 768px) {
  .site-nav-mobile {
    display: none !important;
  }
}

.site-nav-mobile a {
  display: block;
  padding: 0.625rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  color: hsl(var(--foreground));
}

.site-nav-mobile a.is-active {
  color: hsl(var(--accent));
}

.site-nav-mobile a:last-child {
  border-bottom: none;
}

/* Footer — Footer.tsx */
.site-footer {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.site-footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding: 3rem 1rem;
  max-width: 72rem;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .site-footer-grid {
    grid-template-columns: repeat(3, 1fr);
    padding: 4rem 1rem;
  }
}

.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.site-footer-mark {
  width: 2.25rem;
  height: 2.25rem;
  background: hsl(var(--accent));
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--accent-foreground));
  font-family: var(--font-heading);
  font-weight: 700;
}

.site-footer-desc {
  font-size: 0.875rem;
  opacity: 0.8;
  line-height: 1.6;
  margin: 0;
}

.site-footer-social {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.site-footer-social a {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: hsl(var(--primary-foreground) / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.site-footer-social a:hover {
  background: hsl(var(--accent));
}

.site-footer h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.125rem;
  margin: 0 0 1rem;
}

.site-footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  opacity: 0.8;
}

.site-footer-links a:hover {
  color: hsl(var(--accent));
}

.site-footer-contact p {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  opacity: 0.8;
  margin: 0 0 0.75rem;
}

.site-footer-contact .icon-sm {
  margin-top: 0.125rem;
}

.site-footer-bar {
  border-top: 1px solid hsl(var(--primary-foreground) / 0.1);
}

.site-footer-bar-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.6;
  text-align: center;
}

@media (min-width: 768px) {
  .site-footer-bar-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

.site-footer-bar-inner a:hover {
  color: hsl(var(--accent));
}

/* Page hero band (inner pages) */
.page-hero {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  text-align: center;
  padding: 4rem 1rem;
}

@media (min-width: 768px) {
  .page-hero {
    padding: 6rem 1rem;
  }
}

.page-hero .eyebrow {
  color: hsl(var(--accent));
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}

.page-hero h1 {
  font-size: 2.25rem;
  margin: 0;
}

@media (min-width: 768px) {
  .page-hero h1 {
    font-size: 3rem;
  }
}

.page-hero .sub {
  color: hsl(var(--primary-foreground) / 0.7);
  margin: 1rem auto 0;
  max-width: 32rem;
}

/* Homepage hero — Index.tsx */
.hero {
  position: relative;
  min-height: 500px;
  height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  will-change: transform;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: hsl(var(--primary) / 0.7);
}

.hero-inner {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 0 1rem;
  max-width: 56rem;
  animation: fade-in-up 0.6s ease-out forwards;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-eyebrow {
  color: hsl(var(--accent));
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

.hero-inner h1 {
  font-size: 1.875rem;
  color: hsl(var(--primary-foreground));
  margin: 0 0 1.5rem;
  line-height: 1.15;
}

@media (min-width: 768px) {
  .hero-inner h1 {
    font-size: 3rem;
  }
}

@media (min-width: 1024px) {
  .hero-inner h1 {
    font-size: 3.75rem;
  }
}

.hero-inner .lead {
  color: hsl(var(--primary-foreground) / 0.8);
  font-size: 1.125rem;
  margin: 0 0 2rem;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  .hero-inner .lead {
    font-size: 1.25rem;
  }
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

@media (min-width: 640px) {
  .hero-actions {
    flex-direction: row;
  }
}

.btn-primary {
  display: inline-block;
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.125rem;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-outline-light {
  display: inline-block;
  border: 2px solid hsl(var(--primary-foreground) / 0.3);
  color: hsl(var(--primary-foreground));
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.125rem;
  transition: background 0.2s;
}

.btn-outline-light:hover {
  background: hsl(var(--primary-foreground) / 0.1);
}

/* About short + grids */
.about-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.about-short-eyebrow {
  color: hsl(var(--accent));
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}

.about-grid h2 {
  font-size: 1.875rem;
  color: hsl(var(--foreground));
  margin: 0 0 1.5rem;
}

@media (min-width: 768px) {
  .about-grid h2 {
    font-size: 2.25rem;
  }
}

.text-muted {
  color: hsl(var(--muted-foreground));
  line-height: 1.7;
  margin: 0 0 1.5rem;
}

.link-accent {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: hsl(var(--accent));
  font-weight: 600;
  transition: gap 0.2s;
}

.link-accent:hover {
  gap: 0.5rem;
}

.about-img-wrap {
  position: relative;
}

.about-img-wrap img {
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.experience-badge {
  position: absolute;
  bottom: -1rem;
  left: -1rem;
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  display: none;
}

@media (min-width: 768px) {
  .experience-badge {
    display: block;
  }
}

/* Services home grid */
.section-eyebrow {
  text-align: center;
  color: hsl(var(--accent));
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}

.section-title {
  text-align: center;
  font-size: 1.875rem;
  color: hsl(var(--foreground));
  margin: 0 0 3rem;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 2.25rem;
  }
}

.services-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .services-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.service-card {
  background: hsl(var(--card));
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: box-shadow 0.3s, transform 0.3s;
}

.service-card:hover {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  transform: translateY(-4px);
}

.service-card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.25rem;
  background: hsl(var(--accent) / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  transition: background 0.2s;
}

.service-card:hover .service-card-icon {
  background: hsl(var(--accent) / 0.2);
}

.service-card-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  color: hsl(var(--accent));
}

.service-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.5rem;
}

.service-card p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin: 0;
}

/* CTA banner */
.cta-banner {
  position: relative;
  padding: 5rem 1rem;
  overflow: hidden;
}

.cta-banner .bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cta-banner .overlay {
  position: absolute;
  inset: 0;
  background: hsl(var(--primary) / 0.8);
}

.cta-banner .inner {
  position: relative;
  z-index: 10;
  text-align: center;
}

.cta-banner h2 {
  font-size: 1.875rem;
  color: hsl(var(--primary-foreground));
  margin: 0 0 1rem;
}

@media (min-width: 768px) {
  .cta-banner h2 {
    font-size: 2.25rem;
  }
}

.cta-banner .sub {
  color: hsl(var(--primary-foreground) / 0.8);
  margin: 0 0 2rem;
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
}

/* Testimonials */
.testimonial-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .testimonial-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.testimonial-card {
  background: hsl(var(--card));
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border: 1px solid hsl(var(--border));
}

.testimonial-stars {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.testimonial-stars svg {
  width: 1rem;
  height: 1rem;
  fill: hsl(var(--accent));
  color: hsl(var(--accent));
}

.testimonial-card blockquote {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  font-style: italic;
}

.testimonial-card cite {
  font-size: 0.875rem;
  font-weight: 600;
  font-style: normal;
  color: hsl(var(--foreground));
}

/* Servizi alternating rows */
.services-rows {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.service-row {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 768px) {
  .service-row {
    grid-template-columns: 1fr 1fr;
  }

  .service-row--flip .service-row-media {
    order: 2;
  }

  .service-row--flip .service-row-text {
    order: 1;
  }
}

.service-row-media img,
.service-row-placeholder {
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.service-row-placeholder {
  background: hsl(var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-row-placeholder svg {
  width: 6rem;
  height: 6rem;
  color: hsl(var(--accent) / 0.3);
}

.service-row-text .icon-wrap {
  width: 3rem;
  height: 3rem;
  border-radius: 0.25rem;
  background: hsl(var(--accent) / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.service-row-text .icon-wrap svg {
  width: 1.5rem;
  height: 1.5rem;
  color: hsl(var(--accent));
}

.service-row-text h2 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
  color: hsl(var(--foreground));
}

@media (min-width: 768px) {
  .service-row-text h2 {
    font-size: 1.875rem;
  }
}

.service-row-text p {
  margin: 0;
  color: hsl(var(--muted-foreground));
  line-height: 1.7;
}

/* Realizzazioni grid */
.projects-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.project-card {
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  background: hsl(var(--card));
  transition: box-shadow 0.2s;
}

.project-card:hover {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.project-card .thumb {
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.project-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.project-card:hover .thumb img {
  transform: scale(1.05);
}

.project-card .body {
  padding: 1.25rem;
}

.project-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: hsl(var(--foreground));
}

.project-card p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

/* Contatti form */
.contact-grid {
  display: grid;
  gap: 3rem;
}

@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 1rem;
  transition: box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--accent));
}

.form-group textarea {
  resize: none;
}

.contact-info-block {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.contact-line {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.contact-line svg {
  width: 1.25rem;
  height: 1.25rem;
  color: hsl(var(--accent));
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.contact-line .label {
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
}

.contact-line .val {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.contact-line .val.pre {
  white-space: pre-line;
}

.contact-wa-link {
  color: hsl(var(--accent));
  font-weight: 500;
}

.contact-wa-link:hover {
  text-decoration: underline;
}

.map-wrap {
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border: 1px solid hsl(var(--border));
}

.map-wrap iframe {
  display: block;
  width: 100%;
  height: 300px;
  border: 0;
}

/* Chi siamo values */
.values-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .values-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.value-card {
  background: hsl(var(--card));
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: box-shadow 0.2s;
}

.value-card:hover {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.value-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  border-radius: 9999px;
  background: hsl(var(--accent) / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.value-icon svg {
  width: 1.75rem;
  height: 1.75rem;
  color: hsl(var(--accent));
}

.value-card h3 {
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.value-card p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin: 0;
}

/* Story section two col */
.story-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 768px) {
  .story-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.story-grid img {
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.story-grid h2 {
  font-size: 1.875rem;
  margin: 0 0 1.5rem;
}

.story-grid .text-muted {
  margin: 0;
}

/* Toast — Contatti form feedback */
.form-toast {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  max-width: 22rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.15);
}

.form-toast.is-visible {
  display: block;
}

.form-toast strong {
  display: block;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  color: hsl(var(--foreground));
}

.form-toast span {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* 404 — NotFound.tsx inside Layout */
.page-not-found {
  background: hsl(var(--muted));
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
}

.not-found-inner {
  text-align: center;
}

.not-found h1 {
  font-size: 2.25rem;
  margin: 0 0 1rem;
}

.not-found p {
  font-size: 1.25rem;
  color: hsl(var(--muted-foreground));
  margin: 0 0 1rem;
}

.not-found a {
  color: hsl(var(--primary));
  text-decoration: underline;
}

.not-found a:hover {
  opacity: 0.9;
}

.bg-secondary {
  background: hsl(var(--secondary));
}

.bg-background {
  background: hsl(var(--background));
}

/* —— Motion (construction site: subtle scroll reveal + hero depth) —— */
[data-reveal] {
  opacity: 0;
  transform: translateY(1.25rem);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.service-card[data-reveal]:nth-child(1) {
  transition-delay: 0s;
}
.service-card[data-reveal]:nth-child(2) {
  transition-delay: 0.08s;
}
.service-card[data-reveal]:nth-child(3) {
  transition-delay: 0.16s;
}
.service-card[data-reveal]:nth-child(4) {
  transition-delay: 0.24s;
}

.testimonial-card[data-reveal]:nth-child(1) {
  transition-delay: 0s;
}
.testimonial-card[data-reveal]:nth-child(2) {
  transition-delay: 0.1s;
}
.testimonial-card[data-reveal]:nth-child(3) {
  transition-delay: 0.2s;
}

.projects-grid .project-card[data-reveal]:nth-child(1) {
  transition-delay: 0s;
}
.projects-grid .project-card[data-reveal]:nth-child(2) {
  transition-delay: 0.1s;
}
.projects-grid .project-card[data-reveal]:nth-child(3) {
  transition-delay: 0.2s;
}

.value-card[data-reveal]:nth-child(1) {
  transition-delay: 0s;
}
.value-card[data-reveal]:nth-child(2) {
  transition-delay: 0.08s;
}
.value-card[data-reveal]:nth-child(3) {
  transition-delay: 0.16s;
}

.hero--dynamic .hero-inner {
  animation: hero-intro 0.85s ease forwards;
}

@keyframes hero-intro {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cta-banner .inner[data-reveal] {
  transition-delay: 0.05s;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero--dynamic .hero-inner {
    animation: none;
  }

  .hero-bg {
    transform: none !important;
  }
}

/* Fixed WhatsApp — always visible while scrolling */
.whatsapp-float {
  position: fixed;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  right: calc(1.25rem + env(safe-area-inset-right, 0px));
  z-index: 9998;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-float:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.whatsapp-float svg {
  width: 1.75rem;
  height: 1.75rem;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-float {
    transition: none;
  }
}

/* Auth forms (register.php / login.php) */
.auth-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.auth-alert--error {
  background: hsl(var(--destructive-muted));
  border: 1px solid hsl(var(--destructive-border));
  color: hsl(var(--destructive));
}

.auth-alert--error p {
  color: inherit;
}

.auth-alert--success {
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--accent));
}

/* Password field + visibility toggle (login.php) */
.password-field-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-inner input {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.password-toggle:hover {
  color: hsl(var(--accent));
}

.password-toggle:focus-visible {
  outline: 2px solid hsl(var(--accent));
  outline-offset: 2px;
}

.password-toggle-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .password-toggle {
    transition: none;
  }
}

.login-form .form-group input,
.register-form .form-group input {
  background: #eef4ff;
  border-color: hsl(var(--border));
  border-radius: 0.5rem;
}

.login-form .btn-primary,
.register-form .btn-primary {
  border-radius: 0.5rem;
}

.auth-form-submit:disabled {
  opacity: 0.75;
  cursor: wait;
}

/* -------------------------------------------------------------------------- */
/* Admin app shell (ServiceNow-style: left nav + main workspace)              */
/* -------------------------------------------------------------------------- */

.admin-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

.admin-app {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.admin-sidebar {
  width: 15.5rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: hsl(215 32% 17%);
  color: hsl(210 20% 96%);
  border-right: 1px solid hsl(215 25% 12%);
}

.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 1.25rem;
  border-bottom: 1px solid hsl(215 28% 24%);
}

.admin-sidebar-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  font-weight: 700;
  font-size: 1.125rem;
}

.admin-sidebar-title {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.2;
}

.admin-sidebar-sub {
  display: block;
  font-size: 0.75rem;
  color: hsl(210 15% 65%);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-nav {
  flex: 1;
  padding: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.admin-nav-item {
  display: block;
  padding: 0.55rem 1rem;
  margin: 0 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.9375rem;
  color: hsl(210 18% 88%);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav-item:hover:not(.admin-nav-item--disabled) {
  background: hsl(215 28% 22%);
  color: hsl(0 0% 100%);
}

.admin-nav-item.is-active {
  background: hsl(215 35% 26%);
  border-left-color: hsl(var(--accent));
  color: hsl(0 0% 100%);
  font-weight: 600;
}

.admin-nav-item--disabled {
  color: hsl(215 15% 45%);
  cursor: not-allowed;
  pointer-events: none;
}

.admin-sidebar-actions {
  padding: 1rem;
  border-top: 1px solid hsl(215 28% 24%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-sidebar-link {
  font-size: 0.8125rem;
  color: hsl(210 15% 72%);
  text-decoration: none;
}

.admin-sidebar-link:hover {
  color: hsl(var(--accent));
}

.admin-workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}

.admin-topbar-heading {
  margin: 0;
  font-size: 1.375rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: hsl(var(--foreground));
}

.admin-topbar-meta {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.admin-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.admin-main {
  flex: 1;
  padding: 1.25rem 1.5rem;
  overflow: auto;
}

.admin-main-panel {
  min-height: min(28rem, 70vh);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  padding: 1.5rem;
  box-shadow: 0 1px 2px hsl(var(--foreground) / 0.04);
}

.admin-main-placeholder {
  margin: 0;
  font-size: 0.9375rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

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

  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid hsl(215 28% 24%);
  }

  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
  }

  .admin-nav-item {
    margin: 0;
    border-left: none;
    border-bottom: 2px solid transparent;
  }

  .admin-nav-item.is-active {
    border-left: none;
    border-bottom-color: hsl(var(--accent));
  }
}

/* Admin lists + ServiceNow-style record panel */
.admin-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.admin-list-hint {
  margin: 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.admin-btn-new {
  border: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.admin-table-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: 0 1px 2px hsl(var(--foreground) / 0.04);
  overflow: hidden;
}

/* Vista Calendario — ore per utente */
.admin-hours-cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.admin-hours-cal-label {
  font-weight: 600;
  font-size: 0.875rem;
}

.admin-hours-cal-select {
  min-width: 16rem;
  max-width: 100%;
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.admin-hours-cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.admin-hours-cal-month-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  min-width: 12rem;
  text-align: center;
}

.admin-hours-cal-nav-btn {
  padding: 0.35rem 0.75rem;
  font-size: 1rem;
  line-height: 1;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  cursor: pointer;
}

.admin-hours-cal-nav-btn:hover {
  background: hsl(var(--muted) / 0.35);
}

.admin-hours-cal-msg {
  color: hsl(var(--destructive));
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

.admin-hours-cal-loading {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin: 0 0 0.75rem;
}

.admin-hours-cal-grid-wrap {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  overflow: hidden;
}

.admin-hours-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  padding: 0.4rem 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.25);
  border-bottom: 1px solid hsl(var(--border));
}

.admin-hours-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

.admin-hours-cal-cell {
  min-height: 5.5rem;
  padding: 0.25rem 0.35rem;
  border-right: 1px solid hsl(var(--border));
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.7rem;
  line-height: 1.25;
  vertical-align: top;
}

.admin-hours-cal-cell:nth-child(7n) {
  border-right: none;
}

.admin-hours-cal-cell--muted {
  background: hsl(var(--muted) / 0.12);
  min-height: 2rem;
}

.admin-hours-cal-cell--today {
  background: hsl(var(--accent) / 0.08);
  box-shadow: inset 0 0 0 1px hsl(var(--accent) / 0.35);
}

.admin-hours-cal-daynum {
  font-weight: 700;
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
  color: hsl(var(--foreground));
}

.admin-hours-cal-entries {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.admin-hours-cal-entry {
  word-break: break-word;
  color: hsl(var(--foreground));
}

@media (max-width: 900px) {
  .admin-hours-cal-cell {
    min-height: 4rem;
    font-size: 0.62rem;
    padding: 0.2rem;
  }
}

.admin-list-filter-breadcrumb {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.2);
  border-bottom: 1px solid hsl(var(--border));
}

.admin-list-filter-breadcrumb[hidden] {
  display: none !important;
}

.admin-filter-bc-title {
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  margin-right: 0.25rem;
}

.admin-filter-bc-sep {
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  user-select: none;
}

.admin-filter-bc-part {
  white-space: normal;
}

.admin-filter-bc-clear {
  margin-left: 0.35rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: #000;
  cursor: pointer;
}

.admin-filter-bc-clear:hover {
  background: hsl(var(--muted) / 0.35);
  color: #000;
}

.admin-list-filter-breadcrumb > .admin-filter-bc-clear:first-child {
  margin-left: 0;
  margin-right: 0.35rem;
}

#admin-cell-context-menu.admin-context-menu {
  position: fixed;
  z-index: 1100;
  min-width: 12rem;
  max-width: min(22rem, calc(100vw - 1rem));
  padding: 0.35rem 0;
  margin: 0;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: 0 8px 24px hsl(var(--foreground) / 0.12);
}

#admin-cell-context-menu.admin-context-menu[hidden] {
  display: none !important;
}

.admin-context-menu-inner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.35rem;
}

.admin-context-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  font-size: 0.8125rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.admin-context-item:hover,
.admin-context-item:focus-visible {
  background: hsl(var(--muted) / 0.45);
  outline: none;
}

.admin-context-hint {
  margin: 0.35rem 0 0;
  padding: 0.35rem 0.65rem 0.15rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border));
}

.admin-context-hint strong {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.admin-table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.admin-table-loading,
.admin-table-error {
  margin: 0;
  padding: 1.25rem 1.5rem;
  font-size: 0.9375rem;
}

.admin-table-error {
  color: hsl(var(--destructive));
}

.admin-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-data-table th,
.admin-data-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.admin-data-table th {
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.35);
  white-space: nowrap;
}

.admin-data-table thead tr:first-child th {
  border-bottom: none;
}

.admin-table-filter-row th {
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
  background: hsl(var(--muted) / 0.22);
  white-space: normal;
  font-weight: 500;
}

.admin-col-filter {
  width: 100%;
  min-width: 4rem;
  max-width: 12rem;
  box-sizing: border-box;
  padding: 0.35rem 0.45rem;
  font-size: 0.8125rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.admin-col-filter::placeholder {
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
}

.admin-col-filter:focus {
  outline: 2px solid hsl(var(--accent));
  outline-offset: 1px;
}

.admin-data-table tbody tr.admin-data-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.admin-data-table tbody tr.admin-data-row:hover,
.admin-data-table tbody tr.admin-data-row:focus-visible {
  background: hsl(var(--muted) / 0.45);
  outline: none;
}

.admin-table-empty {
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

body.admin-record-open {
  overflow: hidden;
}

.admin-record-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: hsl(220 20% 10% / 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.admin-record-backdrop:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.admin-record-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  width: min(28rem, 100vw);
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  background: hsl(var(--card));
  border-left: 1px solid hsl(var(--border));
  box-shadow: -8px 0 32px hsl(220 20% 10% / 0.15);
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.admin-record-panel.is-open {
  transform: translateX(0);
}

.admin-record-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.75rem 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.admin-record-panel-title {
  margin: 0;
  font-size: 1.125rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: hsl(var(--foreground));
  line-height: 1.3;
}

.admin-record-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-record-close:hover {
  background: hsl(var(--muted) / 0.5);
  color: hsl(var(--foreground));
}

.admin-record-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.admin-record-panel-body {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.25rem;
}

.admin-record-panel-footer {
  flex-shrink: 0;
  padding: 1rem 1.25rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}

.admin-record-panel-footer--split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-record-delete {
  border: 1px solid hsl(var(--destructive-border));
  color: hsl(var(--destructive));
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-record-delete:hover {
  background: hsl(var(--destructive-muted));
}

.admin-record-readonly {
  margin: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--muted) / 0.35);
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  min-height: 2.5rem;
  line-height: 1.4;
}

.admin-record-field {
  margin-bottom: 1rem;
}

.admin-record-field--password.password-field-wrap .admin-record-label {
  margin-bottom: 0.35rem;
}

.admin-record-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: hsl(var(--foreground));
}

.admin-record-input,
.admin-record-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.admin-record-textarea {
  resize: vertical;
  min-height: 5rem;
}

.admin-record-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.admin-record-roles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-record-loading {
  margin: 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
}

#admin-record-panel-error {
  margin-bottom: 1rem;
}

/* Allegati fattura (stile ServiceNow: icona, elenco, selezione multipla) */
.admin-attachments {
  position: relative;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border));
}

/* Blocco Allegati in cima al form fattura: nessun bordo superiore */
.admin-attachments--lead {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
}

.admin-attachments--placeholder {
  padding: 0.75rem 0 0;
}

.admin-attachments--lead.admin-attachments--placeholder {
  padding-top: 0;
}

.admin-attachments-panel[hidden] {
  display: none !important;
}

.admin-attachments-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
  padding: 0.2rem 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.admin-attachments-toggle:hover .admin-attachments-title {
  color: hsl(var(--foreground));
}

.admin-attachments-toggle .admin-attachments-title {
  flex: 1;
}

.admin-attachments-chevron {
  flex-shrink: 0;
  display: block;
  transition: transform 0.2s ease;
  color: hsl(var(--muted-foreground));
}

.admin-attachments-toggle[aria-expanded="true"] .admin-attachments-chevron {
  transform: rotate(180deg);
}

.admin-attachments-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.65rem;
}

.admin-attachments-hint {
  margin: 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.admin-attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.admin-attachments-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(var(--muted-foreground));
}

.admin-attachments-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-attachments-btn {
  font-size: 0.8125rem;
  padding: 0.35rem 0.65rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
}

.admin-attachments-btn:hover:not(:disabled) {
  background: hsl(var(--muted) / 0.4);
}

.admin-attachments-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.admin-attachments-btn--icon {
  padding: 0.4rem;
  line-height: 0;
}

.admin-attachments-btn--danger {
  border-color: hsl(var(--destructive) / 0.45);
  color: hsl(var(--destructive));
}

.admin-attachments-btn--danger:hover:not(:disabled) {
  background: hsl(var(--destructive) / 0.12);
}

/* Evitare disabled nativo (i click non partono). Usare .is-muted per stato “nessuna selezione”. */
.admin-attachments-btn--danger.is-muted {
  opacity: 0.55;
}

.admin-attachments-icon {
  display: block;
}

.admin-attachments-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.admin-attachments-formats {
  margin: 0 0 0.5rem 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: hsl(var(--muted-foreground));
}

.admin-attachments-list-head {
  display: grid;
  grid-template-columns: 2rem 2.25rem minmax(0, 1fr) 5rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0.25rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
}

.admin-attachments-check-all {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-attachments-col-size {
  text-align: right;
}

.admin-attachments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 14rem;
  overflow-y: auto;
}

.admin-attachments-item {
  display: grid;
  grid-template-columns: 2rem 2.25rem minmax(0, 1fr) 5rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0.25rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid hsl(var(--border) / 0.7);
}

.admin-attachments-cb-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.admin-attachments-link {
  color: hsl(var(--accent));
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-attachments-link:hover {
  text-decoration: underline;
}

.admin-attachments-size {
  text-align: right;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
}

.admin-attachments-loading {
  padding: 0.5rem 0.25rem;
  color: hsl(var(--muted-foreground));
  font-style: italic;
  list-style: none;
}

.admin-attachments-empty {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.admin-attachments-msg {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
}

.admin-attachments-error {
  color: hsl(var(--destructive));
}

.admin-attachments-col-view {
  text-align: center;
}

.admin-attachments-view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin: 0;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.admin-attachments-view:hover {
  background: hsl(var(--muted) / 0.35);
  border-color: hsl(var(--primary) / 0.35);
  color: hsl(var(--primary));
}

.admin-attachments-view svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.admin-attachment-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: hsl(0 0% 0% / 0.45);
}

/* [hidden] must win: our display:flex would otherwise keep the modal visible on every page */
.admin-attachment-preview-backdrop[hidden],
.admin-attachment-preview-modal[hidden] {
  display: none !important;
}

.admin-attachment-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1201;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}

.admin-attachment-preview-dialog {
  display: flex;
  flex-direction: column;
  max-width: min(92vw, 56rem);
  max-height: min(88vh, 48rem);
  width: 100%;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 12px 40px hsl(0 0% 0% / 0.2);
  overflow: hidden;
  pointer-events: auto;
}

.admin-attachment-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.admin-attachment-preview-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-attachment-preview-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.admin-attachment-preview-close:hover {
  background: hsl(var(--muted) / 0.35);
  color: hsl(var(--foreground));
}

.admin-attachment-preview-body {
  flex: 1;
  min-height: 0;
  padding: 0.75rem;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-attachment-preview-body img {
  max-width: 100%;
  max-height: min(72vh, 42rem);
  height: auto;
  object-fit: contain;
}

.admin-attachment-preview-body iframe,
.admin-attachment-preview-body .admin-attachment-preview-embed {
  width: 100%;
  min-height: min(72vh, 42rem);
  height: min(72vh, 42rem);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--muted) / 0.2);
}

.admin-attachment-preview-fallback {
  text-align: center;
  padding: 1rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.admin-attachment-preview-fallback a {
  color: hsl(var(--accent));
}

body.admin-attachment-preview-open {
  overflow: hidden;
}

/* Query builder — funnel (toolbar) */
.admin-btn-excel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--primary));
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-btn-excel:hover {
  background: hsl(var(--muted) / 0.35);
  border-color: hsl(var(--primary) / 0.35);
}

.admin-btn-excel svg {
  flex-shrink: 0;
  opacity: 0.9;
  display: block;
}

.admin-qb-funnel {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--primary));
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-qb-funnel:hover {
  background: hsl(var(--muted) / 0.35);
  border-color: hsl(var(--primary) / 0.35);
}

.admin-qb-funnel.is-open {
  border-color: hsl(var(--accent));
  box-shadow: 0 0 0 1px hsl(var(--accent) / 0.25);
}

.admin-qb-funnel svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.admin-qb-funnel-label {
  font-weight: 600;
}

/* Query Builder — compact / slim density */
.admin-qb-drawer {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f8fafc;
  padding: 8px 10px 10px;
  border-radius: 8px;
  max-width: 900px;
  margin: 0 auto 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.admin-qb-mount {
  font-size: 12px;
  line-height: 1.2;
}

/* Groups container + toolbar (Esegui query top-left) */
.admin-qb-groups {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 8px;
}

.admin-qb-groups-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-shrink: 0;
  padding: 0;
  margin: 0 0 2px;
}

/* Individual Group Card */
.admin-qb-group {
  background: white;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  box-shadow: none;
  overflow: visible;
}

/* Lines Container */
.admin-qb-lines {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Individual Line */
.admin-qb-line {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  min-height: 0;
  background: #fafafa;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  position: relative;
  transition: border-color 0.15s ease;
}

.admin-qb-line:hover {
  border-color: #cbd5e1;
  box-shadow: none;
}

/* Join Label (AND/OR) */
.admin-qb-line-join-label,
.admin-qb-join-spacer {
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.admin-qb-line-join-label {
  color: #2563eb;
  background: #dbeafe;
  padding: 2px 4px;
  border-radius: 3px;
}

/* Form Controls */
.admin-qb-field,
.admin-qb-operator,
.admin-qb-value-helper,
.admin-qb-value-date-start,
.admin-qb-value-date-end,
.admin-qb-value-datetime-start,
.admin-qb-value-datetime-end {
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
  font-size: 12px;
  line-height: 1.25;
  color: #1f2937;
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 5.5rem;
  min-height: 1.5rem;
  box-sizing: border-box;
}

.admin-qb-value-date-start,
.admin-qb-value-date-end,
.admin-qb-value-datetime-start,
.admin-qb-value-datetime-end {
  font-family: inherit;
  min-width: 8.5rem;
}

.admin-qb-value-datetime-start,
.admin-qb-value-datetime-end {
  min-width: 10.5rem;
}

.admin-qb-value-aux {
  flex: 1 1 auto;
  min-width: 6rem;
  max-width: 28rem;
  display: flex;
  align-items: center;
}

.admin-qb-range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.admin-qb-range-lbl {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: lowercase;
}

.admin-qb-field:focus,
.admin-qb-operator:focus,
.admin-qb-value-helper:focus,
.admin-qb-value:focus,
.admin-qb-value-date-start:focus,
.admin-qb-value-date-end:focus,
.admin-qb-value-datetime-start:focus,
.admin-qb-value-datetime-end:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.admin-qb-value {
  flex: 1;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.25;
  color: #1f2937;
  min-width: 5rem;
  max-width: 12rem;
  min-height: 1.5rem;
  box-sizing: border-box;
}

.admin-qb-value.admin-qb-value--hidden {
  display: none !important;
}

.admin-qb-value-helper {
  min-width: 7rem;
  color: #6b7280;
}

/* AND/OR + delete — kept together at end of row */
.admin-qb-line-end {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.admin-qb-line-actions {
  display: flex;
  gap: 3px;
}

/* Buttons Base */
.admin-qb-btn {
  padding: 2px 8px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  min-height: 1.5rem;
}

.admin-qb-btn:hover {
  transform: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.admin-qb-btn:active {
  transform: none;
}

/* Button Variants */
.admin-qb-btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.admin-qb-btn-secondary:hover {
  background: #e2e8f0;
  color: #334155;
}

.admin-qb-btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.admin-qb-btn-danger:hover {
  background: #fecaca;
  color: #991b1b;
}

/* Esegui query — compact when inside groups toolbar */
.admin-qb-groups-toolbar .admin-qb-execute {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  border: none;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
  min-height: 0;
}

.admin-qb-groups-toolbar .admin-qb-execute:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}

/* Specific Line Buttons */
.admin-qb-line-add {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  font-size: 10px;
  padding: 1px 6px;
  min-height: 1.35rem;
}

.admin-qb-line-add:hover {
  background: #dcfce7;
  color: #15803d;
}

.admin-qb-line-del {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0;
  background: #fff;
  color: #dc2626;
  border: 1px solid #fecaca !important;
  border-radius: 4px;
  opacity: 1;
  box-shadow: none;
}

.admin-qb-line-del-icon {
  display: block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.admin-qb-line-del:hover {
  background: #fee2e2;
  border-color: #f87171 !important;
}

.admin-qb-line-del:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .admin-qb-line {
    flex-wrap: wrap;
  }

  .admin-qb-field,
  .admin-qb-operator,
  .admin-qb-value,
  .admin-qb-value-helper,
  .admin-qb-value-aux,
  .admin-qb-value-date-start,
  .admin-qb-value-date-end,
  .admin-qb-value-datetime-start,
  .admin-qb-value-datetime-end {
    flex: 1 1 calc(50% - 6px);
    min-width: 120px;
    max-width: none;
  }

  .admin-qb-line-end {
    width: 100%;
    margin-left: 0;
    margin-top: 4px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .admin-qb-line-actions {
    justify-content: flex-end;
  }
}
