/* =========================================================
   Gammacenter · Gestione cassa
   Glass UI su scena di laboratorio
   ========================================================= */

:root {
  --brand: #3065b5;
  --brand-2: #0392ce;
  --cyan: #3eb8d7;
  --yellow: #f9cb14;
  --yellow-2: #e3a90a;
  --green: #62a329;
  --lime: #9be15d;
  --amber: #e9c046;
  --red: #ff7a8a;
  --text: #f3f7ff;
  --muted: rgba(222, 234, 255, .62);
  --faint: rgba(222, 234, 255, .4);
  --line: rgba(255, 255, 255, .1);
  --card: rgba(255, 255, 255, .055);
  --card-hover: rgba(255, 255, 255, .085);
  --field: rgba(6, 20, 46, .38);
  --radius: 24px;
  --ease: cubic-bezier(.2, .85, .25, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: #1a2436;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.num, .tnum { font-variant-numeric: tabular-nums; }
.pos { color: #8ee6a4; }
.neg { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@view-transition { navigation: auto; }
::view-transition-group(root) { animation-duration: .45s; }
.scene { view-transition-name: scene; }
.dock { view-transition-name: dock; }
.topbar { view-transition-name: topbar; }

/* ---------------- scena: foto del laboratorio ---------------- */
.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: #1a2436; }
.scene-photo {
  position: absolute; inset: -4%;
  background-size: cover; background-position: center 40%; background-repeat: no-repeat;
  animation: kenburns 46s ease-in-out infinite alternate;
  will-change: transform;
}
.scene-login .scene-photo { background-position: center 55%; filter: blur(1.5px); }
.scene-dashboard .scene-photo { filter: blur(3px) saturate(1.05); }
/* tinta scura: rende leggibile il vetro sopra una foto molto luminosa */
.scene-tint {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 22, 40, .52) 0%, rgba(12, 22, 40, .42) 40%, rgba(8, 14, 28, .78) 100%),
    linear-gradient(90deg, rgba(8, 14, 28, .45), transparent 30%, transparent 70%, rgba(8, 14, 28, .35));
}
.scene-login .scene-tint { background: linear-gradient(180deg, rgba(12, 22, 40, .38), rgba(8, 14, 28, .7)); }
.scene-glow {
  position: absolute; inset: 0; mix-blend-mode: soft-light;
  background:
    radial-gradient(60vw 40vh at 50% 0%, rgba(249, 203, 20, .55), transparent 70%),
    radial-gradient(40vw 40vh at 100% 100%, rgba(249, 203, 20, .25), transparent 70%);
  animation: breathe 8s ease-in-out infinite alternate;
}
#labCanvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .7; }
.scene-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 50%, rgba(4, 8, 18, .55) 100%); }
.scene-grain {
  position: absolute; inset: -50%; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes kenburns { from { transform: scale(1) translate3d(0, 0, 0); } to { transform: scale(1.08) translate3d(-1.5%, -1%, 0); } }
@keyframes breathe { from { opacity: .65; } to { opacity: 1; } }

/* ---------------- glass ---------------- */
.glass {
  background: linear-gradient(140deg, rgba(40, 52, 74, .5), rgba(20, 30, 50, .42) 55%, rgba(30, 42, 64, .48));
  -webkit-backdrop-filter: blur(30px) saturate(155%);
  backdrop-filter: blur(30px) saturate(155%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 40px 90px -30px rgba(0, 8, 28, .75), inset 0 1px 0 rgba(255, 255, 255, .2);
}

/* ---------------- shell ---------------- */
body.app { padding: 34px 34px 34px 122px; }
.window {
  position: relative;
  max-width: 1340px;
  margin: 0 auto;
  border-radius: 34px;
  padding: 24px 28px 30px;
  animation: windowIn .8s var(--ease) both;
}
@keyframes windowIn { from { opacity: 0; transform: translateY(26px) scale(.975); filter: blur(10px); } }

.topbar { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; object-fit: contain; }
.brand-logo { height: 46px; width: auto; display: block; filter: drop-shadow(0 4px 14px rgba(0,0,0,.35)); transition: transform .5s var(--spring); }
.brand:hover .brand-logo { transform: scale(1.03); }
.auth-logo { width: 100%; max-width: 330px; height: auto; display: block; filter: drop-shadow(0 6px 18px rgba(0,0,0,.4)); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11.5px; letter-spacing: .04em; }
.page-title { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 0 10px; padding-left: 18px; border-left: 1px solid var(--line); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: linear-gradient(135deg, var(--yellow), var(--yellow-2)); color: #2a2205; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta small { color: var(--muted); font-size: 11px; }

/* segmented */
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(4, 16, 38, .35); border: 1px solid var(--line); gap: 2px; position: relative; }
.seg-item { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: color .25s, background .35s var(--ease); white-space: nowrap; cursor: pointer; }
.seg-item:hover { color: var(--text); }
.seg-item.is-on { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 14px -4px rgba(0,0,0,.4); }

.sede-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: rgba(249,203,20,.14); border: 1px solid rgba(249,203,20,.35); color: #ffe78a; }
.sede-chip .ic { width: 16px; height: 16px; }

/* ---------------- dock ---------------- */
.dock {
  position: fixed; left: 30px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px; border-radius: 999px; z-index: 20;
  animation: dockIn .9s var(--ease) .1s both;
}
@keyframes dockIn { from { opacity: 0; transform: translate(-30px, -50%); } }
.dock-form { margin: 0; display: contents; }
.dock-item {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; border: 0; background: transparent; cursor: pointer;
  color: rgba(235, 243, 255, .78);
  transition: transform .35s var(--spring), background .3s, color .3s;
}
.dock-item:hover { background: rgba(255,255,255,.12); color: #fff; transform: scale(1.18); }
.dock-item:has(+ .dock-item:hover), .dock-item:hover + .dock-item { transform: scale(1.07); }
.dock-item.is-active { color: #2a2205; background: linear-gradient(140deg, #ffd93d, var(--yellow-2)); box-shadow: 0 8px 22px -6px rgba(249,203,20,.85), inset 0 1px 0 rgba(255,255,255,.5); }
.dock-item .ic { width: 21px; height: 21px; }
.dock-sep { width: 22px; height: 1px; background: var(--line); margin: 4px 0; }
.dock-tip {
  position: absolute; left: calc(100% + 14px); top: 50%; transform: translate(-6px, -50%);
  padding: 7px 12px; border-radius: 10px; white-space: nowrap; font-size: 12.5px; font-weight: 600;
  background: rgba(8, 24, 52, .85); border: 1px solid var(--line); backdrop-filter: blur(12px);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s var(--ease);
}
.dock-item:hover .dock-tip, .dock-item:focus-visible .dock-tip { opacity: 1; transform: translate(0, -50%); }

/* ---------------- griglie e card ---------------- */
.grid { display: grid; gap: 18px; }
.card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius); padding: 20px 22px;
  transition: background .35s, transform .45s var(--ease), border-color .35s;
}
.card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.085), transparent 42%);
}
.card:hover { background: var(--card-hover); border-color: rgba(255,255,255,.13); }
.card:hover::before { opacity: 1; }
.card > * { position: relative; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.card-sub { color: var(--muted); font-size: 12.5px; }

.content { transition: opacity .17s ease, transform .2s var(--ease), filter .17s ease; }
.content.is-leaving { opacity: 0; transform: translateY(8px) scale(.995); filter: blur(6px); pointer-events: none; }
.reveal { animation: rise .75s var(--ease) both; animation-delay: calc(var(--i, 0) * 65ms + 120ms); }
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(.985); filter: blur(8px); } }

