/* Impostazioni › AI sul PC: cinque schede (Chi fa cosa · Il tuo PC · Modelli · Scarica · Velocità), una alla volta,
   a tutta larghezza e chiare anche sul telefono; le schede le fa setSubtabs (app.js) sul contenitore data-subhost */
#tab-settings .set-pane[data-pane="models"]:not(.hidden) { grid-template-columns: minmax(0, 1fr) !important; max-width: none; }
.ai-page { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; min-width: 0; }
#tab-settings .set-pane [data-subhost] > .sub-off { display: none !important; }
.ai-card { display: grid; gap: .7rem; min-width: 0; align-content: start; }
.ai-card .card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; flex-wrap: nowrap; }
.ai-card .card-head > button { flex: none; }
.ai-card .card-head > div { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .6rem; align-items: center; }
.ai-card .card-head h3 { margin: 0; font-family: var(--font-display); }
.ai-card .card-head .hint { grid-column: 2; margin: .1rem 0 0; }
.ai-step { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: var(--radius); font-weight: 700; font-size: var(--fs-sm);
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent)); color: var(--accent); }
.ai-card h4 { margin: .4rem 0 0; }

/* 1 · cosa c'è */
.ai-pc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .5rem; }
.ai-stat { display: grid; gap: .1rem; padding: .6rem .75rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.ai-stat b { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ai-stat span { font-size: var(--fs-xs); color: var(--muted); }
.ai-stat.ok b { color: var(--ok); }
.ai-stat.ko b { color: var(--danger); }
.ai-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: var(--radius); background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); flex: none; }
.ai-used { color: var(--ink-2); font-weight: 600; }

/* 3 · chi fa cosa (tabella) */
.ai-st { display: inline-flex; gap: .35rem; align-items: center; color: var(--muted); min-width: 0; }
.ai-st svg { width: var(--ic-xs); height: var(--ic-xs); flex: none; }
.ai-st.ok { color: var(--ok); }
.ai-st.warn { color: #b45309; }
.ai-st.ext { color: var(--accent); }

/* 3 · scarica */
.ai-dl-procs { display: flex; flex-wrap: wrap; gap: .4rem; }
.ai-chip { display: inline-flex; gap: .4rem; align-items: center; padding: .4rem .75rem; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; min-height: 2.25rem; }
.ai-chip svg { width: var(--ic-sm); height: var(--ic-sm); }
.ai-chip:hover { border-color: var(--line-strong, var(--line)); color: var(--ink); }
.ai-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ai-dl-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ai-dl-bar .seg { flex: none; }
.ai-dl-bar input[type="search"] { flex: 1 1 16rem; min-width: 0; }
.ai-dl-pulls { display: grid; gap: .4rem; }
.ai-dl-pulls:empty { display: none; }
.ai-pull { display: grid; gap: .3rem; padding: .55rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.ai-pull > div:first-child { display: flex; gap: .5rem; flex-wrap: wrap; align-items: baseline; min-width: 0; }
.ai-pull b { overflow-wrap: anywhere; }
.ai-pull.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.ai-pull.error .meta { color: var(--danger); }
.ai-pull.done .meta { color: var(--ok); }
.ai-dl-other { display: flex; gap: .5rem; flex-wrap: wrap; }
.ai-dl-other input { flex: 1 1 18rem; min-width: 0; }
.ai-calc > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); padding: .3rem 0; }

@media (max-width: 720px) {
  .ai-card .card-head .hint { grid-column: 1 / -1; }
  .ai-dl-bar .seg { width: 100%; display: flex; }
  .ai-dl-bar .seg > button { flex: 1; }
  .ai-chip { font-size: var(--fs-sm); padding: .35rem .65rem; }
}
.ai-ago { color: var(--ok); font-weight: 600; }
.ai-own { grid-column: 1 / -1; }
.ai-own p { margin: .2rem 0 .5rem; }

/* ---------- card 1: il PC letto davvero e la configurazione calcolata (sysscan.py) ---------- */
.lm-profile .scn-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; margin: .2rem 0 .55rem; }
.lm-profile .scn-head > div { display: grid; gap: .15rem; min-width: 0; }
.lm-profile .scn-head b { font-family: var(--font-display); font-size: var(--fs-md); }
.lm-profile .scn-head .ghost { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; flex: none; }
.lm-profile .scn-head .ghost svg { width: var(--ic-sm); height: var(--ic-sm); }
.lm-profile .scn-plan-h { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.scn-hws { display: grid; grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); gap: .5rem; }
.scn-hw { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem .75rem; border-radius: var(--radius); background: var(--surface-2);
  border: 1px solid var(--line); min-width: 0; }
