:root {
  --gima-navy: #0b3a5b;
  --gima-blue: #1479a8;
  --gima-gold: #c62828;
  --gima-ink: #15202b;
  --gima-muted: #5b6b7c;
  --gima-bg: #eef3f7;
  --gima-surface: #ffffff;
  --gima-line: #d7e2ea;
  --gima-shadow: 0 10px 30px rgba(11, 58, 91, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--gima-ink);
  background:
    radial-gradient(circle at top right, rgba(20, 121, 168, 0.12), transparent 36%),
    radial-gradient(circle at bottom left, rgba(240, 180, 41, 0.10), transparent 30%),
    linear-gradient(180deg, #f7fafc 0%, var(--gima-bg) 100%);
}

a { color: var(--gima-blue); text-decoration: none; }
a:hover { color: var(--gima-navy); }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: linear-gradient(90deg, var(--gima-navy) 0%, #0f4f75 55%, var(--gima-blue) 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(11, 58, 91, 0.25);
}

.topbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: #fff !important;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-user-name {
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

.topbar .brand-logo {
  height: 46px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 4px 8px;
}

.topbar .nav-link {
  color: rgba(255, 255, 255, 0.88) !important;
  font-weight: 600;
  padding: 0.55rem 0.85rem !important;
  border-radius: 999px;
}

.topbar .nav-link:hover,
.topbar .nav-link.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.14);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  color: #fff;
  font-size: 0.9rem;
}

.main-wrap {
  flex: 1;
  padding: 1.75rem 0 2.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.page-header h1 {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gima-navy);
}

.page-header p {
  margin: 0.35rem 0 0;
  color: var(--gima-muted);
}

.surface-card {
  background: var(--gima-surface);
  border: 1px solid var(--gima-line);
  border-radius: 16px;
  box-shadow: var(--gima-shadow);
}

.stat-card {
  background: var(--gima-surface);
  border: 1px solid var(--gima-line);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  box-shadow: var(--gima-shadow);
  height: 100%;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--gima-gold), var(--gima-blue));
}

