/* StipX — design 2: hero nero, titoli a lettere larghe, pillole di vetro, card bianche, molle e animazioni.
   Punto di partenza: design Figma "iPhone 16 Pro" (hero nero con sveglia 3D, pillola con freccia, card bianca). */

@font-face {
  font-family: 'Montserrat';
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/montserrat-latin-800-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/montserrat-latin-900-normal.woff2') format('woff2');
}

/* ───────────── design tokens ───────────── */
:root {
  color-scheme: light;
  --bg: #f1f1f4;
  --card: #ffffff;
  --sheet: #f1f1f4;
  --label: #0b0b0d;
  --label-2: rgba(11, 11, 13, 0.58);
  --label-3: rgba(11, 11, 13, 0.3);
  --sep: rgba(11, 11, 13, 0.09);
  --fill: rgba(11, 11, 13, 0.065);
  --fill-2: rgba(11, 11, 13, 0.035);
  --glass: rgba(241, 241, 244, 0.8);
  --glass-strong: rgba(250, 250, 252, 0.88);
  --seg-thumb: #ffffff;
  --btn-bg: #000000;
  --btn-fg: #ffffff;

  --blue: #1e66ff;
  --blue-2: #5b97ff;
  --green: #22b45a;
  --orange: #ff9500;
  --red: #ff3b30;
  --indigo: #5856d6;
  --purple: #af52de;
  --teal: #30b0c7;
  --gray: #8e8e93;
  --green-text: #158a41;
  --tint: var(--blue);

  --shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(10, 10, 20, 0.06);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.05), 0 18px 44px rgba(10, 10, 20, 0.14);
  --blur: saturate(180%) blur(24px);
  --spring: cubic-bezier(0.34, 1.5, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
  --display: 'Montserrat', 'SF Pro Display', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r-xl: 40px;
  --r-lg: 32px;
  --r-md: 24px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #131316;
    --card: #1e1e22;
    --sheet: #1a1a1e;
    --label: #f5f5f7;
    --label-2: rgba(245, 245, 247, 0.62);
    --label-3: rgba(245, 245, 247, 0.28);
    --sep: rgba(255, 255, 255, 0.1);
    --fill: rgba(255, 255, 255, 0.1);
    --fill-2: rgba(255, 255, 255, 0.06);
    --glass: rgba(19, 19, 22, 0.8);
    --glass-strong: rgba(40, 40, 46, 0.88);
    --seg-thumb: #55555c;
    --btn-bg: #ffffff;
    --btn-fg: #000000;
    --blue: #3b7bff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --green-text: #30d158;
    --shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.05), 0 12px 30px rgba(0, 0, 0, 0.45);
    --shadow-lift: 0 18px 44px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #131316;
  --card: #1e1e22;
  --sheet: #1a1a1e;
  --label: #f5f5f7;
  --label-2: rgba(245, 245, 247, 0.62);
  --label-3: rgba(245, 245, 247, 0.28);
  --sep: rgba(255, 255, 255, 0.1);
  --fill: rgba(255, 255, 255, 0.1);
  --fill-2: rgba(255, 255, 255, 0.06);
  --glass: rgba(19, 19, 22, 0.8);
  --glass-strong: rgba(40, 40, 46, 0.88);
  --seg-thumb: #55555c;
  --btn-bg: #ffffff;
  --btn-fg: #000000;
  --blue: #3b7bff;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --green-text: #30d158;
  --shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.05), 0 12px 30px rgba(0, 0, 0, 0.45);
  --shadow-lift: 0 18px 44px rgba(0, 0, 0, 0.6);
}

/* ───────────── base ───────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}
html.locked {
  overflow: hidden;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.3;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
h1,
h2,
h3,
p {
  margin: 0;
}
ol {
  margin: 0;
  padding: 0;
}
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--tint) 55%, transparent);
  outline-offset: 2px;
  border-radius: 12px;
}
.num {
  font-variant-numeric: tabular-nums;
}
.icon {
  display: inline-flex;
  line-height: 0;
  flex-shrink: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
}
.page {
  min-height: 100dvh;
}
.content {
  padding: 0 18px calc(40px + var(--safe-b));
}
.content.has-bar {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 240px);
  padding-bottom: 0;
}

/* cambio pagina: la vecchia sfuma in un attimo, poi entra la nuova (niente sovrapposizioni) */
.view {
  animation: viewIn 0.34s var(--ease-out) backwards;
}
.view.indietro {
  animation-name: viewInBack;
}
.view.esce-avanti,
.view.esce-indietro {
  pointer-events: none;
  animation: viewOutAvanti 0.13s ease-in forwards;
}
.view.esce-indietro {
  animation-name: viewOutIndietro;
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateX(22px);
  }
}
@keyframes viewInBack {
  from {
    opacity: 0;
    transform: translateX(-22px);
  }
}
@keyframes viewOutAvanti {
  to {
    opacity: 0;
    transform: translateX(-14px);
  }
}
@keyframes viewOutIndietro {
  to {
    opacity: 0;
    transform: translateX(14px);
  }
}

