/* FS Panel – tema MyCloudPBX / ArcoLink */
@font-face { font-family: "Poppins"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/poppins-regular.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/poppins-medium.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/poppins-semibold.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/poppins-bold.woff") format("woff"); }

:root {
  /* palette ArcoLink: viola #8C4493 / #782A7E / #6A2271, arancio #FAB41B, azzurro chiaro #EDF5F7 */
  --bg: #edf5f7; --surface: #ffffff; --surface-2: #f7f4f8; --text: #33283a; --muted: #6f6577; --border: #e4dce7;
  --accent: #8c4493; --accent-2: #782a7e; --accent-soft: #f3e8f4; --accent-ink: #fff;
  --highlight: #fab41b; --highlight-ink: #3b2600;
  --danger: #c0392b; --warn: #b8730a; --ok: #1d8a3b; --pill: #f0eaf2;
  --side: #5e1f64; --side-2: #47174c; --side-text: #f3e7f4; --side-muted: #cfb3d3; --side-hover: rgba(255,255,255,.08); --side-active: rgba(255,255,255,.15);
  --radius: 10px; --shadow: 0 1px 2px rgba(60,20,70,.06), 0 1px 3px rgba(60,20,70,.08);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #140f18; --surface: #1e1724; --surface-2: #251c2c; --text: #efe8f2; --muted: #a596ad; --border: #352a3d;
          --accent: #c27bc9; --accent-2: #d295d8; --accent-soft: #33203a; --accent-ink: #1a0d1c; --pill: #2e2336;
          --highlight: #fab41b; --highlight-ink: #2a1a00;
          --danger: #ec6a5c; --warn: #f0b04a; --ok: #4cc06a; --side: #2b0f30; --side-2: #1f0a23;
          --shadow: none; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--pill); padding: 1px 5px; border-radius: 4px; }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); } .text-err { color: var(--danger); }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout ---------- */
