:root { --ink: #14202e; --muted: #5d6b7c; --line: #dde4ec; --bg: #f2f5f9; --panel: #fff; --brand: #0b8fd4; --ok: #0e7a3c; --ok-bg: #e4f5ec; --off: #8793a3; --off-bg: #eef1f5; --warn: #8a6000; --warn-bg: #fff4d6; --bad: #c4262f; --bad-bg: #fdecec; --radius: 14px; }
@media (prefers-color-scheme: dark) {
  :root { --ink: #e7edf5; --muted: #9aa8ba; --line: #2b3646; --bg: #0f1620; --panel: #172130; --ok: #55d68a; --ok-bg: #123524; --off: #8190a4; --off-bg: #1f2a3a; --warn: #f0c14b; --warn-bg: #3a2e0c; --bad: #ff7b82; --bad-bg: #3b1a1e; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
.pagina { max-width: 1280px; margin: 0 auto; padding: 24px 22px 60px; }
.testata { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.testata h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.testata small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.azioni { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--brand); }
.btn--primario { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.cambio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.cambio input { width: 70px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }

.riepilogo { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.num { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.num span { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.num strong { display: block; font-size: 26px; letter-spacing: -.02em; margin-top: 2px; }
.num small { color: var(--muted); font-size: 12.5px; }

.clienti { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.cliente { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; }
.cliente-testa { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cliente-testa h2 { margin: 0; font-size: 18px; }
.cliente-testa a { color: var(--muted); font-size: 13px; text-decoration: none; }
.cliente-testa a:hover { color: var(--brand); text-decoration: underline; }
.stato { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.stato::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.stato--online { color: var(--ok); background: var(--ok-bg); }
.stato--giu { color: var(--bad); background: var(--bad-bg); }
.stato--attesa { color: var(--warn); background: var(--warn-bg); }
.sezione-titolo { font-size: 11.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.chip--on { background: var(--ok-bg); color: var(--ok); }
.chip--off { background: var(--off-bg); color: var(--off); }
.chip--warn { background: var(--warn-bg); color: var(--warn); }
.dati { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.dato { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 3px 0; font-size: 14px; }
.dato span { color: var(--muted); }
.dato b { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.su { color: var(--ok); font-size: 12px; font-weight: 700; }
.giu { color: var(--bad); font-size: 12px; font-weight: 700; }
.nota { color: var(--muted); font-size: 12.5px; }
.canoni { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.canoni label { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); }
.canoni input { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.margine { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-weight: 700; }
.margine b { font-size: 18px; white-space: nowrap; }
.errore { padding: 10px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-weight: 600; margin-bottom: 14px; }

/* accesso */
.accesso { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.accesso form { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; display: grid; gap: 14px; }
.accesso h1 { margin: 0; font-size: 20px; }
.accesso label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.accesso input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 16px; }
.accesso input:focus, .cambio input:focus, .canoni input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

@media (max-width: 520px) {
  .pagina { padding: 16px 12px 40px; }
  .clienti { grid-template-columns: minmax(0, 1fr); }
  .dati, .canoni { grid-template-columns: minmax(0, 1fr); }
}

/* freccia che apre la dashboard del cliente */
.testa-destra { display: flex; align-items: center; gap: 8px; flex: none; }
.apri { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; font-size: 18px; line-height: 1; font-weight: 700; }
.apri:hover, .apri:focus-visible { background: var(--brand); border-color: var(--brand); color: #fff; outline: none; }

/* tendine delle schede */
.cliente { gap: 10px; }
.tendina { border-top: 1px solid var(--line); padding-top: 8px; }
.tendina > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; padding: 4px 0; border-radius: 8px; }
.tendina > summary::-webkit-details-marker { display: none; }
.tendina > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; align-self: center; }
.tendina:not([open]) > summary::after { transform: rotate(-90deg); }
.tendina > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tendina-titolo { font-size: 11.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tendina-riep { font-size: 13.5px; font-weight: 600; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tendina-corpo { display: grid; gap: 10px; padding: 8px 0 4px; }
