/* App del tecnico (telefono): tessere "Paper Widgets" e carosello "Warp Cards" degli appuntamenti.
   Tutto ciò che si muove usa solo transform e opacità, così sul telefono resta a 60 fotogrammi. */

.tech {
  --tw-tile: #f8f7f4;
  --tw-ink: var(--text);
  --tw-muted: rgb(var(--text-rgb) / 0.55);
  --tw-line: rgb(var(--text-rgb) / 0.08);
  --tw-wash: rgb(var(--text-rgb) / 0.05);
  --tw-shadow: 0 0 0 1px rgb(var(--text-rgb) / 0.05), inset 0 1px 0 rgb(255 255 255 / 0.9), 0 24px 40px -28px rgba(40, 34, 20, 0.35), 0 2px 4px rgba(40, 34, 20, 0.04);
  --wc-red: #ff4a3d;
}
:root[data-theme="dark"] .tech { --tw-tile: #17171a; --tw-shadow: 0 0 0 1px rgb(255 255 255 / 0.06), inset 0 1px 0 rgb(255 255 255 / 0.05), 0 24px 40px -28px rgb(0 0 0 / 0.8); }

/* ------------------------------------------------------------------ in alto: tre tessere carta */
.tw-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.tw-tile { position: relative; padding: 14px 14px 12px; border-radius: 22px; background: var(--tw-tile); box-shadow: var(--tw-shadow); animation: rise 0.6s var(--ease) both; }
.tw-tile:nth-child(2) { animation-delay: 60ms; }
.tw-tile:nth-child(3) { animation-delay: 120ms; }
.tw-label { display: flex; align-items: center; gap: 7px; font: 400 12.5px "Inter", var(--font-sans); color: var(--tw-muted); white-space: nowrap; }
.tw-label i { width: 6px; height: 6px; border-radius: 50%; flex: none; background: rgb(var(--c, var(--text-rgb))); }
.tw-tile b { display: block; margin-top: 10px; font-size: 40px; font-weight: 300; letter-spacing: -0.04em; line-height: 1; }

/* ------------------------------------------------------------------ il carosello Warp Cards */
.wc { --cw: min(70vw, 300px); margin: -26px -18px -34px; }
.wc-track {
  display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding: 56px calc(50% - var(--cw) / 2) 62px; scrollbar-width: none; -webkit-overflow-scrolling: touch; outline: none;
}
.wc-track::-webkit-scrollbar { display: none; }
.wc-card {
  position: relative; flex: 0 0 var(--cw); height: 438px; scroll-snap-align: center; scroll-snap-stop: always;
  border-radius: 30px; overflow: hidden; color: var(--wc-ink); background: var(--wc-bg); text-decoration: none;
  box-shadow: 0 30px 50px -30px rgb(20 18 14 / 0.45), 0 2px 6px rgb(20 18 14 / 0.06);
  will-change: transform; backface-visibility: hidden; -webkit-tap-highlight-color: transparent;
  animation: wc-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(min(var(--n, 0), 6) * 45ms);
}
.wc-card:hover { text-decoration: none; }
@keyframes wc-in { from { opacity: 0; translate: 0 34px; } }

/* colori come le schede delle impostazioni di una fotocamera: inchiostro per i da fare, sabbia per i non completati,
   carta per i completati, ardesia per quelli in attesa di invio */
.wc-card.s-todo { --wc-bg: var(--text); --wc-ink: var(--page); --wc-ink-rgb: var(--page-rgb, 241 241 239); }
.wc-card.s-notdone { --wc-bg: #dcd3c4; --wc-ink: #1b1a16; --wc-ink-rgb: 27 26 22; }
.wc-card.s-done { --wc-bg: #f4f2ed; --wc-ink: #18171c; --wc-ink-rgb: 24 23 28; }
.wc-card.is-pending { --wc-bg: #1d2830; --wc-ink: #e8eef1; --wc-ink-rgb: 232 238 241; }
:root[data-theme="dark"] .wc-card.s-todo { --wc-ink-rgb: 7 7 8; }
:root[data-theme="blue"] .wc-card.s-todo { --wc-ink-rgb: 241 241 239; }

.wc-face { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 22px 22px 20px; }
.wc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wc-label { display: flex; align-items: center; gap: 7px; font: 500 14px var(--font-sans); color: rgb(var(--wc-ink-rgb) / 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-label i { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--wc-red); }
.wc-chip { flex: none; padding: 5px 10px; border-radius: 99px; box-shadow: inset 0 0 0 1px rgb(var(--wc-ink-rgb) / 0.22); font: 500 10px var(--font-mono); letter-spacing: 1px; color: rgb(var(--wc-ink-rgb) / 0.78); }
.wc-big { margin-top: 26px; font-size: 78px; font-weight: 600; letter-spacing: -0.045em; line-height: 0.95; }
.wc-cap { margin-top: 10px; font: 500 12px var(--font-mono); letter-spacing: 0.04em; color: rgb(var(--wc-ink-rgb) / 0.42); }
.wc-client { margin-top: 22px; font-size: 21px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wc-addr { margin-top: 4px; font-size: 14px; color: rgb(var(--wc-ink-rgb) / 0.6); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* il righello della giornata (7–21): la fascia è l'orario dell'appuntamento, l'ago rosso l'inizio */
.wc-ruler { position: relative; height: 54px; margin-top: auto; }
.wc-ticks i { position: absolute; bottom: 18px; left: calc(var(--x) * 100%); width: 1.5px; height: 8px; margin-left: -0.75px; background: rgb(var(--wc-ink-rgb) / 0.25); }
.wc-ticks i.major { height: 15px; background: rgb(var(--wc-ink-rgb) / 0.55); }
.wc-band { position: absolute; bottom: 18px; height: 4px; left: calc(var(--a) * 100%); width: calc((var(--b) - var(--a)) * 100%); border-radius: 2px; background: rgb(var(--wc-ink-rgb) / 0.9); }
.wc-needle { position: absolute; bottom: 18px; left: calc(var(--x) * 100%); width: 2px; height: 30px; margin-left: -1px; background: var(--wc-red); border-radius: 1px; }
.wc-needle::before { content: ""; position: absolute; left: -3px; top: -7px; width: 8px; height: 8px; border-radius: 50%; background: var(--wc-red); }
.wc-hours span { position: absolute; bottom: 0; left: calc(var(--x) * 100%); transform: translateX(-50%); font: 500 10px var(--font-mono); color: rgb(var(--wc-ink-rgb) / 0.45); }

.wc-foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; box-shadow: inset 0 1px 0 rgb(var(--wc-ink-rgb) / 0.12); }
.wc-prod { flex: 1; min-width: 0; font-size: 13px; color: rgb(var(--wc-ink-rgb) / 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-parts { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 99px; background: rgb(var(--todo) / 0.9); color: #fff; font: 500 11px var(--font-mono); }
.wc-parts .ico { width: 12px; height: 12px; }
.wc-go { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgb(var(--wc-ink-rgb) / 0.12); color: var(--wc-ink); transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s; }
.wc-go .ico { width: 15px; height: 15px; }
.wc-card.on .wc-go { background: var(--wc-ink); color: var(--wc-bg); }
.wc-card.on:active .wc-go { transform: translateX(3px); }

/* la sfumatura verso il bordo esterno delle schede piegate (l'opacità la scrive lo scorrimento) */
.wc-fade { position: absolute; top: 0; bottom: 0; width: 70%; pointer-events: none; opacity: 0; will-change: opacity; }
.wc-fade-l { left: 0; background: linear-gradient(90deg, var(--page) 8%, rgb(var(--page-rgb, 241 241 239) / 0)); }
.wc-fade-r { right: 0; background: linear-gradient(270deg, var(--page) 8%, rgb(var(--page-rgb, 241 241 239) / 0)); }
.tech { --page-rgb: 241 241 239; }
:root[data-theme="dark"] .tech { --page-rgb: 7 7 8; }

.wc-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: -4px; }
.wc-dots { display: flex; gap: 6px; }
.wc-dots i { width: 6px; height: 6px; border-radius: 99px; background: rgb(var(--text-rgb) / 0.18); transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s; cursor: pointer; }
.wc-dots i.on { width: 20px; background: var(--text); }
.wc-count { font-size: 11px; color: var(--tw-muted); }

/* ------------------------------------------------------------------ l'elenco completo */
.tw-listhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 2px 6px; }
.tw-switch { position: static; font-size: 13px; }
.tw-switch-solo { margin-top: 18px; }
.tw-list { display: grid; }
.tw-day { padding: 18px 2px 6px; font: 400 10.5px var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--tw-muted); }
.tw-row { --c: var(--todo); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 4px; color: var(--text); border-top: 1px solid var(--tw-line); -webkit-tap-highlight-color: transparent; transition: background 0.2s; }
.tw-row:hover { text-decoration: none; }
.tw-row:active { background: var(--tw-wash); }
.tw-day + .tw-row { border-top: 0; }
.tw-row.s-done { --c: var(--done); }
.tw-row.s-notdone { --c: var(--notdone); }
.tw-time { font-size: 12px; color: var(--tw-muted); min-width: 92px; }
.tw-who { display: grid; gap: 2px; min-width: 0; }
.tw-who b { font-weight: 500; font-size: 15px; }
.tw-who span { font-size: 12.5px; color: var(--tw-muted); }
.tw-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tw-muted); white-space: nowrap; }
.tw-state i { width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--c)); }
.tw-empty { margin-top: 30px; padding: 40px 20px; border-radius: 26px; background: var(--tw-tile); box-shadow: var(--tw-shadow); text-align: center; color: var(--tw-muted); }

@media (min-width: 640px) { .wc { --cw: 300px; } }
@media (prefers-reduced-motion: reduce) { .wc-card, .tw-tile { animation: none; } }

/* ------------------------------------------------------------------ dettaglio: la scheda "Warp" in testa, il resto su carta */
.td-hero { display: block; height: auto; flex: none; width: 100%; margin-top: 8px; scroll-snap-align: none; will-change: auto; }
.td-hero .wc-face { position: relative; inset: auto; min-height: 420px; padding: 24px 22px 20px; }
.td-hero .wc-big { font-size: 84px; }
.td-addr { color: rgb(var(--wc-ink-rgb) / 0.7); text-decoration: underline; text-decoration-color: rgb(var(--wc-ink-rgb) / 0.25); text-underline-offset: 3px; }
.td-hero .wc-ruler { margin-top: 26px; }
.td-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.td-act { display: flex; align-items: center; justify-content: center; gap: 9px; height: 54px; border-radius: 18px; background: rgb(var(--wc-ink-rgb) / 0.12); color: var(--wc-ink); font-size: 15.5px; font-weight: 500; -webkit-tap-highlight-color: transparent; transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s; }
.td-act:hover { text-decoration: none; }
.td-act:active { transform: scale(0.97); background: rgb(var(--wc-ink-rgb) / 0.2); }
.td-act .ico { width: 18px; height: 18px; }

/* le sezioni su carta (stile Paper Widgets) */
.tech .panel { border-radius: 26px; background: var(--tw-tile); box-shadow: var(--tw-shadow); padding: 20px 20px 18px; }
.tech .panel + .panel, .tech .td-hero + .panel { margin-top: 14px; }
.tech .tech-main > * + * { margin-top: 14px; }
.td-info .tw-label { margin-bottom: 6px; }
.tech .kv { grid-template-columns: 104px minmax(0, 1fr); border-bottom-color: var(--tw-line); padding: 11px 0; }
.tech .panel > .label { display: flex; align-items: center; gap: 7px; font: 400 12.5px "Inter", var(--font-sans); letter-spacing: 0; text-transform: none; color: var(--tw-muted); }
.tech .panel > .label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--wc-red); }

