
:root {
  --font-sans: "Fira Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --bg: #f4f7fb;
  --bg-2: #eef3f9;
  --panel: rgba(255,255,255,.92);
  --panel-strong: #ffffff;
  --ink: #122033;
  --ink-2: #22314c;
  --ink-muted: #526172;
  --muted: #667085;
  --muted-2: #7a889f;
  --line: #d9e2ee;
  --line-strong: #c9d5e4;
  --brand: #0299D8;
  --brand-2: #0180B5;
  --brand-green: #4A7C2F;
  --brand-soft: #E3F5FC;
  --purple: #739848;
  --teal: #0ea5a4;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --yellow: #d97706;
  --yellow-soft: #fef3c7;
  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --red: #dc2626;
  --red-soft: #fee2e2;
  /* Ultima fascia del semaforo magazzino. Non riusa --purple, che nonostante il
     nome contiene il verde Ricrea. */
  --violet: #7c3aed;
  --violet-soft: #ede9fe;
  --slate-soft: #edf2f7;
  --ricrea-green: #739848;
  --ricrea-green-dark: #4A7C2F;
  --ricrea-green-soft: #EFF5E6;
  --shadow-xl: 0 24px 70px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 14px 38px rgba(15, 23, 42, 0.06);
  --radius-card: 8px;
  /* Alias usati dalle pagine catalogo/trattative (pd-*, wz-*, sb-*): mappano ai
     token semantici, cosi' il tema scuro si propaga anche li' invece di restare
     sul fallback chiaro. Prima queste var non erano definite = card bianche in dark. */
  --bg-1: var(--panel-strong);
  --azzurro: var(--brand);
  --azzurro-bg: var(--brand-soft);
  --verde: var(--ricrea-green-dark);
  --rosso: var(--red);
}

/* ── TEMA SCURO (toggle navbar, html[data-theme="dark"]) ──────────────────
   Override dei token semantici. Le pagine usano questi token, quindi il
   tema scuro si propaga ovunque. I colori di stato (rosso/verde/ambra) e il
   brand restano leggibili anche su sfondo scuro. ───────────────────────── */
html[data-theme="dark"] {
  --bg: #060b16;
  --bg-2: #0e1726;
  --panel: rgba(255,255,255,.045);
  --panel-strong: #0e1726;
  --ink: #eef3fb;
  --ink-2: #c4d2e8;
  --ink-muted: #97a8c2;
  --muted: #8294b1;
  --muted-2: #69788d;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.16);
  --brand: #27bdf2;
  --brand-2: #4fcaf4;
  --brand-green: #82c95f;
  --brand-soft: rgba(39,189,242,.14);
  --purple: #9bbf6e;
  --teal: #2dd4bf;
  --green: #4ade80;
  --green-soft: rgba(74,222,128,.13);
  --yellow: #fbbf24;
  --yellow-soft: rgba(251,191,36,.13);
  --orange: #fb923c;
  --orange-soft: rgba(251,146,60,.16);
  --red: #ff6f81;
  --red-soft: rgba(255,111,129,.14);
  --violet: #c084fc;
  --violet-soft: rgba(192,132,252,.16);
  --slate-soft: rgba(255,255,255,.06);
  --ricrea-green: #9bbf6e;
  --ricrea-green-dark: #82c95f;
  --ricrea-green-soft: rgba(130,201,95,.13);
  --shadow-xl: 0 24px 70px rgba(0,0,0,.5);
  --shadow-lg: 0 14px 38px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(2,153,216,.09), transparent 28%),
    radial-gradient(circle at top right, rgba(115,152,72,.07), transparent 22%),
    linear-gradient(180deg, #f5fafd 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(900px 520px at 8% -6%, rgba(39,189,242,.10), transparent 60%),
    radial-gradient(800px 480px at 100% -4%, rgba(130,201,95,.07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

a { color: inherit; }

/* ── Auth surfaces ──────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 18%, rgba(2,153,216,.16), transparent 24%),
    radial-gradient(circle at 86% 20%, rgba(115,152,72,.18), transparent 22%),
    linear-gradient(145deg, #0c1d13 0%, #152a1c 34%, #0d2230 100%);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-shell-compact {
  padding: 24px;
}

.auth-card {
  width: min(1120px, 100%);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(255,255,255,.96);
  box-shadow: 0 32px 100px rgba(3, 10, 18, .38);
  border: 1px solid rgba(255,255,255,.08);
}

.auth-card-split {
  display: grid;
  grid-template-columns: minmax(300px, .95fr) minmax(360px, 1fr);
}

.auth-card-mfa {
  width: min(980px, 100%);
}

.auth-aside {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 36px 34px;
  color: #eef6ff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)),
    linear-gradient(160deg, #102317 0%, #173a24 58%, #113246 100%);
}

.auth-badge {
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.auth-aside-title {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.7rem);
  line-height: .98;
  letter-spacing: -.05em;
  text-wrap: balance;
}

.auth-aside-copy {
  margin: 0;
  max-width: 34ch;
  color: rgba(238,246,255,.78);
  font-size: .98rem;
}

.auth-note-list {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.auth-note-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  background: rgba(255,255,255,.05);
}

.auth-note-item i {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255,255,255,.1);
  color: #fff;
}

.auth-note-item strong,
.auth-note-item span {
  display: block;
}

.auth-note-item strong {
  font-size: .92rem;
  font-weight: 700;
}

.auth-note-item span {
  color: rgba(238,246,255,.74);
  font-size: .86rem;
}

.auth-meta {
  margin-top: auto;
  color: rgba(238,246,255,.62);
  font-size: .78rem;
}

.auth-form-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 38px 38px 36px;
}

.auth-brand-inline {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.auth-brand-wordmark {
  color: var(--ricrea-green-dark);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -.05em;
}

.auth-brand-product {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .82rem;
}

.auth-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 2vw, 2.35rem);
  line-height: 1;
  letter-spacing: -.05em;
}

.auth-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 34ch;
}

.auth-eyebrow {
  margin-bottom: 10px;
  color: var(--brand-2);
  font-size: .77rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-alert-stack {
  display: grid;
  gap: 10px;
}

.auth-alert-stack .alert {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: .88rem;
}

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

.auth-field {
  min-width: 0;
}

.auth-field .form-label {
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: .83rem;
  font-weight: 700;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: #7f8ca3;
  font-size: 1rem;
  pointer-events: none;
}

.auth-input {
  min-height: 52px;
  padding: .8rem .9rem .8rem 44px;
  border: 1px solid #d6e0ec;
  border-radius: 12px;
  background: var(--panel-strong);
  font-size: .96rem;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(2,153,216,.16);
}

.auth-input-icon {
  color: #8a96a8;
}

.auth-code-input {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  letter-spacing: .38em;
  text-align: center;
  padding-left: 52px;
  font-variant-numeric: tabular-nums;
}

.auth-support-copy {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: .84rem;
}

.btn-login.auth-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 8px 20px rgba(2,153,216,.20);
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.btn-login.auth-submit:hover {
  background: var(--brand-2);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(2,153,216,.26);
}

.btn-login.auth-submit:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(2,153,216,.20);
}

.btn-login.auth-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(2,153,216,.35), 0 8px 20px rgba(2,153,216,.20);
}

.btn-login.auth-submit:disabled,
.btn-login.auth-submit.is-loading {
  cursor: default;
  opacity: .9;
  transform: none;
}

.btn-login.auth-submit.is-loading .auth-submit-label {
  visibility: hidden;
}

.btn-login.auth-submit.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin .6s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-login.auth-submit.is-loading::after { animation-duration: 1.4s; }
}

.login-page {
  background:
    radial-gradient(circle at 88% 12%, rgba(2, 153, 216, 0.10), transparent 30%),
    radial-gradient(circle at 8% 92%, rgba(74, 124, 47, 0.08), transparent 32%),
    linear-gradient(180deg, #f5fafd 0%, #e9f2f8 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(440px, 100%);
  padding: 36px 34px 28px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid #e4ebf2;
  box-shadow: 0 18px 50px rgba(20, 40, 70, 0.10);
}

.login-card-compact {
  width: min(430px, 100%);
}

.login-card-topline {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(115, 152, 72, 0.12);
  color: #355623;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.login-brand-lockup {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 18px;
}

.login-brand-name {
  color: var(--ricrea-green-dark);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.05em;
}

.login-brand-product {
  color: #5f6f83;
  font-size: .82rem;
  font-weight: 500;
}

/* ── 2FA codice (6 caselle) ─────────────────────────────────────────────── */
.otp-group {
  display: flex;
  gap: 10px;
  width: 100%;
}

.otp-cell {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  height: 58px;
  padding: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #132031;
  border: 1px solid #d6e0ec;
  border-radius: 12px;
  background: var(--panel-strong);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.otp-cell:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(2,153,216,.16);
}

.otp-cell.is-filled {
  border-color: var(--brand-green);
}

.otp-cell.is-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220,38,38,.14);
}

.auth-help-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: .84rem;
  text-align: center;
}

.auth-help-note a {
  color: var(--brand-2);
  font-weight: 600;
  text-decoration: none;
}

.login-heading {
  margin-top: 28px;
}

.login-heading h1 {
  margin: 0;
  color: #132031;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -.05em;
}

.login-heading p {
  margin: 10px 0 0;
  color: var(--muted);
}

.security-admin-note {
  padding: 16px 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: var(--bg-2);
}

.security-admin-note-title {
  color: #10221b;
  font-size: .94rem;
  font-weight: 800;
}

.security-admin-note-copy {
  margin-top: 6px;
  color: #64748b;
  font-size: .88rem;
}

@media (max-width: 920px) {
  .auth-shell,
  .auth-shell-compact {
    padding: 18px;
  }

  .auth-card-split {
    grid-template-columns: 1fr;
  }

  .auth-aside,
  .auth-form-side {
    padding: 26px 22px;
  }

  .auth-meta {
    margin-top: 8px;
  }

  .login-shell {
    padding: 16px;
  }

  .login-card {
    padding: 26px 22px 22px;
  }
}

/* ── MFA setup ──────────────────────────────────────────────────────────── */
.mfa-setup-page {
  display: grid;
  gap: 22px;
}

.mfa-setup-shell {
  display: grid;
  gap: 20px;
}

.mfa-setup-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px;
  border: 1px solid rgba(17, 34, 51, 0.08);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(2,153,216,.12), transparent 28%),
    linear-gradient(135deg, #fdfefe 0%, #eef6ef 100%);
  box-shadow: var(--shadow-lg);
}

.mfa-setup-banner h2,
.mfa-recovery-head h3,
.mfa-panel-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.02;
  letter-spacing: -.04em;
}

.mfa-setup-banner p,
.mfa-recovery-head p,
.mfa-panel-head p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 56ch;
}

.mfa-setup-eyebrow {
  margin-bottom: 10px;
  color: var(--brand-2);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mfa-status-pill,
.mfa-chip,
.mfa-recovery-warning {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
}

.mfa-status-pill {
  color: #133748;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(2,153,216,.18);
}

.mfa-setup-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.06fr) minmax(280px, .94fr);
  gap: 20px;
}

.mfa-qr-card,
.mfa-manual-card,
.mfa-confirm-card,
.mfa-recovery-panel {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow-lg);
}

.mfa-panel-head,
.mfa-recovery-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.mfa-chip {
  color: var(--brand-2);
  background: rgba(2,153,216,.1);
}

.mfa-qr-frame {
  display: grid;
  place-items: center;
  min-height: 320px;
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(17, 34, 51, 0.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,.95), rgba(241,247,252,.95)),
    radial-gradient(circle at top, rgba(2,153,216,.08), transparent 36%);
}

.mfa-qr-frame img {
  width: min(280px, 100%);
  height: auto;
  display: block;
}

.mfa-qr-fallback {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.mfa-qr-fallback i {
  font-size: 2.2rem;
  color: var(--brand-2);
}

.mfa-step-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-2);
}

.mfa-step-list li + li {
  margin-top: 10px;
}

.mfa-info-callout {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 16px;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--brand-soft);
  color: #14445a;
}

.mfa-secret-field,
.mfa-manual-details textarea,
.mfa-code-input {
  font-variant-numeric: tabular-nums;
}

.mfa-secret-field {
  min-height: 52px;
}

.mfa-manual-details {
  margin-top: 14px;
}

.mfa-manual-details summary {
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 700;
}

.mfa-device-card {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #f7fafc;
  border: 1px solid var(--line);
}

.mfa-device-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.mfa-device-value {
  margin-top: 6px;
  color: var(--ink);
  font-size: .98rem;
  font-weight: 700;
}

.mfa-confirm-form {
  display: flex;
  align-items: end;
  gap: 14px;
}

.mfa-code-field {
  flex: 1;
}

.mfa-code-input {
  min-height: 56px;
  border-radius: 18px;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  letter-spacing: .34em;
  text-align: center;
}

.mfa-confirm-submit {
  min-width: 180px;
  min-height: 56px;
  border-radius: 18px;
}

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

.mfa-recovery-grid code {
  display: block;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font-size: .98rem;
}

.mfa-recovery-warning {
  color: #8a5d05;
  background: #fff6dd;
}

@media (max-width: 920px) {
  .mfa-setup-banner,
  .mfa-panel-head,
  .mfa-recovery-head,
  .mfa-confirm-form {
    flex-direction: column;
  }

  .mfa-setup-grid,
  .mfa-recovery-grid {
    grid-template-columns: 1fr;
  }

  .mfa-qr-frame {
    min-height: 260px;
  }

  .mfa-confirm-submit {
    width: 100%;
  }
}

/* ── Layout: navbar orizzontale ────────────────────────────────────────── */
.app-shell { min-height: 100vh; }

/* Navbar */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(92deg, #0a2233 0%, #0e3a52 55%, #0b2c40 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 6px 22px rgba(8,30,46,.22);
}
.topnav-inner {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
}
.topnav-logo {
  flex-shrink: 0;
  margin-right: 28px;
  display: flex;
  align-items: center;
}
.topnav-logo img {
  height: 32px;
  width: auto;
  display: block;
  border-radius: 4px;
  background: var(--panel-strong);
  padding: 2px 6px;
}
.topnav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}
.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255,255,255,.78);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s;
  border: 1px solid transparent;
}
.topnav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.10);
}
.topnav-link.active {
  color: #fff;
  background: rgba(2,153,216,.30);
  border-color: rgba(2,153,216,.35);
  font-weight: 600;
}
/* Toggle tema: nascosto di default (il tema chiaro/scuro esiste solo sulle
   pagine bento che caricano dashboard.css, dove viene mostrato e stilizzato).
   Senza questa regola globale, fuori da quelle pagine il bottone comparirebbe
   non stilizzato. */
/* Toggle tema chiaro/scuro: sta nella topnav scura, visibile su ogni pagina */
.dash-theme-toggle {
  display: inline-grid; place-items: center; cursor: pointer; flex: none;
  width: 38px; height: 38px; margin-right: 12px; padding: 0;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.10);
  color: rgba(255,255,255,.92); border-radius: 50%; transition: .16s;
}
.dash-theme-toggle:hover { border-color: #27bdf2; color: #27bdf2; }
.dash-theme-toggle .bi { font-size: 1.05rem; line-height: 1; }
.dash-theme-toggle .lbl-light,
.dash-theme-toggle .lbl-dark { display: grid; place-items: center; grid-area: 1/1; }
.dash-theme-toggle .lbl-dark { display: none; }
html[data-theme="dark"] .dash-theme-toggle .lbl-light { display: none; }
html[data-theme="dark"] .dash-theme-toggle .lbl-dark { display: grid; }
.topnav-user { margin-left: auto; flex-shrink: 0; }
.topnav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: #fff;
  font-size: .84rem;
  font-weight: 500;
  cursor: pointer;
  transition: .15s;
}
.topnav-user-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.topnav-user-btn::after { display: none; } /* hide bs caret */
.topnav-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #0299D8;
  color: #fff;
  font-weight: 700;
  font-size: .78rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topnav-username { color: rgba(255,255,255,.9); }