/* ───────────── tipografia ───────────── */
.hint {
  font-size: 14px;
  color: var(--label-2);
  line-height: 1.38;
}
.hint-small {
  font-size: 13px;
  color: var(--label-2);
}
.center {
  display: flex;
  justify-content: center;
}
.hint.center {
  text-align: center;
}
.footnote {
  font-size: 12.5px;
  color: var(--label-3);
  line-height: 1.4;
  margin: 26px 12px 0;
  text-align: center;
}
.lbl {
  font-size: 13px;
  font-weight: 500;
  color: var(--label-2);
}
.stack {
  display: grid;
  gap: 12px;
}
.stack-lg {
  display: grid;
  gap: 22px;
}
.privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 26px 8px 0;
  font-size: 12.5px;
  color: var(--label-3);
  text-align: center;
}
.eyebrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
}
.eyebrow::first-letter,
.sheet-title::first-letter,
.cap::first-letter {
  text-transform: uppercase;
}

/* ───────────── animazioni d'ingresso ───────────── */
.rise {
  animation: rise 0.55s var(--ease-out) both;
  animation-delay: calc(var(--d, 0) * 45ms + 60ms);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}
.settled .rise,
.settled .lettering .l,
.settled .medal,
.settled .thumb {
  animation-name: none;
}

/* ───────────── hero nero ───────────── */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #000;
  color: #fff;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  padding: calc(var(--safe-t) + 12px) 18px 18px;
}
.hero::before {
  content: '';
  position: absolute;
  left: -15%;
  right: -15%;
  top: -10%;
  height: 85%;
  z-index: -1;
  background: radial-gradient(52% 55% at 50% 48%, rgba(30, 102, 255, 0.38), rgba(30, 102, 255, 0) 72%);
  animation: glow 8s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes glow {
  from {
    opacity: 0.6;
  }
  to {
    opacity: 1;
  }
}
.hero-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  z-index: 3;
}
.hero-actions {
  display: flex;
  gap: 8px;
}
.hero-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #fff;
  transition: transform 0.3s var(--spring), background 0.2s;
}
.hero-btn:active {
  transform: scale(0.86);
  background: rgba(255, 255, 255, 0.28);
}
.hero-btn-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 2.5px #000;
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
  50% {
    transform: scale(1.3);
  }
}
.hero-compact {
  padding-bottom: 20px;
}
.hero-compact .lettering {
  margin: 6px 0 4px;
}
.hero-pad {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.hero-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.hero-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: width 0.5s var(--spring), background 0.3s;
}
.hero-dots i.on {
  background: #fff;
}
.hero-dots i.now {
  width: 24px;
  border-radius: 4px;
  background: #fff;
}
.hero-sub {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 15px;
  margin-top: 4px;
}

/* illustrazione del design Figma: titolo + sveglia come livelli separati */
.art-wrap {
  margin: 4px -18px 6px;
  position: relative;
  z-index: 1;
}
.art {
  position: relative;
  width: 103%;
  margin-left: -1.5%;
  aspect-ratio: 1657 / 932;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.art img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.art-titolo {
  position: absolute;
  left: 9.294%;
  top: 39.592%;
  width: 80.205%;
  height: auto;
  animation: titoloIn 0.7s var(--ease-out) 0.05s both;
}
@keyframes titoloIn {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}
.art-sveglia {
  position: absolute;
  left: 39.107%;
  top: 19.957%;
  width: 28.123%;
  aspect-ratio: 466 / 587;
  transform-origin: 50% 80%;
  animation: clockDrop 0.85s var(--spring) 0.2s both;
}
@keyframes clockDrop {
  0% {
    opacity: 0;
    translate: 0 -60%;
    rotate: -22deg;
    scale: 0.7;
  }
  35% {
    opacity: 1;
  }
  100% {
    translate: 0 0;
    rotate: 0deg;
    scale: 1;
  }
}
.sv-float {
  width: 100%;
  height: 100%;
  animation: clockFloat 5.5s ease-in-out 1.2s infinite;
}
@keyframes clockFloat {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-3.2%) rotate(1.4deg);
  }
}
.sv-ring {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 52% 62%;
  animation: clockRing 9s ease-in-out 3.5s infinite;
}
.live .sv-ring {
  animation-duration: 4.5s;
  animation-delay: 1.2s;
}
@keyframes clockRing {
  0%,
  90%,
  100% {
    rotate: 0deg;
  }
  91.5% {
    rotate: -7deg;
  }
  93% {
    rotate: 7deg;
  }
  94.5% {
    rotate: -5deg;
  }
  96% {
    rotate: 4deg;
  }
  97.5% {
    rotate: -2deg;
  }
}
.sv-ring.ring-now {
  animation: ringNow 0.9s ease-in-out 1;
}
@keyframes ringNow {
  0%,
  100% {
    rotate: 0deg;
  }
  12% {
    rotate: -9deg;
  }
  28% {
    rotate: 9deg;
  }
  44% {
    rotate: -7deg;
  }
  60% {
    rotate: 6deg;
  }
  76% {
    rotate: -3deg;
  }
  90% {
    rotate: 1.5deg;
  }
}
/* titolo a lettere larghe */
.lettering {
  --ls: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1;
  color: #fff;
  font-size: var(--ls);
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}
.lettering.on-light {
  color: var(--label);
}
.lettering.sm {
  --ls: clamp(20px, 6.2vw, 29px);
}
.lettering.md {
  --ls: clamp(24px, 7.6vw, 37px);
}
.lettering.lg {
  --ls: clamp(26px, 8.3vw, 40px);
}
.lettering .l {
  display: inline-block;
  animation: letterIn 0.55s var(--ease-out) both;
  animation-delay: calc(min(var(--i, 0), 9) * 38ms + 0.08s);
}
.lettering .sp {
  display: inline-block;
  width: 0.55em;
}
@keyframes letterIn {
  from {
    opacity: 0;
    transform: translateY(0.45em);
  }
}
/* busta paga 3D con spunta */
.busta {
  display: block;
  width: 100%;
  filter: drop-shadow(0 0.7em 0.9em rgba(0, 20, 100, 0.35));
}
.busta svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.busta .k {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: foglioIn 1s var(--spring) both;
  animation-delay: calc(var(--n) * 160ms + 0.3s);
}
@keyframes foglioIn {
  from {
    opacity: 0;
    transform: translateY(-80px) rotate(-12deg) scale(0.9);
  }
}
.busta .riga {
  transform-box: fill-box;
  transform-origin: 0 50%;
  animation: scrivi 0.7s var(--ease-out) both;
  animation-delay: calc(var(--r) * 160ms + 0.9s);
}
@keyframes scrivi {
  from {
    transform: scaleX(0);
  }
}
.busta .timbro {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: timbra 5.5s ease-in-out 2.6s infinite;
}
@keyframes timbra {
  0%,
  84%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  90% {
    transform: scale(1.14) rotate(-8deg);
  }
  95% {
    transform: scale(0.97) rotate(2deg);
  }
}
.busta .spunta {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw 0.6s var(--ease-out) 1.5s forwards;
}
.busta .spark {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 2.8s ease-in-out infinite;
  animation-delay: calc(var(--n) * 0.7s + 1.2s);
  opacity: 0;
}
@keyframes twinkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.3) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(20deg);
  }
}
.settled .busta .k,
.settled .busta .riga {
  animation: none;
}
.settled .busta .spunta {
  animation: none;
  stroke-dashoffset: 0;
}
.busta-wrap {
  position: relative;
  z-index: 1;
  width: 52%;
  max-width: 210px;
  margin: 2px auto 0;
  animation: floaty 5.5s ease-in-out infinite;
}
@keyframes floaty {
  50% {
    transform: translateY(-6px);
  }
}
.busta-wrap + .lettering {
  margin-top: 6px !important;
}