.stat-card .label {
  color: var(--gima-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.stat-card .value {
  font-family: "Sora", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gima-navy);
  line-height: 1.1;
  margin: 0.35rem 0 0.85rem;
}

.btn-gima {
  background: linear-gradient(135deg, var(--gima-navy), var(--gima-blue));
  border: 0;
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.55rem 1rem;
}

.btn-gima:hover {
  color: #fff;
  filter: brightness(1.05);
}

.btn-outline-gima {
  border: 1.5px solid var(--gima-navy);
  color: var(--gima-navy);
  background: transparent;
  font-weight: 700;
  border-radius: 10px;
}

.btn-email {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.email-sent-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: #e8f8ef;
  color: #1b7a3f;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(27, 122, 63, 0.15);
  padding: 0;
  vertical-align: middle;
}

.email-sent-check:hover,
.email-sent-check:focus {
  background: #d4f3e1;
  color: #146433;
  outline: none;
}

.email-sent-check.static {
  cursor: default;
  box-shadow: none;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.email-sent-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #e8f8ef;
  border: 1px solid #b7e4c7;
  color: #146433;
}

.btn-danger-soft {
  background: #fff1f1;
  color: #b42318;
  border: 1px solid #f3c6c2;
  border-radius: 10px;
  font-weight: 600;
}

.table-gima {
  margin: 0;
  --bs-table-bg: transparent;
}

.table-gima thead th {
  background: #f2f7fb;
  color: var(--gima-navy);
  font-weight: 700;
  border-bottom-width: 1px;
  white-space: nowrap;
  padding: 0.38rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

.table-gima td,
.table-gima th {
  vertical-align: middle;
  padding: 0.28rem 0.65rem;
  font-size: 0.88rem;
  line-height: 1.25;
}

.table-gima.table > :not(caption) > * > * {
  padding: 0.28rem 0.65rem;
}

.table-gima .btn-sm {
  padding: 0.12rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.15;
  min-height: 0;
}

.table-gima .thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
}

.table-gima .badge {
  font-size: 0.68rem;
  padding: 0.18em 0.45em;
}

.table-gima .actions-inline {
  gap: 0.25rem;
}

.table-clienti-compact td,
.table-clienti-compact th {
  padding: 0.12rem 0.45rem !important;
  font-size: 0.76rem;
  line-height: 1.15;
}

.table-clienti-compact thead th {
  padding: 0.22rem 0.45rem !important;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.table-clienti-compact tbody tr:nth-child(odd) {
  background: #ffffff;
}

.table-clienti-compact tbody tr:nth-child(even) {
  background: #e8f0f6;
}

.table-clienti-compact .cliente-row {
  cursor: pointer;
}

.table-clienti-compact .cliente-row:hover {
  background: #d4e8f5 !important;
}

.table-clienti-compact .cliente-row:focus {
  outline: 2px solid #1479a8;
  outline-offset: -2px;
}

.table-clienti-compact .btn-sm {
  padding: 0.08rem 0.35rem;
  font-size: 0.66rem;
  line-height: 1.1;
}

/* Evidenziazione testo ricerca (es. «nic») */
mark.search-hit {
  background: #ffe08a;
  color: inherit;
  padding: 0 0.12em;
  border-radius: 0.15em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.form-card {
  max-width: 760px;
}

.form-card .form-label {
  font-weight: 700;
  color: var(--gima-navy);
  font-size: 0.9rem;
}

.form-card .form-control,
.form-card .form-select {
  border-radius: 10px;
  border-color: #c9d7e3;
  padding: 0.65rem 0.8rem;
}

.form-card .form-control:focus,
.form-card .form-select:focus {
  border-color: var(--gima-blue);
  box-shadow: 0 0 0 0.2rem rgba(20, 121, 168, 0.15);
}

.app-footer {
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--gima-line);
  padding: 1rem 0;
  color: var(--gima-muted);
  font-size: 0.92rem;
}

.app-footer strong {
  color: var(--gima-navy);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    linear-gradient(135deg, rgba(11, 58, 91, 0.94), rgba(20, 121, 168, 0.86)),
    radial-gradient(circle at 18% 18%, rgba(198, 40, 40, 0.22), transparent 42%);
}

.login-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
}

.login-card .logo {
  height: 88px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  margin-bottom: 1rem;
  border-radius: 12px;
}

.login-card h1 {
  font-family: "Sora", sans-serif;
  font-size: 1.35rem;
  color: var(--gima-navy);
  margin-bottom: 0.25rem;
}

.login-card .subtitle {
  color: var(--gima-muted);
  margin-bottom: 1.5rem;
}

.login-meta {
  margin-top: 1.25rem;
  font-size: 0.82rem;
  color: var(--gima-muted);
}

.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--gima-line);
}

.actions-inline {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.alert {
  border-radius: 12px;
}

/* Form interventi / sezioni ad alto contrasto */
.form-section {
  background: #f4f8fb;
  border: 1px solid #c5d5e2;
  border-radius: 14px;
  padding: 1.1rem 1.2rem 1.25rem;
  margin-bottom: 0.25rem;
}

.form-section-title {
  margin: 0 0 0.95rem;
  padding: 0.45rem 0.75rem;
  background: linear-gradient(90deg, #0b3a5b, #1479a8);
  color: #fff !important;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 8px;
}

.field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #0b3a5b;
}

.form-section .form-control,
.form-section .form-select {
  border: 1.5px solid #8fa9bd;
  background: #fff;
  color: #102433;
  font-weight: 600;
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}

.form-section .form-control:focus,
.form-section .form-select:focus {
  border-color: #0b3a5b;
  box-shadow: 0 0 0 0.2rem rgba(11, 58, 91, 0.18);
}

.form-section .form-control[readonly] {
  background: #e8eef3;
  color: #0b3a5b;
  font-weight: 800;
}

/* Schema form — fedele a test.webp (tutti i form) */
body:has(.schema-page) {
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0 16px,
      rgba(255, 255, 255, 0.04) 16px 18px
    ),
    linear-gradient(180deg, #3f4f5f 0%, #4e5d6c 42%, #5a6a7a 100%) !important;
}

body:has(.schema-page) .main-wrap {
  background: transparent;
}

body:has(.schema-page) .app-footer {
  background: #33404c;
  color: rgba(255, 255, 255, 0.85);
}

body:has(.schema-page) .app-footer a {
  color: #fff;
}

.schema-page {
  margin: -0.5rem -0.25rem 0;
  padding: 1.2rem 0.75rem 2rem;
}

.schema-page__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  max-width: 860px;
  margin: 0 auto 1rem;
  color: #fff;
}