.topnav-hamburger {
  background: none; border: none;
  color: #fff; font-size: 1.4rem;
  padding: 6px; margin-left: 8px;
  cursor: pointer;
}
.topnav-link:focus-visible,
.topnav-user-btn:focus-visible,
.topnav-hamburger:focus-visible,
.btn-modern:focus-visible,
.btn-row-action:focus-visible,
.btn-ghost:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.dropdown-item:focus-visible {
  outline: 3px solid rgba(2,153,216,.45);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255,255,255,.55);
}

/* Page header */
.page-header {
  background: var(--panel-strong);
  border-bottom: 1px solid #e5e7eb;
  padding: 18px 0;
}
.page-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-title  { font-family: var(--font-sans); font-size: 1.5rem; font-weight: 800; letter-spacing: -.022em; color: var(--ink); margin: 0; }
.page-subtitle { color: var(--muted); font-size: .9rem; margin: 3px 0 0; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* Main content */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

/* Mobile nav */
@media (max-width: 991px) {
  .topnav-links {
    display: none;
    position: absolute;
    top: 58px; left: 0; right: 0;
    background: #0a2233;
    flex-direction: column;
    padding: 12px 16px;
    gap: 4px;
    border-top: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
  }
  .topnav-links.open { display: flex; }
  .topnav-inner { position: relative; flex-wrap: nowrap; }
  .topnav-link { width: 100%; }
  .page-header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 18px;
  }
  .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-actions .btn-modern {
    flex: 1 1 160px;
  }
  .main-content {
    padding: 18px;
  }
}
.btn-modern {
  border-radius: 8px;
  padding: .78rem 1.08rem;
  font-weight: 700;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn-brand {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #5E8E2B);
  box-shadow: 0 14px 30px rgba(2,153,216,.25);
}
.btn-brand:hover { color: #fff; }
.btn-ghost {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}
.btn-row-action {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.18);
  background: white;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.page-shell { padding: 28px; }
.card-soft {
  border: 1px solid rgba(148, 163, 184, .16);
  background: var(--panel);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}
.card-elevated {
  border: 1px solid rgba(148,163,184,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.88));
  border-radius: 8px;
  box-shadow: var(--shadow-xl);
}
.card-soft .card-body,
.card-elevated .card-body,
.insight-card,
.metric-card { position: relative; }
.flash-stack .alert { padding: 14px 18px; }

.table-th-soft {
  font-weight: 600;
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #9aa4b0;
}

.pagination-clean {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-summary {
  color: var(--ink-muted);
  font-size: .84rem;
}

.pagination-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-link {
  min-width: 34px;
  height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink-2);
  font-weight: 700;
  font-size: .82rem;
  text-align: center;
  text-decoration: none;
}

.pagination-link:hover,
.pagination-link.active {
  border-color: #739848;
  background: #f4f8ef;
  color: #1d4b2c;
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 168px;
  padding: 22px 22px 20px;
}
.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -34px -34px auto;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  filter: blur(8px);
}
.metric-gradient-blue { background: linear-gradient(135deg, #0299D8 0%, #0180B5 100%); color: white; }
.metric-gradient-teal { background: linear-gradient(135deg, #739848 0%, #4A7C2F 100%); color: white; }
.metric-gradient-purple { background: linear-gradient(135deg, #e67e22 0%, #d35400 100%); color: white; }
.metric-gradient-rose { background: linear-gradient(135deg, #e11d48 0%, #fb7185 100%); color: white; }
.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.15);
  margin-bottom: 14px;
  font-size: 1.05rem;
}
.metric-label { font-size: .84rem; font-weight: 700; opacity: .92; text-transform: uppercase; letter-spacing: .06em; }
.metric-value { margin-top: 10px; font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.metric-foot { margin-top: 12px; font-size: .87rem; opacity: .9; }
.metric-note {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  font-size: .76rem;
  font-weight: 700;
}

.hero-shell { position: relative; }
.hero-main {
  overflow: hidden;
  padding: 30px;
  background:
    radial-gradient(circle at 82% 16%, rgba(255,255,255,.18), transparent 22%),
    radial-gradient(circle at 10% 100%, rgba(255,255,255,.08), transparent 22%),
    linear-gradient(135deg, #0180B5 0%, #0299D8 34%, #5a57ff 72%, #739848 100%);
  color: white;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(290px, .7fr);
  gap: 22px;
  align-items: stretch;
}
.hero-eyebrow { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.12); color: white; box-shadow: none; }
.hero-title { font-size: 1.95rem; font-weight: 800; letter-spacing: -.04em; max-width: 700px; line-height: 1.08; }
.hero-subtitle { font-size: .98rem; color: rgba(255,255,255,.84); max-width: 760px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hero-badge,
.light-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.14);
  font-weight: 700;
  font-size: .82rem;
}
.hero-side-panel,
.recommend-card {
  padding: 22px;
  border-radius: 8px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(18px);
}
.mini-kpi-label,
.mini-progress-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  opacity: .78;
}
.mini-kpi-value { margin-top: 10px; font-size: 3.1rem; line-height: 1; font-weight: 800; letter-spacing: -.05em; }
.mini-kpi-foot,
.mini-progress-foot { margin-top: 8px; color: rgba(255,255,255,.82); font-size: .9rem; }
.hero-side-divider { height: 1px; background: rgba(255,255,255,.18); margin: 16px 0; }
.mini-progress-bar {
  margin-top: 10px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  overflow: hidden;
}
.mini-progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c4b5fd, #ffffff); }

.section-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.section-subtitle { margin-top: 4px; color: var(--muted); font-size: .92rem; }
.booking-mobile-card {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
}
.booking-mobile-card:hover {
  border-color: #bfd3ff;
  box-shadow: 0 10px 24px rgba(2, 153, 216, .08);
  color: var(--ink);
}
.booking-mobile-code {
  font-size: .92rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.booking-mobile-date {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 2px;
}
.booking-mobile-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .76rem;
}
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.mobile-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mobile-entity-card {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
  text-decoration: none;
}
.min-w-0 { min-width: 0; }
.mobile-entity-card:hover {
  border-color: #bfd3ff;
  box-shadow: 0 10px 24px rgba(2, 153, 216, .08);
  color: var(--ink);
}
.mobile-entity-title {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.mobile-entity-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.mobile-entity-meta {
  display: flex;
  gap: 10px 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.35;
}
.mobile-entity-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.mobile-entity-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.mobile-entity-actions .btn,
.mobile-entity-actions .btn-modern {
  min-height: 40px;
}
.soft-pill,
.status-pill,
.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}
.soft-pill { background: var(--slate-soft); color: var(--ink-2); }
.soft-pill.brand { background: var(--brand-soft); color: var(--brand); }
.soft-pill.purple { background: #f3e8ff; color: #7e22ce; }
.soft-pill.teal { background: #ccfbf1; color: #0f766e; }
.status-valid { background: var(--green-soft); color: #166534; }
.status-expiring { background: var(--yellow-soft); color: #b45309; }
.status-expired { background: var(--red-soft); color: #b91c1c; }
.status-unknown { background: #eef2f7; color: var(--ink-muted); }
.status-ok { background: #dbeafe; color: #1d4ed8; }
.status-below { background: var(--red-soft); color: #b91c1c; }
.muted-mini { color: var(--muted); font-size: .86rem; }
.table-caption { color: var(--muted); font-size: .82rem; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.table-subtitle { color: var(--ink-2); font-size: .92rem; margin-top: 3px; }
.entity-code { font-size: 1.95rem; line-height: 1; font-weight: 800; letter-spacing: -.04em; }
.highlight-number { font-size: 2.2rem; font-weight: 800; letter-spacing: -.05em; }

.filter-label,
.form-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.filter-card .form-control,
.filter-card .form-select,
.form-modern {
  min-height: 50px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(255,255,255,.9);
  padding-inline: 15px;
}
.filter-card .form-control:focus,
.filter-card .form-select:focus,
.form-modern:focus {
  border-color: rgba(2,153,216,.5);
  box-shadow: 0 0 0 .22rem rgba(2,153,216,.10);
}
.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: .62rem .95rem;
  font-weight: 700;
  border: 1px solid rgba(148,163,184,.18);
  background: white;
  color: var(--ink-2);
}
.btn-chip.active {
  background: linear-gradient(135deg, rgba(2,153,216,.12), rgba(115,152,72,.10));
  border-color: rgba(2,153,216,.24);
  color: var(--brand);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.filter-span-4 { grid-column: span 4; }
.filter-span-3 { grid-column: span 3; }
.filter-span-2 { grid-column: span 2; }
.filter-span-12 { grid-column: span 12; }
.card-mini-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-5 { grid-column: span 5; }
.col-span-6 { grid-column: span 6; }
.col-span-7 { grid-column: span 7; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

.insight-card {
  padding: 20px;
  border-radius: 8px;
  background: white;
  border: 1px solid rgba(148,163,184,.16);
  box-shadow: var(--shadow-lg);
  height: 100%;
}
.stat-card-clean { padding-top: 18px; }
.stat-icon,
.summary-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(2,153,216,.12), rgba(115,152,72,.14));
  color: var(--brand);
  margin-bottom: 14px;
  font-size: 1rem;
}
.summary-list { display: flex; flex-direction: column; gap: 10px; }
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(248,250,252,.84);
  border: 1px solid rgba(148,163,184,.14);
  transition: transform .16s ease, box-shadow .16s ease;
}
.summary-item:hover,
.watch-row:hover,
.btn-row-action:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15,23,42,.06); }
.summary-copy { display: flex; gap: 12px; align-items: center; }
.progress-stack { display: flex; gap: 8px; margin-top: 16px; }
.progress-seg {
  height: 12px;
  border-radius: 999px;
  flex: 1 1 0;
  background: linear-gradient(90deg, #cbd5e1, #e2e8f0);
  overflow: hidden;
  position: relative;
}
.progress-seg > span { display: block; height: 100%; border-radius: inherit; }
.seg-blue { background: linear-gradient(90deg, #0299D8, #60a5fa); }
.seg-teal { background: linear-gradient(90deg, #0ea5a4, #5eead4); }
.seg-purple { background: linear-gradient(90deg, #739848, #c084fc); }
.seg-red { background: linear-gradient(90deg, #ef4444, #fda4af); }
.legend-row { display: flex; flex-wrap: wrap; gap: 8px; }
.summary-list-lg .summary-item { padding: 18px 18px; border-radius: 8px; }
.progress-stack-lg { margin-top: 22px; }
.insight-card-dark {
  background: linear-gradient(180deg, #0f172a 0%, #172554 100%);
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 20px 60px rgba(15,23,42,.22);
}
.rule-item-dark {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
}
.score-ring {
  --score: 72;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#93c5fd calc(var(--score) * 1%), rgba(255,255,255,.16) 0);
  margin: 4px auto 18px;
}
.score-ring::before {
  content: "";
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: white;
}
.score-ring-dark::before { background: #0f172a; }
.score-ring-label {
  position: relative;
  margin-top: -112px;
  text-align: center;
  font-weight: 800;
}
.score-ring-label span { display: block; color: var(--muted); font-size: .82rem; font-weight: 600; }
.score-ring-label-light { color: white; }
.score-ring-label-light span { color: rgba(255,255,255,.68); }

.watch-list { display: flex; flex-direction: column; gap: 12px; }
.watch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.14);
  background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(255,255,255,.85));
}
.watch-code { font-weight: 800; letter-spacing: -.03em; }
.watch-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-items: center; }
.watch-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #0f172a;
  color: white;
  font-weight: 800;
}

.timeline-list { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { display: flex; gap: 14px; align-items: flex-start; }
.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: 7px;
  flex: 0 0 14px;
  box-shadow: 0 0 0 6px rgba(148,163,184,.12);
}
.timeline-dot.valid { background: var(--green); }
.timeline-dot.expiring { background: var(--yellow); }
.timeline-dot.expired { background: var(--red); }
.timeline-content {
  flex: 1 1 auto;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(248,250,252,.84);
  border: 1px solid rgba(148,163,184,.13);
}
.timeline-meta {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: .83rem;
}
.timeline-meta span { display: inline-flex; align-items: center; gap: 6px; }

.table-responsive,
.table-surface {
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.14);
  background: rgba(255,255,255,.78);
  overflow: hidden;
}
.table-sticky-head thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table { margin-bottom: 0; }
.data-table thead th {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  border-bottom: 1px solid rgba(148,163,184,.16);
  background: rgba(248,250,252,.96);
  padding: 16px 16px;
  white-space: nowrap;
  font-weight: 800;
}
.data-table tbody td {
  padding: 16px;
  border-bottom: 1px solid rgba(148,163,184,.10);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(248,250,252,.72); }
.row-alert-below { background: linear-gradient(90deg, rgba(254,226,226,.72), transparent 45%); }
.row-alert-empty { background: linear-gradient(90deg, rgba(237,242,247,.9), transparent 45%); }
.table-entity { min-width: 230px; }
.entity-link {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.03em;
  text-decoration: none;
}
.entity-link:hover { color: var(--brand); }
.table-big-number {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.coverage-stack { display: flex; flex-direction: column; gap: 8px; }

.detail-hero {
  padding: 28px;
  background:
    radial-gradient(circle at 82% 16%, rgba(255,255,255,.18), transparent 22%),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 45%, #739848 100%);
}
.detail-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr);
  gap: 22px;
  align-items: stretch;
}
.detail-topline { display: flex; gap: 10px; flex-wrap: wrap; }
.light-pill { color: white; }
.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.detail-meta-card {
  padding: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
}
.detail-meta-label { color: rgba(255,255,255,.75); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.detail-meta-value { margin-top: 8px; font-size: 1.5rem; font-weight: 800; color: white; letter-spacing: -.04em; }
.recommend-name { margin-top: 10px; font-size: 1.35rem; font-weight: 800; color: white; }
.recommend-row {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: rgba(255,255,255,.9);
  font-size: .92rem;
}
.recommend-row span { display: inline-flex; align-items: center; gap: 8px; color: rgba(255,255,255,.72); }
.empty-note {
  margin-top: 14px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.88);
}
.note-surface {
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7faff, #edf4ff);
  border: 1px solid #d8e6ff;
  color: var(--ink-2);
}
.note-surface-sm { padding: 16px; }
.rule-list { display: flex; flex-direction: column; gap: 10px; }
.rule-item {
  padding: 13px 14px;
  border-radius: 8px;
  background: rgba(248,250,252,.88);
  border: 1px solid rgba(148,163,184,.13);
}
.variant-card {
  border: 1px solid rgba(148,163,184,.16);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(248,250,252,.95), rgba(255,255,255,.82));
}
.variant-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.empty-state { padding: 36px 20px; text-align: center; color: var(--muted); }
.mobile-top-note { display: none; }

@media (max-width: 1400px) {
  .col-span-3 { grid-column: span 6; }
  .col-span-4 { grid-column: span 6; }
  .col-span-5, .col-span-7, .col-span-8 { grid-column: span 12; }
}
@media (max-width: 1180px) {
  .hero-grid,
  .detail-hero-grid { grid-template-columns: 1fr; }
  .detail-meta-grid { grid-template-columns: 1fr; }
  .commercial-dashboard-strip,
  .commercial-dashboard-focus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .commercial-dashboard-analysis-grid,
  .commercial-dashboard-registers {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 991px) {
  .sidebar {
    position: static;
    width: 100%;
    border-radius: 0 0 24px 24px;
    box-shadow: none;
  }
  
  .topbar { position: static; }
  .page-shell, .topbar { padding: 18px; }
  .mobile-top-note { display: block; }
  .filter-span-4, .filter-span-3, .filter-span-2, .filter-span-12,
  .col-span-3, .col-span-4, .col-span-5, .col-span-6, .col-span-7, .col-span-8, .col-span-12 {
    grid-column: span 12;
  }
  .topbar-inner { flex-direction: column; align-items: flex-start; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .watch-row,
  .variant-head,
  .summary-item { flex-direction: column; align-items: flex-start; }
  .watch-meta { justify-content: flex-start; }
}


:root {
  --accent-dark: #081127;
  --accent-dark-2: #101c44;
  --accent-glow: rgba(99,102,241,.24);
  --focus-ring: 0 0 0 .24rem rgba(59,130,246,.16);
}

::selection { background: rgba(59,130,246,.18); }

a, button, .btn, .form-control, .form-select, .side-link, .summary-item, .watch-row, .btn-chip, .btn-row-action, .entity-link, .soft-pill {
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}

a:focus-visible, button:focus-visible, .btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible, .side-link:focus-visible, .summary-item:focus-visible, .watch-row:focus-visible, .btn-chip:focus-visible, .btn-row-action:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.sidebar {
  background:
    radial-gradient(circle at top left, rgba(96,165,250,.14), transparent 24%),
    radial-gradient(circle at bottom left, rgba(115,152,72,.12), transparent 26%),
    linear-gradient(180deg, #071126 0%, #0c1634 42%, #111a3d 100%);
}

/* sidebar-logo-area rimossa */
.sidebar-logo-area img {
  filter: brightness(0) invert(1);
  opacity: .92;
  transition: opacity .2s;
}
.sidebar-logo-area img:hover { opacity: 1; }

.brand-box {
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.05));
  border-color: rgba(255,255,255,.10);
}
.side-link:hover {
  transform: translateX(2px);
  background: rgba(255,255,255,.075);
}
.side-link.active {
  background: linear-gradient(135deg, rgba(2,153,216,.42), rgba(115,152,72,.28));
  border-color: rgba(147, 197, 253, .28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 14px 28px rgba(15,23,42,.18);
}
.side-link.active .side-icon {
  background: rgba(255,255,255,.14);
  color: #fff;
}
.topbar {
  background: rgba(247,250,255,.88);
}
.btn-modern:hover {
  transform: translateY(-1px);
}
.btn-brand:hover {
  box-shadow: 0 16px 36px rgba(2,153,216,.28);
}
.btn-ghost:hover {
  background: var(--bg-2);
  border-color: #cfe0ff;
}
.card-soft:hover,
.card-elevated:hover {
  box-shadow: 0 20px 48px rgba(15,23,42,.08);
}
.summary-item:hover,
.watch-row:hover,
.btn-row-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15,23,42,.08);
}
.filter-card .form-control,
.filter-card .form-select,
.form-modern {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.92));
}
.filter-card .form-control:hover,
.filter-card .form-select:hover,
.form-modern:hover {
  border-color: rgba(59,130,246,.28);
}
.filter-card .form-control:focus,
.filter-card .form-select:focus,
.form-modern:focus,
.is-active-filter {
  border-color: rgba(2,153,216,.52) !important;
  box-shadow: inset 0 0 0 1px rgba(2,153,216,.10), var(--focus-ring) !important;
  background: linear-gradient(180deg, #ffffff, #f3f8ff) !important;
}
.btn-chip {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.btn-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(59,130,246,.24);
  background: var(--bg-2);
  color: var(--brand);
}
.btn-chip.active {
  background: linear-gradient(135deg, rgba(2,153,216,.18), rgba(115,152,72,.16));
  border-color: rgba(2,153,216,.34);
  color: var(--brand);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78), 0 10px 22px rgba(2,153,216,.12);
}
.table-surface {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.92));
  border-color: rgba(148,163,184,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.data-table thead th {
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
  border-bottom-color: rgba(148,163,184,.20);
  box-shadow: inset 0 -1px 0 rgba(148,163,184,.10);
}
.data-table tbody tr {
  position: relative;
}
.data-table tbody tr:nth-child(even) {
  background: rgba(248,250,252,.48);
}
.data-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(2,153,216,.045), rgba(115,152,72,.02));
}
.data-table tbody tr::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}
.data-table tbody tr:hover::before {
  background: linear-gradient(180deg, #60a5fa, #739848);
}
.row-alert-below::before { background: linear-gradient(180deg, #f87171, #ef4444) !important; }
.row-alert-empty::before { background: linear-gradient(180deg, #94a3b8, #64748b) !important; }
.entity-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.entity-link::after {
  content: "→";
  font-size: .9rem;
  color: rgba(2,153,216,.0);
  transform: translateX(-3px);
  transition: transform .18s ease, color .18s ease;
}
.entity-link:hover::after {
  color: var(--brand);
  transform: translateX(0);
}
.table-big-number {
  font-size: 1.22rem;
}
.btn-row-action {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.btn-row-action:hover {
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  border-color: rgba(59,130,246,.26);
}
.insight-card-dark {
  background:
    radial-gradient(circle at top right, rgba(96,165,250,.16), transparent 24%),
    linear-gradient(180deg, #09132a 0%, #0d1735 52%, #162a63 100%);
}
.score-ring-wrap {
  position: relative;
  width: 176px;
  height: 176px;
  margin: 10px auto 20px;
}
.score-ring {
  width: 176px;
  height: 176px;
  margin: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.score-ring::before {
  width: 120px;
  height: 120px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.score-ring-label {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  line-height: 1.05;
  z-index: 1;
  font-size: 1.05rem;
}
.score-ring-label span {
  margin-top: 6px;
  font-size: .8rem;
  line-height: 1.2;
}
.rule-item-dark {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.09);
  color: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
}
.rule-item-dark strong { color: #fff; }
.watch-row, .summary-item {
  text-decoration: none;
}
@media (max-width: 991px) {
  .score-ring-wrap,
  .score-ring {
    width: 160px;
    height: 160px;
  }
}


.sidebar-brand-simple {
  display:flex;
  align-items:center;
  gap:12px;
  padding: 10px 10px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: linear-gradient(135deg, rgba(2,153,216,.34), rgba(115,152,72,.28));
  color: white;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10);
}
.sidebar-brand-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; }
.sidebar-brand-mini { color: rgba(255,255,255,.56); font-size: .82rem; margin-top: 2px; }

.metric-card.compact {
  min-height: 152px;
  padding: 20px 20px 18px;
}
.metric-card.compact .metric-value { font-size: 1.75rem; }
.metric-card.compact .metric-foot { margin-top: 10px; opacity: .88; }

.summary-list-tight { gap: 12px; }
.status-stack-simple { display:flex; flex-direction:column; }
.status-line-simple {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  font-size: .95rem;
  color: var(--ink-2);
}
.status-line-simple strong { font-size: .95rem; color: var(--ink); }
.progress-modern {
  height: 10px;
  background: #e9eff7;
  border-radius: 999px;
  overflow: hidden;
}
.progress-modern .progress-bar {
  background: linear-gradient(90deg, var(--brand), #5b8cff);
  border-radius: 999px;
}
.progress-modern.teal .progress-bar {
  background: linear-gradient(90deg, var(--teal), #4fd1c5);
}
.progress-modern.purple .progress-bar {
  background: linear-gradient(90deg, var(--purple), #9f67ff);
}

.dashboard-simple-head {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 16px;
}

@media (max-width: 991.98px) {
  .sidebar-brand-simple { padding-top: 0; }
}

/* v3.5 – pagina giacenze più sobria e operativa */
.giacenze-summary-card,
.filter-panel-clean,
.giacenze-table-card {
  overflow: hidden;
}

.giacenze-toolbar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.ops-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.ops-kpi {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,250,255,.94));
  border: 1px solid rgba(201,213,228,.9);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 8px 24px rgba(15,23,42,.04);
}

.ops-kpi-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.ops-kpi-value {
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.04em;
}

.clean-filter-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.form-control-strong,
.form-select.form-control-strong {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  box-shadow: none;
}

.form-control-strong:focus,
.form-select.form-control-strong:focus {
  border-color: rgba(2,153,216,.45);
  box-shadow: 0 0 0 4px rgba(2,153,216,.12);
}

.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-header-clean {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(217,226,238,.9);
}

.enterprise-table-wrap {
  background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(249,251,255,.97));
}

.enterprise-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7faff;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid rgba(217,226,238,.95);
  padding: 16px 20px;
  white-space: nowrap;
}

.enterprise-table tbody td {
  padding: 18px 20px;
  border-top: 1px solid rgba(232,238,246,.95);
  vertical-align: middle;
  background: transparent;
}

.enterprise-table tbody tr {
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.enterprise-table tbody tr:hover {
  background: rgba(2,153,216,.028);
}

.waste-main-cell {
  min-width: 260px;
}

.strong-subtitle {
  color: var(--ink-2);
  font-weight: 600;
}

.profile-stack {
  min-width: 220px;
}

.clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.coverage-card-simple {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 210px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid rgba(207,220,237,.92);
  border-radius: 16px;
}

.coverage-card-simple.danger {
  background: #fff7f7;
  border-color: rgba(239,68,68,.22);
}

.coverage-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--ink);
}

.enterprise-table .btn-row-action {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.enterprise-table .row-alert-empty td {
  background: transparent;
}

.enterprise-table .row-alert-below td {
  background: transparent;
}

@media (max-width: 1199px) {
  .ops-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .clean-filter-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .filter-span-5,
  .filter-span-2,
  .filter-span-1 {
    grid-column: span 6;
  }

  .giacenze-toolbar-head,
  .table-header-clean {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .ops-kpi-row {
    grid-template-columns: 1fr;
  }

  .enterprise-table thead th,
  .enterprise-table tbody td {
    padding: 14px 14px;
  }
}


/* v3.6 – scheda rifiuto più essenziale */
.detail-hero-compact {
  padding: 26px 28px;
  border-radius: 26px;
}
.detail-hero-grid-compact {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 18px;
}
.entity-code-compact {
  font-size: 1.65rem;
}
.detail-title-compact {
  font-size: 1.3rem;
  line-height: 1.25;
  font-weight: 700;
  max-width: 820px;
}
.detail-meta-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.recommend-card-compact {
  padding: 18px 20px;
  border-radius: 20px;
}
.compact-note-band {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(148,163,184,.16);
  box-shadow: var(--shadow-lg);
}
.compact-note-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--slate-soft);
  color: var(--ink-2);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.section-head-compact {
  margin-bottom: 14px;
}
.data-table-compact thead th {
  font-size: .71rem;
  padding: 13px 14px;
}
.data-table-compact tbody td {
  padding: 13px 14px;
  font-size: .92rem;
}
.variant-card-compact {
  padding: 14px;
  border-radius: 18px;
}
.variant-head-compact {
  margin-bottom: 10px;
}
.note-surface.note-surface-sm {
  font-size: .9rem;
}
@media (max-width: 991px) {
  .detail-hero-compact {
    padding: 20px;
  }
  .compact-note-band {
    grid-template-columns: 1fr;
  }
}

/* === 2026-03-23 simplification pass === */
body {
  background: #f5f7fb;
}

.sidebar {
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.10);
}

.topbar {
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  background: var(--bg-2);
  box-shadow: none;
  border-color: var(--line);
}

.card-soft,
.clean-panel,
.simple-stats-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
  backdrop-filter: none;
}

.section-title {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 800;
}
.section-subtitle,
.table-caption,
.muted-mini,
.topbar-subtitle {
  color: var(--muted) !important;
}

.simple-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: .85rem;
  font-weight: 700;
}
.simple-counter.small {
  padding: 4px 10px;
  font-size: .78rem;
}

.simple-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.simple-stat {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--bg-2);
}
.simple-stat span {
  display: block;
  color: var(--muted);
  font-size: .84rem;
  margin-bottom: 6px;
}
.simple-stat strong {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
}

.simple-filter-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1fr auto;
  gap: 12px;
}
.filter-col-wide { min-width: 0; }
.form-control-strong,
.form-select.form-control-strong {
  min-height: 46px;
  border-radius: 12px;
  border-color: #cfd8e6;
  box-shadow: none;
}
.form-control-strong:focus,
.form-select.form-control-strong:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(2,153,216,.10);
}
.btn-chip {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink-2);
  font-weight: 600;
}
.btn-chip.active {
  background: #eef4ff;
  border-color: #bfd3ff;
  color: #1d4ed8;
}

.table-header-clean {
  border-bottom: 1px solid #e3eaf3;
  background: var(--bg-2);
}
.clean-enterprise-table thead th,
.clean-data-table thead th,
.enterprise-table thead th,
.data-table thead th {
  background: var(--bg-2);
  color: var(--ink-muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
.clean-enterprise-table tbody td,
.clean-data-table tbody td,
.enterprise-table tbody td,
.data-table tbody td {
  border-color: var(--line);
  color: var(--ink);
  vertical-align: middle;
}
.table-big-number {
  color: #101828;
  font-weight: 800;
}
.table-big-number.smaller {
  font-size: 1rem;
}
.strong-subtitle {
  color: var(--ink);
  font-weight: 600;
}
.entity-link {
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
}
.entity-link:hover { text-decoration: underline; }
.compact-stack .table-caption { margin-bottom: 2px; }

.status-pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .8rem;
  font-weight: 700;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
}
.status-valid { background: #dcfce7; color: #166534; }
.status-ok { background: #dbeafe; color: #1d4ed8; }
.status-below { background: #fee2e2; color: #b42318; }
.status-expiring { background: #fef3c7; color: #b54708; }
.status-expired { background: #fee2e2; color: #b42318; }
.status-unknown { background: #eef2f6; color: var(--ink-muted); }

.row-alert-below { background: #fff9f8; }
.row-alert-empty { background: var(--bg-2); }
.btn-row-action {
  border-color: var(--line);
  color: #1d4ed8;
}

.detail-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}
.detail-page-title {
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.detail-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--ink-2);
  font-size: .95rem;
}
.detail-summary-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.summary-mini-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-2);
  padding: 14px 16px;
}
.summary-mini-label {
  color: var(--muted);
  font-size: .82rem;
  margin-bottom: 6px;
}
.summary-mini-value {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
}
.plain-note {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--bg-2);
  color: var(--ink-2);
}
.detail-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.detail-facts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.detail-facts-grid dt {
  margin: 0 0 4px;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.detail-facts-grid dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}
.clean-variant-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fcfdff;
}
.note-surface {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-muted);
}

/* neutralize previous high-contrast hero styling */
.detail-hero,
.detail-hero-compact,
.recommend-card,
.recommend-card-compact,
.detail-meta-card,
.hero-badge,
.light-pill {
  background: initial;
  color: inherit;
  box-shadow: none;
}

@media (max-width: 1200px) {
  .simple-stats-grid,
  .detail-two-col,
  .detail-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
  .simple-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  
  .sidebar { position: static; width: 100%; }
  .simple-stats-grid,
  .detail-two-col,
  .detail-summary-grid,
  .detail-summary-side,
  .detail-facts-grid,
  .simple-filter-grid {
    grid-template-columns: 1fr;
  }
  .page-shell,
  .topbar { padding: 18px; }
}

/* === 2026-03-23 detail readability fix === */
.detail-header-panel {
  background: var(--panel-strong);
}
.detail-summary-grid-clean {
  grid-template-columns: minmax(0, 1.9fr) minmax(300px, 1fr);
  gap: 20px;
  align-items: center;
}
.detail-code-line {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.detail-summary-side-clean {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.summary-mini-card-strong {
  background: var(--bg-2);
  border-color: var(--line);
}
.detail-inline-list span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.detail-clean-table {
  table-layout: fixed;
}
.detail-clean-table thead th,
.detail-clean-table tbody td {
  background: transparent !important;
}
.detail-clean-table tbody tr:nth-child(even),
.detail-clean-table tbody tr:nth-child(odd) {
  background: transparent;
}
.detail-clean-table tbody tr:hover {
  background: var(--bg-2);
}
.detail-clean-table tbody tr::before {
  display: none;
}
.detail-clean-table tbody td:first-child,
.detail-clean-table thead th:first-child {
  width: 18%;
}
.detail-clean-table tbody td:last-child,
.detail-clean-table thead th:last-child {
  width: 24%;
}
.detail-table-surface {
  background: var(--panel-strong);
  border-color: var(--line);
  overflow: hidden;
}
.detail-table-surface .table {
  margin-bottom: 0;
}
.status-pill {
  line-height: 1.2;
}
.status-valid,
.status-ok,
.status-below,
.status-expiring,
.status-expired,
.status-unknown {
  border-color: transparent;
}
@media (max-width: 1200px) {
  .detail-summary-grid-clean,
  .detail-summary-side-clean {
    grid-template-columns: 1fr;
  }
}


/* === 2026-03-23 alignment and readability hard fix === */
.detail-summary-grid-simple {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}
.detail-summary-stats-simple {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.simple-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
}
.simple-table {
  width: 100%;
  margin: 0;
  table-layout: auto !important;
  border-collapse: separate;
  border-spacing: 0;
}
.simple-table thead th {
  background: var(--bg-2) !important;
  color: var(--ink-muted) !important;
  font-size: .79rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 800;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.simple-table tbody td {
  background: var(--panel-strong) !important;
  color: var(--ink) !important;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.simple-table tbody tr:last-child td {
  border-bottom: none;
}
.simple-table tbody tr:hover td {
  background: var(--bg-2) !important;
}
.simple-table tbody tr::before,
.simple-table thead tr::before,
.detail-clean-table tbody tr::before,
.data-table tbody tr::before {
  display: none !important;
  content: none !important;
}
.detail-clean-table,
.data-table-strong,
.data-table,
.enterprise-table {
  table-layout: auto;
}
.detail-clean-table thead th,
.detail-clean-table tbody td {
  width: auto !important;
}
.detail-header-panel,
.detail-header-panel .card-body {
  background: var(--panel-strong) !important;
}
.detail-header-panel {
  border: 1px solid var(--line) !important;
}
.detail-page-title,
.detail-code-line,
.detail-inline-list,
.detail-inline-list strong,
.summary-mini-label,
.summary-mini-value,
.plain-note,
.plain-note strong {
  color: var(--ink) !important;
}
.detail-code-line,
.summary-mini-label {
  color: var(--muted) !important;
}
.detail-inline-list span {
  background: var(--bg-2) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink) !important;
}
.status-pill {
  white-space: nowrap;
}
@media (max-width: 1200px) {
  .detail-summary-grid-simple,
  .detail-summary-stats-simple {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   v5 FIX — contrasto, phantom elements, allineamento tabelle
   2026-03-23
   ============================================================ */

/* --- 1. entity-link: sposta la freccia → in position:absolute
         così NON occupa spazio inline e non allarga la colonna --- */
.entity-link {
  display: inline-block;
  position: relative;
  padding-right: 0;
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}
.entity-link::after {
  content: none !important;
  display: none !important;
}
.entity-link:hover {
  text-decoration: underline;
  color: #1a3fbb;
}

/* --- 2. Elimina tutti i ::before pseudo-elementi
         nelle righe delle tabelle semplici (phantom bar) --- */
.simple-table-wrap table tr::before,
.simple-table-wrap table tbody tr::before,
.simple-table-wrap table thead tr::before,
.simple-table tbody tr::before,
.simple-table thead tr::before {
  display: none !important;
  content: none !important;
  width: 0 !important;
  position: static !important;
}

/* --- 3. Allineamento tabelle: usa border-collapse:collapse
         (compatibile col wrapper con border-radius esterno) --- */
.simple-table {
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  table-layout: auto !important;
}
.simple-table thead th {
  background: #f5f8fc !important;
  color: var(--ink-2) !important;
  font-size: .79rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 800;
  padding: 13px 16px;
  border-bottom: 2px solid var(--line) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  white-space: nowrap;
  vertical-align: middle;
}
.simple-table tbody td {
  background: var(--panel-strong) !important;
  color: #1a2a3e !important;
  padding: 13px 16px;
  border-bottom: 1px solid #e8eef6 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  vertical-align: middle;
}
.simple-table tbody tr:last-child td {
  border-bottom: none !important;
}
.simple-table tbody tr:hover td {
  background: #f8fafd !important;
}

/* --- 4. Contrasto testi: tutti i testi "muted" portati
         a un livello leggibile su sfondo chiaro --- */
.section-subtitle,
.topbar-subtitle,
.muted-mini,
.table-subtitle,
.filter-label {
  color: #4a5568 !important;
}

.detail-facts-grid dt,
.summary-mini-label,
.detail-code-line {
  color: var(--ink-muted) !important;
}

.detail-facts-grid dd,
.summary-mini-value,
.detail-page-title,
.plain-note {
  color: #0f1f33 !important;
}

.simple-table thead th,
.clean-enterprise-table thead th,
.data-table thead th {
  color: var(--ink-2) !important;
}

/* thead su approvals e plants: icone nelle pill leggibili */
.soft-pill {
  color: #2d3a4d !important;
  background: #eef2f7 !important;
  border: 1px solid #d3dce9;
}
.soft-pill.brand { background: #dbeafe !important; color: #1d4ed8 !important; }
.soft-pill.purple { background: #ede9fe !important; color: #5b21b6 !important; }

/* --- 5. note-surface: contrasto testo su sfondo grigio pallido --- */
.note-surface {
  background: #f5f8fc;
  border: 1px solid var(--line);
  color: var(--ink-2) !important;
  border-radius: 12px;
  padding: 12px 16px;
}

/* --- 6. status pill: bordi espliciti per leggibilità --- */
.status-valid   { background: #dcfce7 !important; color: #14532d !important; border: 1px solid #bbf7d0 !important; }
.status-ok      { background: #dbeafe !important; color: #1e3a8a !important; border: 1px solid #bfdbfe !important; }
.status-below   { background: #fee2e2 !important; color: #7f1d1d !important; border: 1px solid #fecaca !important; }
.status-expiring{ background: #fef3c7 !important; color: #78350f !important; border: 1px solid #fde68a !important; }
.status-expired { background: #fee2e2 !important; color: #7f1d1d !important; border: 1px solid #fecaca !important; }
.status-unknown { background: #f1f5f9 !important; color: #334155 !important; border: 1px solid #cbd5e1 !important; }

/* --- 7. table-entity: dimensione minima controllata --- */
.table-entity {
  min-width: 180px;
  max-width: 280px;
}
.table-entity .entity-link {
  font-size: .92rem;
  line-height: 1.4;
}
.table-entity .table-subtitle {
  color: #4a5568 !important;
  font-size: .84rem;
  margin-top: 2px;
  white-space: normal;
}

/* --- 8. simple-table-wrap: rimuovi bordo doppio con celle --- */
.simple-table-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel-strong);
}

/* --- 9. row-alert leggibile e non troppo invasivo --- */
.row-alert-below td {
  background: #fff8f8 !important;
}
.row-alert-below:hover td {
  background: #fff1f1 !important;
}

/* --- 10. Neutralizza stili Bootstrap .table che confliggono con .simple-table --- */
.simple-table-wrap .table.simple-table {
  border-collapse: collapse !important;
  margin-bottom: 0 !important;
}
.simple-table-wrap .table.simple-table > :not(caption) > * > * {
  background-color: transparent;
  box-shadow: none;
  padding: 13px 16px;
}
.simple-table-wrap .table.simple-table > thead > tr > th {
  background: #f5f8fc !important;
  color: var(--ink-2) !important;
  border-bottom: 2px solid var(--line) !important;
  font-size: .79rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 800;
  vertical-align: middle;
}
.simple-table-wrap .table.simple-table > tbody > tr > td {
  background: var(--panel-strong) !important;
  color: #1a2a3e !important;
  border-bottom: 1px solid #e8eef6 !important;
  border-top: none !important;
  vertical-align: middle;
}
.simple-table-wrap .table.simple-table > tbody > tr:last-child > td {
  border-bottom: none !important;
}
.simple-table-wrap .table.simple-table > tbody > tr:hover > td {
  background: #f8fafd !important;
}

/* --- 11. Status pills: forza wrapping corretto nelle celle --- */
.simple-table tbody td .d-flex.flex-column {
  gap: 5px !important;
}
.status-pill {
  white-space: nowrap;
  line-height: 1.3;
}


/* ============================================================
   v7 — SCHEDA RIFIUTO: pannello decisionale
   ============================================================ */

/* ── Header rifiuto ── */
.waste-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
}
.waste-cer-label {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f1f33;
  line-height: 1.2;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.waste-title {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #739848;
  margin: 0 0 12px;
  line-height: 1.5;
}
.waste-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.waste-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f5f8fc;
  color: #2d3a4d;
  font-size: .83rem;
  font-weight: 600;
}
.waste-stock-box {
  text-align: right;
  min-width: 140px;
}
.waste-stock-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.waste-stock-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: #0f1f33;
  line-height: 1;
}
.waste-stock-unit {
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-top: 3px;
}

/* ── Alert banner ── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.alert-banner:last-child { margin-bottom: 0; }
.alert-banner-red {
  background: #fff0f0;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}
.alert-banner-yellow {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}
.alert-banner-orange {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #7c2d12;
}
.alert-banner-purple {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #4c1d95;
}
.alert-banner-blue {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}
.alert-banner-green {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}
.alert-banner i {
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Pannello decisionale: primo impianto ── */
.decision-panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
}
.decision-label {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.decision-label::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}
.decision-label.decision-label-warn::before { background: #f59e0b; }
.decision-label.decision-label-red::before  { background: #ef4444; }

.decision-plant-name {
  font-size: 1.18rem;
  font-weight: 800;
  color: #0f1f33;
  margin-bottom: 16px;
}
.decision-cost-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 16px;
}
.decision-cost-value {
  font-size: 2rem;
  font-weight: 800;
  color: #0f1f33;
  line-height: 1;
}
.decision-cost-unit {
  font-size: .9rem;
  color: var(--ink-muted);
  font-weight: 600;
}
.decision-cost-transport {
  font-size: .84rem;
  color: var(--ink-muted);
  margin-left: 4px;
}
.decision-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-bottom: 16px;
}
.decision-fact-label {
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-muted);
  margin-bottom: 3px;
}
.decision-fact-value {
  font-size: .93rem;
  font-weight: 600;
  color: #1a2a3e;
}
.decision-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Confronto sbocchi ── */
.best-row td {
  background: #f0fdf4 !important;
}
.best-row:hover td {
  background: #e8fce8 !important;
}
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 800;
  background: #e2e8f0;
  color: #334155;
  flex-shrink: 0;
}
.rank-badge.rank-1 {
  background: #dcfce7;
  color: #14532d;
}

/* ── Varianti ── */
.variant-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
}
.variant-section:last-child { margin-bottom: 0; }
.variant-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}
.variant-section-head:hover {
  background: #f1f5fb;
}
.variant-toggle-icon {
  color: var(--ink-muted);
  transition: transform .2s ease;
  font-size: 1rem;
}
.variant-section-body {
  padding: 0;
}

/* ── No plant state ── */
.no-plant-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  color: var(--ink-muted);
}
.no-plant-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--muted-2);
}

@media (max-width: 1100px) {
  .waste-header { grid-template-columns: 1fr; }
  .waste-stock-box { text-align: left; }
  .decision-facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .decision-facts { grid-template-columns: 1fr; }
}

/* v11 — rimozione gradiente rosso/rosa da righe senza impianto
   Il segnale visivo è ora solo la pill N/A nella colonna Impianti */
.row-alert-empty,
.enterprise-table .row-alert-empty td,
.simple-table tbody tr.row-alert-empty td {
  background: transparent !important;
}
.row-alert-empty::before,
.row-alert-empty td::before {
  display: none !important;
  content: none !important;
}
/* row-alert-below: solo bordo sinistro sottile, niente gradiente di riga */
.enterprise-table .row-alert-below td,
.simple-table tbody tr.row-alert-below td {
  background: transparent !important;
}

/* ── Modifica inline ── */
.editable-field { display: inline-flex; align-items: center; gap: 8px; }
.edit-btn {
  background: none; border: none; padding: 2px 5px; cursor: pointer;
  color: var(--muted-2); border-radius: 6px; line-height: 1; font-size: .85rem;
  transition: color .15s;
}
.edit-btn:hover { color: #0299D8; }
.inline-edit-form { display: none; align-items: center; gap: 6px; margin-top: 6px; }
.inline-edit-form.visible { display: flex; }
.inline-edit-form input, .inline-edit-form select {
  border: 1px solid #93c5fd; border-radius: 8px;
  padding: 4px 10px; font-size: .9rem; outline: none;
  background: #f0f7ff; min-width: 120px;
}
.inline-edit-form input:focus { border-color: #0299D8; box-shadow: 0 0 0 3px rgba(2,153,216,.1); }
.inline-save-btn {
  padding: 4px 12px; border-radius: 8px; border: none;
  background: #0299D8; color: #fff; font-size: .82rem; font-weight: 700; cursor: pointer;
}
.inline-save-btn:hover { background: #1d4ed8; }
.inline-cancel-btn {
  padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-strong); color: var(--ink-muted); font-size: .82rem; cursor: pointer;
}

/* ── Alert chips dashboard ────────────────────────────────────────────── */
.alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
}
.alert-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.alert-chip-red    { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.alert-chip-orange { background:#fff7ed; color:#92400e; border-color:#fed7aa; }
.alert-chip-yellow { background:#fffbeb; color:#78350f; border-color:#fde68a; }
.alert-chip-blue   { background:#eff8ff; color:#0180B5; border-color:#bae6fd; }

.action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15,23,42,.08);
  border-color: #b8c6d9;
}
.action-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.action-card-title {
  font-weight: 800;
  letter-spacing: -.02em;
}
.action-card-meta {
  margin-top: 3px;
  font-size: .82rem;
  color: var(--ink-muted);
  line-height: 1.25;
}
.action-card-count {
  margin-left: auto;
  font-family: 'Fira Code', monospace;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}
.action-card-red .action-card-icon { background:#fef2f2;color:#dc2626; }
.action-card-red .action-card-count { color:#dc2626; }
.action-card-orange .action-card-icon { background:#fff7ed;color:#d97706; }
.action-card-orange .action-card-count { color:#d97706; }
.action-card-yellow .action-card-icon { background:#fffbeb;color:#d97706; }
.action-card-yellow .action-card-count { color:#d97706; }
.action-card-blue .action-card-icon { background:#eff8ff;color:#0299D8; }
.action-card-blue .action-card-count { color:#0299D8; }

.deadline-header-card {
  overflow: hidden;
}
.deadline-topline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.deadline-topline-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248,250,252,.86), rgba(255,255,255,.96));
}
.deadline-topline-label {
  display: block;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.deadline-topline-value {
  display: block;
  margin-top: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 1.85rem;
  line-height: 1;
  color: var(--ink);
}
.deadline-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.deadline-section-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.deadline-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.deadline-filter-form {
  padding: 16px;
  border: 1px solid #e5edf7;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248,250,252,.76), rgba(255,255,255,.96));
}
.deadline-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(180px, 1fr)) 160px;
  gap: 12px;
  align-items: end;
}
.deadline-filter-wide {
  min-width: 0;
}
.deadline-filter-submit {
  min-width: 0;
}
.commercial-subnav-shell {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 6px 20px;
  border-bottom: 1px solid var(--line);
}
.commercial-subnav-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-2);
  padding-bottom: 12px;
  margin-right: 4px;
}
.commercial-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
}
.commercial-subnav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  transition: color .15s ease, border-color .15s ease;
}
.commercial-subnav-link i { font-size: .92em; opacity: .7; }
.commercial-subnav-link:hover {
  color: var(--ink);
  border-bottom-color: var(--line-strong);
}
.commercial-subnav-link.active {
  color: var(--brand-2);
  border-bottom-color: var(--brand);
  font-weight: 700;
}
.commercial-subnav-link.active i { opacity: 1; }
.commercial-hero {
  overflow: hidden;
}
.commercial-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.commercial-metric-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248,250,252,.88), rgba(255,255,255,.98));
}
.commercial-metric-label {
  display: block;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.commercial-metric-value {
  display: block;
  margin-top: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--ink);
}
.commercial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.commercial-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.92));
  color: var(--ink);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.commercial-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15,23,42,.08);
  border-color: #bdd3ea;
}
.commercial-card-top,
.commercial-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.commercial-card-icon,
.commercial-card-arrow {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
}
.commercial-card-icon {
  background: #eff8ff;
  color: #0180B5;
}
.commercial-card-arrow {
  background: var(--bg-2);
  color: #64748b;
}
.commercial-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.commercial-card-meta {
  color: var(--ink-muted);
  line-height: 1.5;
}
.commercial-card-stats strong {
  display: block;
  font-family: 'Fira Code', monospace;
  font-size: 1.1rem;
  color: var(--ink);
}
.commercial-card-stats span {
  display: block;
  margin-top: 3px;
  font-size: .8rem;
  color: var(--muted);
}
.commercial-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(180px, 1fr)) 160px;
  gap: 12px;
  align-items: end;
}
.commercial-toolbar-wide,
.commercial-toolbar-submit {
  min-width: 0;
}
.dashboard-commercial-shell {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.dashboard-commercial-update {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
}
.dashboard-commercial-update-main {
  min-width: 0;
  flex: 1;
}
.dashboard-commercial-update-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dashboard-commercial-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, .9fr);
  gap: 18px;
}
.dashboard-commercial-main,
.dashboard-commercial-side {
  min-width: 0;
}
.dashboard-commercial-list {
  display: flex;
  flex-direction: column;
}
.dashboard-commercial-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}
.dashboard-commercial-row:first-child {
  border-top: none;
}
.dashboard-commercial-row:hover {
  background: #fafbfd;
}
.dashboard-commercial-row-main {
  min-width: 0;
  flex: 1;
}
.dashboard-commercial-row-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
}
.dashboard-commercial-row-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.dashboard-commercial-severity {
  text-transform: capitalize;
}
.dashboard-commercial-severity-red {
  background: #fee2e2;
  color: #b42318;
  border: 1px solid #fecaca;
}
.dashboard-commercial-severity-orange,
.dashboard-commercial-severity-yellow {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.dashboard-commercial-severity-blue {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.dashboard-commercial-token {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink-2);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.dashboard-commercial-summary {
  display: flex;
  flex-direction: column;
}
.dashboard-commercial-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}
.dashboard-commercial-summary-row:first-child {
  border-top: none;
}
.dashboard-commercial-summary-row span {
  color: #526071;
  font-size: .88rem;
}
.dashboard-commercial-summary-row strong {
  font-family: 'Fira Code', monospace;
  font-size: .98rem;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}
.dashboard-commercial-metric-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.dashboard-commercial-metric-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}
.dashboard-commercial-metric-row:first-child {
  border-top: none;
}
.dashboard-commercial-metric-row:hover {
  background: #fafbfd;
}
.dashboard-commercial-metric-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--ink);
}
.dashboard-commercial-metric-row strong {
  font-family: 'Fira Code', monospace;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}
