.tab-pane:focus,
.tab-pane:focus-visible {
  outline: none;
  box-shadow: none;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter/inter-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: optional;
}

:root {
  --button-font-weight: 500;
  /* Forme e profondità */
  --radius-sm: .5rem;
  --radius-md: .8rem;
  --radius-lg: 1rem;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 6px rgba(16, 24, 40, .04);
  --shadow-raised: 0 10px 24px rgba(16, 24, 40, .1);
  /* Scala tipografica: sette passi, mai sotto 12 px per il testo */
  --text-xs: .75rem;        /* 12 px: etichette, note, piè di pagina, intestazioni di tabella */
  /* Only for uppercase, letter-spaced labels (menu sections): capitals stay legible at 11px. Two exceptions in
     city.css, at the request of the editors: .city-reads-recent, a figure that repeats the label beside it, and the
     words of .city-tile. */
  --text-caps: .6875rem;
  --text-sm: .8125rem;      /* 13 px: pulsanti, tabelle, menu laterale */
  --text-base: .875rem;     /* 14 px: corpo, campi, avvisi */
  --text-md: .9375rem;      /* 15 px: titoli di terzo livello, pulsanti grandi */
  --text-lg: 1rem;          /* 16 px: valori in evidenza; campi su telefono (niente zoom iOS) */
  --text-xl: 1.125rem;      /* 18 px: titoli di sezione */
  --text-2xl: 1.3rem;       /* 21 px: valori principali */
  --text-title: clamp(1.625rem, 2.4vw, 1.875rem);   /* titolo di pagina */
  --text-display: clamp(1.45rem, 3.2vw, 2rem);      /* h1 della schermata di accesso */
  --text-stat: clamp(1.25rem, 1.6vw, 1.6rem);       /* numeri delle schede di SellerNotifier */
  /* Monogrammi decorativi (aria-hidden) nei riquadri dei portali e negli avatar: seguono il contenitore */
  --monogram-xs: .58rem;
  --monogram-sm: .68rem;
  --monogram-md: .8rem;
  --monogram-lg: 1rem;
  --monogram-xl: 1.3rem;
  --monogram-2xl: 1.65rem;
  /* Testo e superfici */
  --ink: #242a30;
  --ink-soft: #5f6b74;             /* AA su bianco (5,5:1) e su --surface (5,0:1) */
  --ink-faint: #8a96a0;            /* solo elementi disattivati */
  --ink-fixed: #242a30;            /* inchiostro scuro in entrambi i temi (chip chiari) */
  --on-accent: #fff;               /* testo su sfondi colorati */
  --shade: #000;
  --surface: #f3f6fa;
  --paper: #ffffff;
  --surface-hover: #e9f0f6;
  --topbar-bg: #ffffff;
  --line: #dfe5ec;
  --row-line: #d4dbe3;             /* righe degli elenchi City: fra --line e --control-border */
  --label-ink: #344651;
  /* Controlli */
  --control-border: #c8d1da;
  --control-bg: var(--paper);
  --control-disabled-bg: #e9ecef;
  --focus-ring: var(--primary-light);
  /* Menu laterale, scuro in entrambi i temi */
  --sidebar: #1f2730;
  --sidebar-deep: #171d24;
  --sidebar-hover: #262f38;
  --sidebar-active: #273039;
  --sidebar-accent: #8fc5ee;
  --sidebar-text: #c9d3dd;
  --sidebar-muted: #8e9cab;        /* AA sul menu */
  --sidebar-icon: #8fa0b0;
  --sidebar-brand-ink: #f3f7f7;
  /* Contatori del menu: pieni con il numero bianco, uguali nei due temi (--danger del tema scuro è un rosa da testo). */
  --sidebar-badge-danger: #c0392b;   /* 5,4:1 col bianco */
  --sidebar-badge-warning: #e8740c;  /* 9/11: arancione vero (#c2410c sembrava rosso), numero bianco come gli altri contatori */
  --tooltip-bg: #111820;
  --tooltip-ink: #fff;
  /* Colore principale, collegamenti, grafici */
  --primary: #245f91;
  --primary-deep: #194b75;
  --primary-soft: #e9f0f6;
  --telegram: #229ed9;             /* colore del marchio Telegram, icona del canale */
  --qr-paper: #ffffff;             /* fondo del codice QR, bianco anche nel tema scuro */
  --primary-light: #4d81aa;
  --link-hover: var(--primary);
  --tab-active-ink: var(--primary);
  --chart-line: var(--primary);
  --chart-previous: #c2570c;       /* linea dell'anno precedente nel grafico delle Statistiche */
  --pill-bg: #ddecf6;
  --pill-border: #c4dceb;
  --pill-ink: var(--primary);
  /* Pulsanti: pieno, contorno principale, contorno neutro, pericolo, disattivato */
  --action-bg: #2b6cab;
  --action-hover: #245f91;
  --action-pressed: #194b75;
  --action-outline-bg: #ffffff;
  --action-outline-border: #c7d2dd;
  --action-outline-text: #245f91;
  --action-outline-hover: #f1f5f9;
  --action-outline-hover-border: var(--action-outline-border);
  --action-outline-hover-text: var(--action-outline-text);
  --action-outline-active: #e9f0f6;
  --action-outline-active-text: var(--action-outline-text);
  --neutral-border: var(--action-outline-border);
  --neutral-text: var(--action-outline-text);
  --neutral-hover-bg: var(--action-outline-hover);
  --neutral-hover-border: var(--action-outline-border);
  --neutral-hover-text: var(--action-outline-text);
  --neutral-active-bg: var(--action-outline-active);
  --neutral-active-text: var(--action-outline-text);
  --danger: #b54343;
  --danger-action: #b54343;
  --danger-action-hover: #933838;
  --danger-action-pressed: #ab4848;
  --danger-outline-border: var(--danger);
  --danger-outline-text: var(--danger);
  --danger-outline-hover-border: var(--danger-action-hover);
  --danger-outline-hover-bg: var(--danger-action-hover);
  --danger-outline-hover-text: var(--on-accent);
  --danger-outline-active-border: var(--danger-action-pressed);
  --danger-outline-active-bg: var(--danger-action-pressed);
  --action-disabled-bg: #9aa7b2;
  --action-disabled-ink: #fff;
  /* Stati, avvisi, tendenze */
  --warning: #926d16;
  --success: #23745e;
  --success-edge: #3f9b7c;
  --trend-up: #1f7a4c;             /* AA (5,3:1); prima #2f9e65 (3,4:1) */
  --trend-down: #c23d3d;           /* AA (5,2:1); prima #d14b4b (4,4:1) */
  --attention: #e8740c;             /* «Da tenere d'occhio» di «Analisi AI» (27/11): l'arancione degli avvisi del menu, per il bordo */
  --attention-ink: #b35400;         /* lo stesso arancione per il testo, AA su bianco (5,0:1) */
  /* The boxes are full pastels with dark ink, as the notes (post-its), in both themes; the warning is the yellow of
     the notes, a full post-it yellow from 24/11 because the pale one vanished on the light page. The red box is the
     urgent note instead (24/11): the same red with white ink in both themes. The pastel red stays for the small
     badges and labels (city.css). */
  --urgent-surface: #b54343; --urgent-border: #9f2530;
  --alert-success-bg: #cdeedf; --alert-success-border: #8fd0b3; --alert-success-ink: #0d3b2c;
  --alert-danger-bg: #ffd6d2; --alert-danger-border: #f0a09a; --alert-danger-ink: #5a1414;
  --alert-warning-bg: #ffe98a; --alert-warning-border: #e3c445; --alert-warning-ink: #4a3c05;
  --alert-info-bg: #d3e7fb; --alert-info-border: #94c3ef; --alert-info-ink: #0c3557;
  --highlight-ink: #493300; --highlight-bg: #ffe596; --highlight-edge: #c4931b;
  --table-stripe: rgba(36, 42, 48, .06);
  /* Indicatori di stato */
  --led-active: #2dbb78;
  --led-invited: #429bdc;
  --led-suspended: #e0a126;
  --led-archived: #91a4b1;
  --led-deny: #e95c68;
  --led-allow: #2dbb78;
  --led-own: #e0a126;
  --shadow: 0 8px 24px rgba(36, 42, 48, .1);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Bootstrap legge i nostri token: testo, bordi, collegamenti, colore principale, anello di fuoco */
  --bs-body-color: var(--ink);
  --bs-emphasis-color: var(--ink);
  --bs-heading-color: var(--ink);
  --bs-secondary-color: var(--ink-soft);
  --bs-secondary-rgb: 95, 107, 116;
  --bs-border-color: var(--line);
  --bs-link-color: var(--primary-deep);
  --bs-link-color-rgb: 25, 75, 117;
  --bs-link-hover-color: var(--link-hover);
  --bs-link-hover-color-rgb: 36, 95, 145;
  --bs-primary: var(--primary);
  --bs-primary-rgb: 36, 95, 145;
  --bs-focus-ring-color: rgba(36, 95, 145, .25);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--surface); }