.schema-page__title {
  margin: 0;
  color: #fff !important;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.schema-page__title span {
  display: block;
  font-weight: 500;
}

.schema-page__subtitle {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
}

.schema-page__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
}

.schema-page__brand img {
  height: 40px;
  width: auto;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
}

.schema-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 860px;
  margin: 0 auto 0.85rem;
}

.schema-page__actions .btn-outline-gima {
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.35);
}

.schema-form {
  max-width: 860px;
  margin: 0 auto;
  background: #fff;
  border: 0;
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  padding: 1.45rem 1.55rem 1.55rem;
}

.schema-form__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.05rem;
}

.schema-form__meta .field-label,
.schema-form__meta .form-label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  min-width: 3.5rem;
}

.schema-form__meta .form-select,
.schema-form__meta .form-control {
  max-width: 11rem;
  border-radius: 12px;
  border: 1.5px solid #111;
  font-weight: 600;
  background: #fff;
}

.schema-block {
  margin-bottom: 1.15rem;
}

.schema-block__title,
.schema-form .form-section-title,
.schema-form h2.h5,
.schema-form h2.h4 {
  margin: 0 0 0.9rem !important;
  padding: 0.55rem 1.05rem !important;
  background: #4e5d6c !important;
  color: #fff !important;
  font-family: "Sora", "Manrope", sans-serif !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  border-radius: 999px !important;
  border: 0 !important;
}

.schema-row {
  display: grid;
  grid-template-columns: minmax(140px, 190px) 1fr;
  gap: 0.45rem 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.schema-row .field-label,
.schema-row .form-label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #111;
}

.schema-row .form-control,
.schema-row .form-select,
.schema-form .schema-row .form-control,
.schema-form .schema-row .form-select {
  border: 1.5px solid #111 !important;
  background: #fff !important;
  color: #111;
  font-weight: 600;
  border-radius: 12px !important;
  padding: 0.5rem 0.9rem;
  min-height: 2.45rem;
  box-shadow: none !important;
}

.schema-comments .field-label,
.schema-comments .form-label {
  display: block;
  margin: 0 0 0.4rem;
  text-transform: none;
  font-size: 0.98rem;
  font-weight: 600;
  color: #111;
}

.schema-comments textarea.form-control {
  border: 1.5px solid #111 !important;
  border-radius: 12px !important;
  min-height: 7rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  resize: vertical;
}

.schema-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.schema-form__foot {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 0.78rem;
  color: #555;
}

/* Dentro schema-form: le vecchie card diventano sezioni piatte */
.schema-form .form-section,
.schema-form .surface-card,
.schema-form .form-card {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 0 0.35rem !important;
  margin: 0 0 1rem !important;
  max-width: none !important;
}

