/* =====================================================================
   Gestionale — stile "glass a specchio"
   Vetro smerigliato su sfondo a gradienti, con riflessi e bordi luminosi.
   ===================================================================== */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-xl: 26px; --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --cyan: #22d3ee; --violet: #8b5cf6; --indigo: #6366f1;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #c026d3 120%);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #070a18;
  --text: #eef1ff; --muted: #a7b0d0; --faint: #7b84a6;
  --accent: #a5b4fc;
  --glass: rgba(255, 255, 255, .07);
  --glass-2: rgba(255, 255, 255, .11);
  --glass-hover: rgba(255, 255, 255, .15);
  --glass-border: rgba(255, 255, 255, .16);
  --glass-edge: rgba(255, 255, 255, .34);
  --sheen: rgba(255, 255, 255, .13);
  --shadow: 0 14px 44px rgba(2, 4, 24, .5);
  --input-bg: rgba(8, 12, 32, .35);
  --divider: rgba(255, 255, 255, .09);
  --blob1: #4338ca; --blob2: #0891b2; --blob3: #a21caf;
  --blob-opacity: .55;
  --danger: #fb7185; --ok: #34d399; --warn: #fbbf24;
  --dialog-bg: rgba(18, 22, 50, .72);
}
[data-theme="light"] {
  color-scheme: light;
  --bg-base: #e9edff;
  --text: #14172e; --muted: #535c80; --faint: #7f88a8;
  --accent: #4338ca;
  --glass: rgba(255, 255, 255, .52);
  --glass-2: rgba(255, 255, 255, .72);
  --glass-hover: rgba(255, 255, 255, .88);
  --glass-border: rgba(255, 255, 255, .8);
  --glass-edge: rgba(255, 255, 255, 1);
  --sheen: rgba(255, 255, 255, .75);
  --shadow: 0 12px 38px rgba(70, 80, 160, .17);
  --input-bg: rgba(255, 255, 255, .7);
  --divider: rgba(40, 50, 120, .1);
  --blob1: #a5b4fc; --blob2: #7dd3fc; --blob3: #f0abfc;
  --blob-opacity: .75;
  --danger: #e11d48; --ok: #059669; --warn: #b45309;
  --dialog-bg: rgba(255, 255, 255, .8);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  color: var(--text); background: var(--bg-base);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(139, 92, 246, .4); }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { margin-left: auto; }

/* ---------- sfondo ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(1200px 700px at 80% -10%, color-mix(in srgb, var(--blob2) 18%, transparent), transparent 60%),
  var(--bg-base); }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: var(--blob-opacity); will-change: transform; animation: drift 26s ease-in-out infinite alternate; }
.b1 { width: 52vmax; height: 52vmax; left: -14vmax; top: -16vmax; background: var(--blob1); }
.b2 { width: 44vmax; height: 44vmax; right: -12vmax; top: 8vh; background: var(--blob2); animation-delay: -8s; }
.b3 { width: 48vmax; height: 48vmax; left: 22vw; bottom: -26vmax; background: var(--blob3); animation-delay: -15s; }
@keyframes drift { to { transform: translate3d(6vw, 4vh, 0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } * { transition: none !important; } }

/* ---------- vetro ---------- */
.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 rgba(255, 255, 255, .04);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
}
/* riflesso diagonale, come su uno specchio */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  background:
    linear-gradient(115deg, var(--sheen) 0%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 64%, rgba(255, 255, 255, .06) 100%);
}
.glass > * { position: relative; z-index: 1; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--dialog-bg); }
}
.card { padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 650; letter-spacing: .1px; }
.card-head .ic { color: var(--accent); }
.divider { height: 1px; background: var(--divider); margin: 14px 0; }

