/* CRM Digititaly – tema grafico sopra Bootstrap 5 */

:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ok: #059669;
  --ok-50: #ecfdf5;
  --bad: #dc2626;
  --bad-50: #fef2f2;
  --warn: #b45309;
  --warn-50: #fffbeb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --sidebar-w: 248px;
  --series-1: #2a78d6;  /* grafici: agenzie immobiliari */
  --series-2: #eb6834;  /* grafici: altri clienti */

  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--ink-2);
  --bs-body-bg: var(--bg);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: var(--brand-600);
  --bs-border-color: var(--line);
}

body { font-size: .9rem; background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5 { color: var(--ink); letter-spacing: -.01em; }
a { text-decoration: none; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.text-muted { color: var(--muted) !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; font-size: 1rem;
}
.sidebar .brand small { display: block; font-weight: 500; font-size: .72rem; color: #94a3b8; letter-spacing: .02em; }
.sidebar .section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 12px 6px; line-height: 1.45; }
.sidebar .nav-item-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: #cbd5e1; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s;
}
.sidebar .nav-item-link i { font-size: 1.05rem; opacity: .85; }
.sidebar .nav-item-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar .nav-item-link.active { background: rgba(99, 102, 241, .18); color: #fff; }
.sidebar .nav-item-link.active i { color: #a5b4fc; opacity: 1; }
.sidebar .foot { margin-top: auto; font-size: .75rem; color: #64748b; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar .foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 6px; box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }

.main { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(246, 247, 251, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 14px 32px; display: flex; align-items: center; gap: 16px;
}
.topbar .crumbs { font-size: .8rem; color: var(--muted); }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs a:hover { color: var(--brand); }
.content { padding: 28px 32px 56px; max-width: 1600px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

.mobile-bar { display: none; }
@media (max-width: 991.98px) {
  .sidebar { display: none; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; background: #0f172a; color: #fff; padding: 12px 16px; }
  .mobile-bar a { color: #cbd5e1; margin-left: 14px; font-weight: 500; }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 40px; }
}

/* ---------- Cards e KPI ---------- */
.card-x { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-x .card-x-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-x .card-x-head h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.card-x .card-x-body { padding: 18px 20px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.kpi-tile .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.kpi-tile .lbl { font-size: .75rem; color: var(--muted); font-weight: 500; }
.kpi-tile .val { font-size: 1.35rem; font-weight: 700; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-tile .delta { font-size: .75rem; font-weight: 600; }
.ico-indigo { background: var(--brand-50); color: var(--brand); }
.ico-green { background: var(--ok-50); color: var(--ok); }
.ico-amber { background: var(--warn-50); color: var(--warn); }
.ico-sky { background: #f0f9ff; color: #0284c7; }
.ico-rose { background: #fff1f2; color: #e11d48; }
.up { color: var(--ok); }
.down { color: var(--bad); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; }
.form-control, .form-select { border-radius: 10px; border-color: var(--line); font-size: .88rem; padding-top: .5rem; padding-bottom: .5rem; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); }

.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: .82rem; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }

/* ---------- Tabelle ---------- */
.table-x { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.table-x th {
  position: sticky; top: 0; z-index: 1; background: #f8fafc; font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table-x td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table-x tbody tr { transition: background .1s; }
.table-x tbody tr:hover { background: #fafaff; }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x.compact td { padding: 8px 12px; }
.table-wrap { overflow: auto; max-height: calc(100vh - 230px); border-radius: 0 0 var(--radius) var(--radius); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th[data-sort]::after { content: "\F127"; font-family: "bootstrap-icons"; margin-left: 4px; opacity: .35; font-size: .7rem; }
th.asc::after { content: "\F148"; opacity: 1; color: var(--brand); }
th.desc::after { content: "\F128"; opacity: 1; color: var(--brand); }
tr.clickable { cursor: pointer; }

/* ---------- Elementi ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: .78rem; color: #fff; letter-spacing: .02em;
}
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.3rem; }
.who { display: flex; align-items: center; gap: 12px; min-width: 210px; max-width: 300px; }
.who .name { color: var(--ink); font-weight: 600; line-height: 1.25; }
.who .name:hover { color: var(--brand); }
.who .meta { font-size: .76rem; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.nodot::before { display: none; }
.pill-ok { background: var(--ok-50); color: var(--ok); }
.pill-bad { background: var(--bad-50); color: var(--bad); }
.pill-warn { background: var(--warn-50); color: var(--warn); }
.pill-muted { background: var(--line-2); color: var(--muted); }
.pill-brand { background: var(--brand-50); color: var(--brand); }

.code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .72rem; background: var(--line-2); color: var(--ink-2); padding: 2px 6px; border-radius: 6px; margin-right: 6px; }
.chip { display: inline-block; padding: 3px 9px; border-radius: 8px; font-size: .75rem; margin: 0 4px 4px 0; background: var(--line-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chip b { font-weight: 700; }
.chip.top { background: var(--brand); color: #fff; }
.chip.second { background: var(--brand-100); color: var(--brand-600); }

.price-bad { color: var(--bad); font-weight: 600; }
.price-good { color: var(--ok); font-weight: 600; }
.cell-empty { color: #cbd5e1; }
.money { font-weight: 600; color: var(--ink); }

/* barre fatturato per anno */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 120px; padding-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars .bar .fill { width: 100%; max-width: 56px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #818cf8, var(--brand)); min-height: 3px; }
.bars .bar .v { font-size: .75rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.bars .bar .y { font-size: .72rem; color: var(--muted); }

/* Tabs */
.tabs-x { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; overflow-x: auto; }
.tabs-x .nav-link { border: 0; background: none; color: var(--muted); font-weight: 600; font-size: .86rem; padding: 14px 12px; border-bottom: 2px solid transparent; border-radius: 0; white-space: nowrap; }
.tabs-x .nav-link:hover { color: var(--ink); }
.tabs-x .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs-x .count { background: var(--line-2); color: var(--muted); border-radius: 999px; padding: 1px 8px; font-size: .72rem; margin-left: 6px; }
.tabs-x .nav-link.active .count { background: var(--brand-50); color: var(--brand); }

/* Scheda cliente */
.profile { display: flex; gap: 18px; align-items: center; }
.profile h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 4px; }
.info-list { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; font-size: .86rem; margin: 0; }
.info-list dt { color: var(--muted); font-weight: 500; }
.info-list dd { margin: 0; color: var(--ink); word-break: break-word; }
.btn-soft { background: var(--brand-50); color: var(--brand); border: 0; border-radius: 10px; font-weight: 600; font-size: .82rem; padding: 7px 12px; }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-600); }

/* Documenti */
.doc { border-bottom: 1px solid var(--line-2); }
.doc:last-child { border-bottom: 0; }
.doc > summary { list-style: none; cursor: pointer; padding: 13px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.doc > summary::-webkit-details-marker { display: none; }
.doc > summary:hover { background: #fafaff; }
.doc .chev { transition: transform .15s; color: var(--muted); }
.doc[open] .chev { transform: rotate(90deg); }
.doc[open] > summary { background: #fafaff; }
.doc .lines { padding: 4px 20px 16px 52px; }
.doc-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }

/* Famiglie servizi */
.fam { margin-bottom: 18px; }
.fam .card-x-head .stats { margin-left: auto; display: flex; gap: 18px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.fam .card-x-head .stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.fam-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.range { display: flex; align-items: center; gap: 8px; font-size: .8rem; white-space: nowrap; }
.range .track { position: relative; width: 70px; height: 6px; border-radius: 3px; background: var(--line-2); }
.range .track .mid { position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand); transform: translateX(-50%); }

.note { background: var(--brand-50); color: #3730a3; border-radius: 12px; padding: 12px 16px; font-size: .84rem; display: flex; gap: 10px; }
.note i { margin-top: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); align-items: center; }

.nowrap { white-space: nowrap; }
.city { white-space: nowrap; max-width: 115px; overflow: hidden; text-overflow: ellipsis; }

/* Tipo cliente nella riga */
.tipo-select {
  appearance: none; -webkit-appearance: none; border: 1px dashed var(--line); border-radius: 999px; cursor: pointer;
  font-size: .74rem; font-weight: 600; padding: 3px 24px 3px 10px; color: var(--muted); max-width: 160px;
  background: var(--surface) no-repeat right 8px center / 9px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M1.6 5.2 8 11.6l6.4-6.4-1.1-1.1L8 9.4 2.7 4.1z'/%3E%3C/svg%3E");
}
.tipo-select:hover { border-color: #a5b4fc; }
.tipo-select:focus { outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.tipo-select.tipo-agenzia { color: var(--brand); background-color: var(--brand-50); border-color: var(--brand-100); }
.tipo-select.tipo-rivenditore { color: var(--warn); background-color: var(--warn-50); border-color: #fde68a; }
.tipo-select.tipo-altro { color: var(--ink-2); background-color: var(--line-2); }
.tipo-select.manuale { border-style: solid; }

/* Utente nella sidebar */
.sidebar .foot { margin-top: auto; }
.user-box { display: flex; align-items: center; gap: 8px; padding: 12px 10px 2px; border-top: 1px solid rgba(255, 255, 255, .06); margin-top: 8px; color: #94a3b8; }
.user-box .logout { background: none; border: 0; color: #94a3b8; font-size: 1.1rem; padding: 6px; border-radius: 8px; }
.user-box .logout:hover { color: #fff; background: rgba(255, 255, 255, .08); }

/* Bottoni e avvisi */
.btn-primary-x { background: var(--brand); color: #fff; border: 0; border-radius: 10px; font-weight: 600; font-size: .88rem; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary-x:hover { background: var(--brand-600); color: #fff; }
.alert-x { background: var(--bad-50); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-size: .86rem; font-weight: 500; }
.alert-x.ok { background: var(--ok-50); color: var(--ok); }
.form-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.modal-x { border: 0; border-radius: var(--radius); }
.modal-x .modal-header, .modal-x .modal-footer { border-color: var(--line-2); }

/* Login */
.auth-page { display: flex; min-height: 100vh; }
.auth-side { width: 42%; background: radial-gradient(circle at 20% 20%, #312e81 0, #0f172a 60%); color: #cbd5e1; padding: 36px 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.auth-side .brand .logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #a855f7); }
.auth-side .brand small { display: block; font-weight: 500; font-size: .72rem; color: #94a3b8; }
.auth-claim h2 { color: #fff; font-size: 2rem; font-weight: 700; line-height: 1.2; }
.auth-claim p { color: #94a3b8; font-size: 1rem; max-width: 380px; }
.auth-main { flex: 1; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 36px; }
.auth-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
@media (max-width: 767.98px) { .auth-side { display: none; } }

/* ---------- Commerciale ---------- */
.nav-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.btn-seg { display: inline-block; padding: 6px 12px; border-radius: 8px; font-size: .82rem; font-weight: 500; color: var(--muted); }
.btn-seg:hover { color: var(--ink); }
.btn-seg.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.btn-sm-x { padding: 6px 10px; font-size: .8rem; }
.btn-icon { background: none; border: 0; color: var(--muted); padding: 6px 8px; border-radius: 8px; }
.btn-icon:hover { background: var(--line-2); color: var(--bad); }
.count-badge { background: var(--line-2); color: var(--muted); border-radius: 999px; padding: 1px 8px; font-size: .72rem; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty > i { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .5; }
.group-head { padding: 14px 20px 6px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fbfbfe; border-bottom: 1px solid var(--line-2); }
.group-head .count { background: var(--line-2); border-radius: 999px; padding: 0 7px; margin-left: 4px; }

.att { display: flex; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.att:last-child { border-bottom: 0; }
.att:hover { background: #fcfcff; }
.att-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.att-body { flex: 1; min-width: 0; }
.att-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.att-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: .78rem; color: var(--muted); margin-top: 3px; align-items: center; }
.att-text { font-size: .84rem; color: var(--ink-2); margin-top: 6px; white-space: pre-line; }
.att-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.att-done .att-title .text-dark { color: var(--ink-2) !important; }
.att-late { background: #fffafa; }

.esiti { display: flex; flex-wrap: wrap; gap: 6px; }
.esito-opt { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .8rem; font-weight: 500; cursor: pointer; user-select: none; }
.esito-opt input { display: none; }
.esito-opt:has(input:checked) { color: #fff; border-color: transparent; }
.esito-ok:has(input:checked) { background: var(--ok); }
.esito-warn:has(input:checked) { background: #d97706; }
.esito-bad:has(input:checked) { background: var(--bad); }
.esito-muted:has(input:checked) { background: var(--muted); }
.richiamo { background: #f8fafc; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; }

.kanban { display: grid; grid-template-columns: repeat(6, minmax(250px, 1fr)); gap: 12px; padding: 16px; overflow-x: auto; }
.kcol { background: #f8fafc; border-radius: 12px; display: flex; flex-direction: column; min-height: 300px; border: 2px solid transparent; }
.kcol.over { border-color: #a5b4fc; background: var(--brand-50); }
.kcol-head { display: flex; align-items: center; gap: 8px; white-space: nowrap; padding: 12px 12px 8px; font-weight: 600; font-size: .84rem; color: var(--ink); }
.kcol-head .count { background: #fff; border-radius: 999px; padding: 0 8px; font-size: .72rem; color: var(--muted); }
.kdot { width: 9px; height: 9px; border-radius: 50%; }
.kcol-body { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kcard { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: inherit; cursor: grab; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.kcard:hover { border-color: #a5b4fc; }
.kcard.dragging { opacity: .5; }

.stepper { display: flex; border-top: 1px solid var(--line-2); overflow-x: auto; }
.step-form { flex: 1; }
.step { width: 100%; border: 0; background: none; padding: 12px 8px; font-size: .8rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.step:hover { color: var(--c); background: #fafaff; }
.step.current { color: var(--c); border-bottom-color: var(--c); background: #fafaff; }

.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
#calendario { --fc-border-color: var(--line); --fc-today-bg-color: #f5f3ff; --fc-now-indicator-color: #ef4444; font-size: .85rem; }
#calendario .fc-button { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: .8rem; text-transform: none; box-shadow: none; }
#calendario .fc-button:hover { background: var(--line-2); color: var(--ink); }
#calendario .fc-button-active, #calendario .fc-button:active { background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important; }
#calendario .fc-toolbar-title { font-size: 1.15rem; font-weight: 700; color: var(--ink); text-transform: capitalize; }
#calendario .fc-col-header-cell-cushion { color: var(--muted); font-weight: 600; text-transform: capitalize; }
#calendario .fc-event { border-radius: 6px; padding: 1px 3px; cursor: pointer; }
#calendario .fc-ev { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .76rem; }
#calendario .fc-daygrid-event .fc-ev { color: #fff; }
/* nome cliente sempre leggibile: prima riga in grassetto, va a capo invece di troncarsi */
#calendario .fc-timegrid-slot { height: 2.4em; }
#calendario .fc-ev-2 { white-space: normal; line-height: 1.2; }
#calendario .fc-ev-riga1 { font-weight: 700; font-size: .8rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#calendario .fc-ev-riga2 { opacity: .85; font-size: .72rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#calendario .fc-ev-nome { font-weight: 700; }
#calendario .fc-ev-ora { font-weight: 600; }
#calendario .fc-list-event .fc-ev-riga2 { opacity: .7; }
#calendario a { color: inherit; }
.kcard .d-flex > span { white-space: nowrap; }

.bars .bar .fill.storico { background: linear-gradient(180deg, #cbd5e1, #94a3b8); }
.bars .bar .v { font-size: .7rem; }

/* Statistiche */
.quota { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.quota-bar { height: 6px; border-radius: 3px; background: var(--series-1); min-width: 2px; flex-shrink: 0; }
.quota span { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.table-x tfoot td { background: #f8fafc; border-top: 1px solid var(--line); font-weight: 600; position: sticky; bottom: 0; }
.table-stat th, .table-stat td { padding: 8px 7px; font-size: .82rem; }
.table-stat th { font-size: .68rem; }
.table-stat .quota { min-width: 96px; }

.prodotto-cella { min-width: 170px; max-width: 205px; }
.varianti summary { font-size: .72rem; color: var(--brand); cursor: pointer; list-style: none; }
.varianti summary::-webkit-details-marker { display: none; }
.varianti ul { margin: 6px 0 0; padding-left: 16px; font-size: .74rem; color: var(--muted); max-width: 340px; }

/* Categoria prodotto nella riga */
.cat-box { position: relative; display: flex; align-items: center; gap: 6px; }
.cat-input { width: 118px; padding-left: 10px !important; border: 1px dashed var(--line); border-radius: 999px; padding: 4px 12px; font-size: .78rem; font-weight: 600;
             color: var(--muted); background: var(--surface); }
.cat-input::placeholder { color: #94a3b8; font-weight: 500; }
.cat-input:focus { outline: none; border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); color: var(--ink); }
.cat-input.assegnata { border-style: solid; border-color: var(--brand-100); background: var(--brand-50); color: var(--brand); }
.cat-ok { color: var(--ok); opacity: 0; transition: opacity .2s; }
.cat-ok.visibile { opacity: 1; }
.d-none-cat { display: none; }
.sotto-input { width: 104px; font-weight: 500; }
.riga-macro { cursor: pointer; }
.riga-macro .toggle-sotto { font-size: .7rem; color: var(--muted); margin-right: 4px; display: inline-block; transition: transform .15s; }
.riga-macro.chiusa .toggle-sotto { transform: rotate(-90deg); }
.riga-sotto td { background: #fafbfd; color: var(--muted); }
.riga-sotto td:first-child { padding-left: 26px; }
.quota-bar-sotto { opacity: .5; }
.table-prod th, .table-prod td { padding: 8px 5px; }
.table-prod td.num { font-size: .78rem; }
.table-prod .prodotto-cella { width: 190px; }

/* Scheda cliente: contatti e attività al centro */
.contatti-lista { flex: 1; }
.pager { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line-2); font-size: .8rem; color: var(--muted); }
.pager .btn-icon:disabled { opacity: .35; pointer-events: none; }
.bars-compatte { gap: 4px; }
.bars-compatte .bar .v { font-size: .66rem; }
.bars-compatte .bar .y { font-size: .68rem; }

/* Statistiche > Categorie: per ogni anno fatturato, clienti e prezzo medio */
#t-categoria .th-anno { text-align: center; border-bottom: 1px solid var(--line); }
#t-categoria .th-sub th { font-size: .62rem; }
#t-categoria .col-inizio-anno, #t-categoria .th-anno { border-left: 1px solid var(--line); }
#t-categoria td { white-space: nowrap; }
