/* =====================================================================
   TRADE · design system replicato dal portale TRADE (Nuxt, ottobre 2026)
   Token, guscio (header, sidebar, aurora) e componenti di base.
   Il tema chiaro si attiva con .appLight sulla radice, come in TRADE.
   ===================================================================== */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --primaryD: #0E3A2F;
  --primaryLight: #78f9ad;
  --mint: #95e1a8;
  --deep: #1a6b53;
  --black: #1A1A1A;
  --red: #DC2629;
  --warnc: #f6c870;

  --app-text: #ffffff;
  --app-muted: rgba(255, 255, 255, 0.6);
  --app-faint: rgba(255, 255, 255, 0.45);
  --app-surface: rgba(255, 255, 255, 0.05);
  --app-line: rgba(255, 255, 255, 0.1);
  --app-hover: rgba(255, 255, 255, 0.07);
  --app-accent: #95e1a8;
  --app-accent-soft: rgba(149, 225, 168, 0.14);

  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%), #14342a;
  --card-border: rgba(255, 255, 255, 0.09);
  --card-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  --surface-bg: rgba(255, 255, 255, 0.04);
  --surface-border: rgba(255, 255, 255, 0.08);

  --main-bg: #0f2e26;
  --header-bg: #0E3A2F;
  --aside-bg: #1A1A1A;
  --popover-bg: #12312a;
  --input-bg: rgba(255, 255, 255, 0.06);
  --input-border: rgba(255, 255, 255, 0.14);

  --ok: #95e1a8;
  --warn: #f6c870;
  --danger: #ff8a8d;
  --info: #7fb4ff;

  --sb-text: rgba(255, 255, 255, 0.68);
  --sb-text-strong: #ffffff;
  --sb-muted: rgba(255, 255, 255, 0.38);
  --sb-accent: #78F9AD;
  --sb-accent-soft: rgba(120, 249, 173, 0.14);

  /* OSM in versione scura: inversione e rotazione di tinta, poi tono verso il verde del brand */
  --map-filter: invert(0.92) hue-rotate(185deg) brightness(0.82) contrast(0.92) saturate(0.45) sepia(0.12);
  color-scheme: dark;
}