.dashboard-commercial-table {
  display: flex;
  flex-direction: column;
}
.dashboard-commercial-table-head,
.dashboard-commercial-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) 110px 120px 90px;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
}
.dashboard-commercial-table-head {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  color: #526071;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.dashboard-commercial-table-row {
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.dashboard-commercial-table-row:first-of-type {
  border-top: none;
}
.dashboard-commercial-table-row:hover {
  background: #fafbfd;
}
.dashboard-commercial-table-row > span {
  font-size: .86rem;
  color: var(--ink-2);
}
.dashboard-commercial-table-main {
  min-width: 0;
}
.dashboard-commercial-table-main strong {
  display: block;
  font-size: .92rem;
  color: var(--ink);
}
.dashboard-commercial-table-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .84rem;
}
.commercial-dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.commercial-dashboard-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 2px 2px 16px;
  border-bottom: 1px solid var(--line);
}
.commercial-dashboard-status-main {
  min-width: 0;
  flex: 1;
}
.commercial-dashboard-status-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.commercial-dashboard-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(2,153,216,.22);
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: lowercase;
}
.commercial-dashboard-status-chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.commercial-dashboard-status-chip-warn {
  border-color: rgba(245,158,11,.24);
  background: rgba(245,158,11,.12);
  color: #9a6700;
}
.commercial-dashboard-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 4px 0 2px;
}
.commercial-dashboard-strip-item {
  padding: 4px 22px;
  border-left: 1px solid var(--line);
}
.commercial-dashboard-strip-item:first-child {
  padding-left: 2px;
  border-left: 0;
}
.commercial-dashboard-strip-item span {
  display: block;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.commercial-dashboard-strip-item strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}