body {
  min-height: 100dvh; margin: 0; background: var(--surface); color: var(--ink);
  font-family: var(--font-sans); font-size: var(--text-base); line-height: 1.58; letter-spacing: .006em;
}
button, input, select, textarea { font: inherit; }
a { color: var(--primary-deep); text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

.skip-link {
  position: fixed; z-index: 1200; left: 1rem; top: -5rem; padding: .65rem 1rem;
  border-radius: 0 0 .45rem .45rem; background: var(--primary); color: var(--on-accent);
  font-weight: 800; text-decoration: none; transition: top .16s ease;
}
.skip-link:focus { top: 0; color: var(--on-accent); }

.brand {
  display: inline-flex; align-items: center; color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-logo {
  display: block; width: 12rem; height: auto; max-width: 100%;
  image-rendering: auto; shape-rendering: geometricPrecision;
}
.brand-logo-white { display: none; }
/* The white logos are cropped at 280 of 300 points (1/12): the same size as the coloured one on the sign-in page. */
.auth-header .brand-logo-white { width: 11.2rem; }
html[data-theme="dark"] .auth-header .brand-logo-color { display: none; }
html[data-theme="dark"] .auth-header .brand-logo-white { display: block; }
html[data-theme="dark"] .auth-card .eyebrow { color: var(--sidebar-accent); }
.portal-tile {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 2rem;
  border: 1px solid color-mix(in srgb, var(--portal-color) 72%, var(--shade));
  border-radius: .48rem; background: var(--portal-color); color: var(--on-accent);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 2px 7px rgba(0,0,0,.12);
  font-size: var(--monogram-sm); font-weight: 900; letter-spacing: -.025em; line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}
.portal-tile-md { width: 2.5rem; height: 2.5rem; flex-basis: 2.5rem; border-radius: .55rem; font-size: var(--monogram-md); }
.portal-tile-lg { width: 3rem; height: 3rem; flex-basis: 3rem; border-radius: .7rem; font-size: var(--monogram-lg); }
.portal-tile-nav { width: 1.55rem; height: 1.55rem; flex-basis: 1.55rem; margin-right: .72rem; border-radius: .38rem; font-size: var(--monogram-xs); }
.portal-tile-header { width: 1.65rem; height: 1.65rem; flex-basis: 1.65rem; border-radius: .4rem; font-size: var(--monogram-xs); }
.portal-tile-menu { width: 1.7rem; height: 1.7rem; flex-basis: 1.7rem; border-radius: .4rem; font-size: var(--monogram-xs); }
.status-label { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.status-indicator {
  display: block !important; flex: 0 0 13px !important; flex-shrink: 0 !important;
  width: 13px !important; height: 13px !important; min-width: 13px !important; min-height: 13px !important;
  max-width: 13px !important; max-height: 13px !important; aspect-ratio: 1 / 1;
  align-self: center; padding: 0; border: 0; border-radius: 50% !important;
}
.status-active { background: var(--led-active); }
@media (min-width: 1200px) {
  .users-filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr) minmax(0, 1fr) minmax(0, 1.15fr) auto;
  }
  .users-filter-row > div { width: auto; max-width: none; min-width: 0; }
  .users-filter-actions { justify-content: flex-end; white-space: nowrap; }
}
.status-invited { background: var(--led-invited); }
.status-suspended { background: var(--led-suspended); }
.status-archived { background: var(--led-archived); }
/* A failure: the red LED of the register and of the notifications of the browser. */
.status-indicator.is-deny { background: var(--led-deny); }
.portal-services { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem .65rem; margin-top: .2rem; }
.portal-service { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; color: var(--ink-soft); font-size: var(--text-xs); }
.portal-service-led {
  display: block; flex: 0 0 9px; width: 9px; height: 9px; min-width: 9px; min-height: 9px;
  max-width: 9px; max-height: 9px; border-radius: 50%; background: var(--led-deny);
}
.portal-service-led.is-configured { background: var(--led-active); }
.portal-public-url,
.portal-public-url:hover,
.portal-public-url:focus-visible { text-decoration: none; }
.portal-public-url { overflow-wrap: anywhere; }
.app-body .admin-portal-list .portal-tile {
  color: var(--on-accent);
  text-decoration: none;
}
.profile-avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto; overflow: hidden;
  border-radius: 50%; background: var(--avatar-color, var(--primary)); color: var(--avatar-ink, var(--on-accent));
  font-weight: 900; letter-spacing: .02em; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 2px 6px rgba(24,42,50,.2);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-header { width: 2rem; height: 2rem; font-size: var(--monogram-sm); }
.profile-avatar-md { width: 2.25rem; height: 2.25rem; min-width: 2.25rem; min-height: 2.25rem; max-width: 2.25rem; max-height: 2.25rem; flex-basis: 2.25rem; font-size: var(--monogram-sm); }
.profile-avatar-lg { width: 6.5rem; height: 6.5rem; font-size: var(--monogram-2xl); }
.profile-avatar-list { width: 2.35rem; height: 2.35rem; flex-basis: 2.35rem; font-size: var(--monogram-sm); }
.account-list-link { display: inline-flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; }
.account-list-link:hover { color: var(--primary-deep); }
.profile-editor { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 1.5rem; align-items: start; }
.profile-appearance { min-width: 0; }
.appearance-option { display: inline-flex; align-items: center; gap: .45rem; font-size: var(--text-base); font-weight: 700; }
.avatar-colors { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
.avatar-color-choice { position: relative; cursor: pointer; }
.avatar-color-choice input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-color-choice > span:first-of-type {
  display: block; width: 2rem; height: 2rem; border: .2rem solid var(--paper);
  border-radius: 50%; background: var(--choice-color); box-shadow: 0 0 0 1px var(--line);
}
.avatar-color-choice input:checked + span { box-shadow: 0 0 0 3px var(--primary); }
/* Nome e cognome affiancati, su metà circa della larghezza del form. */
.profile-name-fields { max-width: 44rem; }
/* Every file field of the CMS (profile, Mediateca, banner graphic): as tall as the other fields, with the «Scegli file»
   button filling the whole height, without steps. */
.form-control[type="file"] { height: 2.6rem; padding-top: 0; padding-bottom: 0; line-height: calc(2.6rem - 2px); }
.form-control-sm[type="file"] { height: 2.1rem; line-height: calc(2.1rem - 2px); }
.form-control[type="file"]::file-selector-button { height: 100%; margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }

/* Anonymous and Identity screens */
.auth-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-header {
  height: 4.4rem; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1.25rem, 5vw, 4rem); background: var(--paper); border-bottom: 1px solid var(--line);
}
.auth-context { color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.auth-main { flex: 1; display: grid; place-items: start center; padding: clamp(2.2rem, 8vh, 5.75rem) 1rem 2rem; }
.auth-card {
  width: min(100%, 28.75rem); padding: clamp(1.5rem, 5vw, 2.45rem); background: var(--paper);
  border: 1px solid var(--line); border-radius: .75rem; box-shadow: var(--shadow);
}
.auth-card > :first-child { margin-top: 0; }
.auth-card h1 { font-size: var(--text-display); margin: .45rem 0 .55rem; letter-spacing: -.022em; }
.auth-card .text-muted, .auth-card p { color: var(--ink-soft) !important; }
.auth-footer { padding: 1.35rem 1rem; color: var(--ink-soft); font-size: var(--text-xs); text-align: center; }

/* Application frame */
.app-shell { min-height: 100dvh; }
.app-sidebar {
  position: fixed; z-index: 1050; top: 0; bottom: 0; left: 0; width: 15.6rem;
  display: flex; flex-direction: column; overflow-y: auto; background: var(--sidebar);
  border-right: 1px solid rgba(255,255,255,.07); color: var(--sidebar-text);
  transition: transform .2s ease, width 0.2s ease;
}
.sidebar-brand {
  min-height: 4.35rem; display: flex; align-items: center; padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand { color: var(--sidebar-brand-ink); }
.sidebar-brand-logo { display: block; width: 10rem; overflow: hidden; transition: width .2s ease; }
.sidebar-brand-logo .brand-logo { width: 10rem; max-width: none; height: auto; }
/* Only the items scroll, between the logo and the account. The menu as a whole scrolls in windows too short for
   that minimum height. The two local grounds cover the shadows at the ends the list has reached. */
.sidebar-nav {
  flex: 1 1 auto; min-height: 12rem; overflow: hidden auto; overscroll-behavior: contain; padding: 1.05rem .72rem;
  background:
    linear-gradient(var(--sidebar) 40%, transparent) top / 100% 1.75rem no-repeat local,
    linear-gradient(transparent, var(--sidebar) 60%) bottom / 100% 1.75rem no-repeat local,
    linear-gradient(rgba(0,0,0,.28), transparent) top / 100% .7rem no-repeat scroll,
    linear-gradient(transparent, rgba(0,0,0,.28)) bottom / 100% .7rem no-repeat scroll;
}
.nav-label {
  display: block; padding: .95rem .8rem .4rem; color: var(--sidebar-muted);
  font-family: var(--font-sans); font-size: var(--text-caps); font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  transition: opacity 0.2s ease;
}
/* Menu colours, the same in both themes: navigation items azure with grey icons, hover and the selected
   item white (text and icon); the Account section keeps the neutral text colour. */
.side-link {
  position: relative; display: flex; align-items: center; min-height: 2.5rem; margin: .3rem 0;
  padding: .5rem .8rem .5rem .9rem; border-radius: .55rem; color: var(--sidebar-accent);
  font-size: var(--text-sm); font-weight: 500; letter-spacing: 0; text-decoration: none;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.app-sidebar :is(.side-link, .side-submenu-link, .side-menu-flyout-link) { color: var(--sidebar-accent); }
.side-link:hover { background: transparent; color: var(--on-accent); }
.side-link.active { background: var(--sidebar-deep); color: var(--on-accent); font-weight: 600; }
.side-link-portal { padding-left: 1.35rem; font-size: var(--text-sm); }
/* Unread notifications next to «Notifiche»: red when one of them is important; a point when the menu is collapsed. */
.side-badge { flex: none; margin-left: auto; min-width: 1.35rem; padding: .05rem .4rem; border-radius: 999px; background: var(--sidebar-deep); color: var(--on-accent); font-size: var(--text-xs); font-weight: 700; line-height: 1.3; text-align: center; }
.side-badge.is-important { background: var(--danger); }
.side-link.has-active-child { color: var(--on-accent); }
.side-menu-heading { display: flex; align-items: center; min-width: 0; }
.side-menu-heading > .side-link { min-width: 0; flex: 1; }
.side-menu-flyout-trigger { display: none; border: 0; background: transparent; cursor: pointer; }
.side-menu-flyout-trigger:hover, .side-menu-flyout-trigger:focus-visible { background: var(--sidebar-hover); color: var(--on-accent); }
.side-menu-flyout {
  position: fixed; z-index: 1060; width: min(15rem, calc(100vw - 5.5rem));
  max-height: calc(100dvh - 1rem); overflow-y: auto; padding: .45rem;
  border: 1px solid rgba(255,255,255,.14); border-radius: .45rem;
  background: var(--sidebar); box-shadow: 0 9px 24px rgba(0,0,0,.28);
}
.side-menu-flyout[hidden] { display: none; }
.side-menu-flyout-link {
  display: block; padding: .52rem .6rem; border-radius: .32rem;
  color: var(--sidebar-accent); font-size: var(--text-sm); font-weight: 400; text-decoration: none;
}
.side-menu-flyout-link:hover, .side-menu-flyout-link:focus-visible { background: var(--sidebar-hover); color: var(--on-accent); }
.side-menu-flyout-link.active { background: var(--sidebar-active); color: var(--on-accent); font-weight: 500; }
.side-menu-flyout-link--primary { font-weight: 700; }
.side-menu-flyout-link--primary.active { font-weight: 700; }
.side-menu-flyout-link--sub,
.side-menu-flyout-link--sub.active { font-weight: 400; }
.side-menu-flyout-title {
  display: block; padding: .52rem .6rem; color: var(--on-accent); font-size: var(--text-sm); font-weight: 700;
}
.app-sidebar .side-menu-flyout .side-menu-flyout-link:is(:hover, :focus-visible, .active) { color: var(--on-accent); }
.side-submenu-toggle {
  display: grid; place-items: center; flex: 0 0 2rem; width: 2rem; height: 2rem;
  border: 0; border-radius: .32rem; background: transparent; color: var(--sidebar-accent);
}
/* A group without a page: the whole row opens it. */
.side-menu-group-toggle { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.side-menu-group-toggle::after { margin-left: auto; }
.side-submenu-toggle::after, .side-menu-group-toggle::after {
  content: ""; width: .46rem; height: .46rem; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .16s ease;
}
:is(.side-submenu-toggle, .side-menu-group-toggle)[aria-expanded="true"]::after { transform: rotate(225deg) translate(-1px, -1px); }
.side-submenu-toggle:hover, .side-submenu-toggle:focus-visible { background: var(--sidebar-hover); color: var(--on-accent); }
.side-submenu {
  list-style: none; margin: .1rem 0 .45rem 1.45rem; padding: 0 0 0 .65rem;
  border-left: 1px solid rgba(255,255,255,.18);
}
.side-submenu[hidden] { display: none; }
.side-submenu-link {
  display: block; padding: .45rem .6rem; border-radius: .32rem;
  color: var(--sidebar-accent); font-size: var(--text-sm); line-height: 1.35; text-decoration: none;
}
.app-sidebar .side-submenu-link:is(:hover, :focus-visible) { background: var(--sidebar-hover); color: var(--on-accent); }
.app-sidebar .side-submenu-link.active { background: var(--sidebar-active); color: var(--on-accent); font-weight: 500; }
/* A page under another page of the submenu (Pubblicità › Pacchetti › Tipi di pacchetto): one more step in. */
.side-submenu-link--nested, .side-menu-flyout-link--nested { padding-left: 1.6rem; }
.nav-icon {
  width: 1.1rem; height: 1.1rem; min-width: 1.1rem; margin-right: .7rem; flex-shrink: 0;
  color: var(--sidebar-icon); transition: color .16s ease;
}
.app-sidebar .side-link:is(:hover, .active, .has-active-child) { color: var(--on-accent); }
.app-sidebar .side-link:is(:hover, .active, .has-active-child) .nav-icon { color: var(--on-accent); }
/* Every Bootstrap tooltip of the CMS in the colours of the theme (23/11): Bootstrap takes the text colour as its
   background, light in the dark theme under white text. The sidebar keeps its own rules below. */
.tooltip { --bs-tooltip-bg: var(--tooltip-bg); --bs-tooltip-color: var(--tooltip-ink); --bs-tooltip-opacity: .98; }
.sidebar-tooltip {
  --bs-tooltip-bg: var(--tooltip-bg);
  --bs-tooltip-color: var(--tooltip-ink);
  --bs-tooltip-opacity: .98;
  --bs-tooltip-max-width: 15rem;
  z-index: 1100;
}
.sidebar-tooltip .tooltip-inner {
  padding: .48rem .7rem; border: 1px solid rgba(255,255,255,.12);
  border-radius: .38rem; box-shadow: 0 5px 16px rgba(0,0,0,.28);
  font-size: var(--text-xs); font-weight: 750; letter-spacing: .01em;
}
html[data-theme="dark"] .sidebar-tooltip {
  --bs-tooltip-bg: var(--tooltip-bg);
  --bs-tooltip-color: var(--tooltip-ink);
}
html[data-theme="dark"] .sidebar-tooltip .tooltip-inner {
  border-color: rgba(24,35,44,.18);
  box-shadow: 0 5px 18px rgba(0,0,0,.42);
}
.sidebar-bottom { margin-top: auto; padding: .8rem .72rem 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.app-sidebar .sidebar-bottom .side-link { color: var(--sidebar-text); }
.app-sidebar .sidebar-bottom .side-link:is(:hover, .active) { color: var(--on-accent); }

.desktop-toggle {
    display: none; background: transparent; border: none; color: var(--sidebar-muted);
    cursor: pointer; padding: 0.4rem; border-radius: 0.3rem; margin-left: auto;
}
.desktop-toggle:hover { color: var(--on-accent); background: rgba(255,255,255,0.1); }
.icon-expand { display: none; }
.sidebar-expand { display: none; }
@media (min-width: 768px) {
    /* A tighter frame and closer subitems with the mouse; the phone keeps the height of a finger. */
    .sidebar-nav { padding-top: .6rem; padding-bottom: .6rem; }
    .nav-label { padding-top: .8rem; padding-bottom: .35rem; }
    .side-submenu { margin-bottom: .25rem; }
    .side-submenu-link { padding-top: .38rem; padding-bottom: .38rem; }
    .desktop-toggle { display: block; }
    body.sidebar-collapsed .app-sidebar { width: 4.5rem; }
    body.sidebar-collapsed .app-main { margin-left: 4.5rem; }
    body.sidebar-collapsed .sidebar-brand-logo { width: 2.35rem; }
    body.sidebar-collapsed .nav-label { opacity: 0; pointer-events: none; height: 0; padding: 0; margin: 0; overflow: hidden; }
    body.sidebar-collapsed .sidebar-nav { padding-left: .5rem; padding-right: .5rem; }
    body.sidebar-collapsed .side-link { width: 2.75rem; padding: 0; margin-left: auto; margin-right: auto; justify-content: center; }
    body.sidebar-collapsed .side-link .nav-icon { margin-right: 0 !important; }
    body.sidebar-collapsed .side-link span:not(.portal-tile) { display: none; }
    /* The unread count stays as a point on the icon when the menu is collapsed. */
    body.sidebar-collapsed .side-link span.side-badge { display: block; position: absolute; top: .3rem; right: .3rem; width: .6rem; min-width: 0; height: .6rem; padding: 0; overflow: hidden; color: transparent; }
    body.sidebar-collapsed .side-link .portal-tile { margin-right: 0; }
    body.sidebar-collapsed .side-menu-heading { justify-content: center; }
    body.sidebar-collapsed .side-menu-heading > .side-link { flex: 0 0 2.75rem; }
    body.sidebar-collapsed .side-menu-group-has-flyout .side-menu-heading > :is(a.side-link, .side-menu-group-toggle) { display: none; }
    body.sidebar-collapsed .side-menu-flyout-trigger { display: flex; }
    /* A group with a page of its own: the icon opens the page, the pointer or the right arrow its items. */
    body.sidebar-collapsed .side-menu-group-has-page .side-menu-heading > a.side-link { display: flex; }
    body.sidebar-collapsed .side-menu-group-has-page .side-menu-flyout-trigger { display: none; }
    body.sidebar-collapsed .side-submenu-toggle { display: none; }
    body.sidebar-collapsed .side-submenu { display: none; }
    body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
    body.sidebar-collapsed .sidebar-bottom { padding: .8rem .5rem 1rem; }
    body.sidebar-collapsed .desktop-toggle { display: none; }
    body.sidebar-collapsed .sidebar-expand { display: grid; }
}

.app-main { min-width: 0; margin-left: 15.6rem; transition: margin-left 0.2s ease; }
.topbar {
  position: sticky; z-index: 1020; top: 0; height: 4.35rem; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; padding: 0 1.25rem; background: var(--topbar-bg);
  border-bottom: 1px solid var(--line); box-shadow: 0 1px 8px rgba(16, 24, 40, .04); backdrop-filter: blur(10px);
}
.topbar-leading, .header-actions { min-width: 0; height: 100%; display: flex; align-items: center; gap: .8rem; }
.topbar-context { color: var(--ink-soft); font-size: var(--text-xs); font-weight: 800; letter-spacing: .085em; text-transform: uppercase; }
.portal-switcher-button {
  display: inline-flex; align-items: center; gap: .55rem; min-height: 2.45rem; max-width: min(22rem, 34vw);
  padding: .35rem .75rem .35rem .5rem; border: 1px solid var(--control-border); border-radius: .5rem;
  background: var(--paper); color: var(--ink); font-size: var(--text-sm); font-weight: var(--button-font-weight);
}
.portal-switcher-button > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The only portal of the account: named in the header, no menu to open. */
a.portal-switcher-button.is-static { text-decoration: none; }

.portal-switcher-button:hover, .portal-switcher-button[aria-expanded="true"] {
  border-color: var(--primary-light); background: var(--primary-soft); color: var(--ink);
}
.portal-switcher { position: relative; }
.portal-switcher .dropdown-menu[data-bs-popper="static"] { top: calc(100% + .35rem); margin-top: 0; }
.portal-switcher .dropdown-menu {
  width: min(var(--portal-menu-width), calc(100vw - 2rem));
  padding: 0;
  /* Taller than the window with few columns: it scrolls, the search stays at the top. */
  max-height: calc(100dvh - 5.5rem); overflow-y: auto; overscroll-behavior: contain;
}
.portal-switcher-search {
  position: sticky; z-index: 2; top: 0;
  padding: .65rem; border-bottom: 1px solid var(--line);
  background: var(--paper); border-radius: inherit;
}
.portal-switcher-search { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.portal-switcher-search .form-control { min-height: 2.35rem; flex: 1 1 10rem; width: auto; min-width: 0; }
/* «Nome | Personalizzato», as the buttons of the home. */
.portal-switcher-sort .btn {
  min-height: 2.35rem; padding-inline: .7rem; border-color: var(--line); background: var(--paper);
  color: var(--ink-soft); font-size: var(--text-sm); font-weight: var(--button-font-weight);
}
.portal-switcher-sort .btn:hover, .portal-switcher-sort .btn:focus-visible {
  border-color: var(--primary-light); background: color-mix(in srgb, var(--primary-light) 10%, var(--paper)); color: var(--primary-deep);
}
/* The pressed button over its neighbour: the two share a border, and the pressed one draws it. */
.portal-switcher-sort .btn[aria-pressed="true"] { position: relative; z-index: 1; }
.portal-switcher-sort .btn[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--primary-light) 45%, var(--line));
  background: color-mix(in srgb, var(--primary-light) 16%, var(--paper)); color: var(--primary-deep);
}
.portal-switcher-empty { padding: .8rem 1rem; font-size: var(--text-sm); }
.portal-switcher-options {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--portal-rows, 10), auto);
  grid-template-columns: repeat(var(--portal-columns), minmax(0, 1fr));
  list-style: none; margin: 0; padding: .25rem 0;
}
.portal-switcher-options > li { min-width: 0; }
.portal-switcher-item, .portal-switcher-item-home { display: flex; align-items: center; gap: .65rem; }
/* The portals as small boxes, as in «Portali da mostrare»; the portal in use takes the primary colour. */
.portal-switcher-options { gap: .4rem; padding: .65rem; }
.portal-switcher .portal-switcher-item, .portal-switcher .portal-switcher-item-home {
  min-height: 2.5rem; padding: .35rem .6rem; gap: .5rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper);
  color: var(--ink); font-size: var(--text-sm);
}
.portal-switcher .portal-switcher-item:hover, .portal-switcher .portal-switcher-item:focus-visible,
.portal-switcher .portal-switcher-item-home:hover, .portal-switcher .portal-switcher-item-home:focus-visible { background: var(--surface-hover); border-color: var(--control-border); }
.portal-switcher .portal-switcher-item.is-current {
  border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--paper)); font-weight: 600;
}
.portal-switcher-item > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* «Home» at the top of the portals, only on phones (the side menu has it elsewhere). */
.portal-switcher-home { display: none; padding: .65rem .65rem 0; }
@media (max-width: 767.98px) { .portal-switcher-home { display: block; } }
.portal-tile-home { background: var(--surface-hover); color: var(--ink); border: 1px solid var(--line); }
.portal-tile-home svg { width: 1rem; height: 1rem; }
@media (max-width: 370px), (max-height: 620px) {
  .portal-switcher .dropdown-menu {
    width: min(20rem, calc(100vw - 1rem)); max-height: calc(100dvh - 5.5rem);
    overflow-y: auto; overscroll-behavior: contain;
  }
  .portal-switcher-search { position: sticky; z-index: 2; top: 0; border-radius: 0; }
  .portal-switcher-options { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
}
.menu-toggle {
  display: none; width: 2.55rem; height: 2.55rem; padding: 0; border: 1px solid var(--line); border-radius: .55rem;
  background: var(--paper); color: var(--ink);
}
.menu-toggle svg { width: 1.15rem; height: 1.15rem; }
.sidebar-expand, .theme-toggle, .push-indicator {
  width: 2.35rem; height: 2.35rem; padding: 0; align-items: center; justify-content: center; border: 1px solid var(--line);
  border-radius: .55rem; background: var(--paper); color: var(--ink-soft);
}
.theme-toggle, .push-indicator { display: inline-grid; flex: 0 0 auto; }
.sidebar-expand:hover, .theme-toggle:hover, .push-indicator:hover { border-color: var(--primary-light); color: var(--primary-deep); background: var(--primary-soft); }
.sidebar-expand svg, .theme-icon, .push-icon-bell { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: block; }
.account-menu { height: 100%; display: flex; flex: 0 0 auto; align-items: center; gap: .5rem; }
.account-identity { display: inline-flex; align-items: center; gap: .28rem; min-width: 0; }
.account-name { display: inline-flex; align-items: center; min-height: 2.35rem; max-width: 15rem; padding: 0 .15rem; overflow: hidden; color: var(--ink); font-size: var(--text-sm); font-weight: 600; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.account-action { display: inline-flex; align-items: center; justify-content: center; min-height: 2.35rem; padding: 0 .72rem !important; border: 1px solid var(--line) !important; border-radius: .55rem; background: var(--paper) !important; line-height: 1; }
.account-link { color: var(--ink); font-size: var(--text-sm); font-weight: 800; text-decoration: none; }
.account-link:hover { color: var(--primary-deep); text-decoration: underline; }
.logout-button {
  color: var(--ink-soft); font-size: var(--text-sm); font-weight: var(--button-font-weight); text-decoration: none;
}
.logout-button:hover { border-color: var(--danger) !important; color: var(--danger); }
.logout-form { margin: 0; }
/* --content-pad-x: the side padding of the page, for the bars that reach the menu and the window edge. */
/* 8/11: 20 px on every desktop width (was 20–40 px with the window); a phone keeps its own 16 px below. */
.content-area { --content-pad-x: 1.25rem; min-height: calc(100dvh - 4.35rem); padding: 1.25rem var(--content-pad-x); }
.site-footer { margin-top: auto; padding: 1.25rem 0 .2rem; color: var(--ink-soft); font-size: var(--text-xs); }
.site-footer::before { content: ""; display: block; margin-bottom: 1.2rem; border-top: 1px solid var(--line); }
.sidebar-backdrop { display: none; }

/* Bootstrap refinement for pages supplied by other modules */
h1, .h1 { margin: 0 0 1.4rem; color: var(--ink); font-size: var(--text-display); font-weight: 800; letter-spacing: -.022em; }
.content-area h1:has(+ p), .auth-card h1:has(+ p) { margin-bottom: 0; }
h2, .h2 { color: var(--ink); font-size: var(--text-xl); font-weight: 700; letter-spacing: -.015em; }
h3, .h3 { color: var(--ink); font-size: var(--text-lg); font-weight: 700; letter-spacing: -.008em; }
p { color: var(--ink-soft); }
.eyebrow { display: block; margin-bottom: .4rem; color: var(--primary); font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500; letter-spacing: .09em; text-transform: uppercase; }
.lead { max-width: 52rem; color: var(--ink-soft); font-size: var(--text-md); }
/* Internal headings only: public authentication keeps its existing typography. */
.app-body {
  --heading-ink: #1e293b;
  --heading-muted: #526379;
  --heading-line: #d8e1eb;
}
html[data-theme="dark"] .app-body {
  --heading-ink: #e7eef7;
  --heading-muted: #adbdcf;
  --heading-line: #414a55;
}
.app-body .internal-page-heading {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
  padding-bottom: 20px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
}
.app-body .page-heading-main {
  display: flex; align-items: center; gap: 16px; flex: 1 1 24rem; min-width: 0; max-width: 100%;
}
.app-body .page-heading-text { flex: 1; min-width: 0; }
.app-body .page-heading-section {
  display: block; margin-bottom: 8px; color: var(--primary-deep);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.app-body .page-heading-title {
  margin: 0; color: var(--heading-ink); font-size: var(--text-title);
  font-weight: 750; line-height: 1.2; letter-spacing: -.03em; overflow-wrap: anywhere;
}
.app-body .page-heading-description {
  margin: 8px 0 0; color: var(--heading-muted);
  font-size: var(--text-base); font-weight: 400; line-height: 1.6; overflow-wrap: anywhere;
}
.app-body .page-heading-status { margin-top: 8px; color: var(--heading-muted); }
.app-body .page-heading-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 16px;
  flex: 0 1 auto; min-width: 0; max-width: 100%; margin-left: auto;
}
.app-body .page-heading-actions > * { max-width: 100%; overflow-wrap: anywhere; }
.app-body .internal-page-heading.home-dashboard-heading {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px;
  align-items: center;
  /* The line under the heading as on the other pages (9/11). */
}
.app-body .home-dashboard-heading .page-heading-main,
.app-body .home-dashboard-heading .page-heading-text { display: contents; }
.app-body .home-dashboard-heading .page-heading-section {
  grid-column: 1 / -1; grid-row: 1; margin: 0;
}
.app-body .home-dashboard-heading .page-heading-title { grid-column: 1; grid-row: 2; }
.app-body .home-dashboard-heading .page-heading-actions {
  grid-column: 2; grid-row: 2; margin-left: 0; justify-content: flex-end;
}
.app-body .home-dashboard-heading .page-heading-description {
  grid-column: 1 / -1; grid-row: 3; margin: 0;
}
.app-body .internal-page-heading.portal-dashboard-heading {
  flex-wrap: nowrap; align-items: center; gap: 12px;
}
.app-body .portal-dashboard-heading .page-heading-main {
  flex: 1 1 0; gap: 12px;
}
.app-body .portal-dashboard-heading .page-heading-status {
  margin-top: 4px;
}
.app-body .portal-dashboard-heading .portal-tile-lg {
  width: 4rem; height: 4rem; flex-basis: 4rem;
  border-radius: .85rem; font-size: var(--monogram-xl);
}
.app-body .portal-dashboard-heading .page-heading-actions {
  flex: 0 0 auto; margin-left: 0; justify-content: flex-end;
}
.app-body .internal-page-back {
  display: inline-block; margin-bottom: 16px; font-size: var(--text-sm); font-weight: 550;
  overflow-wrap: anywhere;
}
@media (max-width: 767.98px) {
  .app-body .internal-page-heading { align-items: flex-start; }
  .app-body .page-heading-main { flex-basis: 100%; }
  .app-body .page-heading-actions { justify-content: flex-start; margin-left: 0; }
}
.card {
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper);
  box-shadow: var(--shadow-card);
}
.card-header { padding: 1.05rem 1.35rem; border-bottom-color: var(--line); background: transparent; color: var(--ink); font-weight: 700; }
.card-body { padding: 1.35rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 2.4rem; padding: .3rem .9rem; vertical-align: middle;
  border-radius: .55rem; font-size: var(--text-sm); font-weight: var(--button-font-weight);
  line-height: 1.05; letter-spacing: 0; text-align: center;
}
.btn.btn-sm { min-height: 2rem; padding: .2rem .7rem; border-radius: .45rem; font-size: var(--text-xs); line-height: 1; }
.btn.btn-lg { min-height: 2.65rem; padding: .32rem .9rem; font-size: var(--text-md); line-height: 1.05; }
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.btn.is-loading,
.account-action.is-loading {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: wait;
}
.btn-loading-indicator {
  width: 1em; height: 1em; flex: 0 0 1em; border: .14em solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: button-loading-spin .7s linear infinite;
}
@keyframes button-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn-loading-indicator { animation-duration: 1.4s; }
}
.btn-primary { background: var(--action-bg); border-color: var(--action-bg); color: var(--on-accent); box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.btn-primary:is(:hover, :focus-visible) {
  background: var(--action-hover); border-color: var(--action-hover); color: var(--on-accent);
}
.btn-primary:is(:active, .active, [aria-pressed="true"]) {
  background: var(--action-pressed); border-color: var(--action-pressed); color: var(--on-accent);
}
.btn-outline-primary {
  background: var(--action-outline-bg); border-color: var(--action-outline-border); color: var(--action-outline-text);
}
.btn-outline-primary:is(:hover, :focus-visible) {
  background: var(--action-outline-hover); border-color: var(--action-outline-hover-border); color: var(--action-outline-hover-text);
}
.btn-outline-primary:is(:active, .active, [aria-pressed="true"]) {
  background: var(--action-outline-active); border-color: var(--action-outline-hover-border); color: var(--action-outline-active-text);
}
:is(.btn-secondary, .btn-outline-secondary) {
  background: var(--action-outline-bg); border-color: var(--neutral-border); color: var(--neutral-text);
}
:is(.btn-secondary, .btn-outline-secondary):is(:hover, :focus-visible) {
  background: var(--neutral-hover-bg); border-color: var(--neutral-hover-border); color: var(--neutral-hover-text);
}
:is(.btn-secondary, .btn-outline-secondary):is(:active, .active, [aria-pressed="true"]) {
  background: var(--neutral-active-bg); border-color: var(--neutral-hover-border); color: var(--neutral-active-text);
}
.btn-danger { background: var(--danger-action); border-color: var(--danger-action); color: var(--on-accent); }
.btn-danger:hover, .btn-danger:focus-visible { background: var(--danger-action-hover); border-color: var(--danger-action-hover); color: var(--on-accent); }
.btn-danger:active, .btn-danger.active, .btn-danger[aria-pressed="true"] { background: var(--danger-action-pressed); border-color: var(--danger-action-pressed); color: var(--on-accent); }
.btn-outline-danger { background: transparent; border-color: var(--danger-outline-border); color: var(--danger-outline-text); }
.btn-outline-danger:hover, .btn-outline-danger:focus-visible { border-color: var(--danger-outline-hover-border); background: var(--danger-outline-hover-bg); color: var(--danger-outline-hover-text); }
.btn-outline-danger:active, .btn-outline-danger.active, .btn-outline-danger[aria-pressed="true"] { border-color: var(--danger-outline-active-border); background: var(--danger-outline-active-bg); color: var(--on-accent); }
/* «Assistente» of the content editor (city-assistant.js) and «Analisi AI» of the statistics (27/11, moved here from city.css). A warm shade from orange to coral (13/11, the
   choice of the editor, after violet, violet to magenta and blue to ultraviolet) tells it from the links and the actions of the page: the paragraph actions in the toolbar of
   the text, the actions on the whole content in the save bar, and the panel at the right of the page (a sheet at the
   bottom on the phone), aligned with the toolbar of the text and the links to the blocks. --assistant is the colour
   in the middle of the shade, for texts and edges. The paragraphs it works on stay marked. */
:root {
  --assistant: #d9480f; --assistant-deep: #a8380b; --assistant-soft: #fff3ea; --assistant-line: #f7c9b0; --on-assistant: #fff;
  --assistant-shade: linear-gradient(115deg, #e67700, #d9480f, #c2255c, #d9480f, #e67700);
  --assistant-shade-hover: linear-gradient(115deg, #cc6a00, #bf3e0b, #a61e4d, #bf3e0b, #cc6a00);
  --assistant-line-run: linear-gradient(90deg, transparent, #f08c00, #d6336c, transparent);
  --assistant-line-still: linear-gradient(90deg, #f08c00, #d6336c);
  --assistant-shade-soft: linear-gradient(115deg, #fff1e0 0%, #ffe8ea 100%);
}
html[data-theme="dark"] {
  --assistant: #ff9466; --assistant-deep: #ffc2a6; --assistant-soft: #2f1f18; --assistant-line: #5c3526; --on-assistant: #2b1006;
  --assistant-shade: linear-gradient(115deg, #ffc069, #ff9466, #ff7d9a, #ff9466, #ffc069);
  --assistant-shade-hover: linear-gradient(115deg, #ffcf8a, #ffab85, #ff97ad, #ffab85, #ffcf8a);
  --assistant-line-run: linear-gradient(90deg, transparent, #ffc069, #ff7d9a, transparent);
  --assistant-line-still: linear-gradient(90deg, #ffc069, #ff7d9a);
  --assistant-shade-soft: linear-gradient(115deg, #33250f 0%, #3a1d22 100%);
}
/* Alive (13/11): the shade runs slowly along the button, from its outer edge (background-origin), so that no end of
   it shows again under the transparent border. No halo around the buttons (the editor's choice). The button of the
   toolbar of the text is also a .city-rte-blocks: two classes win over «.city-rte-blocks > summary» of city.css, which
   comes later and would leave it transparent (29/11). */
.btn-assistant,
.city-rte-blocks.city-rte-assistant > summary {
  border-color: transparent; background: var(--assistant-shade) 0 50% / 300% 100% border-box; color: var(--on-assistant);
  animation: city-assistant-flow 8s ease-in-out infinite;
}
/* Bootstrap colours a pressed .btn from its own variables (.btn:first-child:active, stronger than the rules here): they
   say the colours of the assistant, so that a pressed, focused or disabled button keeps them (13/11). */
.btn-assistant {
  --bs-btn-color: var(--on-assistant); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--on-assistant); --bs-btn-hover-bg: transparent; --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--on-assistant); --bs-btn-active-bg: transparent; --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--on-assistant); --bs-btn-disabled-bg: transparent; --bs-btn-disabled-border-color: transparent;
}
.btn-outline-assistant {
  --bs-btn-color: var(--assistant-deep); --bs-btn-bg: var(--assistant-soft); --bs-btn-border-color: var(--assistant-line);
  --bs-btn-hover-color: var(--assistant-deep); --bs-btn-hover-bg: var(--assistant-soft); --bs-btn-hover-border-color: var(--assistant);
  --bs-btn-active-color: var(--assistant-deep); --bs-btn-active-bg: var(--assistant-soft); --bs-btn-active-border-color: var(--assistant);
  --bs-btn-disabled-color: var(--assistant-deep); --bs-btn-disabled-bg: var(--assistant-soft); --bs-btn-disabled-border-color: var(--assistant-line);
}
.btn-assistant:active, .btn-assistant:focus { background-image: var(--assistant-shade-hover); color: var(--on-assistant); }
.btn-assistant:is(:hover, :focus-visible, :active, [aria-pressed="true"]),
details[open] > summary.btn-assistant { border-color: transparent; background: var(--assistant-shade-hover) 0 50% / 300% 100% border-box; color: var(--on-assistant); }
/* A link with the button of the assistant («Apri e correggi», 26/11): the links of the dark theme (html[data-theme="dark"] a)
   would give it their light blue on the light shade; it keeps the dark text, as .btn-primary in site.css. */
html[data-theme="dark"] .btn-assistant:is(:link, :visited, :hover, :focus-visible, :active) { color: var(--on-assistant); }
@keyframes city-assistant-flow { 0%, 100% { background-position: 0 50%; } 50% { background-position: 100% 50%; } }
.btn-outline-assistant { background: var(--assistant-soft); border-color: var(--assistant-line); color: var(--assistant-deep); }
.btn-outline-assistant:is(:hover, :focus-visible, :active) { border-color: var(--assistant); background: var(--assistant-soft); color: var(--assistant-deep); }
@media (prefers-reduced-motion: reduce) { .btn-assistant { animation: none; } }
.btn:disabled, .btn.disabled, fieldset:disabled .btn { border-color: var(--action-disabled-bg); background: var(--action-disabled-bg); color: var(--action-disabled-ink); opacity: .72; }
.form-label { margin-bottom: .38rem; color: var(--label-ink); font-size: var(--text-sm); font-weight: 600; }
.form-control, .form-select {
  min-height: 2.6rem; border-color: var(--control-border); border-radius: .55rem; background-color: var(--control-bg); color: var(--ink); font-size: var(--text-base);
}
/* Bootstrap resets the focused field to its own body colours (white on dark): the tokens win here. */
.form-control:focus, .form-select:focus { border-color: var(--primary-light); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary) 18%, transparent); background-color: var(--control-bg); color: var(--ink); }
.form-check-input:checked { border-color: var(--primary); background-color: var(--primary); }
.form-text { color: var(--ink-soft); font-size: var(--text-xs); }
.text-muted { color: var(--ink-soft) !important; }
.alert { border-width: 1px; border-radius: var(--radius-sm); font-size: var(--text-base); }
.alert-success { border-color: var(--alert-success-border); background: var(--alert-success-bg); color: var(--alert-success-ink); }
.alert-danger { border-color: var(--urgent-border); background: var(--urgent-surface); color: var(--on-accent); }
.alert-warning { border-color: var(--alert-warning-border); background: var(--alert-warning-bg); color: var(--alert-warning-ink); }
/* Bootstrap's light cyan would stay light in the dark theme too (it reads data-bs-theme, not data-theme). */
.alert-info { border-color: var(--alert-info-border); background: var(--alert-info-bg); color: var(--alert-info-ink); }
/* A link in a notice takes the ink of the notice, underlined: the link blue does not read on every notice colour,
   the light blue of the dark theme least of all. Buttons keep their own colours. */
.alert a:not(.btn), .alert a:not(.btn):hover { color: inherit; text-decoration: underline; }
.alert a:not(.btn):hover { text-decoration-thickness: 2px; }
/* On the full pastels (23/11) the grey of the paragraphs (p takes --ink-soft) and the red of the outline danger buttons
   («Salva comunque», «Elimina la bozza») fall under 4.5:1: the paragraphs take the ink of the notice, those buttons a
   deeper red, which holds 4.5:1 on every pastel of both themes (24/11). */
.alert p { color: inherit; }
:is(.alert-success, .alert-danger, .alert-warning, .alert-info) { --danger-outline-border: #8c2e2e; --danger-outline-text: #8c2e2e; }
/* On the red of the urgent notes (24/11) a button must not melt into the box: the outline ones are white chips
   («Salva comunque» keeps its deep red), the full red one («Salva la mia versione») a deeper red with a white edge.
   On hover both turn deep red with white ink and edge. */
.alert-danger {
  --urgent-chip: #fff;
  --danger-action: #8c2e2e; --danger-action-hover: #7a2626; --danger-action-pressed: #6a2020;
  --danger-outline-hover-bg: #7a2626; --danger-outline-hover-border: #fff; --danger-outline-hover-text: #fff;
  --danger-outline-active-bg: #6a2020; --danger-outline-active-border: #fff;
}
.alert-danger .btn-outline-danger { background: var(--urgent-chip); }
.alert-danger .btn-outline-danger:is(:hover, :focus-visible) { background: var(--danger-outline-hover-bg); }
.alert-danger .btn-outline-danger:is(:active, .active, [aria-pressed="true"]) { background: var(--danger-outline-active-bg); }
.alert-danger .btn-danger, .alert-danger .btn-danger:is(:hover, :focus-visible, :active) { border-color: var(--urgent-chip); }
.table-responsive { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); box-shadow: var(--shadow-card); }
/* La card contiene già la cornice; il wrapper mantiene solo lo scorrimento. */
.app-body .card .table-responsive { border: 0; margin-left: 0; margin-right: 0; }
.app-body .card > .table-responsive { border-radius: inherit; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-border-color: var(--line); margin-bottom: 0; font-size: var(--text-sm); }
.table > :not(caption) > * > * { padding: .8rem 1rem; vertical-align: middle; }
/* Zebra rows: every other row in a single tbody, every other group when each row has its own tbody
   (monitoring tables, rows with a detail row). :where() keeps the hover rule and the detail rows on top;
   the permission matrix keeps its own row colours. */
.table:where(:not(.gpm-table)) > :where(tbody:only-of-type) > :where(tr:nth-child(even)) > * { background-color: var(--table-stripe); }
.table:where(:not(.gpm-table)) > :where(tbody:not(:only-of-type):nth-of-type(even)) > :where(tr:not(.mon-detail-row, .table-detail-row)) > * { background-color: var(--table-stripe); }
.table tbody tr:hover > * { background-color: color-mix(in srgb, var(--primary) 4%, var(--paper)); }
.table thead th { padding-top: .6rem; padding-bottom: .6rem; border-bottom-width: 1px; background: var(--surface); color: var(--ink-soft); font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
/* Empty states: inline text (paragraphs, table cells) and dashed box (text, optional icon and action). */
.empty-state { color: var(--ink-soft); }
td.empty-state { padding: 1.25rem 1rem; }
.empty-state-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  min-height: 5rem; padding: 1.25rem 1rem; border: 1px dashed var(--control-border); border-radius: var(--radius-md);
  color: var(--ink-soft); text-align: center;
}
.empty-state-box.is-inline { flex-direction: row; }
.empty-state-box svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-state-box .btn { margin-top: .25rem; }
/* The save bar of the editors (City and the Pubblicità campaign): across the whole page, from the menu to the window
   edge, its buttons in line with the content; it stays over the page until the end of its form. */
.city-editor-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin: 1rem calc(-1 * var(--content-pad-x, 0px)) 0;
  padding: .75rem var(--content-pad-x, 0px);
  border-top: 1px solid var(--line);
  background: var(--surface);
}
/* At the end of the page the bar is no longer over anything (site.js). */
.city-editor-bar.is-docked { border-top-color: transparent; }
/* The same bar for a form inside a card: it becomes the foot of the card, edge to edge, with the card's corners.
   --bar-pad is the card's padding (p-4, or card-body). */
.card.p-4 { --bar-pad: 1.5rem; }
.card-body { --bar-pad: 1.35rem; }
.city-editor-bar.is-card {
  margin: 1.5rem calc(-1 * var(--bar-pad, 1.5rem)) calc(-1 * var(--bar-pad, 1.5rem));
  padding: .75rem var(--bar-pad, 1.5rem);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--paper);
}
.city-editor-bar.is-card.is-docked { border-top-color: var(--line); }
.empty-state-title { margin: 0; color: var(--ink); font-size: var(--text-lg); font-weight: 700; }
/* Pager shared by every paginated list (_Pager.cshtml). */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; margin-top: 1rem; }
.pager-summary { color: var(--ink-soft); font-size: var(--text-sm); }
.pager-link { min-width: 6.5rem; }
.pager-pages { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.pager-pages-narrow { display: none; }
.pager-page { min-width: 2.1rem; justify-content: center; font-variant-numeric: tabular-nums; }
.pager-page.is-current { border-color: var(--action-bg); background: var(--action-bg); color: var(--on-accent); cursor: default; }
.pager-gap { min-width: 1.2rem; color: var(--ink-soft); text-align: center; }
.pager-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-left: auto; }
/* Rows per page, before the page numbers. */
.pager-size { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink-soft); font-size: var(--text-sm); white-space: nowrap; }
.app-body .pager-size .form-select { width: auto; min-width: 4.5rem; height: 2rem; min-height: 2rem; padding-top: 0; padding-bottom: 0; font-size: var(--text-sm); }
@media (max-width: 575.98px) {
  .pager-pages-wide { display: none; }
  .pager-pages-narrow { display: flex; }
  .pager-link { min-width: 2.1rem; }
  .pager-link-text { display: none; }
}
/* Raw event text in the activity details (PlatformAdmin only). */
.activity-event-text { white-space: pre-wrap; max-width: 36rem; }
/* In-row detail panels (activity events, error diagnostics): a toggle in the row opens a full-width
   row under it, so the columns never change width. */
.table-detail-toggle {
  display: flex; align-items: center; gap: .3rem; margin-top: .3rem; padding: 0; border: 0; background: transparent;
  color: var(--primary-deep); font-size: var(--text-xs); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.table-detail-toggle::after {
  content: ""; width: .4rem; height: .4rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px); transition: transform .16s ease;
}
.table-detail-toggle[aria-expanded="true"]::after { transform: rotate(225deg) translate(-1px, -1px); }
.table-detail-toggle:hover { color: var(--link-hover); }
.table > tbody > tr.table-detail-row > td { padding: .85rem 1rem 1rem; background: var(--primary-soft); white-space: normal; }
html[data-theme="dark"] .table > tbody > tr.table-detail-row > td { background: rgba(255, 255, 255, .04); }
.table-detail-panel { max-width: 72rem; font-size: var(--text-sm); }
.table-detail-panel dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .25rem 1rem; margin: 0 0 .65rem; }
.table-detail-panel dt { color: var(--ink-soft); font-weight: 600; }
.table-detail-panel dd { margin: 0; }
.table-detail-panel > :last-child { margin-bottom: 0; }
/* Registro errori: the type of the error goes to a new line only after a dot (<wbr> in the page), the reference
   is smaller and may break anywhere, so the columns fit from 768 px without scrolling sideways. */
.admin-errors-table .admin-error-type { overflow-wrap: normal; word-break: normal; }
.admin-errors-table .admin-error-reference code { font-size: var(--text-xs); overflow-wrap: anywhere; word-break: break-all; }
/* The date on one line where there is room; between 992 and 1200 px it goes to a new line before the time. */
@media (min-width: 1200px) { .admin-errors-table .admin-error-date { white-space: nowrap; } }
/* Between 768 and 992 px, beside the menu, five columns do not fit: the cards of the phones (see .table-cards). */
@media (min-width: 768px) and (max-width: 991.98px) {
  .admin-errors-table, .admin-errors-table > tbody, .admin-errors-table > thead { display: block; width: 100%; }
  .admin-errors-table > thead > tr { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; padding: .5rem .75rem; background: var(--surface); }
  .admin-errors-table > thead > tr > th { display: block; flex: 0 0 auto; padding: 0; border: 0; background: transparent; white-space: nowrap; }
  .admin-errors-table > tbody > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .75rem; padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
  .admin-errors-table > tbody > tr[hidden] { display: none; }
  .admin-errors-table > tbody > tr > td { display: block; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; white-space: normal !important; }
  .admin-errors-table > tbody > tr > td.table-card-wide, .admin-errors-table > tbody > tr > td[colspan] { grid-column: 1 / -1; }
  .admin-errors-table > tbody > tr > td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: .1rem; color: var(--ink-soft);
    font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  }
  .admin-errors-table > tbody > tr:hover { background-color: color-mix(in srgb, var(--primary) 4%, var(--paper)); }
  .admin-errors-table > tbody > tr:hover > td { background-color: transparent; }
}
/* Tables that become cards on phones (Utenti, Attività, Editori, Processi periodici, Registro errori, the lists of the
   interventions and of the editors): one card per row, two values side by side under their labels (data-label), the
   wide ones (.table-card-wide) across the card. The headers stay above the cards as on a desktop, the sortable ones
   with their link and arrow; when they do not fit they go to a new line (9/11: the line that scrolled sideways hid the
   last columns). */