/* ---------------- dashboard ---------------- */
.dash-top { grid-template-columns: 1.3fr .82fr 1.25fr; }
.dash-bottom { grid-template-columns: 2.1fr 1.25fr; margin-top: 18px; }
.stack { display: grid; gap: 14px; }

.bars { display: flex; gap: 12px; height: 168px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.bar {
  position: relative; flex: 1; width: 100%; max-width: 46px;
  border-radius: 999px; background: rgba(255,255,255,.075);
  display: flex; align-items: flex-end; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.bar-fill {
  width: 100%; height: 0; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.6), rgba(255,255,255,.22));
  transition: height 1.15s var(--ease);
  transition-delay: calc(var(--i, 0) * 60ms + 250ms);
}
.bar-col.is-today .bar-fill { background: linear-gradient(180deg, #ffe264, #e3a90a); box-shadow: 0 0 24px rgba(249,203,20,.55); }
.bar-col.is-today .bar-pct { color: #2a2205; }
.bar-pct { position: absolute; left: 0; right: 0; text-align: center; font-size: 10.5px; font-weight: 700; color: rgba(255,255,255,.75); transition: bottom 1.15s var(--ease); transition-delay: calc(var(--i, 0) * 60ms + 250ms); bottom: 6px; }
.bar-label { font-size: 12px; color: var(--muted); }
.bar-col:hover .bar { background: rgba(255,255,255,.12); }
.bar-col .bar[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  font-size: 10px; white-space: nowrap; padding: 3px 7px; border-radius: 8px; background: rgba(5,18,40,.85);
}

.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.stat-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.09); border: 1px solid var(--line); flex: none; }
.stat-val { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.stat-lbl { color: var(--muted); font-size: 12px; }

.donut-wrap { display: grid; grid-template-columns: 156px minmax(0, 1fr); gap: 18px; align-items: center; }
.donut { position: relative; width: 156px; height: 156px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 18; stroke-linecap: round; }
.donut .track { stroke: rgba(255,255,255,.08); }
.donut .arc { transition: stroke-dasharray 1.4s var(--ease), stroke-dashoffset 1.4s var(--ease); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.donut-center small { color: var(--muted); font-size: 12px; }
.legend { display: grid; gap: 14px; }
.legend-row { display: grid; grid-template-columns: 1fr auto; row-gap: 2px; }
.legend-row .lbl { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
.legend-row .val { font-size: 15.5px; font-weight: 700; white-space: nowrap; }
.legend-row .chg { font-size: 11.5px; align-self: end; white-space: nowrap; padding-left: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--line); transition: background .25s, padding .35s var(--ease); border-radius: 14px; }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: rgba(255,255,255,.05); padding-left: 12px; padding-right: 12px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; }
.list-row .meta { color: var(--muted); font-size: 12px; }
.list-row .amount { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.list-row .amount b { color: var(--text); }

.ring { width: 36px; height: 36px; flex: none; }
.ring circle { fill: none; stroke-width: 3.2; }
.ring .track { stroke: rgba(255,255,255,.14); }
.ring .arc { stroke: #fff; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 1.2s var(--ease); }
.ring.spin .arc { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(270deg); } }
.ring-done { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); flex: none; }
.ring-done .ic { width: 18px; height: 18px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-open { background: linear-gradient(180deg, #d6cb42, #b4a72a); color: #1e1b02; }
.pill-closed { background: linear-gradient(180deg, #4fc06a, #2f9a4c); color: #fff; }
.pill-soft { background: rgba(255,255,255,.12); color: var(--text); }
.pill-in { background: rgba(98,163,41,.22); color: #b6ec8e; }
.pill-out { background: rgba(255,122,138,.18); color: #ffb3bd; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-nav { display: flex; gap: 8px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.week a { padding: 9px 0 10px; border-radius: 14px; display: grid; gap: 2px; position: relative; transition: background .25s, transform .3s var(--spring); }
.week a:hover { background: rgba(255,255,255,.08); transform: translateY(-2px); }
.week small { color: var(--muted); font-size: 11.5px; }
.week strong { font-size: 16px; font-weight: 700; }
.week a.is-today { background: rgba(255,255,255,.14); box-shadow: inset 0 1px 0 rgba(255,255,255,.15); }
.week a.has-data::after { content: ''; position: absolute; bottom: 4px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.week a.has-data.is-closed::after { background: var(--lime); box-shadow: 0 0 8px var(--lime); }

.output { display: flex; align-items: center; gap: 14px; }

/* ---------------- bottoni ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14);
  font-weight: 650; font-size: 13.5px; color: var(--text);
  transition: transform .35s var(--spring), background .25s, box-shadow .3s, border-color .25s;
}
.btn:hover { background: rgba(255,255,255,.17); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { color: #2a2205; background: linear-gradient(135deg, #ffd93d, var(--yellow-2)); border-color: transparent; box-shadow: 0 12px 30px -12px rgba(249,203,20,.9), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-primary:hover { background: linear-gradient(135deg, #ffe264, #f0b60f); box-shadow: 0 16px 36px -12px rgba(249,203,20,1), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-green { background: linear-gradient(135deg, #7cc84a, #3d8f28); border-color: transparent; box-shadow: 0 12px 30px -12px rgba(98,163,41,.9), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-green:hover { background: linear-gradient(135deg, #8bd65a, #46a02f); }
.btn-red { background: linear-gradient(135deg, #ff8a98, #d4485c); border-color: transparent; box-shadow: 0 12px 30px -12px rgba(255,122,138,.9), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-red:hover { background: linear-gradient(135deg, #ff9aa6, #e0566a); }
.btn-ghost { background: transparent; }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------------- toolbar ---------------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 6px; }
.date-big small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: 0; }

/* ---------------- KPI ---------------- */
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { padding: 18px; display: grid; gap: 10px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-ic { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.09); }
.kpi-ic .ic { width: 18px; height: 18px; }
.kpi-val { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--faint); font-size: 11.5px; }
.kpi.accent-cyan .kpi-ic { background: rgba(62,184,215,.22); color: #9be7f7; }
.kpi.accent-blue .kpi-ic { background: rgba(80,130,230,.25); color: #b4cbff; }
.kpi.accent-green .kpi-ic { background: rgba(98,163,41,.25); color: #b6ec8e; }
.kpi.accent-red .kpi-ic { background: rgba(255,122,138,.2); color: #ffb3bd; }
.kpi.accent-amber .kpi-ic { background: rgba(233,192,70,.2); color: #f6dc8a; }
.kpi.highlight { background: linear-gradient(145deg, rgba(249,203,20,.26), rgba(227,169,10,.12)); border-color: rgba(249,203,20,.4); }
.kpi.highlight .kpi-ic { background: rgba(249,203,20,.3); color: #ffe78a; }

.sheet-grid { grid-template-columns: 1fr 340px; margin-top: 18px; align-items: start; }

/* ricevuta saldo */
.calc { display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.calc-row { display: flex; justify-content: space-between; padding: 9px 0; color: var(--muted); }
.calc-row b { color: var(--text); font-weight: 650; }
.calc-row.total { border-top: 1px dashed rgba(255,255,255,.22); margin-top: 6px; padding-top: 14px; color: var(--text); font-weight: 700; font-size: 15px; }
.calc-row.total b { font-size: 18px; }
.diff-badge { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.diff-ok { background: rgba(98,163,41,.25); color: #b6ec8e; }
.diff-ko { background: rgba(255,122,138,.2); color: #ffb3bd; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.06); border: 1px solid var(--line); cursor: pointer; transition: all .25s var(--ease); }
.chip:hover { color: var(--text); }
.chip.is-on { color: #fff; background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.22); }

/* ---------------- tabelle ---------------- */
.table-wrap { overflow: auto; border-radius: 16px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
  color: var(--faint); padding: 10px 12px; white-space: nowrap; position: sticky; top: 0;
  background: rgba(10, 30, 62, .6); backdrop-filter: blur(10px);
}
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: rgba(255,255,255,.045); }
.table tbody tr.row-in { animation: rowIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms + 200ms); }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 800; border-top: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.05); }
.table tr.is-hidden { display: none; }
.table a.rowlink { font-weight: 650; }
.table a.rowlink:hover { color: var(--yellow); }
.cat { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.method { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.method .ic { width: 15px; height: 15px; opacity: .8; }

/* ---------------- grafico giornaliero ---------------- */
.daychart { display: flex; align-items: flex-end; gap: 5px; height: 190px; padding-top: 12px; }
.daycol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 6px; position: relative; min-width: 0; }
.daystack { display: flex; flex-direction: column-reverse; border-radius: 8px; overflow: hidden; height: 0; transition: height 1s var(--ease); transition-delay: calc(var(--i, 0) * 22ms + 200ms); background: rgba(255,255,255,.05); }
.daystack span { display: block; }
.daycol small { text-align: center; color: var(--faint); font-size: 10px; }
.daycol:hover .daystack { filter: brightness(1.25); }
.daycol .tip {
  position: absolute; bottom: calc(100% - 10px); left: 50%; transform: translate(-50%, 6px); opacity: 0; pointer-events: none;
  padding: 8px 10px; border-radius: 12px; font-size: 11.5px; white-space: nowrap; z-index: 3;
  background: rgba(6, 20, 46, .92); border: 1px solid var(--line); transition: opacity .2s, transform .25s var(--ease);
}
.daycol:hover .tip { opacity: 1; transform: translate(-50%, 0); }
.c-cash { background: linear-gradient(180deg, #7fe0f5, #2c9fd0); }
.c-pos { background: linear-gradient(180deg, #8eb2ff, #3f6fd0); }
.c-altro { background: linear-gradient(180deg, #b6ec8e, #5ea82d); }
.c-out { background: linear-gradient(180deg, #ffb3bd, #e05a6b); }

/* tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(4,16,38,.35); border: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 650; font-size: 13px; color: var(--muted); cursor: pointer; transition: all .3s var(--ease); }
.tab.is-on { background: rgba(255,255,255,.16); color: #fff; }
.tab-panel[hidden] { display: none; }
.tab-panel { animation: rise .5s var(--ease) both; }

/* ---------------- form ---------------- */
.field { display: grid; gap: 7px; margin-bottom: 14px; }
[data-show-if][hidden] { display: none !important; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 14px; font: inherit; color: var(--text);
  background: var(--field); border: 1px solid rgba(255,255,255,.14); outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cfe0ff' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 38px; }
select.input option { background: #0b2148; color: var(--text); }
.input:focus { border-color: rgba(249, 203, 20, .75); box-shadow: 0 0 0 4px rgba(249,203,20,.18); background: rgba(6,20,46,.55); }
.input::placeholder { color: rgba(222,234,255,.35); }
.input-amount { font-size: 30px; font-weight: 800; letter-spacing: -.02em; padding: 14px 18px 14px 44px; font-variant-numeric: tabular-nums; }
.amount-field { position: relative; }
.amount-field::before { content: '€'; position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 700; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type="date"].input, input[type="time"].input, input[type="month"].input { color-scheme: dark; }
input[type="color"].input { padding: 4px; height: 46px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--cyan); }

.choice { display: flex; gap: 6px; flex-wrap: wrap; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px; cursor: pointer; font-weight: 650; font-size: 13px; color: var(--muted); background: rgba(255,255,255,.06); border: 1px solid var(--line); transition: all .25s var(--ease); }
.choice label .ic { width: 16px; height: 16px; }
.choice input:checked + label { color: #fff; background: rgba(255,255,255,.17); border-color: rgba(255,255,255,.3); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.choice input:focus-visible + label { outline: 2px solid var(--cyan); outline-offset: 2px; }
.choice.type-choice input[value="entrata"]:checked + label { background: rgba(98,163,41,.35); border-color: rgba(155,225,93,.5); }
.choice.type-choice input[value="uscita"]:checked + label { background: rgba(255,122,138,.28); border-color: rgba(255,150,165,.5); }

/* ---------------- modal ---------------- */
dialog.modal { border: 0; padding: 0; background: transparent; color: inherit; width: min(520px, calc(100% - 28px)); max-height: calc(100vh - 40px); overflow: visible; }
dialog.modal::backdrop { background: rgba(2, 10, 26, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .3s both; }
.modal-body { border-radius: 28px; padding: 26px; max-height: calc(100vh - 40px); overflow: auto; background: linear-gradient(150deg, rgba(40, 80, 140, .55), rgba(10, 30, 66, .75)); }
dialog[open] .modal-body { animation: pop .45s var(--spring) both; }
dialog.closing .modal-body { animation: popOut .22s ease-in both; }
dialog.closing::backdrop { animation: fade .22s reverse both; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.94); } }
@keyframes popOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes fade { from { opacity: 0; } }

/* ---------------- toast ---------------- */
.toasts { position: fixed; top: 22px; right: 22px; display: grid; gap: 10px; z-index: 100; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; font-weight: 600;
  background: rgba(10, 34, 70, .82); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px -18px rgba(0,0,0,.7);
  animation: toastIn .55s var(--spring) both, toastOut .4s ease-in 4.5s forwards;
}
.toast .ic { width: 18px; height: 18px; color: var(--lime); }
.toast-err .ic { color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); visibility: hidden; } }

/* ---------------- stati vuoti / hero ---------------- */
.hero-open { display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px; align-items: center; padding: 34px; }
.hero-open h2 { font-size: 28px; margin: 6px 0 10px; letter-spacing: -.02em; }
.hero-open p { color: var(--muted); margin: 0 0 20px; max-width: 46ch; }
.hero-art { display: grid; place-items: center; }
.hero-art svg { width: min(260px, 100%); filter: drop-shadow(0 20px 40px rgba(62,184,215,.35)); animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-10px) rotate(-2deg); } }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { width: 38px; height: 38px; opacity: .6; margin-bottom: 10px; }
.eyebrow { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--yellow); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; margin-bottom: 16px; background: rgba(98,163,41,.16); border: 1px solid rgba(155,225,93,.28); }
.banner.warn { background: rgba(233,192,70,.13); border-color: rgba(233,192,70,.3); }

/* ---------------- login / install ---------------- */
body.auth { display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(430px, 100%); border-radius: 32px; padding: 36px 34px; animation: windowIn .9s var(--ease) both; }
.auth-card.wide { width: min(560px, 100%); }
.auth-brand { margin-bottom: 28px; }
.auth-card h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card p.lead { color: var(--muted); margin: 0 0 24px; }
.auth-card .btn { width: 100%; padding: 13px; font-size: 15px; margin-top: 6px; }
.form-error { padding: 11px 14px; border-radius: 14px; background: rgba(255,122,138,.16); border: 1px solid rgba(255,122,138,.35); color: #ffc4cb; margin-bottom: 16px; font-weight: 600; }
.auth-foot { margin-top: 22px; text-align: center; color: var(--faint); font-size: 12px; }

/* ---------------- conteggio banconote ---------------- */
dialog.modal.modal-wide { width: min(1020px, calc(100% - 24px)); }
.modal-wide .modal-head { align-items: flex-start; }
.cc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-head .spacer { flex: 1; }
.cc-base label { font-size: 12.5px; padding: 8px 13px; }
.cc-hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 16px; }
.cc-title { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin: 0 0 10px; }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.cc-grid.cc-coins { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.cc-coins .cc-tile { padding: 10px 6px 8px; }
.cc-coins .cc-ctrl { gap: 3px; }
.cc-coins .cc-ctrl button { width: 25px; height: 25px; font-size: 15px; }
.cc-coins .cc-ctrl input { width: 40px; }
.cc-tile { min-width: 0; }
.cc-tile {
  display: grid; justify-items: center; gap: 8px; padding: 12px 10px 10px; border-radius: 18px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  transition: background .3s, border-color .3s, transform .35s var(--spring);
}
.cc-tile.has-count { background: rgba(249,203,20,.09); border-color: rgba(249,203,20,.38); }
.cc-hit { position: relative; width: 100%; border: 0; background: none; padding: 0; cursor: pointer; display: grid; place-items: center; transition: transform .35s var(--spring); -webkit-tap-highlight-color: transparent; }
.cc-hit:hover { transform: translateY(-3px) rotate(-1.5deg); }
.cc-hit:active { transform: scale(.93); }
.cc-hit:focus-visible { outline: 2px solid var(--yellow); outline-offset: 4px; border-radius: 8px; }
.note-img { width: 100%; height: auto; aspect-ratio: 320 / 168; object-fit: contain; display: block; border-radius: 5px; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 8px 14px rgba(0,0,0,.45)); }
.coin-img { width: calc(68px * var(--d, 1)); height: auto; aspect-ratio: 1; display: block; border-radius: 50%; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.cc-badge {
  position: absolute; top: -9px; right: -7px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #2a2205;
  background: linear-gradient(135deg, #ffe264, var(--yellow-2)); box-shadow: 0 6px 14px -4px rgba(249,203,20,.8);
  transform: scale(0); transition: transform .35s var(--spring);
}
.cc-tile.has-count .cc-badge { transform: scale(1); }
.cc-badge.bump { animation: ccBump .38s var(--spring); }
@keyframes ccBump { 45% { transform: scale(1.4); } }
.cc-ctrl { display: flex; align-items: center; gap: 5px; }
.cc-ctrl button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--text); font-size: 16px; font-weight: 800; line-height: 1; cursor: pointer; transition: background .2s, transform .25s var(--spring); }
.cc-ctrl button:hover { background: rgba(255,255,255,.18); }
.cc-ctrl button:active { transform: scale(.88); }
.cc-ctrl input { width: 54px; padding: 5px 4px; text-align: center; border-radius: 10px; font: inherit; font-weight: 800; color: var(--text); background: var(--field); border: 1px solid rgba(255,255,255,.14); -moz-appearance: textfield; appearance: textfield; }
.cc-ctrl input::-webkit-outer-spin-button, .cc-ctrl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cc-ctrl input:focus { outline: none; border-color: rgba(249,203,20,.75); box-shadow: 0 0 0 3px rgba(249,203,20,.18); }
.cc-sub { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cc-title-coins { display: flex; justify-content: space-between; align-items: baseline; margin-top: 22px; }
.cc-title-coins small { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.cc-coins .cc-hit { height: 70px; }
.cc-summary {
  position: sticky; bottom: -26px; z-index: 2; margin-top: 18px; padding: 14px 18px 16px; border-radius: 20px;
  background: rgba(12, 24, 48, .93); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.14); box-shadow: 0 -12px 30px -8px rgba(0,0,0,.45);
  transition: border-color .3s, box-shadow .3s;
}
.cc-sum-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; align-items: end; }
.cc-sum-row small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.cc-sum-row strong { font-size: 27px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cc-sum-row b { font-size: 17px; font-variant-numeric: tabular-nums; }
.cc-progress { height: 8px; margin-top: 12px; border-radius: 9px; background: rgba(255,255,255,.08); overflow: hidden; }
.cc-progress span { display: block; height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, #ffe264, var(--yellow-2)); transition: width .5s var(--ease), background .3s; }
.cash-counter.is-ok .cc-progress span { background: linear-gradient(90deg, #8bd65a, #3f8f28); }
.cash-counter.is-over .cc-progress span { background: linear-gradient(90deg, #ff9aa6, #d4485c); }
.cash-counter.is-ok .cc-summary { border-color: rgba(155,225,93,.55); box-shadow: 0 0 0 1px rgba(155,225,93,.2), 0 -12px 30px -8px rgba(0,0,0,.45); }
.cc-fly { position: fixed; z-index: 50; pointer-events: none; margin: 0; }
.shake { animation: ccShake .4s; }
@keyframes ccShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* storico conteggi nel foglio */
.cc-log { border-top: 1px solid var(--line); }
.cc-log summary { display: flex; align-items: center; gap: 8px; padding: 10px 0; cursor: pointer; list-style: none; }
.cc-log summary::-webkit-details-marker { display: none; }
.cc-log summary b { margin-left: auto; }
.cc-log-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cc-log-body { padding: 0 0 12px; animation: rise .35s var(--ease) both; }
.cc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-chip { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.08); white-space: nowrap; }
.cc-chip.chip-note b { color: var(--yellow); }

@media (max-width: 560px) {
  .cc-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .cc-sum-row strong { font-size: 20px; }
  .cc-base { width: 100%; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-top { grid-template-columns: 1fr 1fr; }
  .dash-top > :last-child { grid-column: 1 / -1; }
  .sheet-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body.app { padding: 12px 12px 100px; }
  .window { padding: 18px 16px 22px; border-radius: 26px; }
  .dock { top: auto; bottom: 14px; left: 50%; transform: translateX(-50%); flex-direction: row; animation: none; }
  .dock-sep { width: 1px; height: 22px; margin: 0 4px; }
  .dock-tip { display: none; }
  .dock-item:has(+ .dock-item:hover), .dock-item:hover + .dock-item { transform: none; }
  .topbar { flex-wrap: wrap; }
  .page-title { display: none; }
  .brand-logo { height: 38px; }
  .topbar-right { width: 100%; justify-content: space-between; margin-left: 0; }
  .user-meta { display: none; }
  .user-chip { padding: 2px; }
  .dash-top, .dash-bottom { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .hero-open { grid-template-columns: 1fr; padding: 24px; }
  .hero-art { display: none; }
  .seg { max-width: 100%; overflow-x: auto; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-val { font-size: 18px; }
  .bars { gap: 6px; }
  .row2 { grid-template-columns: 1fr; }
  .date-big { font-size: 19px; }
  .daychart { gap: 2px; }
  .daycol small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  @view-transition { navigation: none; }
}

/* ---------------- stampa ---------------- */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body, body.app { background: #fff !important; color: #000; padding: 0; font-size: 11px; }
  .scene, .dock, .toasts, .no-print, .topbar-right, .tabs { display: none !important; }
  .window { box-shadow: none; border: 0; background: #fff; backdrop-filter: none; padding: 0; max-width: none; animation: none; }
  .card { background: #fff !important; border: 1px solid #bbb; break-inside: avoid; }
  .card::before { display: none; }
  .reveal, .tab-panel, .row-in { animation: none !important; }
  .tab-panel[hidden] { display: block !important; }
  .muted, .card-sub, .kpi-top, .kpi-sub, .table th, .brand small { color: #555 !important; }
  .table th { background: #eee !important; position: static; }
  .table td { border-top: 1px solid #ccc; }
  .pos, .neg { color: #000; }
  .daychart { display: none; }
  .kpi-ic { display: none; }
  .brand-logo { filter: invert(1) hue-rotate(180deg); }
}