/* medaglia del verdetto */
.medal-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  margin: 2px auto 8px;
}
.medal-wrap::before,
.medal-wrap::after {
  content: '';
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  border: 2px solid var(--ring, var(--green));
  opacity: 0;
  animation: ripple 2.8s ease-out 0.7s 3;
}
.medal-wrap::after {
  animation-delay: 1.5s;
}
@keyframes ripple {
  from {
    opacity: 0.6;
    transform: scale(0.9);
  }
  to {
    opacity: 0;
    transform: scale(1.9);
  }
}
.medal {
  --b1: #9aa0a6;
  --b2: #6b7076;
  --b3: #464a4f;
  display: block;
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 12px 18px color-mix(in srgb, var(--b2) 55%, transparent));
  animation: medalPop 1s var(--spring) 0.15s both;
}
.medal.ok {
  --b1: #94f2b3;
  --b2: #22c55e;
  --b3: #0a8a3a;
}
.medal.warn {
  --b1: #ffd68a;
  --b2: #ff9f0a;
  --b3: #cc6a00;
}
.medal.error {
  --b1: #ff9f98;
  --b2: #ff3b30;
  --b3: #b8140b;
  animation: medalPop 1s var(--spring) 0.15s both, shake 0.7s ease-in-out 1.1s 1;
}
.medal .glifo path {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  animation: draw 0.8s var(--ease-out) 0.6s forwards;
}
@keyframes medalPop {
  from {
    opacity: 0;
    transform: scale(0.2) rotate(-40deg);
  }
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-9px) rotate(-5deg);
  }
  40% {
    transform: translateX(8px) rotate(4deg);
  }
  60% {
    transform: translateX(-6px) rotate(-3deg);
  }
  80% {
    transform: translateX(3px);
  }
}
.hero.ok {
  --ring: var(--green);
}
.hero.warn {
  --ring: var(--orange);
}
.hero.error {
  --ring: var(--red);
}
.hero.ok::before {
  background: radial-gradient(52% 55% at 50% 40%, rgba(34, 197, 94, 0.32), rgba(34, 197, 94, 0) 72%);
}
.hero.warn::before {
  background: radial-gradient(52% 55% at 50% 40%, rgba(255, 159, 10, 0.3), rgba(255, 159, 10, 0) 72%);
}
.hero.error::before {
  background: radial-gradient(52% 55% at 50% 40%, rgba(255, 59, 48, 0.32), rgba(255, 59, 48, 0) 72%);
}

/* coriandoli */
.burst {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 0;
  height: 0;
  z-index: 4;
  pointer-events: none;
}
.burst i {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--s);
  height: calc(var(--s) * 1.6);
  border-radius: 2px;
  background: var(--c);
  animation: confetti var(--t) cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
@keyframes confetti {
  0% {
    transform: translate(0, 0) rotate(0) scale(0.4);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), calc(var(--dy) + 120px)) rotate(var(--rot)) scale(1);
    opacity: 0;
  }
}

