/* ════════════════════════════════════════════════════════════
   STAR-GEST PORTAL — site.css DEFINITIVO
   Palette: blu cartella + stella gialla (dall'icona)
   Font: Sora + JetBrains Mono
   ════════════════════════════════════════════════════════════ */
:root {
  --sg-blue:       #1a7fd4;
  --sg-blue-dark:  #0f5fa3;
  --sg-blue-deep:  #0a3d6b;
  --sg-blue-soft:  #e8f4ff;
  --sg-blue-dim:   #1a7fd420;
  --sg-star:       #f5c800;
  --sg-star-lt:    #ffe033;
  --sg-star-dim:   #f5c80020;
  --sg-paper:      #f4f7fb;
  --sg-paper-alt:  #eaf1f9;
  --sg-border:     #d0dff0;
  --sg-text:       #1a2a3a;
  --sg-text-muted: #5a7a9a;
  --sg-card-bg:    #ffffff;
  --sg-sidebar-w:  244px;
  --sg-radius:     10px;
  --sg-radius-lg:  16px;
  --sg-shadow:     0 2px 12px rgba(10,61,107,.09);
  --sg-shadow-lg:  0 8px 32px rgba(10,61,107,.16);
}
*,*::before,*::after{box-sizing:border-box}
body{font-family:'Sora',sans-serif;font-size:15px;color:var(--sg-text);background:var(--sg-paper);-webkit-font-smoothing:antialiased}
code,pre{font-family:'JetBrains Mono',monospace;font-size:13px}

/* ── Logo ─────────────────────────────────────────────────── */
/* Forza dimensioni contro max-width:100% di Bootstrap */
.sg-navbar .navbar-brand { padding: 0; }
.sg-navbar .navbar-brand img,
.sg-logo-img {
    height: 40px !important;
    width: 40px !important;
    max-width: 40px !important;
    min-width: 40px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    flex-shrink: 0;
}
.sg-logo-sidebar,
.sg-sidebar-brand img {
    height: 38px !important;
    width: 38px !important;
    max-width: 38px !important;
    min-width: 38px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 4px rgba(0,0,0,.4));
}
.sg-sidebar-logo-link { display:flex; align-items:center; text-decoration:none; }
.sg-logo-footer,
.sg-footer img {
    height: 32px !important;
    width: 32px !important;
    max-width: 32px !important;
    min-width: 32px;
    object-fit: contain;
    border-radius: 6px;
    vertical-align: middle;
    opacity: .9;
}

