/* ============================================================
   CRM Farmacia della Corte - grafica rinnovata (ottobre 2026)
   Foglio COMUNE alle pagine rinnovate: si attiva solo dentro .pg-mod,
   quindi le pagine non ancora rinnovate restano identiche.
   Funziona sopra Bootstrap 3 / DataTables 1.10 / fastselect gia' presenti.
   ============================================================ */

.pg-mod {
  --m-bg: #f5f6fb;
  --m-card: #ffffff;
  --m-border: #e3e6f0;
  --m-text: #1f2333;
  --m-muted: #6b7088;
  --m-primary: #5b5bd6;
  --m-primary-dark: #4545b8;
  --m-primary-soft: #eef0ff;
  --m-danger: #c0392b;
  --m-ok: #1f9d6b;
  --m-radius: 10px;
  --m-shadow: 0 1px 2px rgba(20, 24, 60, .06), 0 2px 8px rgba(20, 24, 60, .04);
  color: var(--m-text);
  font-size: 14px;
  padding: 8px 0 32px;
}

/* ----------- Intestazione ----------- */
.pg-mod .m-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.pg-mod .m-head h1 { font-size: 24px; font-weight: 600; margin: 0; }
.pg-mod .m-head h1 .fa { color: var(--m-primary); margin-right: 6px; }
.pg-mod .m-sub { color: var(--m-muted); margin: 4px 0 0; }
.pg-mod .m-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------- Card ----------- */
.pg-mod .m-card { background: var(--m-card); border: 1px solid var(--m-border); border-radius: var(--m-radius); box-shadow: var(--m-shadow); padding: 16px; margin-bottom: 16px; }

/* ----------- Filtri ----------- */
.pg-mod .m-grid { display: grid; grid-template-columns: minmax(320px, 1.4fr) repeat(3, minmax(180px, 1fr)); gap: 12px 16px; }
.pg-mod .m-grid-adv { grid-template-columns: repeat(4, minmax(180px, 1fr)); margin-top: 14px; }
.pg-mod .m-section-title { grid-column: 1 / -1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--m-primary-dark); margin: 6px 0 -4px; }
.pg-mod .m-field label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--m-muted); margin-bottom: 5px; }
.pg-mod .m-hint { text-transform: none; font-weight: 400; letter-spacing: 0; }
.pg-mod .form-control { height: 38px; border-radius: 8px; border-color: var(--m-border); box-shadow: none; }
.pg-mod .form-control:focus { border-color: var(--m-primary); box-shadow: 0 0 0 3px var(--m-primary-soft); }
.pg-mod .form-control[readonly] { background: #fff; cursor: pointer; }

.pg-mod .m-range { display: flex; align-items: center; gap: 6px; }
.pg-mod .m-range .form-control { flex: 1; min-width: 0; }
.pg-mod .m-range-sep { color: var(--m-muted); }
.pg-mod .m-date { cursor: pointer; padding-right: 8px; }
.pg-mod .m-date::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; }
.pg-mod .m-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
/* !important: le scorciatoie sono pulsanti e il tema comune (tema-crm.css) ha regole forti sui pulsanti;
   cosi' la scorciatoia scelta e' sempre colorata (17/10/2026) */
.pg-mod .m-chip { border: 1px solid var(--m-border) !important; background: #fff !important; color: var(--m-muted) !important; border-radius: 14px !important;
  padding: 3px 11px !important; min-height: 0 !important; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; }
.pg-mod .m-chip:hover { border-color: var(--m-primary) !important; color: var(--m-primary-dark) !important; }
.pg-mod .m-chip.active { background: var(--m-primary) !important; border-color: var(--m-primary) !important; color: #fff !important; box-shadow: 0 1px 4px rgba(91, 91, 214, .35); }

.pg-mod .m-filters-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--m-border); flex-wrap: wrap; }
.pg-mod .m-link { color: var(--m-primary-dark); font-weight: 600; cursor: pointer; text-decoration: none; }
.pg-mod .m-link:hover { text-decoration: none; color: var(--m-primary); }
.pg-mod .m-caret { transition: transform .2s; margin-left: 2px; }
.pg-mod .m-link[aria-expanded="true"] .m-caret { transform: rotate(180deg); }
.pg-mod .m-badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: var(--m-primary); color: #fff; font-size: 11px; text-align: center; margin-left: 4px; }
.pg-mod .m-filters-actions { display: flex; gap: 8px; }

/* fastselect */
.pg-mod .fstElement { width: 100%; font-size: 14px; border-radius: 8px; border-color: var(--m-border); }
.pg-mod .fstControls { min-height: 36px; padding: 4px 8px; }
.pg-mod .fstChoiceItem { background: var(--m-primary); border-color: var(--m-primary-dark); border-radius: 6px; }

