/* =========================================================
   Appunti – tema scuro con cerchi viola "LED"
   Tutti i colori sono variabili CSS: modificali qui.
   ========================================================= */
:root {
  --bg: #0b0b10;
  --bg-2: #0f0f16;
  --surface: #15151c;
  --surface-2: #1d1d27;
  --surface-3: #262633;
  --border: #262630;
  --border-2: #34343f;
  --text: #ecebf3;
  --text-2: #c9c7d6;
  --muted: #8e8ca0;

  --led: #a855f7;          /* viola principale */
  --led-2: #c084fc;        /* lilla chiaro */
  --led-3: #7c3aed;        /* viola profondo */
  --led-soft: rgba(168, 85, 247, .14);
  --led-glow: 0 0 6px rgba(168, 85, 247, .9), 0 0 16px rgba(168, 85, 247, .55), 0 0 32px rgba(168, 85, 247, .28);
  --led-glow-strong: 0 0 8px rgba(192, 132, 252, 1), 0 0 22px rgba(168, 85, 247, .85), 0 0 48px rgba(168, 85, 247, .5);

  --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .12);
  --bad: #f87171; --bad-soft: rgba(248, 113, 113, .12);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .1);
  --info-soft: rgba(168, 85, 247, .09);

  --radius: 22px;
  --radius-s: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-read: -apple-system, "New York", "Iowan Old Style", Georgia, serif;
  --t-fast: 160ms;
  --t-med: 260ms;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 17px; line-height: 1.5; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
  background-image: radial-gradient(1200px 600px at 80% -10%, rgba(124, 58, 237, .12), transparent 60%), radial-gradient(900px 500px at -10% 10%, rgba(168, 85, 247, .06), transparent 60%);
  background-attachment: fixed;
}
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--led-2); }
::selection { background: rgba(168, 85, 247, .35); }

/* ---------- LED: il cuore del tema ---------- */
@keyframes respira {
  0%, 100% { box-shadow: 0 0 4px color-mix(in srgb, var(--c, var(--led)) 80%, transparent), 0 0 12px color-mix(in srgb, var(--c, var(--led)) 45%, transparent); }
  50% { box-shadow: 0 0 8px color-mix(in srgb, var(--c, var(--led)) 100%, transparent), 0 0 22px color-mix(in srgb, var(--c, var(--led)) 65%, transparent), 0 0 36px color-mix(in srgb, var(--c, var(--led)) 25%, transparent); }
}
@keyframes respira-svg { 0%, 100% { filter: drop-shadow(0 0 2px var(--c, var(--led))); } 50% { filter: drop-shadow(0 0 6px var(--c, var(--led))) drop-shadow(0 0 12px var(--c, var(--led))); } }
.led, .avatar, .mat-dot, .led-dot-s, .led-mini, .brand-led {
  --c: var(--led);
  animation: respira 3.6s ease-in-out infinite;
  transition: transform var(--t-med) ease, box-shadow var(--t-med) ease, filter var(--t-med) ease;
}
.led:hover, .avatar:hover, a:hover > .avatar, a:active > .avatar, .led:active, .mat-dot:hover, .led-dot-s:hover, .pill:hover .led, .fab:hover .led {
  transform: scale(1.12);
  box-shadow: 0 0 10px var(--c), 0 0 26px var(--c), 0 0 52px color-mix(in srgb, var(--c) 50%, transparent);
  filter: brightness(1.2);
  animation-play-state: paused;
}
.mat-dot, .led-dot-s { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; vertical-align: middle; }
.mat-dot { margin-right: 8px; }
.led-mini { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--led); flex: none; }
.led-mini.off { background: #3a3a46; animation: none; box-shadow: none; }
.brand-led { width: 10px; height: 10px; border-radius: 50%; background: var(--led); flex: none; }
.led-dot { animation: respira-svg 3.6s ease-in-out infinite; transition: r var(--t-fast); cursor: default; }
.led-dot:hover { r: 7; filter: drop-shadow(0 0 8px var(--c)) drop-shadow(0 0 16px var(--c)); }
.glow-line { filter: drop-shadow(0 0 4px var(--led)) drop-shadow(0 0 10px rgba(168, 85, 247, .6)); }

/* ---------- barra in alto ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: rgba(11, 11, 16, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--text); }
.icon-btn:active, .icon-btn:hover { background: var(--surface-2); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 130px; outline: none; }
main.wide { max-width: 1200px; }

h2 { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 26px 0 10px; display: flex; align-items: center; }
h2:first-child { margin-top: 4px; }
h3 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.grow { flex: 1; min-width: 0; }
.err { color: var(--bad); font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); }
.link { color: var(--led-2); font-weight: 600; text-decoration: none; }
.pre { white-space: pre-wrap; line-height: 1.65; }

/* ---------- card e liste ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; }
.card.warn { background: linear-gradient(var(--warn-soft), var(--warn-soft)), var(--surface); border-color: rgba(251, 191, 36, .25); }
.card.info { background: linear-gradient(var(--info-soft), var(--info-soft)), var(--surface); border-color: rgba(168, 85, 247, .28); }
.card ul, .card ol { padding-left: 22px; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list a, .list .row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; text-decoration: none; color: inherit; border: 0; border-top: 1px solid var(--border); background: none; width: 100%; text-align: left; cursor: pointer; }
.list > :first-child { border-top: 0; }
.list a:active, .list a:hover, .list .row:hover { background: var(--surface-2); }
.list .t { font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .s { font-size: 14px; color: var(--muted); }
.chev { color: var(--muted); flex: none; }
.badge { font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); flex: none; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.run { background: var(--led-soft); color: var(--led-2); box-shadow: 0 0 12px rgba(168, 85, 247, .35); }

/* ---------- pulsanti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--border-2); background: var(--surface-2); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text); transition: transform var(--t-fast), box-shadow var(--t-med), background var(--t-fast); }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, #9333ea, #7c3aed); border-color: transparent; color: #fff; box-shadow: 0 0 0 1px rgba(192, 132, 252, .35) inset, 0 6px 24px rgba(124, 58, 237, .35); }
.btn.primary:hover { box-shadow: 0 0 0 1px rgba(192, 132, 252, .6) inset, 0 0 26px rgba(168, 85, 247, .6); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-row .btn { flex: 1 1 140px; }
.btn-col { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 10px; }
.mini { border: 1px solid var(--border-2); background: var(--surface-2); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.mini:hover { border-color: var(--led); color: var(--text); box-shadow: 0 0 12px rgba(168, 85, 247, .35); }
.link-back { background: none; border: 0; color: var(--led-2); font-weight: 600; padding: 6px 0; margin-bottom: 8px; cursor: pointer; font-size: 15px; }
.fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 20; padding: 0 22px 0 10px; border-radius: 99px; }
.fab:active { transform: translateX(-50%) scale(.98); }
.plus { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; line-height: 1; background: radial-gradient(circle at 35% 30%, #e9d5ff, #a855f7 55%, #6d28d9); color: #fff; font-weight: 500; }

/* ---------- form ---------- */
label.field, div.field { display: block; margin-bottom: 14px; }
label.field > span, .field > .lbl { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
input[type=text], input[type=password], select, textarea { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border-2); background: var(--bg-2); font-size: 17px; outline: none; -webkit-appearance: none; appearance: none; color: var(--text); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--led); box-shadow: 0 0 0 3px rgba(168, 85, 247, .2), 0 0 18px rgba(168, 85, 247, .2); }
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
input[type=range] { width: 100%; accent-color: var(--led); }
.check { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--led); flex: none; }
.seg { display: flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; padding: 3px; margin-bottom: 14px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px 6px; border-radius: 11px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); min-width: 70px; }
.seg button[aria-pressed=true] { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px rgba(168, 85, 247, .4) inset, 0 0 14px rgba(168, 85, 247, .2); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1.5px dashed var(--border-2); border-radius: var(--radius); padding: 26px 16px; text-align: center; cursor: pointer; background: var(--surface); transition: border-color var(--t-fast); }
.drop:hover { border-color: var(--led); }
.drop input { display: none; }
.drop-ic { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e9d5ff, #a855f7 55%, #6d28d9); color: #fff; display: grid; place-items: center; font-size: 20px; margin-bottom: 8px; }
ol.steps { padding-left: 20px; margin: 0; }
ol.steps li { margin-bottom: 6px; }
details.plain summary { cursor: pointer; color: var(--led-2); font-weight: 600; }

/* ---------- caricamento e avanzamento ---------- */
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--led-soft); border-top-color: var(--led); display: inline-block; vertical-align: -3px; animation: gira .8s linear infinite; box-shadow: 0 0 10px rgba(168, 85, 247, .4); flex: none; }
@keyframes gira { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; padding: 6px 0; }
.bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.bar > div { height: 100%; background: linear-gradient(90deg, #7c3aed, #c084fc); width: 0; transition: width .3s; box-shadow: 0 0 12px var(--led); }
.pipe-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pipe.running { border-color: rgba(168, 85, 247, .45); box-shadow: 0 0 30px rgba(124, 58, 237, .18); }
.progress-list { list-style: none; padding: 0 !important; margin: 6px 0 0; }
.progress-list li { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; color: var(--muted); }
.progress-list li .lbl { font-size: 15px; }
.progress-list li.active { color: var(--text); }
.progress-list li.active .lbl { font-weight: 650; }
.progress-list li.done { color: var(--text-2); }
.progress-list li.fail { color: var(--bad); }
.progress-list .p-live { display: block; }
.dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-2); flex: none; display: grid; place-items: center; font-size: 11px; margin-top: 1px; }
li.active .dot { border-color: var(--led); border-top-color: transparent; animation: gira 1s linear infinite; box-shadow: 0 0 10px var(--led); }
li.done .dot { background: var(--led); border-color: var(--led); color: #fff; box-shadow: 0 0 8px rgba(168, 85, 247, .7); }
li.fail .dot { border-color: var(--bad); color: var(--bad); }
.running-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; border-color: rgba(168, 85, 247, .45); }
.quota-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); margin: -4px 0 14px; }
.quota-list { list-style: none; padding: 0 !important; margin: 10px 0; }
.quota-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 15px; }