/* il report: domande grandi, scelte come tessere, importi con i numeri sottili */
.report-form .q { font-size: 21px; font-weight: 400; letter-spacing: -0.03em; line-height: 1.25; margin-bottom: 16px; }
.report-form .choice { gap: 12px; }
.report-form .choice-btn { height: 92px; flex-direction: column; gap: 6px; border-radius: 22px; border: 0; background: var(--tw-wash); font-size: 16px; font-weight: 500; transition: background 0.3s, box-shadow 0.3s, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1); }
.report-form .choice-btn .ico { width: 26px; height: 26px; }
.report-form .choice-btn:active { transform: scale(0.97); }
.report-form .choice-btn.selected { background: rgb(var(--c)); color: #fff; box-shadow: 0 18px 30px -18px rgb(var(--c) / 0.9); }
.report-form .choice-btn.selected .ico { color: #fff; }
.report-form [data-when] { animation: rise 0.45s var(--ease) both; }
.report-form textarea { border-radius: 16px; background: var(--tw-wash); border-color: transparent; font-size: 15.5px; }
.report-form textarea:focus { background: var(--field); }
.report-form .amount-grid { gap: 8px; }
.report-form .euro-input input { height: 64px; border-radius: 16px; border-color: transparent; background: var(--tw-wash); font: 300 26px var(--font-sans); letter-spacing: -0.03em; padding-right: 30px; }
.report-form .euro-input input:focus { background: var(--field); }
.report-form .seg-choice button { height: 44px; padding: 0 18px; transition: background 0.25s, color 0.25s; }
.report-form .photo-add { border-radius: 18px; width: 84px; height: 84px; }
.tech .actions .btn { border-radius: 999px; }
.tech .actions .btn-primary { box-shadow: 0 18px 30px -18px rgb(var(--text-rgb) / 0.8); }
@media (max-width: 400px) { .report-form .amount-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .report-form .euro-input input { font-size: 21px; padding-right: 22px; } .report-form .euro-input > span { right: 8px; } }

/* intestazione: vetro smerigliato sopra il contenuto che scorre, così niente si legge sotto il titolo */
.tech-header { background: color-mix(in srgb, var(--page) 82%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); box-shadow: 0 1px 0 var(--tw-line); }

/* ------------------------------------------------------------------ il palco del carosello WebGL (warpdeck.js) */
.wd { margin: 8px -18px 0; }
.wd-stage { position: relative; height: clamp(440px, 64vh, 600px); touch-action: pan-y; }
.wd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; cursor: grab; -webkit-tap-highlight-color: transparent; animation: wd-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both; }
.wd-canvas:active { cursor: grabbing; }
@keyframes wd-in { from { opacity: 0; transform: translateY(18px) scale(0.985); } }
.wd .wc-pager { margin-top: 2px; }
@media (prefers-reduced-motion: reduce) { .wd-canvas { animation: none; } }

/* niente tagli netti: le parti piegate e allungate delle schede sfumano verso i bordi del palco */
.wd-canvas {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent 100%), linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent 100%), linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-composite: intersect;
}
.wd { margin-top: 6px; }