/* ----------- Bottoni ----------- */
.pg-mod .m-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--m-border); background: #fff; color: var(--m-text); font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.pg-mod .m-btn:hover { background: var(--m-bg); }
.pg-mod .m-btn-primary { background: var(--m-primary); border-color: var(--m-primary); color: #fff; }
.pg-mod .m-btn-primary:hover { background: var(--m-primary-dark); border-color: var(--m-primary-dark); }

/* ----------- Numeri chiave ----------- */
.pg-mod .m-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.pg-mod .m-kpi { background: var(--m-card); border: 1px solid var(--m-border); border-radius: var(--m-radius); box-shadow: var(--m-shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.pg-mod .m-kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--m-muted); font-weight: 600; }
.pg-mod .m-kpi-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pg-mod .m-kpi-note { font-size: 12px; color: var(--m-muted); min-height: 16px; }
.pg-mod .m-kpi-accent { background: var(--m-primary-soft); border-color: #cfd3fb; }
.pg-mod .m-kpi-accent .m-kpi-value { color: var(--m-primary-dark); }
.pg-mod .m-kpis.m-loading .m-kpi-value { opacity: .35; }

/* ----------- Tabella ----------- */
.pg-mod .m-table-card { padding: 0; overflow: hidden; position: relative; }
.pg-mod table.m-table { margin: 0 !important; border: 0; font-variant-numeric: tabular-nums; width: 100% !important; }
.pg-mod table.m-table thead th { background: #fafbfd; color: var(--m-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--m-border) !important; border-top: 0 !important; padding: 9px 8px; white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.pg-mod table.m-table tbody td { padding: 8px; border-top: 1px solid #f0f1f6; vertical-align: middle; white-space: nowrap; }
.pg-mod table.m-table tbody tr:hover td { background: var(--m-primary-soft); }
.pg-mod table.m-table .m-num { text-align: right; }
.pg-mod table.m-table thead th.m-num { text-align: right; padding-right: 22px; }
.pg-mod table.m-table .m-center { text-align: center; }
.pg-mod table.m-table .m-strong { font-weight: 600; }
.pg-mod table.m-table td.m-muted { color: var(--m-muted); font-size: 13px; }
.pg-mod table.m-table td a { color: var(--m-primary-dark); }
.pg-mod table.m-table .m-name { font-weight: 600; color: var(--m-text); }
.pg-mod table.m-table td.m-actions a { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; color: var(--m-muted); }
.pg-mod table.m-table td.m-actions a:hover { background: var(--m-primary-soft); color: var(--m-primary-dark); }
.pg-mod .m-tag { display: inline-block; min-width: 22px; height: 22px; line-height: 22px; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 700; text-align: center; cursor: help; }
.pg-mod .m-tag-f { background: #e6f5ee; color: #17805a; }   /* cliente farmacia */
.pg-mod .m-tag-c { background: #fdf0f6; color: #b0306e; }   /* cliente centro benessere */
.pg-mod .m-tag + .m-tag { margin-left: 3px; }

/* stati marketing (17/10/2026): colore = stato, F/CB = canale */
.pg-mod .m-st-nuovo   { background: #e8f0fe; color: #1a56c4; }
.pg-mod .m-st-attivo  { background: #e6f5ee; color: #17805a; }
.pg-mod .m-st-rischio { background: #fff1e0; color: #b25a00; }
.pg-mod .m-st-perso   { background: #eef0f3; color: #6b7280; text-decoration: line-through; }
.pg-mod .m-st-mai     { background: #f4f4f6; color: #9aa0ad; font-weight: 600; }
.pg-mod .m-st-vip     { background: #fff6d6; color: #a37b00; }

/* barra dei segmenti pronti */
.pg-mod .m-segbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; }
.pg-mod .m-segbar-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--m-muted); margin-right: 4px; }
.pg-mod .m-seg { border: 1px solid var(--m-border) !important; background: #fff !important; color: var(--m-text) !important; border-radius: 16px !important;
  padding: 4px 12px !important; min-height: 0 !important; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .15s; }
.pg-mod .m-seg:hover { border-color: var(--m-primary) !important; color: var(--m-primary-dark) !important; }
.pg-mod .m-seg.active { background: var(--m-primary) !important; border-color: var(--m-primary) !important; color: #fff !important; }
.pg-mod .m-seg-hot { border-color: #f1d27a !important; background: #fffaeb !important; color: #8a6400 !important; }
.pg-mod .m-seg-warn { border-color: #f5c99a !important; background: #fff6ec !important; color: #9a4f00 !important; }
.pg-mod .m-seg-warn.active { background: #d9822b !important; border-color: #d9822b !important; color: #fff !important; }
.pg-mod .m-seg-hot.active { background: #d4a017 !important; border-color: #d4a017 !important; color: #fff !important; }

/* piede tabella */
.pg-mod .dataTables_wrapper .m-dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--m-border); flex-wrap: wrap; }
.pg-mod .dataTables_wrapper .dataTables_info { padding: 0; color: var(--m-muted); }
.pg-mod .dataTables_wrapper .dataTables_paginate { margin: 0; }
.pg-mod .dataTables_wrapper .pagination { margin: 0; }
.pg-mod .pagination > li > a { border-radius: 6px !important; margin: 0 2px; border-color: var(--m-border); color: var(--m-text); }
.pg-mod .pagination > .active > a { background: var(--m-primary); border-color: var(--m-primary); }
.pg-mod .dataTables_length select { border-radius: 6px; border-color: var(--m-border); }

/* caricamento: barra sottile animata al posto del box "Processing..." */
.pg-mod .dataTables_processing { position: absolute; top: 0 !important; left: 0 !important; right: 0; width: 100% !important; height: 3px !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: linear-gradient(90deg, transparent, var(--m-primary), transparent) !important; background-size: 50% 100% !important; animation: m-bar 1s linear infinite; font-size: 0; box-shadow: none !important; }
@keyframes m-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.pg-mod .m-table-card.m-busy tbody { opacity: .45; transition: opacity .15s; }

/* riga di dettaglio della modalita' responsive (colonne nascoste su schermi stretti) */
.pg-mod table.dataTable > tbody > tr.child ul.dtr-details { width: 100%; }
.pg-mod table.dataTable > tbody > tr.child span.dtr-title { color: var(--m-muted); font-weight: 600; min-width: 120px; }

/* ----------- Elenchi semplici (18/10/2026: Prodotti, Vendite, Campagne, Trattamenti, Inestetismi) ----------- */
.pg-mod .m-grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; }
.pg-mod .m-grid-auto .m-field-wide { grid-column: span 2; }
.pg-mod .m-hidden { display: none; }
/* periodo.js aggiunge le scorciatoie (Oggi, Mese...) sotto le date delle pagine con datetimepicker */
.pg-mod .m-field .tm-chips, .pg-mod .m-field .tm-presets { margin-top: 6px; }
.pg-mod .m-quota { font-size: 11px; font-weight: 500; color: var(--m-muted); line-height: 1.2; }
.pg-mod .m-card-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--m-primary-dark); margin: 0 0 12px; }
.pg-mod .m-radio-row input[type=radio] { margin: 0; }
.pg-mod .alert { border-radius: 8px; }
.pg-mod #aggregati:empty::before { content: 'I totali compaiono dopo la ricerca'; color: var(--m-muted); font-size: 13px; }
/* elenchi con le opzioni standard di DataTables (dom 'rtip'): info e pagine sotto la tabella */
.pg-mod .m-table-card .dataTables_info { padding: 12px 14px !important; color: var(--m-muted); }
.pg-mod .m-table-card .dataTables_paginate { padding: 8px 12px 12px; }
.pg-mod .m-btn-ok { background: var(--m-ok) !important; border-color: var(--m-ok) !important; color: #fff !important; }
.pg-mod .m-note { background: var(--m-primary-soft); border: 1px solid #d9dcfb; border-radius: 10px; padding: 10px 14px; color: #3b3b98; font-size: 13px; line-height: 1.5; }
.pg-mod .m-counter { font-size: 12px; color: var(--m-muted); margin-top: 4px; }
.pg-mod .m-counter.m-warn { color: #b25a00; font-weight: 600; }
.pg-mod .m-preview { background: #f2f4f8; border-radius: 14px 14px 14px 4px; padding: 12px 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; max-width: 420px; }
.pg-mod .m-radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-mod .m-radio-row label { display: inline-flex !important; align-items: center; gap: 6px; border: 1px solid var(--m-border); border-radius: 18px; padding: 6px 12px; margin: 0 !important;
  font-size: 13px !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--m-text) !important; cursor: pointer; }
.pg-mod .m-radio-row input:checked + span { color: var(--m-primary-dark); font-weight: 700; }

/* ----------- Tabelle piu' leggibili (18/10/2026) -----------
   carattere Inter con cifre allineate, righe piu' ariose, zebra leggera, intestazioni discrete */
.pg-mod table.m-table { font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 14.5px; color: #1b1f2e;
  font-feature-settings: 'tnum' 1, 'cv11' 1; -webkit-font-smoothing: antialiased; }
.pg-mod table.m-table thead th { font-size: 11px; letter-spacing: .06em; color: #7a8099; background: #f7f8fc; padding: 11px 10px; }
.pg-mod table.m-table tbody td { padding: 12px 10px; border-top: 1px solid #eef0f5; line-height: 1.35; }
.pg-mod table.m-table tbody tr:nth-child(even) > td { background: #fbfbfe; }
.pg-mod table.m-table tbody tr:hover > td { background: #f0f2ff; }
.pg-mod table.m-table .m-name { font-weight: 600; color: #141829; letter-spacing: -.005em; }
.pg-mod table.m-table td a { text-decoration: none; }
.pg-mod table.m-table td a:hover .m-name, .pg-mod table.m-table td a:hover { color: var(--m-primary); }
.pg-mod table.m-table td.m-strong { font-weight: 700; color: #141829; }
.pg-mod table.m-table .m-tag { height: 22px; line-height: 22px; border-radius: 11px; padding: 0 8px; font-size: 11px; }
.pg-mod .m-quota { margin-top: 2px; }
/* riga di dettaglio (+): etichette e valori allineati */
.pg-mod table.dataTable > tbody > tr.child ul.dtr-details > li { padding: 6px 0; border-bottom: 1px dashed #eceef4; font-size: 13.5px; }
.pg-mod table.dataTable > tbody > tr.child span.dtr-title { min-width: 150px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

/* visite 12m / 6m / 1m: tre pastiglie con colori diversi, zero spento */
.pg-mod .m-visite { display: inline-flex; gap: 4px; justify-content: flex-end; }
.pg-mod .m-vis { display: inline-block; min-width: 26px; padding: 2px 6px; border-radius: 6px; font-size: 12.5px; font-weight: 700; text-align: center; }
.pg-mod .m-vis-12 { background: #e8eafe; color: #3f3fb0; }
.pg-mod .m-vis-6  { background: #e2f3fb; color: #0b6e99; }
.pg-mod .m-vis-3  { background: #fff1dc; color: #a55a00; }
.pg-mod .m-vis-1  { background: #e3f6ec; color: #17805a; }
.pg-mod .m-vis-zero { background: #f2f3f6 !important; color: #b0b4c2 !important; font-weight: 600; }
/* ritmo delle visite (18/10/2026): 4 barre = visite al mese su 12m / 6m / 3m / 1m */
/* ogni colonnina: barra arrotondata in alto, numero sotto; fondo tenue del colore dello stato */
.pg-mod .m-ritmo { display: inline-flex; align-items: flex-end; gap: 2px; padding: 4px 5px 3px; border-radius: 8px; vertical-align: middle; cursor: help;
  background: #f5f6fb; background: color-mix(in srgb, currentColor 8%, #fff); }
.pg-mod .m-rc { display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 20px; height: 38px; }
.pg-mod .m-rc i { display: block; width: 10px; border-radius: 3px; background: currentColor; }
.pg-mod .m-rc b { margin-top: 3px; font-size: 11px; line-height: 1; font-weight: 700; color: #1b1f2e; font-variant-numeric: tabular-nums; }
.pg-mod .m-rc.m-r-zero i { background: #d7dae3; }
.pg-mod .m-rc.m-r-zero b { color: #b0b4c2; font-weight: 600; }
.pg-mod .m-r-ok      { color: #5b5bd6; }
.pg-mod .m-r-su      { color: #1f9d6b; }
.pg-mod .m-r-calo    { color: #d9822b; }
.pg-mod .m-r-assente { color: #d4a017; }
.pg-mod .m-r-fermo   { color: #c0392b; }
.pg-mod .m-r-poco    { color: #b0b4c2; }
.pg-mod .m-ritmo-n { display: inline-block; min-width: 24px; margin-left: 6px; text-align: right; font-size: 12.5px; font-weight: 700; color: #6b7088; vertical-align: middle; font-variant-numeric: tabular-nums; }
/* legenda nell'intestazione allineata alle colonnine */
.pg-mod .m-ritmo-leg { display: flex; justify-content: flex-end; gap: 2px; margin-top: 2px; padding-right: 19px; text-transform: none; letter-spacing: 0; }
.pg-mod .m-ritmo-leg i { width: 20px; text-align: center; font-style: normal; font-size: 9.5px; font-weight: 700; color: #9aa0ad; }
.pg-mod .m-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* avviso di coerenza della frequenza (spazio fisso: le pastiglie restano allineate in colonna) */
.pg-mod .m-freq-slot { display: inline-block; width: 24px; margin-left: 4px; text-align: center; vertical-align: middle; }
.pg-mod .m-freq { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 13px; font-weight: 700; cursor: help; }
.pg-mod .m-freq-fermo   { background: #fde8e6; color: #c0392b; }
.pg-mod .m-freq-calo    { background: #fff1dc; color: #b25a00; }
.pg-mod .m-freq-assente { background: #fff8d6; color: #a37b00; font-size: 9px; }
.pg-mod .m-freq-su      { background: #e3f6ec; color: #17805a; }
.pg-mod .m-vis-leg { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.pg-mod .m-vis-leg i { font-style: normal; font-size: 9.5px; font-weight: 700; padding: 1px 4px; border-radius: 4px; letter-spacing: 0; }

/* ----------- Pazienti: dati divisi farmacia / centro benessere (24/10/2026, json/pazienti2.php) ----------- */
.pg-mod .pz-ult { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.pg-mod .pz-ult-r { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; line-height: 1.25; }
.pg-mod table.m-table .pz-ult-r .m-tag, .pg-mod table.m-table .pz-rit-r .m-tag, .pg-mod .pz-ult-r .m-tag, .pg-mod .pz-rit-r .m-tag { min-width: 26px; height: 18px; line-height: 18px; font-size: 10px; padding: 0 4px; border-radius: 9px; cursor: default; }
.pg-mod .pz-ult-r .pz-et { font-size: 11px; color: var(--m-muted); min-width: 34px; }
.pg-mod .pz-ult-r b { font-weight: 600; color: #1b1f2e; }
.pg-mod .pz-ult-r small { color: var(--m-muted); font-size: 11.5px; }
.pg-mod .pz-ult-r.pz-recente b { color: #17805a; }
.pg-mod .pz-ult-r.pz-vecchio b { color: #9aa0ad; font-weight: 500; }
.pg-mod .pz-rit { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.pg-mod .pz-rit-r { display: inline-flex; align-items: center; gap: 4px; cursor: help; }
.pg-mod .pz-rit .m-ritmo { padding: 2px 4px; }
.pg-mod .pz-rit .m-rc { height: 27px; width: 18px; }
.pg-mod .pz-rit .m-rc b { font-size: 10.5px; margin-top: 2px; }
.pg-mod .pz-split { display: flex; gap: 8px; justify-content: flex-end; margin-top: 3px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pg-mod .pz-sf { color: #17805a; } .pg-mod .pz-sc { color: #b0306e; }
/* 24/10/2026 leggibilita': citta' sotto il nome, telefono con icona, ricette, date future (prenotato) */
.pg-mod .pz-citta { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--m-muted); white-space: nowrap; }
.pg-mod .pz-citta .fa { color: #b0b4c2; margin-right: 2px; }
.pg-mod table.m-table td a .pz-citta { color: var(--m-muted); }
.pg-mod a.pz-tel { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-variant-numeric: tabular-nums; color: #1b1f2e; }
.pg-mod a.pz-tel .fa { width: 22px; height: 22px; border-radius: 50%; background: #eef0ff; color: var(--m-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.pg-mod a.pz-tel:hover .fa { background: var(--m-primary); color: #fff; }
.pg-mod .pz-ric { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; background: #e8f0fe; color: #1a56c4; font-weight: 700; font-size: 12.5px; }
.pg-mod .pz-ult-r.pz-futuro b { color: #1a56c4; }
.pg-mod .pz-ult-r.pz-futuro small { color: #1a56c4; font-weight: 600; }
.pg-mod .pz-mob { display: none; }
/* 24/10/2026 appuntamento al centro (dal planning) */
.pg-mod .pz-ult-r.pz-app { background: #e8f0fe; border-radius: 6px; padding: 2px 6px 2px 0; margin-left: -1px; }
.pg-mod .pz-ult-r.pz-app b, .pg-mod .pz-ult-r.pz-app small, .pg-mod .pz-ult-r.pz-app .pz-et { color: #1a56c4; }
.pg-mod .pz-ult-r.pz-app small { font-weight: 700; }
.pg-mod .m-seg.m-seg-app { border-color: #b9cdf5 !important; background: #eef4ff !important; color: #1a56c4 !important; }
.pg-mod .m-seg.m-seg-app.active { background: #1a56c4 !important; border-color: #1a56c4 !important; color: #fff !important; }
/* importi: totale ben visibile, divisione F / CB a pastiglie */
.pg-mod #example td.m-strong { font-size: 15px; }
.pg-mod .pz-split span { padding: 1px 6px; border-radius: 8px; }
.pg-mod .pz-split .pz-sf { background: #e9f7f0; }
.pg-mod .pz-split .pz-sc { background: #fdf0f6; }
/* nel dettaglio (+) su cellulare: allineati a sinistra, sotto l'etichetta */
.pg-mod tr.child .pz-rit { align-items: flex-start; }
.pg-mod tr.child .pz-split { justify-content: flex-start; }
@media (max-width: 700px) {
  .pg-mod .pz-ult { min-width: 0; }
  .pg-mod .pz-ult-r { font-size: 12.5px; }
  .pg-mod .pz-ult-r small { display: none; }               /* su telefono basta la data */
  /* riepilogo sotto il nome: ultima visita F / CB e spesa 12 mesi, senza aprire il + */
  .pg-mod .pz-mob { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 5px; font-size: 11.5px; white-space: nowrap; }
  .pg-mod .pz-mob span { padding: 1px 6px; border-radius: 8px; font-weight: 700; }
  .pg-mod .pz-mob .pz-mob-f { background: #e9f7f0; color: #17805a; }
  .pg-mod .pz-mob .pz-mob-c { background: #fdf0f6; color: #b0306e; }
  .pg-mod .pz-mob .pz-mob-app { background: #e8f0fe; color: #1a56c4; }
  .pg-mod .pz-mob b { color: #141829; font-size: 12.5px; }
  /* il pulsante + non copre la matita */
  .pg-mod #example.dtr-inline.collapsed > tbody > tr > td:first-child { padding-left: 34px !important; }
  .pg-mod #example.dtr-inline.collapsed > tbody > tr > td:first-child:before { left: 6px; }
  .pg-mod .pz-citta { font-size: 11.5px; }
  .pg-mod #example td { padding: 10px 6px !important; }
  .pg-mod #example td.m-strong { font-size: 14px; }
  /* dettaglio (+): etichetta sopra, valore sotto, su due colonne */
  .pg-mod table.dataTable > tbody > tr.child ul.dtr-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
  .pg-mod table.dataTable > tbody > tr.child ul.dtr-details > li { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; white-space: normal; text-align: left !important; }
  .pg-mod table.dataTable > tbody > tr.child .m-ritmo-leg { justify-content: flex-start; padding-left: 34px; padding-right: 0; }
  .pg-mod table.dataTable > tbody > tr.child span.dtr-title { min-width: 0; }
  .pg-mod table.dataTable > tbody > tr.child ul.dtr-details > li:has(.pz-rit),
  .pg-mod table.dataTable > tbody > tr.child ul.dtr-details > li:has(.pz-ult),
  .pg-mod table.dataTable > tbody > tr.child ul.dtr-details > li:has(.pz-split) { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .pg-mod table.dataTable > tbody > tr.child ul.dtr-details { grid-template-columns: 1fr; }
}

/* ----------- Strumenti strategici e cruscotto (18/10/2026) ----------- */
.pg-mod .m-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.pg-mod .m-grid-2col > .m-card { margin-bottom: 16px; min-width: 0; }
.pg-mod a.m-chip { display: inline-block; text-decoration: none; }
.pg-mod .m-btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.pg-mod .m-btn[disabled] { opacity: .5; cursor: not-allowed; }
.pg-mod .m-export-bar { display: flex; justify-content: flex-end; padding: 8px 10px 0; }
/* Da fare oggi */
.pg-mod .m-todo { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pg-mod .m-todo-item { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--m-border); border-left: 4px solid var(--m-primary);
  border-radius: 10px; background: #fff; color: var(--m-text); text-decoration: none; transition: box-shadow .15s, transform .15s; }
.pg-mod .m-todo-item:hover { box-shadow: 0 4px 14px rgba(20, 24, 60, .08); transform: translateY(-1px); text-decoration: none; color: var(--m-text); }
.pg-mod .m-todo-n { font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pg-mod .m-todo-t { font-weight: 700; font-size: 14px; }
.pg-mod .m-todo-d { font-size: 12.5px; color: var(--m-muted); line-height: 1.35; }
.pg-mod .m-todo-zero { opacity: .55; }
/* grafico a barre semplice (scheda prodotto) */
.pg-mod .m-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.pg-mod .m-bars > div { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 6px; }
.pg-mod .m-bars > div > span { display: block; width: 100%; background: var(--m-primary); border-radius: 3px 3px 0 0; }
.pg-mod .m-bars-mesi { display: flex; gap: 3px; font-size: 10.5px; color: var(--m-muted); margin-top: 4px; }
.pg-mod .m-bars-mesi span { flex: 1; min-width: 6px; white-space: nowrap; }
/* elenco etichetta / valore (schede) */
.pg-mod .m-dets { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.pg-mod .m-det { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef0f5; font-size: 13.5px; }
.pg-mod .m-det span { color: var(--m-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.pg-mod .m-det b { font-weight: 600; text-align: right; word-break: break-word; }
/* coorti e stagionalita' */
.pg-mod table.m-coorti td, .pg-mod table.m-stag td { padding: 7px 6px !important; }
.pg-mod table.m-coorti tbody tr:nth-child(even) > td, .pg-mod table.m-stag tbody tr:nth-child(even) > td { background-clip: padding-box; }
.pg-mod table.m-stag th.m-oggi, .pg-mod table.m-stag td.m-oggi { outline: 2px solid var(--m-primary); outline-offset: -2px; }

/* ----------- Fonte dei dati sotto il menu (19/10/2026, inclusioni/top.php) ----------- */
.tm-fonte { display: block; margin: 10px 0 -2px; padding: 6px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; border: 1px solid; }
.tm-fonte .fa { margin-right: 3px; }
.tm-fonte-carta { background: #eef0ff; border-color: #d9dcfb; color: #3b3b98; }
.tm-fonte-tutte { background: #e9f7f0; border-color: #b7e2cd; color: #0f6b4a; }
.tm-fonte-misto { background: #fff8e6; border-color: #f1d9a0; color: #7a5600; }
.tm-fonte-det { color: inherit; opacity: .85; }
@media (max-width: 700px) { .tm-fonte-det { display: none; } .tm-fonte { cursor: help; } }

/* ----------- Ricerca cliente nella barra del menu (18/10/2026) ----------- */
.tm-nav .tm-cerca { position: relative; margin: 9px 6px 0 0; }
.tm-nav .tm-cerca .fa { position: absolute; left: 11px; top: 10px; color: #9aa0ad; font-size: 13px; pointer-events: none; }
.tm-nav .tm-cerca input { width: 190px; height: 34px; border: 1px solid #e3e6f0; border-radius: 17px; padding: 0 12px 0 32px; font-size: 13.5px; background: #f7f8fc;
  outline: none; transition: width .2s, border-color .2s, background .2s; }
.tm-nav .tm-cerca input:focus { width: 260px; border-color: #5b5bd6; background: #fff; box-shadow: 0 0 0 3px #eef0ff; }
.ui-autocomplete { z-index: 2000 !important; max-height: 340px; overflow-y: auto; }
@media (max-width: 1280px) { .tm-nav .tm-user-nome { display: none; } .tm-nav .tm-cerca input { width: 150px; } }
@media (max-width: 767px) { .tm-nav .tm-cerca { margin: 8px 12px; } .tm-nav .tm-cerca input, .tm-nav .tm-cerca input:focus { width: 100%; } .tm-nav .tm-user-nome { display: inline; } }

/* ----------- Tablet al banco (18/10/2026): schermi touch, bersagli grandi ----------- */
@media (pointer: coarse) {
  .pg-mod .m-btn, .pg-mod .form-control { min-height: 44px; }
  .pg-mod .m-chip, .pg-mod .m-seg { padding: 8px 14px !important; font-size: 13.5px; }
  .pg-mod table.m-table tbody td { padding: 14px 10px; }
  .pg-mod table.m-table td a { display: inline-block; padding: 4px 0; }
  .pg-mod td.m-actions a { width: 40px !important; height: 40px !important; }
  .tm-nav .dropdown-menu > li > a { padding: 12px 20px; }
}
@media (max-width: 1100px) {
  .pg-mod .m-grid-2col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pg-mod .m-dets { grid-template-columns: 1fr; }
}

/* ----------- Tablet e telefono ----------- */
@media (max-width: 1100px) {
  .pg-mod .m-grid, .pg-mod .m-grid-adv { grid-template-columns: repeat(2, 1fr); }
  .pg-mod .m-field-wide { grid-column: 1 / -1; }
  .pg-mod .m-kpis { grid-template-columns: repeat(2, 1fr); }
}
/* ----------- Stati leggibili: in scadenza (verde) / in ritardo (arancio) (19/10/2026) ----------- */
.pg-mod .m-pill { display: inline-flex; align-items: center; gap: 5px; min-width: 30px; justify-content: center; padding: 4px 10px; border-radius: 14px;
  font-size: 12.5px; font-weight: 700; line-height: 1.2; white-space: nowrap; color: #fff; }
.pg-mod .m-pill-ok   { background: #17805a; }
.pg-mod .m-pill-warn { background: #c25e00; }
.pg-mod .m-pill-zero { background: #eef0f3; color: #6b7280; }
.pg-mod .m-pill-sub  { margin-top: 4px; font-size: 12px; color: #4b5068; white-space: nowrap; }
.pg-mod .m-kpi-ok   { background: #e9f7f0; border-color: #b7e2cd; }
.pg-mod .m-kpi-ok .m-kpi-value, .pg-mod .m-kpi-ok .m-kpi-label { color: #17805a; }
.pg-mod .m-kpi-warn { background: #fff4e8; border-color: #f3c99b; }
.pg-mod .m-kpi-warn .m-kpi-value, .pg-mod .m-kpi-warn .m-kpi-label { color: #b25a00; }
.pg-mod .m-kpi-ok .m-kpi-note, .pg-mod .m-kpi-warn .m-kpi-note { color: #4b5068; }
.pg-mod .m-chip.m-chip-warn { color: #b25a00 !important; border-color: #f3c99b !important; }
.pg-mod .m-chip.m-chip-warn.active { background: #c25e00 !important; border-color: #c25e00 !important; color: #fff !important; }
.pg-mod .m-chip.m-chip-ok { color: #17805a !important; border-color: #b7e2cd !important; }
.pg-mod .m-chip.m-chip-ok.active { background: #17805a !important; border-color: #17805a !important; color: #fff !important; }

/* stagionalita': cella con anni molto diversi (indice meno affidabile) */
.pg-mod table.m-stag td.m-varia { outline: 2px dashed rgba(31, 35, 51, .45); outline-offset: -4px; }
.pg-mod .m-varia-leg { display: inline-block; padding: 0 6px; outline: 2px dashed rgba(31, 35, 51, .45); outline-offset: -2px; border-radius: 3px; }
.pg-mod table.m-giorni td { cursor: help; }
/* casella di spunta come link (es. "Confronta con l'anno prima" nel calendario) */
.pg-mod .m-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--m-border); border-radius: 8px;
  background: #fff; color: var(--m-text); font-weight: 600; font-size: 13px; text-decoration: none; }
.pg-mod .m-toggle .fa { font-size: 16px; color: #9aa0ad; }
.pg-mod .m-toggle:hover { border-color: var(--m-primary); text-decoration: none; color: var(--m-primary-dark); }
.pg-mod .m-toggle.on { background: var(--m-primary-soft); border-color: var(--m-primary); color: var(--m-primary-dark); }
.pg-mod .m-toggle.on .fa { color: var(--m-primary); }
@media (pointer: coarse) { .pg-mod .m-toggle { padding: 10px 14px; } }

/* 19/10/2026: nessuna tabella viene piu' tagliata: se non ci sta, scorre di lato dentro la sua scheda */
.pg-mod .m-table-card { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.pg-mod .m-grid-2col > .m-card { overflow-x: auto; }
.pg-mod table.m-table th.m-act-col, .pg-mod table.m-table td.m-act-col { width: 40px; padding-left: 0 !important; padding-right: 8px !important; text-align: right; }
.pg-mod table.m-table td.m-act-col .m-ico-btn { margin-right: 0; }

/* esclusioni (Riacquisti) */
.pg-mod .m-inline-form { display: inline; margin: 0; }
.pg-mod .m-ico-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-right: 6px; padding: 0;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: #b0b4c2; cursor: pointer; vertical-align: middle; }
.pg-mod .m-ico-btn:hover { background: #fde8e6; border-color: #f5c2bc; color: #c0392b; }
.pg-mod details.m-escl > summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--m-primary-dark); list-style: none; }
.pg-mod details.m-escl > summary::-webkit-details-marker { display: none; }
.pg-mod details.m-escl > summary::after { content: '\25BE'; margin-left: 6px; color: var(--m-muted); }
.pg-mod details.m-escl[open] > summary::after { content: '\25B4'; }
.pg-mod details.m-escl .m-muted { font-weight: 400; }
.pg-mod .m-escl-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.pg-mod .m-escl-form .form-control { flex: 1; min-width: 160px; }
@media (pointer: coarse) { .pg-mod .m-ico-btn { width: 38px; height: 38px; } }

/* ----------- Cellulari e tablet: tutte le pagine (19/10/2026) -----------
   - tabelle semplici (non DataTables): sotto 700px ogni riga diventa una scheda con "etichetta: valore"
     (etichette dalle intestazioni, messe da js/crm-comune.js nella classe m-stack)
   - tabelle larghe (DataTables, stagionalita', coorti) e tabelle delle pagine vecchie: scorrono di lato
     dentro la loro scheda, la pagina non si allarga */
html, body { max-width: 100%; overflow-x: clip; }   /* clip e non hidden: non rompe il menu fisso in alto */
img { max-width: 100%; height: auto; }
@media (max-width: 900px) {
  .pg-mod .m-table-card, .tm-card, .jumbotron { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .pg-mod table.m-stag th:first-child, .pg-mod table.m-stag td:first-child,
  .pg-mod table.m-coorti th:first-child, .pg-mod table.m-coorti td:first-child { position: sticky; left: 0; z-index: 3; background: #fff; box-shadow: 1px 0 0 #eef0f5; }
  .pg-mod table.m-stag td:first-child { min-width: 140px !important; }
  .tm-card table, .jumbotron table { min-width: 100%; }
  .container, .container-fluid { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 700px) {
  .pg-mod table.m-stack, .pg-mod table.m-stack tbody, .pg-mod table.m-stack tr, .pg-mod table.m-stack td { display: block; width: 100% !important; }
  .pg-mod table.m-stack thead { display: none; }
  .pg-mod table.m-stack tbody tr { padding: 10px 14px; border-top: 1px solid #eef0f5; }
  .pg-mod table.m-stack tbody tr:nth-child(even) > td, .pg-mod table.m-stack tbody tr:hover > td { background: transparent; }
  .pg-mod table.m-stack tbody tr:nth-child(even) { background: #fbfbfe; }
  .pg-mod table.m-stack tbody td { border: 0 !important; padding: 4px 0 !important; text-align: right !important; white-space: normal !important; overflow: hidden; }
  .pg-mod table.m-stack tbody td[data-label]::before { content: attr(data-label); float: left; margin-right: 12px; padding-top: 2px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #7a8099; text-align: left; }
  .pg-mod table.m-stack tbody td[data-label=""]::before { display: none; }
  /* prima colonna (nome del cliente, del prodotto...) come titolo della scheda */
  .pg-mod table.m-stack tbody td:first-child { text-align: left !important; font-size: 15px; padding-bottom: 6px !important; }
  .pg-mod table.m-stack tbody td:first-child::before { display: none; }
  .pg-mod table.m-stack .m-pill-sub { white-space: normal; }
  /* pulsante escludi in fondo alla scheda, a destra */
  .pg-mod table.m-stack tbody td.m-act-col { width: 100% !important; padding-top: 6px !important; }
  .pg-mod table.m-stack tbody td.m-act-col .m-ico-btn { width: auto; padding: 0 10px; height: 32px; border-color: #e3e6f0; }
  .pg-mod table.m-stack tbody td.m-act-col .m-ico-btn::after { content: ' Escludi'; margin-left: 4px; font-size: 12.5px; font-weight: 600; }
  .pg-mod .m-head-actions form { width: 100%; }
  .pg-mod .m-head-actions form .m-btn { width: 100%; justify-content: center; }
  .pg-mod .m-card { padding: 12px; }
  .pg-mod .m-table-card { padding: 0; }
  .pg-mod .m-filters-bar { align-items: stretch; }
  .pg-mod .m-presets > span[style] { display: none; }
  .pg-mod .m-escl-form .form-control { max-width: none !important; flex-basis: 100%; }
  .pg-mod .m-escl-form .m-btn { width: 100%; justify-content: center; }
}

@media (max-width: 640px) {
  .pg-mod .m-grid, .pg-mod .m-grid-adv { grid-template-columns: 1fr; }
  .pg-mod .m-grid-auto .m-field-wide { grid-column: auto; }
  .pg-mod .m-kpi-value { font-size: 20px; }
  .pg-mod .m-filters-actions, .pg-mod .m-head-actions { width: 100%; }
  .pg-mod .m-filters-actions .m-btn, .pg-mod .m-head-actions .m-btn { flex: 1; justify-content: center; }
  .pg-mod .m-head h1 { font-size: 20px; }
  .pg-mod .m-kpis { gap: 8px; }
  .pg-mod .m-kpi { padding: 10px 12px; }
  .pg-mod .m-kpi-note { font-size: 11.5px; }
  .pg-mod .m-todo { grid-template-columns: 1fr; }
  .pg-mod .m-grid-2col { gap: 0; }
}
@media (max-width: 380px) {
  .pg-mod .m-kpis { grid-template-columns: 1fr; }
}
