:root {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111a2e;
  --surface-2: #18233b;
  --border: #24324f;
  --text: #e7ecf5;
  --muted: #93a0b8;
  --accent: #3b82f6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;

  --free-1: #3b82f6;
  --free-2: #1d4ed8;
  --busy-1: #ef4444;
  --busy-2: #b91c1c;
  --off-1: #4b5563;
  --off-2: #3f4753;
  --off-text: #cbd2dc;

  --radius: 14px;
  --box: 150px;
  --gutter: clamp(10px, 2vw, 18px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-2: #f5f7fb;
    --border: #d9e0ea;
    --text: #0f172a;
    --muted: #5b6476;
    --off-1: #9ca3af;
    --off-2: #8b929e;
    --off-text: #ffffff;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { margin: 0; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- barra superiore ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.2rem; letter-spacing: .01em; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .85rem;
  color: var(--muted);
  max-width: 100%;
}
.status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status.is-ok .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.status.is-error .dot { background: var(--danger); }
.status.is-wait .dot { background: var(--warn); }

.legend {
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .82rem;
  color: var(--muted);
}
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(160deg, var(--c1), var(--c2)); }

.tools { display: flex; gap: 6px; margin-left: auto; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.wide { display: inline-flex; gap: 6px; width: auto; padding: 0 12px; font: inherit; font-size: .85rem; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.banner {
  margin: 12px var(--gutter) 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent);
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  font-size: .9rem;
}

/* ---------- layout ---------- */

.layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 12px;
}
.panel-head h2 { font-size: 1rem; }
.counters { margin: 0; font-size: .82rem; color: var(--muted); }

.bottom {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

@media (min-width: 900px) {
  body { display: flex; flex-direction: column; height: 100dvh; }
  .layout { flex: 1; min-height: 0; }
  .extensions { flex: 1; min-height: 160px; overflow: auto; }
  .bottom { flex: none; max-height: 46dvh; }
  .bottom .panel { overflow: auto; }
}

@media (max-width: 720px) {
  .bottom { grid-template-columns: minmax(0, 1fr); }
  .brand h1 { font-size: 1.05rem; }
  .brand-user { font-size: .95rem; max-width: 42vw; }
  .tools { order: 2; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .status { order: 3; }
  .legend { order: 4; width: 100%; }
}

/* ---------- riquadri di stato ---------- */

.is-free, .is-registered { --c1: var(--free-1); --c2: var(--free-2); }
.is-busy, .is-ringing, .is-inuse { --c1: var(--busy-1); --c2: var(--busy-2); }
.is-offline, .is-unregistered { --c1: var(--off-1); --c2: var(--off-2); }

.ext-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--box), 1fr));
  gap: 10px;
}

.ext, .trunk {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  color: #fff;
  text-align: left;
  font: inherit;
  box-shadow: 0 1px 2px rgb(0 0 0 / .25);
  transition: background .3s, color .3s, transform .1s;
}
.ext { min-height: calc(var(--box) * .64); cursor: pointer; }
.ext:hover { filter: brightness(1.08); }
.ext:active { transform: scale(.98); }
.ext:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.ext.is-offline, .trunk.is-unregistered { color: var(--off-text); }