/* ---------- layout ---------- */
#app { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 22px; padding: 20px; min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: 20px; height: calc(100vh - 40px); height: calc(100dvh - 40px); display: flex; flex-direction: column; padding: 18px 14px; border-radius: var(--r-xl); }
.topbar, .tabbar { display: none; }
#view { min-width: 0; width: 100%; max-width: 1200px; margin: 0 auto; outline: none; padding-bottom: 40px; animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.logo { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 8px 22px rgba(99, 102, 241, .5), inset 0 1px 0 rgba(255, 255, 255, .55); flex: none; }
.brand b { display: block; font-size: 16px; letter-spacing: .2px; }
.brand span { font-size: 12px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--muted); font-weight: 560; transition: background .2s, color .2s; border: 1px solid transparent; }
.nav a:hover { background: var(--glass-2); color: var(--text); }
.nav a.active { color: var(--text); background: var(--glass-2); border-color: var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-edge), 0 6px 18px rgba(0, 0, 0, .12); }
.nav a.active .ic { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--danger); color: #fff; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-border); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--grad); flex: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.avatar.lg { width: 68px; height: 68px; font-size: 24px; box-shadow: 0 10px 28px rgba(99, 102, 241, .45), inset 0 1px 0 rgba(255, 255, 255, .55); }
.user-chip small { display: block; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  #app { display: block; padding: 0; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: calc(10px + env(safe-area-inset-top)); z-index: 30; margin: calc(10px + env(safe-area-inset-top)) 12px 0; padding: 10px 14px; border-radius: 20px; }
  .topbar .logo { width: 34px; height: 34px; border-radius: 11px; }
  .topbar h1 { font-size: 17px; font-weight: 700; }
  #view { padding: 16px 12px calc(120px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 24px; }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border: 0; background: none; border-radius: 16px; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; position: relative; }
  .tabbar a.active { color: var(--text); background: var(--glass-2); box-shadow: inset 0 1px 0 var(--glass-edge); }
  .tabbar a.active .ic { color: var(--accent); }
  .tabbar .plus { width: 54px; height: 54px; margin: -22px auto 0; padding: 0; border-radius: 50%; background: var(--grad); color: #fff; box-shadow: 0 10px 26px rgba(99, 102, 241, .6), inset 0 1px 0 rgba(255, 255, 255, .6); display: grid; place-items: center; }
  .tabbar .badge-dot { position: absolute; top: 4px; right: calc(50% - 20px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
}

/* ---------- intestazione di pagina ---------- */
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 4px 2px 20px; }
.page-head h1 { font-size: 28px; line-height: 1.15; font-weight: 750; letter-spacing: -.4px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 900px) { .page-head h1 { font-size: 24px; } .page-head.hide-sm { display: none; } }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--glass-border); background: var(--glass-2); color: var(--text);
  font-weight: 620; font-size: 14px; cursor: pointer; white-space: nowrap; transition: transform .15s var(--ease), background .2s, box-shadow .2s;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 4px 14px rgba(0, 0, 0, .1);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.btn:hover { background: var(--glass-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--grad); border-color: rgba(255, 255, 255, .4); color: #fff; box-shadow: 0 10px 26px rgba(99, 102, 241, .45), inset 0 1px 0 rgba(255, 255, 255, .55); }
.btn.primary:hover { filter: brightness(1.08); background: var(--grad); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: linear-gradient(135deg, #f43f5e, #e11d48); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; backdrop-filter: none; }
.btn.ghost:hover { background: var(--glass-2); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.icon { width: 42px; padding: 0; }
.btn.icon.sm { width: 34px; }
.btn.block { width: 100%; }
.btn.ok { color: var(--ok); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- form ---------- */
input, select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--input-bg);
  border: 1px solid var(--glass-border); border-radius: 13px; padding: 10px 13px; min-height: 42px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(99, 102, 241, .25); }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
select option { color: #14172e; background: #fff; }
[data-theme="dark"] select option { color: #eef1ff; background: #1a1f45; }
input[type="color"] { padding: 3px; width: 42px; min-width: 42px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: #7c83ff; box-shadow: none; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } input, select, textarea { font-size: 16px; } }
.form-error { color: var(--danger); font-size: 14px; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 14%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.hint { font-size: 13px; color: var(--muted); }
.warn-box { padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); font-size: 14px; margin-bottom: 14px; }
.warn-box a { text-decoration: underline; font-weight: 600; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin-bottom: 16px; font-size: 14px; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box { width: 22px; height: 22px; border-radius: 7px; flex: none; border: 1px solid var(--glass-border); background: var(--input-bg); display: grid; place-items: center; transition: .2s; }
.check input:checked + .box { background: var(--grad); border-color: transparent; box-shadow: 0 4px 12px rgba(99, 102, 241, .45); }
.check input:checked + .box::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + .box { outline: 2px solid var(--cyan); outline-offset: 2px; }
.check small { color: var(--muted); }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 15px; background: var(--input-bg); border: 1px solid var(--glass-border); flex-wrap: wrap; }
.seg button, .seg label { border: 0; background: transparent; padding: 7px 14px; border-radius: 11px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: .2s; }
.seg button:hover, .seg label:hover { color: var(--text); }
.seg .on, .seg input:checked + span { background: var(--glass-hover); color: var(--text); box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 10px rgba(0, 0, 0, .15); }
.seg.full { display: flex; } .seg.full > * { flex: 1; justify-content: center; }
.seg label { position: relative; padding: 0; }
.seg label input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.seg label span { padding: 8px 12px; border-radius: 11px; display: inline-flex; align-items: center; gap: 6px; width: 100%; justify-content: center; }
.seg label input:focus-visible + span { outline: 2px solid var(--cyan); }

.pw { position: relative; }
.pw input { padding-right: 84px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent); font-weight: 650; font-size: 13px; padding: 8px; cursor: pointer; border-radius: 8px; }

/* ---------- badge / chip ---------- */
.badge { --c: #64748b; display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 1.5; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 22%, transparent); color: color-mix(in srgb, var(--c) 52%, var(--text)); border: 1px solid color-mix(in srgb, var(--c) 42%, transparent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.badge.plain::before { display: none; }
.badge.tag { padding-left: 11px; font-weight: 600; }
.badge.tag::before { display: none; }
.badge.danger { --c: #f43f5e; } .badge.ok { --c: #10b981; } .badge.warn { --c: #f59e0b; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-btn { cursor: pointer; border: 1px dashed var(--glass-border); background: transparent; color: var(--muted); padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.chip-btn:hover { color: var(--text); background: var(--glass-2); }
.tagpick { display: flex; flex-wrap: wrap; gap: 8px; }
.tagpick label { cursor: pointer; }
.tagpick input { position: absolute; opacity: 0; }
.tagpick .badge { opacity: .55; transition: .2s; border-style: dashed; }
.tagpick input:checked + .badge { opacity: 1; border-style: solid; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent); }
.tagpick input:focus-visible + .badge { outline: 2px solid var(--cyan); }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat { padding: 18px 18px 16px; display: block; transition: transform .2s var(--ease), background .2s; cursor: pointer; overflow: hidden; }
.stat:hover { transform: translateY(-3px); background: var(--glass-2); }
.stat .lbl { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .lbl .ic { color: var(--accent); }
.stat .num { font-size: 34px; font-weight: 780; letter-spacing: -1px; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.alert .num { color: var(--danger); }
.stat .glow { position: absolute; width: 120px; height: 120px; right: -30px; top: -40px; border-radius: 50%; background: var(--g, var(--indigo)); filter: blur(46px); opacity: .45; z-index: 0; pointer-events: none; }
@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; gap: 12px; } .stat .num { font-size: 28px; } }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-grid .card + .card { margin-top: 18px; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

.hello { display: flex; align-items: center; gap: 14px; }
.hello .date { color: var(--muted); text-transform: capitalize; }

.tasks { display: flex; flex-direction: column; gap: 8px; }
.task { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); transition: background .2s, transform .2s var(--ease); cursor: pointer; }
.task:hover { background: var(--glass-2); transform: translateX(2px); }
.task .when { text-align: center; padding: 6px 0; border-radius: 12px; background: var(--input-bg); border: 1px solid var(--glass-border); line-height: 1.15; }
.task .when b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.task .when small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.task.late .when { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.task.late .when b { color: var(--danger); }
.task .who { min-width: 0; }
.task .who b { display: block; font-weight: 650; }
.task .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; margin-top: 2px; }
.task .meta .ic { margin-right: 3px; margin-top: -2px; }
.task .acts { display: flex; gap: 6px; }
.task.done { opacity: .6; }
.task.done .who b { text-decoration: line-through; }
@media (max-width: 560px) { .task { grid-template-columns: 54px minmax(0, 1fr); } .task .acts { grid-column: 1 / -1; justify-content: flex-end; } }
.sync-ok { color: var(--ok); } .sync-err { color: var(--warn); }

.empty { text-align: center; padding: 30px 14px; color: var(--muted); }
.empty .ic { color: var(--accent); opacity: .8; margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; cursor: pointer; border-radius: 10px; padding: 2px 4px; }
.bar:hover { background: var(--glass); }
.bar .name { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 560; min-width: 0; }
.bar .name i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.bar .n { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.bar .track { grid-column: 1 / -1; height: 7px; border-radius: 9px; background: var(--input-bg); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 9px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 60%, transparent); min-width: 3px; transform-origin: left; animation: grow .8s var(--ease); }
@keyframes grow { from { transform: scaleX(0); } }

.spark { display: flex; align-items: flex-end; gap: 5px; height: 92px; }
.spark i { flex: 1; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #a5b4fc, #6366f1); min-height: 4px; opacity: .9; position: relative; }
.spark i.zero { background: var(--glass-2); opacity: 1; }
.spark-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; }

/* ---------- elenco contatti ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; margin-bottom: 14px; align-items: center; }
.toolbar .search { position: relative; flex: 1 1 260px; min-width: 200px; }
.toolbar .search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.toolbar .search input { padding-left: 40px; }
.toolbar select { width: auto; min-width: 150px; flex: 1 1 150px; max-width: 220px; }
@media (max-width: 640px) { .toolbar select { max-width: none; flex: 1 1 45%; min-width: 0; } }

.list-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.clist { padding: 8px; }
.chead, .crow { display: grid; grid-template-columns: 34px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px; }
.chead { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); }
.chead button { background: none; border: 0; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; text-align: left; display: inline-flex; gap: 4px; align-items: center; }
.chead button:hover, .chead button.on { color: var(--text); }
.crow { border-radius: 16px; cursor: pointer; transition: background .15s; border: 1px solid transparent; }
.crow + .crow { margin-top: 2px; }
.crow:hover { background: var(--glass-2); border-color: var(--glass-border); }
.crow.sel { background: color-mix(in srgb, var(--indigo) 20%, transparent); border-color: color-mix(in srgb, var(--indigo) 45%, transparent); }
.crow .nm { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crow .nm b { display: block; font-weight: 650; }
.crow .nm small { display: block; color: var(--muted); font-size: 12.5px; }
.crow .nm .avatar { width: 38px; height: 38px; font-size: 13px; }
.crow .nm > div { min-width: 0; }
.crow .nm b, .crow .nm small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .c-tags { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.crow .c-last { color: var(--muted); font-size: 13px; }
.crow .when-late { color: var(--danger); font-weight: 650; }
.crow .sel-box { display: grid; place-items: center; }
.list-foot { display: flex; justify-content: center; padding: 14px; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .chead { display: none; }
  .crow { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "chk name badge" ". phone next"; row-gap: 6px; padding: 12px 10px; }
  .crow > :nth-child(1) { grid-area: chk; }
  .crow > :nth-child(2) { grid-area: name; }
  .crow > :nth-child(3) { grid-area: phone; font-size: 13.5px; color: var(--muted); }
  .crow > :nth-child(4) { grid-area: badge; justify-self: end; }
  .crow .c-tags { align-items: flex-end; }
  .crow .c-tags .chips { display: none; }
  .crow > :nth-child(5) { grid-area: next; justify-self: end; font-size: 13px; }
  .crow > :nth-child(6) { display: none; }
}
.bulkbar { position: sticky; top: 12px; z-index: 20; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: 18px; }
@media (max-width: 900px) { .bulkbar { top: 70px; } }
.bulkbar select { width: auto; min-width: 150px; }
.fab { display: none; }

/* ---------- scheda contatto ---------- */
.hero { padding: 22px; display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.hero .info { flex: 1 1 280px; min-width: 0; }
.hero h1 { font-size: 26px; font-weight: 760; letter-spacing: -.4px; line-height: 1.15; }
.hero .sub { color: var(--muted); margin-top: 4px; }
.hero .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.hero .esito-select { width: auto; min-width: 190px; font-weight: 650; padding-left: 34px; }
.esito-wrap { position: relative; }
.esito-wrap i { position: absolute; left: 14px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); pointer-events: none; }
.crumbs { display: flex; align-items: center; gap: 8px; margin: 0 2px 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }
.cols > div > .card + .card { margin-top: 18px; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 560; } .kv dd { margin: 0; word-break: break-word; }
.kv a { color: var(--accent); font-weight: 600; }

.composer { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.composer .line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.composer input[type="datetime-local"] { width: auto; flex: 1 1 200px; }
.timeline { position: relative; display: flex; flex-direction: column; gap: 12px; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, var(--indigo), transparent); opacity: .5; }
.tl { position: relative; padding: 12px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); }
.tl::before { content: ""; position: absolute; left: -21px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 4px var(--bg-base), 0 0 14px rgba(139, 92, 246, .7); }
.tl.sys { background: transparent; border-style: dashed; padding: 8px 14px; }
.tl.sys::before { background: var(--faint); width: 8px; height: 8px; left: -19px; top: 14px; box-shadow: 0 0 0 4px var(--bg-base); }
.tl .head { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.tl .head .tools { margin-left: auto; display: flex; gap: 2px; opacity: .55; }
.tl:hover .head .tools { opacity: 1; }
.tl .body { white-space: pre-wrap; word-break: break-word; }
.tl.sys .body { color: var(--muted); font-size: 13.5px; }

/* ---------- agenda ---------- */
.day-group { margin-bottom: 22px; }
.day-group > h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 0 4px 10px; display: flex; gap: 10px; align-items: center; }
.day-group > h3.late { color: var(--danger); }
.day-group > h3 .badge { text-transform: none; letter-spacing: 0; }

/* ---------- import ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--glass); border: 1px solid var(--glass-border); }
.step i { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font-style: normal; font-size: 12px; background: var(--input-bg); }
.step.on { color: var(--text); background: var(--glass-2); }
.step.on i { background: var(--grad); color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, .5); }
.step.done i { background: var(--ok); color: #fff; }
.drop { border: 2px dashed var(--glass-border); border-radius: 22px; padding: 44px 20px; text-align: center; cursor: pointer; transition: .2s; background: var(--glass); }
.drop:hover, .drop.over { border-color: var(--indigo); background: color-mix(in srgb, var(--indigo) 14%, transparent); }
.drop .ic { color: var(--accent); margin-bottom: 8px; }
.drop b { display: block; font-size: 16px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 14px; }
.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid var(--glass-border); max-height: 360px; }
table.t { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.t th { position: sticky; top: 0; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 9px 12px; background: var(--dialog-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); white-space: nowrap; }
table.t td { padding: 8px 12px; border-top: 1px solid var(--divider); white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 14px 16px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); }
.tile b { display: block; font-size: 26px; font-weight: 760; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12.5px; color: var(--muted); }
.tile.good b { color: var(--ok); } .tile.bad b { color: var(--danger); } .tile.mid b { color: var(--warn); }
.radio-card { display: flex; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--glass-border); background: var(--glass); cursor: pointer; margin-bottom: 10px; align-items: flex-start; }
.radio-card:has(input:checked) { border-color: var(--indigo); background: color-mix(in srgb, var(--indigo) 16%, transparent); }
.radio-card input { margin-top: 3px; }
.radio-card b { display: block; }

/* ---------- impostazioni ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.settings-grid .card + .card { margin-top: 0; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: 1fr; } }
.status { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); margin-bottom: 14px; }
.status .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--faint); flex: none; }
.status.on .dot { background: var(--ok); box-shadow: 0 0 12px var(--ok); }
.status.bad .dot { background: var(--warn); box-shadow: 0 0 12px var(--warn); }
.label-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.label-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.label-row .uso { font-size: 12px; color: var(--faint); white-space: nowrap; }
.label-row .btns { display: flex; gap: 2px; }
.add-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 8px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; padding: 3px 8px; border-radius: 8px; background: var(--input-bg); border: 1px solid var(--glass-border); word-break: break-all; }

/* ---------- dialog ---------- */
dialog.dlg { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(560px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); overflow: visible; }
dialog.dlg.wide { max-width: min(780px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(5, 8, 24, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.dlg-card { background: var(--dialog-bg); display: flex; flex-direction: column; max-height: calc(100dvh - 24px); border-radius: var(--r-xl); animation: pop .28s var(--ease); -webkit-backdrop-filter: blur(34px) saturate(180%); backdrop-filter: blur(34px) saturate(180%); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; }
.dlg-head h2 { font-size: 18px; font-weight: 700; flex: 1; }
.dlg-body { padding: 4px 20px 6px; overflow: auto; overscroll-behavior: contain; }
.dlg-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px 18px; flex-wrap: wrap; }
@media (max-width: 640px) {
  dialog.dlg { max-width: 100vw; margin: auto 0 0; }
  .dlg-card { border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); animation-name: sheet; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .dlg-foot .btn { flex: 1; }
}
.dup-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.dup { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-border); }
.dup b { display: block; } .dup small { color: var(--muted); }
.rem-list { display: flex; flex-direction: column; gap: 10px; }
.rem { padding: 14px; border-radius: 18px; background: var(--glass); border: 1px solid var(--glass-border); }
.rem .top { display: flex; gap: 12px; align-items: center; }
.rem .top b { font-size: 16px; display: block; }
.rem .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick-dates button { border: 1px solid var(--glass-border); background: var(--glass); border-radius: 99px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.quick-dates button:hover { color: var(--text); background: var(--glass-2); }

/* ---------- toast / loader ---------- */
#toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 440px); }
@media (max-width: 900px) { #toasts { bottom: calc(100px + env(safe-area-inset-bottom)); } }
.toast { pointer-events: auto; padding: 12px 18px; border-radius: 16px; font-weight: 600; font-size: 14px; background: var(--dialog-bg); border: 1px solid var(--glass-border); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); animation: pop .3s var(--ease); display: flex; gap: 10px; align-items: center; }
.toast.err { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.toast.err .ic { color: var(--danger); } .toast.ok .ic { color: var(--ok); }
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--glass-border); border-top-color: var(--indigo); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; padding: 20px; }
.login-wrap { width: 100%; max-width: 410px; }
.login-card { padding: 30px 28px 24px; border-radius: 30px; animation: pop .5s var(--ease); }
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-brand .logo { width: 54px; height: 54px; border-radius: 18px; }
.login-brand h1 { font-size: 24px; font-weight: 780; letter-spacing: -.4px; }
.login-brand p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.login-foot { text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--faint); }
.login-card .btn.primary { height: 48px; font-size: 15.5px; }

/* ---------- accesso con Google ---------- */
.btn.google { background: #fff; color: #1f2937; border-color: rgba(255, 255, 255, .9); height: 48px; font-size: 15.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .22), inset 0 -2px 0 rgba(0, 0, 0, .05); gap: 12px; }
.btn.google:hover { background: #f3f4f6; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12.5px; margin: 18px 0; text-transform: uppercase; letter-spacing: .6px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--divider); }
.login-card .check { margin-top: 14px; }
.login-card .check:first-of-type { margin-top: 16px; }

/* colonne più comode quando lo spazio è poco (menu laterale + contenuto) */
.chead, .crow { grid-template-columns: 34px minmax(170px, 1.8fr) minmax(105px, .9fr) minmax(150px, 1.3fr) minmax(115px, 1fr) minmax(90px, .7fr); }
@media (max-width: 1280px) and (min-width: 901px) {
  .chead, .crow { grid-template-columns: 34px minmax(170px, 1.8fr) minmax(105px, .9fr) minmax(150px, 1.3fr) minmax(120px, 1fr); }
  .chead > :nth-child(6), .crow > :nth-child(6) { display: none; }
}

/* righe dei ricontatti: se il riquadro è stretto, i pulsanti vanno sotto */
.tasks { container-type: inline-size; }
@container (max-width: 560px) {
  .task { grid-template-columns: 56px minmax(0, 1fr); }
  .task .acts { grid-column: 1 / -1; justify-content: flex-end; }
}
.kv dd { overflow-wrap: anywhere; }
.drop { display: block; }

/* ---------- accesso / registrazione ---------- */
.form-ok { color: var(--ok); font-size: 14px; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.tabs { margin-bottom: 18px; }
.tabs a { text-align: center; padding: 9px 14px; border-radius: 11px; font-weight: 650; font-size: 14px; color: var(--muted); }
.tabs a.on { background: var(--glass-hover); color: var(--text); box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 10px rgba(0, 0, 0, .15); }
.login-links { text-align: center; margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.login-links a { color: var(--accent); font-weight: 600; text-decoration: underline; }
.check a { color: var(--accent); text-decoration: underline; }
.login-card { max-width: 440px; margin: 0 auto; }
.login-wrap { max-width: 440px; }

/* ---------- banner prova, paywall, admin ---------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 11px 16px; margin-bottom: 16px; border-radius: 16px; font-size: 14px; flex-wrap: wrap; }
.banner > b { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }
.banner.info .ic:first-child { color: var(--accent); }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 14%, var(--glass)); }
.banner.warn .ic:first-child, .banner.warn > b { color: var(--warn); }
.banner:hover { background: var(--glass-2); }
.paywall { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; max-width: 1000px; margin: 0 auto; }
@media (max-width: 900px) { .paywall { grid-template-columns: 1fr; } }
.pw-main { padding: 28px; }
.pw-main h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.4px; margin: 12px 0 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 700; background: var(--glass-2); border: 1px solid var(--glass-border); }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--danger); }
.price { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 14px; }
.price b { font-size: 46px; font-weight: 800; letter-spacing: -1.5px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.price span { color: var(--muted); font-weight: 600; }
.features { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.features li { display: flex; gap: 10px; align-items: flex-start; }
.features .ic { color: var(--ok); margin-top: 3px; }
.btn.big { height: 52px; font-size: 16px; padding: 0 24px; }
.admin-stats { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .admin-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .admin-stats { grid-template-columns: 1fr 1fr; } }
.admin-list .chead, .admin-list .crow { grid-template-columns: minmax(200px, 1.6fr) minmax(110px, .9fr) minmax(90px, .7fr) minmax(90px, .7fr) minmax(110px, .8fr) minmax(130px, .9fr); }
.sec-h { font-size: 14px; margin: 18px 0 8px; color: var(--muted); font-weight: 650; }
@media (max-width: 900px) {
  .admin-list .crow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name state" "reg contacts"; }
  .admin-list .crow > :nth-child(1) { grid-area: name; }
  .admin-list .crow > :nth-child(2) { grid-area: state; justify-self: end; }
  .admin-list .crow > :nth-child(3) { grid-area: reg; display: block; }
  .admin-list .crow > :nth-child(4), .admin-list .crow > :nth-child(6) { display: none; }
  .admin-list .crow > :nth-child(5) { grid-area: contacts; justify-self: end; display: block; }
}

/* ---------- sincronizzazione con Google Calendar in coda ---------- */
.syncbar { display: block; padding: 11px 16px 12px; margin-bottom: 14px; border-radius: 16px; font-size: 14px; }
.syncbar .line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.syncbar .line .ic { color: var(--accent); animation: spin 2.2s linear infinite; }
.syncbar small { margin-left: auto; color: var(--muted); }
.syncbar .track { height: 6px; border-radius: 9px; background: var(--input-bg); overflow: hidden; margin-top: 9px; }
.syncbar .track i { display: block; height: 100%; border-radius: 9px; background: var(--grad); transition: width .6s var(--ease); min-width: 4px; }

/* ---------- fatto / perso ---------- */
.btn.res-won { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 14%, var(--glass-2)); }
.btn.res-lost { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 12%, var(--glass-2)); }
.btn.res-won:hover { background: color-mix(in srgb, var(--ok) 26%, var(--glass-2)); }
.btn.res-lost:hover { background: color-mix(in srgb, var(--danger) 22%, var(--glass-2)); }
.btn.ok-solid { background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-color: rgba(255, 255, 255, .35); box-shadow: 0 8px 22px rgba(16, 185, 129, .4); }
.res-box { align-self: center; }
.res-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 99px; font-weight: 800; letter-spacing: .4px; font-size: 14px; }
.res-badge.vinto { color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 50%, transparent); }
.res-badge.perso { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 50%, transparent); }
.res-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 750; }
.res-chip.vinto { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.res-chip.perso { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.res-tile { display: block; text-align: center; padding: 12px 6px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); transition: transform .2s var(--ease), background .2s; }
.res-tile:hover { transform: translateY(-2px); background: var(--glass-2); }
.res-tile b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.res-tile span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.res-tile.won b { color: var(--ok); } .res-tile.lost b { color: var(--danger); }
.ratio { display: flex; height: 10px; border-radius: 9px; overflow: hidden; background: var(--input-bg); gap: 2px; }
.ratio i.w { background: linear-gradient(90deg, #34d399, #10b981); box-shadow: 0 0 10px rgba(16, 185, 129, .5); }
.ratio i.l { background: linear-gradient(90deg, #fb7185, #f43f5e); }
.ratio-legend { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.ratio-legend b { color: var(--text); }
.hist { max-height: 150px; overflow: auto; padding: 8px 10px; border-radius: 13px; background: var(--input-bg); border: 1px solid var(--glass-border); display: flex; flex-direction: column; gap: 8px; }
.hist-row small { color: var(--muted); font-weight: 600; }
.hist-row div { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.hist-row + .hist-row { border-top: 1px solid var(--divider); padding-top: 8px; }

/* ---------- slot di richiamo ---------- */
.slot-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.slot-choice .btn.big { height: 76px; flex-direction: column; gap: 2px; font-size: 14px; }
.slot-choice .btn.big b { font-size: 28px; line-height: 1; }
.sp { display: flex; flex-direction: column; gap: 10px; }
.sp-nav { display: flex; gap: 8px; align-items: center; }
.sp-nav input[type="date"] { flex: 1; }
.sp-day { font-weight: 650; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; max-height: 280px; overflow: auto; padding: 2px; }
.slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 46px; padding: 6px 4px; border-radius: 13px; border: 1px solid var(--glass-border); background: var(--glass-2); color: var(--text); font: inherit; font-weight: 650; font-size: 14px; cursor: pointer; transition: transform .15s var(--ease), background .2s; font-variant-numeric: tabular-nums; }
.slot small { font-size: 10.5px; font-weight: 600; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.free:hover { background: var(--glass-hover); transform: translateY(-1px); }
.slot.free { border-color: color-mix(in srgb, var(--ok) 35%, var(--glass-border)); }
.slot.selected { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(99, 102, 241, .5); }
.slot:disabled { cursor: not-allowed; }
.slot.busy { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.slot.busy small { text-decoration: none; }
.slot.google { background: color-mix(in srgb, #4285f4 14%, transparent); border-color: color-mix(in srgb, #4285f4 35%, transparent); color: var(--muted); }
.slot.past { opacity: .35; }
.sp-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.sp-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }
.lg.free { background: var(--ok); } .lg.busy { background: var(--danger); } .lg.google { background: #4285f4; }
.sp-msg { padding: 18px 10px; text-align: center; color: var(--muted); border-radius: 14px; background: var(--glass); border: 1px dashed var(--glass-border); }
.sp-setup { padding: 12px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-border); }
.sp-setup p { margin-bottom: 10px; }
.sp-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.linkish { background: none; border: 0; color: var(--accent); font-weight: 650; cursor: pointer; padding: 4px 0; text-decoration: underline; font-size: 13.5px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.daychip { cursor: pointer; }
.daychip input { position: absolute; opacity: 0; }
.daychip span { display: inline-block; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--glass-border); background: var(--input-bg); font-weight: 650; font-size: 13px; color: var(--muted); }
.daychip input:checked + span { background: var(--grad); color: #fff; border-color: transparent; }
.daychip input:focus-visible + span { outline: 2px solid var(--cyan); }

/* ---------- documenti e spazio ---------- */
.paywall .span2 { grid-column: 1 / -1; }
.admin-stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.meter .track { height: 10px; border-radius: 9px; background: var(--input-bg); overflow: hidden; }
.meter .track i { display: block; height: 100%; border-radius: 9px; background: var(--grad); min-width: 3px; transition: width .6s var(--ease); }
.meter.warn .track i { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.meter.full .track i { background: linear-gradient(90deg, #fb7185, #e11d48); }
.meter-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }
.meter-text b { color: var(--text); }
.doc-drop { padding: 12px 14px; border-radius: 14px; border: 2px dashed var(--glass-border); color: var(--muted); font-size: 13.5px; text-align: center; margin-bottom: 12px; transition: .2s; }
.doc-drop.over { border-color: var(--indigo); background: color-mix(in srgb, var(--indigo) 14%, transparent); color: var(--text); }
.btn.disabled { opacity: .5; pointer-events: none; }
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-border); }
.doc-thumb { width: 46px; height: 46px; border-radius: 11px; overflow: hidden; display: grid; place-items: center; background: var(--input-bg); border: 1px solid var(--glass-border); font-weight: 800; font-size: 11px; letter-spacing: .4px; color: #fff; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-ico.pdf { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.doc-ico.docx, .doc-ico.doc { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.doc-info { min-width: 0; }
.doc-info b { display: block; font-weight: 650; }
.doc-info small { color: var(--muted); font-size: 12.5px; }
.doc-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .doc-row { grid-template-columns: 46px minmax(0, 1fr); } .doc-acts { grid-column: 1 / -1; } }
/* scheda stretta: nome e dettagli su una riga, pulsanti sotto */
.doc-row { grid-template-columns: 46px minmax(0, 1fr); row-gap: 8px; }
.doc-acts { grid-column: 1 / -1; justify-content: flex-start; align-items: center; }
.doc-acts .danger { margin-left: auto; }
.doc-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-info small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* conservazione dati dopo la scadenza, elenco spazio */
.warn-box.purge { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 0; line-height: 1.5; }
.warn-box.purge svg { flex: none; margin-top: 2px; color: var(--warn); }
.space-list { max-height: 380px; overflow: auto; padding-right: 4px; }
.page-head { gap: 12px; flex-wrap: wrap; }

/* installazione come app (PWA) */
.pwa-banner .btn { margin-left: 0; }
.pwa-banner span { flex: 1 1 200px; }
.howto { margin: 0; padding-left: 22px; display: grid; gap: 12px; line-height: 1.5; }
.howto li::marker { font-weight: 700; color: var(--accent); }
.howto .ic { vertical-align: -3px; }

/* annulla abbonamento: ben visibile */
.cancel-sub { border-color: color-mix(in srgb, var(--bad, #ef4444) 55%, transparent); }