/* Bootstrap cols -> riga label | campo come test.webp */
.schema-form > .row > [class*="col-"],
.schema-form form > .row > [class*="col-"],
.schema-form fieldset.row > [class*="col-"],
.schema-form .row.g-3 > [class*="col-"],
.schema-form fieldset .row > [class*="col-"] {
  flex: 0 0 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  display: grid;
  grid-template-columns: minmax(140px, 190px) 1fr;
  gap: 0.4rem 1rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.schema-form .row > [class*="col-"] > .form-label,
.schema-form .row > [class*="col-"] > .field-label {
  margin: 0 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.98rem !important;
  font-weight: 600 !important;
  color: #111 !important;
}

.schema-form .row > [class*="col-"] > .form-control,
.schema-form .row > [class*="col-"] > .form-select,
.schema-form .row > [class*="col-"] > .input-group,
.schema-form .row > [class*="col-"] > .cliente-picker,
.schema-form .row > [class*="col-"] > .form-text,
.schema-form .row > [class*="col-"] > .form-check,
.schema-form .row > [class*="col-"] > .d-flex,
.schema-form .row > [class*="col-"] > textarea {
  grid-column: 2;
}

.schema-form .row > [class*="col-"] > .form-control,
.schema-form .row > [class*="col-"] > .form-select,
.schema-form .row > [class*="col-"] > textarea.form-control {
  border: 1.5px solid #111 !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: none !important;
  font-weight: 600;
}

.schema-form .row > [class*="col-"] > textarea.form-control {
  min-height: 5.5rem;
}

.schema-form .cliente-picker .field-label {
  display: block;
  margin-bottom: 0.35rem;
}

@media (max-width: 767.98px) {
  .schema-page__top {
    flex-direction: column;
  }
  .schema-form {
    padding: 1.05rem;
    border-radius: 18px;
  }
  .schema-row,
  .schema-form > .row > [class*="col-"],
  .schema-form form > .row > [class*="col-"],
  .schema-form fieldset.row > [class*="col-"],
  .schema-form .row.g-3 > [class*="col-"],
  .schema-form fieldset .row > [class*="col-"] {
    grid-template-columns: 1fr;
  }
  .schema-form .row > [class*="col-"] > .form-control,
  .schema-form .row > [class*="col-"] > .form-select,
  .schema-form .row > [class*="col-"] > .input-group,
  .schema-form .row > [class*="col-"] > .cliente-picker,
  .schema-form .row > [class*="col-"] > .form-text,
  .schema-form .row > [class*="col-"] > .form-check,
  .schema-form .row > [class*="col-"] > .d-flex,
  .schema-form .row > [class*="col-"] > textarea {
    grid-column: 1;
  }
}

.form-check-label {
  color: #0b3a5b;
  font-weight: 700;
}

.mat-table th {
  background: #0b3a5b !important;
  color: #fff !important;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Menu principale a pulsanti colorati */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.4rem;
}

.menu-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.55rem;
  row-gap: 0.05rem;
  align-items: center;
  min-height: 48px;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  text-decoration: none !important;
  color: #fff !important;
  box-shadow: 0 4px 10px rgba(15, 40, 60, 0.12);
  transition: transform 0.15s ease, filter 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.menu-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  color: #fff !important;
}

.menu-icon {
  grid-row: 1 / span 2;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  margin: 0;
}

.menu-icon img {
  width: 15px;
  height: 15px;
}

.menu-title {
  grid-column: 2;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
}

.menu-count {
  grid-column: 2;
  margin-top: 0;
  font-size: 0.66rem;
  font-weight: 650;
  opacity: 0.95;
  line-height: 1.15;
}