.commercial-dashboard-focus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.commercial-dashboard-focus-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 132px;
  padding: 16px 18px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.commercial-dashboard-focus-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}
.commercial-dashboard-focus-card-red {
  border-color: rgba(220,38,38,.22);
  background: rgba(254,242,242,.7);
}
.commercial-dashboard-focus-card-amber {
  background: var(--panel-strong);
}
.commercial-dashboard-focus-card-blue {
  background: var(--panel-strong);
}
.commercial-dashboard-focus-kicker {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
}
.commercial-dashboard-focus-value {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 2px;
}
.commercial-dashboard-focus-value strong {
  font-family: 'Fira Code', monospace;
  font-size: 2rem;
  line-height: .95;
  color: var(--ink);
}
.commercial-dashboard-focus-value small {
  margin-bottom: 3px;
  font-size: 1rem;
  color: var(--ink-muted);
  font-weight: 800;
}
.commercial-dashboard-focus-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.commercial-dashboard-focus-detail {
  color: #526071;
  font-size: .9rem;
  line-height: 1.5;
}
.commercial-dashboard-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .9fr);
  gap: 18px;
}
.commercial-dashboard-analysis-main,
.commercial-dashboard-analysis-side {
  min-width: 0;
}
.commercial-dashboard-chart-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, .9fr);
  gap: 18px;
  padding: 18px;
}
.commercial-dashboard-chart-card-split {
  grid-template-columns: minmax(220px, .8fr) minmax(0, 1fr);
}
.commercial-dashboard-chart-frame {
  position: relative;
  min-height: 200px;
}
.commercial-dashboard-chart-frame-bar {
  min-height: 210px;
}
.commercial-dashboard-chart-frame-donut {
  min-height: 185px;
}
.commercial-dashboard-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.commercial-dashboard-legend-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(248,250,252,.84);
  border: 1px solid rgba(148,163,184,.14);
}
.commercial-dashboard-legend-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.commercial-dashboard-legend-main strong {
  font-size: .9rem;
  color: var(--ink);
}
.commercial-dashboard-legend-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  color: #526071;
  font-size: .8rem;
}
.commercial-dashboard-legend-values strong {
  font-family: 'Fira Code', monospace;
  font-size: .92rem;
  color: var(--ink);
}
.commercial-dashboard-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.commercial-dashboard-dot-green { background: #739848; }
.commercial-dashboard-dot-yellow { background: #f59e0b; }
.commercial-dashboard-dot-red { background: #dc2626; }
.commercial-dashboard-dot-slate { background: #94a3b8; }
.commercial-dashboard-agenda {
  display: flex;
  flex-direction: column;
}
.commercial-dashboard-agenda-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.commercial-dashboard-agenda-row:first-child {
  border-top: none;
}
.commercial-dashboard-agenda-row:hover {
  background: #fafbfd;
}
.commercial-dashboard-agenda-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.commercial-dashboard-agenda-title-wrap {
  display: flex;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.commercial-dashboard-agenda-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.16);
  background: rgba(248,250,252,.92);
  color: var(--ink-2);
  flex-shrink: 0;
}
.commercial-dashboard-agenda-title {
  font-size: .96rem;
  font-weight: 800;
  color: var(--ink);
}
.commercial-dashboard-agenda-badges {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.commercial-dashboard-agenda-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-2);
  font-size: .84rem;
  font-weight: 800;
}
.commercial-dashboard-token {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink-2);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.commercial-dashboard-token-green {
  border-color: rgba(115,152,72,.24);
  background: rgba(115,152,72,.10);
  color: #466227;
}
.commercial-dashboard-token-yellow {
  border-color: rgba(245,158,11,.24);
  background: rgba(245,158,11,.10);
  color: #9a6700;
}
.commercial-dashboard-token-red,
.commercial-dashboard-token-missing {
  border-color: rgba(220,38,38,.18);
  background: rgba(254,226,226,.82);
  color: #b42318;
}
.commercial-dashboard-token-none {
  border-color: rgba(148,163,184,.24);
  background: rgba(241,245,249,.9);
  color: var(--ink-muted);
}
.commercial-dashboard-severity {
  text-transform: capitalize;
}
.commercial-dashboard-severity-red {
  background: rgba(254,226,226,.82);
  color: #b42318;
  border: 1px solid rgba(220,38,38,.18);
}
.commercial-dashboard-severity-orange,
.commercial-dashboard-severity-yellow {
  background: rgba(245,158,11,.10);
  color: #9a6700;
  border: 1px solid rgba(245,158,11,.24);
}
.commercial-dashboard-severity-blue {
  background: rgba(2,153,216,.10);
  color: var(--brand-2);
  border: 1px solid rgba(2,153,216,.22);
}
.commercial-dashboard-registers {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .95fr);
  gap: 18px;
}
.commercial-dashboard-table,
.commercial-dashboard-list {
  display: flex;
  flex-direction: column;
}
.commercial-dashboard-table-head,
.commercial-dashboard-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 110px 130px 130px 120px;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
}
.commercial-dashboard-table-head {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  color: #526071;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.commercial-dashboard-table-row {
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.commercial-dashboard-table-row:first-of-type {
  border-top: none;
}
.commercial-dashboard-table-row:hover,
.commercial-dashboard-list-row:hover {
  background: #fafbfd;
}
.commercial-dashboard-table-row > span {
  font-size: .84rem;
  color: var(--ink-2);
}
.commercial-dashboard-table-main {
  min-width: 0;
}
.commercial-dashboard-table-main strong {
  display: block;
  font-size: .92rem;
  color: var(--ink);
}
.commercial-dashboard-table-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .83rem;
}
.commercial-dashboard-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.commercial-dashboard-list-row:first-child {
  border-top: none;
}
.commercial-dashboard-list-main {
  min-width: 0;
  flex: 1;
}
.commercial-dashboard-list-title {
  font-size: .95rem;
  font-weight: 800;
  color: var(--ink);
}
.commercial-dashboard-list-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.approvals-register-table th:nth-child(1),
.approvals-register-table td:nth-child(1) {
  white-space: nowrap;
}
.approvals-register-table th:nth-child(11),
.approvals-register-table td:nth-child(11) {
  width: 72px;
}