/* ───────────── pulsanti a pillola ───────────── */
.cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 61px;
  padding: 0 20px 0 26px;
  border-radius: var(--r-xl);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: left;
  transition: transform 0.4s var(--spring), background 0.25s, filter 0.2s, opacity 0.2s;
}
.cta:active {
  transform: scale(0.965);
}
.cta:disabled {
  opacity: 0.38;
  pointer-events: none;
}
.cta.vetro {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.cta.vetro:active {
  background: rgba(255, 255, 255, 0.3);
}
.cta.nero {
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.cta.chiaro {
  background: #fff;
  color: #000;
}
.cta.rosso {
  background: var(--red);
  color: #fff;
}
.cta-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cta-text small {
  font-size: 12.5px;
  font-weight: 500;
  opacity: 0.68;
}
.cta-ico {
  display: inline-flex;
}
.cta-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--p, 0) * 100%);
  background: linear-gradient(90deg, #1e66ff, #5b97ff);
  border-radius: inherit;
  z-index: -1;
  transition: width 1s linear;
  overflow: hidden;
}
.cta-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.4) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shine 2.6s ease-in-out infinite;
}
@keyframes shine {
  to {
    transform: translateX(100%);
  }
}
.cta .chev {
  display: inline-flex;
  margin-left: auto;
  flex-shrink: 0;
  animation: nudge 2s ease-in-out infinite;
}
.cta .chev svg {
  stroke-width: 3.3;
}
@keyframes nudge {
  0%,
  55%,
  100% {
    transform: translateX(0);
  }
  27% {
    transform: translateX(6px);
  }
}
.cta-live {
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-align: center;
  transition: transform 0.35s var(--spring), opacity 0.15s, background 0.2s, filter 0.2s;
}
.btn:active {
  transform: scale(0.96);
}
.btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-tinted {
  background: color-mix(in srgb, var(--tint) 13%, transparent);
  color: var(--tint);
}
.btn-plain {
  color: var(--label-2);
  font-weight: 500;
}
.btn-plain.danger,
.danger {
  color: var(--red);
}
.btn-lg {
  height: 58px;
  font-size: 17px;
}
.btn-sm {
  height: 34px;
  padding: 0 15px;
  font-size: 14.5px;
  gap: 6px;
}
.btn-block {
  width: 100%;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--label);
  transition: background 0.2s, transform 0.3s var(--spring), opacity 0.15s;
}
.icon-btn:active {
  background: var(--fill);
  transform: scale(0.88);
}
.icon-btn.tinted {
  background: var(--fill);
}
.icon-btn.small {
  width: 32px;
  height: 32px;
  color: var(--label-2);
}

/* barra flottante che compare scorrendo */
.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 40;
  width: min(100%, 480px);
  padding: calc(var(--safe-t) + 8px) 14px 0;
  transform: translate(-50%, -130%);
  transition: transform 0.55s var(--spring);
  pointer-events: none;
}
.topbar.show {
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.topbar-in {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 16px 5px 5px;
  border-radius: 999px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-lift), 0 0 0 0.5px var(--sep);
}
.topbar .icon-btn {
  width: 34px;
  height: 34px;
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.topbar-t {
  font-family: var(--display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ───────────── card e liste ───────────── */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}
@supports (corner-shape: squircle) {
  .card,
  .group,
  .sheet,
  .hero,
  .stat,
  .tile-stip {
    corner-shape: squircle;
  }
}
.section {
  margin-top: 26px;
}
.section-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label-2);
  margin: 0 18px 8px;
}
.section-title.tight {
  margin: 0 0 6px;
}
.section-note {
  font-size: 13px;
  line-height: 1.38;
  color: var(--label-2);
  margin: 8px 18px 0;
}
.section-note.error {
  color: var(--red);
}
.group {
  background: var(--card);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 18px;
  font-size: 17px;
  text-align: left;
}
.group > .row:not(:first-child)::before,
.group > details:not(:first-child)::before,
.group > .check:not(:first-child)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18px;
  right: 0;
  height: 0.5px;
  background: var(--sep);
}
.group > details,
.group > .check {
  position: relative;
}
.row.tappable,
.row-main {
  cursor: pointer;
  transition: background 0.15s;
}
.row.tappable:active,
.row-main:active {
  background: var(--fill);
}
.row.column {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 18px 14px;
}
.row-body {
  flex: 1;
  min-width: 0;
  display: block;
}
.row-title {
  display: block;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.row-sub {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  color: var(--label-2);
  margin-top: 1px;
}
.row-value {
  margin-left: auto;
  color: var(--label-2);
  flex-shrink: 0;
}
.row-chevron {
  color: var(--label-3);
}
.row-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.row-icon.blue {
  background: var(--blue);
}
.row-icon.red {
  background: var(--red);
}
.row-icon.indigo {
  background: var(--indigo);
}
.row-icon.gray {
  background: var(--gray);
}
.tappable-wrap {
  padding: 0 8px 0 0;
}
.tappable-wrap .row-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 6px 10px 18px;
  text-align: left;
}
.row.field {
  cursor: text;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--gray);
  transition: background 0.3s;
}
.status-dot.green,
.dot.green {
  background: var(--green);
}
.status-dot.blue,
.dot.blue {
  background: var(--blue);
}
.status-dot.orange,
.dot.orange {
  background: var(--orange);
}
.status-dot.red,
.dot.red {
  background: var(--red);
}
.status-dot.gray,
.dot.gray {
  background: var(--gray);
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.purple {
  background: var(--purple);
}
.dot.teal {
  background: var(--teal);
}

/* ───────────── campi ───────────── */
.input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 0;
  font-size: 17px;
}
.input.right {
  text-align: right;
}
.input::placeholder {
  color: var(--label-3);
}
.textarea {
  background: var(--fill-2);
  border-radius: 16px;
  padding: 12px 14px;
  resize: none;
  line-height: 1.35;
}
.field-number {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 5px;
  margin-left: auto;
  flex-shrink: 0;
}
.field-number .input {
  width: 92px;
  text-align: right;
  padding: 6px 8px;
  margin: -6px 0;
  border-radius: 10px;
  transition: background 0.15s;
}
.field-number .input:focus {
  background: var(--fill);
}
.field-suffix {
  color: var(--label-2);
  font-size: 15px;
  min-width: 24px;
}
.input-time,
.input-date {
  background: var(--fill);
  border: 0;
  border-radius: 12px;
  padding: 7px 10px;
  min-height: 38px;
  font-size: 17px;
  outline: 0;
  min-width: 0;
}
.input-date {
  margin-left: auto;
}
.big-time {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 58px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  padding: 0;
  color: var(--label);
}
.big-time::-webkit-calendar-picker-indicator {
  display: none;
}
.arrived {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px 0 0;
}