.menu-clienti { background: linear-gradient(145deg, #0f766e, #14b8a6); }
.menu-dipendenti { background: linear-gradient(145deg, #166534, #22c55e); }
.menu-cantieri { background: linear-gradient(145deg, #9a3412, #f59e0b); }
.menu-automezzi {
  background: linear-gradient(145deg, #4c1d95, #831843) !important;
  color: #fff !important;
}
.menu-interventi { background: linear-gradient(145deg, #9f1239, #e11d48); }
.menu-formazione { background: linear-gradient(145deg, #1e3a8a, #3b82f6); }
.menu-manuali {
  background: linear-gradient(145deg, #064e3b, #059669) !important;
  color: #fff !important;
}
.menu-planning { background: linear-gradient(145deg, #0e7490, #22d3ee); }
.menu-utenti { background: linear-gradient(145deg, #334155, #64748b); }

.btn-camera {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #0b3a5b;
  color: #fff !important;
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  padding: 0.55rem 0.9rem;
  text-decoration: none !important;
}

.btn-camera img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

.btn-camera:hover {
  background: #1479a8;
  color: #fff !important;
}

.btn-sm.btn-camera {
  padding: 0.3rem 0.55rem;
  font-size: 0.85rem;
}

.btn-sm.btn-camera img {
  width: 16px;
  height: 16px;
}

.photo-card {
  background: #fff;
  border: 1px solid #d7e2ea;
  border-radius: 14px;
  overflow: hidden;
  height: 100%;
  box-shadow: 0 8px 20px rgba(11, 58, 91, 0.08);
}

.photo-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  background: #e8eef3;
}

.photo-meta {
  padding: 0.75rem 0.85rem 0.9rem;
}

.photo-tag {
  font-weight: 800;
  color: #0b3a5b;
  font-size: 0.95rem;
}

.photo-uploader,
.photo-date {
  font-size: 0.82rem;
  color: #5b6b7c;
  margin-top: 0.2rem;
}

.cliente-picker-search .form-control {
  border-radius: 10px 0 0 10px;
}

.cliente-picker-search .btn {
  border-radius: 0 10px 10px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
}

.cliente-picker select.cliente-select-compact {
  height: auto !important;
  min-height: 2.4rem;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.badge-manut {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-manut-ok {
  background: #e8f8ef;
  color: #146433;
}

.badge-manut-todo {
  background: #fff4e5;
  color: #9a5b00;
}

.manut-row-done {
  background: #f7fbf8;
}

.manut-row-late td:first-child .badge-manut-todo {
  background: #fdecea;
  color: #b42318;
}

/* Planning */
.planning-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.4rem;
  border-radius: 18px;
  background:
    radial-gradient(circle at 85% 20%, rgba(20, 121, 168, 0.25), transparent 45%),
    linear-gradient(135deg, #0b3a5b 0%, #125a84 55%, #1479a8 100%);
  color: #fff;
  box-shadow: 0 14px 30px rgba(11, 58, 91, 0.22);
}

.planning-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 800;
  opacity: 0.85;
}

.planning-hero h2 {
  font-family: "Sora", sans-serif;
  font-size: 1.45rem;
  margin: 0.25rem 0 0.35rem;
}

.planning-hero p {
  margin: 0;
  opacity: 0.92;
}

.planning-hero-stats .num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.planning-hero-stats .lbl {
  font-size: 0.85rem;
  opacity: 0.9;
}

.planning-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #c9d7e3;
  color: #0b3a5b;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
  background: #fff;
}

.filter-chip.active,
.filter-chip:hover {
  background: #0b3a5b;
  border-color: #0b3a5b;
  color: #fff;
}

.planning-board {
  display: grid;
  gap: 0.85rem;
}

.planning-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0;
  background: #fff;
  border: 1px solid #d7e2ea;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(11, 58, 91, 0.07);
}

.planning-card.is-da-fare {
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.10), #fff 42%);
  border-color: #86efac;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.12);
}

.planning-card.is-da-fare .planning-card-date {
  background: linear-gradient(160deg, #15803d, #22c55e);
}

.planning-card.is-scaduto {
  background: linear-gradient(90deg, rgba(234, 88, 12, 0.12), #fff 42%);
  border-color: #fdba74;
  box-shadow: 0 10px 24px rgba(234, 88, 12, 0.14);
}

.planning-card.is-scaduto .planning-card-date {
  background: linear-gradient(160deg, #c2410c, #f97316);
}

.badge-scadenza {
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.badge-da-fare {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.badge-scaduto {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.planning-card-date {
  background: var(--accent, #1479a8);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 0.4rem;
  text-align: center;
}

.planning-card-date .day {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.planning-card-date .mon {
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.planning-card-date .year {
  font-size: 0.75rem;
  opacity: 0.85;
}

.planning-card-body {
  padding: 0.95rem 1.05rem 1.05rem;
}

.planning-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.tip-pill {
  background: color-mix(in srgb, var(--accent, #1479a8) 16%, white);
  color: var(--accent, #0b3a5b);
  border: 1px solid color-mix(in srgb, var(--accent, #1479a8) 35%, white);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.stato-pill {
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eef2f6;
  color: #334155;
}

.stato-programmato { background: #e8f1fb; color: #0b3a5b; }
.stato-in-corso { background: #fff4e5; color: #9a5b00; }
.stato-completato { background: #e8f8ef; color: #146433; }
.stato-annullato { background: #fdecea; color: #b42318; }

.planning-card h3 {
  margin: 0;
  color: #0b3a5b;
  font-size: 1.1rem;
  font-weight: 800;
}

.planning-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.45rem;
  color: #5b6b7c;
  font-size: 0.88rem;
  font-weight: 600;
}

.planning-author {
  color: #0b3a5b;
}

.planning-author-bar {
  margin: 0.35rem 0 0.55rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: #e8f1fb;
  color: #0b3a5b;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid #bfd4e8;
}

.planning-author-bar strong {
  font-weight: 800;
}

.planning-author-time {
  color: #5b6b7c;
  font-weight: 600;
}

.utente-attivo-box {
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  border: 1px solid #d7e2ea;
  background: #f8fafc;
}

.utente-attivo-box.is-on {
  background: #ecfdf5;
  border-color: #86efac;
}

.utente-attivo-box.is-off {
  background: #fff7ed;
  border-color: #fdba74;
}

.utente-attivo-box .form-check-input {
  width: 2.6rem;
  height: 1.35rem;
  margin-top: 0.2rem;
  cursor: pointer;
}

.utente-attivo-box .form-check-label {
  margin-left: 0.35rem;
  cursor: pointer;
}

.btn-toggle-pwd.is-shown {
  background: #0b3a5b;
  color: #fff;
  border-color: #0b3a5b;
}

.planning-maps {
  color: #0e7490;
  font-weight: 800;
  text-decoration: none;
}

.planning-maps:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .planning-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .planning-filters {
    justify-content: flex-start;
  }
  .planning-card {
    grid-template-columns: 72px 1fr;
  }
}

/* —— Accesso negato —— */
.access-denied-wrap {
  min-height: calc(100vh - 220px);
  display: grid;
  place-items: center;
  padding: 1.5rem 0 2.5rem;
}

.access-denied-card {
  width: min(560px, 100%);
  text-align: center;
  padding: 2.25rem 1.75rem 2rem;
  border-radius: 28px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(254, 226, 226, 0.95), rgba(255, 255, 255, 0.92) 55%),
    linear-gradient(160deg, #fff 0%, #f8fafc 100%);
  border: 1px solid rgba(185, 28, 28, 0.18);
  box-shadow:
    0 24px 50px rgba(127, 29, 29, 0.14),
    0 2px 0 rgba(255, 255, 255, 0.8) inset;
  animation: accessDeniedIn 0.55s ease-out both;
}

.access-denied-badge {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: #7f1d1d;
  color: #fff;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.access-denied-logo {
  width: 168px;
  height: 168px;
  margin: 0 auto 1.1rem;
  animation: accessDeniedPulse 2.4s ease-in-out infinite;
}

.access-denied-logo img {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 12px 22px rgba(153, 27, 27, 0.28));
}

.access-denied-card h1 {
  margin: 0 0 0.75rem;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.55rem, 4vw, 2rem);
  font-weight: 800;
  color: #7f1d1d;
  letter-spacing: -0.02em;
}

.access-denied-lead {
  margin: 0 auto;
  max-width: 38ch;
  color: #334155;
  font-size: 1.05rem;
  line-height: 1.55;
  font-weight: 600;
}

.access-denied-sub {
  margin: 0.85rem auto 0;
  max-width: 40ch;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.5;
}

.access-denied-actions {
  margin-top: 1.5rem;
}

@keyframes accessDeniedIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes accessDeniedPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* —— Terminale connessione —— */
.device-chip {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.device-inline {
  color: var(--gima-muted);
  font-weight: 600;
}

/* —— Responsive: Desktop / Tablet / Smartphone —— */
@media (min-width: 992px) {
  .menu-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .container {
    max-width: 1140px;
  }
}

@media (max-width: 991.98px) {
  .main-wrap {
    padding: 1.25rem 0 2rem;
  }
  .menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }
  .menu-btn {
    min-height: 46px;
    padding: 0.35rem 0.5rem;
  }
  .menu-title {
    font-size: 0.8rem;
  }
  .page-header h1 {
    font-size: 1.45rem;
  }
  .topbar .brand-logo {
    height: 40px;
    max-width: 140px;
  }
  .nav-user-name {
    font-size: 0.95rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .form-section {
    padding: 0.95rem 0.9rem 1.05rem;
  }
  .planning-card {
    grid-template-columns: 76px 1fr;
  }
}

@media (max-width: 767.98px) {
  .main-wrap {
    padding: 0.9rem 0 1.6rem;
  }
  .container {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .menu-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
  }
  .menu-btn {
    min-height: 44px;
    padding: 0.35rem 0.45rem;
  }
  .menu-icon {
    width: 24px;
    height: 24px;
  }
  .menu-icon img {
    width: 14px;
    height: 14px;
  }
  .menu-title {
    font-size: 0.78rem;
    letter-spacing: 0.01em;
  }
  .menu-count {
    font-size: 0.64rem;
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 0.95rem;
  }
  .page-header h1 {
    font-size: 1.3rem;
  }
  .page-header .btn,
  .page-header > a.btn {
    width: 100%;
  }
  .topbar .container {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }
  .topbar .brand-logo {
    height: 34px;
    max-width: 110px;
    padding: 2px 6px;
  }
  .nav-user-name {
    font-size: 0.88rem;
    max-width: 110px;
  }
  .surface-card,
  .form-card,
  .form-section {
    border-radius: 12px;
  }
  .table-gima td,
  .table-gima th,
  .table-gima.table > :not(caption) > * > * {
    padding: 0.22rem 0.45rem;
    font-size: 0.82rem;
  }
  .table-clienti-compact td,
  .table-clienti-compact th {
    padding: 0.1rem 0.35rem !important;
    font-size: 0.72rem;
  }
  .actions-inline {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .actions-inline .btn {
    font-size: 0.78rem;
  }
  .btn-gima,
  .btn-outline-gima {
    min-height: 42px;
  }
  .form-control,
  .form-select {
    min-height: 44px;
    font-size: 16px; /* evita zoom iOS */
  }
  .login-page {
    padding: 1rem 0.75rem;
    align-items: stretch;
  }
  .login-card {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.35rem 1.1rem 1.2rem;
    border-radius: 18px;
  }
  .login-card .logo {
    max-width: 160px;
  }
  .login-card h1 {
    font-size: 1.35rem;
  }
  .app-footer {
    font-size: 0.8rem;
    padding: 0.85rem 0;
  }
  .planning-card {
    grid-template-columns: 1fr;
  }
  .planning-card-date {
    flex-direction: row;
    gap: 0.65rem;
    justify-content: flex-start;
    padding: 0.7rem 1rem;
  }
  .cliente-picker select[size] {
    size: auto;
  }
  .cliente-picker select {
    min-height: 2.6rem;
  }
}

@media (max-width: 480px) {
  .menu-btn {
    min-height: 42px;
    padding: 0.3rem 0.4rem;
  }
  .menu-title {
    font-size: 0.74rem;
  }
  .menu-count {
    font-size: 0.6rem;
  }
  .device-chip {
    display: none !important;
  }
}

/* Tutto il gestionale: testo sempre in maiuscolo */
body,
body *:not(script):not(style):not(svg):not(path):not(canvas) {
  text-transform: uppercase !important;
}

input[type="password"] {
  text-transform: none !important;
}