@media (max-width: 767.98px) {
  .table-cards, .table-cards > tbody { display: block; width: 100%; }
  .table-cards > thead { display: block; }
  .table-cards > thead > tr { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; padding: .5rem .75rem; background: var(--surface); }
  .table-cards > thead > tr > th { display: block; flex: 0 0 auto; padding: 0; border: 0; background: transparent; white-space: nowrap; }
  /* A header with nothing to read (the column of the actions) takes no room. */
  .table-cards > thead > tr > th:empty,
  .table-cards > thead > tr > th:has(> .visually-hidden:only-child) { display: none; }
  .table-cards > tbody > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .75rem; padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
  .table-cards > tbody > tr[hidden] { display: none; }
  .table-cards > tbody > tr > td { display: block; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
  .table-cards > tbody > tr > td.table-card-wide,
  .table-cards > tbody > tr > td[colspan] { grid-column: 1 / -1; }
  .table-cards > tbody > tr > td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: .1rem; color: var(--ink-soft);
    font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  }
  .table-cards > tbody > tr > td.text-nowrap { white-space: normal !important; }
  /* The first value without a label names the card. */
  .table-cards > tbody > tr > td:first-child:not([data-label]):not([colspan]) { font-weight: 600; }
  /* Hover on the whole card: on the cells alone, its padding and the gaps of the grid drew a dark frame inside it. */
  .table-cards > tbody > tr:hover { background-color: color-mix(in srgb, var(--primary) 4%, var(--paper)); }
  .table-cards > tbody > tr:hover > td { background-color: transparent; }
}
.home-console-person-text { display: grid; min-width: 0; }
.home-console-operators-brief { display: none; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 400; }
@media (max-width: 767.98px) {
  /* «Interventi per tipo»: one line per person, the total on the right, the kinds done in a few words under the name. */
  .home-console-operators > tbody > tr { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .home-console-operators > tbody > tr > td.table-card-wide { grid-column: auto; }
  .home-console-operators > tbody > tr > td:not(.table-card-wide):not(.home-console-total-cell) { display: none; }
  .home-console-operators > tbody > tr > td.home-console-total-cell::before { content: none; }
  .home-console-operators > tbody > tr > td.home-console-total-cell strong { font-size: var(--text-lg); }
  .home-console-operators-brief { display: block; }
}
/* Sortable table headers: one link or button, arrow from th[aria-sort]. */
.sort-link { display: inline-flex; align-items: center; gap: .3rem; color: inherit; text-decoration: none; font-weight: inherit; cursor: pointer; }
button.sort-link { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; font-weight: inherit; }
.sort-link:hover { color: var(--primary-deep); text-decoration: underline; text-underline-offset: 3px; }
.sort-link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: .2rem; }
th[aria-sort="ascending"] .sort-link, th[aria-sort="descending"] .sort-link { color: var(--primary-deep); }
/* The arrow is drawn (a mask in the colour of the text), not a character: on iPhone «↕» turned into a grey emoji.
   At rest a light double arrow, on the sorted column one arrow in the colour of the link. */
.sort-indicator {
  --sort-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12V2M1.5 4.5 4 2l2.5 2.5M8 2v10M5.5 9.5 8 12l2.5-2.5'/%3E%3C/svg%3E");
  display: inline-block; flex: none; width: .75rem; height: .875rem; background-color: currentColor; opacity: .45;
  -webkit-mask: var(--sort-icon) center / contain no-repeat; mask: var(--sort-icon) center / contain no-repeat;
}
th[aria-sort="ascending"] .sort-indicator, .sort-link[data-sorted="asc"] .sort-indicator { --sort-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12V2M3 5l3-3 3 3'/%3E%3C/svg%3E"); opacity: 1; }
th[aria-sort="descending"] .sort-indicator, .sort-link[data-sorted="desc"] .sort-indicator { --sort-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2v10M3 9l3 3 3-3'/%3E%3C/svg%3E"); opacity: 1; }
/* Several sorts in one header (the City lists): only the link marked data-sorted shows the arrow of the order. */
th .city-dense-sorts .sort-link:not([data-sorted="asc"]):not([data-sorted="desc"]) .sort-indicator { --sort-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12V2M1.5 4.5 4 2l2.5 2.5M8 2v10M5.5 9.5 8 12l2.5-2.5'/%3E%3C/svg%3E"); opacity: .45; }
.activity-sequence-context { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: .2rem 1.5rem; }
.activity-sequence-context > span:first-child { grid-column: 1 / -1; }
.activity-sequence-context strong { font-size: var(--text-lg); }
.table tbody tr:last-child > * { border-bottom: 0; }
/* Monitoring section tabs (.mon-tabs) share every nav-tabs rule; the range selector (.mon-ranges) is a segmented control. */
/* Sideways scrolling only: the line under the tabs is an inset shadow, so the tabs need no negative margin and nothing
   overflows vertically (a 1px overflow showed a vertical scrollbar on hover). */
.mon-tabs { display: flex; gap: .25rem; overflow-x: auto; overflow-y: hidden; margin: 0 0 1rem; box-shadow: inset 0 -1px 0 var(--line); }
.mon-tabs .mon-tab { display: block; padding: .5rem 1rem; text-decoration: none; white-space: nowrap; }
/* Title of «Andamento dei parametri» on the left, the range selector on the right (wraps on phones). */
.mon-history-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: 0 0 1rem; }
.mon-history-head .mon-ranges { margin: 0; }
.mon-ranges { display: inline-flex; margin: 0 0 1rem; border: 1px solid var(--line); border-radius: .45rem; overflow: hidden; }
.mon-ranges .mon-tab { padding: .35rem .85rem; color: var(--ink-soft); font-size: var(--text-sm); font-weight: var(--button-font-weight); text-decoration: none; white-space: nowrap; }
.mon-ranges .mon-tab + .mon-tab { border-left: 1px solid var(--line); }
.mon-ranges .mon-tab:hover { background: var(--surface-hover); color: var(--primary-deep); }
.mon-ranges .mon-tab.active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
/* Schede a binario segmentato: le schede stanno in un binario chiaro e quella attiva è una pillola bianca. Il padding
   laterale porta l'icona (o il testo) a 16 px dal bordo del binario, allineata ai titoli h2 delle sezioni. */
.nav-tabs { display: inline-flex; flex-wrap: wrap; gap: .15rem; max-width: 100%; padding: .2rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-hover); }
.nav-tabs > .nav-item { min-width: 0; margin: 0; }
.nav-tabs .nav-link, .mon-tabs .mon-tab { display: flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.1rem; margin: 0; padding: .35rem calc(1rem - .2rem - 2px); border: 1px solid transparent; border-radius: calc(var(--radius-sm) - .15rem); background: transparent; color: var(--ink-soft); font-size: var(--text-base); font-weight: var(--button-font-weight); line-height: 1.2; }
.nav-tabs .nav-link svg { flex: none; width: 1rem; height: 1rem; opacity: .8; }
.nav-tabs .nav-link:hover, .mon-tabs .mon-tab:hover { border-color: transparent; background: transparent; color: var(--primary-deep); }
.nav-tabs .nav-link.active, .mon-tabs .mon-tab.active { border-color: var(--line); background: var(--paper); color: var(--primary-deep); box-shadow: 0 1px 2px rgb(25 75 117 / 8%); }
.nav-tabs .nav-link.active svg { color: var(--primary); opacity: 1; }
.portal-identity { min-width: 0; display: inline-flex; align-items: center; gap: .75rem; text-align: left; }
.portal-identity > span:last-child { min-width: 0; }
.portal-identity strong, .portal-identity small { overflow-wrap: anywhere; }
.portal-assignment-list { overflow: hidden; border: 1px solid var(--line); border-radius: .55rem; }
.portal-assignment-card { padding: 1rem 1.2rem; }
.portal-assignment-row {
  min-height: 4.35rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line);
}
.portal-assignment-row:last-child { border-bottom: 0; }
.portal-permission-card { overflow: hidden; }
.portal-permission-summary {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; cursor: pointer; list-style: none;
}
/* The arrow of whatever opens: one thin chevron, at the end of the line in the panels. An action in a button has none. */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
:where(details > summary:not(.btn))::after {
  content: ""; display: inline-block; flex: none; width: .45rem; height: .45rem; margin-left: .55rem;
  border-right: 1.5px solid var(--ink-soft); border-bottom: 1.5px solid var(--ink-soft);
  vertical-align: .15em; transform: rotate(45deg); transition: transform .16s ease;
}
:where(details[open] > summary:not(.btn))::after { vertical-align: -.05em; transform: rotate(225deg); }
.portal-edit-advanced > summary, details.card > summary { display: flex; align-items: center; gap: .4rem; }
.portal-edit-advanced > summary::after, details.card > summary::after { margin-left: auto; }
.portal-summary-meta { margin-right: .4rem; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.portal-permission-summary::after { grid-column: 3; }
.portal-permission-body { padding: 1rem 1.2rem 1.2rem; border-top: 1px solid var(--line); }
.permission-list { border: 1px solid var(--line); border-radius: .5rem; }
.permission-row {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(12rem,18rem); align-items: center; gap: 1rem;
  padding: .8rem 1rem; border-bottom: 1px solid var(--line);
}
.permission-row:last-child { border-bottom: 0; }
.portal-remove-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.responsibility-row {
  min-height: 4rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .75rem 0; border-top: 1px solid var(--line);
}
.summary-section { margin-top: 1.5rem; }
.summary-portal { border-top: 1px solid var(--line); }
.summary-portal:last-child { border-bottom: 1px solid var(--line); }
.summary-portal > summary {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 1rem;
  padding: .85rem 0; cursor: pointer; list-style: none;
}
.summary-permissions { padding: .25rem 0 .9rem 2.75rem; }
.summary-permissions > div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-top: 1px solid var(--line); font-size: var(--text-sm); }
.badge { padding: .35em .55em; border-radius: .28rem; font-size: var(--text-xs); font-weight: 800; letter-spacing: .02em; }
.pagination { --bs-pagination-color: var(--primary-deep); --bs-pagination-border-color: var(--line); --bs-pagination-hover-color: var(--primary-deep); --bs-pagination-hover-bg: var(--primary-soft); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(52, 143, 226, .16); --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); }
.validation-summary-errors, .field-validation-error { color: var(--danger); font-size: var(--text-sm); font-weight: 700; }
.validation-summary-errors {
  padding: .75rem .9rem;
  margin: .9rem 0;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: .5rem;
  background: color-mix(in srgb, var(--danger) 8%, var(--paper));
}
.validation-summary-errors ul { list-style: none; margin: 0; padding: 0; }
.validation-summary-errors li + li { margin-top: .35rem; }
.form-validation-hint { display: block; margin: .3rem 0 .65rem; color: var(--danger); font-size: var(--text-sm); font-weight: 700; }
.auth-card .form-control.mb-3 + .form-validation-hint { margin-top: -.7rem; }
.auth-card .form-control.mb-4 + .form-validation-hint { margin-top: -.95rem; }
.notes-form .form-validation-hint { margin: .25rem 0 0; }
.input-validation-error { border-color: var(--danger); }

@media (max-width: 767.98px) {
  .profile-editor { grid-template-columns: 1fr; }
  .app-sidebar { width: min(17.5rem, calc(100vw - 3.25rem)); transform: translateX(-101%); box-shadow: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open .app-sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 1040; inset: 0; background: rgba(12,27,35,.45); }
  body.nav-open .sidebar-backdrop { display: block; }
  .app-main { margin-left: 0; transition: none; }
  .topbar { height: 4rem; padding: 0 1rem; backdrop-filter: none; }
  .menu-toggle { display: grid; place-items: center; }
  .topbar-context { display: none; }
  .portal-switcher-button { max-width: 45vw; }
  .account-name { display: none; }
  .content-area { --content-pad-x: 1rem; min-height: calc(100dvh - 4rem); padding: 1.2rem var(--content-pad-x); }
  .auth-header { height: 4rem; padding: 0 1rem; }
  .auth-context { display: none; }
  .auth-main { padding-top: 2.25rem; }
  .auth-card { border-radius: .6rem; }
  .table-responsive { margin-left: -1px; margin-right: -1px; border-radius: .45rem; }
  .table > :not(caption) > * > * { padding: .68rem .75rem; }
  .portal-permission-summary { grid-template-columns: minmax(0,1fr) auto; }
  .portal-summary-meta { display: none; }
  .portal-permission-summary::after { grid-column: 2; }
  .permission-row { grid-template-columns: 1fr; gap: .55rem; }
  .portal-assignment-row { align-items: flex-start; }
  .portal-assignment-card { padding: .8rem; }
  .summary-permissions { padding-left: 0; }
  .notes-form-footer { flex-direction: column; align-items: stretch !important; gap: .5rem !important; }
  .notes-form-footer > .d-flex { justify-content: flex-end; padding-top: 0 !important; }
  [data-home-admin-metrics] .card { padding: .55rem !important; }
  [data-home-admin-metrics] .text-secondary { font-size: var(--text-xs); line-height: 1.25; }
  [data-home-admin-metrics] strong { font-size: var(--text-2xl) !important; }
}

/* Push Notifications */
.push-control-wrapper { position: relative; }
.push-indicator { transition: border-color .16s ease, background-color .16s ease, color .16s ease; }
.push-indicator svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.push-indicator.border-success { border-color: var(--success-edge) !important; color: var(--success) !important; }
.push-indicator.border-danger { border-color: var(--danger) !important; color: var(--danger) !important; }
.push-indicator.border-warning { border-color: var(--warning) !important; color: var(--warning) !important; }
.push-help {
    position: absolute;
    z-index: 1080;
    top: calc(100% + .55rem);
    right: 0;
    width: min(20rem, calc(100vw - 2rem));
    padding: .7rem .8rem;
    border: 1px solid var(--line);
    border-radius: .5rem;
    background: var(--paper);
    box-shadow: var(--shadow);
    color: var(--ink);
    font-size: var(--text-xs);
    font-weight: 650;
    line-height: 1.4;
}

/* Shared notes widget */
.notes-widget { max-width: 100%; }
.notes-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .65rem;
}
.notes-widget-heading { display: flex; align-items: center; gap: .55rem; }
.count-pill {
    display: inline-grid;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 .42rem;
    place-items: center;
    border: 1px solid var(--pill-border);
    border-radius: 999px;
    background: var(--pill-bg);
    color: var(--pill-ink);
    box-shadow: none;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 800;
    line-height: 1;
}
.notification-center { display: grid; gap: 2rem; }
.notification-area-activity { padding-top: 1.5rem; border-top: 1px solid var(--line); }
.notification-area-activity:first-child { padding-top: 0; border-top: 0; }
.notification-activity { display: grid; gap: .1rem; margin: 0; padding: 0; list-style: none; }
.notification-activity li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .15rem 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.notification-activity li:last-child { border-bottom: 0; }
.notification-activity small { color: var(--ink-soft); white-space: nowrap; }
.notification-list { display: grid; gap: .1rem; margin: 0; padding: 0; list-style: none; }
.notification-item { display: flex; gap: .65rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.notification-item:last-child { border-bottom: 0; }
.notification-dot { flex: none; width: .5rem; height: .5rem; margin-top: .45rem; border-radius: 50%; background: var(--line); }
.notification-item.is-new .notification-dot { background: var(--primary); }
.notification-item.is-important .notification-dot { background: var(--danger); }
.notification-item.is-new .notification-text > :is(a, span) { font-weight: 600; }
.notification-text { display: grid; gap: .1rem; min-width: 0; }
.notification-body { margin: 0; color: var(--ink-soft); font-size: var(--text-sm); }
.notification-text small { color: var(--ink-soft); }
.notification-choices .form-check + .form-check { margin-top: .35rem; }
.notification-read-all { flex: none; }
.notification-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: flex-end; }
.settings-toggle { display: inline-flex; align-items: center; gap: .35rem; }
.settings-toggle svg { width: 1rem; height: 1rem; }
.settings-toggle[aria-expanded="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-deep); }
.settings-panel { margin: 0 0 1.25rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); }
/* A view of fewer portals than the account sees: the button that chooses them says so, in the colour of the warnings. */
.settings-toggle.is-partial { border-color: var(--warning); color: var(--ink); }
.partial-chip { display: inline-flex; align-items: center; gap: .3rem; margin-left: .15rem; padding: .05rem .45rem; border-radius: 999px; background: color-mix(in srgb, var(--warning) 16%, var(--paper)); color: var(--ink); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.partial-chip::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: var(--warning); }
.notification-settings { display: grid; gap: 1.1rem; }
.notification-settings-form { display: grid; gap: 1.1rem; justify-items: start; }
.notification-settings-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.notification-settings-title { margin: 0 0 .45rem; padding: 0; font-size: var(--text-base); font-weight: 700; color: var(--ink); }
.notification-settings-state { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; }
.notification-settings-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.notification-settings-actions:not(:has(button:not([hidden]))) { display: none; }
.notification-read-all button { white-space: nowrap; }
/* On a phone the button goes under the words of the heading instead of squeezing them. */
@media (max-width: 575.98px) {
  .notification-area-heading:has(.notification-tools) { flex-wrap: wrap; }
  .notification-tools { flex-basis: 100%; justify-content: flex-start; }
}
.notification-area-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}
/* Centro notifiche (8/11): blocchi con un'intestazione, tabelle dense dentro, piede con pagine o collegamento. */
.nc-page { display: grid; gap: 1.25rem; }
.nc-block { padding: 0; overflow: hidden; }
.nc-block[hidden] { display: none; }
.nc-block-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .6rem 1rem; padding: .9rem 1.1rem .75rem; border-bottom: 1px solid var(--line); }
.nc-block-head h2 { margin: 0; font-size: var(--text-xl); font-weight: 700; }
.nc-block-head p { margin: .15rem 0 0; color: var(--ink-soft); font-size: var(--text-sm); }
.nc-block-tools { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.nc-block-body { padding: 1rem 1.1rem; }
.nc-block-body > .notes-widget { margin-bottom: 0 !important; }
.nc-block-foot { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .55rem 1.1rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: var(--text-sm); }
.nc-block-foot > nav, .nc-block-foot > .pager { flex: 1 1 100%; margin: 0; }
.nc-count { display: inline-flex; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; margin-left: .45rem; align-items: center; justify-content: center; border-radius: 999px; background: var(--primary); color: var(--on-accent); font-size: var(--text-xs); font-weight: 700; vertical-align: .15rem; }
.nc-table { margin: 0; font-size: var(--text-sm); }
.nc-table > thead > tr > th { padding: .45rem .75rem; background: var(--surface); color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line); }
.nc-table > tbody > tr > td { padding: .5rem .75rem; border-bottom: 1px solid var(--row-line); vertical-align: top; background: transparent; }
.nc-table > tbody > tr:last-child > td { border-bottom: 0; }
/* A table under the heading of a block (9/11): never against the edge of the card. It goes in like the heading,
   with its own thin frame; the heading loses its line and the foot follows the table. Every block with a title
   and a table has to look like this. */
.app-body :is(.nc-block, .nc-block > .nc-settings-form) > .table-responsive { width: auto; margin: 0 1.1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: none; }
.nc-block-head:has(+ .table-responsive) { border-bottom: 0; padding-bottom: .65rem; }
.nc-block > .table-responsive + .nc-block-foot { border-top: 0; padding-top: 0; padding-bottom: .9rem; margin-top: -.35rem; }
.nc-date { white-space: nowrap; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.nc-title { display: flex; gap: .55rem; align-items: baseline; min-width: 0; }
.nc-title a, .nc-title .t { color: var(--ink); text-decoration: none; }
.nc-title a:hover { text-decoration: underline; }
.nc-dot { flex: none; width: .5rem; height: .5rem; border-radius: 50%; background: var(--line); transform: translateY(-.05rem); }
tr.is-new .nc-dot { background: var(--primary); }
tr.is-important .nc-dot { background: var(--danger); }
tr.is-new .nc-title a, tr.is-new .nc-title .t { font-weight: 600; }
.nc-body { margin: .1rem 0 0 1.05rem; color: var(--ink-soft); font-size: var(--text-xs); }
.nc-muted { color: var(--ink-soft); }
.nc-pill { --tone: var(--ink-soft); display: inline-flex; align-items: center; height: 20px; padding: 0 .5rem; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--tone) 28%, var(--paper)); color: var(--tone); background: color-mix(in srgb, var(--tone) 11%, var(--paper)); }
.nc-pill[data-tone="pub"] { --tone: var(--success); }
.nc-pill[data-tone="mod"] { --tone: var(--primary); }
.nc-pill[data-tone="off"], .nc-pill[data-tone="chk"] { --tone: var(--warning); }
.nc-pill[data-tone="del"], .nc-pill[data-tone="imp"] { --tone: var(--danger); }
.nc-filter { display: inline-flex; border: 1px solid var(--control-border); border-radius: .45rem; overflow: hidden; }
.nc-filter a { display: inline-flex; align-items: center; min-height: 2rem; padding: .3rem .65rem; background: var(--paper); color: var(--ink); font-size: var(--text-xs); text-decoration: none; }
.nc-filter a + a { border-left: 1px solid var(--control-border); }
.nc-filter a:hover { background: var(--surface-hover); }
.nc-filter a[aria-current="page"] { background: color-mix(in srgb, var(--primary) 12%, var(--paper)); color: var(--primary); font-weight: 600; }
/* Canali delle notifiche: questo browser, email, Telegram. */
/* Impostazioni › Telegram: «Rimuovi il token» a sinistra nella barra, «Salva token» a destra. */
.telegram-settings-bar > .btn-outline-danger { margin-right: auto; }
.nc-settings-form { display: grid; }
.nc-channel { display: flex; gap: .65rem; align-items: flex-start; }
.nc-channel-icon { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .5rem; background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line); }
.nc-channel-icon svg { width: 1.05rem; height: 1.05rem; }
.nc-channel-icon.is-telegram { background: var(--telegram); border-color: var(--telegram); color: var(--on-accent); }
.nc-channel strong { display: block; font-size: var(--text-sm); }
.nc-channel small { color: var(--ink-soft); }
.nc-state { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; }
.nc-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.nc-help { margin: .35rem 0 0; color: var(--ink-soft); font-size: var(--text-xs); max-width: 34rem; }
.nc-code { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-xs); padding: .05rem .3rem; border-radius: .25rem; background: var(--surface); border: 1px solid var(--line); }
.nc-select { min-width: 10.5rem; font-size: var(--text-sm); min-height: 2rem; padding-top: .25rem; padding-bottom: .25rem; }
.nc-prefs { display: grid; gap: .35rem; margin: 0; padding: .85rem 1.1rem; border: 0; border-top: 1px solid var(--line); background: var(--surface); min-width: 0; }
.nc-prefs > legend { float: left; width: 100%; margin: 0; }
.nc-table > tbody > tr:has(+ .nc-detail-row) > td { border-bottom: 0; }
.nc-link-cell { padding-top: 0 !important; }
/* No box around the QR (8/11): the code and the steps sit in the row of Telegram. */
.nc-link { display: flex; gap: 1.1rem; align-items: center; margin-left: 2.65rem; padding: .25rem 0 .5rem; }
.nc-qr { flex: none; width: 132px; height: 132px; padding: 6px; border-radius: .45rem; background: var(--qr-paper); border: 1px solid var(--line); image-rendering: pixelated; }
.nc-link-text { display: grid; gap: .35rem; font-size: var(--text-sm); min-width: 0; }
.nc-link-text ol { margin: 0; padding-left: 1.1rem; display: grid; gap: .15rem; }
.nc-phone-only { display: none; }
/* On a phone (or a touch screen) the QR would be read by the same device: the words alone, with «Apri Telegram». */
@media (max-width: 767.98px), (pointer: coarse) {
  .nc-qr, .nc-qr-only { display: none; }
  .nc-phone-only { display: revert; }
  .nc-link { margin-left: 0; }
}
/* Phones: dense rows, the title on top, then label, portal and date on one line, without the names of the fields. */
@media (max-width: 767.98px) {
  .nc-table > thead > tr > th:first-child, .nc-table > tbody > tr > td:first-child { padding-left: 0; }
  .nc-table.table-cards > thead > tr { padding: .45rem .75rem; }
  .nc-table.table-cards > tbody > tr { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; padding: .6rem .75rem; border-bottom: 1px solid var(--row-line); }
  .nc-table.table-cards > tbody > tr:last-child { border-bottom: 0; }
  .nc-table.table-cards > tbody > tr > td { border: 0 !important; padding: 0 !important; }
  .nc-table.table-cards > tbody > tr > td::before { display: none !important; }
  .nc-table.table-cards > tbody > tr > td.table-card-wide, .nc-table.table-cards > tbody > tr > td[colspan] { flex: 1 0 100%; }
  .nc-table.table-cards > tbody > tr > td:empty { display: none; }
  .nc-table.table-cards > tbody > tr > td.nc-date { margin-left: auto; font-size: var(--text-xs); }
  .nc-table.table-cards > tbody > tr > td:has(.nc-select) { flex: 1 0 100%; }
  .nc-actions { justify-content: flex-start; }
  .nc-select { width: 100%; }
  .nc-block-head, .nc-block-foot, .nc-prefs, .nc-block-body { padding-left: 1rem; padding-right: 1rem; }
  .app-body :is(.nc-block, .nc-block > .nc-settings-form) > .table-responsive { margin: 0 1rem 1rem; }
}
.notes-add-button { display: inline-flex; align-items: center; gap: .35rem; }
.notes-add-label-mobile { display: none; }
.notes-composer {
    margin-bottom: 1.5rem;
    border: 1px solid var(--line);
    border-radius: .65rem;
    background: var(--paper);
    box-shadow: 0 4px 14px rgba(36, 42, 48, .045);
    overflow: hidden;
}
.notes-composer:not([hidden]) {
    animation: notes-composer-in .18s ease-out;
}
@keyframes notes-composer-in {
    from { opacity: 0; transform: translateY(-.25rem); }
    to { opacity: 1; transform: translateY(0); }
}
.notes-form-inner {
    padding: 1rem;
}
.notes-composer-title { margin-bottom: .85rem; color: var(--ink); font-size: var(--text-sm); font-weight: 800; }
.notes-composer-title-mobile { display: none; }
.notes-options {
    display: grid;
    grid-template-columns: minmax(0, 14rem) minmax(12rem, 1fr);
    align-items: end;
    gap: 1rem;
    flex: 1 1 30rem;
    min-width: 0;
}
.notes-urgent-switch {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 2rem;
    padding-left: 0;
}
.notes-urgent-switch .form-check-input { float: none; flex: none; }
@media (max-width: 767.98px) {
    .notes-options { grid-template-columns: minmax(0, 1fr); flex: none; width: 100%; gap: .65rem; }
    .notes-composer-title-desktop { display: none; }
    .notes-composer-title-mobile { display: inline; }
    .notes-form-inner { padding: .85rem; }
}
.notes-textarea {
    resize: vertical;
    min-height: 4.75rem;
    font-size: var(--text-base);
    line-height: 1.5;
}
.notes-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    align-items: stretch;
}
.note-item {
    --note-surface: var(--paper);
    position: relative;
    height: auto;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--note-surface);
    box-shadow: 0 2px 8px rgba(36, 42, 48, .025);
}
/* A note alone takes the whole width: half of the screen would stay empty. */
.note-item:only-child { grid-column: 1 / -1; }
.note-item > .d-flex { height: 100%; min-height: 0; }
.note-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.note-item:has(.note-delete-form) .note-content > .d-flex {
    padding-right: 2rem;
}
.note-item.is-expanded > .d-flex,
.note-item.is-expanded .note-content { height: auto; }
.note-item .profile-avatar-md {
    width: 2rem !important;
    height: 2rem !important;
    min-width: 2rem;
    min-height: 2rem;
    max-width: 2rem;
    max-height: 2rem;
    flex: 0 0 2rem;
    overflow: hidden;
    font-size: var(--monogram-sm);
    line-height: 1;
}
.note-item .profile-avatar-md > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover;
}
.note-urgent {
    --note-surface: #b54343;
    border-color: transparent;
    background: var(--note-surface);
    color: var(--on-accent);
}
.note-urgent .note-author,
.note-urgent .note-body {
    color: var(--on-accent);
}
.note-tag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    max-width: 100%;
    padding: .15rem .5rem;
    border: 1px solid transparent;
    border-radius: .35rem;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.note-portal-badge {
    border-color: color-mix(in srgb, var(--primary-deep) 40%, transparent);
    background: var(--primary-soft);
    color: var(--primary-deep);
    max-width: min(100%, 9rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.note-urgent-icon { display: inline-flex; align-items: center; color: var(--danger); }
.note-urgent .note-urgent-icon { color: var(--on-accent); }
.note-urgent .note-tag {
    border-color: rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .2);
    color: var(--on-accent);
}
.note-urgent .note-delete-btn {
    color: rgba(255, 255, 255, .82);
}
.note-urgent .note-delete-btn:hover {
    background: rgba(255, 255, 255, .16);
    color: var(--on-accent);
}
.note-body {
    position: relative;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--ink);
}
.note-body.is-truncated::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.25em;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--note-surface) 0%, transparent) 0%,
        color-mix(in srgb, var(--note-surface) 72%, transparent) 56%,
        var(--note-surface) 100%
    );
}
.note-item.is-expanded .note-body {
    display: block;
    overflow: visible;
}
.note-item.is-expanded .note-body::after { display: none; }
.note-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: none;
    min-height: 0;
    margin-top: auto;
    padding-top: 0;
}
.note-actions:has(> .note-expand-btn:not([hidden])) { padding-top: .45rem; }
.note-expand-btn {
    padding: .15rem 0;
    border: 0;
    background: transparent;
    color: var(--primary-deep);
    font-size: var(--text-xs);
    font-weight: var(--button-font-weight);
}
.note-expand-btn:hover { text-decoration: underline; }
.note-urgent .note-expand-btn { color: var(--on-accent); }
.note-delete-form {
    position: absolute;
    top: .7rem;
    right: .7rem;
    margin-left: 0 !important;
}
.note-delete-btn {
    display: grid;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: .38rem;
    background: transparent;
    color: var(--ink-soft);
    opacity: 0;
    transition: opacity .16s ease, background-color .16s ease, color .16s ease;
}
.note-item:hover .note-delete-btn,
.note-item:focus-within .note-delete-btn,
.note-delete-btn:focus-visible {
    opacity: 1;
}
@media (hover: none) {
    .note-delete-btn { opacity: 1; }
}
.note-delete-btn:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
}
.notes-expiry-input {
    width: 14rem;
}
@media (prefers-reduced-motion: reduce) {
    .notes-composer:not([hidden]) { animation: none; }
    .note-item { transition: none; }
}