.seg {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  background: var(--fill);
  border-radius: 14px;
  padding: 3px;
}
.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--n));
  background: var(--seg-thumb);
  border-radius: 11px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform 0.45s var(--spring);
}
.seg-item {
  position: relative;
  z-index: 1;
  height: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}
.seg-item[aria-selected='true'] {
  font-weight: 700;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.stepper-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--label);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.25s var(--spring), background 0.2s, opacity 0.2s;
}
.stepper-btn:active {
  transform: scale(0.84);
  background: color-mix(in srgb, var(--tint) 22%, transparent);
}
.stepper-btn:disabled {
  opacity: 0.28;
}
.stepper-value {
  min-width: 150px;
  text-align: center;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.stepper.compact {
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.stepper.compact .stepper-btn {
  width: 32px;
  height: 32px;
}
.stepper.compact .stepper-btn .icon svg {
  width: 17px;
  height: 17px;
}
.stepper.compact .stepper-value {
  min-width: 76px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(98px, 1fr));
  gap: 10px;
}
.chips.scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 14px -18px 0;
  padding: 2px 18px 4px;
  scrollbar-width: none;
}
.chips.scroll::-webkit-scrollbar {
  display: none;
}
.chip {
  flex-shrink: 0;
  height: 36px;
  padding: 0 15px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.25s, color 0.25s, transform 0.3s var(--spring);
}
.chip:active {
  transform: scale(0.94);
}
.chip.selected {
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.chip-preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 13px 14px 12px;
  border-radius: 22px;
  background: var(--card);
  border: 2px solid transparent;
  text-align: left;
  transition: transform 0.35s var(--spring), border-color 0.2s, background 0.2s;
}
.chip-preset:active {
  transform: scale(0.95);
}
.chip-preset.selected {
  border-color: var(--btn-bg);
  background: var(--card);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.chip-ore {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.chip-nome {
  font-size: 12.5px;
  color: var(--label-2);
  line-height: 1.2;
}
.chip-preset.selected .chip-ore {
  color: var(--blue);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--fill);
  color: var(--label-2);
  gap: 6px;
}
.badge.small {
  height: 20px;
  padding: 0 8px;
  font-size: 11.5px;
  margin-left: 8px;
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green-text);
}
.hero .badge {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.hero .badge.red {
  background: rgba(255, 59, 48, 0.25);
  color: #ff8a82;
}
.hero .badge.orange {
  background: rgba(255, 159, 10, 0.25);
  color: #ffc566;
}
.hero .badge.green {
  background: rgba(48, 209, 88, 0.22);
  color: #6ee08c;
}
.hero .badge.gray {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
}
.badge.red {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
}
.badge.orange {
  background: color-mix(in srgb, var(--orange) 16%, transparent);
  color: color-mix(in srgb, var(--orange) 80%, #000);
}
.badge.green {
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green-text);
}
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(74, 222, 128, 0);
  }
}