/* ── Banner data giacenza dashboard ─────────────────────────────────────── */
.giacenza-date-banner {
  background: linear-gradient(135deg, #0299D8 0%, #0180B5 100%);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(2,153,216,.22);
}
.giacenza-date-empty {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
  box-shadow: 0 4px 14px rgba(245,158,11,.14) !important;
}
.giacenza-date-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  flex-wrap: wrap;
}
.giacenza-date-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
}
.giacenza-date-content {
  flex: 0 0 auto;
}
.giacenza-date-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.72);
  line-height: 1;
  margin-bottom: 4px;
}
.giacenza-date-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.02em;
  line-height: 1;
}
.giacenza-date-stale {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.9);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: .78rem;
  font-weight: 600;
}
.giacenza-date-file {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.85);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: .74rem;
  display: flex;
  align-items: center;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.giacenza-date-update {
  margin-left: auto;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.35);
  color: #fff;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all .15s;
  white-space: nowrap;
}
.giacenza-date-update:hover {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* ── Banner data giacenza ─────────────────────────────────────────────────── */
.giacenza-date-banner {
  background: linear-gradient(135deg, #e3f5fc 0%, #f0fdf4 100%);
  border: 1.5px solid #b6e4f5;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 4px 18px rgba(2,153,216,.10);
}
.giacenza-date-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  flex-wrap: wrap;
}
.giacenza-date-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: #0299D8;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(2,153,216,.30);
}
.giacenza-date-content { flex: 1; min-width: 140px; }
.giacenza-date-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #0180B5;
  margin-bottom: 2px;
}
.giacenza-date-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0c1e0e;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.giacenza-date-stale {
  font-size: .78rem;
  color: var(--ink-muted);
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(2,153,216,.18);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.giacenza-date-file {
  font-size: .75rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.giacenza-date-update {
  padding: 8px 16px;
  background: #0299D8;
  color: #fff;
  border: 1.5px solid #0299D8;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s;
  margin-left: auto;
}
.giacenza-date-update:hover {
  background: #0180B5;
  border-color: #0180B5;
  color: #fff;
}
.giacenza-date-empty {
  background: linear-gradient(135deg, #fffbeb 0%, #fef9f0 100%);
  border-color: #fde68a;
}

/* ── Semaforo magazzino ─────────────────────────────────────────────────── */
.sem-dot{display:inline-block;width:9px;height:9px;border-radius:50%;margin-left:5px;vertical-align:middle;flex-shrink:0}
.sem-green,.sem-dot-green{background:#22c55e;box-shadow:0 0 5px rgba(34,197,94,.4)}
.sem-yellow,.sem-dot-yellow{background:#f59e0b;box-shadow:0 0 5px rgba(245,158,11,.4)}
.sem-orange,.sem-dot-orange{background:#f97316;box-shadow:0 0 5px rgba(249,115,22,.4)}
.sem-red,.sem-dot-red{background:#ef4444;box-shadow:0 0 5px rgba(239,68,68,.4)}
.sem-purple,.sem-dot-purple{background:#7c3aed;box-shadow:0 0 5px rgba(124,58,237,.45)}
.sem-neutral{background:#94a3b8;box-shadow:0 0 5px rgba(148,163,184,.35)}
@keyframes pulse-red{0%,100%{opacity:1}50%{opacity:.45}}
.sem-red,.sem-purple{animation:pulse-red 1.5s ease-in-out infinite}
@media (prefers-reduced-motion: reduce){ .sem-red,.sem-purple{animation:none} }

.sem-kpi-card{
  display:flex;flex-direction:column;align-items:center;
  background:var(--bg-2);border:1px solid #e2e8f0;
  border-radius:16px;padding:18px 24px;min-width:120px;
  gap:4px;transition:transform .15s;
}
.sem-kpi-card:hover{transform:translateY(-2px)}
.sem-kpi-green{border-color:#bbf7d0;background:#f0fdf4}
.sem-kpi-yellow{border-color:#fde68a;background:#fffbeb}
.sem-kpi-red{border-color:#fecaca;background:#fef2f2}
.sem-kpi-dot{width:12px;height:12px;border-radius:50%;margin-bottom:4px}
.sem-kpi-val{font-size:2rem;font-weight:800;line-height:1;letter-spacing:-.04em}
.sem-kpi-green .sem-kpi-val{color:#16a34a}
.sem-kpi-yellow .sem-kpi-val{color:#d97706}
.sem-kpi-red .sem-kpi-val{color:#dc2626}
.sem-kpi-lbl{font-size:.78rem;font-weight:600;color:var(--ink-muted)}
.sem-kpi-sub{font-size:.7rem;color:#9aa4b0}

/* ── Tasto Sincronizza navbar ────────────────────────────────────────────── */
.topnav-sync {
  background: rgba(115,152,72,.18) !important;
  border: 1px solid rgba(115,152,72,.35) !important;
  color: #c5e8a0 !important;
  border-radius: 8px;
  font-weight: 600;
}
.topnav-sync:hover {
  background: rgba(115,152,72,.32) !important;
  color: #fff !important;
}
.topnav-sync.active {
  background: #739848 !important;
  color: #fff !important;
}
.topnav-sync i {
  animation: none;
}
.topnav-sync:hover i {
  animation: spin-once .4s ease;
}
@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (max-width: 991px) {
  .page-title {
    font-size: 1.22rem;
    line-height: 1.15;
  }
  .page-subtitle {
    font-size: .86rem;
    line-height: 1.45;
  }
  .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-actions .btn-modern,
  .page-actions .btn {
    min-height: 42px;
  }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .simple-stats-grid,
  .detail-two-col,
  .detail-summary-grid,
  .detail-summary-side,
  .detail-facts-grid,
  .simple-filter-grid,
  .card-mini-grid,
  .ops-kpi-row,
  .commercial-metrics,
  .commercial-grid,
  .commercial-toolbar-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-commercial-layout,
  .dashboard-commercial-table-head,
  .dashboard-commercial-table-row {
    grid-template-columns: 1fr;
  }
  .commercial-dashboard-strip,
  .commercial-dashboard-focus-grid,
  .commercial-dashboard-analysis-grid,
  .commercial-dashboard-registers,
  .commercial-dashboard-chart-card,
  .commercial-dashboard-chart-card-split,
  .commercial-dashboard-table-head,
  .commercial-dashboard-table-row {
    grid-template-columns: 1fr;
  }
  .table-header-clean,
  .giacenze-toolbar-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .detail-summary-grid-simple,
  .detail-summary-grid-clean,
  .detail-summary-grid-compact {
    grid-template-columns: 1fr;
  }
  .waste-header,
  .detail-hero-grid,
  .detail-hero-grid-compact,
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .waste-stock-box {
    text-align: left;
    min-width: 0;
  }
  .mobile-entity-card {
    padding: 13px 14px;
  }
  .dashboard-commercial-update,
  .dashboard-commercial-row,
  .dashboard-commercial-metric-row,
  .dashboard-commercial-summary-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .commercial-dashboard-status,
  .commercial-dashboard-list-row,
  .commercial-dashboard-agenda-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .dashboard-commercial-row-side,
  .dashboard-commercial-update-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .commercial-dashboard-status-side,
  .commercial-dashboard-list-side,
  .commercial-dashboard-agenda-badges {
    width: 100%;
    justify-content: flex-start;
  }
  .dashboard-commercial-table-head {
    display: none;
  }
  .dashboard-commercial-table-row > span {
    display: block;
  }
  .commercial-dashboard-table-head {
    display: none;
  }
  .commercial-dashboard-table-row > span {
    display: block;
  }
  .commercial-toolbar-submit {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .page-header {
    padding: 14px 0;
  }
  .topnav-inner {
    padding: 0 12px;
  }
  .topnav-logo {
    margin-right: 12px;
  }
  .topnav-user-btn {
    padding: 5px 8px;
  }
  .page-header-inner {
    padding: 0 16px;
  }
  .main-content {
    padding: 16px;
  }
  .btn-modern {
    padding: .7rem .95rem;
  }
  .card-soft .card-body,
  .card-elevated .card-body {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .card-soft form.d-flex.flex-wrap.gap-3 > div {
    min-width: 0 !important;
    flex: 1 1 100% !important;
    width: 100%;
  }
  .card-soft form.d-flex.flex-wrap.gap-3 > div .btn {
    width: 100%;
  }
  .table-header-clean > .d-flex {
    width: 100%;
    flex-wrap: wrap;
  }
  .table-header-clean > .d-flex .btn {
    flex: 1 1 100%;
  }
  .ops-kpi-row {
    grid-template-columns: 1fr;
  }
  .simple-table thead th,
  .simple-table tbody td {
    padding: 14px 14px;
  }
  .mobile-entity-actions {
    flex-direction: column;
  }
  .mobile-entity-actions .btn,
  .mobile-entity-actions .btn-modern {
    width: 100%;
  }
  .mobile-entity-card .inline-edit-form.visible {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .mobile-entity-card .inline-edit-form.visible input,
  .mobile-entity-card .inline-edit-form.visible select {
    width: 100% !important;
    min-width: 0;
  }
  .mobile-entity-card .inline-edit-form.visible .inline-save-btn,
  .mobile-entity-card .inline-edit-form.visible .inline-cancel-btn {
    width: 100%;
  }
  .waste-badge,
  .soft-pill,
  .status-pill,
  .btn-chip {
    font-size: .76rem;
  }
  .commercial-subnav {
    padding: 10px;
  }
  .commercial-subnav-link {
    width: 100%;
    justify-content: center;
  }
  .waste-pagination {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }
  .waste-pagination .btn-chip {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* Booking previews */
.doc-field-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #9aa4b0;
  margin-bottom: 3px;
}
.doc-field-value {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.booking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .79rem;
}
.booking-table th {
  background: #0f172a;
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 600;
}
.booking-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}
.booking-table tbody tr:last-child td {
  border-bottom: none;
}
.booking-preview-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.booking-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
  padding: 14px 16px;
}
.booking-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.booking-preview-title {
  min-width: 0;
  flex: 1;
}
.booking-preview-cer {
  font-size: .88rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}
.booking-preview-desc {
  margin-top: 3px;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}
.booking-preview-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.booking-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}
.preview-field {
  min-width: 0;
}
.preview-field-wide {
  grid-column: span 2;
}
.preview-field-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #9aa4b0;
  margin-bottom: 2px;
}
.preview-field-value {
  font-size: .84rem;
  line-height: 1.45;
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 991px) {
  .booking-preview-card {
    padding: 13px 14px;
  }
  .booking-preview-head {
    flex-direction: column;
  }
  .booking-preview-badges {
    justify-content: flex-start;
  }
  .booking-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preview-field-wide {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .booking-preview-grid {
    grid-template-columns: 1fr;
  }
  .preview-field-wide {
    grid-column: span 1;
  }
}

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

/* ============================================================
   2026-04-14 UI refinement — bookings + waste detail
   ============================================================ */

.section-title,
.entity-code,
.highlight-number,
.metric-value,
.waste-cer-label,
.waste-stock-value,
.decision-plant-name,
.decision-cost-value,
.candidate-cer,
.ic-cer,
.booking-stage-title,
.booking-kpi-value,
.waste-summary-value {
  font-family: var(--font-mono);
}

.btn-icon-square {
  min-width: 50px;
  white-space: nowrap;
}

.btn-danger-soft {
  color: #b42318;
  border-color: #fecaca;
  background: #fff5f5;
}

.btn-danger-soft:hover {
  color: #7f1d1d;
  border-color: #fda4af;
  background: #ffe4e6;
}

.btn-danger-ghost {
  color: #b42318;
  font-size: .78rem;
}

.booking-stage-card {
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(115,152,72,.16), transparent 30%),
    radial-gradient(circle at 0% 100%, rgba(2,153,216,.16), transparent 34%),
    linear-gradient(135deg, rgba(15,35,54,.98), rgba(15,35,54,.92));
  color: #fff;
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 28px 56px rgba(15,23,42,.18);
}

.booking-stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 22px;
  align-items: stretch;
}

.booking-stage-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.booking-stage-title {
  margin: 18px 0 10px;
  font-size: clamp(1.5rem, 2.8vw, 2.35rem);
  line-height: 1.02;
}

.booking-stage-text {
  margin: 0;
  max-width: 58ch;
  color: rgba(255,255,255,.82);
  font-size: .96rem;
}

.booking-stage-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.booking-stage-pills .soft-pill {
  background: rgba(255,255,255,.10) !important;
  border: 1px solid rgba(255,255,255,.12);
  color: #fff !important;
}

.booking-stage-pills .soft-pill.brand {
  background: rgba(2,153,216,.2) !important;
  color: #dff5ff !important;
}

.booking-stage-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.booking-kpi-card {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
}

.booking-kpi-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.66);
}

.booking-kpi-value {
  margin-top: 10px;
  font-size: 1.02rem;
  line-height: 1.2;
  color: #fff;
}

.booking-kpi-foot {
  margin-top: 8px;
  color: rgba(255,255,255,.72);
  font-size: .82rem;
}

.booking-meta-card,
.booking-column-card {
  border-color: rgba(148,163,184,.18);
}

.booking-meta-note {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(255,255,255,.96));
  border: 1px solid var(--line);
  border-radius: 18px;
  font-size: .82rem;
  color: var(--ink-muted);
}

.booking-meta-slot,
.booking-meta-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.14);
  background: rgba(255,255,255,.82);
}

.booking-meta-slot strong,
.booking-meta-empty {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted-2);
}

.booking-meta-slot span:last-child {
  font-size: .94rem;
  font-weight: 600;
  color: var(--ink);
}

.booking-meta-empty {
  justify-content: center;
  color: var(--ink-muted);
}

.candidate-search-wrap {
  position: relative;
}

.candidate-search-wrap .form-control[data-booking-search="true"] {
  min-height: 48px;
  padding-right: 38px;
  border-radius: 16px;
}

.candidate-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa4b0;
  font-size: .86rem;
}

.candidate-stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .74rem;
  color: var(--ink-muted);
}

.candidate-list {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.96);
}

.candidate-list-empty {
  padding: 14px 16px;
  color: var(--muted);
  font-size: .84rem;
}

.candidate-item {
  display: flex;
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid #edf2f7;
  cursor: pointer;
  align-items: flex-start;
  transition: background .16s ease, transform .16s ease;
}

.candidate-item:last-child { border-bottom: none; }
.candidate-item:hover { background: #f7fbff; }
.candidate-item.is-selected { background: linear-gradient(90deg, rgba(2,153,216,.10), rgba(115,152,72,.08)); }
.candidate-check { margin-top: 2px; flex-shrink: 0; }
.candidate-main { min-width: 0; flex: 1; }
.candidate-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.candidate-cer { font-weight: 700; color: var(--ink); font-size: .9rem; letter-spacing: -.03em; }
.candidate-desc {
  color: var(--ink-muted);
  font-size: .78rem;
  margin-top: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.candidate-badges,
.item-badges {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.candidate-badge,
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .67rem;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid transparent;
}

.rb-hp { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.rb-om { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.rb-op { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.rb-st { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.rb-alt { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }

.candidate-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.candidate-filters { display: flex; gap: 10px; flex-wrap: wrap; }

.candidate-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.candidate-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  font-size: .78rem;
  color: #334155;
}

.candidate-filter-check input { margin: 0; accent-color: #0299D8; }

.manual-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
  color: var(--muted-2);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.manual-divider span {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.manual-surface {
  background: linear-gradient(180deg, rgba(248,250,252,.96), rgba(255,255,255,.96));
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px;
}

.selection-head {
  gap: 12px;
}

.selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.selection-empty {
  color: var(--muted-2);
  font-size: .86rem;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(248,250,252,.76);
}

.selection-empty i {
  display: block;
  margin-bottom: 10px;
  font-size: 1.9rem;
  color: #c8d5e3;
}

.selection-total-row {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  background: linear-gradient(90deg, #f0fdf4, #ecfeff);
  border: 1px solid #bbf7d0;
  border-radius: 18px;
  justify-content: space-between;
  align-items: center;
}

.selection-total-label {
  font-size: .78rem;
  color: var(--ink-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.selection-total-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: #15803d;
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.9));
  box-shadow: 0 8px 24px rgba(15,23,42,.05);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.item-card + .item-card {
  margin-top: 12px;
}

.item-card:hover {
  border-color: #bfd3ff;
  box-shadow: 0 14px 30px rgba(2,153,216,.08);
  transform: translateY(-1px);
}

.item-head { margin-bottom: 14px; }
.item-main { min-width: 0; flex: 1; }
.item-code-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-sync-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.item-sync-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ink-2);
  font-size: .8rem;
}
.item-sync-label {
  color: #8b98aa;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.item-sync-toggle {
  align-self: center;
}
.item-sync-warning {
  margin-top: 10px;
  border: 1px solid #fde68a;
  border-radius: 14px;
  background: #fffbeb;
  color: #92400e;
  padding: 10px 12px;
  font-size: .79rem;
  line-height: 1.45;
}

.item-remove-btn {
  background: none;
  border: none;
  color: var(--muted-2);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.item-remove-btn:hover { color: #dc2626; }

.ic-desc {
  font-size: .82rem;
  color: var(--ink-muted);
  margin-top: 5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ic-label {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #8b98aa;
  font-weight: 700;
  margin-bottom: 4px;
}

.item-fields { display: grid; gap: 10px 12px; align-items: end; }
.item-fields-a2a { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.item-fields-chimet { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.item-field { min-width: 0; }
.item-field-center { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.item-control { font-size: .82rem; }
.item-check { width: 20px; height: 20px; accent-color: #0299D8; margin-top: 3px; }
.booking-actions { align-items: center; }

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 7px 11px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(2,153,216,.10), rgba(115,152,72,.10));
  color: #274561;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.waste-badge-danger { background: #fff0f0; border-color: #fecaca; color: #7f1d1d; }
.waste-badge-warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }

.waste-badge-semaphore .waste-badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.waste-badge.green {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.waste-badge.yellow {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.waste-badge.red {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b42318;
}

.waste-badge.green .waste-badge-dot { background: #16a34a; }
.waste-badge.yellow .waste-badge-dot { background: #d97706; }
.waste-badge.red .waste-badge-dot { background: #dc2626; }

/* Badge semaforo con naming a trattino (waste-badge-<stato>), 5 fasce */
.waste-badge-green  { background: var(--green-soft);  border-color: color-mix(in srgb, var(--green) 35%, transparent);  color: var(--green); }
.waste-badge-yellow { background: var(--yellow-soft); border-color: color-mix(in srgb, var(--yellow) 35%, transparent); color: var(--yellow); }
.waste-badge-orange { background: var(--orange-soft); border-color: color-mix(in srgb, var(--orange) 35%, transparent); color: var(--orange); }
.waste-badge-red    { background: var(--red-soft);    border-color: color-mix(in srgb, var(--red) 35%, transparent);    color: var(--red); }
.waste-badge-purple { background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 35%, transparent); color: var(--violet); }
.waste-badge-green  .waste-badge-dot { background: var(--green); }
.waste-badge-yellow .waste-badge-dot { background: var(--yellow); }
.waste-badge-orange .waste-badge-dot { background: var(--orange); }
.waste-badge-red    .waste-badge-dot { background: var(--red); }
.waste-badge-purple .waste-badge-dot { background: var(--violet); }

.waste-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.waste-summary-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.16);
  background: linear-gradient(180deg, rgba(248,250,252,.94), rgba(255,255,255,.96));
}

.waste-summary-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted-2);
}

.waste-summary-value {
  margin-top: 10px;
  font-size: 1.02rem;
  line-height: 1.15;
  color: #0f1f33;
}

.waste-summary-foot {
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: .82rem;
}

.detail-tech-surface {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248,250,252,.92), rgba(255,255,255,.96));
}

.detail-tech-title {
  font-size: .88rem;
}

.adr-surface {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-size: .83rem;
}

.adr-surface-warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.adr-surface-neutral {
  background: #f9fafb;
  border-color: #e5e7eb;
}

.adr-surface-title {
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.adr-surface-warning .adr-surface-title { color: #92400e; }
.adr-surface-neutral .adr-surface-title { color: var(--ink-muted); }
.adr-surface-copy { color: #78350f; }
.adr-surface-meta { color: var(--muted-2); font-size: .78rem; }

@media (max-width: 1200px) {
  .booking-stage-grid,
  .waste-summary-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 991px) {
  .booking-stage-grid,
  .booking-stage-kpis,
  .booking-meta-note,
  .waste-summary-strip {
    grid-template-columns: 1fr;
  }

  .booking-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 12px 0 2px;
    background: linear-gradient(180deg, rgba(244,247,251,0), rgba(244,247,251,.94) 24px, rgba(244,247,251,1) 100%);
    flex-direction: column;
    gap: 10px;
  }

  .booking-actions .btn { width: 100%; }
  .item-fields-a2a,
  .item-fields-chimet { grid-template-columns: 1fr; }
  .candidate-item { padding: 12px 10px; }
  .item-card { padding: 14px; }
  .item-code-row { flex-direction: column; }
  .selection-actions { width: 100%; }
  .selection-actions .btn { width: 100%; }
  .candidate-list { max-height: 42vh; }
  .candidate-toolbar-actions {
    width: 100%;
  }
  .candidate-toolbar-actions .btn {
    flex: 1 1 100%;
  }
  .deadline-topline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .deadline-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .candidate-top {
    flex-direction: column;
  }
  .deadline-topline,
  .deadline-filter-grid {
    grid-template-columns: 1fr;
  }

  .deadline-section-actions {
    justify-content: flex-start;
  }
}

@media print {
  .no-print,
  .topnav,
  .page-header,
  .topnav-wrapper,
  nav,
  header,
  .btn,
  .page-actions {
    display: none !important;
  }
  body {
    background: var(--panel-strong) !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .booking-doc {
    box-shadow: none !important;
    border: none !important;
  }
  .booking-doc .card-body {
    padding: 0 !important;
  }
  .booking-preview-card {
    box-shadow: none !important;
  }
  .booking-table th {
    background: #1e293b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  a {
    color: inherit !important;
    text-decoration: none !important;
  }
}

.direction-subnav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 22px;
}
/* Nav spostata nella sidebar: restano solo le azioni Excel/PDF, a destra */
.direction-subnav-shell--actions-only {
  justify-content: flex-end;
  margin-bottom: 12px;
}

.direction-subnav {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  overflow: auto;
  flex: 1;
}

.direction-subnav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  color: #536276;
  font-weight: 700;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.direction-subnav-link:hover {
  background: #f7fafc;
  border-color: var(--line);
  color: #1a2940;
}

.direction-subnav-link.active {
  background: #142033;
  border-color: var(--ink);
  color: #fff;
}

.direction-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.direction-board,
.direction-source-note {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
}

.direction-board-status {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.direction-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.direction-kpi-grid-dashboard {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.direction-kpi {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.direction-kpi span {
  color: #5f6d80;
  font-size: .82rem;
  font-weight: 700;
}

.direction-kpi strong {
  color: var(--ink);
  font-family: 'Fira Code', monospace;
  font-size: 1.18rem;
  line-height: 1.12;
}

.direction-kpi small {
  color: var(--muted);
}

.direction-row-negative {
  background: #fff7f7;
}

.direction-subnav-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.direction-update-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.direction-update-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.direction-form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 32px;
}

.direction-update-note {
  grid-column: span 3;
}

.direction-update-actions {
  display: flex;
  align-items: end;
}

.direction-audit-table th,
.direction-audit-table td {
  white-space: nowrap;
}

.direction-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .95fr);
  gap: 18px;
}

.direction-layout-editorial {
  align-items: start;
}

.direction-editorial-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .78fr);
  gap: 20px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96)),
    #fff;
}

.direction-editorial-heading {
  min-width: 0;
}

.direction-editorial-kicker {
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #7b4f21;
}

.direction-editorial-title {
  margin: 10px 0 0;
  max-width: 18ch;
  font-size: 2.2rem;
  line-height: 1.02;
  letter-spacing: -.04em;
  color: var(--ink);
}

.direction-editorial-text {
  margin: 14px 0 0;
  max-width: 64ch;
  color: #5f6d80;
  line-height: 1.58;
  font-size: .97rem;
}

.direction-editorial-feature {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 16px;
  border: 1px solid #d9c7b4;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8efe4 0%, #f4e7d7 100%);
}

.direction-editorial-feature-label {
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #81572b;
}

.direction-editorial-feature-value {
  font-size: 2.5rem;
  line-height: .95;
  letter-spacing: -.05em;
  color: var(--ink);
}

.direction-editorial-feature-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #5c4d3e;
  font-size: .87rem;
}

.direction-editorial-feature-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(129, 87, 43, 0.16);
  color: #533f2c;
  font-size: .88rem;
  font-weight: 700;
}

.direction-editorial-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.direction-editorial-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
}

.direction-editorial-stat span {
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.direction-editorial-stat strong {
  font-size: 1.42rem;
  line-height: 1.02;
  letter-spacing: -.03em;
  color: var(--ink);
}

.direction-editorial-stat small {
  color: var(--muted);
  line-height: 1.4;
}

.direction-editorial-header {
  align-items: flex-start;
}

.direction-editorial-mini-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #e6dac9;
  border-radius: 10px;
  background: #fbf6f0;
  min-width: 0;
}

.direction-editorial-mini-note-soft {
  border-color: var(--line);
  background: var(--bg-2);
}

.direction-editorial-mini-note span {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #8a6b4b;
}

.direction-editorial-mini-note-soft span {
  color: var(--muted);
}

.direction-editorial-mini-note strong {
  font-size: .88rem;
  line-height: 1.25;
  color: var(--ink);
}

.direction-editorial-chart-panel,
.direction-editorial-table-panel,
.direction-editorial-forecast-panel,
.direction-editorial-signal-panel,
.direction-editorial-runrate-panel {
  overflow: hidden;
}

.direction-editorial-chart-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.direction-editorial-caption {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}

.direction-editorial-forecast-body {
  background: linear-gradient(180deg, rgba(248,239,228,.55), rgba(255,255,255,0));
}

.direction-source-note-editorial {
  border-radius: 12px;
}

.direction-main,
.direction-side {
  min-width: 0;
}

.direction-status-chip {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 11px;
  border-radius:8px;
  font-size:.78rem;
  text-transform:uppercase;
  letter-spacing:.05em;
  font-weight:800;
}

.direction-status-chip-positive{
  background:#e8f6ea;
  color:#23633c;
}

.direction-status-chip-attention{
  background:#fff2dd;
  color:#8c5a11;
}

.direction-status-chip-under{
  background:#fde9e9;
  color:#943737;
}

.direction-progress-values{
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-bottom:12px;
}

.direction-progress-values span,
.direction-progress-meta {
  color:#65758a;
}

.direction-progress-track{
  width:100%;
  height:12px;
  border-radius:999px;
  background:#ecf2f8;
  overflow:hidden;
}

.direction-progress-track span{
  display:block;
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg, #0f7a78 0%, #7a8f2d 100%);
}

.direction-progress-meta{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:10px;
  font-size:.83rem;
}

.direction-summary-list,
.direction-signal-list,
.direction-stack-list {
  display: flex;
  flex-direction: column;
}

.direction-summary-list-divider {
  border-top: 1px solid var(--line);
}

.direction-summary-row,
.direction-signal-row,
.direction-stack-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.direction-summary-row:first-child,
.direction-signal-row:first-child,
.direction-stack-item:first-child {
  border-top: none;
}

.direction-summary-row strong:not(.direction-summary-value),
.direction-signal-row strong:not(.direction-signal-value),
.direction-stack-item strong {
  display: block;
  color: var(--ink);
  font-size: .92rem;
}

.direction-summary-row span,
.direction-signal-row span,
.direction-stack-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
  font-size: .84rem;
}

.direction-summary-value,
.direction-signal-value,
.direction-stack-item-trend {
  color: #132238;
  text-align: right;
  font-family: 'Fira Code', monospace;
  font-size: .94rem;
  line-height: 1.2;
}

.direction-signal-value small,
.direction-stack-item-trend small {
  display: block;
  margin-top: 4px;
  color: inherit;
  font-size: .8rem;
  font-family: 'Fira Sans', sans-serif;
}

.direction-signal-row-up {
  background: #f4faf4;
}

.direction-signal-row-down {
  background: #fdf3f3;
}

.direction-signal-row-positive {
  background: #eef8f1;
}

.direction-signal-row-attention {
  background: #fff6e8;
}

.direction-signal-row-under {
  background:#fdefef;
}

.direction-trend-up{
  color:#1f6d3c;
  font-weight:700;
}

.direction-trend-down{
  color:#a23e3e;
  font-weight:700;
}

.direction-trend-neutral{
  color:#475569;
  font-weight:700;
}

.direction-chart-frame{
  position:relative;
  width:100%;
  border:1px solid #e3ebf4;
  border-radius:10px;
  background:var(--bg-2);
  padding:12px;
}

.direction-chart-frame-large{
  height:300px;
}

.direction-chart-frame-small{
  height:220px;
}

.direction-chart-frame canvas{
  width:100% !important;
  height:100% !important;
  display:block;
}

.direction-register-table th{
  white-space:nowrap;
}

.direction-register-table td small {
  display: block;
  margin-top: 3px;
}

.direction-row-selected {
  background: #f2f7ff;
}

.direction-toolbar-form {
  min-width: 260px;
  flex-shrink: 0;
}

.direction-source-note {
  flex-direction: column;
  color: #5d6c81;
}

.direction-source-note strong {
  color: var(--ink);
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.admin-kpi {
  border: 1px solid #e3ebf4;
  background: var(--panel-strong);
  border-radius: 8px;
  padding: 16px 18px;
}

.admin-kpi span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.admin-kpi strong {
  display: block;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.2;
  margin-top: 6px;
}

.admin-kpi-warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.admin-kpi-net {
  border-color: #cbd5e1;
  background: var(--bg-2);
}

.admin-kpi-revenue {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.admin-chart-frame {
  position: relative;
  height: 260px;
}

.admin-chart-frame-tight {
  height: 220px;
}

.admin-ledger-board {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr);
  border: 1px solid #d8e2ee;
  background: var(--bg-2);
  border-radius: 8px;
  overflow: hidden;
}

.admin-ledger-main {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(360px, 1.1fr);
  gap: 28px;
  padding: 28px 32px;
}

.admin-eyebrow {
  display: block;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-ledger-main strong {
  display: block;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1.1;
  margin-top: 8px;
}

.admin-ledger-main p {
  max-width: 52ch;
  margin: 12px 0 0;
  color: #5d6c81;
  line-height: 1.55;
}

.admin-ledger-lines {
  display: grid;
  gap: 10px;
  align-content: center;
}

.admin-ledger-lines div,
.admin-ledger-side div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  border-bottom: 1px solid #e6edf5;
  padding: 10px 0;
}

.admin-ledger-lines span,
.admin-ledger-side span {
  color: var(--muted);
  font-weight: 700;
}

.admin-ledger-lines strong,
.admin-ledger-side strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

.admin-ledger-side {
  background: #f3f7fb;
  border-left: 1px solid #d8e2ee;
  padding: 26px 28px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.admin-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 18px;
}

.admin-workbench-secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-workbench-panel {
  border: 1px solid #dfe7f1;
  background: var(--panel-strong);
  border-radius: 8px;
  padding: 22px;
}

.admin-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.admin-panel-heading h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 850;
  letter-spacing: 0;
}

.admin-mini-ledger {
  display: grid;
  gap: 8px;
}

.admin-mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
  color: #223047;
  text-decoration: none;
}

.admin-mini-row:hover {
  color: #0f766e;
}

.admin-mini-row span,
.admin-mini-row small {
  display: block;
  min-width: 0;
}

.admin-mini-row strong {
  font-weight: 850;
}

.admin-mini-row small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 600;
}

.admin-mini-row b {
  color: var(--ink);
  font-size: .95rem;
  white-space: nowrap;
}

.admin-mini-row-warning b {
  color: #9a3412;
}

.admin-empty-line {
  color: var(--muted);
  padding: 16px 0;
}

.admin-audit-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.admin-audit-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #edf2f7;
  padding: 10px 0;
}

.admin-audit-list dt {
  color: var(--muted);
  font-weight: 750;
}

.admin-audit-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
  text-align: right;
}

.admin-table-scroll {
  border-top: 1px solid #dfe7f1;
}

.admin-valuation-table-detail {
  min-width: 1180px;
  table-layout: fixed;
}

.admin-valuation-table-detail th,
.admin-valuation-table-detail td {
  padding: 14px 22px;
  line-height: 1.25;
}

.admin-valuation-table-detail td {
  font-size: .96rem;
}

.admin-valuation-table-detail .text-end {
  font-variant-numeric: tabular-nums;
}

.admin-col-code { width: 12%; }
.admin-col-state { width: 25%; }
.admin-col-causale { width: 9%; }
.admin-col-kg { width: 12%; }
.admin-col-price { width: 15%; }
.admin-col-type { width: 15%; }
.admin-col-impact { width: 12%; }

.admin-valuation-table th {
  white-space: nowrap;
}

.admin-valuation-table td {
  vertical-align: middle;
}

.admin-row-warning {
  background: #fff8ed;
}

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

.security-kpi-card,
.security-event-card,
.security-session-card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,252,0.96));
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.security-kpi-card {
  padding: 16px 18px;
}

.security-kpi-label {
  color: #64748b;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.security-kpi-value {
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.8rem;
  font-weight: 800;
}

.security-event-stack,
.security-session-stack {
  display: grid;
  gap: 14px;
}

.security-event-card {
  padding: 16px 18px;
}

.security-event-title,
.security-session-title {
  color: #10221b;
  font-size: 1rem;
  font-weight: 800;
}

.security-event-meta,
.security-session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 6px;
  color: #64748b;
  font-size: .84rem;
}

.security-event-path,
.security-event-detail,
.security-session-agent {
  margin-top: 10px;
  color: #334155;
  font-size: .9rem;
  word-break: break-word;
}

.security-event-path {
  font-family: "Fira Code", monospace;
  font-size: .8rem;
}

.security-session-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.security-session-card.is-current {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.09);
}

.security-session-main {
  min-width: 0;
}

@media (max-width: 1199.98px){
  .direction-subnav-shell {
    flex-direction: column;
    align-items: stretch;
  }

  .direction-subnav-actions {
    justify-content: flex-end;
  }

  .direction-layout {
    grid-template-columns:1fr;
  }

  .direction-kpi-grid,
  .direction-kpi-grid-dashboard,
  .admin-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-ledger-board,
  .admin-ledger-main,
  .admin-workbench,
  .admin-workbench-secondary {
    grid-template-columns: 1fr;
  }

  .admin-ledger-side {
    border-left: 0;
    border-top: 1px solid #d8e2ee;
  }

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

  .direction-update-note {
    grid-column: span 2;
  }

  .direction-editorial-hero {
    grid-template-columns: 1fr;
  }

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

  .security-session-card {
    flex-direction: column;
  }
}

@media (max-width: 767.98px){
  .direction-board,
  .direction-progress-values,
  .direction-progress-meta,
  .direction-summary-row,
  .direction-signal-row,
  .direction-stack-item,
  .direction-source-note {
    flex-direction:column;
    align-items:flex-start;
  }

  .direction-editorial-title {
    max-width: none;
    font-size: 1.86rem;
  }

  .direction-editorial-strip {
    grid-template-columns: 1fr;
  }

  .direction-editorial-feature-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .direction-kpi-grid,
  .direction-kpi-grid-dashboard,
  .admin-kpi-grid,
  .direction-update-form,
  .security-kpi-grid {
    grid-template-columns: 1fr;
  }

  .admin-ledger-main,
  .admin-ledger-side,
  .admin-workbench-panel {
    padding: 18px;
  }

  .admin-ledger-main strong {
    font-size: 1.55rem;
  }

  .direction-update-note {
    grid-column: auto;
  }

  .direction-subnav-actions {
    justify-content: stretch;
  }

  .direction-subnav-actions .btn {
    flex: 1;
  }

  .direction-chart-frame-large{
    height:252px;
  }

  .direction-chart-frame-small{
    height:208px;
  }

  .direction-toolbar-form{
    width:100%;
    min-width:0;
  }

  .direction-summary-value,
  .direction-signal-value,
  .direction-stack-item-trend{
    text-align:left;
  }
}

.app-footer {
  padding: 0 28px 28px;
}

.app-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 18px;
  border: 1px solid rgba(28, 44, 35, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-muted);
  font-size: .88rem;
}