/* ---------- registratore ---------- */
.rec { text-align: center; padding: 22px 16px; }
.rec-time { font-size: 46px; font-weight: 250; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.rec-btn { width: 88px; height: 88px; border-radius: 50%; border: 2px solid var(--border-2); background: var(--bg-2); margin: 14px auto; display: grid; place-items: center; cursor: pointer; }
.rec-btn span { width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f0abfc, #a855f7 55%, #6d28d9); transition: all .2s; box-shadow: var(--led-glow); animation: respira 2.4s ease-in-out infinite; }
.rec-btn.on span { width: 30px; height: 30px; border-radius: 8px; animation-duration: 1s; }
.rec-live { color: var(--led-2); font-weight: 600; }

/* ---------- dashboard ---------- */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.hello h2 { margin: 0; font-size: 32px; font-weight: 500; color: var(--text); text-transform: none; letter-spacing: -.02em; line-height: 1.15; }
.hello .date { color: var(--muted); font-size: 14px; margin-top: 2px; }
.hello-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--border-2); font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; background: var(--surface); color: var(--text); transition: box-shadow var(--t-med), transform var(--t-fast); }
.pill.ink { background: var(--surface-2); padding-left: 7px; }
.pill.blue { background: linear-gradient(135deg, #9333ea, #7c3aed); border-color: transparent; color: #fff; box-shadow: 0 0 22px rgba(124, 58, 237, .4); }
.pill:hover { box-shadow: 0 0 24px rgba(168, 85, 247, .45); }
.pill:active { transform: scale(.97); }
.nav { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 4px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; width: max-content; max-width: 100%; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; padding: 8px 16px; border-radius: 99px; text-decoration: none; color: var(--text-2); font-weight: 600; font-size: 14px; }
.nav a.on { background: var(--surface-3); color: #fff; box-shadow: 0 0 0 1px rgba(168, 85, 247, .5) inset, 0 0 16px rgba(168, 85, 247, .3); }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; min-width: 0; }
.tile.span2 { grid-column: span 2; }
.tile-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tile-h h3 { margin: 0; font-size: 17px; font-weight: 500; color: var(--text-2); }
.tile-x { color: var(--muted); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.tile-x:hover { color: var(--text); background: var(--surface-2); }
.kpi-v { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; margin-top: 14px; }
.kpi-v b { font-size: 46px; font-weight: 500; line-height: 1; letter-spacing: -.02em; }
.kpi-v .of { font-size: 20px; color: var(--muted); }
.kpi-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); display: inline-block; }
.chip.up { background: rgba(74, 222, 128, .14); color: var(--ok); }
.chip.down { background: rgba(248, 113, 113, .14); color: var(--bad); }
.chip.flat { background: var(--surface-3); color: var(--muted); }
.chip.facile { color: var(--ok); } .chip.difficile { color: #f0abfc; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.glow-card { border: 1px solid rgba(192, 132, 252, .55); background: radial-gradient(120% 120% at 100% 0%, rgba(124, 58, 237, .28), transparent 55%), #100d18; box-shadow: 0 0 0 1px rgba(168, 85, 247, .25) inset, 0 0 24px rgba(168, 85, 247, .35), 0 0 60px rgba(124, 58, 237, .18); animation: bordo 4s ease-in-out infinite; }
@keyframes bordo { 50% { box-shadow: 0 0 0 1px rgba(192, 132, 252, .45) inset, 0 0 34px rgba(168, 85, 247, .5), 0 0 80px rgba(124, 58, 237, .25); } }
.spark { position: absolute; right: 14px; top: 46px; width: 46%; height: 42px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--border-2); stroke-dasharray: 2 5; }
.chart .vgrid { stroke: var(--border-2); stroke-dasharray: 3 5; }
.bar-r { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 60%, transparent)); transition: filter var(--t-med); }
.bar-r:hover { filter: drop-shadow(0 0 10px var(--c)) brightness(1.2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 15px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend b { color: var(--text); font-weight: 600; }
.donut-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: center; }
.donut-wrap svg { max-width: 220px; margin: 0 auto; }
.donut-seg { filter: drop-shadow(0 0 5px var(--c)); animation: respira-svg 3.6s ease-in-out infinite; transition: stroke-width var(--t-med); }
.donut-seg:hover { stroke-width: 32; filter: drop-shadow(0 0 10px var(--c)) drop-shadow(0 0 20px var(--c)); }
.donut-core { fill: #120f1a; stroke: rgba(168, 85, 247, .25); stroke-width: 1; }
.chart .donut-center { font-size: 42px; font-weight: 500; fill: var(--text); }
.chart .donut-cap { font-size: 12px; }
.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 15px; color: var(--text-2); }
.stat-list li b { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--border-2); background: var(--surface-2); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.filters button[aria-pressed=true] { background: var(--surface-3); color: #fff; border-color: rgba(168, 85, 247, .6); box-shadow: 0 0 12px rgba(168, 85, 247, .35); }
.hbar { display: flex; gap: 4px; margin-top: 4px; }
.hbar div { height: 34px; border-radius: 10px; min-width: 6px; }
.hb1 { background: linear-gradient(90deg, #7c3aed, #c084fc); box-shadow: 0 0 16px rgba(168, 85, 247, .55); }
.hb2 { background: #2b2140; }
.hbar-labels { display: flex; justify-content: space-between; font-size: 13px; margin-top: 4px; color: var(--text-2); }
.people { list-style: none; margin: 0; padding: 0; }
.people li a { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: inherit; text-decoration: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; position: relative; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 40%, white), var(--c) 55%, color-mix(in srgb, var(--c) 60%, black)); }
.avatar.sm { width: 32px; height: 32px; font-size: 11px; }
.avatar .st { position: absolute; right: -2px; top: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface); background: #5b5670; }
.avatar .st0 { background: var(--warn); } .avatar .st3 { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.people .nm { font-weight: 500; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.people .rl { font-size: 12px; color: var(--muted); }
.people .tag { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--led-2); background: var(--led-soft); padding: 3px 8px; border-radius: 7px; flex: none; }
.tip { background: radial-gradient(130% 120% at 0% 0%, #7c3aed, #4c1d95 60%, #2e1065); color: #fff; border-radius: 18px; padding: 14px; margin-top: 14px; box-shadow: 0 0 28px rgba(124, 58, 237, .35); }
.tip .tip-h { display: flex; justify-content: space-between; font-size: 13px; opacity: .85; margin-bottom: 8px; }
.tip p { background: rgba(255, 255, 255, .1); border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; font-size: 14px; }
.tip a { color: #fff; font-weight: 600; font-size: 14px; }
.tile .empty-chart { color: var(--muted); font-size: 14px; padding: 26px 0; text-align: center; }
@media (min-width: 900px) {
  .dash { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .tile { padding: 18px; }
  .tile.span2 { grid-column: span 1; }
  .tile.w2 { grid-column: span 2; }
  .tile.r2 { grid-row: span 2; }
  .donut-wrap { grid-template-columns: 1fr 1fr; }
  .hello h2 { font-size: 36px; }
}

/* ---------- pagina lezione ---------- */
.les-head { display: flex; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px 4px; scrollbar-width: none; position: sticky; top: calc(env(safe-area-inset-top) + 57px); z-index: 20; background: linear-gradient(var(--bg) 70%, transparent); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text-2); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.tabs a.on { background: var(--surface-3); color: #fff; border-color: rgba(168, 85, 247, .7); box-shadow: 0 0 16px rgba(168, 85, 247, .35); }
.tab-n { background: var(--led); color: #fff; font-size: 11px; border-radius: 99px; padding: 0 6px; min-width: 18px; text-align: center; box-shadow: 0 0 8px var(--led); }
.subtabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 2px; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: none; border: 1px solid var(--border-2); background: transparent; color: var(--muted); border-radius: 10px; padding: 7px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.subtabs button[aria-pressed=true] { color: var(--text); background: var(--led-soft); border-color: rgba(168, 85, 247, .6); }
.doc-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 12px 16px; margin-bottom: 12px; }
.toc summary { cursor: pointer; font-weight: 650; font-size: 15px; color: var(--text-2); }
.toc ol { margin: 10px 0 0; padding-left: 20px; }
.toc li { margin: 3px 0; }
.toc li.sub { margin-left: 16px; list-style: circle; font-size: 14px; }
.toc button { display: block; width: 100%; background: none; border: 0; color: var(--led-2); text-align: left; cursor: pointer; padding: 2px 0; font-size: inherit; line-height: 1.4; }
.hint-tap { text-align: center; }

/* ---------- testo lungo (appunti, riassunti) ---------- */
.doc { padding: 22px 20px; }
.md { font-size: 17px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
.doc.md { font-size: 18px; }
.md h2, .md h3, .md h4 { text-transform: none; letter-spacing: -.01em; color: #fff; line-height: 1.3; display: block; scroll-margin-top: 120px; }
.md h2 { font-size: 23px; margin: 34px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-2); font-weight: 650; }
.md h2::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--led); margin: 0 10px 3px 0; box-shadow: var(--led-glow); vertical-align: middle; }
.md h3 { font-size: 19px; margin: 24px 0 8px; font-weight: 640; color: var(--led-2); }
.md h4 { font-size: 17px; margin: 16px 0 6px; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 14px; }
.md ul, .md ol { padding-left: 24px; margin: 0 0 14px; }
.md li { margin-bottom: 6px; }
.md li::marker { color: var(--led-2); }
.md strong { color: #fff; font-weight: 650; }
.md em { color: var(--text-2); }
.md blockquote { margin: 0 0 14px; padding: 10px 16px; border-left: 3px solid var(--led); background: var(--led-soft); border-radius: 0 12px 12px 0; color: var(--text-2); }
.md code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.md pre.code { background: #0a0a0f; border: 1px solid var(--border); border-radius: 12px; padding: 14px; overflow-x: auto; font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.md pre.code code { background: none; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--border-2); margin: 22px 0; }
.math-d { display: block; overflow-x: auto; overflow-y: hidden; margin: 8px 0 14px; padding: 4px 0; }
.katex { font-size: 1.08em; }
.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--border); border-radius: 12px; }
.md table, .cmp { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.45; }
.md th, .md td, .cmp th, .cmp td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; min-width: 110px; }
.md thead th, .cmp thead th { background: var(--surface-2); color: #fff; font-weight: 650; }
.md tr:last-child td, .cmp tr:last-child td, .cmp tr:last-child th { border-bottom: 0; }
.cmp tbody th { color: var(--led-2); font-weight: 600; background: rgba(168, 85, 247, .05); }
/* riquadri speciali */
.box { border-radius: 14px; padding: 12px 16px; margin: 0 0 16px; border: 1px solid; }
.box-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.box-h::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; flex: none; }
.box-t { text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 650; color: var(--text); flex-basis: 100%; }
.box-b > :last-child { margin-bottom: 0; }
.box-def { background: rgba(168, 85, 247, .08); border-color: rgba(168, 85, 247, .35); }
.box-def .box-h { color: var(--led-2); }
.box-imp { background: rgba(251, 191, 36, .07); border-color: rgba(251, 191, 36, .35); }
.box-imp .box-h { color: var(--warn); }
.box-es { background: rgba(56, 189, 248, .06); border-color: rgba(56, 189, 248, .3); }
.box-es .box-h { color: #7dd3fc; }
.box-att { background: rgba(248, 113, 113, .07); border-color: rgba(248, 113, 113, .35); }
.box-att .box-h { color: var(--bad); }
.box-appr { background: repeating-linear-gradient(135deg, rgba(232, 121, 249, .05) 0 10px, rgba(232, 121, 249, .02) 10px 20px); border: 1.5px dashed rgba(232, 121, 249, .55); }
.box-appr .box-h { color: #f0abfc; }
/* spiegazioni sui paragrafi */
.doc > p, .doc > ul, .doc > ol, .doc > .box, .doc > .table-wrap, .doc > blockquote { cursor: pointer; border-radius: 10px; transition: background var(--t-fast); }
.doc > p:hover { background: rgba(168, 85, 247, .05); }
.sel-blk { background: rgba(168, 85, 247, .1) !important; box-shadow: 0 0 0 6px rgba(168, 85, 247, .1); }
.sp-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 16px; }
.sp-bar button { border: 1px solid rgba(168, 85, 247, .6); background: var(--led-soft); color: #fff; border-radius: 99px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 0 14px rgba(168, 85, 247, .3); }
.spiega { border-left: 3px solid var(--led); background: rgba(168, 85, 247, .07); border-radius: 0 14px 14px 0; padding: 10px 16px; margin: -4px 0 18px; }
.spiega .box-h { color: var(--led-2); }
.spiega .md { font-size: 16px; }
.imp-card .imp-p { font-weight: 600; margin-bottom: 8px; }
.imp-card blockquote { margin: 0 0 8px; padding: 8px 14px; border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 0 10px 10px 0; font-style: italic; color: var(--text-2); }
details.dom summary { cursor: pointer; font-weight: 600; display: flex; gap: 10px; align-items: baseline; list-style: none; }
details.dom summary::-webkit-details-marker { display: none; }
details.dom[open] summary { margin-bottom: 10px; }
.gloss dt { font-weight: 650; color: #fff; margin-top: 12px; }
.gloss dt:first-child { margin-top: 0; }
.gloss dd { margin: 2px 0 0; color: var(--text-2); padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.g-es { font-size: 14px; color: var(--muted); margin-top: 4px; }
.g-es span { color: var(--led-2); font-weight: 600; }

/* ---------- mappa concettuale ---------- */
.mm-wrap { position: relative; background: radial-gradient(circle at 50% 50%, #17121f, #0b0b10 70%); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; height: min(72vh, 640px); }
.mm-wrap.full { position: fixed; inset: 0; z-index: 100; border-radius: 0; height: 100%; padding-top: env(safe-area-inset-top); }
.mm-svg { width: 100%; height: 100%; touch-action: none; display: block; cursor: grab; user-select: none; -webkit-user-select: none; }
.mm-svg:active { cursor: grabbing; }
.mm-edge { fill: none; stroke-width: 2.2; opacity: .75; filter: drop-shadow(0 0 3px currentColor); }
.mm-cross { fill: none; stroke: #e879f9; stroke-width: 1.6; stroke-dasharray: 6 6; opacity: .75; }
.mm-rel rect { fill: #14111c; stroke: var(--border-2); }
.mm-rel text { fill: var(--muted); font-size: 11px; font-style: italic; font-family: var(--font); }
.mm-rel-x text { fill: #f0abfc; }
.mm-node { cursor: pointer; }
.mm-node rect { fill: #17141f; stroke: var(--c); stroke-width: 1.5; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--c) 60%, transparent)); transition: filter var(--t-med), stroke-width var(--t-med); }
.mm-node text { fill: var(--text); font-size: 13px; font-family: var(--font); font-weight: 500; pointer-events: none; }
.mm-node.mm-l1 rect { fill: color-mix(in srgb, var(--c) 22%, #15121c); stroke-width: 2; }
.mm-node.mm-l1 text { font-weight: 650; font-size: 13.5px; }
.mm-node .mm-led { fill: var(--c); animation: respira-svg 3.6s ease-in-out infinite; }
.mm-root rect { fill: url(#none); fill: #2a1650; stroke: #c084fc; stroke-width: 2.5; filter: drop-shadow(0 0 10px #a855f7) drop-shadow(0 0 24px rgba(168, 85, 247, .6)); animation: respira-svg 3.6s ease-in-out infinite; }
.mm-root text { font-size: 16px; font-weight: 700; fill: #fff; }
.mm-node:hover rect, .mm-node.sel rect { stroke-width: 3; filter: drop-shadow(0 0 8px var(--c)) drop-shadow(0 0 18px var(--c)); }
.mm-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.mm-tools button { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border-2); background: rgba(21, 21, 28, .85); color: var(--text); font-size: 18px; cursor: pointer; backdrop-filter: blur(6px); }
.mm-tools button:hover { border-color: var(--led); box-shadow: 0 0 12px rgba(168, 85, 247, .5); }
.mm-hint { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--muted); pointer-events: none; }
.mm-sheet { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(21, 18, 30, .96); border: 1px solid rgba(168, 85, 247, .5); border-radius: 18px; padding: 14px 16px; box-shadow: 0 0 30px rgba(124, 58, 237, .35); max-height: 50%; overflow: auto; backdrop-filter: blur(10px); }
.mm-sheet-t { font-weight: 700; font-size: 17px; margin-bottom: 4px; padding-right: 30px; }
.mm-sheet-r { font-size: 13px; color: var(--led-2); margin-bottom: 8px; }
.mm-sheet p { margin: 0 0 8px; font-size: 15px; color: var(--text-2); }
.mm-sheet-k { font-size: 13px; color: var(--muted); margin-top: 4px; }
.mm-close { position: absolute; right: 10px; top: 8px; border: 0; background: none; color: var(--muted); font-size: 24px; cursor: pointer; }

/* ---------- schemi ---------- */
.schema-card h3 { color: #fff; }
.timeline { list-style: none; padding: 0 0 0 22px !important; margin: 8px 0 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(#a855f7, #7c3aed 60%, transparent); box-shadow: 0 0 8px var(--led); }
.timeline li { position: relative; padding: 0 0 18px 10px; }
.tl-dot { position: absolute; left: -22px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--led); --c: var(--led); animation: respira 3.6s ease-in-out infinite; }
.tl-d { font-weight: 700; color: var(--led-2); font-size: 15px; }
.tl-t { font-weight: 600; }
.tl-x { color: var(--text-2); font-size: 15px; }
.chain { display: flex; flex-direction: column; }
.ch-i { border: 1px solid var(--border-2); border-radius: 16px; padding: 12px; background: var(--bg-2); }
.ch-c, .ch-e { padding: 8px 12px; border-radius: 10px; }
.ch-c { background: rgba(168, 85, 247, .1); }
.ch-e { background: rgba(232, 121, 249, .08); }
.ch-k { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--led-2); }
.ch-arrow { text-align: center; color: var(--led); font-size: 20px; line-height: 1.2; text-shadow: 0 0 10px var(--led); }
.ch-x { font-size: 14px; color: var(--muted); margin-top: 8px; }
.ch-link { width: 2px; height: 16px; background: var(--led); margin: 0 auto; box-shadow: 0 0 8px var(--led); }
.formule { display: grid; gap: 12px; }
.fx { border: 1px solid rgba(168, 85, 247, .35); border-radius: 16px; padding: 14px; background: rgba(168, 85, 247, .05); }
.fx-n { font-weight: 700; color: var(--led-2); }
.fx-m { margin: 6px 0; overflow-x: auto; }
.fx-s { font-size: 15px; color: var(--text-2); }
.fx-v { width: 100%; font-size: 14px; margin-top: 8px; border-collapse: collapse; }
.fx-v td { padding: 4px 6px; border-top: 1px solid var(--border); }
.fx-inv { margin-top: 8px; }
.steps-v { list-style: none; padding: 0 !important; margin: 0; }
.steps-v li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.steps-v li:first-child { border-top: 0; }
.st-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--led); color: #fff; flex: none; --c: var(--led); animation: respira 3.6s ease-in-out infinite; }
.st-t { font-weight: 600; }
.st-x { color: var(--text-2); font-size: 15px; }
.sezioni { display: grid; gap: 12px; }
.sez { border: 1px solid var(--border-2); border-radius: 16px; padding: 12px 16px; background: var(--bg-2); }
.sez-t { font-weight: 700; color: var(--led-2); margin-bottom: 4px; }
.sez ul { margin: 0; padding-left: 20px; }
@media (min-width: 700px) { .sezioni, .formule { grid-template-columns: 1fr 1fr; } }

/* ---------- quiz ---------- */
.q-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 8px; }
.q-text { font-size: 19px; font-weight: 600; margin-bottom: 14px; line-height: 1.4; }
.q-text p { margin: 0; }
.q-arg { font-size: 12px; color: var(--led-2); font-weight: 600; margin-bottom: 4px; }
.opt { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 14px; margin-bottom: 8px; border-radius: 14px; border: 1px solid var(--border-2); background: var(--bg-2); cursor: pointer; line-height: 1.4; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.opt:hover { border-color: rgba(168, 85, 247, .6); box-shadow: 0 0 14px rgba(168, 85, 247, .2); }
.opt-l { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-3); flex: none; }
.opt.right { background: var(--ok-soft); border-color: var(--ok); }
.opt.right .opt-l { background: var(--ok); color: #0b0b10; }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad); }
.opt.wrong .opt-l { background: var(--bad); color: #0b0b10; }
.opt:disabled { cursor: default; color: var(--text); opacity: 1; }
.explain { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); margin: 8px 0 12px; font-size: 15px; }
.explain p { margin: 0; }
.voto-big { font-size: 58px; font-weight: 600; text-align: center; line-height: 1.1; margin: 8px 0; text-shadow: 0 0 20px currentColor; }
.voto-big small { font-size: 22px; color: var(--muted); text-shadow: none; }
.voto-big.ok { color: #d8b4fe; } .voto-big.bad { color: var(--bad); }
.quiz-start { text-align: center; }
.big-n { font-size: 54px; font-weight: 600; color: #fff; text-shadow: 0 0 22px var(--led); }
.stats-arg h3 { font-size: 16px; }
.sa-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; }
.sa-h.bad { color: var(--bad); } .sa-h.ok { color: var(--ok); }
ul.sa { list-style: none; padding: 0 !important; margin: 0; }
ul.sa li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; }
.meter { width: 70px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #7c3aed, #c084fc); }

/* ---------- verifica ---------- */
.ver-head h3 { margin-bottom: 4px; }
.vq-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.vq-n { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--led); color: #fff; flex: none; box-shadow: 0 0 10px rgba(168, 85, 247, .7); }
.vq-p { margin-left: auto; font-size: 14px; color: var(--muted); }
.q-txt { font-weight: 550; margin-bottom: 10px; }
.q-txt p:last-child { margin-bottom: 0; }
.opt-r { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--border-2); border-radius: 12px; margin-bottom: 6px; cursor: pointer; background: var(--bg-2); }
.opt-r input { accent-color: var(--led); margin-top: 4px; width: 18px; height: 18px; flex: none; }
.opt-r.right { border-color: var(--ok); background: var(--ok-soft); }
.opt-r.wrong { border-color: var(--bad); background: var(--bad-soft); }
.vf { display: flex; gap: 8px; }
.vf .opt-r { flex: 1; }
.compl { line-height: 2.3; }
.blank { display: inline-block; width: auto !important; min-width: 110px; max-width: 220px; padding: 4px 10px !important; margin: 0 4px; font-size: 16px !important; border-radius: 10px !important; }
.blank.right, select.right { border-color: var(--ok) !important; }
.blank.wrong, select.wrong { border-color: var(--bad) !important; }
.abb-r { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.abb-r select { font-size: 15px; padding: 9px 30px 9px 10px; }
.fb { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--led-soft); font-size: 15px; }
details.sol { margin-top: 10px; border: 1px solid rgba(74, 222, 128, .3); border-radius: 12px; padding: 8px 14px; background: rgba(74, 222, 128, .05); }
details.sol summary { cursor: pointer; color: var(--ok); font-weight: 600; font-size: 15px; }
details.sol .md { font-size: 15px; margin-top: 8px; }
.griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.griglia > div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; }
.g-k { font-size: 13px; color: var(--muted); }
.g-v { font-size: 26px; font-weight: 600; color: #d8b4fe; }
.timer { position: sticky; top: calc(env(safe-area-inset-top) + 108px); z-index: 15; margin-bottom: 12px; }
.timer-bar { position: relative; background: var(--surface); border: 1px solid rgba(168, 85, 247, .5); border-radius: 14px; padding: 10px 14px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; box-shadow: 0 0 18px rgba(124, 58, 237, .25); }
.timer-bar i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--led); box-shadow: 0 0 10px var(--led); }
.timer-bar span { position: relative; }
.timer-bar.low { border-color: var(--warn); color: var(--warn); }
.timer-bar.over { border-color: var(--bad); color: var(--bad); }

/* ---------- flashcard ---------- */
.fh-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; text-align: center; }
.fh-stats b { display: block; font-size: 30px; font-weight: 600; color: #fff; }
.fh-stats span { font-size: 12px; color: var(--muted); }
.flash { display: block; width: 100%; min-height: 300px; border: 0; background: none; padding: 0; perspective: 1200px; cursor: pointer; color: inherit; margin: 8px 0 14px; }
.flash-in { position: relative; width: 100%; min-height: 300px; transition: transform .5s; transform-style: preserve-3d; }
.flash.flip .flash-in { transform: rotateY(180deg); }
.f-front, .f-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; border: 1px solid rgba(168, 85, 247, .45); background: radial-gradient(120% 100% at 50% 0%, rgba(124, 58, 237, .22), var(--surface) 60%); box-shadow: 0 0 26px rgba(124, 58, 237, .25); overflow: auto; }
.f-back { transform: rotateY(180deg); }
.f-txt { font-size: 20px; font-weight: 600; }
.f-back .f-txt { font-size: 17px; font-weight: 400; text-align: left; }
.f-rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.f-rate button { border: 1px solid var(--border-2); background: var(--surface-2); border-radius: 12px; padding: 12px 4px; font-weight: 600; font-size: 14px; cursor: pointer; }
.f-rate .r1 { color: var(--bad); } .f-rate .r3 { color: var(--warn); } .f-rate .r4 { color: #d8b4fe; } .f-rate .r5 { color: var(--ok); }
.flash-list { display: grid; gap: 10px; margin-top: 12px; }
.fl-i { border-top: 1px solid var(--border); padding-top: 10px; }
.fl-f { font-weight: 650; }
.fl-f p { margin: 0; }
.fl-b { font-size: 15px; color: var(--text-2); }

/* ---------- chat e interrogazione ---------- */
.int-start { text-align: center; }
.int-ic { font-size: 40px; margin-bottom: 6px; filter: drop-shadow(0 0 12px rgba(168, 85, 247, .6)); }
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.msg { max-width: 92%; padding: 12px 14px; border-radius: 18px; font-size: 16px; line-height: 1.55; }
.msg.prof { align-self: flex-start; background: var(--surface); border: 1px solid var(--border-2); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 0 18px rgba(124, 58, 237, .35); }
.msg .md { font-size: 16px; }
.msg .md > :last-child { margin-bottom: 0; }
.val { font-size: 12px; font-weight: 700; margin-bottom: 6px; padding: 3px 9px; border-radius: 99px; display: inline-block; }
.val.ok { background: var(--ok-soft); color: var(--ok); } .val.warn { background: var(--warn-soft); color: var(--warn); } .val.bad { background: var(--bad-soft); color: var(--bad); }
.composer { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); background: rgba(21, 21, 28, .95); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 10px; backdrop-filter: blur(10px); }
.composer .btn-row { margin-top: 8px; }
.composer p { margin: 6px 0 0; }
.sugg { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 10px; padding: 0 16px; scrollbar-width: none; }
.sugg::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; border: 1px solid rgba(168, 85, 247, .45); background: var(--led-soft); color: var(--text); border-radius: 99px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.empty-chat { text-align: center; color: var(--muted); padding: 30px 10px; }
.esito ul { margin: 4px 0 10px; }

/* ---------- vari ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { color: var(--border-2); margin-bottom: 8px; }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--surface-3); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 15px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 200; max-width: 90vw; text-align: center; border: 1px solid rgba(168, 85, 247, .5); box-shadow: 0 0 20px rgba(124, 58, 237, .4); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- stampa / PDF ---------- */
@media print {
  @page { margin: 16mm; }
  body { background: #fff !important; color: #111 !important; font-size: 12pt; }
  .topbar, .tabs, .subtabs, .doc-tools, .toc, .hint-tap, .btn-row, h2:not(.md h2), #pipe, .les-head, .fab, #toast, .sp-bar, .mm-tools { display: none !important; }
  main { padding: 0; max-width: none; }
  .card, .printable { border: 0 !important; background: #fff !important; box-shadow: none !important; padding: 0 !important; }
  .md, .md strong, .md h2, .md h3, .md em, .md li::marker { color: #111 !important; }
  .md h2::before { display: none; }
  .box { break-inside: avoid; background: #f7f5fb !important; }
  .box-h, .box-def .box-h, .box-imp .box-h, .box-es .box-h, .box-att .box-h, .box-appr .box-h { color: #5b21b6 !important; }
  .box-h::before { box-shadow: none; }
  .md thead th, .cmp thead th { background: #eee !important; color: #111 !important; }
  .spiega { background: #f7f5fb !important; }
}

/* ---------- movimento ridotto ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .led, .avatar, .mat-dot, .led-dot-s, .led-mini, .brand-led { box-shadow: 0 0 6px var(--c, var(--led)), 0 0 14px color-mix(in srgb, var(--c, var(--led)) 50%, transparent); }
  li.active .dot, .spin { animation: gira 1.6s linear infinite !important; }
  .flash-in { transition: none; }
}

/* ---------- approfondimento dei riassunti ---------- */
.appr-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.appr-bar .seg { flex: 1; margin: 0; }
.seg-s button { padding: 7px 6px; font-size: 13px; min-width: 56px; }
#appr-msg:empty { display: none; }

/* ---------- stampa ---------- */
.stampa-card .check { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.stampa-card .check:first-of-type { border-top: 0; }
.stampa-card .check input { width: 20px; height: 20px; accent-color: var(--led); }
#print-area { display: none; }
.pr-head { border-bottom: 2px solid #5b21b6; padding-bottom: 6px; margin-bottom: 14px; }
.pr-head h1 { font-size: 20pt; margin: 0; }
.pr-head div { font-size: 10pt; color: #555; }
.pr-sec + .pr-sec { break-before: page; }
.pr-sec > h2.pr-t { font-size: 15pt; color: #5b21b6; margin: 0 0 10px; }
.pr-sec .schema-card { margin-bottom: 18px; break-inside: avoid; }
.pr-gloss dt { font-weight: 700; margin-top: 8px; }
.pr-gloss dd { margin: 0 0 4px; }
.pr-dom { break-inside: avoid; margin-bottom: 12px; }
.pr-dom > b { display: block; margin-bottom: 4px; }

@media print {
  :root {
    --bg: #fff; --bg-2: #fff; --surface: #fff; --surface-2: #eee; --surface-3: #ddd;
    --border: #ccc; --border-2: #bbb; --text: #111; --text-2: #333; --muted: #555;
    --led: #6d28d9; --led-2: #5b21b6; --led-3: #5b21b6; --led-soft: #f3effa;
    color-scheme: light;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; animation: none !important; text-shadow: none !important; }
  body { background-image: none !important; }
  .schema-card h3, .tl-t, .st-t { color: #111 !important; }
  .timeline::before, .ch-link, .tl-dot { box-shadow: none !important; }
  .ch-i, .sez, .fx { break-inside: avoid; }
  .md h2:not(.pr-t) { break-after: avoid; }
  body.stampa-sel > *:not(#print-area) { display: none !important; }
  body.stampa-sel #print-area { display: block !important; }
  body.stampa-sel #print-area h2 { display: block !important; }
}

/* ---------- foto della lezione ---------- */
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin: 12px 0 6px; }
.foto-th { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-2); background: var(--bg-2); }
.foto-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-n { position: absolute; left: 6px; top: 6px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 700; border-radius: 8px; padding: 1px 7px; }
.foto-x { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }

/* ---------- mappa a schema (fissa e stampabile) ---------- */
.ms-centro { text-align: center; }
.ms-centro > span { display: inline-block; padding: 12px 22px; border-radius: 16px; background: var(--led-3); color: #fff; font-weight: 800; font-size: 19px; box-shadow: var(--led-glow); }
.ms-centro .ms-sp { max-width: 520px; margin: 8px auto 0; }
.ms-trunk { width: 2px; height: 18px; background: var(--led); margin: 0 auto 0; }
.ms-rami { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; border-top: 2px solid var(--led); padding-top: 14px; }
@media (min-width: 700px) { .ms-rami { grid-template-columns: 1fr 1fr; } }
.ms-ramo { border: 1.5px solid var(--c); border-radius: 16px; padding: 12px 14px; background: color-mix(in srgb, var(--c) 7%, var(--bg-2)); break-inside: avoid; }
.ms-rel { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.ms-n1 { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; color: var(--c); margin-bottom: 8px; }
.ms-num { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #fff; font-size: 13px; display: grid; place-items: center; }
.ms-f { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--c); }
.ms-f > li { position: relative; padding: 5px 0 5px 10px; }
.ms-f > li::before { content: ""; position: absolute; left: -14px; top: 17px; width: 18px; height: 2px; background: var(--c); }
.ms-rel2 { display: block; font-size: 11px; color: var(--muted); font-style: italic; }
.ms-n2 { font-weight: 650; }
.ms-f3 { margin: 3px 0 0; padding-left: 18px; font-size: 14px; color: var(--text-2); }
.ms-rel3 { font-size: 11px; color: var(--muted); font-style: italic; }
.ms-sp { font-size: 13px; color: var(--muted); margin: 2px 0 0; line-height: 1.4; }
.ms-coll { margin-top: 16px; border: 1px dashed var(--border-2); border-radius: 14px; padding: 10px 14px; break-inside: avoid; }
.ms-coll-h { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.ms-coll ul { margin: 0; padding-left: 18px; font-size: 14px; }
.ms-freccia { color: var(--muted); font-style: italic; }
@media print {
  .ms-centro > span { box-shadow: none !important; }
  .ms-rami { grid-template-columns: 1fr 1fr; }
  .ms-ramo { background: #fff !important; }
}

/* ---------- interrogazione a voce, dal vivo ---------- */
.voce-live { text-align: center; padding-top: 26px; }
.voce-led { --lv: 0; width: 110px; height: 110px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, rgba(168, 85, 247, .25), transparent 70%); }
.voce-led span { width: 64px; height: 64px; border-radius: 50%; background: var(--led); --c: var(--led); box-shadow: var(--led-glow); transition: transform 90ms linear; }
.voce-led.ascolto span, .voce-led.parli span { transform: scale(calc(1 + var(--lv) * .45)); }
.voce-led.parli span { background: var(--led-2); box-shadow: var(--led-glow-strong); }
.voce-led.prof span { animation: respira 1.4s ease-in-out infinite; background: #d946ef; --c: #d946ef; }
.voce-led.pensa span, .voce-led.voto span, .voce-led.avvio span { animation: respira 2.4s ease-in-out infinite; opacity: .7; }
.voce-led.pausa span { background: var(--surface-3); box-shadow: none; }
.voce-stato { font-size: 20px; font-weight: 700; }
.voce-sub { min-height: 2.8em; margin: 4px auto 14px; max-width: 340px; }
.voce-btns .btn { flex: 1; }
.link-btn { background: none; border: 0; color: var(--led-2); text-decoration: underline; margin-top: 12px; cursor: pointer; }
.msg-mic { font-size: 13px; opacity: .8; }

/* =========================================================
   DESKTOP (computer e tablet in orizzontale)
   ========================================================= */
.top-nav { display: none; }
@media (min-width: 900px) {
  .topbar { padding-left: 24px; padding-right: 20px; gap: 14px; }
  .topbar h1 { flex: 0 1 auto; max-width: 34vw; }
  .top-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
  .top-nav a { padding: 8px 14px; border-radius: 99px; text-decoration: none; color: var(--text-2); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; transition: background var(--t-fast), box-shadow var(--t-med); }
  .top-nav a:hover { background: var(--surface-2); color: var(--text); }
  .top-nav a.on { background: var(--surface-3); color: #fff; box-shadow: 0 0 0 1px rgba(168, 85, 247, .5) inset, 0 0 16px rgba(168, 85, 247, .3); }
  .top-nav .top-new { margin-left: 8px; padding-left: 6px; background: var(--surface-2); border: 1px solid var(--border-2); }
  .top-nav .top-new .plus { width: 24px; height: 24px; font-size: 16px; }
  #btn-settings.on { background: var(--surface-3); box-shadow: 0 0 0 1px rgba(168, 85, 247, .5) inset; }
  /* il menu in alto sostituisce quello dentro le pagine */
  main > .nav, main .nav[aria-label="Sezioni"] { display: none; }
  main { padding: 24px 24px 80px; }
  .fab { display: none; }
  /* sotto-schede su più righe: niente scorrimento laterale col mouse */
  .subtabs { flex-wrap: wrap; overflow: visible; margin: 0 0 14px; padding: 0; }
  .tabs { flex-wrap: wrap; overflow: visible; margin: 0 0 16px; padding: 2px 0 6px; }

  .card { padding: 22px; }
}

@media (min-width: 1100px) {
  main.lez { max-width: 1180px; }
  .les-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
  .les-grid > .tabs { flex-direction: column; gap: 4px; position: sticky; top: 78px; margin: 0; padding: 0; overflow: visible; background: none; z-index: 1; }
  .les-grid > .tabs a { justify-content: space-between; border-radius: 12px; padding: 10px 14px; font-size: 15px; background: transparent; border-color: transparent; }
  .les-grid > .tabs a:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
  .les-grid > .tabs a.on { background: var(--surface-3); border-color: rgba(168, 85, 247, .7); }
  .les-main { min-width: 0; }
  .les-main .doc { font-size: 17.5px; }
  #pipe:not(:empty) { max-width: none; }
  .chat .msg { max-width: 75%; }
}
.seg-s button { white-space: nowrap; }
.doc-tools .seg-s { flex: none; }