/* ───────────── home ───────────── */
.home .hero {
  padding-bottom: 16px;
}
.home-top-title {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: -0.01em;
}
.tile-stip {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 18px;
  padding: 22px 18px 18px;
  border-radius: var(--r-xl);
  color: #fff;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  background: radial-gradient(110% 70% at 18% 0%, rgba(140, 186, 255, 0.85) 0%, rgba(140, 186, 255, 0) 60%), linear-gradient(165deg, #2f73ff 0%, #1352ea 52%, #0a36b9 100%);
  box-shadow: 0 22px 44px -16px rgba(30, 102, 255, 0.7);
  transition: transform 0.45s var(--spring), box-shadow 0.3s;
}
.tile-stip::before {
  content: '';
  position: absolute;
  right: -30%;
  bottom: -40%;
  width: 90%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  z-index: -1;
}
.tile-stip:active {
  transform: scale(0.97);
}
@media (hover: hover) {
  .tile-stip:hover {
    transform: translateY(-3px);
    box-shadow: 0 28px 50px -16px rgba(30, 102, 255, 0.8);
  }
  .tile-stip:active {
    transform: scale(0.98);
  }
}
.tile-stip .busta-wrap {
  width: 48%;
  max-width: 190px;
}
.tile-stip .lettering {
  margin: 4px 0 16px;
}
.tile-stip .cta {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.tile-stip .busta {
  filter: drop-shadow(0 0.7em 0.8em rgba(0, 16, 90, 0.4));
}
.tile-chip {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 700;
}
.home .hero .cta {
  margin-top: 10px;
}

/* ───────────── lavoro ───────────── */
.cal {
  padding: 18px 12px 14px;
  border-radius: var(--r-xl);
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px;
}
.cal-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cal-year {
  color: var(--label-3);
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cal-nav .btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 13.5px;
  margin-right: 2px;
}
.cal-nav .icon-btn {
  width: 36px;
  height: 36px;
  background: var(--fill);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px 2px;
}
.cal-dow {
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-2);
  padding: 6px 0 4px;
}
.cal-dow.weekend {
  color: var(--label-3);
}
.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 56px;
  padding-top: 4px;
  border-radius: 16px;
  transition: background 0.15s, transform 0.3s var(--spring);
}
.cal-day:active {
  background: var(--fill);
  transform: scale(0.9);
}
.cal-grid.anim .cal-day {
  animation: dayPop 0.4s var(--ease-out) both;
  animation-delay: calc(var(--k, 0) * 7ms);
}
@keyframes dayPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.85);
  }
}
.cal-num {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 16.5px;
  font-weight: 500;
}
.cal-day.holiday .cal-num {
  color: var(--red);
}
.cal-day.today .cal-num {
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 800;
}
.cal-tag {
  min-width: 26px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  color: #fff;
  background: var(--gray);
  font-variant-numeric: tabular-nums;
}
.cal-tag.blue {
  background: var(--blue);
}
.cal-tag.orange {
  background: var(--orange);
}
.cal-tag.purple {
  background: var(--purple);
}
.cal-tag.red {
  background: var(--red);
}
.cal-tag.teal {
  background: var(--teal);
}
.cal-tag.pulse {
  animation: tagPulse 1.6s ease-in-out infinite;
}
@keyframes tagPulse {
  50% {
    opacity: 0.45;
    transform: scale(0.92);
  }
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 0.5px solid var(--sep);
}
.legend.dots {
  border: 0;
  margin: 12px 4px 0;
  padding: 0;
  justify-content: flex-start;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--label-2);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.stat {
  display: block;
  width: 100%;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  text-align: left;
}
.stat.tappable:active {
  transform: scale(0.96);
}
.stat-value {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label-2);
  margin-top: 6px;
}
.stat.accent .stat-value {
  color: var(--blue);
}

/* ───────────── sheet ───────────── */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
.backdrop.show {
  opacity: 1;
}
.sheet {
  --card: var(--sheet-card, #fff);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 101;
  margin: 0 auto;
  max-width: 480px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  background: var(--sheet);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -12px 50px rgba(0, 0, 0, 0.25);
  transform: translateY(104%);
  transition: transform 0.6s var(--ease-out);
  padding-bottom: var(--safe-b);
}
.sheet.tall {
  max-height: 95dvh;
}
.sheet.show {
  transform: translateY(0);
}
:root[data-theme='dark'] .sheet {
  --sheet-card: #2a2a30;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .sheet {
    --sheet-card: #2a2a30;
  }
}
.sheet.show .sheet-body > * {
  animation: rise 0.7s var(--spring) both;
}
.sheet.show .sheet-body > *:nth-child(2) {
  animation-delay: 70ms;
}
.sheet.show .sheet-body > *:nth-child(3) {
  animation-delay: 140ms;
}
.sheet.show .sheet-body > *:nth-child(4) {
  animation-delay: 210ms;
}
.sheet-header {
  position: relative;
  padding: 8px 56px 12px;
  text-align: center;
  touch-action: none;
  cursor: grab;
  flex-shrink: 0;
}
.sheet-grabber {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--label-3);
  margin: 0 auto 14px;
}
.sheet-title {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.2;
}
.sheet-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--label-2);
  transition: transform 0.3s var(--spring);
}
.sheet-close:active {
  transform: scale(0.85);
}
.sheet-body {
  overflow-y: auto;
  padding: 6px 20px 22px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sheet-footer {
  padding: 12px 20px 18px;
  flex-shrink: 0;
  background: var(--sheet);
}
.sheet-h {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label-2);
  margin: 0 0 12px;
}
.planned {
  text-align: center;
  color: var(--label-2);
  font-size: 15px;
}
.planned strong {
  color: var(--label);
}
@media (min-width: 720px) {
  .sheet {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    width: 480px;
    border-radius: var(--r-xl);
    transform: translate(-50%, -46%) scale(0.95);
    opacity: 0;
    transition: transform 0.6s var(--ease-out), opacity 0.3s;
  }
  .sheet.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.radio {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--label-3);
  display: grid;
  place-items: center;
  color: transparent;
  flex-shrink: 0;
  transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.4s var(--spring);
}
.radio.on {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--btn-fg);
  transform: scale(1.1);
}
.type-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -20px;
  padding: 2px 20px;
  scrollbar-width: none;
}
.type-scroll::-webkit-scrollbar {
  display: none;
}
.type-chip {
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.25s, color 0.25s, transform 0.35s var(--spring);
}
.type-chip:active {
  transform: scale(0.94);
}
.type-chip.selected {
  color: #fff;
  background: var(--blue);
}
.type-chip.selected.orange {
  background: var(--orange);
}
.type-chip.selected.purple {
  background: var(--purple);
}
.type-chip.selected.red {
  background: var(--red);
}
.type-chip.selected.teal {
  background: var(--teal);
}
.banner-festa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--red) 11%, transparent);
  color: var(--red);
  font-size: 15px;
  font-weight: 600;
}
.turno {
  background: var(--card);
  border-radius: 24px;
  padding: 14px 16px;
  display: grid;
  gap: 12px;
}
.turno-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.turno-title {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}
.turno-times {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
}
.turno-times label {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.turno-times .input-time {
  width: 100%;
}
.turno-arrow {
  color: var(--label-3);
  margin-bottom: 10px;
}
.turno-ore {
  display: flex;
  align-items: center;
  gap: 10px;
}
.day-total {
  text-align: center;
  font-size: 15px;
  color: var(--label-2);
}
.day-total strong {
  color: var(--label);
  font-family: var(--display);
  font-size: 19px;
}

/* ───────────── alert e toast ───────────── */
.alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s;
}
.alert-overlay.show {
  opacity: 1;
}
.alert {
  width: min(290px, 84vw);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-radius: 28px;
  overflow: hidden;
  text-align: center;
  transform: scale(1.14);
  transition: transform 0.45s var(--spring);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.alert-overlay.show .alert {
  transform: scale(1);
}
.alert-title {
  font-size: 17px;
  font-weight: 700;
  padding: 22px 18px 4px;
  line-height: 1.25;
}
.alert-message {
  font-size: 13px;
  padding: 2px 18px 18px;
  line-height: 1.35;
}
.alert-title:last-child {
  padding-bottom: 18px;
}
.alert-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 0.5px solid var(--sep);
}
.alert-btn {
  height: 50px;
  font-size: 17px;
  text-align: center;
  color: var(--tint);
  transition: background 0.15s;
}
.alert-btn:active {
  background: var(--fill);
}
.alert-btn + .alert-btn {
  border-left: 0.5px solid var(--sep);
}
.alert-btn.strong {
  font-weight: 700;
}
.alert-btn.destructive {
  color: var(--red);
}
.toast-host {
  position: fixed;
  top: calc(var(--safe-t) + 10px);
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 420px);
  padding: 10px 18px 10px 12px;
  border-radius: 999px;
  background: #000;
  color: #fff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-30px) scale(0.85);
  transition: transform 0.6s var(--spring), opacity 0.3s;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--gray);
  flex-shrink: 0;
}
.toast.ok .toast-icon {
  background: var(--green);
  animation: pop 0.6s var(--spring) 0.15s both;
}
.toast.error .toast-icon {
  background: var(--red);
}
.toast.warn .toast-icon {
  background: var(--orange);
}
@keyframes pop {
  from {
    transform: scale(0);
  }
}