.app-footer a,
.auth-legal-note a,
.privacy-cover a,
.privacy-document a,
.privacy-actions a {
  color: var(--brand-green);
  text-decoration: none;
  font-weight: 700;
}

.app-footer a:hover,
.auth-legal-note a:hover,
.privacy-cover a:hover,
.privacy-document a:hover,
.privacy-actions a:hover {
  text-decoration: underline;
}

.auth-legal-note {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(28, 44, 35, 0.68);
  font-size: .88rem;
}

.privacy-page {
  background:
    radial-gradient(circle at top right, rgba(2, 153, 216, 0.14), transparent 18%),
    linear-gradient(180deg, #10253a 0%, #10253a 360px, #eef3f9 360px, #eef3f9 100%);
}

.privacy-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 36px 24px 48px;
}

.privacy-cover {
  position: relative;
  overflow: hidden;
  padding: 42px 54px 54px;
  border-radius: 0;
  background:
    radial-gradient(circle at top right, rgba(45, 114, 160, 0.24) 0, rgba(45, 114, 160, 0.24) 18%, transparent 18.2%),
    radial-gradient(circle at top right, rgba(45, 114, 160, 0.14) 0, rgba(45, 114, 160, 0.14) 30%, transparent 30.2%),
    #10253a;
  color: #ffffff;
  box-shadow: 0 18px 40px rgba(7, 16, 26, 0.18);
}