@media (max-width: 767.98px) {
    .notes-list { grid-template-columns: minmax(0, 1fr); }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6e9ec;
  --ink-soft: #a7b1ba;
  --ink-faint: #9aa6af;            /* controlli disattivati: come prima della tokenizzazione */
  --surface: #15191e;
  --paper: #1e242b;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-raised: 0 12px 28px rgba(0, 0, 0, .45);
  --surface-hover: #303941;
  --topbar-bg: rgba(36, 42, 48, .96);
  --line: #2f3741;
  --row-line: #3b444e;
  --label-ink: #d4d9dd;
  --control-border: #46515b;
  --control-bg: #1e2328;
  --control-disabled-bg: #303840;
  --tooltip-bg: #f2f5f7;
  --tooltip-ink: #18232c;
  --primary-soft: #1f3f5c;
  --primary-deep: #8fc5ee;
  --primary-light: #8fc5ee;
  --link-hover: #c2e1fa;
  --tab-active-ink: #b9ddf7;
  --chart-line: #7fb3dc;
  --chart-previous: #f2a65a;
  --pill-bg: #fff;
  --pill-border: rgba(255, 255, 255, .82);
  --pill-ink: var(--ink-fixed);
  --action-bg: #376f9d;
  --action-hover: #3d77a5;        /* AA con testo bianco (4,8:1); prima #4380af (4,3:1) */
  --action-pressed: #245f91;
  --action-outline-bg: transparent;
  --action-outline-border: #4a5866;
  --action-outline-text: #c6dbe9;
  --action-outline-hover: #2c3c49;
  --action-outline-hover-border: #8fabc2;
  --action-outline-hover-text: #e4f0f8;
  --action-outline-active: #345166;
  --action-outline-active-text: #fff;
  --neutral-border: #71818d;
  --neutral-text: #d2dbe2;
  --neutral-hover-bg: #303b44;
  --neutral-hover-border: #9aaab5;
  --neutral-hover-text: #edf2f5;
  --neutral-active-bg: #3c4953;
  --neutral-active-text: #fff;
  --danger: #f0a4a4;
  --danger-action: #a9464f;
  --danger-action-hover: #b75159;
  --danger-action-pressed: #903942;
  --danger-outline-border: #bd747b;
  --danger-outline-text: #f2bec2;
  --danger-outline-hover-border: #df9299;
  --danger-outline-hover-bg: #472d33;
  --danger-outline-hover-text: #ffe0e2;
  --danger-outline-active-border: #df9299;
  --danger-outline-active-bg: #67383f;
  --action-disabled-bg: #59636d;
  --action-disabled-ink: #e1e6ea;
  --warning: #ead18d;
  --success: #9bd6c8;
  --success-edge: var(--success);
  --trend-up: #51c98a;
  --trend-down: #f07d7d;
  --attention: #ffa94d;             /* «Da tenere d'occhio» di «Analisi AI» (27/11): bordo e titolo */
  --attention-ink: #ffb871;
  /* A tone dimmer than in the light theme, as the notes, so as not to dazzle; the ink stays dark. */
  --alert-success-bg: #b4dccb; --alert-success-border: #7cc2a7; --alert-success-ink: #0b3326;
  --alert-danger-bg: #eebcb7; --alert-danger-border: #d98a84; --alert-danger-ink: #4a1212;
  --alert-warning-bg: #e4d78f; --alert-warning-border: #c7b45a; --alert-warning-ink: #352c05;
  --alert-info-bg: #b8d4ee; --alert-info-border: #7fb0dc; --alert-info-ink: #0c3050;
  --highlight-ink: #fff3c4; --highlight-bg: #705318; --highlight-edge: #bd963a;
  --table-stripe: #2b3239;
  --led-active: #55e6a1;
  --led-invited: #83caff;
  --led-suspended: #ffc268;
  --led-archived: #b8c6d0;
  --led-deny: #ff7480;
  --led-allow: #55e6a1;
  --led-own: #ffc268;
  --shadow: 0 10px 28px rgba(0, 0, 0, .24);
  --bs-secondary-rgb: 167, 177, 186;
  --bs-link-color-rgb: 143, 197, 238;
  --bs-link-hover-color-rgb: 194, 225, 250;
  --bs-focus-ring-color: rgba(143, 197, 238, .3);
}
html[data-theme="dark"] a,
html[data-theme="dark"] .account-link,
html[data-theme="dark"] .pagination .page-link {
  color: var(--primary-deep);
}
html[data-theme="dark"] a:hover,
html[data-theme="dark"] .account-link:hover,
html[data-theme="dark"] .nav-tabs .nav-link:hover,
html[data-theme="dark"] .mon-tabs .mon-tab:hover,
html[data-theme="dark"] .pagination .page-link:hover {
  color: var(--link-hover);
}
html[data-theme="dark"] .text-danger,
html[data-theme="dark"] .validation-summary-errors,
html[data-theme="dark"] .field-validation-error {
  color: var(--danger) !important;
}
html[data-theme="dark"] .text-success { color: var(--success) !important; }
html[data-theme="dark"] .text-warning { color: var(--warning) !important; }
html[data-theme="dark"] .form-label,
html[data-theme="dark"] label,
html[data-theme="dark"] legend {
  color: var(--label-ink);
}
html[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23d4d9dd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
html[data-theme="dark"] .form-select option,
html[data-theme="dark"] .form-control option {
  background-color: var(--control-bg);
  color: var(--ink);
}
html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-select:disabled,
html[data-theme="dark"] .form-check-input:disabled {
  background-color: var(--control-disabled-bg);
  color: var(--ink-faint);
  opacity: 1;
}
html[data-theme="dark"] .form-check-label { color: var(--ink); }
/* Bootstrap reads data-bs-theme, not data-theme: controls not restyled here would keep its light colours. */
html[data-theme="dark"] .input-group-text { border-color: var(--control-border); background-color: var(--surface-hover); color: var(--ink-soft); }
html[data-theme="dark"] .form-check-input { border-color: var(--control-border); background-color: var(--control-bg); }
html[data-theme="dark"] .form-check-input:checked { border-color: var(--action-bg); background-color: var(--action-bg); }
html[data-theme="dark"] .form-switch .form-check-input:not(:checked) {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba(255,255,255,.55)'/%3e%3c/svg%3e");
}
html[data-theme="dark"] .form-control-color { border-color: var(--control-border); background-color: var(--control-bg); }
html[data-theme="dark"] .form-control::file-selector-button { border-color: var(--control-border); background-color: var(--surface-hover); color: var(--ink); }
html[data-theme="dark"] .form-control:hover:not(:disabled):not([readonly])::file-selector-button { background-color: var(--control-border); }
html[data-theme="dark"] .btn-primary:is(:link, :visited, :hover, :focus-visible, :active) { color: var(--on-accent); }
/* A box of the dark theme is a pastel as in the light one: its text takes its ink, and the controls inside it (buttons,
   fields, links) the colours of the light theme, which read on a pale ground. */
html[data-theme="dark"] :is(.alert-success, .alert-danger, .alert-warning, .alert-info, .city-check.is-problem, .city-presence-live) {
  color-scheme: light;
  --ink: #242a30; --ink-soft: #5f6b74; --ink-faint: #8a96a0; --surface: #f3f6fa; --paper: #ffffff; --surface-hover: #e9f0f6;
  --line: #dfe5ec; --row-line: #d4dbe3; --label-ink: #344651; --control-border: #c8d1da; --control-bg: #ffffff;
  --control-disabled-bg: #e9ecef; --primary-deep: #194b75; --primary-soft: #e9f0f6; --primary-light: #4d81aa;
  --action-outline-bg: #ffffff; --action-outline-border: #c7d2dd; --action-outline-text: #245f91; --action-outline-hover: #f1f5f9;
  --action-outline-hover-border: #c7d2dd; --action-outline-hover-text: #245f91; --action-outline-active: #e9f0f6;
  --action-outline-active-text: #245f91; --neutral-border: #c7d2dd; --neutral-text: #245f91; --neutral-hover-bg: #f1f5f9;
  --neutral-hover-border: #c7d2dd; --neutral-hover-text: #245f91; --neutral-active-bg: #e9f0f6; --neutral-active-text: #245f91;
  --danger: #b54343; --danger-outline-border: #8c2e2e; --danger-outline-text: #8c2e2e; --warning: #926d16; --success: #23745e;
  /* The links too («Ignora» of the checks is a .btn-link, which reads --bs-link-color as resolved on the page: 24/11). */
  --link-hover: #245f91; --bs-link-color: #194b75; --bs-link-color-rgb: 25, 75, 117;
  --bs-link-hover-color: #245f91; --bs-link-hover-color-rgb: 36, 95, 145;
}
html[data-theme="dark"] :is(.alert-success, .alert-danger, .alert-warning, .alert-info) *:not(.btn, .btn *, .form-control, .form-select) { color: inherit; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .modal-content {
  background-color: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}
html[data-theme="dark"] .dropdown-item {
  color: var(--ink);
}
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
  background-color: var(--surface-hover);
  color: var(--on-accent);
}
html[data-theme="dark"] .dropdown-item.active,
html[data-theme="dark"] .dropdown-item:active {
  background-color: var(--primary-soft);
  color: var(--link-hover);
}
html[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink);
  --bs-table-border-color: var(--line);
  --bs-table-striped-bg: var(--table-stripe);
  --bs-table-hover-bg: var(--surface-hover);
}
html[data-theme="dark"] .table > :not(caption) > * > * {
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] .table thead th { color: var(--ink-soft); }
html[data-theme="dark"] .nav-tabs { background: rgb(255 255 255 / 4%); }
html[data-theme="dark"] .nav-tabs .nav-link.active,
html[data-theme="dark"] .mon-tabs .mon-tab.active {
  border-color: var(--line);
  background: var(--paper);
  box-shadow: none;
  color: var(--tab-active-ink);
}
html[data-theme="dark"] .nav-tabs .nav-link.active svg { color: var(--tab-active-ink); }
html[data-theme="dark"] .page-link {
  background: var(--paper);
  border-color: var(--line);
  color: var(--primary-deep);
}
html[data-theme="dark"] .page-link:hover,
html[data-theme="dark"] .page-link:focus {
  background: var(--primary-soft);
  border-color: var(--primary-light);
  color: var(--link-hover);
}
html[data-theme="dark"] .page-item.disabled .page-link {
  background: var(--control-disabled-bg);
  border-color: var(--line);
  color: var(--ink-faint);
}
html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-end,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start {
  border-color: var(--line) !important;
}
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .bg-body {
  background-color: var(--paper) !important;
  color: var(--ink) !important;
}
html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(1.8); }
html[data-theme="dark"] hr { border-color: var(--line); opacity: 1; }

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

/* BeNews Portals Grid & Cards */
.portals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, max(28rem, calc((100% - 2rem) / 3))), 1fr));
    gap: 1rem;
}

.dashboard-section { margin-bottom: 2.5rem; }
.dashboard-summary-counts { margin-bottom: 2rem; }
.dashboard-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
    margin-bottom: .85rem;
}
.dashboard-section-heading > h2 {
    min-width: 0;
    margin: 0;
    font-size: var(--text-lg);
    line-height: 1.35;
}
.dashboard-section-heading > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: .35rem;
    white-space: nowrap;
}
.dashboard-section-title { margin: 0 0 .85rem; }
.dashboard-stats-card { margin-bottom: 2rem; }
/* The heading of a card that is a whole block of the dashboard: title and button inside the card. */
.dashboard-card-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .85rem; }
/* Long lists: the first items, the last of them fading into the card, the rest opened by «Mostra altri». */
.expand-list.is-collapsed > .expand-extra { display: none; }
.expand-list.is-collapsed > .expand-edge { position: relative; }
.expand-list.is-collapsed > .expand-edge::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, color-mix(in srgb, var(--paper) 0%, transparent) 0%, var(--paper) 92%); pointer-events: none; }
.expand-list:not(.is-collapsed) > .expand-extra { animation: expand-list-in .22s ease-out both; }
@keyframes expand-list-in { from { opacity: 0; transform: translateY(-.25rem); } to { opacity: 1; transform: none; } }
.expand-list-toggle { display: block; margin: -.15rem auto .5rem; padding: .2rem .6rem; font-weight: 600; text-decoration: none; }
/* Open, the list keeps a bounded height and scrolls inside the card: «Mostra meno», right under it, is always in view
   and the page never has to be scrolled to close it again. */
.expand-list:not(.is-collapsed) { max-height: min(40rem, 70vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.expand-list-toggle.is-open { margin-top: .35rem; }
.expand-list.has-more { -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 3.5rem), transparent); mask-image: linear-gradient(to bottom, black calc(100% - 3.5rem), transparent); }
@media (prefers-reduced-motion: reduce) { .expand-list:not(.is-collapsed) > .expand-extra { animation: none; } }
.portal-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .85rem 1rem;
    margin-bottom: 1rem;
}
.portal-section-heading { min-width: 0; }
/* Desktop: a title above its block (outside a card) starts 16 px in; inside a card the card's own padding already does it.
   .block-heading is the same for a bare title (and the line under it) set straight above a card or a table, and the line
   under a .mon-head follows its title (9/11). */
@media (min-width: 768px) {
  .portal-section-heading, .dashboard-section-heading, .notes-widget-header, .city-subhead,
  .mon-head:not(.mon-pcard .mon-head), .mon-head:not(.mon-pcard .mon-head) + p, .block-heading { padding-left: 16px; }
}
.portal-section-heading > h2 { margin: 0 0 .25rem; }
.portal-section-heading > p { margin: 0; }
.portal-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: .65rem;
    min-width: 0;
    max-width: 100%;
}

.portal-sort .btn,
.portal-search-form .form-control,
.portal-search-form .btn {
    min-height: 2.55rem;
    padding-top: .48rem;
    padding-bottom: .48rem;
    font-size: var(--text-sm);
}

.portal-sort .btn {
    min-width: 5.6rem;
    font-weight: var(--button-font-weight);
    border-color: var(--line);
    background: var(--paper);
    color: var(--ink-soft);
}
.portal-sort .btn:hover,
.portal-sort .btn:focus-visible {
    border-color: var(--primary-light);
    background: color-mix(in srgb, var(--primary-light) 10%, var(--paper));
    color: var(--primary-deep);
}
.portal-sort .btn[aria-pressed="true"] {
    border-color: color-mix(in srgb, var(--primary-light) 45%, var(--line));
    background: color-mix(in srgb, var(--primary-light) 16%, var(--paper));
    color: var(--primary-deep);
}

.portal-search-form {
    display: flex;
    align-items: stretch;
}

.portal-search-form .form-control {
    width: min(16rem, 30vw);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.portal-search-form .btn {
    margin-left: -1px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    font-weight: var(--button-font-weight);
}

.portal-sort .btn:not(.btn-sm),
.portal-search-form .btn:not(.btn-sm) {
    min-height: 2.35rem;
    padding-top: .32rem;
    padding-bottom: .32rem;
}

.portal-order-status {
    min-height: 1.25rem;
    color: var(--ink-soft);
}
.portal-order-status:empty { display: none; }

.portal-card {
    display: flex;
    flex-wrap: wrap;
    row-gap: .6rem;
    align-items: center;
    background: var(--paper);
    border: 1px solid var(--line);
    min-height: 6.25rem;
    border-radius: var(--radius-md);
    padding: 1.05rem 1.2rem;
    position: relative;
    box-shadow: var(--shadow-card);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.portal-card[hidden],
[data-portal-filter-empty][hidden] { display: none !important; }

/* The name is the link, stretched over the whole card; what has its own use rises above it. */
.portal-card-name::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-md); }
.portal-card-drag-handle, .portal-card-actions, .portal-card-stats [title] { position: relative; z-index: 1; }

/* Under the mouse or the keyboard the card takes the colour of its portal. */
.portal-card:is(:hover, :has(.portal-card-name:focus-visible)) {
    border-color: color-mix(in srgb, var(--portal-color) 42%, var(--line));
    background: color-mix(in srgb, var(--portal-color) 7%, var(--paper));
}
html[data-theme="dark"] .portal-card:is(:hover, :has(.portal-card-name:focus-visible)) {
    background: color-mix(in srgb, var(--portal-color) 13%, var(--paper));
}
.portal-card .portal-tile { transition: box-shadow 0.2s ease; }
.portal-card:is(:hover, :has(.portal-card-name:focus-visible)) .portal-tile {
    box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 0 0 3px color-mix(in srgb, var(--portal-color) 24%, transparent);
}
.portal-card-name:focus-visible { outline: none; }
.portal-card:has(.portal-card-name:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

.portal-card-arrow {
    flex: 0 0 1rem;
    width: 1rem;
    height: 1rem;
    margin-left: .75rem;
    color: var(--primary);
    opacity: 0;
    transform: translateX(-.35rem);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
html[data-theme="dark"] .portal-card-arrow { color: var(--primary-light); }
.portal-card:is(:hover, :has(.portal-card-name:focus-visible)) .portal-card-arrow { opacity: 1; transform: none; }
.portals-grid[data-sort-mode="custom"] .portal-card-arrow { display: none; }
@media (hover: none), (max-width: 767.98px) { .portal-card-arrow { display: none; } }

.portal-card-drag-handle {
    display: none;
    cursor: grab;
    padding: 0.5rem 0.5rem 0.5rem 0;
    color: var(--ink-soft);
    margin-left: -0.5rem;
}

.portal-card-drag-handle:active {
    cursor: grabbing;
}

.portal-card-drag-handle:hover {
    color: var(--ink);
}

.portals-grid[data-sort-mode="custom"] .portal-card-drag-handle {
    display: flex;
}

.portals-grid[data-sort-mode="custom"] .portal-card-actions {
    display: flex;
}

.portal-card-main {
    flex: 1 0 auto;
    min-width: min(100%, var(--portal-heading-width, 14rem));
    max-width: 100%;
}

.portal-card-info {
    flex: 1;
    min-width: 0;
}

.portal-card-name {
    display: block;
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--ink);
    text-decoration: none;
    line-height: 1.2;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow-wrap: normal;
}

.portal-card-name:hover {
    color: var(--ink);
    text-decoration: none;
}

.portal-card-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--text-sm);
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
}

.portal-card-meta .status-indicator {
    flex-basis: 10px !important;
    width: 10px !important; height: 10px !important;
    min-width: 10px !important; min-height: 10px !important;
    max-width: 10px !important; max-height: 10px !important;
}

.portal-card-meta .text-truncate {
    flex: 1;
    min-width: 0;
}

.meta-separator {
    opacity: 0.5;
}

/* Statistics and arrow travel together: the arrow never wraps on its own line. */
.portal-card-side {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Same width in every card (site.js sets it to the widest), so the separators line up. */
.portal-card-stats {
    text-align: left;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--line);
    min-width: 5.6rem;
    width: var(--portal-stats-width, auto);
    flex-shrink: 0;
}

.sessions-source + .sessions-source {
    margin-top: .45rem;
}

/* KPI blocks (home portal cards, dashboard, period summary, network tiles): label, then value, then change pill. */
.sessions-source, .analytics-metric, .analytics-preview-metric, .network-tile-stat {
    display: flex; flex-direction: column; align-items: flex-start;
}
.sessions-val {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.sessions-val svg { width: .9rem; height: .9rem; }
.sessions-label {
    order: -1;
    margin: 0 0 .2rem;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink-soft);
}

.portal-card .sessions-label { white-space: nowrap; }

.sessions-missing { color: var(--ink-soft); }

.trend-up { color: var(--trend-up); }
.trend-down { color: var(--trend-down); }
.trend-stable { color: var(--ink-soft); }

.portal-card.is-dragging {
    opacity: 0.4;
    border: 1px dashed var(--primary);
}
.portal-card.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