.ext-num {
  font-size: clamp(1.1rem, calc(var(--box) * .17), 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.ext-name, .trunk-name {
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ext-name:empty::before { content: "—"; opacity: .5; }
.ext-info, .trunk-info {
  margin-top: auto;
  font-size: .78rem;
  opacity: .92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.trunk-detail { font-size: .72rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ext.is-ringing, .trunk.is-ringing { animation: ring 1s ease-in-out infinite; }
@keyframes ring {
  0%, 100% { box-shadow: 0 0 0 0 rgb(239 68 68 / .75); }
  50% { box-shadow: 0 0 0 7px rgb(239 68 68 / 0); }
}
@media (prefers-reduced-motion: reduce) {
  .ext.is-ringing { animation: none; outline: 3px dashed #fff; outline-offset: -6px; }
}

.layout.is-stale .ext-grid,
.layout.is-stale .trunk-grid { opacity: .45; filter: saturate(.5); }

.trunk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.trunk { min-height: 74px; }

.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty p { margin: 0 0 14px; }
.empty-inline { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- chiamata ---------- */

.dial form { display: grid; gap: 10px; }
.dial input#dialNumber { font-size: 1.35rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.recent { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.recent:empty { display: none; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.hint { margin: 10px 0 0; font-size: .78rem; color: var(--muted); }

/* ---------- moduli ---------- */

.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: .82rem; color: var(--muted); font-weight: 500; }
.field small { font-size: .75rem; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row .grow { flex: 1 1 200px; }
.narrow { flex: 0 1 150px; }

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
}
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .88rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.check input { width: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.call { background: #16a34a; border-color: transparent; color: #fff; padding: 12px 16px; font-size: 1.05rem; }
.btn.call svg { width: 20px; height: 20px; }

.help { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.45; }
.form-error { color: var(--danger); font-size: .85rem; margin: 0; }

/* ---------- impostazioni ---------- */

dialog { color: var(--text); }
dialog::backdrop { background: rgb(2 6 23 / .6); }

.sheet {
  width: min(680px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--bg);
}
.sheet > form { display: flex; flex-direction: column; height: 100%; }
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 12px;
  border-bottom: 1px solid var(--border);
}
.sheet-head h2 { font-size: 1.1rem; }
.sheet-body { flex: 1; overflow: auto; padding: 14px var(--gutter); display: grid; gap: 14px; align-content: start; }
.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}
.sheet-foot .form-error { margin-right: auto; }

fieldset {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
legend { padding: 0 6px; font-weight: 600; font-size: .95rem; }
.test-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.test-result { font-size: .85rem; }
.test-result.ok { color: var(--ok); }
.test-result.ko { color: var(--danger); }

/* ---------- registro chiamate ---------- */

.sheet.wide { width: min(1240px, 100vw); }
.sheet-frame { display: flex; flex-direction: column; height: 100%; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.head-actions .btn { padding: 7px 12px; font-size: .88rem; text-decoration: none; }
.head-actions svg { width: 18px; height: 18px; }

.cdr-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
}
/* Unica ricerca del registro chiamate, nell'intestazione */
.head-search { flex: 1 1 220px; max-width: 380px; margin-left: auto; padding: 8px 11px; }
.history-row { align-items: flex-end; }
.sync-status.error { color: var(--danger); }

.cdr-history {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.cdr-history .field { flex: 0 1 260px; }

.cdr-status, .cdr-summary { margin: 0; font-size: .85rem; color: var(--muted); }
.cdr-status.error { color: var(--danger); }
.cdr-summary { color: var(--text); font-weight: 500; }

.table-wrap {
  flex: 1;
  min-height: 160px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.cdr-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
/* Intestazione (titoli e filtri) sempre visibile mentre la lista scorre. */
.cdr-table thead { position: sticky; top: 0; z-index: 1; }
.cdr-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: .78rem;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cdr-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.cdr-table tbody tr:hover { background: var(--surface-2); }
.cdr-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cdr-table .when { font-variant-numeric: tabular-nums; }
.cdr-table .who { display: grid; line-height: 1.25; }
.cdr-table .who small { color: var(--muted); font-size: .76rem; }
.cdr-table .muted { color: var(--muted); }

.dir { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; }
.dir b { font-size: 1rem; }
.dir.in b { color: #0ea5e9; }
.dir.out b { color: #22c55e; }
.dir.internal b { color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge.answered { background: color-mix(in srgb, #22c55e 18%, transparent); color: #16a34a; }
.badge.noanswer { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.badge.busy { background: color-mix(in srgb, var(--warn) 22%, transparent); color: #d97706; }
.badge.failed { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }

.recall {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: #16a34a;
  cursor: pointer;
}
.recall svg { width: 16px; height: 16px; }

.list-end { margin: 0; padding: 12px; text-align: center; font-size: .82rem; color: var(--muted); }

.d-short { display: none; }

@media (max-width: 720px) {
  .head-actions .btn { padding: 7px 9px; }
  /* Registro chiamate sul cellulare: niente filtri, solo la freccia, data abbreviata. */
  .dir-label, .d-long { display: none; }
  .head-search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .d-short { display: inline; }
  .dir b { font-size: 1.15rem; }
  .cdr-table td, .cdr-table th { padding: 7px 8px; }
}

.actions { display: inline-flex; gap: 6px; }
.recall.play { color: var(--accent); }

/* ---------- ruoli ---------- */

body:not([data-role="superadmin"]) .admin-only { display: none !important; }
/* Dopo "Centralino": il nome di chi è collegato. */
.brand { min-width: 0; }
.brand-user {
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}
.brand-user:empty { display: none; }
.brand-user::before { content: "·"; margin-right: 8px; color: var(--muted); font-weight: 400; }

/* ---------- aziende e utenti ---------- */

.tabs {
  display: flex;
  gap: 3px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.tab {
  border: 0;
  border-radius: 8px;
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); color: #fff; }

.admin-body { flex: 1; min-height: 0; overflow: auto; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom)); }
.admin-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.sheet-head { flex-wrap: wrap; }
@media (max-width: 720px) {
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .tab { flex: 1; padding: 6px 4px; font-size: .8rem; white-space: nowrap; }
}

.section-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 4px; font-size: 1rem; }
.section-title .count { color: var(--muted); font-weight: 500; font-size: .85rem; }
.admin-list > .help { margin-bottom: 10px; }
.online-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--ok); }
.online-dot.waiting { background: var(--warn); }
.card.guest { border-style: dashed; }
.card-sub.alert { color: var(--danger); font-weight: 600; }
.log-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 10px; }
.log-head .section-title { margin: 0; }
.log-head input { flex: 0 1 280px; padding: 7px 10px; }
.log-wrap { max-height: 55vh; margin-bottom: 8px; }
.badge.info { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
@media (min-width: 900px) {
  .admin-panel.editing { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
  .admin-editor { position: sticky; top: 0; }
}
@media (max-width: 899px) {
  .admin-editor { order: -1; }
}
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.admin-toolbar .help { flex: 1 1 260px; }
.cards { display: grid; gap: 8px; }
.card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
}
button.card { cursor: pointer; }
button.card:hover, .card.selected { border-color: var(--accent); }
.card-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; font-weight: 600; }
.card-sub { font-size: .82rem; color: var(--muted); }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: .76rem; }
.tag.line { border-color: color-mix(in srgb, #0ea5e9 45%, transparent); color: #0ea5e9; }
.tag.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); color: #d97706; }
.tag.off { color: var(--muted); }

.admin-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}
.admin-editor h3 { margin: 0; font-size: 1rem; }
fieldset.picks { padding: 10px 12px; background: var(--surface-2); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 12px; max-height: 280px; overflow: auto; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .88rem; }
.check-item input, .check input { width: auto; }
.check-item small { color: var(--muted); }
.check-item.taken { opacity: .5; }
.editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.link-on { display: grid; gap: 8px; }
.link-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#userLinkUrl { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
#userLinkBox .help { display: block; margin-top: 8px; }
.input-btn { display: flex; gap: 6px; }
.input-btn input { flex: 1; min-width: 0; }
/* Password generata, in chiaro: carattere a spaziatura fissa per leggerla senza errori. */
.input-btn input[type="text"] { font-family: ui-monospace, Consolas, monospace; letter-spacing: .06em; }
.btn.danger { margin-right: auto; background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }

/* ---------- app installata, a schermo intero su telefono: tutto lo spazio ai riquadri ---------- */

@media (display-mode: fullscreen) and (max-width: 720px), (display-mode: standalone) and (max-width: 720px) {
  :root { --gutter: 6px; }
  .topbar { gap: 4px 6px; padding: calc(4px + env(safe-area-inset-top)) 8px 4px; }
  .brand img { width: 26px; height: 26px; }
  .brand h1, .legend, .hint { display: none; }
  /* A schermo intero resta il nome (senza "Centralino"), accanto all'icona. */
  .brand { gap: 6px; }
  .brand-user { max-width: 34vw; font-size: .88rem; }
  .brand-user::before { display: none; }
  .status { order: 2; flex: 1 1 0; min-width: 0; padding: 3px 8px; font-size: .74rem; }
  .tools { order: 3; gap: 4px; margin-left: 0; }
  .icon-btn { width: 34px; height: 34px; border-radius: 9px; }
  .icon-btn.wide { padding: 0 8px; }
  .banner { margin: 6px var(--gutter) 0; padding: 6px 10px; font-size: .8rem; }
  .layout { gap: 6px; padding: 6px var(--gutter) calc(6px + env(safe-area-inset-bottom)); }
  .panel { padding: 8px; border-radius: 10px; }
  .panel-head { margin-bottom: 6px; }
  .ext-grid, .trunk-grid { gap: 6px; }
  .ext { min-height: calc(var(--box) * .56); padding: 7px 9px; border-radius: 9px; }
  .trunk { min-height: 0; padding: 7px 9px; border-radius: 9px; }
  .dial form { gap: 6px; }
  .btn.call { padding: 10px 14px; }
}

.login {
  width: min(360px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.login form, .play-choice { display: grid; gap: 14px; padding: 24px; justify-items: center; }
.login .field, .login .btn { width: 100%; }
.login a.btn { text-decoration: none; }
.admin-locked { margin: 0; text-align: left; font-size: .9rem; color: var(--text); }
.play-choice { gap: 10px; }
.play-choice h2 { font-size: 1.1rem; }
.play-choice .help { margin: 0 0 6px; text-align: center; }
.play-choice .btn svg { width: 20px; height: 20px; }

/* Lettore dell'ascolto sul dispositivo */
.player {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.player-icon { width: 20px; height: 20px; color: var(--accent); flex: none; }
.player-info { flex: 1 1 200px; min-width: 0; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.player.error { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.player.error .player-icon { color: var(--danger); }
.player.error .player-info { color: var(--danger); white-space: normal; }
.player .btn { padding: 6px 14px; }

/* ---------- notifiche ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: .92rem;
  box-shadow: 0 8px 30px rgb(0 0 0 / .3);
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform .25s, opacity .25s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--danger); color: #fff; }