.scn-hw > svg { width: var(--ic-sm); height: var(--ic-sm); flex: none; margin-top: .15rem; color: var(--accent); }
.scn-hw > div { display: grid; gap: .1rem; min-width: 0; }
.scn-hw b { font-weight: 600; font-size: var(--fs-base); line-height: 1.35; overflow-wrap: anywhere; }
.scn-hw b .meta { font-weight: 400; }
.scn-ok, .scn-warn { display: inline-flex; align-items: center; gap: .25rem; font-size: var(--fs-sm); font-weight: 600; }
.scn-ok { color: var(--ok, #12A56A); } .scn-warn { color: var(--warn, #C77C02); }
.scn-ok svg, .scn-warn svg { width: var(--ic-xs); height: var(--ic-xs); }
.scn-table { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.scn-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "proc st" "model model"; gap: .3rem .8rem; align-items: center;
  padding: .6rem .8rem; border-top: 1px solid var(--line); background: var(--surface); }
.scn-row:first-child { border-top: 0; }
.scn-proc { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.scn-proc svg { width: var(--ic-sm); height: var(--ic-sm); color: var(--accent); flex: none; }
.scn-proc b { font-size: var(--fs-base); font-weight: 600; }
.scn-model { display: grid; gap: .1rem; min-width: 0; }
.scn-model > b { font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--fs-sm); font-weight: 600; overflow-wrap: anywhere; }
.scn-model .meta { font-size: var(--fs-sm); line-height: 1.4; }
.scn-st { display: inline-flex; align-items: center; gap: .25rem; font-size: var(--fs-xs); font-weight: 600; padding: .2rem .5rem;
  border-radius: var(--radius); background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.scn-st svg { width: var(--ic-xs); height: var(--ic-xs); }
.scn-st.ok { background: color-mix(in srgb, var(--ok, #12A56A) 14%, transparent); color: var(--ok, #12A56A); }
.scn-st.dl { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.scn-st.run { background: color-mix(in srgb, #38BDF8 18%, transparent); color: #0E7FB5; }
.scn-st.ko { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.scn-mem { display: grid; gap: .3rem; margin: .7rem 0 .2rem; }
.scn-bar { height: .45rem; border-radius: var(--radius); background: var(--surface-3); overflow: hidden; }
.scn-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2F6BFF, #38BDF8); }
.scn-warnline { display: flex; gap: .45rem; align-items: flex-start; margin: .45rem 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.scn-warnline svg { width: var(--ic-sm); height: var(--ic-sm); flex: none; margin-top: .1rem; color: var(--warn, #C77C02); }
.scn-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .8rem; }
.scn-row > .scn-proc { grid-area: proc; } .scn-row > .scn-model { grid-area: model; padding-left: 1.55rem; } .scn-row > .scn-st { grid-area: st; }
@media (max-width: 640px) {
  .lm-profile .scn-head .ghost span { display: none; }
}

/* capacità dei modelli: etichette rettangolari morbide, niente pillole con il contorno */
.lm-profile .scn-head .check { white-space: nowrap; flex: none; }
/* Banco di prova (aitrial.js): «Ascolta», «Prova», modelli in prova e il popup */
.ait-play.ait-on { background: #38bdf8; border-color: #38bdf8; color: #06202c; }
.ait-card:focus { outline: none; }
.ait-long { font-style: normal; }
.ait-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: .5rem; }
.ait-chip { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .6rem .75rem;
  border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, #f5b941 55%, var(--line));
  background: color-mix(in srgb, #f5b941 8%, var(--surface)); min-width: 0; }
.ait-chip b { display: block; font-size: var(--fs-base); overflow-wrap: anywhere; }
.ait-chip .meta { display: block; font-size: var(--fs-xs); }
.ait-chip.ready { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); background: color-mix(in srgb, var(--ok) 7%, var(--surface)); }
.ait-chip.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
.ait-dot { width: .6rem; height: .6rem; border-radius: var(--radius); background: #f5b941; box-shadow: 0 0 0 3px color-mix(in srgb, #f5b941 25%, transparent); }
.ait-chip.ready .ait-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.ait-chip.error .ait-dot { background: var(--danger); box-shadow: none; }
.ait-chip.download .ait-dot, .ait-chip.bench .ait-dot { animation: ait-pulse 1.4s ease-in-out infinite; }

.sheet-card.ait-card { width: min(64rem, 100%); }
.ait-head { gap: .75rem; }
.ait-badge { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: var(--radius); flex: none; color: #fff;
  background: linear-gradient(135deg, #2f6bff, #38bdf8); box-shadow: 0 6px 18px -8px rgba(47, 107, 255, .7); }
.ait-badge svg { width: var(--ic-md); height: var(--ic-md); }
.ait-titles { flex: 1; min-width: 0; display: grid; }
.ait-titles h3 { margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); }
.ait-titles .meta { overflow-wrap: anywhere; }
.ait-body { display: grid; gap: 1rem; align-content: start; }
.ait-tabs { width: 100%; display: flex; }
.ait-tabs > button { flex: 1; display: inline-flex; gap: .45rem; align-items: center; justify-content: center; }
.ait-tabs svg { width: var(--ic-sm); height: var(--ic-sm); }
.ait-pane { display: grid; gap: .8rem; min-width: 0; align-content: start; }
.ait-lead { margin: 0; line-height: 1.5; }
.ait-h { margin: .2rem 0 0; font-size: var(--fs-md); }
.ait-q { width: 100%; box-sizing: border-box; resize: vertical; min-height: 4.6rem; font: inherit; }
.ait-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: flex-end; }
.ait-actions .check { margin-right: auto; }
.ait-actions button, .ait-intro button, .ait-sample button { display: inline-flex; gap: .45rem; align-items: center; }
.ait-actions svg, .ait-intro button svg, .ait-sample svg, .ait-ab svg, .ait-again svg, .ait-media svg, .ait-foot svg { width: var(--ic-sm); height: var(--ic-sm); }
.ait-sample { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; padding: .9rem 1rem; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, color-mix(in srgb, #2f6bff 10%, var(--surface)), color-mix(in srgb, #38bdf8 12%, var(--surface)));
  border: 1px solid color-mix(in srgb, #38bdf8 35%, var(--line)); }
.ait-sample .meta { flex: 1 1 14rem; }
.ait-media { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.ait-media > div { display: grid; gap: .4rem; justify-items: start; flex: 1 1 14rem; }
.ait-thumb { width: 5.5rem; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.ait-thumb.big { width: min(100%, 26rem); margin-top: .5rem; }
.ait-file { display: inline-flex; gap: .4rem; align-items: center; cursor: pointer; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .35rem .8rem; font-size: var(--fs-base); min-height: 2.1rem; font-weight: 500; }
.ait-file:hover { border-color: var(--line-strong, var(--line)); }
.ait-mic .ait-on { color: var(--danger); border-color: var(--danger); }
.ait-out:empty { display: none; }
.ait-out { display: grid; gap: .5rem; }
.ait-step { display: flex; gap: .6rem; align-items: center; margin: 0; color: var(--ink-2); font-size: var(--fs-base); }
.ait-spin { width: 1rem; height: 1rem; border-radius: var(--radius); border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent); animation: ait-spin .8s linear infinite; flex: none; }
.ait-answer, .ait-acol { padding: .8rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); min-width: 0; display: grid; gap: .5rem; align-content: start; }
.ait-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: var(--fs-md); max-height: 22rem; overflow: auto; }
.ait-answer audio, .ait-acol audio, .ait-cell audio { width: 100%; max-width: 26rem; height: 2.4rem; }
.ait-gen { width: min(100%, 28rem); border-radius: var(--radius); }
.ait-src { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin: 0; }
.ait-src svg { width: var(--ic-xs); height: var(--ic-xs); }
.ait-rank { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; font-size: var(--fs-base); }
.ait-rank li { display: flex; gap: .6rem; justify-content: space-between; }
.ait-rank li b { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.ait-rank li.top span { font-weight: 600; color: var(--ok); }
.ait-intro, .ait-progress { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem; border-radius: var(--radius-sm);
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.ait-progress { display: grid; gap: .6rem; }
.ait-progress .meta { margin: 0; }
.ait-intro > svg { width: var(--ic-xl); height: var(--ic-xl); color: var(--accent); flex: none; margin-top: .1rem; }
.ait-intro > div { display: grid; gap: .5rem; justify-items: start; }
.ait-intro .meta { line-height: 1.5; }

.ait-results { display: grid; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.ait-row { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 2fr); border-top: 1px solid var(--line); min-width: 0; }
.ait-results.two .ait-row { grid-template-columns: minmax(9rem, 1fr) minmax(0, 1.6fr) minmax(0, 1.6fr); }
.ait-row:first-child { border-top: 0; }
.ait-row > * { padding: .7rem .8rem; min-width: 0; }
.ait-row > * + * { border-left: 1px solid var(--line); }
.ait-hrow { background: var(--surface-2); }
.ait-lab { display: grid; gap: .15rem; align-content: start; font-weight: 600; font-size: var(--fs-base); }
.ait-lab .meta { font-weight: 400; font-size: var(--fs-xs); }
.ait-col-h { display: grid; gap: .1rem; min-width: 0; }
.ait-col-h b { overflow-wrap: anywhere; }
.ait-col-h .meta { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; }
.ait-sum { font-size: var(--fs-sm); color: var(--ink-2); }
.ait-sum b { color: var(--ink); }
.ait-cell { display: grid; gap: .3rem; align-content: start; }
.ait-cell > .meta { font-size: var(--fs-sm); }
.ait-ok, .ait-ko { display: inline-flex; gap: .3rem; align-items: center; font-weight: 700; font-size: var(--fs-sm); }
.ait-ok { color: var(--ok); }
.ait-ko { color: var(--danger); }
.ait-ok svg, .ait-ko svg { width: var(--ic-sm); height: var(--ic-sm); }
.ait-note { color: #b45309; }
.ait-det summary { cursor: pointer; font-size: var(--fs-sm); color: var(--accent); font-weight: 600; }
.ait-det .ait-text { margin-top: .35rem; font-size: var(--fs-sm); max-height: 14rem; padding: .5rem .6rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.ait-ab, .ait-again { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ait-ab button, .ait-again button { display: inline-flex; gap: .4rem; align-items: center; }
.ait-ab .ait-on { background: #38bdf8; border-color: #38bdf8; color: #06202c; }
.ait-ask { display: grid; gap: .6rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.ait-ask .ait-h + .meta { margin: -.4rem 0 0; }
.ait-answers { display: grid; gap: .6rem; }
.ait-answers.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.ait-empty { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--amber, #f5b941) 55%, var(--line)); background: color-mix(in srgb, #f5b941 7%, var(--surface)); }
.ait-empty > svg { width: var(--ic-lg); height: var(--ic-lg); color: #b45309; flex: none; }
.ait-empty > div { display: grid; gap: .3rem; justify-items: start; }
.ait-foot button { display: inline-flex; gap: .4rem; align-items: center; }
.ait-foot .danger-text { color: var(--danger); }
@keyframes ait-spin { to { transform: rotate(360deg); } }
@keyframes ait-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .ait-spin, .ait-chip .ait-dot { animation: none; } }
@media (max-width: 720px) {
  .ait-row, .ait-results.two .ait-row { grid-template-columns: minmax(0, 1fr); }
  .ait-row > * + * { border-left: 0; border-top: 1px dashed var(--line); }
  .ait-hrow .ait-lab { display: none; }
  .ait-hrow > .ait-col-h + .ait-col-h { border-top: 1px dashed var(--line); }
  .ait-long { display: none; }
  .ait-cell::before { content: attr(data-col); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .ait-foot #ai-try-keep { flex: 1 1 100%; justify-content: center; }
}

/* le tabelle della pagina AI: righe pulite, colonne allineate; sul telefono ogni riga è una scheda */
.ai-tbl-wrap { min-width: 0; }
.ai-tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.ai-tbl caption { text-align: left; padding: .2rem 0 .5rem; }
.ai-tbl th { text-align: left; font-size: var(--fs-2xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: .45rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ai-tbl td { padding: .6rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; min-width: 0; overflow-wrap: anywhere; }
.ai-tbl tbody tr:last-child td { border-bottom: 0; }
.ai-tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.ai-tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ai-tbl .ai-act { text-align: right; white-space: nowrap; }
.ai-tbl td small { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: .1rem; overflow-wrap: anywhere; }
.ai-m-name { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.ai-kind { display: inline-flex; align-items: flex-start; gap: .4rem; color: var(--ink-2); }
.ai-kind svg { width: var(--ic-sm); height: var(--ic-sm); color: var(--accent); flex: none; margin-top: .12em; }
.ai-tbl .icon-only { width: 2rem; height: 2rem; min-height: 0; padding: 0; display: inline-grid; place-items: center; }
.ai-tbl .icon-only svg { width: var(--ic-sm); height: var(--ic-sm); }
.ai-models-f small { margin-left: .35rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ai-models-f .on small { color: inherit; opacity: .8; }
.ai-procs .ai-proc-h { display: flex; gap: .65rem; align-items: center; }
.ai-procs .ai-proc-h b { display: block; }
.ai-procs td:first-child { width: 34%; }
.ai-procs td:nth-child(2) { width: 32%; }
.ai-procs select { width: 100%; min-width: 0; }
.ai-procs tr.warn td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--amber, #f5b941) 80%, transparent); }
.ai-procs .ai-act .linkish, .ai-procs .ai-act button.linkish { display: inline-flex; gap: .3rem; align-items: center; font-size: var(--fs-sm); padding: 0 0 0 .8rem;
  background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; min-height: 0; }
.ai-procs .ai-act .linkish svg { width: var(--ic-xs); height: var(--ic-xs); }
.ai-dl-list td:first-child { width: 26%; }
.ai-dl-list .ai-dl-desc { color: var(--ink-2); }
.ai-dl-list tr.ai-best td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.ai-dl-list .lm-sizes { display: inline-flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
.ai-dl-list .lm-sizes .chip { display: inline-flex; gap: .3rem; align-items: center; font-size: var(--fs-xs); padding: .2rem .6rem;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; min-height: 1.9rem; }
.ai-dl-list .chip svg { width: var(--ic-xs); height: var(--ic-xs); }
.ai-dl-list .chip.ai-best { border-color: var(--accent); color: var(--accent); }
.ai-dl-list .chip:hover:not(:disabled) { border-color: var(--accent); }
.ai-have { display: inline-flex; align-items: center; gap: .3rem; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.ai-have.ok { color: var(--ok); }
.ai-have svg { width: var(--ic-xs); height: var(--ic-xs); }
.ait-box:empty { display: none; }
@media (max-width: 860px) {
  .ai-tbl thead { display: none; }
  .ai-tbl, .ai-tbl tbody { display: block; }
  .ai-tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .8rem; padding: .7rem .1rem; border-bottom: 1px solid var(--line); }
  .ai-tbl tbody tr:last-child { border-bottom: 0; }
  .ai-tbl td { display: block; padding: 0; border: 0; width: auto !important; text-align: left; }
  .ai-tbl td:first-child { grid-column: 1; }
  .ai-tbl td.ai-act { grid-column: 2; grid-row: 1; text-align: right; }
  .ai-tbl td:not(:first-child):not(.ai-act) { grid-column: 1 / -1; font-size: var(--fs-sm); }
  .ai-tbl td[data-l]:not(:first-child)::before { content: attr(data-l) " · "; color: var(--muted); font-size: var(--fs-xs); }
  .ai-tbl .num { text-align: left; }
  .ai-procs td.ai-act { grid-column: 1 / -1; grid-row: auto; text-align: left; }
  .ai-procs .ai-act .linkish { padding: 0 .9rem 0 0; }
  .ai-dl-list td.ai-act { grid-column: 1 / -1; grid-row: auto; }
  .ai-dl-list .lm-sizes { justify-content: flex-start; }
}
.ai-proc-ic { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: var(--radius); flex: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.ai-proc-ic svg { width: var(--ic-sm); height: var(--ic-sm); }
.ai-models-f { display: flex; flex-wrap: wrap; width: max-content; max-width: 100%; }
.ai-models-f > button { white-space: nowrap; }
.ai-procs .ai-acts { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.ai-procs .ai-act .linkish, .ai-procs .ai-act button.linkish { padding: 0; }
.ai-procs td:nth-child(3) { width: auto; }
@media (max-width: 860px) {
  .ai-models-f { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .ai-procs .ai-acts { flex-direction: row; gap: .9rem; align-items: center; }
}
@media (min-width: 861px) {
  .ai-procs { table-layout: fixed; }
  .ai-procs th:nth-child(1) { width: 31%; }
  .ai-procs th:nth-child(2) { width: 29%; }
  .ai-procs th:nth-child(4) { width: 6.5rem; }
  .ai-procs td:first-child, .ai-procs td:nth-child(2) { width: auto; }
  .ai-models { table-layout: fixed; }
  .ai-models th:nth-child(1) { width: 26%; }
  .ai-models th:nth-child(2) { width: 19%; }
  .ai-models th:nth-child(4) { width: 6rem; }
  .ai-models th:nth-child(6) { width: 3.2rem; }
  .ai-dl-list { table-layout: fixed; }
  .ai-dl-list th:nth-child(2) { width: 13%; }
  .ai-dl-list th:nth-child(3) { width: 6.5rem; }
  .ai-dl-list th:nth-child(5) { width: 15rem; }
  .ai-dl-list td:first-child { width: auto; }
  /* colonne a misura fissa: un peso lungo («≈ 100 M parametri per lingua») va a capo, mai sopra la colonna accanto */
  :is(.ai-procs, .ai-models, .ai-dl-list) td.num { white-space: normal; overflow-wrap: normal; text-wrap: balance; }
}

.scn-prio { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; margin: .1rem 0 .6rem; }
.scn-prio .seg { flex: none; }

/* Scarica modelli: una lista sola, solo ciò che gira bene su questo PC */
.ai-dl-pc { display: flex; align-items: center; gap: .45rem; margin: 0; flex: 1 1 22rem; min-width: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.ai-dl-pc svg { width: var(--ic-sm); height: var(--ic-sm); color: var(--accent); flex: none; }
.ai-dl-pc span { min-width: 0; overflow-wrap: anywhere; }
.ai-dl-bar input[type="search"] { flex: 0 1 16rem; }
.ai-dl-more { margin-top: .2rem; }
.ai-dl-more .ai-dl-other { margin-top: .5rem; }
.ai-rec { display: inline-flex; align-items: center; margin-left: .45rem; padding: .05rem .45rem; border-radius: var(--radius); font-size: var(--fs-2xs);
  white-space: nowrap;
  font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); vertical-align: .1em; }
.ai-dl-list .ai-m-name { font-weight: 600; color: var(--ink); }
.ai-dl-list small.ai-m-ver { font-variant-numeric: tabular-nums; margin: .1rem 0 .25rem; }
.ai-dl-list .ai-dl-desc { display: block; font-size: var(--fs-sm); line-height: 1.4; }
.ai-tags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.ai-tag { font-size: var(--fs-2xs); padding: .05rem .4rem; border-radius: var(--radius); border: 1px solid var(--line); color: var(--muted); }
.ai-dl-list td.ai-tech { font-size: var(--fs-sm); color: var(--ink-2); }
.ai-dl-list .chip.primary-chip { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ai-dl-list .chip.primary-chip:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
.ai-dl-list .lm-sizes .chip.ait-try, .ai-dl-list .lm-sizes .chip.ait-listen { font-weight: 600; }
.ai-pull > div:first-child .chip { margin-left: auto; display: inline-flex; gap: .25rem; align-items: center; font-size: var(--fs-xs);
  padding: .15rem .55rem; }
.ai-pull .chip svg { width: var(--ic-xs); height: var(--ic-xs); }
.ai-pull.stopped .meta { color: var(--muted); }
@media (min-width: 861px) {
  .ai-dl-list { table-layout: fixed; }
  .ai-dl-list th:nth-child(1) { width: 34%; }
  .ai-dl-list th:nth-child(2) { width: 15%; }
  .ai-dl-list th:nth-child(3) { width: 11%; }
  .ai-dl-list th:nth-child(4) { width: 10%; }
  .ai-dl-list th:nth-child(5) { width: 13%; }
  .ai-dl-list th:nth-child(6) { width: 17%; }
  .ai-dl-list td:first-child { width: auto; }
  .ai-dl-list .lm-sizes { white-space: normal; }
  .ai-dl-list td.num small { white-space: normal; }
  .ai-dl-list td.num { padding-left: .9rem; }
}
@media (max-width: 860px) { .ai-dl-bar input[type="search"] { flex: 1 1 100%; } }

/* il modello Graphorum: ora ha la sua pagina, «Il tuo modello» (gmodel.css) */

/* «Solo i miei modelli» acceso: l'avviso in cima alla pagina (sul foglio, separato da una riga sottile) */
.ai-solo-note { display: flex; align-items: flex-start; gap: .6rem 1rem; flex-wrap: wrap; padding: 0 0 .9rem; margin-bottom: .2rem;
  border-bottom: 1px solid var(--line); color: var(--ink-2); }
.ai-solo-note > svg { width: var(--ic-sm); height: var(--ic-sm); flex: none; margin-top: .15rem; color: var(--warn); }
.ai-solo-note p { flex: 1 1 18rem; min-width: 0; margin: 0; font-size: var(--fs-base); line-height: 1.5; }
.ai-solo-note p b { color: var(--ink); }
.ai-solo-note button { flex: none; }

/* ------------------------------------------------------------------ Scarica modelli › Hugging Face dal vivo */
/* sotto i consigliati, sul foglio: una riga sottile e il titolo; «Gira su questo PC» in parole e colore */
.ai-hf { display: grid; gap: .5rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); min-width: 0; }
.ai-hf.hidden { display: none; }
.ai-hf-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem 1rem; }
.ai-hf-head h4 { margin: 0; display: inline-flex; align-items: center; gap: .45rem; font: 500 var(--fs-md)/1.3 var(--font-display, inherit); }
.ai-hf-head h4 svg { width: var(--ic-sm); height: var(--ic-sm); color: var(--accent); }
.ai-hf-head .meta { font-size: var(--fs-sm); }
.ai-fit { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: var(--fs-sm); }
.ai-fit::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; flex: none; }
.ai-fit.ok { color: var(--ok); } .ai-fit.warn { color: var(--warn); } .ai-fit.ko { color: var(--danger); }
.ai-fit.try { color: var(--accent); }
.ai-hf-list .ai-dl-desc { margin-top: .3rem; font-size: var(--fs-sm); }
.ai-hf-list .lm-sizes .chip { white-space: nowrap; }
@media (min-width: 861px) {
  .ai-hf-list th:nth-child(1) { width: 28%; } .ai-hf-list th:nth-child(2) { width: 12%; }
  .ai-hf-list th:nth-child(3) { width: 13%; } .ai-hf-list th:nth-child(4) { width: 9%; }
  .ai-hf-list th:nth-child(5) { width: 18%; } .ai-hf-list th:nth-child(6) { width: 20%; }
}
.ai-hf-list td small { line-height: 1.35; }
.ai-hf-list .ai-hf-file { overflow-wrap: anywhere; }
.ai-hf-list td.num small { overflow-wrap: normal; }      /* «+ 2,8 GB di supporto» va a capo tra le parole */
/* in fondo, chiusi: quelli che non girano qui, ognuno con il perché (niente pulsante per scaricarli) */
.ai-hf-out { border-top: 1px solid var(--line); padding-top: .6rem; min-width: 0; }
.ai-hf-out.hidden { display: none; }
.ai-hf-out > summary { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; list-style: none;
  font-weight: 600; font-size: var(--fs-base); color: var(--muted); min-height: var(--ctl-h); }
.ai-hf-out > summary::-webkit-details-marker { display: none; }
.ai-hf-out > summary svg { width: var(--ic-sm); height: var(--ic-sm); color: var(--danger); flex: none; }
.ai-hf-out > summary::after { content: ""; width: .45rem; height: .45rem; margin-left: .15rem; border: solid currentColor;
  border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.ai-hf-out[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.ai-hf-x { list-style: none; margin: .2rem 0 0; padding: 0; }
.ai-hf-x li { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: .2rem 1.2rem; padding: .55rem 0;
  border-bottom: 1px solid var(--line); font-size: var(--fs-sm); min-width: 0; }
.ai-hf-x li:last-child { border-bottom: 0; }
.ai-hf-xn { display: grid; gap: .1rem; min-width: 0; }
.ai-hf-xn a { color: var(--ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.ai-hf-xn a:hover { color: var(--accent); }
.ai-hf-xn small { overflow-wrap: anywhere; }
.ai-hf-xr { color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
@media (max-width: 720px) { .ai-hf-x li { grid-template-columns: minmax(0, 1fr); } }

/* Misure del mini PC (misure.js): righe e tabelle sul foglio, le immagini da giudicare in una griglia */
.ai-card .card-head > .mis-acts { flex: none; display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {                 /* sul telefono i pulsanti vanno sotto il titolo, a tutta riga */
  .ai-card .card-head:has(> .mis-acts) { flex-wrap: wrap; }
  .ai-card .card-head > .mis-acts { flex: 1 1 100%; justify-content: flex-start; }
}
.mis-out { display: grid; gap: .35rem; min-width: 0; }
.mis-out h4 { margin: .8rem 0 .1rem; }
.mis-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; margin: 0; color: var(--muted); }
.mis-line { margin: 0; overflow-wrap: anywhere; }
.mis-grid { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); }
.mis-grid li { display: grid; gap: .3rem; align-content: start; min-width: 0; }
.mis-grid :is(img, video) { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.mis-grid small { color: var(--muted); overflow-wrap: anywhere; }
.mis-vote { display: flex; gap: .4rem; flex-wrap: wrap; }
/* Insegna al decisore: il testo della decisione, la domanda e le risposte come pulsanti della stessa altezza */
.lab-item { display: grid; gap: .55rem; min-width: 0; }
.lab-q { display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; margin: 0; }
.lab-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 14rem; overflow: auto; padding: .1rem 0 .1rem .8rem;
  border-left: 2px solid var(--line-strong); color: var(--ink-2); font-size: var(--fs-md); }
.lab-opts, .lab-more { display: flex; flex-wrap: wrap; gap: .4rem; }

/* Libera spazio: l'elenco di cosa toglierebbe o ha tolto (riga sottile tra le voci, niente riquadri) */
.clean-list { list-style: none; margin: 0; padding: 0; display: grid; }
.clean-list li { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-top: 1px solid var(--line);
  font-size: var(--fs-base); min-width: 0; }
.clean-list li:first-child { border-top: 0; }
.clean-list li span { min-width: 0; overflow-wrap: anywhere; }
.clean-list li b { flex: none; font-variant-numeric: tabular-nums; }
/* Velocità: i modelli che il motore ha fatto ripartire in modalità prudente */
.eng-faults:empty { display: none; }
.eng-faults { display: grid; gap: .4rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.eng-faults h4 { margin: 0; font-size: var(--fs-md); }
.eng-fault { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; font-size: var(--fs-base); }
.eng-fault .meta { display: block; overflow-wrap: anywhere; }

/* Scarica › Voce: le voci naturali in un gruppo a parte, in cima (titolo, riga sottile e spazio: niente riquadri).
   «Naturale» accanto al nome; le voci che su questo PC sarebbero troppo lente dicono perché, al posto di «Scarica e usa» */
.ai-dl-list tr.ai-dl-sec th { padding: 1.1rem .1rem .45rem; border-bottom: 1px solid var(--line); text-align: left;
  font-weight: 400; background: none; text-transform: none; letter-spacing: normal; white-space: normal; color: var(--ink); }
.ai-dl-list tr.ai-dl-sec:first-child th { padding-top: .5rem; }
.ai-dl-list .ai-sec-t { display: flex; align-items: center; gap: .45rem; font-family: "Space Grotesk", var(--font, inherit);
  font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.ai-dl-list tr.ai-dl-sec.nat .ai-sec-t { color: var(--accent); }
.ai-dl-list .ai-sec-t svg { width: 1.05rem; height: 1.05rem; flex: none; }
.ai-dl-list tr.ai-dl-sec small { display: block; margin-top: .2rem; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.4;
  max-width: 62rem; }
.ai-nat { display: inline-flex; align-items: center; margin-left: .45rem; padding: .05rem .45rem; border-radius: var(--radius);
  white-space: nowrap;
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; vertical-align: .1em;
  color: color-mix(in srgb, #38bdf8 70%, var(--ink)); background: color-mix(in srgb, #38bdf8 14%, transparent); }
.ai-dl-list tr.ai-natural td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, #38bdf8 70%, transparent); }
.ai-dl-list tr.ai-natural.ai-slow td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, #f5b941 75%, transparent); }
/* le voci lente su questo PC: l'avviso onesto accanto alla voce (e di nuovo nel popup prima del download) */
.ai-dl-list .ai-dl-warn { display: flex; align-items: flex-start; gap: .35rem; margin-top: .35rem; font-size: var(--fs-xs); line-height: 1.4;
  color: color-mix(in srgb, #f5b941 60%, var(--ink)); }
.ai-dl-list .ai-dl-warn svg { width: .9rem; height: .9rem; flex: none; margin-top: .1rem; }
@media (max-width: 860px) {
  .ai-dl-list tr.ai-dl-sec { display: block; padding: 0; border-bottom: 0; }
  .ai-dl-list tr.ai-dl-sec th { display: block; padding: 1rem .1rem .45rem; }
}