body.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none; z-index: 30; }
.side-head { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 16px 10px; text-align: center; }
.side-logo { width: 168px; height: auto; display: block; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.side-host { font-size: 11.5px; color: var(--side-muted); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-name { font-weight: 700; color: #fff; }
.brand-logo { height: 76px; width: auto; display: block; }
.login-logo { width: 220px; height: auto; display: block; margin: 0 auto 4px; }
.login-sub { text-align: center; }
.version { font-size: 11px; color: var(--side-muted); font-family: ui-monospace, Menlo, monospace; }
.ver-btn { font: inherit; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--accent); border-radius: 999px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.ver-btn:hover { border-color: var(--accent); }
.ver-btn .dot-new { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--highlight); margin-left: 6px; vertical-align: middle; }
.about-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 13.5px; }
.about-grid dt { color: var(--muted); } .about-grid dd { margin: 0; font-weight: 500; }
.about-notes { border-top: 1px solid var(--border); padding-top: 12px; font-size: 13.5px; }
.about-notes h4 { margin: 12px 0 4px; font-size: 13px; color: var(--accent); }
.about-notes ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.version-foot { text-align: center; margin-top: 4px !important; }
.side-head .muted { color: var(--side-muted); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px; letter-spacing: .02em; flex: none; }
.tenant-box { padding: 4px 14px 12px; border-bottom: 1px solid rgba(255,255,255,.1); }
.tenant-box label { display: block; margin-bottom: 4px; color: var(--side-muted); }
.tenant-box select { width: 100%; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.18); }
.tenant-box select option { color: #222; }
.nav { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 6px 10px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-text); font-size: 13.5px; }
.nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--highlight); }
.nav a span:not(.badge) { flex: 1; }
.nav .badge { background: var(--highlight); color: var(--highlight-ink); border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 8px; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; text-align: left; padding: 6px; border-radius: 8px; cursor: pointer; font: inherit; }
.user-btn:hover { background: var(--side-hover); }
.user-meta { display: grid; line-height: 1.25; } .user-meta strong { color: #fff; font-size: 13px; } .user-meta .muted { color: var(--side-muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--highlight); color: var(--highlight-ink) !important; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.side-foot .btn.ghost { color: var(--side-text); border-color: rgba(255,255,255,.22); }
.side-foot .btn.ghost:hover { background: var(--side-hover); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 18px; font-weight: 600; color: var(--accent); }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.live { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.live.off .dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.menu-btn { display: none; }
.view { padding: 22px 24px 40px; max-width: 1500px; width: 100%; }

/* ---------- controlli ---------- */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.btn { font: inherit; font-size: 13.5px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover, .btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.full { width: 100%; }
.danger-text { color: var(--danger) !important; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 6px; width: 30px; height: 30px; cursor: pointer; color: var(--muted); font-size: 15px; }
.icon-btn:hover { background: var(--pill); color: var(--text); }

.toolbar { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.toolbar.wrap { flex-wrap: wrap; }
.toolbar .filter { min-width: 280px; }
.toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.toolbar label.grow, .row .grow { flex: 1; }
.toolbar .quick { display: flex; gap: 4px; }
.toolbar label.check.inline { flex-direction: row; align-items: center; padding-bottom: 8px; }
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.intro { margin: 0 0 12px; }

/* ---------- tabelle ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.table-wrap.flat { border: 0; box-shadow: none; border-radius: 0; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }
th.sorted::after { content: " " attr(data-dir); }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
table.clickable tbody tr:not(.empty) { cursor: pointer; }
table.clickable tbody tr:not(.empty):hover td { background: var(--surface-2); }
tr.empty td { text-align: center; color: var(--muted); padding: 32px; }
tr.empty.err td { color: var(--danger); }
tr.row-err td { background: color-mix(in srgb, var(--danger) 5%, transparent); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 4px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td .detail { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; background: var(--pill); border-radius: 999px; padding: 2px 9px; font-size: 12px; white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.role-superadmin { background: var(--accent-soft); color: var(--accent); }
.dir { font-size: 12.5px; white-space: nowrap; }
.dir.in { color: var(--accent); } .dir.out { color: #3b6fd8; } .dir.loc { color: var(--muted); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; }
.player-wrap { display: inline-flex; align-items: center; gap: 8px; }
.player-wrap audio { height: 32px; max-width: 260px; }

/* ---------- card e statistiche ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.empty-state { max-width: 560px; margin: 40px auto; text-align: center; display: grid; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-value.warn { color: var(--warn); }
.stat-sub { color: var(--muted); font-size: 12px; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 36px; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { display: block; height: 8px; background: var(--pill); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; }
td.barcell { width: 22%; }
.summary { display: flex; gap: 18px; flex-wrap: wrap; margin: -2px 2px 12px; color: var(--muted); font-size: 13px; }
.summary strong { color: var(--text); }

/* ---------- telefono ---------- */
.form-card { display: flex; flex-direction: column; gap: 12px; }
.form-card p { margin: 0; }
.form-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: flex-end; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }
.pc-calls { display: grid; gap: 6px; }
.pc-call { flex-direction: row !important; align-items: center; gap: 10px !important; padding: 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--text) !important; font-size: 13.5px !important; }
.pc-call.sel { border-color: var(--accent); background: var(--accent-soft); }
.pc-actions { display: grid; gap: 10px; padding-top: 6px; border-top: 1px dashed var(--border); }
.result:empty { display: none; }

/* ---------- modali e form ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 20, .5); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 460px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .18s ease; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 10px; }
.modal-head h2 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-body > p { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

.form-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -6px 0 16px; overflow-x: auto; }
.ftab { background: none; border: 0; padding: 9px 12px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.ftab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.form-sec { display: none; } .form-sec.active { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.field > span:first-child { font-weight: 550; }
.field.wide { grid-column: 1 / -1; }
.field.check { flex-direction: row; align-items: center; gap: 9px; color: var(--text); font-size: 13.5px; align-self: end; padding: 8px 0; }
.field.check > span:first-of-type { font-weight: 400; }
.field.check .help { flex-basis: 100%; }
.field.invalid input, .field.invalid select, .field.invalid textarea, .field.invalid .checklist { border-color: var(--danger); outline: 2px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.help { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; cursor: pointer; }
.checks-col { justify-content: flex-end; gap: 8px; }
.checklist { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; max-height: 180px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.checklist.tall { max-height: 240px; }
.filter.mini { padding: 5px 9px; font-size: 13px; }
.repeater .rep-rows { display: grid; gap: 8px; }
.rep-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.rep-cell { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); flex: 1; min-width: 110px; }
.rep-cell.check { flex-direction: row; align-items: center; gap: 6px; flex: 0 0 auto; min-width: 0; padding-bottom: 8px; color: var(--text); font-size: 12.5px; }
.rep-tools { display: flex; gap: 2px; margin-left: auto; }
.rep-add { align-self: flex-start; justify-self: start; margin-top: 4px; }
.alert { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.alert.success { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }

/* ---------- migrazione ---------- */
.mig { display: grid; gap: 14px; }
.mig-intro p { margin: 0 0 8px; }
.mig-help { display: grid; gap: 10px; margin-top: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.drop { border: 2px dashed var(--border); border-radius: 12px; padding: 28px; display: grid; gap: 4px; place-items: center; cursor: pointer; text-align: center; color: var(--text); font-size: 14px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.mig-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mig-files li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.mig-files li .icon-btn { margin-left: auto; }
.mig-sum { margin-top: 18px; }
.mig-sec { margin-top: 14px; }
.badge-n { background: var(--pill); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 600; margin-left: 6px; }
.mig-fallback { margin-bottom: 10px; }
.mig-fallback label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.mini-in { padding: 4px 8px; font-size: 12.5px; width: 170px; }
.todo-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.todo-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.mig-go { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mig-go p { margin: 0; }

/* ---------- nuovo cliente ---------- */
.wizard { display: grid; gap: 14px; }
.wiz-dest { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; width: fit-content; flex-wrap: wrap; }
.seg-opt { display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; font-size: 13.5px; }
.seg-opt + .seg-opt { border-left: 1px solid var(--border); }
.seg-opt:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg-opt:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.ex-tenant { display: grid; gap: 4px; max-width: 520px; }
.run-log li.skip .st { color: var(--muted); }
.wiz-top label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); max-width: 520px; }
.wiz-actions { justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 14px; }
.run-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 420px; overflow-y: auto; }
.run-log li { padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.run-log .st { display: inline-block; width: 20px; font-weight: 700; }
.run-log li.ok .st { color: var(--ok); } .run-log li.ko .st { color: var(--danger); }

/* ---------- import CSV ---------- */
.import .paste { width: 100%; margin-top: 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.import p { margin: 0 0 12px; }
.file-btn { cursor: pointer; }
.cols-help { display: grid; gap: 4px; margin-top: 8px; max-height: 200px; overflow-y: auto; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.map-grid label, .import-opts label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.import-opts { margin-bottom: 12px; }
.preview { max-height: 340px; overflow: auto; box-shadow: none; }
.preview th { position: sticky; top: 0; }
.preview td:nth-child(2) { min-width: 160px; }
.progress { height: 10px; background: var(--pill); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }

/* ---------- profilo e 2FA ---------- */
.profile { display: grid; gap: 4px; }
.profile-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.avatar.big { width: 44px; height: 44px; font-size: 18px; background: var(--accent); color: var(--accent-ink); }
.profile-sec { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.profile-sec:last-child { border-bottom: 0; }
.profile-sec h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.profile-sec > div:first-child { flex: 1; min-width: 0; }
.profile-sec p { margin: 0; }
.btn-col { display: grid; gap: 6px; flex: none; }
.otp-input { font-family: ui-monospace, Menlo, monospace; font-size: 20px !important; letter-spacing: .25em; text-align: center; }
.setup-2fa .steps { margin: 0; padding-left: 20px; display: grid; gap: 16px; }
.setup-2fa .steps li { padding-left: 4px; }
.setup-2fa .steps .form-grid { margin-top: 10px; }
.qr-wrap { display: flex; gap: 18px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.qr { width: 180px; height: 180px; flex: none; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-manual { display: grid; gap: 6px; flex: 1; min-width: 200px; }
.secret { font-size: 14px; padding: 8px 10px; word-break: break-all; letter-spacing: .05em; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; padding: 14px; margin: 12px 0; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; font-size: 15px; }
.check.ack { margin-top: 14px; }
.login-card h3 { margin: 0; }
.login-card details summary { cursor: pointer; }
.login-card details p { margin-top: 6px; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; }
.toast { padding: 11px 16px; border-radius: 9px; background: var(--text); color: var(--bg); box-shadow: 0 8px 28px rgba(0,0,0,.2); max-width: 380px; font-size: 13.5px; animation: pop .2s ease; transition: opacity .4s, transform .4s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--ok); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- login / install ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 15% 0%, rgba(140,68,147,.28), transparent 45%), radial-gradient(circle at 90% 100%, rgba(250,180,27,.22), transparent 40%), var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 30px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 10px 40px rgba(16,24,40,.08); }
.login-card.wide { max-width: 560px; }
.login-card .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.login-card h3 { margin-top: 6px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.login-card p { margin: 0; }
.login-card .alert { margin: 0; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.checks .ok { color: var(--ok); } .checks .ko { color: var(--danger); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .menu-btn { display: inline-block; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .view { padding: 16px; }
  .live-text, #live-text { display: none; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .filter { min-width: 0; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 92vh; border-radius: 14px 14px 0 0; }
}

/* ---------- accesso (stile area clienti ArcoLink) ---------- */
.auth-page, .login-page {
  --auth-ink: #344767; --auth-brand: #662483; --auth-brand2: #9565ff;
  min-height: 100vh; margin: 0; position: relative; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px 88px; color: #444;
  background-color: #1a1030;
  background-image:
    linear-gradient(135deg, rgba(8,15,35,.55), rgba(46,24,74,.78)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23b48cff' stroke-opacity='.22' stroke-width='1.2'%3E%3Cpath d='M0 40h40l20 20h40M100 60v40l20 20h40M20 160v-40l20-20h30M160 20h-30l-20 20v30M60 0v20M70 100h30l10-10'/%3E%3C/g%3E%3Cg fill='%23fab41b' fill-opacity='.35'%3E%3Ccircle cx='100' cy='60' r='2.5'/%3E%3Ccircle cx='70' cy='100' r='2.5'/%3E%3Ccircle cx='130' cy='20' r='2.5'/%3E%3Ccircle cx='60' cy='20' r='2.5'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.25'%3E%3Ccircle cx='40' cy='40' r='2'/%3E%3Ccircle cx='120' cy='120' r='2'/%3E%3Ccircle cx='110' cy='90' r='2'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(circle at 20% 10%, #4b1f6e 0, transparent 55%),
    radial-gradient(circle at 85% 90%, #2a1550 0, transparent 50%),
    linear-gradient(160deg, #120b26, #2b1446);
  background-attachment: fixed;
}
.auth-glow { position: fixed; width: 520px; height: 520px; border-radius: 50%; filter: blur(70px); background: rgba(102,36,131,.38); pointer-events: none; z-index: 0; }
.auth-glow-1 { top: -180px; left: -160px; }
.auth-glow-2 { bottom: -220px; right: -160px; background: rgba(149,101,255,.26); }
.auth-wrap { position: relative; z-index: 1; width: 100%; display: flex; justify-content: center; }
.auth-card, .login-page .login-card {
  width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 0;
  padding: 36px 34px 30px; border-radius: 28px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.6); box-shadow: 0 30px 80px rgba(6,10,30,.45);
  color: #444;
}
.login-page .login-card { gap: 14px; }
.login-page .login-card.wide { max-width: 580px; }
.login-page .login-card label { color: #5b6478; }
.auth-logo { display: block; width: 190px; height: auto; margin: 0 auto 22px; }
.auth-eyebrow { font-size: 11.7px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--auth-brand); }
.auth-title { margin: 6px 0 8px; font-size: 34px; line-height: 1.12; font-weight: 700; color: var(--auth-ink); letter-spacing: -.01em; }
.auth-sub { margin: 0 0 22px; font-size: 14.5px; line-height: 1.5; color: #67748e; }
.auth-alert { margin: 0 0 16px; padding: 11px 14px; border-radius: 14px; background: #fdecee; border: 1px solid #f5c2c9; color: #a61b2b; font-size: 13.5px; font-weight: 500; }
.auth-label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 600; color: var(--auth-ink); }
.auth-input {
  display: flex; align-items: center; gap: 10px; height: 52px; margin-bottom: 16px; padding: 0 8px 0 16px;
  background: rgba(255,255,255,.78); border: 1px solid #dfe5f1; border-radius: 16px; transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus-within { border-color: #a77bd0; box-shadow: 0 0 0 4px rgba(102,36,131,.12); background: #fff; }
.auth-input > svg { flex: none; width: 19px; height: 19px; fill: none; stroke: #8a94ab; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-input:focus-within > svg { stroke: var(--auth-brand); }
.auth-input input { flex: 1; min-width: 0; height: 100%; border: 0 !important; outline: 0; background: transparent !important; box-shadow: none !important; padding: 0 !important; font: inherit; font-size: 15px; color: var(--auth-ink); }
.auth-input input::placeholder { color: #a3abbd; }
.auth-input input.otp-input { letter-spacing: .25em; font-weight: 600; text-align: left; font-size: 17px; }
.auth-eye { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.auth-eye svg { width: 19px; height: 19px; fill: none; stroke: #8a94ab; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-eye:hover { background: rgba(102,36,131,.07); }
.auth-eye.on svg { stroke: var(--auth-brand); }
/* interruttore "ricorda questo dispositivo" */
.auth-check { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 14px; padding: 12px 14px; border-radius: 16px; background: #f5f0f8; border: 1px solid #ece2f1; cursor: pointer; font-size: 13.6px; color: var(--auth-ink); line-height: 1.4; }
.auth-check small { color: #67748e; font-size: 12.3px; }
.auth-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.auth-switch { flex: none; position: relative; width: 40px; height: 23px; margin-top: 1px; border-radius: 999px; background: #cdd3e0; transition: background .15s; }
.auth-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.auth-check input:checked + .auth-switch { background: linear-gradient(135deg, var(--auth-brand), var(--auth-brand2)); }
.auth-check input:checked + .auth-switch::after { transform: translateX(17px); }
.auth-check input:focus-visible + .auth-switch { box-shadow: 0 0 0 4px rgba(102,36,131,.18); }
.auth-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; margin-top: 6px;
  border: 0; border-radius: 16px; cursor: pointer; font: inherit; font-size: 15.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--auth-brand), var(--auth-brand2)); box-shadow: 0 12px 30px rgba(102,36,131,.3);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.auth-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.auth-btn:hover { filter: brightness(1.06); box-shadow: 0 16px 36px rgba(102,36,131,.38); }
.auth-btn:hover svg { transform: translateX(3px); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn.busy { opacity: .75; pointer-events: none; }
.auth-help { margin-top: 18px; font-size: 13.6px; }
.auth-help summary { cursor: pointer; list-style: none; text-align: center; color: var(--auth-brand); font-weight: 700; }
.auth-help summary::-webkit-details-marker { display: none; }
.auth-help summary:hover { text-decoration: underline; }
.auth-help p { margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: #f5f0f8; color: #5b6478; line-height: 1.5; }
.auth-link { margin-top: 12px; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13.6px; font-weight: 700; color: var(--auth-brand); }
.auth-link:hover { text-decoration: underline; }
.auth-legal {
  position: absolute; left: 16px; right: 16px; bottom: 24px; margin: 0 auto; width: fit-content; z-index: 1;
  max-width: 680px; padding: 8px 16px; border-radius: 999px; text-align: center;
  background: rgba(6,12,28,.2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.22); color: rgba(255,255,255,.78); font-size: 10.9px; line-height: 1.4;
}
.auth-ver { opacity: .75; white-space: nowrap; }
@media (max-width: 520px) {
  .auth-card { padding: 28px 22px 24px; border-radius: 24px; }
  .auth-title { font-size: 28px; }
  .auth-legal { border-radius: 16px; }
}
/* la card è sempre chiara: tokens chiari anche con tema scuro */
.auth-card, .login-page .login-card {
  --bg: #edf5f7; --surface: #ffffff; --surface-2: #f7f4f8; --text: #33283a; --muted: #6f6577; --border: #e4dce7;
  --accent: #8c4493; --accent-2: #782a7e; --accent-soft: #f3e8f4; --accent-ink: #fff; --pill: #f0eaf2;
  --danger: #c0392b; --warn: #b8730a; --ok: #1d8a3b; color-scheme: light; color: var(--text);
}

/* profilo: dispositivi attendibili */
.dev-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dev-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.dev-list li > div { flex: 1; min-width: 0; }
.dev-list .small { display: block; }