/* ── Navbar ───────────────────────────────────────────────── */
.sg-navbar{background:var(--sg-blue-deep);padding:12px 0;position:sticky;top:0;z-index:1030;border-bottom:3px solid var(--sg-star)}
.sg-brand{display:flex;align-items:center;gap:10px;text-decoration:none}
.sg-brand-text{font-size:1.25rem;font-weight:800;color:#fff;letter-spacing:-.02em}
.sg-brand-accent{color:var(--sg-star)}
.sg-navbar .nav-link{color:rgba(255,255,255,.78)!important;font-weight:500;font-size:14px;padding:6px 14px!important;border-radius:6px;transition:color .15s,background .15s}
.sg-navbar .nav-link:hover{color:#fff!important;background:rgba(255,255,255,.1)}

/* ── Buttons ──────────────────────────────────────────────── */
.sg-btn-primary{background:var(--sg-blue);border:none;color:#fff!important;font-weight:600;border-radius:var(--sg-radius);transition:background .15s,transform .1s,box-shadow .15s}
.sg-btn-primary:hover{background:var(--sg-blue-dark);transform:translateY(-1px);box-shadow:0 4px 16px rgba(26,127,212,.35)}

/* Outline su sfondo chiaro */
.sg-btn-outline{background:transparent;border:1.5px solid var(--sg-border);color:var(--sg-text)!important;font-weight:600;border-radius:var(--sg-radius);transition:border-color .15s,background .15s,color .15s}
.sg-btn-outline:hover{border-color:var(--sg-blue);background:var(--sg-blue-dim);color:var(--sg-blue)!important}

/* Outline su sfondo scuro (hero, navbar, cta, page-hero) */
.sg-hero .sg-btn-outline,
.sg-page-hero .sg-btn-outline,
.sg-cta-section .sg-btn-outline,
.sg-navbar .sg-btn-outline {
    border-color: rgba(255,255,255,.6)!important;
    color: #fff!important;
    background: transparent;
}
.sg-hero .sg-btn-outline:hover,
.sg-page-hero .sg-btn-outline:hover,
.sg-cta-section .sg-btn-outline:hover,
.sg-navbar .sg-btn-outline:hover {
    border-color: #fff!important;
    background: rgba(255,255,255,.12)!important;
    color: #fff!important;
}

.sg-btn-danger-soft{background:rgba(220,53,69,.1);border:1.5px solid rgba(220,53,69,.25);color:#dc3545!important;font-weight:500;border-radius:var(--sg-radius);transition:background .15s}
.sg-btn-danger-soft:hover{background:rgba(220,53,69,.18)}

/* ── Hero ─────────────────────────────────────────────────── */
.sg-hero{background:linear-gradient(135deg,var(--sg-blue-deep) 0%,var(--sg-blue-dark) 60%,#1060a0 100%);color:#fff;padding:90px 0 80px;position:relative;overflow:hidden}
.sg-hero::before{content:'';position:absolute;width:500px;height:500px;border-radius:50%;background:radial-gradient(circle,rgba(245,200,0,.15) 0%,transparent 70%);top:-80px;right:-60px;pointer-events:none}
.sg-hero::after{content:'';position:absolute;width:300px;height:300px;border-radius:50%;background:radial-gradient(circle,rgba(26,127,212,.3) 0%,transparent 70%);bottom:-60px;left:10%;pointer-events:none}
.sg-hero-badge{display:inline-flex;align-items:center;gap:6px;background:rgba(245,200,0,.15);border:1px solid rgba(245,200,0,.4);color:var(--sg-star-lt);padding:5px 14px;border-radius:20px;font-size:12px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;margin-bottom:20px}
.sg-hero-title{font-size:clamp(2rem,4vw,3.2rem);font-weight:800;line-height:1.1;letter-spacing:-.03em;color:#fff}
.sg-text-accent{color:var(--sg-star)}
.sg-hero-sub{font-size:1.05rem;color:rgba(255,255,255,.75);line-height:1.7;max-width:480px;margin-top:16px}

/* Mockup */
.sg-hero-visual{display:flex;justify-content:flex-end;padding:20px}
.sg-mockup-card{background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.15);border-radius:var(--sg-radius-lg);width:340px;overflow:hidden;box-shadow:var(--sg-shadow-lg);backdrop-filter:blur(8px)}
.sg-mockup-header{background:rgba(255,255,255,.07);padding:10px 16px;display:flex;align-items:center;border-bottom:1px solid rgba(255,255,255,.1)}
.sg-mockup-header .text-muted{color:rgba(255,255,255,.45)!important}
.sg-dot{width:11px;height:11px;border-radius:50%;margin-right:5px;display:inline-block}
.sg-dot.red{background:#ff5f57}.sg-dot.yellow{background:#febc2e}.sg-dot.green{background:#28c840}
.sg-mockup-body{padding:20px;display:flex;flex-direction:column;gap:12px}
.sg-mockup-stat{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:12px 16px;display:flex;align-items:center;gap:12px;font-size:13px;color:rgba(255,255,255,.85)}
.sg-mockup-stat i{font-size:18px}.sg-mockup-stat strong{margin-left:auto;font-weight:700;color:#fff;font-size:15px}

/* ── Features ─────────────────────────────────────────────── */
.sg-section-features{padding:90px 0;background:var(--sg-paper)}
.sg-section-title{font-size:2rem;font-weight:800;letter-spacing:-.025em;color:var(--sg-blue-deep)}
.sg-feature-card{background:var(--sg-card-bg);border:1.5px solid var(--sg-border);border-radius:var(--sg-radius-lg);padding:28px;height:100%;transition:border-color .2s,box-shadow .2s,transform .2s}
.sg-feature-card:hover{border-color:var(--sg-blue);box-shadow:0 6px 24px rgba(26,127,212,.14);transform:translateY(-3px)}
.sg-feature-icon{width:48px;height:48px;background:var(--sg-blue-dim);border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:22px;color:var(--sg-blue);margin-bottom:16px}
.sg-feature-title{font-size:1rem;font-weight:700;margin-bottom:8px;color:var(--sg-blue-deep)}
.sg-feature-desc{font-size:13.5px;color:var(--sg-text-muted);line-height:1.6;margin:0}

/* ── CTA ──────────────────────────────────────────────────── */
.sg-cta-section{background:linear-gradient(135deg,var(--sg-blue-deep),var(--sg-blue-dark));padding:80px 0;color:#fff}
.sg-cta-title{font-size:2rem;font-weight:800;letter-spacing:-.025em;color:#fff}
.sg-cta-sub{color:rgba(255,255,255,.75);font-size:1.05rem}

/* ── Footer ───────────────────────────────────────────────── */
.sg-footer{background:var(--sg-blue-deep);border-top:1px solid rgba(255,255,255,.08);padding:24px 0}
.sg-footer .text-muted,
.sg-footer small,
.sg-footer .small { color:rgba(255,255,255,.55)!important }
.sg-footer .sg-brand-text{font-size:1rem;color:#fff}

/* ── Page hero ────────────────────────────────────────────── */
.sg-page-hero{background:linear-gradient(135deg,var(--sg-blue-deep),var(--sg-blue-dark));color:#fff;padding:60px 0}
.sg-page-title{font-size:2.4rem;font-weight:800;letter-spacing:-.025em;color:#fff}
.sg-page-sub{color:rgba(255,255,255,.75);font-size:1.05rem}
.sg-section{background:var(--sg-paper)}
.sg-feature-big-icon{font-size:52px;line-height:1}
.sg-feature-row{padding:32px 0}
.sg-feature-list{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:1fr 1fr;gap:10px}
.sg-feature-list li{font-size:14px;color:var(--sg-text)}
.sg-divider{border-color:var(--sg-border);opacity:1;margin:0}

/* ── Login / Error ────────────────────────────────────────── */
.sg-login-icon{width:64px;height:64px;background:var(--sg-blue-dim);border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:28px;color:var(--sg-blue);margin:0 auto;border:2px solid var(--sg-border)}
.sg-error-icon{font-size:72px;color:var(--sg-blue);line-height:1;margin-bottom:16px}

/* ── Card & Inputs ────────────────────────────────────────── */
.sg-card{background:var(--sg-card-bg);border:1.5px solid var(--sg-border);border-radius:var(--sg-radius-lg);box-shadow:var(--sg-shadow)}
.sg-input{border:1.5px solid var(--sg-border);border-radius:var(--sg-radius);font-family:'Sora',sans-serif;font-size:14px;transition:border-color .15s,box-shadow .15s;background:#fff}
.sg-input:focus{border-color:var(--sg-blue);box-shadow:0 0 0 3px rgba(26,127,212,.14);background:#fff;outline:none}

/* ── Portal/Admin layout ──────────────────────────────────── */
.sg-portal-wrapper{display:flex;min-height:100vh}
.sg-sidebar{width:var(--sg-sidebar-w);background:var(--sg-blue-deep);display:flex;flex-direction:column;position:fixed;top:0;left:0;height:100vh;overflow-y:auto;z-index:100}
.sg-sidebar-admin{background:#072040}
.sg-sidebar-brand{padding:20px 20px 16px;border-bottom:1px solid rgba(255,255,255,.1);display:flex;align-items:center;justify-content:space-between;gap:8px}
.sg-sidebar-tag{font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;background:rgba(245,200,0,.18);color:var(--sg-star-lt);padding:3px 8px;border-radius:4px;border:1px solid rgba(245,200,0,.35)}
.sg-tag-admin{background:rgba(26,127,212,.25);color:#7ecfff;border-color:rgba(26,127,212,.4)}
.sg-sidebar-nav{flex:1;padding:12px 0;display:flex;flex-direction:column}
.sg-sidebar-section{font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:rgba(255,255,255,.35);padding:16px 20px 6px}
.sg-sidebar-link{display:flex;align-items:center;gap:10px;padding:9px 20px;color:rgba(255,255,255,.7);text-decoration:none;font-size:14px;font-weight:500;border-left:3px solid transparent;transition:color .15s,background .15s,border-color .15s}
.sg-sidebar-link i{font-size:16px;width:18px;text-align:center}
.sg-sidebar-link:hover{color:rgba(255,255,255,.95);background:rgba(255,255,255,.07)}
.sg-sidebar-link.active{color:#fff;background:rgba(26,127,212,.25);border-left-color:var(--sg-star)}

/* Sidebar footer: testo bianco su sfondo scuro */
.sg-sidebar-footer{padding:16px 20px;border-top:1px solid rgba(255,255,255,.08)}
.sg-sidebar-footer span,
.sg-sidebar-footer .text-muted,
.sg-sidebar-footer .small,
.sg-sidebar-footer small { color:rgba(255,255,255,.65)!important }

.sg-main{flex:1;margin-left:var(--sg-sidebar-w);display:flex;flex-direction:column;min-width:0}
.sg-topbar{background:var(--sg-card-bg);border-bottom:1.5px solid var(--sg-border);padding:12px 28px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:50}
.sg-topbar-right{display:flex;align-items:center;gap:10px}
.sg-content{padding:28px;flex:1}
.sg-page-header{margin-bottom:24px}
.sg-page-h1{font-size:1.6rem;font-weight:800;letter-spacing:-.02em;margin-bottom:4px;color:var(--sg-blue-deep)}

/* ── Badges ───────────────────────────────────────────────── */
.sg-badge-portal{background:rgba(16,185,129,.12);color:#059669;font-size:11px;font-weight:600;padding:4px 10px;border-radius:20px}
.sg-badge-admin{background:rgba(26,127,212,.12);color:var(--sg-blue);font-size:11px;font-weight:600;padding:4px 10px;border-radius:20px}

/* ── Stat cards ───────────────────────────────────────────── */
.sg-stat-card{background:var(--sg-card-bg);border:1.5px solid var(--sg-border);border-radius:var(--sg-radius-lg);padding:20px;display:flex;flex-direction:column;gap:6px;box-shadow:var(--sg-shadow)}
.sg-stat-icon{font-size:24px;line-height:1}
.sg-stat-value{font-size:2rem;font-weight:800;letter-spacing:-.03em;color:var(--sg-blue-deep);line-height:1}
.sg-stat-label{font-size:13px;color:var(--sg-text-muted);font-weight:500}

/* ── Guide cards ──────────────────────────────────────────── */
.sg-guide-card{display:flex;flex-direction:column;background:var(--sg-card-bg);border:1.5px solid var(--sg-border);border-radius:var(--sg-radius-lg);padding:20px;height:100%;text-decoration:none;color:var(--sg-text);transition:border-color .18s,box-shadow .18s,transform .18s}
.sg-guide-card:hover{border-color:var(--sg-blue);box-shadow:0 4px 20px rgba(26,127,212,.14);transform:translateY(-2px);color:var(--sg-text)}
.sg-guide-cat{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--sg-blue);margin-bottom:8px}
.sg-guide-title{font-weight:700;font-size:15px;margin-bottom:6px;color:var(--sg-blue-deep);line-height:1.35}
.sg-guide-desc{font-size:13px;color:var(--sg-text-muted);line-height:1.55;flex:1}
.sg-guide-badge{display:inline-flex;align-items:center;background:var(--sg-blue-dim);color:var(--sg-blue);font-size:11px;font-weight:600;padding:3px 9px;border-radius:20px;border:1px solid rgba(26,127,212,.2)}
.sg-badge-attach{background:rgba(245,200,0,.12);color:#a07800;border-color:rgba(245,200,0,.3)}

/* ── Guida detail ─────────────────────────────────────────── */
.sg-guida-title{font-size:1.7rem;font-weight:800;letter-spacing:-.02em;color:var(--sg-blue-deep);line-height:1.2;margin-bottom:10px}
.sg-guida-desc{font-size:1.05rem;line-height:1.65}
.sg-guida-meta{font-size:12.5px;color:var(--sg-text-muted);padding:12px 0;border-top:1px solid var(--sg-border);border-bottom:1px solid var(--sg-border);margin-bottom:24px}
.sg-guida-content{font-size:15px;line-height:1.75;color:var(--sg-text)}
.sg-guida-content h2,.sg-guida-content h3{font-weight:700;margin-top:28px;margin-bottom:12px;color:var(--sg-blue-deep)}
.sg-guida-content p{margin-bottom:14px}
.sg-guida-content ul,.sg-guida-content ol{padding-left:22px;margin-bottom:14px}
.sg-badge-cat{background:var(--sg-blue-dim);color:var(--sg-blue);font-size:12px;font-weight:600;padding:4px 12px;border-radius:20px;border:1px solid rgba(26,127,212,.2)}
.sg-video-wrap{border-radius:var(--sg-radius-lg);overflow:hidden;border:1.5px solid var(--sg-border)}
.sg-video-caption{background:var(--sg-paper-alt);border-top:1px solid var(--sg-border);padding:10px 16px;font-size:13px;color:var(--sg-text-muted);font-weight:500}
.sg-allegato{padding:10px 0;border-bottom:1px solid var(--sg-border);display:flex;align-items:center}
.sg-allegato:last-child{border-bottom:none}
.sg-allegato-link{color:var(--sg-text);text-decoration:none;font-size:14px;font-weight:500}
.sg-allegato-link:hover{color:var(--sg-blue)}
.sg-correlata-item{display:block;padding:10px 12px;border-radius:8px;text-decoration:none;color:var(--sg-text);transition:background .15s;border-bottom:1px solid var(--sg-border)}
.sg-correlata-item:last-child{border-bottom:none}
.sg-correlata-item:hover{background:var(--sg-paper-alt);color:var(--sg-text)}
.sg-correlata-title{font-size:13.5px;font-weight:600;margin-bottom:2px}

/* ── Empty state ──────────────────────────────────────────── */
.sg-empty-state{text-align:center;padding:60px 20px;color:var(--sg-text-muted)}
.sg-empty-state i{font-size:48px;display:block;margin-bottom:12px;color:var(--sg-border)}
.sg-empty-state p{font-size:15px;margin-bottom:16px}

/* ── Admin table ──────────────────────────────────────────── */
.sg-table{font-size:14px}
.sg-table thead th{background:var(--sg-paper-alt);font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--sg-text-muted);border-bottom:1.5px solid var(--sg-border);padding:10px 16px}
.sg-table tbody td{padding:12px 16px;border-bottom:1px solid var(--sg-border);vertical-align:middle}
.sg-table tbody tr:last-child td{border-bottom:none}
.sg-table tbody tr:hover{background:var(--sg-paper-alt)}
.sg-list-item{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-bottom:1px solid var(--sg-border)}
.sg-list-item:last-child{border-bottom:none}
.sg-list-title{font-size:14px;font-weight:600}

/* ── Permessi clienti ─────────────────────────────────────── */
.sg-permessi-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:8px;margin-top:10px}
.sg-permesso-check{display:flex;align-items:center;gap:8px;background:var(--sg-paper-alt);border:1.5px solid var(--sg-border);border-radius:8px;padding:8px 12px;cursor:pointer;transition:border-color .15s,background .15s;user-select:none}
.sg-permesso-check:has(input:checked){border-color:var(--sg-blue);background:var(--sg-blue-dim)}
.sg-permesso-check input{width:16px;height:16px;accent-color:var(--sg-blue);cursor:pointer;flex-shrink:0}
.sg-permesso-check span{font-size:13px;font-weight:600;color:var(--sg-text)}
.sg-permesso-check small{font-size:11px;color:var(--sg-text-muted);display:block}

/* ── Navigazione categorie portale ───────────────────────── */
.sg-cat-nav{position:sticky;top:80px}
.sg-cat-nav-title{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--sg-text-muted);padding:4px 4px 10px;border-bottom:1px solid var(--sg-border);margin-bottom:6px}
.sg-cat-link{display:flex;align-items:center;padding:8px 10px;border-radius:8px;text-decoration:none;color:var(--sg-text);font-size:14px;font-weight:500;transition:background .15s,color .15s;margin-bottom:2px}
.sg-cat-link:hover{background:var(--sg-paper-alt);color:var(--sg-blue)}
.sg-cat-link.active{background:var(--sg-blue-dim);color:var(--sg-blue);font-weight:700}
.sg-cat-count{margin-left:auto;background:var(--sg-paper-alt);color:var(--sg-text-muted);font-size:11px;font-weight:600;padding:1px 7px;border-radius:10px;min-width:22px;text-align:center}
.sg-cat-link.active .sg-cat-count{background:var(--sg-blue);color:#fff}
.sg-cat-header{font-size:1.1rem;font-weight:700;color:var(--sg-blue-deep);padding:10px 14px;background:var(--sg-blue-dim);border-radius:var(--sg-radius);border-left:4px solid var(--sg-blue)}
.sg-sidebar-sub{padding-left:36px!important;font-size:13px!important;opacity:.85}
.sg-sidebar-sub i{font-size:13px!important}
.sg-sidebar-sub.active{opacity:1}

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb-item a{color:var(--sg-text-muted);text-decoration:none;font-size:13px}
.breadcrumb-item.active{color:var(--sg-text);font-size:13px}
.breadcrumb-item+.breadcrumb-item::before{color:var(--sg-border)}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width:768px){
  .sg-sidebar{width:100%;height:auto;position:relative;flex-direction:row;flex-wrap:wrap}
  .sg-main{margin-left:0}
  .sg-sidebar-nav{flex-direction:row;flex-wrap:wrap}
  .sg-sidebar-section{display:none}
  .sg-sidebar-link{padding:8px 14px;font-size:13px;border-left:none;border-bottom:3px solid transparent}
  .sg-sidebar-link.active{border-bottom-color:var(--sg-star);border-left:none}
  .sg-content{padding:16px}
  .sg-feature-list{grid-template-columns:1fr}
  .sg-permessi-grid{grid-template-columns:1fr 1fr}
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤992px) e Mobile (≤768px / ≤480px)
   ════════════════════════════════════════════════════════════ */

/* ── Tablet (≤992px) ─────────────────────────────────────── */
@media (max-width: 992px) {

  /* Sidebar si trasforma in topbar orizzontale */
  .sg-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: column;
  }

  .sg-sidebar-brand {
    padding: 12px 16px;
  }

  .sg-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 4px 8px 8px;
    gap: 2px;
  }

  .sg-sidebar-section { display: none; }

  .sg-sidebar-link {
    padding: 7px 12px;
    font-size: 13px;
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: 6px;
    flex: 0 0 auto;
  }
  .sg-sidebar-link.active {
    border-left: none;
    border-bottom-color: var(--sg-star);
    background: rgba(26,127,212,.2);
  }
  .sg-sidebar-link i { width: auto; }

  .sg-sidebar-footer {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(255,255,255,.08);
  }

  .sg-main { margin-left: 0; }

  .sg-topbar { padding: 10px 16px; }

  .sg-content { padding: 20px 16px; }

  /* Categorie guide: nascondi sidebar, usa select */
  .sg-cat-nav { position: static; margin-bottom: 16px; }

  /* Hero */
  .sg-hero { padding: 60px 0 50px; }
  .sg-hero-title { font-size: 2.2rem; }

  /* Admin table: scroll orizzontale */
  .sg-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Mobile (≤768px) ─────────────────────────────────────── */
@media (max-width: 768px) {

  /* ── Navbar pubblica ── */
  .sg-navbar { padding: 10px 0; }
  .sg-navbar .navbar-toggler {
    border-color: rgba(255,255,255,.3);
    padding: 4px 8px;
  }
  .sg-navbar .navbar-toggler-icon {
    filter: invert(1);
  }
  .sg-navbar .navbar-collapse {
    background: var(--sg-blue-deep);
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 8px 0 12px;
    margin-top: 8px;
  }
  .sg-navbar .nav-link {
    padding: 10px 20px !important;
    border-radius: 0;
  }
  .sg-navbar .d-flex {
    padding: 8px 20px 0;
    flex-direction: column;
    gap: 8px !important;
  }
  .sg-navbar .d-flex .btn { width: 100%; text-align: center; }

  /* ── Hero ── */
  .sg-hero { padding: 50px 0 40px; }
  .sg-hero-title { font-size: 1.9rem; }
  .sg-hero-sub { font-size: .95rem; }
  .sg-hero .d-flex { flex-direction: column !important; }
  .sg-hero .btn { width: 100%; text-align: center; }

  /* ── Page hero ── */
  .sg-page-title { font-size: 1.8rem; }
  .sg-page-hero { padding: 40px 0; }

  /* ── Features ── */
  .sg-section-features { padding: 50px 0; }
  .sg-section-title { font-size: 1.6rem; }
  .sg-feature-list { grid-template-columns: 1fr; }
  .sg-feature-row { padding: 20px 0; }

  /* ── CTA ── */
  .sg-cta-section { padding: 50px 0; }
  .sg-cta-title { font-size: 1.5rem; }
  .sg-cta-section .btn { width: 100%; }

  /* ── Cards ── */
  .sg-card { border-radius: 12px; }
  .sg-guide-card { padding: 16px; }

  /* ── Page header ── */
  .sg-page-header { flex-direction: column !important; align-items: flex-start !important; gap: 12px; }
  .sg-page-h1 { font-size: 1.35rem; }

  /* ── Stat cards ── */
  .sg-stat-value { font-size: 1.6rem; }

  /* ── Permessi grid ── */
  .sg-permessi-grid { grid-template-columns: 1fr; }

  /* ── Categorie sidebar (portale) ── */
  .sg-cat-nav { display: none; }
  .sg-cat-nav-mobile { display: block !important; }

  /* ── Admin table ── */
  .sg-table { font-size: 13px; }
  .sg-table thead th { padding: 8px 12px; }
  .sg-table tbody td { padding: 10px 12px; }

  /* ── Guida dettaglio ── */
  .sg-guida-title { font-size: 1.35rem; }

  /* ── Footer ── */
  .sg-footer .row { flex-direction: column; gap: 6px; }
  .sg-footer .text-md-end { text-align: left !important; }

  /* ── Sidebar portale/admin ── */
  .sg-sidebar-nav { gap: 0; }
  .sg-sidebar-link { font-size: 12px; padding: 6px 10px; }
  .sg-sidebar-link i { display: none; }
  .sg-sidebar-footer { flex-wrap: wrap; }
}

/* ── Mobile piccolo (≤480px) ─────────────────────────────── */
@media (max-width: 480px) {

  .sg-hero-title { font-size: 1.6rem; }
  .sg-hero-badge { font-size: 10px; }

  .sg-page-title { font-size: 1.5rem; }

  .sg-content { padding: 14px 12px; }
  .sg-topbar { padding: 10px 12px; }

  /* Bottoni affiancati diventano colonna */
  .sg-page-header .btn,
  .d-flex.gap-2 > .btn { font-size: 13px; padding: 7px 14px; }

  /* Nasconde colonne meno importanti nelle tabelle */
  .sg-table .d-none-xs { display: none !important; }

  /* Mockup TV: nascosto su schermi piccoli */
  .sg-tv-visual { display: none !important; }

  /* HelpDesk step cards: 1 colonna */
  .sg-step-card { padding: 18px; }

  /* Logo sidebar più piccolo */
  .sg-logo-sidebar,
  .sg-sidebar-brand img {
    height: 30px !important;
    width: 30px !important;
    max-width: 30px !important;
    min-width: 30px;
  }
  .sg-logo-img,
  .sg-navbar .navbar-brand img {
    height: 34px !important;
    width: 34px !important;
    max-width: 34px !important;
    min-width: 34px;
  }
}

/* ── Utility: select mobile per categorie ─────────────────── */
.sg-cat-nav-mobile {
  display: none; /* visibile solo su mobile via media query */
}
.sg-cat-select {
  border: 1.5px solid var(--sg-border);
  border-radius: var(--sg-radius);
  padding: 9px 14px;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--sg-text);
  background: #fff;
  width: 100%;
  cursor: pointer;
  transition: border-color .15s;
}
.sg-cat-select:focus {
  border-color: var(--sg-blue);
  box-shadow: 0 0 0 3px rgba(26,127,212,.14);
  outline: none;
}

/* ════════════════════════════════════════════════════════════
   MOBILE NAVBAR + DRAWER (portale e admin)
   ════════════════════════════════════════════════════════════ */

/* ── Mobile navbar bar ── */
.sg-mobile-nav-bar {
    background: var(--sg-blue-deep);
    border-bottom: 3px solid var(--sg-star);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 200;
}
.sg-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.sg-mobile-brand-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: rgba(245,200,0,.18);
    color: var(--sg-star-lt);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(245,200,0,.35);
}
.sg-mobile-admin-tag {
    background: rgba(26,127,212,.25);
    color: #7ecfff;
    border-color: rgba(26,127,212,.4);
}
.sg-hamburger {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    padding: 0;
    line-height: 1;
    cursor: pointer;
}

/* ── Drawer overlay ── */
.sg-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 300;
}
.sg-drawer-overlay.open { display: block; }

/* ── Drawer panel ── */
.sg-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--sg-blue-deep);
    z-index: 400;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
}
.sg-drawer.open { transform: translateX(0); }

.sg-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sg-drawer-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.6);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}
.sg-drawer-close:hover { color: #fff; }

.sg-drawer-nav {
    flex: 1;
    padding: 12px 0;
}
.sg-drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.sg-drawer-link i { font-size: 18px; width: 22px; text-align: center; }
.sg-drawer-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sg-drawer-link.active {
    color: #fff;
    background: rgba(26,127,212,.25);
    border-left-color: var(--sg-star);
}
.sg-drawer-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    padding: 16px 20px 6px;
}
.sg-drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ── Mobile breadcrumb ── */
.sg-mobile-breadcrumb {
    background: var(--sg-paper-alt);
    border-bottom: 1px solid var(--sg-border);
    padding: 10px 16px;
    overflow-x: auto;
    white-space: nowrap;
}
.sg-mobile-breadcrumb .breadcrumb { flex-wrap: nowrap; margin: 0; }

/* ── Desktop: sidebar nascosta su mobile ── */
@media (max-width: 991px) {
    .sg-main { margin-left: 0 !important; }
    .sg-content { padding: 16px; }
    .sg-topbar { display: none !important; }
}

/* ── Video responsive ── */
.sg-video-responsive {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}
.sg-video-responsive iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ── Guida content responsive ── */
.sg-guida-content img  { max-width: 100%; height: auto; border-radius: 8px; }
.sg-guida-content table { width: 100%; overflow-x: auto; display: block; font-size: 14px; }
.sg-guida-content pre  { overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--sg-paper-alt); padding: 12px 16px; border-radius: 8px; border: 1px solid var(--sg-border); }

/* ── Mobile tweaks generali ── */
@media (max-width: 768px) {
    .sg-guida-title  { font-size: 1.3rem; line-height: 1.3; }
    .sg-page-h1      { font-size: 1.3rem; }
    .sg-stat-value   { font-size: 1.6rem; }
    .sg-hero         { padding: 50px 0 40px; }
    .sg-hero-title   { font-size: 1.9rem; }
    .sg-page-hero    { padding: 40px 0; }
    .sg-page-title   { font-size: 1.8rem; }
    .sg-cta-section  { padding: 50px 0; }
    .sg-cta-title    { font-size: 1.5rem; }
    .sg-section-features { padding: 50px 0; }
    .sg-feature-list { grid-template-columns: 1fr; }
    .sg-feature-row  { padding: 20px 0; }
    .sg-permessi-grid { grid-template-columns: 1fr; }
    .sg-cat-nav      { display: none; }
    .sg-cat-nav-mobile { display: block !important; }
    .sg-table        { font-size: 13px; }
    .sg-footer .row  { flex-direction: column; gap: 6px; }
    .sg-footer .text-md-end { text-align: left !important; }
    .sg-hero .d-flex  { flex-direction: column !important; }
    .sg-hero .btn, .sg-cta-section .btn { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
    .sg-hero-title   { font-size: 1.6rem; }
    .sg-page-title   { font-size: 1.5rem; }
    .sg-content      { padding: 12px; }
    .sg-guida-title  { font-size: 1.15rem; }
    .sg-tv-visual    { display: none !important; }
    .sg-logo-img,
    .sg-navbar .navbar-brand img {
        height: 34px !important; width: 34px !important;
        max-width: 34px !important; min-width: 34px;
    }
}

/* ── Fix testo che esce dal viewport su mobile ── */
.sg-guida-content,
.sg-guida-content * {
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Previeni overflow orizzontale globale su mobile */
body {
    overflow-x: hidden;
}
.sg-portal,
.sg-main,
.sg-content {
    overflow-x: hidden;
    min-height: 0;
}

/* Fix altezza pagina — il wrapper non deve bloccare lo scroll */
.sg-portal-wrapper {
    min-height: 100vh;
    overflow: visible;
}

/* La sidebar fixed non influenza l'altezza del body */
@media (max-width: 991px) {
    .sg-portal-wrapper {
        display: block;
    }
    .sg-main {
        margin-left: 0;
        width: 100%;
        min-height: calc(100vh - 56px);
    }
}