.portal-card-actions {
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.btn-reorder {
    padding: 0.2rem;
    line-height: 1;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-soft);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-reorder:hover, .btn-reorder:focus-visible {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.profile-avatar-sm { flex: 0 0 2.25rem; width: 2.25rem; height: 2.25rem; font-size: var(--monogram-md); }
.profile-avatar-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }


@media (max-width: 767.98px) {
  .portal-tools, .portal-search-form { width: 100%; }
  .portal-sort { display: flex; width: 100%; }
  .portal-sort .btn { flex: 1 1 0; min-width: 0; padding-inline: .3rem; font-size: var(--text-xs); white-space: normal; }
  .portal-search-form .form-control { flex: 1; width: auto; min-width: 0; }
  .portal-card {
    align-items: center;
    padding: .85rem;
  }
  .portal-card-drag-handle { display: none !important; }
  .portal-card-main > .d-flex { gap: .55rem !important; }
  .portal-card-stats {
    min-width: 5.6rem;
    margin: 0 0 0 .55rem;
    padding: 0 0 0 .55rem;
    border-left: 1px solid var(--line);
    border-top: 0;
    text-align: right;
  }
  /* A smaller figure keeps five digits and the trend within the shared column width. */
  .portal-card-stats .sessions-val { justify-content: flex-end; gap: .2rem; font-size: var(--text-xl); }
  .portal-card-actions {
    flex-direction: column;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .btn-reorder { display: grid; place-items: center; min-width: 2rem; min-height: 2rem; padding: 0; }
}
/* ---- Granular permission matrix (task 23) ---- */
.gpm-card { padding: 0; overflow: hidden; }
.gpm-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.gpm-portal-picker { min-width: 15rem; }
/* «Copia da» beside «Portale» (24/11); the button stays on the select's line. */
.gpm-pickers { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; }
.gpm-copy-picker .btn { flex: none; align-self: stretch; }
.gpm-tile { width: 1.9rem; height: 1.9rem; font-size: var(--text-xs); flex: none; }
.gpm-readonly, .gpm-copy-notice { padding: .55rem 1.2rem; background: var(--primary-soft); color: var(--ink); }
.gpm-bulk { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)) auto; align-items: end; gap: .65rem; padding: .8rem; background: color-mix(in srgb, var(--primary-soft) 38%, var(--paper)); }
.gpm-bulk-field { min-width: 0; }
.gpm-bulk-field label { display: block; font-size: var(--text-xs); font-weight: 600; margin-bottom: .25rem; }
.gpm-bulk .form-select { width: 100%; min-width: 0; min-height: 2.4rem; }
.gpm-bulk .btn { min-height: 2.4rem; }
.gpm-bulk-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; padding: .65rem .8rem; }
.gpm-bulk-count { font-weight: 600; }
.gpm-bulk-count.is-error { color: var(--danger); }
.gpm-bulk-hint { color: var(--ink-soft); grid-column: 1 / -1; }
.gpm-bulk-panel { margin: .55rem 1.2rem; border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; }
.gpm-bulk-title { margin: 0; font-size: var(--text-base); font-weight: 700; }
.gpm-bulk-panel .gpm-bulk { border-top: 1px solid var(--line); border-bottom: 0; }
.gpm-group-summary { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; color: var(--ink); font-weight: 600; cursor: pointer; list-style: none; }
.gpm-group-summary::-webkit-details-marker { display: none; }
.gpm-group-summary::after { content: ""; width: .5rem; height: .5rem; flex: none; margin-left: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
.gpm-group[open] > .gpm-group-summary::after { transform: rotate(225deg); }
.gpm-group-name { display: inline-flex; align-items: center; gap: .4rem; }
.gpm-group { margin: .55rem 1.2rem; border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; }
.gpm-group-summary { background: color-mix(in srgb, var(--primary-soft) 55%, var(--paper)); }
.gpm-group-tools { padding: .45rem .8rem; border-top: 1px solid var(--line); }
.gpm-group-select { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.gpm-group-select .form-check-input, .gpm-select-hit .form-check-input { float: none; margin: 0; width: .8rem; height: .8rem; flex: 0 0 .8rem; }
.gpm-scroll { overflow-x: auto; overflow-y: hidden; }
/* 23/11 sera: all the columns of the page in the same order and share in every group (colgroup from
   GranularPermissionMatrix), the whole width above the minimum: each permission stays under its own heading, a column
   the group does not use is blank.
   Headings in plain case, broken only between words, the «?» joined to the last word, aligned on their last line. */
.gpm-table { font-size: var(--text-sm); border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; min-width: var(--gpm-width, 0); --bs-table-bg: transparent; color: var(--ink); }
.gpm-table thead :is(th, td) { background: var(--paper); font-size: var(--text-xs); color: var(--ink-soft); font-weight: 600; text-transform: none; letter-spacing: 0; line-height: 1.3; white-space: normal; overflow-wrap: normal; word-break: normal; hyphens: manual; vertical-align: bottom; border-bottom: 1px solid var(--line); padding: .5rem .25rem; }
.gpm-col-last { white-space: nowrap; }
.gpm-table td, .gpm-table tbody th { padding: .32rem .25rem; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.gpm-sel { text-align: center; }
.gpm-select-hit { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; min-height: 2rem; cursor: pointer; }
.gpm-group-row th { background: color-mix(in srgb, var(--primary-soft) 70%, var(--paper)); color: var(--primary-deep); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; padding: .4rem .6rem; position: sticky; left: 0; }
.gpm-group-count { font-weight: 500; color: var(--ink-soft); }
.gpm-area { font-weight: 600; position: sticky; left: 0; background: var(--paper); z-index: 1; }
/* The first line of the name on the middle of the selects (2rem), the next ones close to it. */
.gpm-area-name { display: block; line-height: 1.25rem; padding: .375rem 0; }
.gpm-area-name[for] { margin: 0; cursor: pointer; color: inherit; font-weight: inherit; }
.gpm-inactive { display: none; font-size: var(--text-xs); font-weight: 500; color: var(--warning); }
.gpm-row.is-inactive .gpm-inactive { display: block; }
.gpm-row.is-inactive .gpm-area-name { color: var(--ink-soft); }
.gpm-row.is-inactive .gpm-cell:not([data-gpm-column="access"]) .gpm-select { opacity: .72; }
.gpm-row.is-selected td, .gpm-row.is-selected .gpm-area { background: color-mix(in srgb, var(--primary-soft) 55%, var(--paper)); }
.gpm-row.has-error .gpm-area { box-shadow: inset 1px 0 0 var(--danger); }
.gpm-errors { list-style: none; margin: 0; padding: 0; font-size: var(--text-xs); font-weight: 500; color: var(--danger); max-width: 16rem; }
.gpm-errors li + li { margin-top: .15rem; }
.gpm-cell { min-width: 0; }
.gpm-cell-label { display: block; font-size: var(--text-xs); color: var(--ink-soft); line-height: 1.2; margin: .2rem 0 0; }
.gpm-select { min-height: 2rem; font-size: var(--text-sm); padding-top: .18rem; padding-bottom: .18rem; padding-left: .4rem; padding-right: 1.4rem; background-position: right .4rem center; background-size: 12px 9px; min-width: 0; }
.gpm-select-control { display: flex; align-items: center; gap: .25rem; }
/* One width for every Sì/No select and one for the three values of Modifica: the grid stays even in every column. */
.gpm-select-control .gpm-select { flex: 0 0 auto; width: 3.25rem; }
.gpm-select-control .gpm-select.is-scope { width: 6.15rem; }
.gpm-value-deny { background: var(--led-deny); }
.gpm-value-allow { background: var(--led-allow); }
.gpm-value-own { background: var(--led-own); }
.gpm-cell.is-dirty .gpm-select { border-color: var(--primary-light); box-shadow: inset 0 -2px 0 var(--primary-light); }
.gpm-select.is-invalid { border-color: var(--danger); }
.gpm-na { padding: 0; }
.gpm-help { display: inline-grid; place-items: center; width: .9rem; height: .9rem; border-radius: 50%; border: 1px solid currentColor; font-size: var(--text-xs); line-height: 1; vertical-align: top; margin-top: .05rem; cursor: help; margin-left: .2rem; }
.gpm-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; padding: .75rem 1.2rem; border-top: 1px solid var(--line); }
.gpm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.gpm-status { color: var(--primary-deep); font-weight: 600; }
.gpm-status.is-error { color: var(--danger); }
html[data-theme="dark"] .gpm-group-row th { color: var(--ink); background: color-mix(in srgb, var(--primary) 22%, var(--paper)); }
html[data-theme="dark"] .gpm-status { color: var(--primary-light); }
html[data-theme="dark"] .gpm-bulk, html[data-theme="dark"] .gpm-readonly, html[data-theme="dark"] .gpm-copy-notice { background: color-mix(in srgb, var(--primary) 12%, var(--paper)); }
html[data-theme="dark"] .gpm-row.is-selected td, html[data-theme="dark"] .gpm-row.is-selected .gpm-area { background: color-mix(in srgb, var(--primary) 18%, var(--paper)); }
@media (max-width: 767.98px) {
  .gpm-head, .gpm-foot { padding: .8rem; }
  .gpm-pickers, .gpm-portal-picker { width: 100%; }
  .gpm-copy-notice { padding: .55rem .8rem; }
  .gpm-group { margin-left: .8rem; margin-right: .8rem; }
  .gpm-bulk-panel { margin-left: .8rem; margin-right: .8rem; }
  .gpm-bulk { grid-template-columns: minmax(0,1fr); }
  .gpm-bulk .btn { width: 100%; min-height: 2.75rem; }
  .gpm-bulk .form-select { min-height: 2.75rem; }
  .gpm-scroll { overflow: visible; }
  .gpm-table { width: 100%; min-width: 0; table-layout: auto; }
  .gpm-table colgroup { display: none; }
  .gpm-table td, .gpm-table tbody th { padding: .32rem .45rem; }
  .gpm-table thead { display: none; }
  .gpm-table tbody { display: block; }
  .gpm-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .45rem .65rem; padding: .65rem; background: var(--paper); border-bottom: 1px solid var(--line); }
  .gpm-table > tbody > .gpm-row > * { background: transparent; border: 0; box-shadow: none; }
  html[data-theme="dark"] .gpm-table > tbody > .gpm-row > * { background: transparent; }
  .gpm-row.is-selected { background: color-mix(in srgb, var(--primary-soft) 55%, var(--paper)); }
  html[data-theme="dark"] .gpm-row.is-selected { background: color-mix(in srgb, var(--primary) 18%, var(--paper)); }
  .gpm-row > .gpm-sel { grid-column: 1; grid-row: 1; width: 1.5rem; padding: 0; justify-self: start; position: relative; z-index: 1; }
  .gpm-row > .gpm-sel:empty { display: none; }
  .gpm-row > .gpm-sel:empty + .gpm-area { grid-column: 1 / -1; }
  .gpm-select-hit { min-width: 1.5rem; min-height: 2.75rem; justify-content: flex-start; padding-left: .375rem; }
  .gpm-row > .gpm-area { grid-column: 1 / -1; grid-row: 1; position: static; z-index: auto; padding: .3rem 0 .3rem 1.5rem; align-self: center; }
  .gpm-row > .gpm-sel:empty + .gpm-area { padding-left: 0; }
  .gpm-row.has-error > .gpm-area { border-left: 1px solid var(--danger); box-shadow: none; }
  .gpm-row > .gpm-cell { min-width: 0; padding: 0; }
  .gpm-row > .gpm-cell::before { content: attr(data-label); display: block; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 600; margin-bottom: .2rem; }
  .gpm-row > .gpm-na { display: none; }
  .gpm-row > .gpm-cell .gpm-cell-label { display: none; }
  .gpm-row .gpm-select-control .gpm-select, .gpm-row .gpm-select-control .gpm-select.is-scope { width: auto; min-width: 0; }
  .gpm-row .gpm-area-name { padding: 0; }
}
@media (max-width: 359.98px) {
  .gpm-row { grid-template-columns: minmax(0,1fr); }
  .gpm-row > .gpm-cell { grid-column: 1; }
}
/* Phone layout of the matrix (permission-matrix.js adds .gpm-enhanced): one card per area with the Accesso switch
   beside the name, the other permissions only while access is on, buttons instead of menus, a sticky save bar.
   The selects stay in the page, hidden, as the submitted values. Without the script the layout above applies. */
.gpm-seg, .gpm-off-note, .gpm-bulk-toggle { display: none; }
@media (max-width: 767.98px) {
  .gpm-enhanced .gpm-bulk-toggle { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 2.75rem; padding: .65rem .8rem; border: 0; background: color-mix(in srgb, var(--primary-soft) 38%, var(--paper)); color: var(--ink); font-weight: 600; text-align: left; }
  .gpm-enhanced .gpm-bulk-toggle::after { content: ""; width: .5rem; height: .5rem; flex: none; margin-left: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); }
  .gpm-enhanced.is-bulk-open .gpm-bulk-toggle::after { transform: rotate(225deg); }
  html[data-theme="dark"] .gpm-enhanced .gpm-bulk-toggle { background: color-mix(in srgb, var(--primary) 12%, var(--paper)); }
  .gpm-enhanced .gpm-bulk-title { display: none; }
  .gpm-enhanced:not(.is-bulk-open) .gpm-bulk-heading,
  .gpm-enhanced:not(.is-bulk-open) .gpm-bulk,
  .gpm-enhanced:not(.is-bulk-open) .gpm-group-tools,
  .gpm-enhanced:not(.is-bulk-open) .gpm-row > .gpm-sel { display: none; }
  .gpm-enhanced.is-bulk-open .gpm-bulk-heading { border-top: 1px solid var(--line); }

  .gpm-enhanced .gpm-row { grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: .5rem .75rem; padding: .7rem .8rem; }
  .gpm-enhanced .gpm-row > .gpm-sel { grid-column: 1; grid-row: 1; align-self: start; }
  .gpm-enhanced .gpm-row > .gpm-area { grid-column: 1; grid-row: 1; padding: 0; }
  .gpm-enhanced.is-bulk-open .gpm-row > .gpm-area { padding-left: 1.75rem; }
  .gpm-enhanced .gpm-area-name { line-height: 1.3; font-size: var(--text-base); }
  .gpm-enhanced .gpm-row > .gpm-cell { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem .75rem; padding-top: .5rem; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
  .gpm-enhanced .gpm-row > .gpm-cell::before { flex: 1 1 7rem; margin: 0; font-size: var(--text-sm); font-weight: 500; color: var(--ink); }
  .gpm-enhanced .gpm-row > .gpm-cell.has-cell-label::before { display: none; }
  .gpm-enhanced .gpm-row > .gpm-cell .gpm-cell-label { display: block; order: -1; flex: 1 1 7rem; margin: 0; font-size: var(--text-sm); font-weight: 500; color: var(--ink); line-height: 1.3; }
  .gpm-enhanced .gpm-row > .gpm-cell[data-gpm-column="access"] { grid-column: 2; grid-row: 1; padding: 0; border: 0; }
  .gpm-enhanced .gpm-row > .gpm-cell[data-gpm-column="access"]::before { display: none; }
  .gpm-enhanced .gpm-select-control { display: none; }
  .gpm-enhanced .gpm-seg { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; background: var(--paper); }
  .gpm-enhanced .gpm-seg.is-invalid { border-color: var(--danger); }
  .gpm-enhanced .gpm-cell.is-dirty .gpm-seg { box-shadow: 0 0 0 2px var(--primary-light); }
  .gpm-seg-btn { min-width: 3.25rem; min-height: 2.75rem; padding: 0 .8rem; border: 0; background: transparent; color: var(--ink-soft); font-size: var(--text-sm); font-weight: 600; }
  .gpm-seg-btn + .gpm-seg-btn { border-left: 1px solid var(--line); }
  .gpm-seg-btn[aria-pressed="true"].is-deny { background: color-mix(in srgb, var(--led-deny) 22%, var(--paper)); color: var(--ink); }
  .gpm-seg-btn[aria-pressed="true"].is-allow { background: color-mix(in srgb, var(--led-allow) 24%, var(--paper)); color: var(--ink); }
  .gpm-seg-btn[aria-pressed="true"].is-own { background: color-mix(in srgb, var(--led-own) 24%, var(--paper)); color: var(--ink); }
  .gpm-seg-btn:disabled { opacity: .4; cursor: not-allowed; }
  .gpm-seg-btn[aria-pressed="true"]:disabled { opacity: .75; }
  .gpm-seg-btn:focus-visible { outline: 2px solid var(--primary-light); outline-offset: -2px; }

  .gpm-enhanced .gpm-row > .gpm-cell.is-blocked::after { content: "Sì richiede Modifica diversa da Nessuno"; flex-basis: 100%; margin-top: -.15rem; font-size: var(--text-xs); color: var(--ink-soft); }
  .gpm-enhanced .gpm-row .gpm-inactive { display: none; }
  .gpm-enhanced .gpm-row.is-inactive .gpm-off-note { display: block; font-size: var(--text-xs); font-weight: 500; color: var(--ink-soft); }
  .gpm-enhanced .gpm-row.is-inactive:not(.has-error) > .gpm-cell:not([data-gpm-column="access"]) { display: none; }
  .gpm-enhanced .gpm-row.is-inactive .gpm-area-name { color: var(--ink); }

  .gpm-card:has(.gpm-enhanced) { overflow: clip; }
  .gpm-enhanced .gpm-foot { display: contents; }
  .gpm-enhanced .gpm-foot > p { display: block; padding: .75rem .8rem; border-top: 1px solid var(--line); }
  .gpm-enhanced .gpm-actions { position: sticky; bottom: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .6rem .8rem calc(.6rem + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -6px 16px rgb(0 0 0 / .12); }
  .gpm-enhanced .gpm-actions .gpm-status { grid-column: 1 / -1; }
  .gpm-enhanced .gpm-actions .gpm-status:empty { display: none; }
  .gpm-enhanced .gpm-actions .btn { min-height: 2.75rem; }
}
@media (max-width: 359.98px) {
  .gpm-enhanced .gpm-row { grid-template-columns: minmax(0,1fr) auto; }
  .gpm-enhanced .gpm-row > .gpm-cell { grid-column: 1 / -1; }
  .gpm-enhanced .gpm-row > .gpm-cell[data-gpm-column="access"] { grid-column: 2; }
}

/* Portal analytics */
.analytics-chart-card {
  --chart-inset: clamp(1rem, 2vw, 1.5rem);
  padding: 0; overflow: hidden;
}
.analytics-chart-card > h2 {
  margin: 0 var(--chart-inset) 1rem;
  padding-top: var(--chart-inset);
}
.analytics-chart-card > .analytics-filters,
.analytics-chart-card > p,
.analytics-chart-card > .analytics-daily-details,
.analytics-chart-card > .empty-state-box {
  margin-left: var(--chart-inset);
  margin-right: var(--chart-inset);
}
.analytics-chart-card > .analytics-daily-details,
.analytics-chart-card > .empty-state-box { margin-bottom: var(--chart-inset); }
.analytics-preview { container: analytics-preview / inline-size; }
.btn-arrow-icon { display: block; width: .8em; height: .8em; flex: 0 0 .8em; }
.analytics-preview-grid, .analytics-panel-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.analytics-preview-source, .analytics-panel {
  background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1.1rem; min-width: 0;
}
.analytics-preview-source { container: analytics-preview-source / inline-size; }
.analytics-preview-periods { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.analytics-preview-period + .analytics-preview-period { border-top: 1px solid var(--line); padding-top: 1rem; }
.analytics-period-label { font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: .55rem; }
.analytics-preview-period { container: analytics-preview-period / inline-size; min-width: 0; }
.analytics-preview-measures { display: grid; grid-template-columns: minmax(0, 1fr); gap: .7rem; }
.analytics-preview-metric { text-align: left; min-width: 0; font-variant-numeric: tabular-nums; }
.analytics-preview-metric .sessions-val { flex-wrap: wrap; }
@container analytics-preview (min-width: 900px) {
  .analytics-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container analytics-preview-source (min-width: 820px) {
  .analytics-preview-periods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-preview-period + .analytics-preview-period {
    border-top: 0; border-left: 1px solid var(--line); padding-top: 0; padding-left: 1rem;
  }
}
@container analytics-preview-period (min-width: 350px) {
  .analytics-preview-measures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.analytics-filters {
  display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap;
  padding: 1rem; border: 1px solid var(--line); border-radius: .65rem;
  background: var(--paper);
}
.analytics-filters label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; min-width: 10rem; }
.analytics-filters .form-select { background-color: var(--paper); }
.analytics-filters .btn { min-height: 2.4rem; }
.analytics-chart-frame {
  position: relative; width: 100%; min-width: 0;
  height: clamp(220px, 28vw, 320px); overflow: hidden;
}
.analytics-chart-canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.analytics-chart-canvas:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
.analytics-chart-tooltip {
  position: absolute; z-index: 1; min-width: 8rem; padding: .45rem .65rem;
  border: 1px solid var(--line); border-radius: .45rem; background: var(--paper);
  color: var(--ink); box-shadow: var(--shadow); pointer-events: none;
  font-family: var(--font-sans); font-size: var(--text-sm); line-height: 1.4;
}
.analytics-chart-tooltip > span { display: block; color: var(--ink-soft); }
.analytics-chart-tooltip > strong { display: block; font-weight: 700; }
.analytics-chart-tooltip > .analytics-chart-tooltip-previous { color: var(--chart-previous); font-weight: 600; }
/* La legenda del grafico con l'anno precedente (27/11): colonne del periodo e linea dell'anno prima. */
.analytics-chart-card > .analytics-chart-legend {
  display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0 var(--chart-inset) .5rem;
  font-size: var(--text-sm); color: var(--ink-soft);
}
.analytics-chart-legend > span { display: inline-flex; align-items: center; gap: .45rem; }
.analytics-chart-key { display: inline-block; flex: 0 0 auto; }
.analytics-chart-key-period { width: .7rem; height: .7rem; border-radius: 2px; background: var(--chart-line); opacity: .8; }
.analytics-chart-key-previous { width: 1.1rem; height: 2px; border-radius: 1px; background: var(--chart-previous); }
.analytics-chart-script-note { margin: .75rem var(--chart-inset); color: var(--ink-soft); }
.analytics-chart-table { max-height: 18rem; overflow-y: auto; }
.analytics-daily-details > .analytics-chart-table { margin-top: .75rem; }
.analytics-daily-details { font-family: var(--font-sans); font-size: inherit; }
.analytics-daily-details > summary {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--primary-deep); font-weight: 600; cursor: pointer; list-style: none;
  text-decoration: underline; text-underline-offset: 3px;
}
.analytics-daily-details > summary::marker { content: ""; }
.analytics-daily-details > summary::-webkit-details-marker { display: none; }
.analytics-daily-details > summary::after {
  content: ""; width: .46rem; height: .46rem; flex: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px); transition: transform .16s ease;
}
.analytics-daily-details[open] > summary::after { transform: rotate(225deg) translate(-1px, -1px); }
.analytics-daily-details > summary:hover { color: var(--primary); }
html[data-theme="dark"] .analytics-daily-details > summary:hover { color: var(--link-hover); }
.analytics-daily-details > summary:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 3px; }
.analytics-breakdown > h2 { margin-bottom: 1rem !important; }
.analytics-source-section { container: analytics-source / inline-size; }
.analytics-source-section > h2, .analytics-source-section > h3 { letter-spacing: -.012em; }
.analytics-panel h3, .analytics-panel h4 { font-weight: 750; }
.analytics-detail-card .analytics-panel > h3,
.analytics-detail-card .analytics-panel > h4 { margin-bottom: .7rem !important; }
.analytics-source-section .analytics-panel-grid-single {
  grid-template-columns: minmax(0, 1fr); max-width: 30rem;
}
.analytics-metric {
  border-top: 1px solid var(--line); padding: .65rem 0; text-align: left; font-variant-numeric: tabular-nums;
}
.analytics-metric:last-child { padding-bottom: 0; }
.analytics-metric .sessions-val { flex-wrap: wrap; }
.analytics-delta {
  display: inline-flex; align-items: center; margin-top: .45rem; padding: .12rem .55rem; border-radius: 999px;
  font-size: var(--text-xs); font-weight: 500; line-height: 1.4;
  background: color-mix(in srgb, currentColor 11%, transparent);
}
.analytics-table-delta { display: block; font-size: var(--text-xs); font-weight: 500; white-space: nowrap; }
.network-tile-stat .analytics-delta { font-size: var(--text-xs); }
.analytics-network-table { border: 1px solid var(--line); border-radius: .65rem; }
.analytics-network-table .table { margin-bottom: 0; }
.analytics-network-table thead { background: color-mix(in srgb, var(--primary) 6%, var(--paper)); }
.analytics-network-table th, .analytics-network-table td { padding: .7rem .9rem; vertical-align: middle; }
.analytics-network-portals .network-tile-grid { margin-top: 1.1rem; }
.dashboard-stats-card .analytics-preview-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 385px), 1fr)); gap: .75rem;
}
.dashboard-stats-card .analytics-preview-source { padding: .85rem; }
.dashboard-stats-card .analytics-preview-periods { gap: .65rem; }
.dashboard-stats-card .analytics-preview-period + .analytics-preview-period { padding-top: .65rem; }
.dashboard-stats-card .analytics-period-label { margin-bottom: .35rem; }
.dashboard-facebook .analytics-panel-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
.dashboard-facebook .analytics-panel {
  padding: .35rem 0; border: 0; border-radius: 0; background: transparent;
}
.dashboard-facebook .analytics-panel + .analytics-panel {
  border-top: 1px solid var(--line); margin-top: .65rem; padding-top: .85rem;
}
.dashboard-facebook .analytics-panel h3.analytics-period-label {
  font: inherit; font-size: var(--text-xs); font-weight: 700; color: var(--ink-soft);
  letter-spacing: inherit; margin-bottom: .35rem !important;
}
.dashboard-facebook .analytics-metric { padding: 0; border: 0; }
.dashboard-facebook .analytics-metric + .analytics-metric {
  margin-top: .7rem; padding-top: .65rem; border-top: 1px solid var(--line);
}
.dashboard-stats-card .analytics-delta { margin-top: .2rem; }
.dashboard-stats-card .analytics-period-label { margin: 0 0 .55rem; }
.dashboard-stats-card .analytics-preview-measures > .analytics-metric {
  margin: 0; padding: 0; border: 0;
}
.dashboard-stats-card .analytics-preview-measures .sessions-label {
  font-size: var(--text-xs); font-weight: 600; color: var(--ink-soft);
}
@container analytics-source (min-width: 620px) {
  .dashboard-facebook .analytics-panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-facebook .analytics-panel { padding: .35rem .85rem; }
  .dashboard-facebook .analytics-panel:first-child { padding-left: 0; }
  .dashboard-facebook .analytics-panel:last-child { padding-right: 0; }
  .dashboard-facebook .analytics-panel + .analytics-panel {
    border-top: 0; border-left: 1px solid var(--line);
    margin-top: 0; padding-top: .35rem;
  }
}
@container analytics-source (min-width: 460px) {
  .analytics-panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container analytics-source (min-width: 620px) {
  .analytics-panel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Quattro riquadri (YouTube di Network, 11/11): due per riga finché non stanno tutti in fila. */
  .analytics-panel-grid.analytics-panel-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container analytics-source (min-width: 700px) {
  .analytics-panel-grid.analytics-panel-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* 15 px su desktop (9/11): i riquadri delle statistiche nella dashboard (Portale, App, Facebook, Instagram) e i pannelli
   interni delle Statistiche.
   Il grafico «Andamento» ha il suo margine; su telefono restano i valori più stretti delle regole sotto i 768 px. */
@media (min-width: 768px) {
  .analytics-preview-source, .analytics-panel,
  .dashboard-stats-card .analytics-preview-source { padding: 15px; }
  /* Le card p-4 di tutto il CMS (9/11): 16 px, comprese quelle delle Statistiche (analytics-detail-card). */
  .card.p-4, .analytics-detail-card { padding: 16px !important; --bar-pad: 16px; }
  /* Titolo, filtri, note e tabella delle card del grafico (Statistiche, Network, Posizionamento): 16 px di lato. */
  .analytics-chart-card { --chart-inset: 16px; }
  /* Il grafico stesso: 8 px di lato dentro la sua cornice. */
  .analytics-chart-frame { padding: 0 8px; }
}
@media (max-width: 700px) {
  .analytics-filters label { width: 100%; }
  .analytics-filters .btn { width: 100%; }
}
/* «Vista» e «Periodo» delle Statistiche (26/11): i tipi di periodo come pulsanti su una riga loro, poi i soli periodi di
   quel tipo con il precedente e il successivo ai lati, accanto a Fonte e Misura. Su telefono i quattro pulsanti vanno
   due per riga. */
.analytics-period-field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.analytics-period-field:has(.analytics-period-kinds) { flex-basis: 100%; align-items: flex-start; }
/* «Vista» e «Confronta con» (27/11) sulla stessa riga, che resta sopra Periodo, Fonte e Misura. */
.analytics-period-choices { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.5rem; flex-basis: 100%; min-width: 0; }
.analytics-period-choices > .analytics-period-field { flex-basis: auto; }
.analytics-period-name { font-weight: 600; }
.analytics-period-kinds { flex-wrap: nowrap; }
.analytics-period-kinds .btn { min-width: 0; white-space: nowrap; }
/* Nel gruppo unito ogni pulsante copre di 1 px il bordo sinistro del successivo: quello scelto sta sopra, così il suo
   bordo destro resta intero anche quando non è l'ultimo. */
.analytics-period-kinds > .btn[aria-pressed="true"] { z-index: 2; }
.analytics-period-step { display: flex; align-items: stretch; gap: .35rem; }
.analytics-period-step .form-select { min-width: 12rem; }
.analytics-filters .analytics-period-step .btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.6rem; padding: 0; font-size: var(--text-2xl); line-height: 1;
}
@media (max-width: 700px) {
  .analytics-period-field { width: 100%; }
  .analytics-period-field:has(.analytics-period-kinds) { align-items: stretch; }
  .analytics-period-choices > .analytics-period-field { flex-basis: 100%; }
  .analytics-period-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
  /* Fuori dal gruppo unito di Bootstrap: ogni pulsante coi suoi angoli e senza il bordo sovrapposto. */
  .analytics-period-kinds > .btn { margin-left: 0 !important; border-radius: var(--bs-btn-border-radius) !important; }
  .analytics-period-step .form-select { flex: 1 1 auto; min-width: 0; }
}
/* «Analisi AI» ed «Esporta PDF» nell'intestazione delle Statistiche (27/11); il pulsante dell'analisi è quello
   dell'Assistente dei contenuti (.btn-assistant). Sotto l'intestazione il pannello dell'analisi, disegnato come il pannello
   dell'Assistente: testa con la stella e la sfumatura, la riga sotto che scorre mentre il modello lavora; dentro le cifre
   chiave della pagina, la frase dell'andamento, i tre elenchi con titolo e cifre, in fondo il costo. */
.statistics-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.statistics-ai-form { margin: 0; }
.statistics-action { display: inline-flex; align-items: center; gap: .35rem; }
.statistics-action svg { width: 1rem; height: 1rem; flex: 0 0 1rem; }
.statistics-action[aria-busy="true"] { cursor: progress; }
/* «Esporta PDF» è un link: .app-body supera il colore dei link del tema scuro (html[data-theme="dark"] a), come gli altri pulsanti. */
.app-body .statistics-actions a.btn-outline-secondary { color: var(--neutral-text); }
.app-body .statistics-actions a.btn-outline-secondary:is(:hover, :focus-visible) { color: var(--neutral-hover-text); }
.statistics-analysis {
  margin-bottom: 1.5rem; border: 1px solid var(--assistant-line); border-radius: var(--radius-md);
  background: var(--paper); overflow: hidden;
}
.statistics-analysis:focus { outline: none; }
.statistics-analysis:focus-visible { outline: 2px solid var(--assistant); outline-offset: 2px; }
.statistics-analysis-head {
  position: relative; display: flex; align-items: flex-start; gap: .6rem; padding: .85rem 1rem;
  border-bottom: 1px solid var(--assistant-line); background: var(--assistant-shade-soft);
}
.statistics-analysis-head::after {
  content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px;
  background: var(--assistant-line-still); opacity: .35;
}
.statistics-analysis.is-working .statistics-analysis-head::after {
  background: var(--assistant-line-run) -70% 0 / 40% 100% no-repeat, color-mix(in srgb, var(--assistant) 12%, transparent); opacity: 1;
  animation: statistics-analysis-run 1.4s ease-in-out infinite;
}
@keyframes statistics-analysis-run { to { background-position: 170% 0, 0 0; } }
.statistics-analysis-star { flex: none; width: 1.1rem; height: 1.1rem; margin-top: .15rem; color: var(--assistant); }
.statistics-analysis-head > div { flex: 1; min-width: 0; }
/* .app-body .content-area h2[class] (0,3,1) darebbe ai titoli il colore delle intestazioni: qui quello dell'Assistente e degli elenchi. */
.app-body .content-area .statistics-analysis h2.statistics-analysis-title { margin: 0; color: var(--assistant-deep); font-size: var(--text-md); font-weight: 700; }
.statistics-analysis-head span { color: var(--ink-soft); font-size: var(--text-xs); }
.statistics-analysis-body { display: grid; gap: 1rem; padding: 1rem; }
/* Due per riga anche sul telefono (375 px), quattro su desktop. */
.statistics-analysis-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.25rem), 1fr)); gap: .6rem; }
.statistics-analysis-figure { display: grid; align-content: start; gap: .15rem; padding: .65rem .75rem; border-radius: var(--radius-md); background: var(--surface); min-width: 0; }
.statistics-analysis-figure > span:first-child { color: var(--ink-soft); font-size: var(--text-xs); }
.statistics-analysis-figure > strong { font-size: var(--text-xl); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.statistics-analysis-change { font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.statistics-analysis-change.is-up, .statistics-analysis-number.is-up { color: var(--trend-up); }
.statistics-analysis-change.is-down, .statistics-analysis-number.is-down { color: var(--trend-down); }
.statistics-analysis-change.is-same { color: var(--ink-soft); }
.statistics-analysis-arrow { display: inline-block; width: .75rem; height: .75rem; vertical-align: -.05em; }
.statistics-analysis-mark { display: inline-block; width: .75rem; text-align: center; font-weight: 800; }
.statistics-analysis-before { color: var(--ink-soft); font-size: var(--text-xs); font-weight: 400; }
.statistics-analysis-kicker { margin: 0; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
/* I paragrafi del CMS sono grigi (p { color: var(--ink-soft) }): la frase dell'andamento ha il colore del testo. */
.statistics-analysis-headline { margin: .15rem 0 .25rem; color: var(--ink); font-size: var(--text-md); font-weight: 700; }
/* Sintesi e righe dei numeri nel colore del testo (27/11, richiesta dell'utente): si leggono per intero, non sono note. */
.statistics-analysis-summary { margin: 0; color: var(--ink); }
.statistics-analysis-number { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.statistics-analysis-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .75rem; }
/* I tre elenchi con il bordo del loro colore (27/11): verde, rosso, arancione; più spesso in alto. */
.statistics-analysis-list {
  min-width: 0; padding: .75rem .85rem; border: 1px solid var(--line); border-top-width: 3px;
  border-radius: var(--radius-md); background: var(--paper);
}
.app-body .content-area .statistics-analysis-list h3 { margin: 0 0 .55rem; font-size: var(--text-sm); font-weight: 700; }
.statistics-analysis-list.is-up { border-color: var(--trend-up); }
.app-body .content-area .statistics-analysis-list.is-up h3 { color: var(--trend-up); }
.statistics-analysis-list.is-down { border-color: var(--trend-down); }
.app-body .content-area .statistics-analysis-list.is-down h3 { color: var(--trend-down); }
.statistics-analysis-list.is-watch { border-color: var(--attention); }
.app-body .content-area .statistics-analysis-list.is-watch h3 { color: var(--attention-ink); }
.statistics-analysis-list ul { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.statistics-analysis-list li { display: grid; gap: .1rem; }
.statistics-analysis-point { font-weight: 600; }
.statistics-analysis-list li > span { color: var(--ink); font-size: var(--text-sm); }
.statistics-analysis-meta {
  margin: 0; padding-top: .75rem; border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: var(--text-xs); font-variant-numeric: tabular-nums;
}
.statistics-analysis-status { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--ink-soft); font-size: var(--text-sm); }
.statistics-analysis-status > svg { flex: none; width: 1rem; height: 1rem; color: var(--assistant); }
/* Dove arriverà l'analisi, righe che luccicano nella forma della sintesi e dei tre elenchi, come nell'Assistente. */
.statistics-analysis-skeleton { display: grid; gap: .5rem; }
.statistics-analysis-skeleton > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .75rem; margin-top: .35rem; }
.statistics-analysis-skeleton > div > div { display: grid; gap: .5rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-md); }
.statistics-analysis-skeleton span {
  display: block; height: .6rem; border-radius: 999px;
  background: linear-gradient(90deg, var(--assistant-soft) 0, color-mix(in srgb, var(--assistant) 22%, var(--paper)) 40%, var(--assistant-soft) 80%) 0 0 / 28rem 100%;
  animation: statistics-analysis-shimmer 1.3s linear infinite;
}
@keyframes statistics-analysis-shimmer { from { background-position: -14rem 0; } to { background-position: 14rem 0; } }
@media (prefers-reduced-motion: reduce) {
  .statistics-analysis.is-working .statistics-analysis-head::after, .statistics-analysis-skeleton span { animation: none; }
}
.network-tile-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: .75rem;
}
.network-tile {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-width: 0; padding: .9rem; border: 1px solid var(--line); border-radius: .6rem;
  background: color-mix(in srgb, var(--primary) 4%, var(--paper));
  color: var(--ink); text-decoration: none;
  transition: border-color .16s ease, background-color .16s ease;
}
.network-tile:hover, .network-tile:focus-visible {
  border-color: var(--primary); color: var(--ink);
  background: color-mix(in srgb, var(--primary) 9%, var(--paper));
}
.network-tile:not([href]) { cursor: default; }
.network-tile:not([href]):hover { border-color: var(--line); }
.network-tile-identity { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.network-tile-identity .portal-tile { flex: 0 0 auto; }
.network-tile-name { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
/* The figures column is anchored to the tile's right edge: label, value and change pill share the same right margin. */
.network-tile-stat { flex: 0 0 auto; min-width: 7.5rem; align-items: flex-end; text-align: right; }
.network-tile .sessions-val { font-size: var(--text-xl); justify-content: flex-end; }
.network-tile .sessions-label { display: block; font-size: var(--text-xs); }
.network-tile .analytics-delta { margin-top: .3rem; }
@media (max-width: 767.98px) {
  /* Under the top bar, as wide as the screen allows: the bell stands too far left for the box to open from it. */
  .push-help { position: fixed; top: 4.35rem; right: 1rem; }
  .app-body .portal-dashboard-heading .page-heading-actions { align-self: flex-end; }
  .page-heading-main .portal-tile-lg { width: 2.25rem; height: 2.25rem; flex-basis: 2.25rem; font-size: var(--monogram-md); }
  .internal-page-heading:has(.page-heading-status) .page-heading-actions > .notes-add-button {
    flex: 0 0 auto; width: auto; min-height: 2rem; padding: .2rem .5rem;
    font-size: var(--text-xs); white-space: nowrap;
  }
  .notes-add-label-desktop { display: none; }
  .notes-add-label-mobile { display: inline; }

  .dashboard-activity-card { padding: .85rem !important; }
  .dashboard-stats-card .analytics-preview-grid { gap: .85rem; }
  /* No outer card since 8/11: each source keeps its own block on the phone too. */
  .dashboard-stats-card .analytics-preview-source { padding: .85rem; }
  .dashboard-stats-card .analytics-preview-periods {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem;
  }
  .dashboard-stats-card .analytics-preview-period + .analytics-preview-period {
    border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 1rem;
  }
  .dashboard-stats-card .analytics-preview-source.dashboard-facebook { margin-top: .75rem; }
  .dashboard-stats-card .analytics-preview-measures { grid-template-columns: minmax(0, 1fr); gap: .45rem; }
  .dashboard-stats-card .analytics-preview-secondary { display: none; }

  .dashboard-facebook .analytics-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem;
  }
  .dashboard-facebook .analytics-panel,
  .dashboard-facebook .analytics-panel + .analytics-panel {
    border: 0; margin: 0; padding: .2rem 0;
  }
  .dashboard-facebook .analytics-metric + .analytics-metric { margin-top: .45rem; padding-top: .45rem; }

  /* Pagine Statistiche: un solo bordo per sezione, senza schede annidate. */
  .analytics-chart-card, .analytics-detail-card { margin-bottom: 1rem !important; }
  .analytics-chart-card { --chart-inset: .75rem; }
  .analytics-chart-card > h2 { margin-bottom: .6rem; }
  .analytics-filters { border: 0; border-radius: 0; padding: 0; background: transparent; gap: .55rem; }
  .analytics-filters label { gap: .2rem; }
  .analytics-chart-card .empty-state-box { border: 0; padding: 1rem 0; }
  .analytics-breakdown > h2 { margin-bottom: .65rem !important; }
  .analytics-detail-card { padding: .85rem !important; }
  .analytics-detail-card > h3.mb-3 { margin-bottom: .65rem !important; }
  .analytics-detail-card .analytics-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem .6rem;
  }
  .analytics-detail-card .analytics-panel-week,
  .analytics-detail-card .analytics-week-cell { display: none; }
  .analytics-detail-card .analytics-panel {
    min-width: 0; border: 0; border-radius: 0; padding: 0; background: transparent;
  }
  .analytics-detail-card .sessions-val { font-size: var(--text-lg); flex-wrap: wrap; }
  .analytics-detail-card .sessions-val strong { min-width: 0; overflow-wrap: anywhere; }
  .analytics-detail-card .analytics-metric { border: 0; padding: .35rem 0; }
  .analytics-detail-card .network-tile-grid { gap: .3rem; }
  .analytics-detail-card .network-tile {
    border: 0; border-radius: 0; padding: .35rem 0; background: transparent;
  }
  .analytics-detail-card .table-responsive,
  .analytics-chart-card .table-responsive { border: 0; border-radius: 0; }
  .analytics-detail-card .analytics-network-table th,
  .analytics-detail-card .analytics-network-table td { padding: .5rem .35rem; }
}
@media (max-width: 360px) {
  .network-tile { flex-wrap: wrap; }
  .network-tile-stat { width: 100%; padding-left: 3rem; }
}
/* iOS ingrandisce automaticamente i controlli con testo inferiore a 16px al focus. */
@media (max-width: 767.98px) {
  input:not(:is([type="checkbox"], [type="radio"], [type="file"], [type="hidden"],
    [type="color"], [type="range"], [type="submit"], [type="button"], [type="reset"])),
  select,
  textarea { font-size: var(--text-lg) !important; }
}
/* Keep the internal hierarchy above Bootstrap sizes and analytics-specific labels. */
.app-body .content-area h2,
.app-body .content-area h2[class] {
  color: var(--heading-ink); font-size: var(--text-xl); font-weight: 650; line-height: 1.35; letter-spacing: -.015em;
}
.app-body .content-area h3,
.app-body .content-area h3[class] {
  color: var(--heading-ink); font-size: var(--text-md); font-weight: 650;
}