.appLight {
  --app-text: #0E3A2F;
  --app-muted: rgba(14, 58, 47, 0.78);
  --app-faint: rgba(14, 58, 47, 0.6);
  --app-surface: rgba(14, 58, 47, 0.06);
  --app-line: rgba(14, 58, 47, 0.2);
  --app-hover: rgba(14, 58, 47, 0.09);
  --app-accent: #1a6b53;
  --app-accent-soft: rgba(26, 107, 83, 0.12);

  --card-bg: #ffffff;
  --card-border: rgba(14, 58, 47, 0.16);
  --card-shadow: 0 2px 10px rgba(14, 58, 47, 0.08);
  --surface-bg: #f6faf8;
  --surface-border: rgba(14, 58, 47, 0.14);

  --main-bg: #f5f7f6;
  --header-bg: #0E3A2F;
  --aside-bg: #ffffff;
  --popover-bg: #ffffff;
  --input-bg: #ffffff;
  --input-border: rgba(14, 58, 47, 0.18);

  --ok: #145c1f;
  --warn: #7a531a;
  --danger: #b83034;
  --info: #1e4a99;

  --sb-text: rgba(14, 58, 47, 0.72);
  --sb-text-strong: #0E3A2F;
  --sb-muted: rgba(14, 58, 47, 0.45);
  --sb-accent: #1a6b53;
  --sb-accent-soft: rgba(26, 107, 83, 0.12);

  --map-filter: none;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Montserrat", system-ui, sans-serif;
  background: #394748;
  color: var(--app-text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid rgba(149, 225, 168, 0.7); outline-offset: 2px; }
.appLight :focus-visible { outline-color: rgba(26, 107, 83, 0.7); }

/* Scrollbar sottili come nel portale */
* { scrollbar-width: thin; scrollbar-color: var(--app-line) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--app-line); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================ GUSCIO ============================ */
.wrapperGeneral { height: 100vh; display: flex; flex-direction: column; color: var(--app-text); }

.headerStyle {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 70px;
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--header-bg);
  color: #ffffff;
}
.hdrLeft { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hdrLogo img { height: 26px; display: block; }
.hdrModule {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(149, 225, 168, 0.14);
  border: 1px solid rgba(149, 225, 168, 0.35);
  color: #95e1a8;
  font-size: 12px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap;
}
.hdrRight { display: flex; align-items: center; gap: 12px; }
.iconBtn.hamburger { display: none; }

.statusPill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}
.statusPill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.statusPill.st-attiva { color: #95e1a8; border-color: rgba(149, 225, 168, 0.4); background: rgba(149, 225, 168, 0.12); }
.statusPill.st-attiva .dot { animation: pulse 2.2s ease-in-out infinite; }
.statusPill.st-in_corso { color: #7fb4ff; border-color: rgba(127, 180, 255, 0.4); background: rgba(127, 180, 255, 0.12); }
.statusPill.st-errore, .statusPill.st-ferma { color: #ff8a8d; border-color: rgba(239, 116, 119, 0.45); background: rgba(239, 116, 119, 0.14); }
.statusPill.st-non_configurata, .statusPill.st-in_attesa { color: #f6c870; border-color: rgba(246, 200, 112, 0.45); background: rgba(246, 200, 112, 0.12); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.iconBtn {
  position: relative;
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 2px solid #1A1A1A;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.iconBtn:hover { background: rgba(255, 255, 255, 0.08); }
.iconBtn .badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: #ef7477; color: #ffffff;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--header-bg);
}

.avatarWrap { position: relative; }
.avatar {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #1A1A1A; color: #ffffff;
  border: none; cursor: pointer;
  font-weight: 700; font-size: 14px;
}
.appLight .avatar { background: #E8EBEF; color: #0E3A2F; }
.avatar .chev {
  position: absolute; bottom: -3px; right: -3px;
  width: 19px; height: 19px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #78f9ad; color: #0E3A2F;
  box-shadow: 0 0 0 2px var(--header-bg);
  transition: transform 0.2s ease;
}
.avatarWrap.open .avatar .chev { transform: rotate(180deg); }
.popover {
  position: absolute; right: 0; top: calc(100% + 12px); z-index: 200;
  width: 290px;
  overflow: hidden;
  background: var(--primaryD);
  color: #ffffff;
  border: 1px solid rgba(120, 249, 173, 0.3);
  border-radius: 14px 2px 14px 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  display: none;
}
.appLight .popover { background: #ffffff; color: #0E3A2F; border-color: #E8EBEF; }
.avatarWrap.open .popover { display: block; }
.popHead { display: flex; align-items: center; gap: 12px; padding: 16px; background: rgba(14, 58, 47, 0.8); border-bottom: 1px solid rgba(120, 249, 173, 0.2); }
.appLight .popHead { background: rgba(232, 235, 239, 0.4); border-color: #E8EBEF; }
.popAvatar { width: 40px; height: 40px; border-radius: 50%; background: #78f9ad; color: #0E3A2F; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.appLight .popAvatar { background: #0E3A2F; color: #78f9ad; }
.popName { font-weight: 700; font-size: 14px; }
.popMail { font-size: 12px; opacity: 0.7; word-break: break-all; }
.popRole { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; background: #95E1A8; color: #0E3A2F; }
.popItem {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  font-size: 13px; font-weight: 600;
  background: transparent; border: none; cursor: pointer; text-decoration: none; text-align: left;
}
.popItem:hover { background: rgba(120, 249, 173, 0.1); }
.appLight .popItem:hover { background: rgba(120, 249, 173, 0.2); }
.popItem.danger:hover { color: #ff8a8d; background: rgba(220, 38, 41, 0.12); }

.layout { display: flex; width: 100%; flex: 1; position: relative; }

.asideStyle {
  position: fixed; top: 70px; left: 0; z-index: 10;
  width: 264px; height: calc(100vh - 70px);
  padding-top: 20px;
  background: var(--aside-bg);
  transition: width 0.3s ease;
  border-right: 1px solid transparent;
}
.appLight .asideStyle { border-right-color: rgba(14, 58, 47, 0.08); }
.collapsedSide .asideStyle { width: 68px; }

.appMenu {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; gap: 10px;
  padding: 4px 14px 16px;
  color: var(--sb-text);
}
.sideTop { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 2px; }
.sideSectionLabel { font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sb-muted); }
.collapseBtn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid transparent; background: transparent;
  color: var(--sb-muted); cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.collapseBtn:hover { background: var(--app-hover); color: var(--sb-text-strong); border-color: var(--app-line); }
.collapseBtn .expandIcon { display: none; }
.collapsedSide .collapseBtn .collapseIcon { display: none; }
.collapsedSide .collapseBtn .expandIcon { display: block; }

.sideNav { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.navItem {
  position: relative;
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border: none; border-radius: 12px;
  background: transparent;
  color: var(--sb-text);
  font-size: 13.5px; font-weight: 600;
  text-align: left; text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}
.navItem:hover { background: var(--app-hover); color: var(--sb-text-strong); }
.navItem:hover .navIcon { color: var(--sb-accent); }
.navItem:active { transform: scale(0.99); }
.navItem.active { background: var(--sb-accent-soft); color: var(--sb-accent); }
.navItem.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--sb-accent);
}
.navItem.active .navIcon { color: var(--sb-accent); }
.navIcon { width: 22px; display: flex; align-items: center; justify-content: center; color: var(--sb-muted); transition: color 0.16s ease; }
.navLabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navCount {
  min-width: 22px; padding: 2px 7px; border-radius: 999px;
  background: rgba(239, 116, 119, 0.18); color: #ff8a8d;
  font-size: 11px; font-weight: 800; text-align: center;
}
.appLight .navCount { color: #b83034; background: rgba(214, 61, 64, 0.12); }
.navDivider { margin: 14px 6px 6px; }

.sideFooter { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--app-line); }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--app-surface); border: 1px solid var(--app-line); }
.segBtn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 8px;
  border: none; border-radius: 9px; background: transparent;
  color: var(--sb-muted);
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.segBtn:hover { color: var(--sb-text-strong); }
.segBtn.on { background: var(--sb-accent-soft); color: var(--sb-accent); }
.logoutItem:hover { background: rgba(220, 38, 41, 0.12); color: #ff6b6d; }
.logoutItem:hover .navIcon { color: #ff6b6d; }
.sideNote { padding: 0 6px; font-size: 10.5px; line-height: 1.5; color: var(--sb-muted); }

/* barra compressa: solo icone */
.collapsedSide .appMenu { padding: 4px 6px 14px; align-items: center; }
.collapsedSide .sideTop { justify-content: center; padding: 4px 0; }
.collapsedSide .sideSectionLabel,
.collapsedSide .navLabel,
.collapsedSide .navCount,
.collapsedSide .segmented,
.collapsedSide .sideNote { display: none; }
.collapsedSide .navItem { width: 40px; height: 40px; padding: 0; justify-content: center; }
.collapsedSide .navItem.active::before { left: -6px; height: 20px; }
.collapsedSide .navDivider { display: none; }
.collapsedSide .navItem .railDot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #ef7477;
}
.navItem .railDot { display: none; }
.collapsedSide .navItem .railDot { display: block; }

.mainstyle {
  position: relative;
  margin-left: 264px; margin-top: 70px;
  width: calc(100% - 264px); height: calc(100vh - 70px);
  padding: 30px;
  overflow-y: auto;
  background: var(--main-bg);
  isolation: isolate;
  transition: margin-left 0.3s ease, width 0.3s ease;
}
.collapsedSide .mainstyle { margin-left: 68px; width: calc(100% - 68px); }

/* Aurora animata: tre blob verdi che fluttuano lentamente */
.mainstyle::before, .mainstyle::after, .wrapperGeneral::after {
  content: ''; position: fixed; border-radius: 50%; pointer-events: none; will-change: transform;
}
.mainstyle::before {
  width: 620px; height: 620px; filter: blur(90px); z-index: -1;
  background: radial-gradient(circle, rgba(149, 225, 168, 0.28) 0%, rgba(149, 225, 168, 0) 70%);
  top: -160px; left: 22%;
  animation: auroraA 42s ease-in-out infinite;
}
.mainstyle::after {
  width: 520px; height: 520px; filter: blur(90px); z-index: -1;
  background: radial-gradient(circle, rgba(52, 148, 121, 0.36) 0%, rgba(52, 148, 121, 0) 70%);
  bottom: -140px; right: 8%;
  animation: auroraB 52s ease-in-out infinite;
}
.wrapperGeneral::after {
  width: 480px; height: 480px; filter: blur(100px); z-index: 0;
  background: radial-gradient(circle, rgba(26, 107, 83, 0.42) 0%, rgba(26, 107, 83, 0) 72%);
  top: 40%; right: 30%;
  animation: auroraC 60s ease-in-out infinite;
}
.appLight .mainstyle::before, .appLight .mainstyle::after, .appLight .wrapperGeneral::after { opacity: 0.25; }
@keyframes auroraA { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(60px, 80px) scale(1.08); } 66% { transform: translate(-40px, 40px) scale(0.94); } }
@keyframes auroraB { 0%, 100% { transform: translate(0, 0) scale(1); } 40% { transform: translate(-80px, -50px) scale(1.1); } 75% { transform: translate(50px, 60px) scale(0.9); } }
@keyframes auroraC { 0%, 100% { transform: translate(0, 0) scale(1); } 30% { transform: translate(-100px, 60px) scale(1.05); } 60% { transform: translate(80px, -40px) scale(0.95); } }
@media (prefers-reduced-motion: reduce) {
  .mainstyle::before, .mainstyle::after, .wrapperGeneral::after, .statusPill .dot { animation: none; }
}

.pageStack { width: 100%; display: flex; flex-direction: column; gap: 20px; position: relative; z-index: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid64 { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }

/* drawer mobile */
.drawerOverlay { position: fixed; inset: 70px 0 0 0; z-index: 90; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px); display: none; }
.drawerOpen .drawerOverlay { display: block; }

@media (max-width: 1024px) {
  .asideStyle { width: 224px; }
  .mainstyle { margin-left: 224px; width: calc(100% - 224px); }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1023px) {
  .grid2, .grid64 { grid-template-columns: 1fr; }
}
@media (max-width: 950px) {
  .iconBtn.hamburger { display: inline-flex; }
  .asideStyle { transform: translateX(-100%); transition: transform 0.3s ease; width: min(92vw, 320px); z-index: 95; box-shadow: 2px 0 18px rgba(0, 0, 0, 0.45); }
  .drawerOpen .asideStyle { transform: translateX(0); }
  .collapsedSide .asideStyle { width: min(92vw, 320px); }
  .mainstyle, .collapsedSide .mainstyle { margin-left: 0; width: 100%; padding: 20px 16px; }
  .collapseBtn { display: none; }
  .collapsedSide .navLabel, .collapsedSide .navCount, .collapsedSide .segmented, .collapsedSide .sideSectionLabel, .collapsedSide .sideNote { display: revert; }
  .collapsedSide .navItem { width: 100%; height: auto; padding: 11px 12px; justify-content: flex-start; }
  .collapsedSide .appMenu { align-items: stretch; padding: 4px 14px 16px; }
  .hdrModule { display: none; }
}
@media (max-width: 640px) {
  .grid3 { grid-template-columns: 1fr; }
  .statusPill .lbl { display: none; }
  .headerStyle { padding: 0 12px; gap: 8px; }
  .hdrRight { gap: 8px; }
}

/* ============================ CARD ============================ */
.card {
  position: relative;
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  color: var(--app-text);
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
}
.cardHead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: var(--app-faint); margin-bottom: 4px; }
.cardTitle { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.2px; }
.cardDesc { margin: 0; max-width: 90ch; font-size: 12px; line-height: 1.5; color: var(--app-muted); }
.cardLink {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700;
  color: var(--app-accent); text-decoration: none;
  padding: 6px 10px; border-radius: 8px;
  background: var(--app-accent-soft);
  border: none; cursor: pointer;
  transition: background 0.15s ease;
}
.cardLink:hover { background: rgba(149, 225, 168, 0.2); }
.appLight .cardLink:hover { background: rgba(14, 58, 47, 0.16); }

/* Hero, come HeroHomeCard */
.hhCard {
  position: relative;
  padding: 26px 28px;
  border-radius: 20px;
  background: radial-gradient(140% 100% at 100% 0%, rgba(149, 225, 168, 0.10) 0%, rgba(149, 225, 168, 0) 55%),
              linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0) 100%),
              #14342a;
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.appLight .hhCard {
  background: radial-gradient(140% 100% at 100% 0%, rgba(14,58,47,0.06) 0%, rgba(14,58,47,0) 55%), #ffffff;
  border-color: rgba(14, 58, 47, 0.16);
  box-shadow: var(--card-shadow);
}
.hhBlob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.35; pointer-events: none; }
.hhBlob1 { width: 240px; height: 240px; background: #1a6b53; top: -80px; right: -60px; }
.hhBlob2 { width: 180px; height: 180px; background: #95e1a8; bottom: -80px; left: 40%; opacity: 0.18; }
.appLight .hhBlob1 { background: #95e1a8; opacity: 0.25; }
.appLight .hhBlob2 { background: #1a6b53; opacity: 0.12; }
.hhHead { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 20px; }
.hhIcon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(149,225,168,0.12); color: #95e1a8; }
.appLight .hhIcon { background: rgba(14,58,47,0.08); color: #0E3A2F; }
.hhTitleRow { display: flex; gap: 16px; align-items: center; }
.hhGreet { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; }
.hhSub { margin: 6px 0 0; font-size: 13px; color: var(--app-muted); font-weight: 500; max-width: 80ch; line-height: 1.5; }
.hhBadges { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hhKpis { position: relative; z-index: 1; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; gap: 12px; margin-top: 22px; }
.hhKpis.k4 { grid-template-columns: repeat(4, 1fr); }
.hhKpi {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; flex-direction: column; gap: 4px;
  text-decoration: none; color: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
  min-width: 0;
}
.appLight .hhKpi { background: #f6faf8; border-color: rgba(14,58,47,0.14); }
.hhKpi.kpiHero { background: rgba(149, 225, 168, 0.06); border-color: rgba(149, 225, 168, 0.2); }
.appLight .hhKpi.kpiHero { background: rgba(149,225,168,0.12); border-color: rgba(46,160,67,0.28); }
.hhKpi.kpiCta { cursor: pointer; background: linear-gradient(135deg, rgba(26,107,83,0.28) 0%, rgba(14,58,47,0.28) 100%); border-color: rgba(149, 225, 168, 0.25); }
.hhKpi.kpiCta:hover { background: linear-gradient(135deg, rgba(26,107,83,0.45) 0%, rgba(14,58,47,0.45) 100%); border-color: rgba(149, 225, 168, 0.45); }
.appLight .hhKpi.kpiCta { background: linear-gradient(135deg, rgba(26,107,83,0.14) 0%, rgba(14,58,47,0.14) 100%); border-color: rgba(14,58,47,0.24); }
.hhKpi.kpiAlert { background: rgba(239,116,119,0.10); border-color: rgba(239,116,119,0.35); }
.appLight .hhKpi.kpiAlert { background: rgba(214,61,64,0.08); border-color: rgba(214,61,64,0.28); }
.kpiIcon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: rgba(149,225,168,0.12); color: #95e1a8; margin-bottom: 4px; }
.appLight .kpiIcon { background: rgba(14,58,47,0.08); color: #0E3A2F; }
.kpiLabel { font-size: 10.5px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--app-faint); }
.kpiValue { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpiValueSmall { font-size: 22px; }
.kpiUnit { font-size: 12px; font-weight: 600; color: var(--app-faint); letter-spacing: 0; }
.kpiHint { font-size: 11px; font-weight: 600; color: var(--app-faint); }
.kpiCtaText { font-size: 13px; font-weight: 700; margin-top: 6px; }
@media (max-width: 1180px) { .hhKpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .hhHead { grid-template-columns: 1fr; } .hhBadges { justify-content: flex-start; } .hhKpis, .hhKpis.k4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .hhKpis, .hhKpis.k4 { grid-template-columns: 1fr; } }

/* ============================ BADGE ============================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap;
  border: 1px solid var(--app-line); background: var(--app-surface); color: var(--app-muted);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: rgba(149,225,168,0.14); color: var(--ok); border-color: rgba(149,225,168,0.32); }
.pill.warn { background: rgba(246,200,112,0.16); color: var(--warn); border-color: rgba(246,200,112,0.3); }
.pill.danger { background: rgba(239,116,119,0.16); color: var(--danger); border-color: rgba(239,116,119,0.3); }
.pill.info { background: rgba(120,180,255,0.16); color: var(--info); border-color: rgba(120,180,255,0.3); }
.pill.upper { text-transform: uppercase; }

/* ============================ PULSANTI ============================ */
.btn-greenDark-normal {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 18px; border-radius: 10px;
  background: rgba(149, 225, 168, 0.14); border: 1px solid rgba(149, 225, 168, 0.4);
  color: #95e1a8; font-weight: 700; font-size: 12.5px; letter-spacing: 0.3px;
  cursor: pointer; text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.btn-greenDark-normal:hover { background: rgba(149, 225, 168, 0.26); border-color: rgba(149, 225, 168, 0.65); color: #ffffff; transform: translateY(-1px); }
.appLight .btn-greenDark-normal { background: rgba(26, 107, 83, 0.12); border-color: rgba(26, 107, 83, 0.38); color: #0E3A2F; }
.appLight .btn-greenDark-normal:hover { background: rgba(26, 107, 83, 0.22); border-color: rgba(26, 107, 83, 0.6); }
.btn-greenDark-normal:disabled, .btn-ghost:disabled, .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border: none; border-radius: 10px;
  background: #95e1a8; color: #0E3A2F;
  font-size: 12.5px; font-weight: 800; letter-spacing: 0.2px;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary:hover { background: #aef0bf; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }
.appLight .btn-primary { background: #0E3A2F; color: #78f9ad; box-shadow: none; }
.appLight .btn-primary:hover { background: #1a6b53; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border-radius: 10px;
  border: 1px solid var(--app-line); background: transparent; color: var(--app-text);
  font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover { background: var(--app-hover); }
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 10px;
  border: 1px solid rgba(255, 138, 141, 0.6); background: rgba(220, 38, 41, 0.14); color: var(--danger);
  font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.btn-danger:hover { background: rgba(220, 38, 41, 0.28); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: 8px; }

/* Pulsante "firma" di TRADE, angoli 10-0-10 */
.btn-greenLight-trade {
  color: #0E3A2F; background: #78f9ad; text-align: center;
  padding: 11px 40px; border: none; border-radius: 10px 0 10px;
  font-weight: 700; letter-spacing: 1px; cursor: pointer;
  transition: background-color 0.3s ease, letter-spacing 0.2s ease, box-shadow 0.3s ease;
}
.btn-greenLight-trade:hover { background: #5ae99a; letter-spacing: 2px; box-shadow: 0 0 15px rgba(0, 255, 127, 0.7), 0 0 30px rgba(0, 255, 127, 0.4); }

/* ============================ FORM ============================ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fieldLabel { font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--app-faint); }
.input, .select, .textarea {
  height: 36px; padding: 0 11px;
  border-radius: 9px;
  background: var(--input-bg); border: 1px solid var(--input-border);
  color: var(--app-text);
  font-size: 12.5px; font-weight: 600;
  min-width: 0;
}
.textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; font-weight: 500; line-height: 1.45; }
.select { cursor: pointer; }
.select option { background: var(--popover-bg); color: var(--app-text); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--app-accent); box-shadow: 0 0 0 3px var(--app-accent-soft); }
.controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.controls .grow { flex: 1; min-width: 180px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.check input { accent-color: #78f9ad; width: 15px; height: 15px; }
.appLight .check input { accent-color: #1a6b53; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 10px;
  background: var(--surface-bg); border: 1px solid var(--surface-border);
  font-size: 12.5px; font-weight: 700; cursor: pointer; user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.chip:hover { border-color: rgba(149,225,168,0.35); }
.chip input { accent-color: #78f9ad; }
.chip .swatch { width: 9px; height: 9px; border-radius: 50%; }
.chip .n { font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--app-surface); color: var(--app-muted); }
.chip.off { opacity: 0.55; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--app-surface); border: 1px solid var(--app-line); flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: 9px; border: none; background: transparent; color: var(--app-muted); font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--app-text); }
.tab.on { background: var(--app-accent-soft); color: var(--app-accent); }
.tab .n { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--app-surface); }

/* ============================ LISTE ============================ */
.reList { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.reItem {
  display: grid; grid-template-columns: 36px 1fr auto 16px; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface-bg); border: 1px solid var(--surface-border);
  color: inherit; text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.reItem.link { cursor: pointer; }
.reItem.link:hover { background: var(--app-hover); border-color: rgba(149,225,168,0.28); transform: translateX(2px); }
.reItem.link:hover .reGo { opacity: 1; transform: translateX(0); }
.reGo { display: flex; color: var(--app-accent); opacity: 0; transform: translateX(-4px); transition: opacity 0.15s ease, transform 0.15s ease; }
.reIcon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.reIcon.crit { background: rgba(239,116,119,0.14); color: var(--danger); }
.reIcon.warn { background: rgba(246,200,112,0.14); color: var(--warn); }
.reIcon.ok { background: rgba(46,160,67,0.16); color: var(--ok); }
.reIcon.info { background: rgba(120,180,255,0.14); color: var(--info); }
.reBody { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.reTitle { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reMeta { font-size: 11.5px; color: var(--app-faint); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.reDot { opacity: 0.5; }
.reVal { text-align: right; min-width: 76px; }
.reVal b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.reVal span { display: block; font-size: 10px; color: var(--app-faint); font-weight: 600; margin-top: 2px; }

.skeleton { display: flex; flex-direction: column; gap: 8px; }
.skelRow, .skelBox {
  height: 52px; border-radius: 10px;
  background: linear-gradient(90deg, var(--app-surface) 0%, var(--app-hover) 50%, var(--app-surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skelBox { height: 100%; min-height: 120px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.empty {
  padding: 22px; text-align: center;
  font-size: 12.5px; color: var(--app-faint); line-height: 1.55;
  border-radius: 10px; background: var(--app-surface); border: 1px dashed var(--app-line);
}
.empty b { color: var(--app-text); }

/* ============================ TABELLE ============================ */
.repTableWrap {
  --rep-line-soft: rgba(255, 255, 255, 0.06);
  --rep-head-bg: #12312a;
  --rep-zebra: rgba(255, 255, 255, 0.03);
  width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--app-line); border-radius: 12px;
}
.appLight .repTableWrap { --rep-line-soft: rgba(14, 58, 47, 0.08); --rep-head-bg: #eef4f1; --rep-zebra: rgba(14, 58, 47, 0.035); }
.repTable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; color: var(--app-text); }
.repTable thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--rep-head-bg);
  padding: 12px 14px; text-align: left;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--app-muted); white-space: nowrap;
  border-bottom: 1px solid var(--app-line);
}
.repTable td { padding: 11px 14px; border-bottom: 1px solid var(--rep-line-soft); white-space: nowrap; vertical-align: middle; }
.repTable td.num, .repTable th.num { text-align: right; font-variant-numeric: tabular-nums; }
.repTable td.wrap { white-space: normal; min-width: 220px; }
.repTable tbody tr:last-child td { border-bottom: none; }
.repTable tbody tr:hover td { background: var(--app-hover); }
.repTable tbody tr:nth-child(even) td { background: var(--rep-zebra); }
.repTable tbody tr:nth-child(even):hover td { background: var(--app-hover); }
.repTable .strong { font-weight: 700; }
.repTable .muted { color: var(--app-faint); font-size: 12px; }
.repTable .rowLink { cursor: pointer; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--app-muted); }
.pager .btns { display: flex; gap: 6px; }

/* ============================ MODALE E TOAST ============================ */
.modalOverlay { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); }
.modalOverlay.open { display: flex; }
.modalCard { width: min(720px, 94vw); max-height: 92vh; overflow-y: auto; background: var(--popover-bg); border: 1px solid var(--card-border); border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,0.45); padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.modalHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modalClose { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--app-line); background: transparent; cursor: pointer; font-size: 18px; line-height: 1; color: var(--app-muted); }
.modalClose:hover { background: var(--app-hover); color: var(--app-text); }
.modalActions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.toastStack { position: fixed; top: 82px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 14px; border-radius: 10px;
  background: #ffffff; color: #1e1e1e;
  border-left: 4px solid #2ea043;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  font-size: 13px; line-height: 1.45;
  animation: toastIn 0.3s ease;
}
.toast.error { border-left-color: #DC2629; }
.toast.warning { border-left-color: #f6c870; }
.toast.info { border-left-color: #2563EB; }
.toast b { display: block; font-weight: 700; color: #111; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: none; } }

.muted { color: var(--app-muted); }
.faint { color: var(--app-faint); }
.danger-text { color: var(--danger); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.hidden, [hidden] { display: none !important; }
