/* SCOVAFUNGHI — "Nel bosco": tema scuro dello strumento (stesso stile del Piano di ricerca di BioDog) */
.nb { --bg: #0F1A17; --panel: #16241F; --panel2: #1E2F29; --campo: #0E1714; --line: #2A3F37; --text: #E8F1EC; --muted: #9DB3A9;
      --amber: #F5A524; --amber2: #FFC457; --mint: #3FC77F; --red: #E5484D; --blue: #4CC3FF; --pw: 380px; }
html:has(body.nb) { height: 100%; background: #0F1A17; }
body.nb { margin: 0; height: 100%; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: none;
          background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
.nb .hidden { display: none !important; }
.nb button { font: inherit; cursor: pointer; }
.nb a { color: var(--amber2); }

/* barra in alto */
.nb .top { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line); z-index: 5; }
.nb .top .brand { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.nb .top .brand b { font-weight: 800; letter-spacing: .02em; white-space: nowrap; font-size: 15px; }
.nb .top .brand span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb .top .spacer { flex: 1; }
.nb .top a.back { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.nb .menu-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--amber); color: #1A1200; border: 1px solid var(--amber); border-radius: 10px; padding: 7px 11px; font-weight: 800; font-size: 13px; flex: none; }
.nb .menu-btn[aria-expanded="true"] { background: var(--panel2); color: var(--amber2); }
.nb .chip { height: 32px; padding: 0 9px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 12px; white-space: nowrap; flex: none; }
.nb .chip.allarme { border-color: var(--amber); color: var(--amber2); background: #3A2E12; }

/* corpo: pannello laterale a scomparsa sopra la mappa */
.nb .app { flex: 1; display: flex; min-height: 0; position: relative; }
.nb .panel { position: absolute; top: 0; bottom: 0; left: 0; width: var(--pw); background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; z-index: 1200; box-shadow: 10px 0 30px rgba(0,0,0,.35); transition: transform .25s ease; }
.nb .app.chiuso .panel { transform: translateX(-100%); box-shadow: none; }
.nb .panel-tab { position: absolute; top: 50%; left: var(--pw); z-index: 1201; transform: translateY(-50%); width: 26px; height: 64px; border: 1px solid var(--line); border-left: 0; border-radius: 0 12px 12px 0; background: var(--panel); color: var(--amber2); font-size: 18px; font-weight: 800; display: flex; align-items: center; justify-content: center; transition: left .25s ease; box-shadow: 6px 0 14px rgba(0,0,0,.3); }
.nb .app.chiuso .panel-tab { left: 0; }

.nb .stima { margin: 8px 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; background: var(--campo); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; color: var(--text); }
.nb .stima .liv { font-size: 16px; font-weight: 800; line-height: 1.1; }
.nb .stima small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.nb .stima .vai { flex: none; background: var(--amber); color: #1A1200; border-radius: 9px; padding: 6px 9px; font-weight: 800; font-size: 12px; }
.nb .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.nb .tabs button { background: var(--panel2); color: var(--muted); border: 1px solid transparent; border-radius: 10px; padding: 6px 4px; font-size: 12px; font-weight: 700; line-height: 1.15; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.nb .tabs button i { font-style: normal; font-size: 16px; }
.nb .tabs button small { display: block; font-weight: 600; font-size: 11.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb .tabs button[aria-selected="true"] { background: #243A32; color: var(--text); border-color: var(--amber); }
.nb .tabs button.on small { color: var(--mint); }
.nb .tabs button.rec { border-color: var(--red); color: #FFB4B7; }
.nb .tabs button.rec small { color: #FFB4B7; }
.nb .tabs button.sos { color: #FFB4B7; }
.nb .steps { flex: 1; overflow: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.nb .foot { font-size: 12px; color: var(--muted); line-height: 1.45; border-top: 1px solid var(--line); padding: 8px 12px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.nb .foot a { color: var(--muted); }

/* contenuti dei pannelli */
.nb h2 { font-size: 15px; font-weight: 800; margin: 0 0 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nb h2 a, .nb h2 button { font-size: 12px; font-weight: 700; color: var(--amber2); background: none; border: 0; padding: 0; text-decoration: underline; }
.nb h3.sub { font-size: 12px; font-weight: 800; margin: 14px 0 6px; color: var(--amber2); text-transform: uppercase; letter-spacing: .08em; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nb p.help { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 10px; }
.nb p.nota { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin: 8px 0 0; }
.nb .row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.nb .row > * { flex: 1; min-width: 0; }
.nb .row > .fix { flex: none; }
.nb .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 700; font-size: 13px; width: 100%; text-decoration: none; text-align: center; }
.nb .btn:hover { border-color: var(--amber); }
.nb .btn.primary { background: var(--amber); color: #1A1200; border-color: var(--amber); }
.nb .btn.primary:hover { background: var(--amber2); }
.nb .btn.danger { color: #FFB4B7; }
.nb .btn.rec { background: #4A1D1F; border-color: var(--red); color: #FFB4B7; }
.nb .btn.grande { padding: 13px 12px; font-size: 15px; }
.nb .btn.sos { background: var(--red); border-color: var(--red); color: #fff; font-size: 16px; font-weight: 800; padding: 13px; }
.nb .btn small { font-weight: 600; font-size: 11.5px; color: inherit; opacity: .8; display: block; }
.nb .btn.col { flex-direction: column; gap: 2px; padding: 8px 4px; }
.nb .btn.col i { font-style: normal; font-size: 18px; }
.nb .link { display: inline; background: none; border: 0; padding: 0; color: var(--amber2); font-weight: 700; text-decoration: underline; font-size: 12px; }
.nb .link.muted { color: var(--muted); font-weight: 600; }
.nb input[type="text"] { width: 100%; background: var(--campo); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; font-size: 15px; }
.nb input[type="text"]::placeholder { color: #6E8379; }
.nb label.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.nb label.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; color: var(--text); }
.nb label.chk input { width: 18px; height: 18px; accent-color: var(--amber); }
.nb .stat { background: var(--campo); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; line-height: 1.5; }
.nb .stat b { color: var(--amber2); }
.nb .stat.ok { border-color: #245C3F; }
.nb .stat.warn { border-color: #6B4A12; }
.nb .stat.bad { border-color: #7A2A2D; background: #2A1416; }
.nb .stat.bad b { color: #FFB4B7; }
.nb .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.nb .kpis.tre { grid-template-columns: repeat(3, 1fr); }
.nb .kpi { background: var(--campo); border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; text-align: center; }
.nb .kpi b { display: block; font-size: 16px; font-weight: 800; color: var(--amber2); line-height: 1.15; white-space: nowrap; }
.nb .kpi span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.nb .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.nb .pill { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 9999px; padding: 6px 11px; font-size: 12px; font-weight: 700; }
.nb .pill[aria-pressed="true"] { border-color: var(--amber); background: #3A2E12; color: var(--amber2); }
.nb .grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0; }
.nb .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.nb .lista { list-style: none; margin: 0; padding: 0; }
.nb .riga { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; font-size: 13px; background: var(--campo); width: 100%; text-align: left; color: var(--text); }
.nb .riga > i { font-style: normal; font-size: 17px; text-align: center; }
.nb .riga > i.num { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 13px; }
.nb .riga b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb .riga small { color: var(--muted); display: block; font-size: 12px; }
.nb .riga .azioni { display: flex; gap: 4px; }
.nb .mini { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 5px 8px; font-size: 12px; font-weight: 700; }
.nb .mini.amber { color: var(--amber2); border-color: #6B4A12; }
.nb .mini.danger { color: #FFB4B7; }
.nb .righe .r { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.nb .righe .r b { font-size: 16px; font-weight: 800; }
.nb .ore { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 4px; margin: 8px 0; }
.nb .ora { flex: none; width: 54px; background: var(--campo); border: 1px solid var(--line); border-radius: 10px; padding: 6px 0; display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--muted); }
.nb .ora b { color: var(--text); font-size: 12px; }
.nb .ora i { font-style: normal; font-size: 17px; }
.nb .ora .p { color: var(--blue); font-weight: 700; }
.nb .giorni7 { display: flex; gap: 4px; margin-top: 8px; }
.nb .giorni7 div { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.nb .giorni7 span { display: block; height: 7px; border-radius: 9999px; margin-top: 3px; }
.nb .livello { font-size: 22px; font-weight: 900; line-height: 1.1; }
.nb .coord { font-size: 22px; font-weight: 800; letter-spacing: .02em; color: var(--text); }
.nb .stat .consiglio b { color: var(--text); }

/* mappa e strumenti sopra la mappa */
.nb .mapwrap { flex: 1; position: relative; min-width: 0; z-index: 1; isolation: isolate; }
.nb #nb-mappa { position: absolute; inset: 0; background: var(--campo); }
.nb .hud { position: absolute; z-index: 1000; }
.nb .hud.tl { top: 10px; left: 10px; right: 64px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.nb .badge { background: rgba(15,26,23,.92); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px; font-weight: 700; pointer-events: auto; text-align: left; max-width: 100%; }
.nb .badge.amber { border-color: var(--amber); color: var(--amber2); }
.nb .badge.warn { border-color: var(--amber); background: rgba(58,46,18,.95); color: #FFE3A3; font-weight: 600; line-height: 1.35; }
.nb .badge.rec { border-color: var(--red); color: #FFB4B7; }
.nb .badge.rec::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: nb-blink 1s infinite; }
@keyframes nb-blink { 50% { opacity: .2; } }
.nb .mapbtns { position: absolute; top: 10px; right: 10px; z-index: 1000; display: flex; flex-direction: column; gap: 6px; }
.nb .mapbtns button { width: 42px; height: 42px; border-radius: 10px; background: rgba(15,26,23,.92); color: var(--text); border: 1px solid var(--line); font-size: 17px; }
.nb .mapbtns button[aria-pressed="true"] { border-color: var(--amber); color: var(--amber2); }
.nb .dials { position: absolute; left: 10px; bottom: 22px; z-index: 1000; display: flex; gap: 8px; }
.nb .dial { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.nb .dial b { font: 700 10px Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--text); text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.nb .wind { width: 68px; height: 68px; border-radius: 50%; background: rgba(15,26,23,.92); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 0; }
.nb .wind svg { width: 58px; height: 58px; }
.nb .wind text { font: 700 9px Inter, sans-serif; fill: #FF5A5F; text-anchor: middle; }
.nb .wind.live { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(245,165,36,.35); }
.nb .guida { position: absolute; left: 10px; right: 64px; bottom: 22px; z-index: 1000; background: rgba(15,26,23,.95); border: 1px solid var(--amber); border-radius: 14px; padding: 10px; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.45); }
.nb .guida-testo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nb .guida-testo small { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb .guida-testo b { font-size: 22px; font-weight: 900; color: var(--amber2); line-height: 1.1; }
.nb .guida-testo span { font-size: 12px; color: var(--text); }
.nb #nb-freccia { flex: none; transition: transform .25s linear; }
.nb #nb-guida-chiudi { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); }

/* Leaflet nel tema scuro */
.nb .leaflet-container { font-family: inherit; background: var(--campo); }
.nb .leaflet-control-attribution { background: rgba(15,26,23,.8) !important; color: var(--muted) !important; font-size: 9px !important; }
.nb .leaflet-control-attribution a { color: var(--muted) !important; }
.nb .leaflet-bar a { background: rgba(15,26,23,.92); color: var(--text); border-color: var(--line); }
.nb .leaflet-bar a:hover { background: var(--panel2); color: var(--amber2); }
.nb .leaflet-popup-content-wrapper, .nb .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.nb .leaflet-popup-content { font-size: 13px; line-height: 1.45; }
.nb .leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.nb .nb-link { color: var(--amber2); font-weight: 700; text-decoration: underline; background: none; border: 0; padding: 0; margin-top: 4px; cursor: pointer; }
.nb .nb-spillo { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; }
.nb .nb-spillo span { transform: rotate(45deg); font-size: 16px; line-height: 1; }
.nb .nb-stima { width: 30px; height: 30px; border-radius: 9999px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.45); color: #fff; font-weight: 900; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.nb .nb-stima-top { width: 36px; height: 36px; font-size: 17px; outline: 3px solid var(--amber); color: #1A1200; }

/* accesso e avvisi */
.nb .gate { position: fixed; inset: 0; z-index: 2000; background: rgba(15,26,23,.86); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.nb .gate > div { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; max-width: 390px; width: 100%; }
.nb .gate h2 { font-size: 24px; font-weight: 900; margin: 6px 0 8px; display: block; }
.nb .gate p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 12px; }
.nb .gate .eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--amber2); margin: 0; font-weight: 700; }
.nb .gate ul { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; font-size: 13px; }
.nb .gate .btn { padding: 13px; font-size: 15px; }
.nb .gate a.link { display: block; text-align: center; margin-top: 12px; color: var(--muted); }
.nb .toast { position: fixed; left: 50%; transform: translateX(-50%); top: 70px; z-index: 2100; max-width: 92vw; padding: 11px 14px; border-radius: 12px; font-size: 13px; font-weight: 700; background: var(--panel2); color: var(--text); border: 1px solid var(--amber); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.nb .toast.errore { border-color: var(--red); background: #4A1D1F; color: #FFD9DB; }

@media (min-width: 901px) {
    .nb .app:not(.chiuso) .hud.tl, .nb .app:not(.chiuso) .dials, .nb .app:not(.chiuso) .guida { left: calc(var(--pw) + 36px); }
    .nb .hud.tl, .nb .dials, .nb .guida { transition: left .25s ease; }
}
@media (max-width: 900px) {
    .nb { --pw: min(88vw, 380px); }
    .nb .top a.back { display: none; }
}
@media (max-width: 380px) {
    .nb .top .brand span { display: none; }
    .nb .chip { padding: 0 7px; }
}

/* tasti da almeno 44 px: si toccano bene anche con i guanti */
.nb .top { padding-top: calc(4px + env(safe-area-inset-top)); padding-bottom: 4px; }
.nb .menu-btn { min-height: 44px; }
.nb .chip { height: 44px; min-width: 44px; }
.nb .top a.back { min-height: 44px; line-height: 44px; padding: 0 4px; }
.nb .pill { min-height: 44px; padding: 8px 13px; font-size: 13px; }
.nb .panel-tab { width: 34px; height: 72px; }
.nb .mapbtns button { width: 46px; height: 46px; }
.nb .leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 44px !important; }
