:root {
  --bg: #f4f4f1;
  --card: #ffffff;
  --ink: #1b1d1f;
  --muted: #6b7075;
  --line: #e2e2dd;
  --accent: #0f7b5f;
  --accent-ink: #ffffff;
  --rec: #d23b2f;
  --warn: #a15c00;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416; --card: #1b1e21; --ink: #e8e9ea; --muted: #9aa0a6;
    --line: #2c3035; --accent: #2fb58c; --accent-ink: #0b1411; --rec: #ff5a4e; --warn: #f0a640;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 640px; margin: 0 auto; padding: 0 16px 48px; display: grid; gap: 16px; }

.top { max-width: 640px; margin: 0 auto; padding: 16px; display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 20px; margin: 0; }
.badge { font: 600 11px var(--mono); padding: 3px 7px; border-radius: 4px; background: var(--warn); color: #fff; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h2 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 14px; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.lista li:first-child { border-top: 0; }
.lista .q { font-family: var(--mono); color: var(--muted); white-space: nowrap; padding-left: 12px; }
.lista li.nuovo { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }

.controlli { display: grid; justify-items: center; gap: 12px; padding: 8px 0; }
.risposta { min-height: 1.45em; margin: 0; text-align: center; font-weight: 500; }
.stato { margin: 0; min-height: 1.3em; text-align: center; }
.diag { margin: 0; font: 11px/1.3 var(--mono); color: var(--muted); text-align: center; overflow-wrap: anywhere; max-width: 100%; }

.ptt {
  width: 168px; height: 168px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-content: center; gap: 4px; font: 600 15px system-ui, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  cursor: pointer; transition: transform .08s, background .15s;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
}
.ptt-icona { font-size: 40px; line-height: 1; }
.ptt.rec { background: var(--rec); transform: scale(1.06); box-shadow: 0 0 0 10px color-mix(in srgb, var(--rec) 25%, transparent); }
.ptt.busy { opacity: .6; }
.ptt:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }

button { font: inherit; }
.fatto {
  min-width: 168px; padding: 12px 20px; border-radius: 10px;
  border: 2px solid var(--ink); background: transparent; color: var(--ink); font-weight: 600; cursor: pointer;
}
.fatto:disabled { opacity: .35; cursor: not-allowed; }
.bottoni { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.reset {
  padding: 12px 20px; border-radius: 10px; border: 2px solid var(--rec);
  background: transparent; color: var(--rec); font-weight: 600; cursor: pointer;
}
.secondario {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); cursor: pointer; font-size: 14px;
}

.opzioni { display: grid; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.opzioni label { display: grid; gap: 4px; }
.opzioni label.check { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
select, input[type=text] {
  font: inherit; font-size: 14px; padding: 7px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-width: 0;
}
.debug { display: flex; gap: 8px; }
.debug input { flex: 1; }
.azioni-log { display: flex; gap: 8px; flex-wrap: wrap; }

.turni { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.turno { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.turno.errore { border-color: var(--rec); }
.turno-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.turno .etichetta { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; }
.turno .trascr { font-family: var(--mono); background: var(--bg); padding: 6px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.turno .avviso { color: var(--warn); }
.turno pre {
  margin: 0; font: 12px/1.4 var(--mono); background: var(--bg); padding: 8px; border-radius: 6px;
  overflow-x: auto; max-height: 260px;
}
.tempi { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; margin-top: 4px; }
.tempi div { background: var(--bg); border-radius: 6px; padding: 5px 7px; }
.tempi b { display: block; font: 600 15px var(--mono); }
.tempi span { color: var(--muted); font-size: 11px; }
.barra { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 6px; background: var(--line); }
.barra i { display: block; height: 100%; }
.barra .b-client { background: #8a8f95; }
.barra .b-rete { background: #c9a227; }
.barra .b-stt { background: #3a7bd5; }
.barra .b-llm { background: #9b59b6; }
.legenda { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 3px; }
.legenda i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 3px; vertical-align: middle; }