.privacy-cover-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 4px;
  background: #27a3a1;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.privacy-cover h1 {
  margin: 68px 0 0;
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -.05em;
  max-width: 10ch;
}

.privacy-cover-subtitle {
  margin: 22px 0 0;
  max-width: 42ch;
  color: rgba(255,255,255,0.82);
  font-size: 1rem;
}

.privacy-cover-rule {
  width: min(244px, 100%);
  height: 5px;
  margin: 34px 0 92px;
  background: #27a3a1;
}

.privacy-cover-meta {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

.privacy-meta-row {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  background: #f5f7fb;
  border-left: 10px solid #27a3a1;
  color: #10253a;
}

.privacy-meta-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.privacy-meta-row strong {
  font-size: 1.04rem;
}

.privacy-cover-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 124px;
  color: rgba(255,255,255,0.78);
  font-size: .84rem;
}

.privacy-document {
  margin-top: 18px;
  border: 1px solid #d9e2ee;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.privacy-section {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 22px;
  padding: 28px 32px;
  border-top: 1px solid #e8eef5;
}

.privacy-section:first-child {
  border-top: 0;
}

.privacy-section-index {
  color: #27a3a1;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
}

.privacy-section-body h2 {
  margin: 0 0 12px;
  color: #10253a;
  font-size: 1.15rem;
  letter-spacing: -.02em;
}