/* Indicatore descrittivo, senza avanzamento automatico o azioni cliccabili.
   Variabili locali: i colori richiesti non cambiano la palette degli altri moduli. */
html .app-body .form-steps {
  --ink: var(--heading-ink);
  --ink-soft: var(--heading-muted);
  --line: var(--heading-line);
  --surface-muted: #f7f9fc;
  --action-bg: #245f91;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}
html[data-theme="dark"] .app-body .form-steps {
  --surface-muted: #2b3037;
  --action-bg: #2f6c9b;
}
html .app-body .form-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
}
html .app-body .form-step-number {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}
html .app-body .form-steps [aria-current="step"] {
  color: var(--ink);
  font-weight: 600;
}
html .app-body .form-steps [aria-current="step"] .form-step-number {
  color: var(--on-accent);
  background: var(--action-bg);
  border-color: var(--action-bg);
}

/* The notes look like post-its: full yellow with dark ink (the warning box has the same), in the dark theme a dimmer
   yellow so it does not dazzle;
   the urgent ones stay red. */
.note-item {
    --note-surface: #ffe98a;
    --note-border: #e3c445;
    --note-ink: #4a3c05;
    border-color: var(--note-border);
    color: var(--note-ink);
    box-shadow: none;
}
.note-urgent {
    --note-surface: var(--urgent-surface);
    --note-border: var(--urgent-border);
    --note-ink: var(--on-accent);
}
html[data-theme="dark"] .note-item:not(.note-urgent) {
    --note-surface: #e4d78f;
    --note-border: #c7b45a;
    --note-ink: #352c05;
}
.note-item .note-author,
.note-item .note-body,
.note-item .note-expand-btn,
.note-item .note-delete-btn,
.note-item .note-urgent-icon {
    color: var(--note-ink);
}
.note-item .note-tag {
    border-color: var(--note-border);
    background: rgba(255, 255, 255, .6);
    color: var(--note-ink);
}
.note-urgent .note-tag {
    border-color: rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .08);
}
.note-item .note-delete-btn:hover {
    background: color-mix(in srgb, var(--note-ink) 12%, transparent);
    color: var(--note-ink);
}

/* Portal create/edit: advanced settings grouped by purpose */
/* «Verifica cartella media»: a caution, neither passed nor failed, in the warning colour of each theme. */
.media-check-warning { color: var(--warning); }
/* What a saved portal keeps for life, read in a row at the top of the form: publisher, type, identifier. */
.portal-edit-facts { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: 0 0 .35rem; }
.portal-edit-facts dt { color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.portal-edit-facts dd { margin: 0; font-weight: 600; }
/* The colour across its column like the other fields, its code beside it. */
.portal-edit-color .form-control-color { flex: 1 1 auto; width: auto; min-width: 0; max-width: none; }
.portal-edit-color output { min-width: 6rem; justify-content: center; font-family: var(--font-mono); font-size: var(--text-sm); }
/* «Dati tecnici avanzati»: a panel of its own on the background of the page, closed by default, with what it holds
   under its title and «Mostra» / «Nascondi» beside the arrow. */
.portal-edit-advanced { margin-top: 1.75rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.portal-edit-advanced > summary { padding: .9rem 1.1rem; gap: .75rem; }
.portal-edit-advanced-title { display: grid; gap: .15rem; min-width: 0; }
.portal-edit-advanced-title small { color: var(--ink-soft); font-size: var(--text-xs); }
.portal-edit-advanced-toggle { margin-left: auto; color: var(--primary); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.portal-edit-advanced-toggle::before { content: "Mostra"; }
.portal-edit-advanced[open] .portal-edit-advanced-toggle::before { content: "Nascondi"; }
.portal-edit-advanced > summary::after { margin-left: 0; }
.portal-edit-advanced[open] > summary { border-bottom: 1px solid var(--line); }
.portal-edit-advanced-body { padding: 1rem 1.1rem 1.25rem; }
.portal-edit-group { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
/* Condivisione su Facebook e Instagram (9/11): pannelli che si chiudono, stato a destra del titolo sempre visibile, riepilogo sotto, poi gruppi separati dalla linea. */
details.social-share > summary { align-items: flex-start; gap: .75rem; }
details.social-share > summary::after { margin: .5rem 0 0; }
.social-share > summary > .social-share-head { flex: 1 1 auto; min-width: 0; }
.social-share-toggle { margin-top: .2rem; color: var(--primary); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.social-share-toggle::before { content: "Mostra"; }
.social-share[open] .social-share-toggle::before { content: "Nascondi"; }
.social-share-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem 1rem; }
.social-share-head > div { min-width: 0; flex: 1 1 18rem; }
.social-share-state { margin-top: .2rem; font-size: var(--text-sm); font-weight: 600; }
.social-share-stats { margin: .75rem 0 0; color: var(--ink-soft); font-size: var(--text-sm); }
.social-share > .alert { margin: .75rem 0 0; }
.social-share fieldset.portal-edit-group > legend { float: none; margin-bottom: .5rem; }
.social-share legend.h6 { font-size: var(--text-md); font-weight: 650; }
.social-share .city-editor-bar { margin-top: 1.5rem; }
.portal-edit-form .field-validation-error { display: block; margin-top: .25rem; font-size: var(--text-xs); }
.portal-edit-form input[readonly] { background-color: var(--surface); }

/* Dashboard portale: niente linea tra intestazione e pannello stato; azioni a capo senza overflow. */
.app-body .internal-page-heading.portal-dashboard-heading{flex-wrap:wrap;padding-bottom:0;margin-bottom:16px;border-bottom:0}
.app-body .portal-dashboard-heading .page-heading-actions{flex:0 1 auto;gap:8px}
.app-body .portal-dashboard-heading .portal-header-action svg{flex-shrink:0}
@media (max-width: 767.98px){.app-body .portal-dashboard-heading .page-heading-actions{flex-basis:100%;justify-content:flex-start}}

/* Dashboard portale, telefoni: tre azioni d'intestazione con la stessa misura. */
@media (max-width: 767.98px) {
  .app-body .internal-page-heading.portal-dashboard-heading .page-heading-actions > .btn.btn {
    flex: 0 0 auto; width: auto; min-height: 2.25rem; padding: .3rem .7rem;
    font-size: var(--text-sm); line-height: 1.05; white-space: nowrap;
  }
  .app-body .internal-page-heading.portal-dashboard-heading .page-heading-actions > .btn.btn:not(.btn-sm) {
    min-height: 2.1rem; padding: .25rem .6rem;
  }
}
/* Statistiche dashboard: titoli fonte uniformi e spaziatura verticale uguale tra le fonti. */
.app-body .dashboard-stats-card .analytics-preview-source > .analytics-source-title {
  font-size: var(--text-md); font-weight: 650; line-height: 1.3;
}
@media (max-width: 767.98px) {
  .dashboard-stats-card .analytics-preview-grid { gap: .75rem; }
  .dashboard-stats-card .analytics-preview-source.dashboard-facebook { margin-top: 0; }
}

/* Selettore portali (popup), telefoni: due colonne, nomi lunghi troncati su una riga. */
@media (max-width: 767.98px) {
  html { min-width: 0; }
  .topbar { gap: .5rem; }
  .topbar-leading { flex: 1 1 0; gap: .5rem; }
  .topbar-leading > .menu-toggle { flex: 0 0 auto; }
  .topbar-leading > .portal-switcher { flex: 0 1 auto; min-width: 0; max-width: 45vw; }
  .portal-switcher-button { width: auto; max-width: 100%; min-width: 0; }
  .topbar .account-menu { flex: 0 0 auto; gap: .5rem; }
  .portal-switcher .dropdown-menu {
    width: min(32rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 5.5rem); overflow-y: auto; overscroll-behavior: contain;
  }
  /* On a phone it hangs from the window, under the bar: it cannot stick out on the right and widen the page. */
  .portal-switcher .dropdown-menu[data-bs-popper="static"] { position: fixed; top: 4.35rem; left: 1rem; right: 1rem; width: auto; }
  .portal-switcher-search { position: sticky; z-index: 2; top: 0; }
  .portal-switcher-options { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-switcher-item { align-items: center; gap: .4rem; padding-inline: .55rem; }
  .portal-switcher-item > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; line-height: 1.3; }
}
@media (max-width: 370px) {
  .topbar { padding-inline: .5rem; }
  .topbar-leading, .topbar .account-menu { gap: .35rem; }
  .portal-switcher-button { padding-inline: .4rem; gap: .3rem; }
}

/* Schede (nav-tabs, mon-tabs) su telefono: lo stesso binario segmentato, a tutta larghezza in due colonne, con le
   etichette centrate. Colori e pillola attiva vengono dalle regole di base.
   Opt-out: html[data-mobile-tabs="legacy"] lascia il binario in riga come su desktop. */
@media (max-width: 767.98px) {
  html:not([data-mobile-tabs="legacy"]) .nav-tabs,
  html:not([data-mobile-tabs="legacy"]) .mon-tabs {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; overflow: visible; list-style: none;
  }
  html:not([data-mobile-tabs="legacy"]) .nav-tabs .nav-link,
  html:not([data-mobile-tabs="legacy"]) .mon-tabs .mon-tab {
    width: 100%; min-width: 0; min-height: 2.35rem; padding: .4rem .5rem; font-size: var(--text-sm);
    text-align: center; white-space: normal; overflow-wrap: anywhere;
  }
}

/* Console della home (Pages/Shared/_HomeConsole.cshtml): riquadri, schede d'impatto, cronologia e operatori dei
   portali City con scrittura. Etichette, tonalità delle letture e riquadri vengono da city.css. */
.home-console-portal-form { display: flex; align-items: stretch; }
.home-console-portal-form .form-select { width: auto; min-width: 11rem; min-height: 2.55rem; border-top-right-radius: 0; border-bottom-right-radius: 0; font-size: var(--text-sm); }
.home-console-portal-form .btn { margin-left: -1px; min-height: 2.55rem; border-top-left-radius: 0; border-bottom-left-radius: 0; font-size: var(--text-sm); font-weight: var(--button-font-weight); }
.home-console-tiles { margin-bottom: 1.25rem; }
.home-console-tiles .city-tile small { display: block; order: 1; }
/* auto-fill: the empty tracks stay, so one card is as wide as one of four, not the whole row. */
.home-console-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
/* A card takes six rows of the grid and shares them with the cards beside it (subgrid): portal, section, title, number,
   words and chart line up along the row. A title on two lines no longer pushes its number and chart below those of the
   other cards, and the chart, the last row, sits at the bottom of every card. */
.home-console-card { display: grid; grid-row: span 6; grid-template-columns: minmax(0, 1fr); grid-template-rows: subgrid; row-gap: .4rem; }
.home-console-card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.home-console-card-top .city-badge { margin: 0; }
.home-console-card .home-console-title { display: -webkit-box; align-self: start; overflow: hidden; font-size: var(--text-base); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
/* The number on a line of its own and the words under it, two rows of the card: the numbers of a row stay on one line
   however their words wrap. */
.home-console-card-figure { display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: .3rem; }
.home-console-card-figure strong { font-size: var(--text-2xl); font-weight: 700; line-height: 1; }
.home-console-card-labels { display: grid; align-content: start; gap: .1rem; }
.home-console-card-figure small { color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.35; }
.home-console-card .home-console-spark { align-self: end; width: 100%; height: 2.4rem; }
.home-console-warning { margin: 0 0 1rem; }
/* «Ultimi interventi» and «Operatori» side by side on wide screens, one under the other below. */
.home-console-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (min-width: 1100px) { .home-console-split { grid-template-columns: minmax(0, 1.7fr) minmax(19rem, 1fr); } }
.home-console-split > .home-console-panel { margin-bottom: 0; }
/* Dashboard del portale: campagne in scadenza o scadute da meno di 7 giorni (AdvDueCampaigns), striscia come
   Monitoraggio e SEO (8/11). Le regole sono qui e non in portal-positioning.css, che c'è solo con la SEO. */
.adv-due-strip { min-width: 0; margin-bottom: 1.5rem; }
.adv-due-strip .mon-table td { font-variant-numeric: tabular-nums; }
.adv-due-strip .mon-table td > strong, .adv-due-strip .mon-table td > .mon-status { font-size: var(--text-md); font-weight: 700; }
.adv-due-strip .mon-table th:nth-child(-n+2) { width: 22%; }
.adv-due-next { min-width: 0; }
.adv-due-next > a, .adv-due-next > dd > a { display: block; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.adv-due-strip .mon-meta { overflow-wrap: anywhere; }
.adv-due-title { min-width: 0; font-size: var(--text-md); font-weight: 600; }
.adv-due-strip .mon-pcard-dashboard .adv-due-next dd { font-size: var(--text-base); font-weight: 400; }
.home-console-panel h3 { margin-bottom: .15rem; }
.home-console-sub { margin: 0 0 .5rem; color: var(--ink-soft); font-size: var(--text-xs); }
.home-console-list, .home-console-people { margin: 0; padding: 0; list-style: none; }
.home-console-list > li { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; gap: .9rem; align-items: start; padding: .6rem 0; border-bottom: 1px solid var(--row-line); }
.home-console-people > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .65rem; align-items: start; padding: .6rem 0; border-bottom: 1px solid var(--row-line); }
.home-console-list > li:last-child, .home-console-people > li:last-child { border-bottom: 0; }
.home-console-list .home-console-thumb-wrap { width: 3.5rem; margin: 0; }
.home-console-people .home-console-text { gap: .3rem; }
.home-console-thumb { display: block; width: 3.5rem; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.home-console-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-console-thumb .city-contents-noimage { width: 100%; height: 100%; border: 0; }
.home-console-thumb.is-deleted { display: grid; place-items: center; color: var(--ink-faint); }
.home-console-thumb.is-deleted .city-icon { width: 1.1rem; height: 1.1rem; }
.home-console-text { display: grid; grid-template-columns: minmax(0, 1fr); gap: .2rem; min-width: 0; }
.home-console-title { display: block; color: var(--ink); font-size: var(--text-sm); font-weight: 600; line-height: 1.3; text-decoration: none; }
a.home-console-title:hover { color: var(--primary-deep); text-decoration: underline; }
/* «Ultimi interventi» (8/11): the titles are links as in the other panels of the dashboard, colour and underline. */
.app-body .home-console-list a.home-console-title { color: var(--primary-deep); text-decoration: underline; }
.app-body .home-console-list a.home-console-title:hover { color: var(--link-hover); }
/* What was done and when, then by whom: one line in a wide column, two in a narrow one (a phone, the side column of
   the home). A separator is glued to the word before it, so a line never starts with «·». */
.home-console-list { container-type: inline-size; }
.home-console-action { display: block; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.45; }
.home-console-action strong { color: var(--ink); font-weight: 600; }
.home-console-sep::before, .home-console-who::before { content: "\00a0· "; color: var(--ink-faint); }
@container (max-width: 30rem) {
  .home-console-what, .home-console-who { display: block; }
  .home-console-who::before { content: none; }
}
.home-console-line { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .4rem; color: var(--ink-soft); font-size: var(--text-xs); }
.home-console-portal { display: inline-flex; align-items: center; gap: .3rem; color: var(--ink); white-space: nowrap; }
/* In the lists of interventions the portal is one line, cut at its end when long (8/11: no place any more). */
.home-console-list .home-console-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-console-list .home-console-portal { display: inline; }
/* The portal leads to its dashboard, with no rollover: it reads as before. */
.app-body a.home-console-portal, .app-body a.home-console-portal:hover, .app-body a.home-console-portal:focus-visible { color: var(--ink); text-decoration: none; }
.app-body a.home-console-badge-tile, .app-body a.home-console-badge-tile:hover { color: var(--on-accent); text-decoration: none; }
/* In the cards of «Impatto sui portali»: the section of the content, right above its title. */
.home-console-category { display: block; margin: .15rem 0 -.3rem; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.2; }
.home-console-tile { width: 1.1rem; height: 1.1rem; flex-basis: 1.1rem; border-radius: .28rem; font-size: var(--monogram-xs); }
/* In the cards of «Impatto sui portali», as large as the tile on the pictures of «Ultimi interventi». */
.home-console-tile.is-large { width: 1.5rem; height: 1.5rem; flex-basis: 1.5rem; border-radius: .38rem; }
/* The readings of the content, with their word; the deeper the colour, the more read. */
.home-console-list .home-console-reads { display: grid; justify-items: end; min-width: 4.25rem; padding-top: .05rem; text-align: right; line-height: 1.15; font-weight: 400; }
.home-console-list .home-console-reads strong { color: var(--ink); font-size: var(--text-md); font-weight: 700; }
.home-console-list .home-console-reads.is-3 strong, .home-console-list .home-console-reads.is-4 strong { color: var(--primary-deep); }
.home-console-list .home-console-reads small { color: var(--ink-soft); font-size: var(--text-xs); }
.home-console-list .home-console-reads.is-off small { color: var(--ink-faint); }
/* The interventions of the period, with their word. */
.home-console-total { display: grid; justify-items: end; padding-top: .05rem; text-align: right; line-height: 1.1; }
.home-console-total strong { font-size: var(--text-xl); font-weight: 700; }
.home-console-total small { color: var(--ink-soft); font-size: var(--text-xs); }
/* The last 7 days: one column per day, the count above and the initial of the day under it, on every row. */
.home-console-heat { display: inline-grid; grid-template-columns: repeat(7, 1.6rem); gap: 3px; margin-top: .3rem; }
.home-console-day { display: grid; gap: .3rem; justify-items: stretch; }
.home-console-day > span { display: grid; place-items: center; height: 1.45rem; border-radius: .25rem; color: var(--primary-deep); font-size: var(--text-xs); font-weight: 600; }
.home-console-day > small { color: var(--ink-faint); font-size: var(--text-caps); line-height: 1; letter-spacing: .04em; text-align: center; text-transform: uppercase; }
.home-console-day.is-today > small { color: var(--primary); font-weight: 700; }
.home-console-day > .is-0 { background: var(--surface); color: var(--ink-faint); }
.home-console-day > .is-1 { background: color-mix(in srgb, var(--primary-deep) 12%, var(--paper)); }
.home-console-day > .is-2 { background: color-mix(in srgb, var(--primary-deep) 24%, var(--paper)); }
.home-console-day > .is-3 { background: color-mix(in srgb, var(--primary-deep) 45%, var(--paper)); color: var(--ink); }
.home-console-day > .is-4 { background: var(--primary-deep); color: var(--paper); }
.home-console-day.is-today > span { outline: 2px solid var(--primary); outline-offset: -2px; }
.home-console-foot { margin: .6rem 0 0; color: var(--ink-soft); font-size: var(--text-xs); }
.home-console-spark { display: block; width: 4.5rem; height: 1.4rem; }
.home-console-spark rect { fill: color-mix(in srgb, var(--primary) 40%, var(--paper)); }
.home-console-spark rect.is-last { fill: var(--primary-deep); }
.home-console-impact { margin-bottom: 1rem; }
.home-console-impact .home-console-cards { margin-bottom: 0; }
/* The home comes back to its console after the portals are saved (#home-console): clear of the sticky top bar. */
.home-console { scroll-margin-top: 5.35rem; }
/* «Portali da mostrare»: a small box per portal, the name on one line; a chosen box takes the primary colour, a portal
   without data for now a dashed border. The boxes take the whole width of the panel, as many per row as fit; the
   notification settings keep their narrow column, and «Salva» its own width. */
.console-settings-form > .notification-settings-group { justify-self: stretch; }
.console-portals-tools { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-bottom: .5rem; font-size: var(--text-sm); }
.console-portals-count { color: var(--ink-soft); margin-right: auto; }
.console-portals { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr)); gap: .4rem; margin-bottom: .75rem; }
.console-portal {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  min-height: 2.5rem;
  padding: .35rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-sm);
  cursor: pointer;
}
.console-portal .form-check-input { flex: none; margin: 0; }
.console-portal .portal-tile { flex: none; }
.console-portal-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console-portal:hover { background: var(--surface-hover); }
.console-portal:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
.console-portal:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--paper)); }
.console-portal.is-empty { border-style: dashed; }
.console-portal.is-empty .console-portal-name { color: var(--ink-soft); }
@media (max-width: 767.98px) {
  .home-console-heat { grid-template-columns: repeat(7, 1.3rem); }
  .home-console-day > span { height: 1.25rem; }
}

