/* ── Giro clienti (/giro-clienti) ───────────────────────────────── */

.gt-daynav { display: inline-flex; align-items: center; gap: 4px; }
.gt-daynav .input { width: 150px; }

/* striscia dei giorni della settimana */
.gt-week { display: flex; align-items: stretch; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.gt-week::-webkit-scrollbar { display: none; }
.gt-week > .btn { align-self: center; flex: none; }
.gt-week-day {
    flex: 1 1 0; min-width: 72px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 6px;
    color: var(--text-2); cursor: pointer; font: inherit; transition: background .15s, border-color .15s, transform .15s;
}
.gt-week-day:hover { background: var(--surface-hover); transform: translateY(-1px); }
.gt-week-day.weekend { opacity: .7; }
.gt-week-day.today .gt-week-num { color: var(--accent); }
.gt-week-day.on { border-color: var(--accent); background: var(--grad-soft); color: var(--text); box-shadow: var(--shadow-glow); opacity: 1; }
.gt-week-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gt-week-num { font: 700 20px 'Space Grotesk', Inter, sans-serif; line-height: 1.1; }
.gt-week-count { font-size: 11px; color: var(--muted); white-space: nowrap; }
.gt-week-day.has .gt-week-count { color: var(--accent-2); font-weight: 600; }

/* prossima tappa (oggi) */
.gt-next {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 16px;
    border-radius: 16px; background: var(--grad-soft); border: 1px solid var(--border-strong);
}
.gt-next-badge {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: var(--grad); color: #fff; font: 700 18px 'Space Grotesk', Inter, sans-serif;
}
.gt-next-name { font: 600 17px 'Space Grotesk', Inter, sans-serif; }
.gt-next-actions { gap: 8px; }

/* impaginazione: elenco a sinistra, mappa a destra */
.gt-layout { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.gt-main { min-width: 0; position: sticky; top: 76px; }

.gt-start { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; }
.gt-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.gt-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.gt-warn { color: var(--warning); margin-top: 6px; }
.gt-start-btns { gap: 6px; }
.gt-hq { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); min-width: 0; }
.gt-hq .input { flex: 1; min-width: 0; }

.gt-add { position: relative; margin-bottom: 12px; }
.gt-suggest {
    position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); padding: 4px;
    background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow);
}
.gt-suggest-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.gt-suggest-item:hover, .gt-suggest-item:focus-visible { background: var(--surface-hover); outline: 0; }
.gt-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); }
.gt-free { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; margin-top: 8px; }