/* ───────────── stipendio ───────────── */
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}
.thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  background: var(--fill);
  box-shadow: 0 0 0 0.5px var(--sep);
  animation: pop 0.6s var(--spring) both;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-pdf {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  color: var(--label-2);
  font-weight: 700;
  font-size: 13px;
}
.thumb-n {
  position: absolute;
  left: 8px;
  bottom: 8px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.thumb-x {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  display: grid;
  place-items: center;
}
.scan::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 38%;
  top: -38%;
  background: linear-gradient(180deg, transparent, rgba(30, 102, 255, 0.5) 85%, rgba(120, 170, 255, 0.95) 100%);
  border-bottom: 2px solid #8fb8ff;
  animation: scanLine 1.8s var(--ease-io) infinite;
}
@keyframes scanLine {
  to {
    top: 100%;
  }
}
.read-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 16px;
  align-items: center;
}
.read-card .thumb {
  aspect-ratio: 3 / 4;
}
.read-info {
  display: grid;
  gap: 8px;
}
.read-info strong {
  font-size: 17px;
}
.bar {
  height: 8px;
  border-radius: 4px;
  background: var(--fill);
  overflow: hidden;
}
.bar > i {
  display: block;
  position: relative;
  height: 100%;
  background: linear-gradient(90deg, #1e66ff, #5b97ff);
  border-radius: 4px;
  transition: width 0.5s var(--ease-out);
  overflow: hidden;
}
.bar > i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shine 1.8s ease-in-out infinite;
}
.summary-big {
  font-size: 18px;
  letter-spacing: -0.015em;
}
.summary-big b {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.summary-big.muted {
  color: var(--label-2);
  font-size: 18px;
  font-weight: 600;
}
.summary .btn {
  margin-top: 10px;
}
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.check-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  background: var(--gray);
  margin-top: 1px;
}
.check-icon svg {
  stroke-width: 2.6;
}
.check-icon.ok {
  background: var(--green);
}
.check-icon.warn {
  background: var(--orange);
}
.check-icon.error {
  background: var(--red);
}
.check-icon.info {
  background: var(--blue);
}
.check-icon.skip {
  background: var(--gray);
}
.row-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.actionbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 28px -18px 0;
  padding: 12px 18px calc(12px + var(--safe-b));
  background: linear-gradient(180deg, transparent, var(--bg) 38%);
}
.content.has-bar .actionbar {
  margin-top: auto;
}
.status-card {
  display: flex;
  gap: 14px;
  align-items: center;
}
.status-card strong {
  font-size: 16px;
}
.tag {
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--fill);
  color: var(--label-2);
  transition: transform 0.3s var(--spring), background 0.2s;
}
.tag:active {
  transform: scale(0.9);
}
.tag.green {
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green-text);
}
.tag.red {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
}
.tag.orange {
  background: color-mix(in srgb, var(--orange) 18%, transparent);
  color: color-mix(in srgb, var(--orange) 78%, #000);
}
.voce .row-value {
  margin-left: 0;
  color: var(--label);
  font-weight: 600;
}
.voce.off {
  opacity: 0.4;
}
.voce .row-title {
  font-size: 15px;
}
.disclosure {
  margin-top: 22px;
}
.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  padding: 4px 6px;
  color: var(--label-2);
  font-size: 15px;
  font-weight: 500;
}
.disclosure > summary::-webkit-details-marker {
  display: none;
}
.disclosure.group-details > summary {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.ocr-text {
  margin: 10px 0 0;
  padding: 14px;
  background: var(--card);
  border-radius: 18px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
  color: var(--label-2);
}
.check-summary {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 18px;
  list-style: none;
}
details.check > summary {
  cursor: pointer;
  transition: background 0.15s;
}
details.check > summary:active {
  background: var(--fill);
}
details.check > summary::-webkit-details-marker {
  display: none;
}
.checks > .check {
  animation: rise 0.5s var(--ease-out) both;
  animation-delay: calc(min(var(--k, 0), 9) * 40ms + 0.2s);
}
.settled .checks > .check {
  animation: none;
}
.check-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.check-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.check-msg {
  font-size: 14.5px;
  line-height: 1.38;
  color: var(--label-2);
}
.check-chev {
  color: var(--label-3);
  margin-top: 4px;
  transition: transform 0.4s var(--spring);
}
details[open] > summary .check-chev {
  transform: rotate(180deg);
}
.check-detail {
  padding: 0 18px 16px 61px;
  animation: fadeDown 0.4s var(--ease-out);
}
@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}
.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 16px;
  margin: 0;
  padding: 12px 14px;
  background: var(--fill-2);
  border-radius: 16px;
}
.kv dt {
  font-size: 14px;
  color: var(--label-2);
}
.kv dd {
  margin: 0;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
}
.tip {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tint) 9%, transparent);
  font-size: 14px;
  line-height: 1.4;
}
.tip .icon {
  color: var(--tint);
  margin-top: 1px;
}
.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.38;
  color: var(--label-2);
  text-align: left;
}
.notice p {
  flex: 1;
}
.notice strong {
  color: var(--label);
}
.notice-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--orange) 16%, transparent);
  color: var(--orange);
  flex-shrink: 0;
}