/* Attività CMS: the family of each action at a glance, and the outcome as a LED with its word. */
.activity-action, .activity-result { display: inline-flex; align-items: center; gap: .45rem; }
.activity-kind { display: inline-grid; place-items: center; flex: none; width: 1.6rem; height: 1.6rem; border-radius: .4rem; background: var(--surface); color: var(--ink-soft); }
.activity-kind svg { width: .95rem; height: .95rem; }
.activity-kind.is-create { background: color-mix(in srgb, var(--success) 14%, var(--paper)); color: var(--success); }
.activity-kind.is-update { background: color-mix(in srgb, var(--primary) 14%, var(--paper)); color: var(--primary-deep); }
.activity-kind.is-publish { background: color-mix(in srgb, var(--success) 22%, var(--paper)); color: var(--success); }
.activity-kind.is-deactivate { background: color-mix(in srgb, var(--warning) 16%, var(--paper)); color: var(--warning); }
.activity-kind.is-delete, .activity-kind.is-problem { background: color-mix(in srgb, var(--danger) 14%, var(--paper)); color: var(--danger); }
.activity-kind.is-send, .activity-kind.is-export { background: color-mix(in srgb, var(--primary-light) 16%, var(--paper)); color: var(--primary); }
.activity-kind.is-security { background: color-mix(in srgb, var(--ink) 10%, var(--paper)); color: var(--ink); }

/* The console of the home and the pages of Attività CMS: interventions and operators as tables. */
.home-console-panel { margin-bottom: 1rem; }
/* Sideways only: overflow-x alone turns the vertical axis to auto, and a bar shows up on hover. */
.home-console-table-wrap { overflow-y: hidden; }
.home-console-table-wrap { margin: 0 -.25rem; }
.content-activity-list .home-console-table-wrap { margin: 0; }
.home-console-table th { color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.home-console-table td { font-size: var(--text-sm); }
.home-console-content { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.home-console-thumb-wrap { position: relative; flex: none; width: 3.5rem; margin: 0 .35rem .3rem 0; }
/* The tile of the portal on the picture, larger and a little out of it, bottom right. */
.home-console-badge-tile { position: absolute; right: -.5rem; bottom: -.4rem; width: 1.5rem; height: 1.5rem; flex-basis: 1.5rem; border: 2px solid var(--paper); border-radius: .38rem; font-size: var(--monogram-xs); }
.home-console-kind { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.home-console-saves { display: block; color: var(--ink-soft); font-size: var(--text-xs); }
.home-console-reads { font-weight: 700; }
.home-console-reads.is-3, .home-console-reads.is-4 { color: var(--primary-deep); }
.home-console-reads.is-off { color: var(--ink-faint); font-size: var(--text-xs); font-weight: 400; }
.home-console-person { display: inline-flex; align-items: center; gap: .5rem; }
.home-console-person .profile-avatar-sm { flex-basis: 1.75rem; width: 1.75rem; height: 1.75rem; font-size: var(--monogram-xs); }
.home-console-operators td.is-zero { color: var(--ink-faint); }
.home-console-total-cell strong { font-size: var(--text-md); }
/* Operators day by day: one row each, the name, the total and a square per day (per week beyond a month), darker
   with more interventions; the weeks stand apart, the dates head the Mondays. On phones the squares go under the name. */
.operator-strip-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem 1rem; margin-bottom: .15rem; }
.operator-strip-legend { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-soft); font-size: var(--text-xs); }
.operator-strip-legend .operator-strip-cell { width: .8rem; height: .8rem; }
.operator-strip-legend .operator-strip-cell:first-child { margin-left: .3rem; }
.operator-strip-legend .operator-strip-cell:last-child { margin-right: .3rem; }
/* clip: a date over the last columns may run past the squares, never past the card. */
.operator-strip { display: grid; gap: .35rem; margin-top: .5rem; overflow-x: clip; }
.operator-strip-row { display: grid; grid-template-columns: minmax(8rem, 13rem) 3rem auto; align-items: center; gap: .75rem; }
.operator-strip-row + .operator-strip-row:not(.operator-strip-head) { padding-top: .35rem; border-top: 1px solid var(--row-line); }
.operator-strip-head + .operator-strip-row { border-top: 0 !important; padding-top: 0 !important; }
.operator-strip-name { overflow: hidden; color: var(--ink); font-size: var(--text-sm); font-weight: 600; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
a.operator-strip-name:hover { color: var(--primary-deep); text-decoration: underline; }
.operator-strip-total { color: var(--ink); font-size: var(--text-sm); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.operator-strip-cells { display: grid; gap: 3px; align-items: end; }
.operator-strip-label { overflow: visible; color: var(--ink-faint); font-size: var(--text-xs); line-height: 1; white-space: nowrap; }
.operator-strip-cell { display: block; aspect-ratio: 1; border-radius: .2rem; background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 6%, transparent); }
.operator-strip-cell.is-1 { background: color-mix(in srgb, var(--primary-deep) 22%, var(--paper)); }
.operator-strip-cell.is-2 { background: color-mix(in srgb, var(--primary-deep) 42%, var(--paper)); }
.operator-strip-cell.is-3 { background: color-mix(in srgb, var(--primary-deep) 68%, var(--paper)); }
.operator-strip-cell.is-4 { background: var(--primary-deep); }
@media (max-width: 767.98px) {
  .operator-strip-row { grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .75rem; }
  .operator-strip-row > .operator-strip-cells { grid-column: 1 / -1; }
  .operator-strip-head > span:not(.operator-strip-cells) { display: none; }
  /* A month on a phone: thinner gaps, and the narrow squares grow into short bars, so they read as days, not dots. */
  .operator-strip-cells { gap: 2px; }
  .operator-strip-cells > .operator-strip-cell { aspect-ratio: auto; height: .9rem; border-radius: .12rem; }
}
@media (max-width: 767.98px) {
  .home-console-table-wrap { margin: 0; }
  .home-console-table > tbody > tr > td.home-console-reads-cell { text-align: left !important; }
}

/* Figure tiles (Contenuti, home console, Monitoraggio): a label on top, the value at the bottom; as links they filter. */
/* All the rows as tall as the tallest tile of the group, however the labels wrap. */
.city-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr));
  grid-auto-rows: 1fr;
  gap: .5rem;
  margin-bottom: 1rem;
}
.city-tile {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .5rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-card);
  text-decoration: none;
}
/* .app-body outranks the dark theme link colour (html[data-theme="dark"] a), as for .portal-tile. */
.app-body .city-tile,
.app-body .city-tile:hover { color: var(--ink); }
/* Label, then value, as in the BeNews KPI blocks (.sessions-label, .sessions-val): the label and its note from the top,
   the value at the bottom, level with the others of the row however long the labels are. */
.city-tile strong { order: 1; margin-top: auto; font-size: var(--text-xl); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.city-tile > span { order: -1; color: var(--ink-soft); font-size: var(--text-caps); font-weight: 500; line-height: 1.3; }
.city-tile small { color: var(--ink-soft); font-size: var(--text-caps); line-height: 1.3; }
.city-tile.is-warn strong { color: var(--warning); }
.city-tile:hover { border-color: var(--primary-light); }
.city-tile[aria-current="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-soft); }
.city-tile.is-bad strong { color: var(--danger); }
/* Monitoraggio: a tile filters the rows of its table in place; the message shows when a filter leaves none. */
.mon-tiles { margin-bottom: .85rem; }
.mon-filter-empty { margin: .5rem 0 1rem; }

/* «Il punto di ieri» (_YesterdayDigest, home-digest.js): a strip under the title, with the first points in a few words,
   and the panel with all of them under it. A plain border, as the cards. */
.digest-slot:empty { display: none; }
/* On the dashboard of a portal the strip keeps some air from the buttons of the heading. */
.portal-dashboard-heading + .digest-slot:not(:empty) { padding-top: 8px; }
.digest-strip {
  display: flex; align-items: center; gap: .75rem; margin: 0 0 1.5rem; padding: .45rem .5rem .45rem .85rem;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); font-size: var(--text-sm);
}
.digest-strip-day { flex: none; color: var(--ink); font-weight: 700; }
.digest-strip-quiet { color: var(--ink-soft); }
/* One line: the points that do not fit whole go to a second line, which is hidden (they are in the panel); only the
   first is cut, when alone it does not fit. */
.digest-strip-items { display: flex; flex-wrap: wrap; column-gap: 1.1rem; min-width: 0; height: 1.5rem; overflow: hidden; }
.digest-strip-item { display: inline-flex; align-items: center; gap: .35rem; flex: 0 0 auto; max-width: 100%; height: 1.5rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.digest-strip-item > span { overflow: hidden; text-overflow: ellipsis; }
.digest-strip-item:hover > span { text-decoration: underline; }
.digest-strip-item svg { flex: none; width: 1rem; height: 1rem; }
.digest-strip-item.is-up svg { color: var(--success); }
.digest-strip-item.is-down svg { color: var(--danger); }
.digest-strip-item.is-star svg { color: var(--highlight-edge); }
.digest-strip-item.is-info svg { color: var(--primary); }
.digest-strip-item.is-warn svg { color: var(--warning); }
.digest-strip-all { display: inline-flex; align-items: center; gap: .25rem; flex: none; margin-left: auto; padding: .15rem .4rem; font-weight: 600; text-decoration: none; }
.digest-strip-all svg { width: .9rem; height: .9rem; transition: transform .15s ease; }
.digest-strip-all[aria-expanded="true"] svg { transform: rotate(180deg); }
/* The strip and its panel keep the space and the corners of the cards around them. */
.digest-panel { margin: -1rem 0 1.5rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); box-shadow: var(--shadow-raised); }
.digest-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; padding: .75rem 1rem .55rem; border-bottom: 1px solid var(--row-line); }
.digest-head strong { font-size: var(--text-base); }
.digest-head small, .digest-empty { color: var(--ink-soft); }
.digest-empty { margin: 0; padding: .75rem 1rem; font-size: var(--text-sm); }
.digest-list { list-style: none; margin: 0; padding: .25rem 0; }
.digest-item { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .75rem; align-items: start; padding: .6rem 1rem; }
.digest-item + .digest-item { border-top: 1px solid var(--row-line); }
.digest-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .5rem; }
.digest-icon svg { width: 1.05rem; height: 1.05rem; }
.digest-item.is-up .digest-icon { background: color-mix(in srgb, var(--success) 14%, var(--paper)); color: var(--success); }
.digest-item.is-down .digest-icon { background: color-mix(in srgb, var(--danger) 12%, var(--paper)); color: var(--danger); }
.digest-item.is-star .digest-icon { background: color-mix(in srgb, var(--highlight-bg) 70%, var(--paper)); color: var(--highlight-edge); }
.digest-item.is-info .digest-icon { background: color-mix(in srgb, var(--primary) 12%, var(--paper)); color: var(--primary-deep); }
.digest-item.is-warn .digest-icon { background: color-mix(in srgb, var(--warning) 14%, var(--paper)); color: var(--warning); }
.digest-text { font-size: var(--text-sm); line-height: 1.4; }
.digest-text b { font-weight: 700; }
.digest-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .4rem; margin-top: .2rem; color: var(--ink-soft); font-size: var(--text-xs); }
.digest-meta .portal-tile { width: 1.1rem; height: 1.1rem; flex-basis: 1.1rem; border-radius: .28rem; font-size: var(--monogram-xs); }
.digest-go { font-size: var(--text-xs); font-weight: 600; white-space: nowrap; text-decoration: none; }
.digest-more > summary { padding: .45rem 1rem; color: var(--ink-soft); font-size: var(--text-sm); cursor: pointer; border-top: 1px solid var(--row-line); }
.digest-foot { padding: .55rem 1rem .7rem; border-top: 1px solid var(--row-line); color: var(--ink-soft); font-size: var(--text-xs); }
@media (max-width: 575.98px) {
  .digest-item { grid-template-columns: 2rem minmax(0, 1fr); }
  .digest-go { grid-column: 2; }
}

/* ======================================================================
   Menu laterale (8/11/2026): misure, pesi e movimenti presi dall'admin di Shopify, con i nostri colori.
   Menu 220 px (60 da chiuso), righe 30 px senza spazio, testo 13/20 px peso 450 (500 la voce attiva),
   icone 16 px dal tratto sottile; sul telefono righe da 40 px. Queste regole stanno in fondo apposta:
   sostituiscono le misure precedenti del menu definite più su. Animazioni e scorciatoia: js/sidebar-motion.js.
   ====================================================================== */
/* Valori comuni del menu laterale. */
:root {
  --nav-ease: cubic-bezier(.2, .8, 0, 1);         /* la curva di Shopify: parte svelta, si posa piano */
  --nav-fill-hover: rgba(255, 255, 255, .055);
  --nav-fill-active: rgba(255, 255, 255, .10);
  --nav-sub-ink: color-mix(in srgb, var(--sidebar-accent) 72%, var(--sidebar));
  --nav-icon-x: 10px;                              /* rientro dell'icona nella pillola: centrata anche a menu chiuso */
}

/* ---------- Caratteri: pesi leggeri e resa sottile, come Shopify ---------- */
.app-sidebar,
.side-menu-flyout,
.sidebar-shortcut-tip {
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.side-link { font-weight: 450; letter-spacing: -.01em; }
.side-link.active { font-weight: 500; }
.side-submenu-link { font-weight: 450; letter-spacing: -.01em; }
.app-sidebar .side-submenu-link { color: var(--nav-sub-ink); }
.app-sidebar .side-submenu-link.active { font-weight: 450; color: var(--on-accent); }

/* Icone dal tratto sottile (1,6 invece di 2). */
:is(.app-sidebar, .side-menu-flyout) .nav-icon { stroke-width: 1.6; }

/* Il tasto destro non seleziona più il nome della voce (sul Mac evidenziava la parola). */
.app-sidebar :is(a, button) { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.app-sidebar :is(a, button):focus:not(:focus-visible) { outline: none; box-shadow: none; }

/* ---------- Voci: pillola chiara al passaggio del mouse e sulla voce attiva ---------- */
.side-link,
.side-submenu-link,
.side-menu-flyout-link {
  transition: background-color .15s cubic-bezier(.25, .1, .25, 1), color .15s ease;
}
.app-sidebar :is(.side-link, .side-submenu-link):is(:hover, :focus-visible) { background: var(--nav-fill-hover); }
.app-sidebar :is(.side-link, .side-submenu-link).active { background: var(--nav-fill-active); }
.side-link.has-active-child:not(.active) { background: transparent; }

/* La freccia del gruppo compare solo sopra la riga, come le azioni di Shopify. */
:is(.side-submenu-toggle, .side-menu-group-toggle)::after {
  width: .36rem; height: .36rem; opacity: 0; transition: transform .25s var(--nav-ease), opacity .15s ease;
}
.side-menu-group:is(:hover, :focus-within) :is(.side-submenu-toggle, .side-menu-group-toggle)::after { opacity: .75; }
.side-submenu-toggle:hover { background: var(--nav-fill-hover); }
/* Gruppo senza pagina propria: la freccia non tocca il bordo della pillola. */
.side-menu-group-toggle { padding-right: 12px !important; }

/* ---------- Contatori (Notifiche, Dashboard, Contenuti, Pubblicità): quadratino grigio 16 px, rosso se importante (Dashboard sempre, 9/11), arancione se è un avviso ---------- */
.side-badge {
  min-width: 1rem; height: 1rem; padding: 0 .25rem; border-radius: .3125rem;
  background: rgba(255, 255, 255, .14); color: var(--sidebar-text);
  font-size: var(--text-xs); font-weight: 500; line-height: 1rem; letter-spacing: 0;
}
.side-badge.is-important { background: var(--sidebar-badge-danger); color: var(--on-accent); }
.side-badge.is-warning { background: var(--sidebar-badge-warning); color: var(--on-accent); }

/* ---------- Sottomenu: testo allineato a quello della voce madre, nessuna linea ---------- */
/* Da chiuso resta nel flusso ad altezza zero, così si apre e si chiude scorrendo (js/sidebar-motion.js). */
.side-submenu { margin: 0; padding: 0; border-left: 0; overflow: hidden; }
.side-submenu[hidden] { display: block; height: 0; visibility: hidden; }
.side-submenu > li:last-child { padding-bottom: .375rem; }

/* ---------- Logo allineato alle icone ---------- */
/* Il disegno è largo 280 punti e l'icona ne occupa i primi 68 (1/12, loghi BeNews e BeApp): a menu chiuso si vede solo quello,
   alla stessa grandezza, perché il riquadro si stringe sopra l'immagine senza ridimensionarla. */
:root { --nav-logo: 9rem; }
.sidebar-brand { padding: 0 .75rem 0 1.25rem; }
.sidebar-brand-logo { width: var(--nav-logo); transition: width .25s var(--nav-ease); }
.sidebar-brand-logo .brand-logo { width: var(--nav-logo); }

/* ---------- Barra di scorrimento: binario 10 px, cursore 4 px arrotondato, compare e svanisce in 150 ms ---------- */
@property --nav-thumb { syntax: "<color>"; inherits: true; initial-value: transparent; }
:is(.app-sidebar, .sidebar-nav) {
  scrollbar-width: auto; scrollbar-color: auto;
  --nav-thumb: transparent; transition: --nav-thumb .15s cubic-bezier(.42, 0, .58, 1);
}
:is(.app-sidebar, .sidebar-nav):is(:hover, :focus-within, .is-scrolling) { --nav-thumb: rgba(255, 255, 255, .28); }
:is(.app-sidebar, .sidebar-nav)::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
:is(.app-sidebar, .sidebar-nav)::-webkit-scrollbar-track,
:is(.app-sidebar, .sidebar-nav)::-webkit-scrollbar-corner { background: transparent; }
:is(.app-sidebar, .sidebar-nav)::-webkit-scrollbar-thumb {
  border: 3px solid transparent; border-radius: 999px; background-clip: content-box; background-color: var(--nav-thumb);
}
:is(.app-sidebar, .sidebar-nav)::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .45); }
@supports not selector(::-webkit-scrollbar) {
  :is(.app-sidebar, .sidebar-nav) { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  :is(.app-sidebar, .sidebar-nav):is(:hover, :focus-within, .is-scrolling) { scrollbar-color: rgba(255,255,255,.28) transparent; }
}

/* ---------- Finestra delle sottovoci a menu chiuso ---------- */
.side-menu-flyout {
  padding: .375rem; border-radius: .75rem; border-color: rgba(255, 255, 255, .1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.side-menu-flyout:not([hidden]) { animation: sidebar-fade .15s cubic-bezier(.25, .1, .25, 1); }
.side-menu-flyout :is(.side-menu-flyout-link, .side-menu-flyout-title) {
  min-height: 1.75rem; padding: 5px 8px; border-radius: .625rem; font-size: var(--text-sm); line-height: 1.125rem;
}
.side-menu-flyout-link { font-weight: 450; }
.side-menu-flyout-link:is(:hover, :focus-visible) { background: var(--nav-fill-hover); }
.side-menu-flyout-link.active { background: var(--nav-fill-active); font-weight: 450; }
.side-menu-flyout :is(.side-menu-flyout-link--primary, .side-menu-flyout-title) { font-weight: 500; }
@keyframes sidebar-fade { from { opacity: 0; } }

/* ---------- Suggerimento del pulsante che chiude e apre il menu: colori del menu, scorciatoia ⌘B / Ctrl+B ---------- */
.sidebar-shortcut-tip {
  position: fixed; z-index: 1100; display: flex; align-items: center; gap: 8px;
  padding: 5px 5px 5px 9px; border: 1px solid rgba(255, 255, 255, .12); border-radius: .5rem;
  background: var(--sidebar); color: var(--sidebar-text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28); font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 450; line-height: 1.25rem; letter-spacing: -.01em;
  white-space: nowrap; pointer-events: none; animation: sidebar-fade .12s ease;
}
.sidebar-shortcut-tip[hidden] { display: none; }
.sidebar-shortcut-tip kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 5px;
  background: rgba(255, 255, 255, .1); color: var(--sidebar-text); box-shadow: none; font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 500; line-height: 1;
}
.sidebar-shortcut-tip .sidebar-shortcut-keys { display: flex; gap: 2px; }

/* ---------- Righe e allineamenti, a ogni larghezza ---------- */
.sidebar-nav { padding: .5rem .75rem .75rem; }
.nav-label { padding: .85rem .625rem .3rem; white-space: nowrap; overflow: hidden; }
.side-link {
  margin: 0; padding: 5px 8px 5px var(--nav-icon-x); border-radius: .625rem;
  white-space: nowrap; overflow: hidden;
}
.side-link > span:not(.side-badge):not(.portal-tile) { overflow: hidden; text-overflow: ellipsis; transition: opacity .2s var(--nav-ease); }
.side-link .nav-icon { width: 1rem; height: 1rem; min-width: 1rem; margin-right: .625rem !important; }
.side-submenu-toggle { flex: 0 0 1.75rem; width: 1.75rem; height: 1.75rem; border-radius: .5rem; }
/* Il testo delle sottovoci parte dove parte quello della voce madre: rientro + icona 16 + spazio 10. */
.side-submenu-link {
  margin: 0; padding: 5px 8px 5px calc(var(--nav-icon-x) + 26px); border-radius: .625rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-submenu-link--nested { padding-left: calc(var(--nav-icon-x) + 38px); }
.sidebar-bottom { padding: .5rem .75rem .75rem; }

/* ---------- Da 768 px in su: misure di Shopify ---------- */
@media (min-width: 768px) {
  .app-sidebar { width: 13.75rem; overflow-x: hidden; transition: transform .25s var(--nav-ease), width .25s var(--nav-ease); }
  .app-main { margin-left: 13.75rem; transition: margin-left .25s var(--nav-ease); }
  body.sidebar-collapsed .app-sidebar { width: 3.75rem; }
  body.sidebar-collapsed .app-main { margin-left: 3.75rem; }

  .side-link,
  .side-submenu-link { min-height: 1.875rem; font-size: var(--text-sm); line-height: 1.25rem; }

  /* Menu chiuso: le icone restano dove sono, centrate nella pillola, e il menu si stringe sopra il testo. */
  body.sidebar-collapsed .sidebar-nav,
  body.sidebar-collapsed .sidebar-bottom { padding-left: .75rem; padding-right: .75rem; }
  body.sidebar-collapsed .nav-label { height: auto; padding: .85rem .625rem .3rem; margin: 0; opacity: 0; }
  body.sidebar-collapsed .side-link {
    width: auto; padding: 5px 8px 5px var(--nav-icon-x); margin: 0; justify-content: flex-start;
  }
  body.sidebar-collapsed .side-link > span:not(.side-badge):not(.portal-tile) { display: inline; opacity: 0; }
  body.sidebar-collapsed .side-menu-heading { justify-content: flex-start; }
  body.sidebar-collapsed .side-menu-heading > .side-link { flex: 1 1 auto; }
  body.sidebar-collapsed .side-link span.side-badge { top: 4px; left: 25px; right: auto; width: 7px; height: 7px; padding: 0; border-radius: 50%; }
  body.sidebar-collapsed .side-submenu,
  body.sidebar-collapsed .side-submenu[hidden] { display: none; }
  body.sidebar-collapsed .sidebar-brand { padding: 0; }
  /* 1/12: the logos of BeNews and BeApp are 280 points wide and the icon fills the first 68. */
  body.sidebar-collapsed .sidebar-brand-logo { width: calc(var(--nav-logo) * 68 / 280); }
}

/* ---------- Telefono: stesso disegno, righe alte un dito (40 px), cassetto più stretto e scorrevole ---------- */
@media (max-width: 767.98px) {
  .app-sidebar {
    width: min(15rem, calc(100vw - 3.25rem));
    transition: transform .3s var(--nav-ease);
  }
  body.nav-open .app-sidebar { box-shadow: 8px 0 28px rgba(0, 0, 0, .3); }
  body.nav-open .sidebar-backdrop { animation: sidebar-fade .25s ease; }
  .side-link { min-height: 2.5rem; padding-top: 10px; padding-bottom: 10px; font-size: var(--text-base); line-height: 1.25rem; }
  .side-submenu-link { min-height: 2.25rem; padding-top: 8px; padding-bottom: 8px; font-size: var(--text-base); line-height: 1.25rem; }
  .side-submenu-toggle { flex-basis: 2.25rem; width: 2.25rem; height: 2.25rem; }
  /* Senza mouse la freccia resta sempre visibile. */
  :is(.side-submenu-toggle, .side-menu-group-toggle)::after { opacity: .75; }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar, .app-main { transition: none; }
  .side-menu-flyout:not([hidden]), .sidebar-shortcut-tip, body.nav-open .sidebar-backdrop { animation: none; }
}

/* ---------- 11/11: 1 px tra le voci e voce selezionata «a vetro» ---------- */
/* Le pillole non si toccano più: fra una riga e l'altra resta 1 px del colore del menu. */
.app-sidebar :is(.side-link, .side-submenu-link),
.side-menu-flyout .side-menu-flyout-link { margin-bottom: 1px; }
/* Voce selezionata: lastra chiara in leggero rilievo (sfumato, riflesso in alto, ombra sotto). */
.app-sidebar :is(.side-link, .side-submenu-link).active,
.side-menu-flyout .side-menu-flyout-link.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .085));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .04),
    inset 0 1px 0 rgba(255, 255, 255, .08),
    inset 0 -1px 0 rgba(0, 0, 0, .1),
    0 1px 2px rgba(0, 0, 0, .12);
}
.app-sidebar :is(.side-link, .side-submenu-link).active:is(:hover, :focus-visible) {
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .1));
}

/* ---------- 11/11: «Portali» nel menu, per tutti dall’11/11 (PortalMenuTrial e js/portal-menu.js) ---------- */
/* Righe del sottomenu: il nome parte dove partono le altre sottovoci; contatore e spillo hanno colonne fisse a destra,
   così né il passaggio del mouse né lo spillo spostano le etichette. */
.portal-menu-row,
.portal-pinned { position: relative; }
.portal-menu-link,
.portal-pinned-link { display: flex; align-items: center; gap: 0; }
.app-sidebar :is(.portal-menu-link, .portal-pinned-link) { padding-right: 32px !important; }
.portal-menu-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:is(.portal-menu-link, .portal-pinned-link) .side-badge { flex: none; margin-left: .4rem; }
/* Piastrella grande quanto un'icona del menu: nei portali appuntati ne prende il posto, anche a menu chiuso. */
:is(.portal-pins, .portal-menu-list, .portal-menu-flyout) .portal-tile-nav {
  width: 1.125rem; height: 1.125rem; flex: 0 0 1.125rem; margin: 0 calc(.625rem - 1px) 0 -1px; border-radius: .28rem;
  font-size: var(--monogram-xs); font-weight: 800; letter-spacing: -.04em; box-shadow: none; text-shadow: none;
}
/* Sottomenu aperto (11/11): la riga ha il rientro delle sottovoci (icona 16 + spazio 10), la piastrella torna indietro
   nella colonna delle icone, come negli appuntati; il nome resta a filo delle altre sottovoci e nulla si sposta. */