/* tappe */
.gt-stops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: none; }
.gt-stop {
    display: flex; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
    transition: border-color .15s, background .15s; animation: gt-in .25s ease-out;
}
.gt-stop:hover { border-color: var(--border-strong); }
.gt-stop.done { opacity: .55; }
.gt-stop.done .gt-stop-name { text-decoration: line-through; }
.gt-stop.nopoint { border-style: dashed; }
@keyframes gt-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.gt-num {
    flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
    background: var(--grad); color: #fff; font: 700 13px 'Space Grotesk', Inter, sans-serif; box-shadow: 0 4px 12px -4px rgba(236, 72, 153, .6);
}
.gt-stop.done .gt-num { background: var(--success); box-shadow: none; }
.gt-stop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gt-stop-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gt-stop-name { font-weight: 600; color: var(--text); min-width: 0; flex: 1; }
a.gt-stop-name:hover { color: var(--accent); }
.gt-eta { font: 600 12px 'Space Grotesk', Inter, sans-serif; color: var(--text-2); background: var(--surface-2); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.gt-weather { font-size: 12px; white-space: nowrap; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.gt-weather.warn { background: rgba(245, 158, 11, .14); color: var(--warning); }
.gt-weather.bad { background: rgba(244, 63, 94, .14); color: var(--danger); }
.gt-stop-ctrl { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.gt-stop-ctrl label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.gt-stop-ctrl .select { width: auto; padding-right: 24px; }
.gt-stop-ctrl input[type=time] { width: 104px; }
.gt-stop-btns { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.gt-stop-ctrl .ic.gt-up { transform: rotate(90deg); }
.gt-done.on { background: var(--success); color: #fff; border-color: transparent; }

.gt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.gt-actions .btn-primary { flex: 1; justify-content: center; }

/* mappa */
.gt-map-card { padding: 0; overflow: hidden; position: relative; }
.gt-map { height: min(62vh, 560px); min-height: 320px; width: 100%; background: var(--bg-2); z-index: 0; }
.gt-map-foot { padding: 8px 14px; border-top: 1px solid var(--border); }
.gt-stale {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px; font-size: 12.5px; background: var(--surface-solid); color: var(--warning);
    border: 1px solid rgba(245, 158, 11, .4); box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
/* nel tema scuro niente filtri sulle tessere (rovinavano satellite e colori): c'è la vista «Scura», scelta da sola se non se ne è salvata un'altra */
.gt-map .leaflet-container { font: inherit; }
.gt-map .leaflet-popup-content-wrapper, .gt-map .leaflet-popup-tip { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }
.gt-map .leaflet-popup-content { margin: 10px 14px; font-size: 13px; line-height: 1.45; }
.gt-map .leaflet-control-attribution { background: rgba(0, 0, 0, .45); color: #ddd; }
.gt-map .leaflet-control-attribution a { color: #fff; }
[data-theme="light"] .gt-map .leaflet-control-attribution { background: rgba(255, 255, 255, .8); color: #333; }
[data-theme="light"] .gt-map .leaflet-control-attribution a { color: #0078a8; }
.gt-map .leaflet-bar a { background: var(--surface-solid); color: var(--text); border-color: var(--border); }
.gt-pop-a { color: var(--muted); font-size: 12px; margin-top: 2px; }
.gt-pop-w { margin-top: 4px; }
.gt-route { stroke: var(--accent-2); filter: drop-shadow(0 0 6px rgba(236, 72, 153, .55)); }

.gt-pin-wrap { background: none; border: 0; }
.gt-pin {
    width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); display: grid; place-items: center;
    background: var(--grad); border: 2px solid #fff; box-shadow: 0 6px 16px -4px rgba(0, 0, 0, .55); cursor: grab;
    color: #fff; font: 700 14px/1 'Space Grotesk', Inter, sans-serif;
}
/* il numero resta dritto dentro la goccia ruotata */
.gt-pin > span { transform: rotate(45deg); }
.gt-pin.start { background: #111827; }
.gt-pin.done { background: var(--success); }
.gt-pin.late { background: var(--danger); }
.gt-pin.stale { filter: saturate(.4); }

.gt-kpis { animation: gt-in .3s ease-out; }

/* consigli */
.gt-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.gt-tip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; line-height: 1.45; }
.gt-tip-ic { font-size: 18px; line-height: 1.2; flex: none; }
.gt-tip.late { border-color: rgba(244, 63, 94, .4); background: rgba(244, 63, 94, .08); }
.gt-tip.weather { border-color: rgba(6, 182, 212, .3); }
.gt-tip.traffic { border-color: rgba(245, 158, 11, .3); }

/* la giornata */
.gt-timeline { display: flex; flex-direction: column; }
.gt-tl-row, .gt-tl-leg { display: grid; grid-template-columns: 52px 30px minmax(0, 1fr); align-items: center; gap: 10px; }
.gt-tl-row { padding: 6px 0; }
.gt-tl-leg { min-height: 26px; }
.gt-tl-time { font: 600 13px 'Space Grotesk', Inter, sans-serif; color: var(--text-2); text-align: right; }
.gt-tl-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 15px; }
.gt-tl-dot.num { background: var(--grad); color: #fff; font: 700 13px 'Space Grotesk', Inter, sans-serif; }
.gt-tl-line { justify-self: center; width: 2px; height: 100%; min-height: 26px; background: repeating-linear-gradient(to bottom, var(--border-strong) 0 4px, transparent 4px 8px); }
.gt-tl-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }

.gt-hint { display: flex; gap: 14px; align-items: flex-start; }
.gt-hint-ic { font-size: 26px; }

/* invio all'iPhone */
.gt-send-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.gt-send-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.gt-send-box h4 { display: flex; align-items: center; gap: 6px; margin: 0; }
.gt-send-qr { align-items: center; text-align: center; }
.gt-qr { width: 176px; height: 176px; padding: 8px; border-radius: 12px; background: #fff; display: grid; place-items: center; }
.gt-qr svg { width: 100%; height: 100%; }

@media (max-width: 1100px) {
    .gt-layout { grid-template-columns: minmax(0, 1fr); }
    .gt-main { position: static; order: -1; }
    .gt-map { height: 46vh; }
}
@media (max-width: 760px) {
    .gt-send-grid { grid-template-columns: minmax(0, 1fr); }
    .gt-free { grid-template-columns: minmax(0, 1fr); }
    .gt-next-actions { width: 100%; }
    .gt-next-actions .btn { flex: 1; justify-content: center; }
    .gt-week-day { min-width: 58px; }
}

/* suggerimenti: nome, luogo che prende lo spazio libero, poi le etichette */
.gt-suggest-item > .ellipsis { min-width: 0; }
.gt-suggest-item > .tiny { flex: 1; }
.gt-suggest-item > .tag, .gt-suggest-item > .gt-dot { flex: none; }

/* ── Giro clienti nella scheda e nell'elenco clienti ── */
.cv-card .card-header { margin-bottom: 10px; }
.cv-next { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--grad-soft); border: 1px solid var(--border); }
.cv-date { display: flex; flex-direction: column; align-items: center; min-width: 46px; padding: 4px 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); line-height: 1.1; }
.cv-date span { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cv-date b { font-size: 20px; color: var(--accent); }
.cv-add { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.cv-add .input { width: 150px; flex: none; }
.cv-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cv-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; transition: background .15s, border-color .15s; }
.cv-chip:hover { background: var(--surface-hover); }
.cv-chip.on { border-color: var(--accent); color: var(--text); background: var(--grad-soft); }
.cv-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.cv-list { display: flex; flex-direction: column; }
.cv-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.cv-row:last-child { border-bottom: none; }
.cv-dot { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-hover); color: var(--muted); }
.cv-row.done .cv-dot { background: color-mix(in srgb, #10b981 18%, transparent); color: #10b981; }
.cv-row.planned .cv-dot { background: var(--grad-soft); color: var(--accent); }
.cv-row.missed .cv-dot { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #f59e0b; }
.cv-badge { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; color: var(--muted); }
td .cv-badge { margin-top: 0; }
.cv-badge.planned { color: var(--accent); font-weight: 600; }
@media (max-width: 640px) { .cv-add { flex-wrap: wrap; } .cv-add .input { width: 100%; } }

/* ── Viste della mappa e schermo intero ── */
.gt-map .leaflet-control-layers { background: var(--surface-solid); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.gt-map .leaflet-control-layers-expanded { padding: 8px 12px; font-size: 13px; }
.gt-map .leaflet-control-layers label { margin: 3px 0; cursor: pointer; }
.gt-full-btn { display: grid !important; place-items: center; width: 34px; height: 34px; font-size: 18px; line-height: 1; background: var(--surface-solid) !important; color: var(--text) !important; text-decoration: none; }
.gt-map-card.gt-map-full { position: fixed; inset: 0; z-index: 2000; border-radius: 0; margin: 0; display: flex; flex-direction: column; }
.gt-map-card.gt-map-full .gt-map { flex: 1; height: auto; min-height: 0; }
body.gt-map-full-open { overflow: hidden; }

/* ── Feedback dopo la visita ── */
.gt-feedback { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--grad-soft); border-radius: 16px; padding: 12px 14px; margin-bottom: 16px; }
.gt-feedback-head { display: flex; gap: 12px; align-items: flex-start; }
.gt-feedback-ico { font-size: 22px; line-height: 1; }
.gt-feedback-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gt-feedback-item { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, transform .15s; }
.gt-feedback-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.gt-feedback-cta { color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.gt-fb { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 6px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; min-width: 0; }
.gt-fb:hover { border-color: var(--accent); }
.gt-fb-todo { border-style: dashed; color: var(--accent); font-weight: 600; }
.vf-outcomes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.vf-outcome { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.vf-outcome:hover { transform: translateY(-1px); background: var(--surface-hover); }
.vf-emoji { font-size: 26px; line-height: 1; }
.vf-outcome.on { color: var(--text); font-weight: 600; }
.vf-outcome.on.o2 { border-color: #10b981; background: color-mix(in srgb, #10b981 14%, transparent); }
.vf-outcome.on.o1 { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 14%, transparent); }
.vf-outcome.on.o0 { border-color: #f43f5e; background: color-mix(in srgb, #f43f5e 14%, transparent); }
.vf-next { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.vf-next .field:last-child { width: 160px; }
.cv-fb { display: flex; gap: 6px; margin-top: 3px; font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.cv-fb-btn { white-space: nowrap; }
.ci-visits { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ci-visit { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.ci-visit.o2 { border-color: color-mix(in srgb, #10b981 45%, var(--border)); }
.ci-visit.o1 { border-color: color-mix(in srgb, #f59e0b 45%, var(--border)); }
.ci-visit.o0 { border-color: color-mix(in srgb, #f43f5e 45%, var(--border)); }
.ci-visit.planned { background: var(--grad-soft); }