/* ───────────── varie ───────────── */
@media (min-width: 720px) {
  .app {
    padding-bottom: 40px;
  }
  .hero {
    border-radius: var(--r-xl);
    margin-top: 20px;
  }
  .topbar {
    display: none;
  }
}
@media (hover: hover) {
  .cta.nero:hover,
  .btn-primary:hover {
    filter: brightness(1.2);
  }
  .cta.vetro:hover {
    background: rgba(255, 255, 255, 0.28);
  }
  .row.tappable:hover,
  .row-main:hover {
    background: var(--fill-2);
  }
  .cal-day:hover {
    background: var(--fill-2);
  }
}
@media (max-width: 380px) {
  .stepper-value {
    min-width: 120px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ───────────── dettagli dell'intestazione ───────────── */
.hero-center {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding-left: 4px;
}
.hero-top.has-back .hero-center {
  justify-content: center;
  padding: 0;
}
.hero-top .hero-actions {
  min-width: 44px;
  justify-content: flex-end;
}
.hero:not(.hero-compact) > .lettering {
  margin: 34px 0 30px;
}
.hero-link {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s, transform 0.3s var(--spring);
}
.hero-link:active {
  color: #fff;
  transform: scale(0.94);
}

/* ───────────── introduzione (primo avvio) ───────────── */
.sveglia-sola {
  position: relative;
  z-index: 1;
  width: 44%;
  max-width: 170px;
  aspect-ratio: 466 / 587;
  margin: 6px auto 4px;
  cursor: pointer;
  animation: clockDrop 0.85s var(--spring) 0.2s both;
}
.sveglia-sola img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.hero > .sveglia-sola + .lettering {
  margin: 14px 0 6px;
}
.hero-skip {
  min-width: 44px;
  height: 44px;
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  transition: color 0.2s, transform 0.3s var(--spring);
}
.hero-skip:active {
  color: #fff;
  transform: scale(0.94);
}
.onb-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.onb-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
}
.onb-row h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.onb-row p {
  margin-top: 2px;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--label-2);
}
.onb-ico {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 14px -6px rgba(0, 0, 0, 0.35);
}
.onb-ico.blue {
  background: linear-gradient(160deg, #5ac8fa, #1e66ff);
}
.onb-ico.green {
  background: linear-gradient(160deg, #78e08f, #1fa24e);
}
.onb-ico.orange {
  background: linear-gradient(160deg, #ffc15a, #ff8a00);
}
.onb-ico.indigo {
  background: linear-gradient(160deg, #8e8cff, #5856d6);
}
.onb-note {
  margin: 28px 14px 0;
  text-align: center;
  font-size: 16px;
  line-height: 1.45;
  color: var(--label-2);
}
.onboarding {
  display: flex;
  flex-direction: column;
}
.onboarding > .content {
  flex: 1;
}