.portal-menu-list .portal-tile-nav { margin-left: calc(-26px - 1px); }
.portal-menu-flyout .portal-tile-nav { margin-left: 0; margin-right: .5rem; }
.side-menu-flyout.portal-menu-flyout { max-height: min(36rem, calc(100vh - 5rem)); overflow-y: auto; overscroll-behavior: contain; }
.side-menu-flyout .portal-menu-link { display: flex; align-items: center; }
/* Il portale aperto, fra gli appuntati: testo pieno, senza la lastra della pagina attiva (quella resta a «Dashboard»). */
.app-sidebar .portal-pinned-link.is-current { color: var(--on-accent); font-weight: 500; }
/* Lo spillo: colonna fissa a destra, visibile al passaggio del mouse; pieno sui portali appuntati. */
.portal-pin {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: .4rem;
  background: transparent; color: var(--nav-sub-ink); opacity: 0; transition: opacity .15s ease, color .15s ease, background-color .15s ease;
}
.portal-pin svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(45deg); }
.portal-pin.is-pinned svg { fill: currentColor; }
:is(.portal-menu-row, .portal-pinned):is(:hover, :focus-within) .portal-pin,
.portal-pin:focus-visible { opacity: .85; }
.portal-menu-row .portal-pin.is-pinned { opacity: .55; }
.portal-pin:is(:hover, :focus-visible) { opacity: 1 !important; color: var(--on-accent); background: var(--nav-fill-hover); }
/* Tre portali appuntati: gli altri spilli restano grigi e non rispondono (il suggerimento dice perché). */
.portal-pin[aria-disabled="true"] { cursor: not-allowed; }
.portal-pin[aria-disabled="true"]:is(:hover, :focus-visible) { color: var(--nav-sub-ink); background: transparent; opacity: .35 !important; }
@media (min-width: 768px) {
  body.sidebar-collapsed .portal-pin { display: none; }
  body.sidebar-collapsed .app-sidebar .portal-pinned-link { padding-right: 8px !important; }
  /* Il pallino sull'angolo della piastrella, come sulle icone: senza il margine che lo separa dal nome. */
  body.sidebar-collapsed .portal-pinned-link .side-badge { margin-left: 0; }
}
/* Senza mouse lo spillo resta visibile, tenue. */
@media (hover: none) {
  :is(.portal-menu-row, .portal-pinned) .portal-pin { opacity: .45; }
}
/* Riga del gruppo: il totale nella colonna dei contatori delle righe, la freccia in quella dello spillo. */
.portal-menu .side-menu-group-toggle .side-badge { margin-left: auto; }
.portal-menu .side-menu-group-toggle::after { margin-left: 14px; }

/* ---------- 11/11: suggerimenti delle voci a menu chiuso nei colori della barra, come le finestre delle sottovoci ---------- */
.sidebar-tooltip,
html[data-theme="dark"] .sidebar-tooltip {
  --bs-tooltip-bg: var(--sidebar);
  --bs-tooltip-color: var(--on-accent);
  --bs-tooltip-opacity: 1;
}
.sidebar-tooltip .tooltip-inner,
html[data-theme="dark"] .sidebar-tooltip .tooltip-inner {
  padding: 5px 10px; border: 1px solid rgba(255, 255, 255, .1); border-radius: .625rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  font-size: var(--text-sm); font-weight: 450; line-height: 1.125rem; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

/* ---------- 11/11: selettore dei portali senza portale scelto, l'icona di «Portali» al posto della piastrella ---------- */
.portal-tile-choose {
  border-color: var(--control-border); background: var(--primary-soft); color: var(--ink-soft);
  box-shadow: none; text-shadow: none;
}
.portal-tile-choose svg { width: 1rem; height: 1rem; }
.portal-switcher-button:is(:hover, [aria-expanded="true"]) .portal-tile-choose { color: var(--primary); }
/* Tema scuro (11/11): niente blu, che sul grigio dell'header stonava e spariva nel pulsante acceso; grigio dei controlli. */
html[data-theme="dark"] .portal-tile-choose { background: var(--surface-hover); }
html[data-theme="dark"] .portal-switcher-button:is(:hover, [aria-expanded="true"]) .portal-tile-choose {
  border-color: var(--primary-light); background: var(--paper); color: var(--primary-light);
}
/* Sul telefono lo spazio è poco: quadratino, distanze e margine più stretti, così «Portale…» si legge intero. */
@media (max-width: 767.98px) {
  .portal-switcher-button:has(.portal-tile-choose) { gap: .35rem; padding-right: .5rem; }
  .portal-tile-choose { width: 1.35rem; height: 1.35rem; flex-basis: 1.35rem; }
  .portal-tile-choose svg { width: .85rem; height: .85rem; }
}
/* Spillo non salvato (server irraggiungibile o rifiuto): il portale torna com'era e il menu lo dice per qualche secondo. */
.portal-pins-notice {
  margin: .25rem 0 .375rem; padding: 4px 8px 4px var(--nav-icon-x); border-radius: .5rem;
  background: rgba(255, 255, 255, .055); color: var(--sidebar-text); font-size: var(--text-xs); line-height: 1rem;
}
.portal-pins-notice[hidden] { display: none; }
@media (min-width: 768px) { body.sidebar-collapsed .portal-pins-notice { display: none; } }

/* SellerNotifier PRO in BeNews (28/11, revisione dell'impaginazione): the pages are built from the blocks of the
   Centro notifiche (.nc-page, .nc-block, .nc-table, .nc-filter, .nc-pill); these few rules add what they lack. */
.nc-block-body { --bar-pad: 1.1rem; }
.nc-block-body:has(.city-editor-bar.is-card) { padding-bottom: 1.1rem; }
.nc-block-body > :last-child { margin-bottom: 0; }
/* Facts of a seller or of a setting: label above, value under, as many columns as fit. */
.sn-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .85rem 1.5rem; margin: 0; }
.sn-kv > div { min-width: 0; }
.sn-kv dt { margin: 0 0 .15rem; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 600; }
.sn-kv dd { margin: 0; font-size: var(--text-sm); overflow-wrap: anywhere; }
/* Figures of a block: the tiles of the dashboards, inside the body of the block. */
.nc-block-body > .city-tiles { margin: 0; }
/* Actions as rows: name and help on the left, the button on the right; the form opens under its row. */
.sn-actions { margin: 0; padding: 0; list-style: none; }
.sn-actions > li + li { border-top: 1px solid var(--row-line); }
.sn-action > summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; padding: .7rem 1.1rem; cursor: pointer; list-style: none; }
.sn-action > summary::-webkit-details-marker { display: none; }
.sn-action > summary:hover { background: var(--surface-hover); }
.sn-action > summary:focus-visible { outline: 2px solid var(--focus, var(--primary)); outline-offset: -2px; }
.sn-action-text { min-width: 0; }
.sn-action-name { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.sn-action-help { display: block; margin-top: .1rem; color: var(--ink-soft); font-size: var(--text-xs); }
.sn-action-open { flex: none; pointer-events: none; }
.sn-action[open] > summary { background: var(--surface); }
.sn-action[open] .sn-action-open { visibility: hidden; }
.sn-action-body { padding: .85rem 1.1rem 1rem; background: var(--surface); border-top: 1px solid var(--row-line); }
.sn-action-body .form-label { font-size: var(--text-sm); }
/* The foot of an action or of a form: the confirmation beside the button, on the right. */
.sn-confirm-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .6rem 1rem; margin-top: 1rem; }
.sn-confirm-bar .form-check { margin: 0; }
.city-editor-bar.is-card.sn-confirm-bar { margin-top: 1.25rem; align-items: center; }
/* The irreversible actions: their own block, its title in red. */
.nc-block.is-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.nc-block.is-danger > .nc-block-head h2 { color: var(--danger); }
/* A secret shown once (temporary access). */
.nc-block.is-warning { border-color: color-mix(in srgb, var(--warning) 55%, var(--line)); }
/* Code-like values in a table cell. */
.sn-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-xs); color: var(--ink-soft); }
/* A small line of facts under a name in a cell. */
.sn-sub { display: block; margin-top: .1rem; color: var(--ink-soft); font-size: var(--text-xs); }
.sn-pills { display: inline-flex; flex-wrap: wrap; gap: .25rem; vertical-align: middle; }
@media (max-width: 767.98px) {
  .sn-action > summary { padding: .65rem .85rem; }
  .sn-action-body { padding: .75rem .85rem .9rem; }
  .sn-confirm-bar { justify-content: stretch; }
  .sn-confirm-bar > .btn { width: 100%; }
}
/* The search of a block, in its tools beside the filters. */
.sn-search { display: flex; gap: .4rem; min-width: 0; }
.sn-search .form-control { min-width: 15rem; min-height: 2rem; padding-top: .25rem; padding-bottom: .25rem; font-size: var(--text-sm); }
.sn-search .btn { min-height: 2rem; }
.nc-block-tools .form-select { min-height: 2rem; padding-top: .25rem; padding-bottom: .25rem; font-size: var(--text-sm); width: auto; }
@media (max-width: 767.98px) {
  .nc-block-tools { width: 100%; }
  .sn-search { flex: 1 1 100%; }
  .sn-search .form-control { min-width: 0; flex: 1 1 auto; }
}
/* The row of an action has its own button: no arrow of the generic summaries. */
.sn-action > summary::after { content: none !important; display: none !important; }
/* The tables of SellerNotifier on a phone: the cards with the names of the fields (numbers alone say nothing), the name of
   the row on its own line without a label, the closed detail rows really closed. */
.sn-cards > tbody > tr[hidden] { display: none !important; }
@media (max-width: 767.98px) {
  .nc-table.table-cards.sn-cards > tbody > tr:not(.table-detail-row) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem .75rem; align-items: start; }
  .nc-table.table-cards.sn-cards > tbody > tr > td:not(.table-card-wide):not([data-label="Azioni"]):not([data-label="Azione"])[data-label]::before { display: block !important; white-space: normal; }
  .nc-table.table-cards.sn-cards > tbody > tr > td.table-card-wide,
  .nc-table.table-cards.sn-cards > tbody > tr > td[colspan] { grid-column: 1 / -1; }
  .nc-table.table-cards.sn-cards > tbody > tr > td.text-end { text-align: left !important; }
  .nc-table.table-cards.sn-cards > tbody > tr > td.nc-date { margin-left: 0; font-size: inherit; white-space: normal; }
  .nc-table.table-cards.sn-cards .nc-pill { height: auto; min-height: 20px; white-space: normal; line-height: 1.25; padding-top: .1rem; padding-bottom: .1rem; }
  .nc-table.table-cards.sn-cards > tbody > tr > td[data-label="Azioni"], .nc-table.table-cards.sn-cards > tbody > tr > td[data-label="Azione"] { grid-column: 1 / -1; text-align: left !important; }
  .nc-table.table-cards.sn-cards > tbody > tr > td[data-label="Azioni"]::before, .nc-table.table-cards.sn-cards > tbody > tr > td[data-label="Azione"]::before { display: none !important; }
}

/* SellerNotifier PRO, scheda Processi (28/11 sera): piastrelle di Processi periodici per gruppo, giri con diagnostica su due righe. */
.sn-group-title { margin: 1rem 0 .5rem; font-size: var(--text-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.sn-group-title:first-child { margin-top: 0; }
.periodic-recap.sn-recap { margin-bottom: 0; }
.periodic-recap.sn-recap { align-items: stretch; }
.periodic-recap.sn-recap > .periodic-recap-item > h4 { min-width: 0; margin: 0 0 .2rem; font-size: var(--text-base); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.periodic-recap.sn-recap > .periodic-recap-item > .mon-status { font-size: var(--text-sm); }
.sn-runs .sn-diag { min-width: 12rem; width: 100%; color: var(--ink-soft); }
.sn-runs .sn-diag > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
  .periodic-recap.sn-recap > .periodic-recap-item > h4 { font-size: var(--text-sm); }
  .nc-table.table-cards.sn-cards.sn-runs > tbody > tr > td.sn-diag { grid-column: 1 / -1; min-width: 0; }
  .nc-table.table-cards.sn-cards.sn-runs > tbody > tr > td.sn-diag.is-empty { display: none !important; }
}

/* SellerNotifier PRO come la sua console (28/11 sera): figures with their icon in a tinted square and their colour, headings
   with icon and count, charts of days with bars, areas and lines in more colours, actions beside their data with a
   confirmation window. The tones are those of the original console, readable in both themes. */
:root {
  --sn-orange: #d9480f; --sn-blue: #1c6fc4; --sn-green: #2b8a3e; --sn-amber: #b7791f; --sn-red: var(--danger);
  --sn-teal: #0c8599; --sn-violet: #6741d9; --sn-slate: var(--ink-soft);
}
html[data-theme="dark"] {
  --sn-orange: #ffa94d; --sn-blue: #74b9f5; --sn-green: #8ce99a; --sn-amber: #ffd43b; --sn-red: var(--danger);
  --sn-teal: #66d9e8; --sn-violet: #b197fc; --sn-slate: var(--ink-soft);
}
[data-tone="orange"] { --tone: var(--sn-orange); }
[data-tone="blue"] { --tone: var(--sn-blue); }
[data-tone="green"] { --tone: var(--sn-green); }
[data-tone="amber"] { --tone: var(--sn-amber); }
[data-tone="red"] { --tone: var(--sn-red); }
[data-tone="teal"] { --tone: var(--sn-teal); }
[data-tone="violet"] { --tone: var(--sn-violet); }
[data-tone="slate"] { --tone: var(--sn-slate); }
/* Figures. */
.sn-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); gap: .75rem; }
:where(.sn-stat) { --tone: var(--sn-slate); }
.sn-stat {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr; column-gap: .6rem;
  padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper);
  box-shadow: var(--shadow-card); color: var(--ink); text-decoration: none; min-width: 0;
}
.app-body a.sn-stat, .app-body a.sn-stat:hover { color: var(--ink); }
a.sn-stat:hover { border-color: color-mix(in srgb, var(--tone) 45%, var(--line)); }
a.sn-stat[aria-current="true"] { border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone); background: color-mix(in srgb, var(--tone) 7%, var(--paper)); }
.sn-stat-label { grid-column: 1; grid-row: 1; align-self: center; color: var(--ink-soft); font-size: var(--text-sm); font-weight: 500; line-height: 1.3; }
.sn-stat-icon {
  grid-column: 2; grid-row: 1 / span 2; display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border-radius: .55rem; background: color-mix(in srgb, var(--tone) 13%, var(--paper)); color: var(--tone);
}
.sn-stat-icon svg, .sn-h-icon svg, .sn-btn svg, .sn-i { width: 1.1rem; height: 1.1rem; flex: none; }
.sn-stat-value { grid-column: 1; grid-row: 2; margin-top: .35rem; font-size: var(--text-stat); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sn-stat-note { grid-column: 1 / -1; grid-row: 3; align-self: end; margin-top: .3rem; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 500; }
.sn-stat-note[data-tone] { color: var(--tone); }
/* A heading with its icon and its count. */
.sn-h { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
:where(.sn-h-icon, .sn-series, .sn-key) { --tone: var(--sn-orange); }
.sn-h-icon { display: inline-grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: .5rem; background: color-mix(in srgb, var(--tone) 13%, var(--paper)); color: var(--tone); }
.sn-h-icon svg { width: 1rem; height: 1rem; }
.sn-count { display: inline-flex; align-items: center; height: 1.35rem; padding: 0 .5rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.sn-section-title { display: flex; align-items: center; gap: .45rem; margin: 1.5rem 0 .25rem; font-size: var(--text-xl); font-weight: 700; }
.sn-section-title + p { margin: 0 0 .85rem; color: var(--ink-soft); font-size: var(--text-sm); }
.sn-section-title .sn-i { color: var(--sn-orange); }
/* Charts. */
.sn-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1rem; }
.sn-chart { margin: 0; padding: .9rem 1rem .8rem; min-width: 0; }
.sn-chart.is-wide { grid-column: 1 / -1; }
.sn-chart figcaption { margin-bottom: .5rem; }
.sn-chart-title { display: block; font-size: var(--text-md); font-weight: 700; color: var(--ink); }
.sn-chart-note { display: block; margin-top: .1rem; color: var(--ink-soft); font-size: var(--text-xs); }
.sn-chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.sn-grid { stroke: var(--line); stroke-width: 1; }
.sn-tick { fill: var(--ink-soft); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.sn-series { color: var(--tone); }
.sn-bar { fill: currentColor; opacity: .88; }
.sn-bar:hover { opacity: 1; }
.sn-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sn-area-top { stop-color: currentColor; stop-opacity: .28; }
.sn-area-bottom { stop-color: currentColor; stop-opacity: 0; }
.sn-point { fill: var(--paper); stroke: currentColor; stroke-width: 2; opacity: 0; }
.sn-point:hover { opacity: 1; }
.sn-day-link rect { fill: transparent; cursor: pointer; }
.sn-day-link:hover rect, .sn-day-link:focus-visible rect { fill: color-mix(in srgb, var(--ink) 7%, transparent); }
.sn-day-link:focus-visible { outline: none; }
.sn-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1rem; margin: .5rem 0 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: var(--text-xs); }
.sn-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.sn-key { width: .65rem; height: .65rem; border-radius: 2px; background: var(--tone); }
/* Buttons of the actions: outline, the icon in the colour of the action. */
.sn-btn { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.sn-btn[data-tone] svg { color: var(--tone); }
.sn-btn[data-tone]:hover { border-color: color-mix(in srgb, var(--tone) 55%, var(--control-border)); background: color-mix(in srgb, var(--tone) 8%, var(--paper)); color: var(--ink); }
.sn-btn.btn-danger svg { color: inherit; }
.sn-btnbar { display: flex; flex-wrap: wrap; gap: .45rem; }
.sn-modal .modal-title { display: flex; align-items: center; gap: .5rem; font-size: var(--text-xl); font-weight: 700; }
.sn-modal .modal-body > p { color: var(--ink-soft); font-size: var(--text-base); }
.sn-modal .modal-footer { gap: .5rem; }
.sn-confirm[data-tone] { --bs-btn-bg: var(--tone); --bs-btn-border-color: var(--tone); --bs-btn-hover-bg: color-mix(in srgb, var(--tone) 85%, var(--shade)); --bs-btn-hover-border-color: color-mix(in srgb, var(--tone) 85%, var(--shade)); --bs-btn-color: var(--on-accent); --bs-btn-hover-color: var(--on-accent); background: var(--tone); border-color: var(--tone); color: var(--on-accent); }
html[data-theme="dark"] .sn-confirm[data-tone] { color: var(--ink-fixed); --bs-btn-color: var(--ink-fixed); --bs-btn-hover-color: var(--ink-fixed); }
@media (max-width: 575.98px) {
  .sn-stat { padding: .7rem .8rem; }
  .sn-stat-value { font-size: var(--text-stat); }
  .sn-stat-icon { width: 2rem; height: 2rem; }
  .sn-chart { padding: .75rem .7rem .65rem; }
}
/* The card of a seller (28/11 sera). */
.nc-pill svg { width: .8rem; height: .8rem; margin-right: .25rem; flex: none; }
a.nc-pill.sn-pill-link { text-decoration: none; }
a.nc-pill.sn-pill-link:hover { border-color: var(--tone); }
.sn-region { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.1rem; margin: -.35rem 0 1.1rem; padding: 0; list-style: none; color: var(--ink-soft); font-size: var(--text-sm); }
.sn-chip { padding: .1rem .45rem; border-radius: .35rem; background: var(--surface); border: 1px solid var(--line); }
.sn-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1.25rem; align-items: start; }
.sn-two > .nc-block { height: 100%; }
.sn-rows { display: grid; gap: .5rem; margin: 0; }
.sn-rows > div { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; min-height: 2.6rem; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--surface); }
.sn-rows dt { margin: 0; color: var(--ink-soft); font-size: var(--text-sm); font-weight: 500; }
.sn-rows dd { margin: 0; min-width: 0; text-align: right; font-size: var(--text-sm); font-weight: 600; overflow-wrap: anywhere; }
.sn-strong[data-tone] { color: var(--tone); font-size: var(--text-md); font-weight: 700; }
.sn-secret { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .4rem; }
.sn-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: .55rem; }
.sn-list > li { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; }
.sn-list > li + li { border-top: 1px solid var(--line); }
.sn-list-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; font-size: var(--text-sm); }
.sn-list-main .sn-mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-list-side { display: flex; flex-direction: column; align-items: flex-end; flex: none; font-size: var(--text-sm); }
.sn-list-side .sn-sub { margin: 0; }
.sn-mini { display: inline-flex; align-items: center; gap: .65rem; padding: .3rem .4rem .3rem .7rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--surface); }
.sn-mini > span { display: flex; flex-direction: column; line-height: 1.2; }
.sn-mini > span .sn-sub { margin: 0; }
.sn-mini strong { display: inline-flex; align-items: center; gap: .3rem; font-size: var(--text-sm); }
.sn-mini strong .sn-i { width: .9rem; height: .9rem; color: var(--sn-orange); }
.sn-row-actions { white-space: normal; }
.sn-row-actions .sn-btn { margin: .1rem .1rem .1rem 0; }
.sn-stores td { vertical-align: middle; }
.sn-money { color: var(--sn-green); font-weight: 700; }
.sn-product > span { display: inline-block; max-width: 26rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.page-heading-actions .sn-btn { margin: .15rem 0; }
@media (max-width: 767.98px) {
  .sn-row-actions { min-width: 0; }
  .sn-product > span { max-width: 100%; white-space: normal; }
  .sn-mini { width: 100%; justify-content: space-between; }
}
/* The dashboard of SellerNotifier (28/11 sera): banner of the alerts, progress of the catalogue, sections. */
.sn-alert-banner { border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); border-radius: var(--radius-md); background: color-mix(in srgb, var(--danger) 7%, var(--paper)); padding: .85rem 1.1rem; }
.sn-alert-banner-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.sn-alert-banner h2 { margin: 0; font-size: var(--text-lg); font-weight: 700; color: var(--danger); }
.sn-alert-banner h2 .sn-i { color: var(--danger); }
.sn-alert-banner ul { margin: .6rem 0 0; padding: 0; list-style: none; }
.sn-alert-banner li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .6rem 0; border-top: 1px solid color-mix(in srgb, var(--danger) 22%, var(--line)); }
.sn-alert-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 20rem; font-size: var(--text-sm); }
.sn-alert-facts { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin-top: .25rem; color: var(--ink-soft); font-size: var(--text-xs); }
.sn-alert-error { margin-top: .25rem; color: var(--ink-soft); font-size: var(--text-xs); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.sn-progress-cell { min-width: 9rem; }
.sn-progress { display: inline-block; vertical-align: middle; width: calc(100% - 3rem); max-width: 9rem; height: .4rem; border-radius: 999px; background: var(--line); overflow: hidden; }
.sn-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--sn-orange); }
.sn-progress-value { display: inline-block; width: 2.6rem; text-align: right; color: var(--ink-soft); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.sn-subsection { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 1rem 0 .6rem; font-size: var(--text-md); font-weight: 700; }
.sn-subsection .sn-i { color: var(--sn-orange); width: 1rem; height: 1rem; }
.sn-subsection .nc-pill { font-weight: 600; }
.sn-stats-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 30rem; }
@media (max-width: 575.98px) { .sn-stats-pair { max-width: none; } }
.sn-rows-inline { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
@media (min-width: 768px) { .sn-lifecycle .sn-when { width: 1%; white-space: nowrap; } }
.sn-stats a.sn-stat { cursor: pointer; }
.nc-block[id^="sn-l-"] { scroll-margin-top: 5rem; }
.sn-with-icon { display: inline-flex; align-items: center; gap: .5rem; }
.sn-h-icon.is-small { width: 1.6rem; height: 1.6rem; border-radius: .45rem; flex: none; }
.sn-h-icon.is-small svg { width: .85rem; height: .85rem; }
.sn-count-icon { display: inline-flex; align-items: center; gap: .3rem; font-variant-numeric: tabular-nums; }
.sn-count-icon .sn-i { width: .9rem; height: .9rem; color: var(--ink-soft); }
/* Bootstrap colours every cell of a table and the dark theme every link: the colours of SellerNotifier win here. */
.nc-table > tbody > tr > td.sn-money { color: var(--sn-green); }
.app-body a.nc-pill, .app-body a.nc-pill:hover { color: var(--tone); }
@media (min-width: 768px) { .sn-row-actions { min-width: 13.5rem; } }
.sn-stat-value { white-space: nowrap; font-size: var(--text-stat); }
/* On a phone every card of SellerNotifier carries its labels: the row of the headers would only repeat them. */
@media (max-width: 767.98px) { .nc-table.table-cards.sn-cards > thead { display: none; } }
/* The figures on one line each (28/11 sera): the label across the card, the icon beside the value, so that small screens
   do not send the labels to a new line; what still does not fit ends with an ellipsis and is whole in the title. */
.sn-stat { grid-template-rows: auto auto auto; align-items: center; }
.sn-stat-label { grid-column: 1 / -1; grid-row: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-stat-icon { grid-column: 2; grid-row: 2; margin-top: .35rem; }
.sn-stat-value { grid-row: 2; overflow: hidden; text-overflow: ellipsis; }
.sn-stat-note { grid-row: 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 575.98px) {
  .sn-stat-label { font-size: var(--text-xs); }
  .sn-stat-icon { width: 1.85rem; height: 1.85rem; }
  .sn-stat-icon svg { width: .95rem; height: .95rem; }
}
/* Labels on one line in every page of SellerNotifier (28/11 sera): the names of the processes (whole in the title), the
   labels of the facts, the long states of a card across the card on a phone. */
.periodic-recap.sn-recap > .periodic-recap-item > h4 { font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-rows dt { white-space: nowrap; }
@media (max-width: 767.98px) {
  .nc-table.table-cards.sn-cards > tbody > tr > td.sn-span { grid-column: 1 / -1; }
  .sn-alert-banner h2 { font-size: var(--text-md); }
}
/* Sortable tables of SellerNotifier on a phone: only the headers that sort, as a compact row above the cards. */
@media (max-width: 767.98px) {
  .nc-table.table-cards.sn-cards:is([data-sn-sort], [data-sn-sorted]) > thead { display: block; }
  .nc-table.table-cards.sn-cards:is([data-sn-sort], [data-sn-sorted]) > thead > tr { display: flex; flex-wrap: wrap; gap: .3rem .9rem; padding: .5rem .75rem; border-bottom: 1px solid var(--row-line); }
  .nc-table.table-cards.sn-cards:is([data-sn-sort], [data-sn-sorted]) > thead > tr > th { padding: 0 !important; border: 0 !important; background: transparent; white-space: nowrap; }
  .nc-table.table-cards.sn-cards:is([data-sn-sort], [data-sn-sorted]) > thead > tr > th:not([aria-sort]) { display: none; }
}
/* On a phone the processes one per row: the whole name, the last cycle on one line. */
@media (max-width: 575.98px) { .periodic-recap.sn-recap { grid-template-columns: minmax(0, 1fr); } }
/* 1/12: «Passa a BeApp / BeNews» at the top of the menu: a flat background of its own sets it apart from Home, with the
   size and the icon of the other items (no border). */
.app-sidebar .side-link.brand-switch-link { margin-bottom: .3rem; background: color-mix(in srgb, var(--sidebar-accent) 12%, transparent); }
.app-sidebar .side-link.brand-switch-link:hover { background: color-mix(in srgb, var(--sidebar-accent) 20%, transparent); }
.brand-handoff { display: grid; place-items: center; min-height: 60vh; text-align: center; }

/* ---------- BeApp (1/12): verde «Bosco» al posto del blu, stessi effetti; solo sul dominio BeApp (BrandSites) ---------- */
html[data-brand="beapp"] {
  --sidebar: #1b2722; --sidebar-deep: #131c18; --sidebar-hover: #22312a; --sidebar-active: #25352e;
  --sidebar-accent: #93dbb4; --sidebar-text: #c8d8cf; --sidebar-muted: #8fa89b; --sidebar-icon: #90ab9e;
  --primary: #1f6b47;
}
html[data-brand="beapp"]:not([data-theme="dark"]) {
  --primary-deep: #164f35; --primary-soft: #e4f1ea; --primary-light: #4b9272;
  --pill-bg: #d8eee2; --pill-border: #bddfcd;
  --action-bg: #237a51; --action-hover: #1f6b47; --action-pressed: #164f35;
  --action-outline-border: #c2d7cb; --action-outline-text: #1f6b47; --action-outline-hover: #f0f7f3; --action-outline-active: #e4f1ea;
  --surface-hover: #e9f2ed;
}
html[data-brand="beapp"][data-theme="dark"] {
  --primary-soft: #1c3a2c; --primary-deep: #93dbb4; --primary-light: #93dbb4; --link-hover: #c6f0da;
  --tab-active-ink: #b6eccf; --chart-line: #78c8a0;
  --action-bg: #2e7a55; --action-hover: #34845d; --action-pressed: #1f6b47;
  --action-outline-border: #4a6557; --action-outline-text: #c4e5d3; --action-outline-hover: #253a30;
  --action-outline-hover-border: #86b29b; --action-outline-hover-text: #e2f5ea; --action-outline-active: #2e4b3d;
  --neutral-hover-bg: #2c3a33; --surface-hover: #2c3832;
}