.privacy-section-body p {
  margin: 0 0 10px;
  color: var(--ink-muted);
}

.privacy-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-muted);
}

.privacy-list li + li {
  margin-top: 8px;
}

.privacy-actions {
  margin-top: 18px;
  padding: 24px 28px;
  border: 1px solid #d9e2ee;
  background: rgba(255,255,255,0.97);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.privacy-actions h2 {
  margin: 0 0 8px;
  color: #10253a;
  font-size: 1.08rem;
}

.privacy-actions p {
  margin: 0;
  color: var(--ink-muted);
}

@media (max-width: 767.98px){
  .app-footer {
    padding: 0 16px 20px;
  }

  .app-footer-inner,
  .auth-legal-note,
  .privacy-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .privacy-shell {
    padding: 20px 16px 28px;
  }

  .privacy-cover {
    padding: 24px 20px 26px;
  }

  .privacy-cover h1 {
    margin-top: 42px;
  }

  .privacy-cover-rule {
    margin-bottom: 42px;
  }

  .privacy-cover-foot {
    margin-top: 48px;
  }

  .privacy-section {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 22px 20px;
  }
}

/* ── Config section ────────────────────────────────────────────────────── */

/* KPI strip */
.cfg-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.cfg-kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,252,0.96));
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  transition: box-shadow .2s ease, border-color .2s ease;
}

.cfg-kpi:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.cfg-kpi--warn {
  border-color: rgba(217, 119, 6, 0.25);
  background: linear-gradient(180deg, #fffbf0, #fff8e8);
}

.cfg-kpi--danger {
  border-color: rgba(220, 38, 38, 0.22);
  background: linear-gradient(180deg, #fff5f5, #fee2e2);
}

.cfg-kpi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.cfg-kpi--warn .cfg-kpi-icon {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.cfg-kpi--danger .cfg-kpi-icon {
  background: var(--red-soft);
  color: var(--red);
}

.cfg-kpi-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cfg-kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
}

.cfg-kpi-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 2px;
}

.cfg-kpi-label small {
  font-weight: 500;
  opacity: .7;
  margin-left: 4px;
}

/* Filters */
.cfg-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248,250,252,.85), rgba(255,255,255,.98));
}

.cfg-filter-label {
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-right: 4px;
}

.cfg-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cfg-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink-2);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  cursor: pointer;
}

.cfg-chip:hover {
  border-color: #bdd3ea;
  color: var(--ink);
  background: #f8fbfe;
}

.cfg-chip--active {
  background: var(--brand-soft);
  border-color: #9bd7ef;
  color: #01678f;
}

.cfg-filter-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: .82rem;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
  opacity: .8;
  transition: opacity .15s ease;
}

.cfg-filter-clear:hover {
  opacity: 1;
}

/* Summary bar */
.cfg-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 10px 18px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--slate-soft);
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
}

/* Event list */
.cfg-event-list {
  display: grid;
  gap: 10px;
}

.cfg-event {
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 14px;
  background: var(--panel-strong);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.cfg-event:hover {
  border-color: rgba(15, 23, 42, 0.12);
}

.cfg-event[open] {
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
  border-color: rgba(2, 153, 216, 0.18);
}

.cfg-event-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.cfg-event-header::-webkit-details-marker {
  display: none;
}

.cfg-event-header::marker {
  content: '';
}

/* Severity dot */
.cfg-event-severity {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cfg-sev--ok {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.cfg-sev--alert {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.cfg-sev--current {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(2, 153, 216, 0.18);
}

/* Event content */
.cfg-event-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.cfg-event-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cfg-event-actor {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 500;
}

.cfg-event-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Badges */
.cfg-event-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.cfg-badge--success {
  background: var(--green-soft);
  color: #15803d;
}

.cfg-badge--warning {
  background: var(--yellow-soft);
  color: #92400e;
}

.cfg-badge--current {
  background: var(--brand-soft);
  color: #0369a1;
}

.cfg-event-time {
  font-size: .78rem;
  color: var(--muted-2);
  white-space: nowrap;
}

/* Chevron */
.cfg-event-chevron {
  font-size: .8rem;
  color: var(--muted);
  transition: transform .2s ease;
  flex-shrink: 0;
}

.cfg-event[open] .cfg-event-chevron {
  transform: rotate(180deg);
}

/* Details panel */
.cfg-event-details {
  padding: 0 18px 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.cfg-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
  padding-top: 14px;
}

.cfg-detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cfg-detail-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.cfg-detail-value {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.cfg-detail-extra {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(15, 23, 42, 0.08);
}

.cfg-detail-code {
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f1f5f9;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: #334155;
  line-height: 1.55;
  word-break: break-all;
  white-space: pre-wrap;
}

.cfg-mono {
  font-family: var(--font-mono);
  font-size: .85rem;
}

/* Empty state */
.cfg-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
}

.cfg-empty i {
  font-size: 1.3rem;
  opacity: .6;
}

/* Sync hero */
.cfg-sync-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border-radius: 18px;
  margin-bottom: 20px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,252,0.96));
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

.cfg-sync--ok {
  border-color: rgba(22, 163, 74, 0.22);
  background: linear-gradient(135deg, #f0fdf4, #dcfce7 40%, #f0fdf4);
}

.cfg-sync--error {
  border-color: rgba(220, 38, 38, 0.22);
  background: linear-gradient(135deg, #fff5f5, #fee2e2 40%, #fff5f5);
}

.cfg-sync--unknown {
  border-color: rgba(100, 116, 139, 0.18);
}

.cfg-sync-hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.cfg-sync--ok .cfg-sync-hero-icon {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.cfg-sync--error .cfg-sync-hero-icon {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.cfg-sync--unknown .cfg-sync-hero-icon {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.cfg-sync-hero-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cfg-sync-hero-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.cfg-sync-hero-time {
  font-size: .84rem;
  color: var(--muted);
}

/* Section header */
.cfg-section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.cfg-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.cfg-section-count {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 767.98px) {
  .cfg-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cfg-detail-grid {
    grid-template-columns: 1fr;
  }

  .cfg-sync-hero {
    flex-direction: column;
    text-align: center;
  }

  .cfg-filters {
    flex-direction: column;
    align-items: flex-start;
  }

  .cfg-filter-clear {
    margin-left: 0;
  }

  .cfg-event-header {
    padding: 12px 14px;
  }

  .cfg-event-right {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
}

/* ===== TEMA SCURO: superfici opache chiare -> scure (auto-generato) =====
   Velature translucide su sfondo scuro (hero/topnav/pill) e pagine auth/MFA
   escluse di proposito. Soft colorati (badge stato) restano chiari/leggibili. */
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .btn-row-action,
html[data-theme="dark"] .card-elevated,
html[data-theme="dark"] .filter-card .form-control,
html[data-theme="dark"] .filter-card .form-select,
html[data-theme="dark"] .form-modern,
html[data-theme="dark"] .btn-chip,
html[data-theme="dark"] .insight-card,
html[data-theme="dark"] .summary-item,
html[data-theme="dark"] .watch-row,
html[data-theme="dark"] .timeline-content,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .table-surface,
html[data-theme="dark"] .rule-item,
html[data-theme="dark"] .variant-card,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .filter-card .form-control:focus,
html[data-theme="dark"] .filter-card .form-select:focus,
html[data-theme="dark"] .form-modern:focus,
html[data-theme="dark"] .is-active-filter,
html[data-theme="dark"] .ops-kpi,
html[data-theme="dark"] .enterprise-table-wrap,
html[data-theme="dark"] .compact-note-band,
html[data-theme="dark"] .note-surface,
html[data-theme="dark"] .waste-badge,
html[data-theme="dark"] .action-card,
html[data-theme="dark"] .deadline-topline-item,
html[data-theme="dark"] .deadline-filter-form,
html[data-theme="dark"] .commercial-metric-card,
html[data-theme="dark"] .commercial-card,
html[data-theme="dark"] .commercial-dashboard-legend-row,
html[data-theme="dark"] .commercial-dashboard-agenda-icon,
html[data-theme="dark"] .giacenza-date-stale,
html[data-theme="dark"] .booking-meta-note,
html[data-theme="dark"] .booking-meta-slot,
html[data-theme="dark"] .booking-meta-empty,
html[data-theme="dark"] .candidate-list,
html[data-theme="dark"] .manual-surface,
html[data-theme="dark"] .selection-empty,
html[data-theme="dark"] .item-card,
html[data-theme="dark"] .waste-summary-card,
html[data-theme="dark"] .detail-tech-surface,
html[data-theme="dark"] .adr-surface-neutral,
html[data-theme="dark"] .direction-editorial-hero,
html[data-theme="dark"] .security-kpi-card,
html[data-theme="dark"] .security-event-card,
html[data-theme="dark"] .security-session-card,
html[data-theme="dark"] .app-footer-inner,
html[data-theme="dark"] .privacy-document,
html[data-theme="dark"] .privacy-actions,
html[data-theme="dark"] .cfg-kpi,
html[data-theme="dark"] .cfg-filters,
html[data-theme="dark"] .cfg-sync-hero {
  background: var(--panel-strong) !important;
  background-image: none !important;
  border-color: var(--line);
}
html[data-theme="dark"] .data-table thead th,
html[data-theme="dark"] .data-table tbody tr:hover,
html[data-theme="dark"] .btn-row-action:hover,
html[data-theme="dark"] .simple-table thead th,
html[data-theme="dark"] .simple-table-wrap .table.simple-table > thead > tr > th,
html[data-theme="dark"] .dashboard-commercial-row:hover,
html[data-theme="dark"] .dashboard-commercial-metric-row:hover,
html[data-theme="dark"] .dashboard-commercial-table-row:hover,
html[data-theme="dark"] .commercial-dashboard-agenda-row:hover,
html[data-theme="dark"] .commercial-dashboard-table-row:hover,
html[data-theme="dark"] .commercial-dashboard-list-row:hover,
html[data-theme="dark"] .direction-subnav-link:hover {
  background: var(--bg-2) !important;
  background-image: none !important;
  border-color: var(--line);
}
/* input testo + placeholder, dropdown, footer, header */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea {
  background-color: var(--panel-strong) !important; background-image:none !important;
  color: var(--ink); border-color: var(--line-strong);
}
html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] .form-select::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--muted-2); }
html[data-theme="dark"] .data-table thead th,
html[data-theme="dark"] .simple-table thead th,
html[data-theme="dark"] .note-surface,
html[data-theme="dark"] .waste-badge { color: var(--ink-2); }
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .offcanvas {
  background-color: var(--panel-strong); color: var(--ink); border-color: var(--line);
}
html[data-theme="dark"] .dropdown-item { color: var(--ink-2); }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background-color: var(--bg-2); color: var(--ink); }
html[data-theme="dark"] .dropdown-divider { border-color: var(--line); }
html[data-theme="dark"] .dropdown-header { color: var(--muted); }
html[data-theme="dark"] .btn-row-action { color: var(--brand); }
html[data-theme="dark"] .score-ring::before { background: var(--panel-strong); }
html[data-theme="dark"] .app-footer-inner { background: var(--panel-strong); border-color: var(--line); }
html[data-theme="dark"] .page-header { border-bottom-color: var(--line); }

/* ===== Unificazione bottoni: btn-modern/btn-brand/btn-ghost → look rx-btn =====
   Vecchio sistema (gradiente + ombra) allineato al look piatto della barra
   nuova (rx-btn in app_shell.css). Un solo blocco: tutti i bottoni diventano
   coerenti, niente da toccare nei template. I colori usano i token → dark ok. */
.btn-modern,
.btn-brand,
.btn-ghost {
  height: 38px;
  border-radius: 9px;
  padding: 0 15px;
  font-weight: 600;
  font-size: .88rem;
  gap: 7px;
  box-shadow: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-sm.btn-modern, .btn-modern.btn-sm,
.btn-sm.btn-brand, .btn-brand.btn-sm,
.btn-sm.btn-ghost, .btn-ghost.btn-sm {
  height: 32px;
  font-size: .82rem;
  padding: 0 11px;
}
.btn-brand {
  background: var(--brand);
  box-shadow: none;
}
.btn-brand:hover { background: var(--brand-2); }
.btn-ghost {
  background: var(--panel-strong);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--bg-2); }
.btn-danger-soft { box-shadow: none; }
