    :root {
      /* Palette Colori MEDUSA Digital Twin - Light Mode (ArcGIS Experience Builder / Calcite) */
      --primary: #0062A1;
      --primary-light: #007BC9;
      --primary-dark: #00497B;
      --accent: #007BC9;
      --accent-hover: #00497B;
      --accent-gradient: linear-gradient(135deg, #0062A1 0%, #00497B 100%);
      --beta-color: #F39C12;
      --beta-bg: rgba(243, 156, 18, 0.12);
      
      --bg-body: #F4F0EF;
      --bg-card: #FFFFFF;
      --bg-header: #0062A1;
      --bg-sidebar: #FFFFFF;
      --bg-code: #EAE6E5;
      --bg-callout-info: rgba(0, 123, 201, 0.08);
      --bg-callout-warn: rgba(243, 156, 18, 0.08);
      --bg-callout-note: rgba(0, 98, 161, 0.08);
      --bg-callout-audit: rgba(239, 68, 68, 0.08);
      
      --text-main: #1C1B1B;
      --text-muted: #525050;
      --text-inverse: #FFFFFF;
      
      --border-color: #DCD7D6;
      --border-focus: #0062A1;
      
      --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
      --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
      --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.14);
      --shadow-glow: 0 0 16px rgba(0, 123, 201, 0.25);
      
      --radius-sm: 4px;
      --radius-md: 6px;
      --radius-lg: 10px;
      --radius-xl: 16px;
      --radius-pill: 9999px;
      
      --sidebar-width: 320px;
      --header-height: 87px;
      --nav-height: 48px;
      --dtfoot-height: 30px;
      --footer-height: calc(var(--nav-height) + var(--dtfoot-height));

      /* Colori dell'intestazione e del footer del Digital Twin (Experience Builder).
         Come nel DT: tema chiaro = intestazione blu, tema scuro (predefinito nel DT) = intestazione celeste */
      --dt-font: Georgia, "Times New Roman", serif;
      --dt-head-bg: #2163A1;
      --dt-head-fg: #FFFFFF;
      --dt-btn-bg: #00497B;
      --dt-btn-fg: #FFFFFF;
      --dt-btn-border: #FFFFFF;
      --dt-foot-bg: #484646;
      --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    [data-theme="dark"] {
      --dt-head-bg: #9CCAFF;
      --dt-head-fg: #001D35;
      --dt-btn-bg: #5EB0FF;
      --dt-btn-fg: #001D35;
      --dt-btn-border: #001D35;
      /* Palette Colori MEDUSA Digital Twin - Dark Mode (ArcGIS Experience Builder / Calcite Dark) */
      --primary: #9CCAFF;
      --primary-light: #BCE0FF;
      --primary-dark: #5EB0FF;
      --accent: #5EB0FF;
      --accent-hover: #9CCAFF;
      --accent-gradient: linear-gradient(135deg, #313030 0%, #1C1B1B 100%);
      --beta-color: #FBBF24;
      --beta-bg: rgba(251, 191, 36, 0.15);
      
      --bg-body: #1C1B1B;
      --bg-card: #313030;
      --bg-header: #242D38;
      --bg-sidebar: #262525;
      --bg-code: #2C2B2B;
      --bg-callout-info: rgba(156, 202, 255, 0.12);
      --bg-callout-warn: rgba(251, 191, 36, 0.12);
      --bg-callout-note: rgba(94, 176, 255, 0.12);
      --bg-callout-audit: rgba(248, 113, 113, 0.14);
      
      --text-main: #FFFFFF;
      --text-muted: #B0AFAF;
      --text-inverse: #1C1B1B;
      
      --border-color: #484646;
      --border-focus: #9CCAFF;
      
      --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
      --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
      --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
      --shadow-glow: 0 0 20px rgba(156, 202, 255, 0.25);
    }

    /* Reset & Base */
    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html {
      scroll-behavior: smooth;
      scroll-padding-top: calc(var(--header-height) + 24px);
      scroll-padding-bottom: calc(var(--footer-height) + 16px);
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      background-color: var(--bg-body);
      color: var(--text-main);
      line-height: 1.7;
      font-size: 16px;
      transition: background-color 0.3s ease, color 0.3s ease;
      overflow-x: hidden;
    }

    h1, h2, h3, h4, h5, h6 {
      font-family: 'Georgia', serif;
      color: var(--text-main);
      font-weight: 700;
      line-height: 1.3;
    }

    a {
      color: var(--accent);
      text-decoration: none;
      transition: var(--transition);
    }

    a:hover {
      color: var(--accent-hover);
      text-decoration: underline;
    }

    code, kbd, pre {
      font-family: 'JetBrains Mono', monospace;
    }

    /* Intestazione: stessa grafica della barra superiore del Digital Twin */
    .top-header {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: var(--header-height);
      background: var(--dt-head-bg);
      color: var(--dt-head-fg);
      font-family: var(--dt-font);
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 0 8px 0 0;
    }

    .brand-container {
      display: flex;
      align-items: center;
      gap: 6px;
      height: 100%;
      min-width: 0;
    }

    .brand-logo {
      width: 59px;
      height: 100%;
      flex-shrink: 0;
      overflow: hidden;
    }

    .brand-logo-img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .brand-text {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 8px;
      min-width: 0;
    }

    .brand-title {
      font-family: var(--dt-font);
      font-size: 25.6px;
      font-weight: 700;
      line-height: 1.15;
      color: var(--dt-head-fg);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .brand-subtitle {
      font-family: var(--dt-font);
      font-size: 19.2px;
      font-weight: 400;
      line-height: 1.15;
      color: var(--dt-head-fg);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .header-controls {
      display: flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
    }

    /* Pulsanti a pillola come i pulsanti di sezione del DT */
    .header-action-btn,
    .footer-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      height: 31px;
      padding: 0 16px;
      border-radius: 50px;
      background: var(--dt-btn-bg);
      border: 0.8px solid var(--dt-btn-border);
      color: var(--dt-btn-fg);
      font-family: var(--dt-font);
      font-size: 14px;
      font-weight: 400;
      line-height: 1;
      cursor: pointer;
      white-space: nowrap;
      user-select: none;
      text-decoration: none;
      transition: filter 0.2s ease;
    }

    .header-action-btn {
      min-width: 126px;
    }

    .header-action-btn:hover,
    .footer-btn:hover {
      filter: brightness(1.08);
      color: var(--dt-btn-fg);
    }

    .header-action-btn:focus-visible,
    .footer-btn:focus-visible {
      outline: 2px solid var(--dt-btn-border);
      outline-offset: 2px;
    }

    .header-action-btn svg {
      flex-shrink: 0;
    }

    /* Badges */
    .badge {
      display: inline-flex;
      align-items: center;
      padding: 3px 10px;
      border-radius: 12px;
      font-size: 0.725rem;
      font-weight: 700;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }

    .badge-beta {
      background-color: var(--beta-bg);
      color: var(--beta-color);
      border: 1px solid var(--beta-color);
      box-shadow: 0 0 10px rgba(243, 156, 18, 0.15);
      animation: pulse-beta 2.5s infinite;
    }

    .badge-audit {
      background-color: var(--bg-callout-audit);
      color: #EF4444;
      border: 1px solid #EF4444;
    }

    @keyframes pulse-beta {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.75; }
    }

    .badge-tag {
      background: var(--bg-code);
      color: var(--text-muted);
      border: 1px solid var(--border-color);
      font-family: 'JetBrains Mono', monospace;
    }

    /* Layout Wrapper */
    .app-container {
      display: flex;
      margin-top: var(--header-height);
      margin-bottom: var(--footer-height);
      min-height: calc(100vh - var(--header-height) - var(--footer-height));
    }

    /* Sidebar Navigation (TOC) */
    .sidebar {
      width: var(--sidebar-width);
      background: var(--bg-sidebar);
      border-right: 1px solid var(--border-color);
      position: fixed;
      top: var(--header-height);
      bottom: var(--footer-height);
      left: 0;
      overflow-y: auto;
      padding: 24px 16px;
      transition: var(--transition);
      z-index: 900;
    }

    .sidebar-heading {
      font-family: Georgia, serif;
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
      margin-bottom: 12px;
      padding-left: 12px;
      font-weight: 700;
    }

    .toc-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .toc-item a {
      display: flex;
      align-items: center;
      padding: 8px 12px;
      border-radius: var(--radius-sm);
      color: var(--text-muted);
      font-size: 0.865rem;
      font-weight: 500;
      transition: var(--transition);
      text-decoration: none;
      border-left: 3px solid transparent;
    }

    .toc-item a:hover {
      background: var(--bg-code);
      color: var(--text-main);
      transform: translateX(4px);
    }

    .toc-item a.active {
      background: var(--bg-callout-info);
      color: var(--accent);
      font-weight: 600;
      border-left-color: var(--accent);
    }

    .toc-sublist {
      list-style: none;
      padding-left: 16px;
      margin-top: 4px;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .toc-sublist .toc-item a {
      padding: 6px 12px;
      font-size: 0.8rem;
    }

    /* Main Content Area */
    .main-content {
      flex: 1;
      margin-left: var(--sidebar-width);
      padding: 40px calc(5vw);
      max-width: 1320px;
    }

    /* Hero Banner / Title Card */
    .hero-banner {
      background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
      border-radius: var(--radius-xl);
      padding: 48px;
      color: white;
      margin-bottom: 40px;
      position: relative;
      overflow: hidden;
      box-shadow: var(--shadow-lg);
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hero-banner::after {
      content: "";
      position: absolute;
      right: -50px;
      bottom: -50px;
      width: 300px;
      height: 300px;
      background: radial-gradient(circle, rgba(0, 123, 201, 0.35) 0%, rgba(0,0,0,0) 70%);
      border-radius: 50%;
      pointer-events: none;
    }

    .hero-title {
      font-size: 2.65rem;
      font-weight: 800;
      color: white;
      margin-bottom: 12px;
      letter-spacing: -1px;
    }

    .hero-subtitle {
      font-size: 1.2rem;
      color: rgba(255, 255, 255, 0.88);
      font-weight: 400;
      margin-bottom: 24px;
      max-width: 850px;
    }

    .hero-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: center;
    }

    .hero-badge {
      background: rgba(255, 255, 255, 0.15);
      backdrop-filter: blur(8px);
      padding: 6px 14px;
      border-radius: 20px;
      font-size: 0.825rem;
      font-weight: 600;
      color: white;
      border: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Section Cards */
    .section-card {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-lg);
      padding: 40px;
      margin-bottom: 40px;
      box-shadow: var(--shadow-sm);
      transition: var(--transition);
      position: relative;
    }

    .section-card:hover {
      box-shadow: var(--shadow-md);
      border-color: rgba(0, 123, 201, 0.3);
    }

    .section-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 2px solid var(--border-color);
      padding-bottom: 16px;
      margin-bottom: 24px;
    }

    .section-title {
      font-size: 1.85rem;
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .section-number {
      color: var(--accent);
      font-weight: 800;
    }

    .subsection-title {
      font-size: 1.35rem;
      color: var(--text-main);
      margin: 32px 0 16px 0;
      padding-top: 16px;
      border-top: 1px dashed var(--border-color);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    p {
      margin-bottom: 16px;
      color: var(--text-main);
    }

    ul, ol {
      margin-bottom: 20px;
      padding-left: 24px;
    }

    li {
      margin-bottom: 8px;
    }

    li > strong {
      color: var(--text-main);
    }

    /* Callouts & Admonitions */
    .callout {
      border-left: 4px solid;
      padding: 20px 24px;
      border-radius: var(--radius-md);
      margin: 24px 0;
      display: flex;
      gap: 16px;
      align-items: flex-start;
    }

    .callout-icon {
      font-size: 1.5rem;
      flex-shrink: 0;
      margin-top: 2px;
    }

    .callout-content {
      flex: 1;
    }

    .callout-title {
      font-family: Georgia, serif;
      font-weight: 700;
      font-size: 1.05rem;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .callout.important {
      background-color: var(--bg-callout-warn);
      border-color: var(--beta-color);
    }

    .callout.important .callout-title {
      color: var(--beta-color);
    }

    .callout.note {
      background-color: var(--bg-callout-note);
      border-color: #3B82F6;
    }

    .callout.note .callout-title {
      color: #3B82F6;
    }

    .callout.tip {
      background-color: var(--bg-callout-info);
      border-color: var(--accent);
    }

    .callout.tip .callout-title {
      color: var(--accent);
    }

    .callout.audit {
      background-color: var(--bg-callout-audit);
      border-color: #EF4444;
    }

    .callout.audit .callout-title {
      color: #EF4444;
    }

    /* Screenshots & Figures */
    .screenshot-figure {
      margin: 32px 0;
      background: var(--bg-code);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      overflow: hidden;
      box-shadow: var(--shadow-sm);
      transition: var(--transition);
      cursor: zoom-in;
      position: relative;
    }

    .screenshot-figure:hover {
      box-shadow: var(--shadow-lg);
      transform: translateY(-4px);
      border-color: var(--accent);
    }

    .screenshot-figure img {
      max-width: 100%;
      max-height: 480px;
      width: auto;
      height: auto;
      display: block;
      margin: 0 auto;
      transition: transform 0.5s ease;
    }

    .screenshot-figure:hover img {
      transform: scale(1.015);
    }

    .screenshot-figure figcaption {
      padding: 14px 20px;
      background: var(--bg-card);
      border-top: 1px solid var(--border-color);
      font-size: 0.875rem;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .fig-number {
      font-weight: 700;
      color: var(--text-main);
      margin-right: 6px;
    }

    .zoom-hint {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--accent);
      background: var(--bg-callout-info);
      padding: 4px 10px;
      border-radius: 12px;
      transition: var(--transition);
    }

    .screenshot-figure:hover .zoom-hint {
      background: var(--accent);
      color: white;
    }

    /* Tables */
    .table-container {
      overflow-x: auto;
      margin: 24px 0;
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      box-shadow: var(--shadow-sm);
    }

    table {
      width: 100%;
      border-collapse: collapse;
      text-align: left;
      background: var(--bg-card);
    }

    thead {
      background: var(--bg-code);
      border-bottom: 2px solid var(--border-color);
    }

    th {
      padding: 16px 20px;
      font-family: var(--font-main);
      font-weight: 700;
      color: var(--text-main);
      font-size: 0.9rem;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    td {
      padding: 16px 20px;
      border-bottom: 1px solid var(--border-color);
      color: var(--text-main);
      font-size: 0.925rem;
    }

    tbody tr:last-child td {
      border-bottom: none;
    }

    tbody tr:hover {
      background: var(--bg-code);
    }

    /* Lightbox Modal */
    .lightbox-modal {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: rgba(5, 20, 36, 0.92);
      backdrop-filter: blur(10px);
      z-index: 2000;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
      padding: 40px;
    }

    .lightbox-modal.active {
      opacity: 1;
      pointer-events: all;
    }

    .lightbox-content {
      max-width: 90vw;
      max-height: 80vh;
      object-fit: contain;
      border-radius: var(--radius-md);
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
      border: 2px solid rgba(255, 255, 255, 0.15);
      transform: scale(0.95);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .lightbox-modal.active .lightbox-content {
      transform: scale(1);
    }

    .lightbox-caption {
      margin-top: 20px;
      color: white;
      font-size: 1rem;
      font-weight: 500;
      text-align: center;
      max-width: 800px;
    }

    .lightbox-close {
      position: absolute;
      top: 24px;
      right: 24px;
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.15);
      border: 1px solid rgba(255, 255, 255, 0.3);
      color: white;
      font-size: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: var(--transition);
    }

    .lightbox-close:hover {
      background: var(--accent);
      border-color: var(--accent);
      transform: rotate(90deg);
    }

    /* Footer fisso su due righe: barra di navigazione (stile intestazione del DT) e footer del DT */
    .app-footer {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      height: var(--footer-height);
      display: flex;
      flex-direction: column;
      z-index: 1000;
    }

    .footer-nav {
      height: var(--nav-height);
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
      align-items: center;
      gap: 16px;
      padding: 0 8px;
      background: var(--dt-head-bg);
      color: var(--dt-head-fg);
      font-family: var(--dt-font);
    }

    .footer-slot {
      min-width: 0;
      display: flex;
    }
    .footer-prev { justify-content: flex-start; }
    .footer-next { justify-content: flex-end; }

    .footer-info {
      text-align: center;
      white-space: nowrap;
      font-size: 14px;
    }

    .footer-btn {
      max-width: 100%;
      min-width: 0;
    }
    .footer-btn-arrow {
      font-size: 16px;
      flex-shrink: 0;
    }
    .footer-btn-title {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .dt-footer {
      height: var(--dtfoot-height);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 0 4px;
      background: var(--dt-foot-bg);
      color: #FFFFFF;
      font-family: var(--dt-font);
      font-size: 12px;
    }

    .dt-footer-fin {
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* Pulsante e pannello Finanziamento: solo su smartphone (vedi media query), come nel DT */
    .dt-theme-btn.dt-fin-btn { display: none; }
    .fin-sheet {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      padding: 8px 14px 22px;
      background: #313030;
      color: #FCF8F8;
      border-radius: 12px 12px 0 0;
      box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
      font-family: var(--dt-font);
      z-index: 1002;
    }
    .fin-sheet[hidden] { display: none; }
    .fin-sheet-handle {
      width: 44px;
      height: 4px;
      margin: 0 auto 10px;
      border-radius: 2px;
      background: #FCF8F8;
    }
    .fin-sheet-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .fin-sheet-title {
      font-size: 18px;
      font-weight: 700;
    }
    .fin-sheet-close {
      width: 36px;
      height: 36px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 0;
      background: transparent;
      color: #FCF8F8;
      cursor: pointer;
    }
    .fin-sheet-text {
      margin: 14px 10px 0;
      font-size: 14px;
      font-weight: 700;
      line-height: 1.5;
    }

    .dt-footer-controls {
      display: flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
    }

    .dt-theme-btn {
      width: 32px;
      height: 30px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 0;
      border-radius: 50%;
      background: transparent;
      color: #FFFFFF;
      cursor: pointer;
    }
    .dt-theme-btn:hover {
      background: #313030;
    }
    .dt-theme-btn:focus-visible {
      outline: 2px solid #FFFFFF;
      outline-offset: -2px;
    }
    .dt-share-btn[aria-expanded="true"] {
      background: #313030;
    }

    /* Popup Condividi: stessa grafica del popup del DT (solo collegamento) */
    .share-popup {
      position: fixed;
      right: 4px;
      bottom: calc(var(--dtfoot-height) + 4px);
      width: min(268px, calc(100vw - 8px));
      padding: 12px;
      background: #313030;
      color: #FCF8F8;
      border-radius: 10px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
      font-family: var(--dt-font);
      font-size: 13px;
      z-index: 1001;
    }
    .share-popup[hidden] {
      display: none;
    }
    .share-field {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .share-url {
      flex: 1;
      min-width: 0;
      height: 34px;
      padding: 0 12px;
      background: #1C1B1B;
      color: #FFFFFF;
      border: 0.8px solid #929090;
      border-radius: 50px;
      font-family: var(--dt-font);
      font-size: 14px;
      text-overflow: ellipsis;
    }
    .share-url:focus {
      outline: none;
      border-color: #FFFFFF;
    }
    .share-copy {
      width: 30px;
      height: 30px;
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      background: transparent;
      color: #FFFFFF;
      border: 0;
      border-radius: 50%;
      cursor: pointer;
    }
    .share-copy:hover {
      background: #484646;
    }
    .share-copy:focus-visible {
      outline: 2px solid #FFFFFF;
    }
    .share-feedback {
      min-height: 0;
      margin-top: 0;
      color: #9CCAFF;
      font-size: 12px;
    }
    .share-feedback:not(:empty) {
      margin-top: 8px;
    }

    /* Responsive Queries */
    @media (max-width: 1024px) {
      :root {
        --sidebar-width: 270px;
      }
      .main-content {
        padding: 24px 20px;
      }
    }

    @media (max-width: 768px) {
      .hero-banner {
        padding: 24px;
      }
      .hero-title {
        font-size: 1.85rem;
      }
      .search-box {
        display: none;
      }
    }

    /* Print Styles */
    @media print {
      .top-header, .sidebar, .btn-print, .btn-icon, .zoom-hint, .app-footer {
        display: none !important;
      }
      .app-container {
        margin-top: 0;
      }
      .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
      }
      .section-card {
        box-shadow: none !important;
        border: none !important;
        padding: 20px 0 !important;
        page-break-inside: avoid;
      }
      .screenshot-figure {
        page-break-inside: avoid;
      }
      body {
        background: white !important;
        color: black !important;
      }
    }

    /* Highlight Search Match */
    .search-match {
      background-color: rgba(243, 156, 18, 0.3);
      padding: 2px 4px;
      border-radius: 4px;
    }
    .hidden-by-search {
      display: none !important;
    }

/* Modular Navigation & Chapter Cards */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}
.chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}
.chapter-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.chapter-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.chapter-number {
  font-family: Georgia, serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--accent);
  background: rgba(0, 123, 201, 0.12);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chapter-card-title {
  font-family: Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.3;
}
.chapter-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
  flex-grow: 1;
}
.chapter-card-link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s ease;
}
.chapter-card:hover .chapter-card-link {
  gap: 10px;
}

/* ===== CLASSI SEMANTICHE E MENU LATERALE RAGGRUPPATO ===== */

/* Menu Laterale Raggruppato / Sottosezioni Espandibili */
.toc-parent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.toc-parent-header .toc-toggle {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  color: var(--text-muted);
  padding: 2px 6px;
}
.toc-parent-header.collapsed .toc-toggle {
  transform: rotate(-90deg);
}
.toc-sublist {
  max-height: 3000px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}
.toc-sublist.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}
/* Terzo livello dell'indice (es. 4.1.2) */
.toc-sublist-2 { padding-left: 12px; }
.toc-sublist-2 .toc-item a { font-size: 0.76rem; padding: 5px 10px; }

/* Tabella dei layer: rientro in base al livello del gruppo (classi l1-l4 sulla prima cella) */
.tabella-layer td:first-child { white-space: normal; min-width: 14em; }
.tabella-layer td.l1 { font-weight: 700; }
.tabella-layer td.l1 { padding-left: 0.9em; }
.tabella-layer td.l2 { padding-left: 2.4em; }
.tabella-layer td.l3 { padding-left: 3.9em; }
.tabella-layer td.l4 { padding-left: 5.4em; }
.tabella-layer tr.riga-gruppo td { background: var(--bg-callout-info); }

/* Alias Classi Semantiche (Italiano) */
.titolo-capitolo {
  font-size: 1.85rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.titolo-sezione {
  font-size: 1.35rem;
  color: var(--text-main);
  margin: 32px 0 16px 0;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}
.titolo-paragrafo {
  font-size: 1.1rem;
  color: var(--accent);
  margin: 20px 0 10px 0;
}

/* Callout semantici in italiano */
.nota, .suggerimento, .importante, .attenzione {
  border-left: 4px solid;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  margin: 24px 0;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.nota {
  background-color: var(--bg-callout-note);
  border-color: #3B82F6;
}
.suggerimento {
  background-color: var(--bg-callout-info);
  border-color: var(--accent);
}
.importante {
  background-color: var(--bg-callout-warn);
  border-color: var(--beta-color);
}
.attenzione {
  background-color: var(--bg-callout-audit);
  border-color: #EF4444;
}

/* Altri elementi semantici */
.riquadro-dati {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 16px 0;
}
.badge-lista {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

/* =========================================================
   GLOBAL SEARCH MODAL (MEDUSA DIGITAL TWIN DESIGN SYSTEM)
   ========================================================= */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 20px 30px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.search-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.search-modal-box {
  width: 100%;
  max-width: 720px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(-12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-modal-backdrop.active .search-modal-box {
  transform: scale(1) translateY(0);
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.search-modal-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.global-search-input {
  flex-grow: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  font-size: 1.12rem;
  font-weight: 500;
  outline: none;
}

.global-search-input::placeholder {
  color: var(--text-muted);
}

.search-modal-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-code);
  color: var(--text-main);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.search-modal-close:hover {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.search-modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--bg-code);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.search-shortcut-hint {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.search-modal-box:has(.search-modal-body:empty) .search-modal-header {
  border-bottom: none;
}

.search-modal-body {
  max-height: 58vh;
  overflow-y: auto;
  padding: 18px 24px;
}

.search-modal-body:empty {
  padding: 0;
  display: none;
}

.search-modal-body::-webkit-scrollbar {
  width: 8px;
}
.search-modal-body::-webkit-scrollbar-track {
  background: var(--bg-code);
}
.search-modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.search-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.search-result-card {
  display: block;
  padding: 16px 20px;
  margin-bottom: 12px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}

.search-result-card:hover, .search-result-card.focused {
  background: var(--bg-card);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.search-result-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.search-result-badge {
  display: inline-block;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-result-category {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.search-result-title {
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.search-result-snippet {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

mark.search-highlight {
  background-color: var(--beta-bg);
  color: var(--text-main);
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  border-bottom: 2px solid var(--beta-color);
}

.search-suggestions-container {
  padding: 12px 0;
}

.search-suggestions-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.search-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search-suggestion-pill {
  border: 1px solid var(--border-color);
  background: var(--bg-code);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.search-suggestion-pill:hover {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-no-results-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.search-no-results-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

/* =========================================================
   ELEMENTI "SOLO DESKTOP" E FIGURE IN FORMATO SMARTPHONE
   ========================================================= */
.callout.desktop-only {
  background-color: var(--bg-callout-note);
  border-color: var(--primary);
}
.callout.desktop-only .callout-title {
  color: var(--primary);
}
.badge-desktop {
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
  background: var(--bg-callout-note);
  color: var(--primary);
  border: 1px solid var(--primary);
  font-size: 0.68rem;
  padding: 1px 8px;
  white-space: nowrap;
}
.screenshot-figure.screenshot-portrait {
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.screenshot-figure.screenshot-portrait figcaption {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* =========================================================
   NAVIGAZIONE MOBILE (MENU A SCOMPARSA)
   ========================================================= */
.header-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--dt-btn-bg);
  border: 0.8px solid var(--dt-btn-border);
  color: var(--dt-btn-fg);
  cursor: pointer;
}
.brand-title-short,
.brand-subtitle-short {
  display: none;
}
.sidebar-backdrop {
  display: none;
}

/* Schermi intermedi (portatili piccoli, tablet orizzontali): intestazione su una riga */
@media (max-width: 1280px) {
  .brand-title-full {
    display: none;
  }
  .brand-title-short {
    display: inline;
  }
}

/* Layout compatto: tablet e smartphone (valore allineato a MOBILE_BREAKPOINT in main.js) */
@media (max-width: 900px) {
  :root {
    --header-height: 60px;
    --nav-height: 46px;
  }
  .top-header {
    padding: 0 8px 0 0;
    gap: 6px;
  }
  .brand-container {
    gap: 8px;
  }
  .header-menu-btn {
    display: inline-flex;
    order: 2;
  }
  .brand-logo {
    width: 41px;
    order: 1;
  }
  .brand-text {
    order: 3;
    gap: 2px;
  }
  .brand-title {
    font-size: 20px;
  }
  .brand-subtitle {
    font-size: 13px;
  }
  .brand-title-full,
  .brand-subtitle-full {
    display: none;
  }
  .brand-title-short,
  .brand-subtitle-short {
    display: inline;
  }
  .header-action-btn {
    min-width: 0;
    width: 36px;
    height: 36px;
    padding: 0;
  }
  .header-action-btn span {
    display: none;
  }

  /* Indice come pannello a scomparsa */
  .sidebar {
    width: min(86vw, 340px);
    transform: translateX(-100%);
    z-index: 1100;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--header-height) 0 var(--footer-height) 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
  body.sidebar-open {
    overflow: hidden;
  }
  .toc-item a {
    padding: 10px 12px;
    font-size: 0.92rem;
  }
  .toc-sublist .toc-item a {
    padding: 9px 12px;
    font-size: 0.86rem;
  }
  .toc-parent-header .toc-toggle {
    padding: 10px 12px;
  }

  /* Contenuto a tutta larghezza */
  .main-content {
    margin-left: 0;
    padding: 16px 12px;
    max-width: 100%;
    min-width: 0;
  }
  .section-card {
    padding: 22px 18px;
    margin-bottom: 24px;
    border-radius: var(--radius-md);
  }
  .section-header {
    padding-bottom: 12px;
    margin-bottom: 18px;
  }
  .section-title,
  .titolo-capitolo {
    font-size: 1.45rem;
    display: block;
  }
  .subsection-title,
  .titolo-sezione {
    font-size: 1.18rem;
    margin: 24px 0 12px 0;
  }
  .section-card p,
  .section-card li {
    overflow-wrap: anywhere;
  }
  .callout {
    padding: 14px 14px;
    gap: 10px;
  }
  .callout-icon {
    font-size: 1.2rem;
  }
  .screenshot-figure {
    margin: 22px 0;
  }
  .screenshot-figure figcaption {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
  }
  th, td {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
  th {
    font-size: 0.78rem;
  }
  /* Footer: solo i due pulsanti affiancati e il finanziamento in forma breve */
  .footer-nav {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }
  .footer-info {
    display: none;
  }
  .footer-btn {
    width: 100%;
    padding: 0 12px;
  }
  .footer-btn.next {
    justify-content: flex-end;
  }
  .dt-footer-fin { display: none; }
  .dt-theme-btn.dt-fin-btn { display: inline-flex; }

  /* Ricerca a schermo intero */
  .search-modal-backdrop {
    padding: 0;
  }
  .search-modal-box {
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
  .search-modal-body {
    max-height: none !important;
    flex: 1;
  }
  .search-modal-header {
    padding: 12px 14px;
  }
  .global-search-input {
    font-size: 1rem;
  }

  /* Visualizzatore immagini */
  .lightbox-modal {
    padding: 12px;
  }
  .lightbox-content {
    max-width: 100%;
    max-height: 75vh;
  }
  .lightbox-close {
    top: 12px;
    right: 12px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px;
  }
  .section-card {
    padding: 18px 14px;
  }
  .section-title,
  .titolo-capitolo {
    font-size: 1.3rem;
  }
}

/* Dispositivi touch: niente effetti hover che "restano attivi" dopo il tocco */
@media (hover: none) {
  .screenshot-figure:hover,
  .search-result-card:hover,
  .header-action-btn:hover {
    transform: none;
  }
  .screenshot-figure:hover img {
    transform: none;
  }
  .toc-item a:hover {
    transform: none;
  }
}

/* =========================================================
   VERSIONE 2: icone dei comandi e riga "Dove si trova"
   ========================================================= */
span.icona { display: inline-block; vertical-align: middle; line-height: 0; margin: 0 2px; }
img.icona { height: 1.5em; width: auto; vertical-align: middle; border-radius: 4px; box-shadow: 0 0 0 1px var(--border-color); }
/* Elenco dei comandi: icone piu' grandi e centrate */
.tabella-comandi td:first-child { text-align: center; white-space: nowrap; }
.tabella-comandi img.icona { height: 2em; }
.percorso {
  display: inline-block;
  margin: 4px 0 14px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  font-size: 0.9em;
  color: var(--text-main);
}
.percorso::before { content: "Dove si trova: "; font-weight: 700; color: var(--text-muted); }
