/* SATE Agenda — interfaccia "Graphite": pannelli grafite, bordo a filo di luce, Geist + Geist Mono, un solo accento. */

:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --page: #070708;
  --light-centre: #17171a;
  --panel-top: #1b1b1e;
  --panel-mid: #131315;
  --panel-bottom: #0f0f11;
  --raised: #1f1f23;
  --field: #0b0b0d;
  --text: #f1f1f3;
  --text-rgb: 241 241 243;
  --muted: rgb(var(--text-rgb) / 0.6);
  --label: rgb(var(--text-rgb) / 0.42);
  --line: rgb(255 255 255 / 0.07);
  --line-strong: rgb(255 255 255 / 0.13);
  --liner: linear-gradient(180deg, rgb(255 255 255 / 0.2), rgb(255 255 255 / 0.05) 40%, rgb(255 255 255 / 0.02) 70%, rgb(255 255 255 / 0.08));
  --sheen: rgb(255 255 255 / 0.05);
  --shadow: 0 30px 60px -30px rgb(0 0 0 / 0.8);

  --accent: 106 161 255;
  --todo: 255 181 71;
  --done: 110 231 183;
  --notdone: 255 106 94;
  --late: 255 138 76;
  --info: 150 170 255;
  --off: 150 150 158;

  --radius: 18px;
  --radius-sm: 11px;
  --rail: 252px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="light"], :root[data-theme="blue"] {
  --page: #f1f1ef;
  --light-centre: #ffffff;
  --panel-top: #ffffff;
  --panel-mid: #fdfdfc;
  --panel-bottom: #f9f9f8;
  --raised: #ffffff;
  --field: #ffffff;
  --text: #121214;
  --text-rgb: 18 18 20;
  --line: rgb(0 0 0 / 0.08);
  --line-strong: rgb(0 0 0 / 0.16);
  --liner: linear-gradient(180deg, rgb(0 0 0 / 0.1), rgb(0 0 0 / 0.07));
  --sheen: rgb(255 255 255 / 0);
  --shadow: 0 24px 48px -28px rgb(20 20 30 / 0.25);
  --accent: 26 95 224;
  --todo: 180 106 0;
  --done: 12 138 86;
  --notdone: 214 54 40;
  --late: 204 84 20;
  --info: 70 92 200;
  --off: 110 110 118;
}

/* Blu SATE: gli stessi bianchi del tema chiaro (pagina #f1f1ef, pannelli #fff); l'inchiostro (testi, bottoni pieni, barre, card attive, logo)
   diventa il navy del sito satesnc.com (#223554) invece del nero. Eredita tutto il resto dal chiaro. */
:root[data-theme="blue"] {
  --text: #223554;
  --text-rgb: 34 53 84;
  --line: rgb(34 53 84 / 0.09);
  --line-strong: rgb(34 53 84 / 0.18);
  --liner: linear-gradient(180deg, rgb(34 53 84 / 0.11), rgb(34 53 84 / 0.07));
  --shadow: 0 24px 48px -28px rgb(26 43 72 / 0.3);
  --accent: 34 53 84;
  --info: 125 147 184;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--page); color: var(--text);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
/* luce morbida dietro l'interfaccia + grana */
body::before {
  content: ""; position: fixed; inset: -20% -10% auto -10%; height: 90vh; z-index: -2; pointer-events: none;
  background: radial-gradient(closest-side, var(--light-centre), transparent);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0.035; transform: translateZ(0);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root:is([data-theme="light"], [data-theme="blue"]) body::after { opacity: 0.025; }

h1, h2, h3, p { margin: 0; }
a { color: rgb(var(--accent)); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgb(var(--text-rgb) / 0.16); color: var(--text); }
:focus-visible { outline: 2px solid rgb(var(--accent) / 0.8); outline-offset: 2px; border-radius: 6px; }
svg.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.label, .mono-cap {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--label); font-weight: 400;
}
.mono { font-family: var(--font-mono); letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ pannello */
/* Il filo di luce del bordo è un'ombra di 1 px (più un riflesso in alto) invece di una maschera: stessa resa, ma il
   browser non deve ridisegnare una maschera grande quanto la scheda a ogni fotogramma quando la pagina si allarga o
   si stringe (menu che si apre e si chiude). */
.panel {
  position: relative; border-radius: var(--radius); padding: 22px;
  background: linear-gradient(180deg, var(--panel-top) 0%, var(--panel-mid) 45%, var(--panel-bottom) 100%);
  box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 var(--sheen), var(--shadow);
}
.panel.flush { padding: 0; overflow: hidden; }
.panel + .panel, .grid-2 + .panel, .panel + .grid-2, .stack > * + * { margin-top: 16px; }
.panel-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }
.panel-title.pad { padding: 20px 22px 0; }
.panel-title .ico { color: var(--label); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .panel { margin-top: 0; }

/* ------------------------------------------------------------------ pulsanti e campi */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgb(var(--text-rgb) / 0.04); color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.3s;
}
.btn:hover { background: rgb(var(--text-rgb) / 0.09); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--text); color: var(--page); border-color: transparent; }
.btn-primary:hover { background: var(--text); box-shadow: 0 0 0 4px rgb(var(--text-rgb) / 0.12), 0 8px 30px -8px rgb(var(--accent) / 0.6); }
.btn-accent { background: rgb(var(--accent)); color: #fff; border-color: transparent; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-danger { color: rgb(var(--notdone)); border-color: rgb(var(--notdone) / 0.35); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-sm .ico { width: 15px; height: 15px; }
.btn-block { width: 100%; height: 50px; font-size: 16px; }
.btn[disabled], .btn.disabled { opacity: 0.45; pointer-events: none; }
.btn-icon { width: 40px; padding: 0; }

input, select, textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--field);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { height: auto; padding: 11px 13px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: rgb(var(--accent) / 0.8); box-shadow: 0 0 0 4px rgb(var(--accent) / 0.16); }
input::placeholder, textarea::placeholder { color: var(--label); }
input.invalid { border-color: rgb(var(--notdone)); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23999' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
select option { background: var(--raised); color: var(--text); }
input[type="checkbox"] { width: 18px; height: 18px; padding: 0; accent-color: rgb(var(--accent)); cursor: pointer; }
input[type="date"] { color-scheme: dark; }
:root:is([data-theme="light"], [data-theme="blue"]) input[type="date"] { color-scheme: light; }

.field { display: block; margin-bottom: 16px; }
.field > span:first-child, .filter > span { display: block; margin-bottom: 7px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--label); }
.hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.req { color: rgb(var(--notdone)); }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.form-error { margin: 12px 0; padding: 11px 14px; border-radius: var(--radius-sm); background: rgb(var(--notdone) / 0.12); color: rgb(var(--notdone)); font-size: 14px; box-shadow: inset 0 0 0 1px rgb(var(--notdone) / 0.35); }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.row-actions.left { justify-content: flex-start; }
.pwd { display: flex; gap: 8px; }

/* ------------------------------------------------------------------ chip di stato (LED) */
.chip {
  --c: var(--off);
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 999px; white-space: nowrap;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgb(var(--c)); background: rgb(var(--c) / 0.1); box-shadow: inset 0 0 0 1px rgb(var(--c) / 0.28);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgb(var(--c)); box-shadow: 0 0 8px rgb(var(--c) / 0.9); }
.chip.plain::before { display: none; }
.c-todo { --c: var(--todo); } .c-done { --c: var(--done); } .c-notdone { --c: var(--notdone); } .c-late { --c: var(--late); } .c-info { --c: var(--info); } .c-off { --c: var(--off); }
.led { --c: var(--off); display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--c)); box-shadow: 0 0 10px rgb(var(--c) / 0.9); }
.led.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
code.art { font-family: var(--font-mono); font-size: 12.5px; padding: 2px 7px; border-radius: 6px; background: rgb(var(--text-rgb) / 0.07); box-shadow: inset 0 0 0 1px var(--line); }
.badge-parts { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.badge-parts .ico { width: 14px; height: 14px; }
.badge-parts.todo { color: rgb(var(--todo)); }
.badge-pending { display: inline-block; margin-top: 4px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: rgb(var(--todo)); }

/* ------------------------------------------------------------------ accesso */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.login-wrap { width: min(430px, 100%); }
.login-card { padding: 34px 30px 26px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; font-family: var(--font-mono); font-size: 20px; color: var(--page);
  background: linear-gradient(160deg, var(--text), rgb(var(--text-rgb) / 0.72)); box-shadow: 0 10px 26px -10px rgb(var(--text-rgb) / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.6);
}
.brand-mark.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 15px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.login-brand h1 { font-size: 26px; font-weight: 400; letter-spacing: -0.03em; }
.login-brand p { color: var(--muted); font-size: 14px; }
.demo-box { margin-top: 16px; padding: 18px 20px; }
.demo-box ul { list-style: none; margin: 12px 0 8px; padding: 0; display: grid; gap: 4px; }
.demo-box li button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; font-size: 13.5px; color: var(--muted); }
.demo-box li button:hover { background: rgb(var(--text-rgb) / 0.06); color: var(--text); }
.demo-box code { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); }
.link { border: 0; background: none; padding: 0; color: rgb(var(--accent)); cursor: pointer; font-size: 13.5px; }

/* ------------------------------------------------------------------ struttura ufficio */
.office { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px 16px; border-right: 1px solid var(--line); }
.rail .brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.rail .brand b { display: block; font-weight: 500; letter-spacing: -0.02em; font-size: 16px; }
.rail nav { display: grid; align-content: start; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px; scrollbar-width: none; -ms-overflow-style: none; }
.rail nav::-webkit-scrollbar { display: none; }
.rail nav a { position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 11px; color: var(--muted); font-size: 14.5px; transition: color 0.2s, background 0.2s; }
.rail nav a:hover { color: var(--text); background: rgb(var(--text-rgb) / 0.05); text-decoration: none; }
.rail nav a.active { color: var(--text); background: rgb(var(--text-rgb) / 0.08); box-shadow: inset 0 0 0 1px var(--line); }
.rail nav a.active::before { content: ""; position: absolute; left: -6px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--text); box-shadow: 0 0 12px rgb(var(--text-rgb) / 0.35); }
.rail nav .sep { margin: 14px 12px 6px; }
.rail-foot { margin-top: 0; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; flex: none; }
.live-pill { display: flex; align-items: center; gap: 9px; padding: 0 12px; }
.office-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 20px 34px; background: color-mix(in srgb, var(--page) 84%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 30px; font-weight: 400; letter-spacing: -0.035em; margin-right: auto; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.office-content { padding: 6px 34px 80px; max-width: 1380px; }
.loadbar { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 100; background: rgb(var(--accent)); box-shadow: 0 0 12px rgb(var(--accent)); transition: width 0.4s var(--ease), opacity 0.3s; }

.menu { position: relative; }
.menu-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 13px; border: 1px solid var(--line); background: rgb(var(--text-rgb) / 0.03); cursor: pointer; text-align: left; }
.menu-btn:hover { background: rgb(var(--text-rgb) / 0.07); }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; font-family: var(--font-mono); font-size: 13px; background: rgb(var(--accent) / 0.18); color: rgb(var(--accent)); box-shadow: inset 0 0 0 1px rgb(var(--accent) / 0.35); }
.who { min-width: 0; flex: 1; }
.who b { display: block; font-weight: 500; font-size: 13.5px; }
.who small { display: block; color: var(--label); font-size: 11.5px; }
.menu-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 50; padding: 6px; border-radius: 14px; background: var(--raised); box-shadow: 0 0 0 1px var(--line-strong), 0 24px 50px -12px rgb(0 0 0 / 0.7); animation: pop 0.22s var(--ease); min-width: 220px; }
.menu-pop.down { bottom: auto; top: calc(100% + 8px); left: auto; }
.menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 11px; border: 0; border-radius: 9px; background: none; cursor: pointer; font-size: 14px; text-align: left; }
.menu-pop button:hover { background: rgb(var(--text-rgb) / 0.07); }
.menu-head { padding: 9px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.menu-head small { display: block; color: var(--label); font-size: 12px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* ------------------------------------------------------------------ animazione d'ingresso */
.view-in > * { animation: rise 0.6s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ dashboard */
.section-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 14px; }
.section-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 30px 0 14px; }
.section-row .section-title { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { --c: var(--off); display: block; color: var(--text); padding: 20px 22px 22px; transition: transform 0.35s var(--ease); }
.kpi:hover { text-decoration: none; transform: translateY(-3px); }
.kpi .label { display: flex; align-items: center; gap: 9px; }
.kpi b { display: block; margin-top: 16px; font-family: var(--font-mono); font-weight: 400; font-size: 46px; line-height: 1; letter-spacing: -0.04em; }
.kpi::after { content: ""; position: absolute; left: 22px; right: 22px; bottom: 0; height: 1px; background: linear-gradient(90deg, rgb(var(--c) / 0.9), transparent); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; background: rgb(var(--todo) / 0.08); box-shadow: inset 0 0 0 1px rgb(var(--todo) / 0.25); }
.notice .ico { color: rgb(var(--todo)); margin-top: 1px; }
.notice.info { background: rgb(var(--info) / 0.08); box-shadow: inset 0 0 0 1px rgb(var(--info) / 0.25); }
.notice.info .ico { color: rgb(var(--info)); }
.tech-panel { padding: 0; }
.tp-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.tp-head a { color: var(--text); font-size: 17px; letter-spacing: -0.01em; }
.tp-head a .mono { color: var(--label); margin-right: 8px; font-size: 13px; }
.tp-progress { display: flex; align-items: center; gap: 12px; }
.segs { display: flex; gap: 3px; }
.segs i { width: 14px; height: 6px; border-radius: 2px; background: rgb(var(--text-rgb) / 0.09); }
.segs i.ok { background: rgb(var(--done)); box-shadow: 0 0 8px rgb(var(--done) / 0.7); }
.segs i.ko { background: rgb(var(--notdone)); box-shadow: 0 0 8px rgb(var(--notdone) / 0.7); }
.dash-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-col { padding: 16px 22px 20px; }
.dash-col + .dash-col { border-left: 1px solid var(--line); }
.dash-col .label { margin-bottom: 10px; }
.dash-entry { --c: var(--todo); display: block; position: relative; color: var(--text); padding: 12px 14px 12px 18px; border-radius: 12px; margin-top: 8px; background: rgb(var(--text-rgb) / 0.03); box-shadow: inset 0 0 0 1px var(--line); transition: background 0.2s, transform 0.3s var(--ease); font-size: 14px; }
.dash-entry::before, .appt-card::before, .job-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: rgb(var(--c)); box-shadow: 0 0 10px rgb(var(--c) / 0.7); }
.dash-entry:hover { text-decoration: none; background: rgb(var(--text-rgb) / 0.06); transform: translateX(3px); }
.de-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 4px; }
.de-report { margin-top: 6px; color: var(--muted); font-size: 13px; }
.de-report.warn { color: rgb(var(--todo)); }
.s-todo { --c: var(--todo); } .s-done { --c: var(--done); } .s-notdone { --c: var(--notdone); }
.amounts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--muted); }
.amounts b { font-family: var(--font-mono); font-weight: 400; color: var(--text); }

/* ------------------------------------------------------------------ elenco appuntamenti */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 18px 20px; }
.filter { display: block; flex: 1 1 150px; min-width: 130px; }
.filter.search { flex: 2 1 260px; }
.filter.inline { flex: 0 0 240px; }
.custom-range { display: contents; }
.totals-bar { display: flex; align-items: center; gap: 30px; flex-wrap: wrap; padding: 18px 22px; }
.tot .label { display: block; margin-bottom: 6px; }
.tot b { font-family: var(--font-mono); font-weight: 400; font-size: 24px; letter-spacing: -0.03em; }
.tot-meta { margin-left: auto; font-size: 13px; text-align: right; }
.list-head { margin: 18px 4px 4px; font-size: 13px; }
.day { margin: 26px 4px 10px; display: flex; align-items: center; gap: 12px; }
.day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.card-list .day:first-child { margin-top: 12px; }
.appt-card { --c: var(--todo); position: relative; display: block; color: var(--text); padding: 15px 20px 15px 22px; border-radius: 14px; margin-top: 8px; background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom)); box-shadow: inset 0 0 0 1px var(--line); transition: transform 0.35s var(--ease), box-shadow 0.3s; }
.appt-card:hover { text-decoration: none; transform: translateX(4px); box-shadow: inset 0 0 0 1px var(--line-strong), 0 14px 30px -18px rgb(0 0 0 / 0.7); }
.ac-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ac-when { font-family: var(--font-mono); font-size: 13px; }
.ac-order { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.ac-order b { font-family: var(--font-mono); font-weight: 400; color: var(--text); }
.ac-client { margin-top: 9px; font-size: 16px; letter-spacing: -0.01em; }
.ac-client span { color: var(--muted); }
.ac-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 5px; color: var(--muted); font-size: 13px; }
.ac-meta span { display: inline-flex; align-items: center; gap: 6px; }
.ac-meta .ico { width: 14px; height: 14px; }
.ac-report { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); margin-top: 12px; }
.empty-page { padding: 80px 20px; text-align: center; display: grid; gap: 16px; justify-items: center; color: var(--muted); }

/* ------------------------------------------------------------------ tabelle */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 13px 16px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 400; color: var(--label); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-family: var(--font-mono); }
.table .num.neg { color: rgb(var(--notdone)); }
.table tr.clickable { cursor: pointer; transition: background 0.15s; }
.table tr.clickable:hover, .table tr.current { background: rgb(var(--text-rgb) / 0.04); }
.table tr.hl td { background: rgb(var(--accent) / 0.1); }
.table.compact td, .table.compact th { padding: 10px 14px; }
.table tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 500; background: rgb(var(--text-rgb) / 0.03); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table input, .table select { height: 34px; font-size: 13.5px; border-radius: 9px; min-width: 96px; background-color: transparent; border-color: var(--line); }
.table input.euro { text-align: right; font-family: var(--font-mono); min-width: 84px; width: 90px; }
.table input.saved, .table select.saved { border-color: rgb(var(--done) / 0.8); box-shadow: 0 0 0 3px rgb(var(--done) / 0.15); }

.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv:last-child { border-bottom: 0; }
.kv > span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--label); padding-top: 3px; }
.detail-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.detail-head h2 { font-family: var(--font-mono); font-weight: 400; font-size: 32px; letter-spacing: -0.04em; margin-top: 4px; }
.detail-head .filter { flex: 0 0 210px; margin-left: auto; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: 14px; padding: 0 0 18px 0; }
.timeline li::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.tl-icon { width: 27px; height: 27px; flex: none; border-radius: 9px; display: grid; place-items: center; background: rgb(var(--text-rgb) / 0.06); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.tl-icon .ico { width: 14px; height: 14px; }
.diff { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.diff s { opacity: 0.7; }
.diff b { color: var(--text); font-weight: 500; }
.report-item { --c: var(--done); position: relative; padding: 14px 16px 14px 20px; border-radius: 12px; background: rgb(var(--text-rgb) / 0.03); box-shadow: inset 0 0 0 1px var(--line); font-size: 14.5px; }
.report-item + .report-item { margin-top: 10px; }
.report-item::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: rgb(var(--c)); }
.report-item.ko { --c: var(--notdone); }
.ri-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.lbl { color: var(--label); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; margin-right: 6px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photos img, .photo-thumb { width: 78px; height: 78px; object-fit: cover; border-radius: 10px; cursor: zoom-in; box-shadow: inset 0 0 0 1px var(--line); transition: transform 0.3s var(--ease); }
.photos img:hover { transform: scale(1.05); }
.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgb(0 0 0 / 0.86); backdrop-filter: blur(8px); cursor: zoom-out; animation: fade 0.25s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------------------------ importazione */
.dropzone { display: grid; place-items: center; gap: 10px; padding: 66px 24px; text-align: center; cursor: pointer; border-radius: var(--radius); border: 1px dashed var(--line-strong); background: rgb(var(--text-rgb) / 0.02); transition: border-color 0.2s, background 0.2s, transform 0.3s var(--ease); }
.dropzone:hover, .dropzone.over { border-color: rgb(var(--accent)); background: rgb(var(--accent) / 0.06); }
.dropzone.over { transform: scale(1.01); }
.dz-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: rgb(var(--accent) / 0.14); color: rgb(var(--accent)); box-shadow: inset 0 0 0 1px rgb(var(--accent) / 0.3); }
.dz-icon .ico { width: 26px; height: 26px; }
.dz-title { font-size: 19px; letter-spacing: -0.02em; }
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; margin: 16px 0; }
.counter { --c: var(--off); padding: 14px 14px 12px; border-radius: 12px; background: rgb(var(--text-rgb) / 0.03); box-shadow: inset 0 0 0 1px var(--line); }
.counter b { display: block; font-family: var(--font-mono); font-weight: 400; font-size: 26px; letter-spacing: -0.03em; color: rgb(var(--c)); }
.counter:not([class*="c-"]) b { color: var(--text); }
.counter span { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--label); }
.det { border-top: 1px solid var(--line); padding: 12px 0; }
.det summary { cursor: pointer; font-weight: 500; }
.det ul { margin: 10px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); display: grid; gap: 5px; }
.det li b { color: var(--text); font-weight: 500; }
.warnings { margin-top: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: rgb(var(--todo) / 0.07); box-shadow: inset 0 0 0 1px rgb(var(--todo) / 0.22); font-size: 14px; }
.warnings ul, .warn-list { margin: 8px 0 0; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
.alert { padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.alert.success { background: rgb(var(--done) / 0.09); box-shadow: inset 0 0 0 1px rgb(var(--done) / 0.3); }
.alert.error { background: rgb(var(--notdone) / 0.1); box-shadow: inset 0 0 0 1px rgb(var(--notdone) / 0.3); }
.progress-bar { height: 6px; border-radius: 3px; background: rgb(var(--text-rgb) / 0.08); overflow: hidden; margin: 14px 0; }
.progress-bar > div { height: 100%; width: 0; background: rgb(var(--accent)); box-shadow: 0 0 12px rgb(var(--accent)); transition: width 0.5s var(--ease); }
.spinner { width: 30px; height: 30px; margin: 10px auto; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: rgb(var(--accent)); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auto-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.path { display: inline-block; font-family: var(--font-mono); font-size: 12.5px; padding: 6px 10px; border-radius: 8px; background: rgb(var(--text-rgb) / 0.06); word-break: break-all; }

/* ------------------------------------------------------------------ schede, modali, avvisi */
.tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0 16px; border-radius: 999px; background: rgb(var(--text-rgb) / 0.05); box-shadow: inset 0 0 0 1px var(--line); max-width: 100%; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; font-size: 14px; white-space: nowrap; transition: background 0.25s, color 0.2s; }
.tab .ico { width: 15px; height: 15px; }
.tab.active { background: var(--text); color: var(--page); }

.modal-backdrop { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgb(0 0 0 / 0.6); backdrop-filter: blur(10px); animation: fade 0.2s; }
.modal { width: min(500px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 26px; animation: rise 0.4s var(--ease); }
.modal.wide { width: min(880px, 100%); }
.modal h2 { font-size: 21px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.creds { display: grid; gap: 10px; margin: 16px 0; }
.creds div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgb(var(--text-rgb) / 0.05); box-shadow: inset 0 0 0 1px var(--line); }
.creds code { font-family: var(--font-mono); font-size: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.items-head, .item-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 90px 40px; gap: 8px; align-items: center; }
.items-head.with-notes, .item-row.with-notes { grid-template-columns: 140px minmax(0, 1.2fr) 80px minmax(0, 1fr) 40px; }
.items-head { margin-bottom: 6px; }
.item-row { margin-bottom: 8px; }
.item-row.known [name="name"] { border-color: rgb(var(--done) / 0.5); }
.top-gap { margin-top: 16px; }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { --c: var(--info); display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 13px; font-size: 14px; max-width: min(420px, calc(100vw - 40px)); background: var(--raised); box-shadow: 0 0 0 1px var(--line-strong), 0 20px 40px -12px rgb(0 0 0 / 0.7); opacity: 0; transform: translateY(12px) scale(0.97); transition: opacity 0.3s, transform 0.45s var(--ease); }
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; background: rgb(var(--c)); box-shadow: 0 0 10px rgb(var(--c)); }
.toast.show { opacity: 1; transform: none; }
.toast.success { --c: var(--done); } .toast.error { --c: var(--notdone); }

/* ------------------------------------------------------------------ statistiche */
.stat-row { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.stat-row:last-child { border-bottom: 0; }
.stat-bar { height: 8px; border-radius: 4px; background: rgb(var(--text-rgb) / 0.06); overflow: hidden; display: flex; }
.stat-bar i { display: block; height: 100%; background: rgb(var(--accent)); transition: width 0.9s var(--ease); }
.stat-bar i.b2 { background: rgb(var(--done)); }
.stat-val { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }

/* ------------------------------------------------------------------ area tecnico (telefono) */
.tech { max-width: 600px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.tech-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 18px 14px; background: linear-gradient(180deg, var(--page) 70%, transparent); }
.tech-header h1 { font-size: 22px; font-weight: 400; letter-spacing: -0.03em; }
.tech-header .sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.tech-header .menu { margin-left: auto; }
.tech-header .menu-btn { width: auto; padding: 5px; border-radius: 14px; }
.tech-header .back { margin-right: 2px; }
.offline-banner { margin: 0 18px 10px; padding: 11px 14px; border-radius: 12px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; background: rgb(var(--todo) / 0.1); color: rgb(var(--todo)); box-shadow: inset 0 0 0 1px rgb(var(--todo) / 0.3); }
.tech-main { padding: 4px 18px; }
.tech-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tech-kpis .panel { padding: 14px 16px; margin: 0; }
.tech-kpis b { display: block; font-family: var(--font-mono); font-weight: 400; font-size: 30px; letter-spacing: -0.04em; margin-top: 8px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 2px 0; font-size: 13.5px; color: var(--muted); }
.job-card { --c: var(--todo); position: relative; display: flex; align-items: center; gap: 12px; color: var(--text); padding: 16px 14px 16px 20px; border-radius: 16px; margin-top: 10px; background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom)); box-shadow: inset 0 0 0 1px var(--line); transition: transform 0.3s var(--ease); }
.job-card:active { transform: scale(0.985); }
.job-card:hover { text-decoration: none; }
.job-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.job-body b { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
.job-body .addr { color: var(--muted); font-size: 14px; }
.job-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.chev { color: var(--label); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.quick .btn { height: 48px; }
.parts-box ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.qty { font-family: var(--font-mono); margin-right: 6px; color: rgb(var(--todo)); }
.pv { padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pv:first-of-type { margin-top: 10px; }
.q { font-size: 18px; letter-spacing: -0.02em; margin-bottom: 14px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.choice-btn { --c: var(--done); display: flex; align-items: center; justify-content: center; gap: 10px; height: 62px; border-radius: 16px; border: 1px solid var(--line-strong); background: rgb(var(--text-rgb) / 0.03); cursor: pointer; font-size: 18px; transition: all 0.25s var(--ease); }
.choice-btn.no { --c: var(--notdone); }
.choice-btn .ico { width: 22px; height: 22px; color: rgb(var(--c)); }
.choice-btn.selected { background: rgb(var(--c) / 0.14); border-color: rgb(var(--c)); box-shadow: 0 0 0 4px rgb(var(--c) / 0.15), 0 0 30px -6px rgb(var(--c) / 0.6); }
.amounts-box { border: 0; padding: 0; margin: 0 0 6px; }
.amounts-box legend { padding: 0; margin-bottom: 10px; }
.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.euro-input { position: relative; display: block; }
.euro-input input { height: 54px; padding-right: 30px; font-family: var(--font-mono); font-size: 19px; text-align: right; }
.euro-input > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--label); }
.seg-choice { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-choice button { height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: none; cursor: pointer; font-size: 14px; }
.seg-choice button.selected { background: var(--text); color: var(--page); border-color: transparent; }
.photo-add { width: 78px; height: 78px; border-radius: 12px; border: 1px dashed var(--line-strong); display: grid; place-items: center; cursor: pointer; color: var(--muted); background: rgb(var(--text-rgb) / 0.03); }
.photo-wrap { position: relative; }
.photo-wrap button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgb(var(--notdone)); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.tech .actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 20px; }
.tech .actions .btn { height: 54px; font-size: 16px; }

/* ------------------------------------------------------------------ schermi piccoli */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 880px) {
  .office { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; z-index: 60; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: var(--page); overflow-x: auto; }
  .rail .brand, .rail .sep, .rail .live-pill { display: none; }
  .rail nav { display: flex; gap: 4px; flex: none; overflow: visible; margin: 0; padding: 0; }
  .rail nav a { flex-direction: column; gap: 3px; height: 52px; padding: 0 12px; font-size: 10.5px; justify-content: center; white-space: nowrap; }
  .rail nav a.active::before { display: none; }
  .rail-foot { margin: 0 0 0 8px; padding-top: 0; border-top: 0; display: flex; align-items: center; }
  .rail-foot .who, .rail-foot .theme-btn span { display: none; }
  .menu-pop { left: auto; right: 0; }
  .topbar { padding: 16px 18px; }
  .topbar h1 { font-size: 24px; }
  .office-content { padding: 4px 18px 110px; }
  .dash-cols { grid-template-columns: minmax(0, 1fr); }
  .dash-col + .dash-col { border-left: 0; border-top: 1px solid var(--line); }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .items-head { display: none; }
  .item-row, .item-row.with-notes { grid-template-columns: 1fr 70px 40px; }
  .item-row [name="name"], .item-row [name="notes"] { grid-column: 1 / -1; }
  .auto-box { grid-template-columns: minmax(0, 1fr); }
  .stat-row { grid-template-columns: 110px minmax(0, 1fr) auto; }
  #toasts { left: 14px; right: 14px; bottom: 84px; justify-items: stretch; }
}
@media (max-width: 520px) {
  .amount-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi b { font-size: 36px; }
  .tot-meta { margin-left: 0; text-align: left; }
}

/* ------------------------------------------------------------------ dashboard: micro schede tecnico */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; grid-auto-flow: dense; }
.mini-tech { padding: 0; display: flex; flex-direction: column; min-width: 0; overflow: hidden; transition: box-shadow 0.3s; }
.mini-tech:not(.wide):hover { box-shadow: var(--shadow), 0 0 0 1px var(--line-strong); }
.mini-tech.wide { grid-column: 1 / -1; }
.mini-tech.has-alert::after { content: ""; position: absolute; top: 18px; right: 52px; width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--late)); box-shadow: 0 0 10px rgb(var(--late)); }
.mt-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 18px 12px; border: 0; background: none; cursor: pointer; text-align: left; border-radius: var(--radius) var(--radius) 0 0; }
.mt-name { flex: 1; min-width: 0; display: grid; gap: 2px; }
.mt-name b { font-weight: 500; font-size: 15.5px; letter-spacing: -0.01em; }
.mt-chev { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: rgb(var(--text-rgb) / 0.05); box-shadow: inset 0 0 0 1px var(--line); transition: transform 0.45s var(--ease), background 0.2s, color 0.2s; }
.mt-chev .ico { width: 15px; height: 15px; }
.mt-chev:hover { color: var(--text); background: rgb(var(--text-rgb) / 0.1); }
.mini-tech.open .mt-chev { transform: rotate(90deg); background: var(--text); color: var(--page); box-shadow: none; }
.mt-days { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px; }
.mt-day { display: grid; gap: 7px; padding: 11px 12px; border-radius: 12px; background: rgb(var(--text-rgb) / 0.035); box-shadow: inset 0 0 0 1px var(--line); }
.mt-day .segs i { width: 10px; }
.mt-count { font-size: 12.5px; color: var(--muted); }
.mt-count b { font-family: var(--font-mono); font-weight: 400; color: var(--text); font-size: 15px; }
.mt-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 12px 18px 0; min-height: 36px; }
.mt-stat { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.mt-last { padding: 8px 18px 16px; }
.mt-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.38s cubic-bezier(0.4, 0, 0.2, 1); }
.mini-tech.open .mt-body { grid-template-rows: 1fr; transition-duration: 0.5s; transition-timing-function: var(--ease); }
.mt-inner { min-height: 0; overflow: hidden; opacity: 0; transform: translateY(-6px); transition: opacity 0.16s ease, transform 0.25s ease; }
.mt-inner .dash-cols { border-top: 1px solid var(--line); margin-top: 14px; }
.mini-tech.open .mt-inner { opacity: 1; transform: none; transition: opacity 0.35s ease 0.15s, transform 0.45s var(--ease) 0.15s; }
.mt-links { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 22px 20px; }
.mini-tech.open .dash-entry { animation: rise 0.5s var(--ease) 0.18s both; }
.mini-tech.open .dash-col .dash-entry:nth-child(3) { animation-delay: 240ms; }
.mini-tech.open .dash-col .dash-entry:nth-child(4) { animation-delay: 300ms; }
@media (max-width: 520px) { .mini-grid { grid-template-columns: minmax(0, 1fr); } }
.mini-tech .avatar { background: var(--text); color: var(--page); box-shadow: none; }

/* micro schede: tutte della stessa misura e allineate */
.mini-grid > .panel, .mini-grid > .panel + .panel { margin-top: 0; }
.mini-grid { align-items: stretch; }
.mini-tech .mt-foot { min-height: 70px; align-content: flex-start; padding-bottom: 4px; }
.mini-tech .mt-last { margin-top: auto; }
.mini-tech .mt-name b, .mini-tech .mt-name .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-chev:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgb(var(--text-rgb) / 0.35); }
/* le schede affiancate in griglia non prendono il margine dei pannelli impilati */
.kpis > .panel, .kpis > .panel + .panel, .tech-kpis > .panel, .tech-kpis > .panel + .panel { margin-top: 0; }

/* niente barra di scorrimento della pagina: si scorre con rotella, touchpad e dito (Lenis) */
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* anche nei riquadri che scorrono da soli */
[data-lenis-prevent], .modal { scrollbar-width: none; }
[data-lenis-prevent]::-webkit-scrollbar, .modal::-webkit-scrollbar { display: none; }
/* le tabelle larghe scorrono di lato: barra sottilissima e quasi invisibile, visibile solo quando serve */
.table-wrap { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.table-wrap:hover { scrollbar-color: rgb(var(--text-rgb) / 0.18) transparent; }

/* ------------------------------------------------------------------ menu laterale a tendine */
.rail nav { gap: 4px; }
.rail-group { display: grid; }
.rg-head { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 12px; margin-top: 6px; border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left; transition: background 0.25s; }
.rail-group:first-child .rg-head { margin-top: 0; }
.rg-head:hover { background: rgb(var(--text-rgb) / 0.04); }
.rg-head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgb(var(--text-rgb) / 0.35); }
.rg-head .label { transition: color 0.3s; }
.rg-head:hover .label, .rail-group.open .rg-head .label { color: rgb(var(--text-rgb) / 0.62); }
.rg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text); opacity: 0; transform: scale(0.3); transition: opacity 0.4s, transform 0.5s var(--ease); }
.rail-group.has-active:not(.open) .rg-dot { opacity: 1; transform: none; }
.rg-chev { margin-left: auto; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; color: var(--label); transition: transform 0.75s cubic-bezier(0.65, 0, 0.35, 1), color 0.3s, background 0.3s; }
.rg-chev .ico { width: 13px; height: 13px; }
.rg-head:hover .rg-chev { color: var(--text); background: rgb(var(--text-rgb) / 0.06); }
.rail-group.open .rg-chev { transform: rotate(90deg); }

/* apertura e chiusura al rallentatore: l'altezza scorre, le voci entrano una dopo l'altra */
.rg-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.75s cubic-bezier(0.65, 0, 0.35, 1); }
.rail-group.open .rg-body { grid-template-rows: 1fr; }
.rg-inner { min-height: 0; overflow: hidden; display: grid; gap: 2px; margin: 0 -6px; padding: 0 6px; }
.rg-inner > a { opacity: 0; transform: translateY(-8px); filter: blur(2px);
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.65, 0, 0.35, 1), filter 0.4s ease, color 0.2s, background 0.2s;
  transition-delay: calc((3 - var(--n, 0)) * 35ms), calc((3 - var(--n, 0)) * 35ms), calc((3 - var(--n, 0)) * 35ms), 0s, 0s; }
.rail-group.open .rg-inner > a { opacity: 1; transform: none; filter: none;
  transition: opacity 0.55s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), filter 0.5s ease, color 0.2s, background 0.2s;
  transition-delay: calc(120ms + var(--n, 0) * 70ms), calc(120ms + var(--n, 0) * 70ms), calc(120ms + var(--n, 0) * 70ms), 0s, 0s; }
.rail-group:not(.animating) .rg-inner > a { transition-delay: 0s; }
.rail-group.open .rg-inner > a:first-child { margin-top: 2px; }
.rail-group.open .rg-inner > a:last-child { margin-bottom: 4px; }
.rail-solo { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; }

@media (max-width: 880px) {
  .rail-group, .rg-body, .rg-inner, .rail-solo { display: contents; }
  .rg-head { display: none; }
  .rg-inner > a { opacity: 1 !important; transform: none !important; filter: none !important; }
}
@media (prefers-reduced-motion: reduce) { .rg-body, .rg-inner > a, .rg-chev { transition: none !important; } }


/* ------------------------------------------------------------------ barra laterale che sparisce */
.rail .brand { align-items: center; }
.rail-hide { display: grid; place-items: center; width: 32px; height: 32px; margin-left: auto; flex: none; border: 0; border-radius: 10px; background: none; color: var(--label); cursor: pointer; transition: background 0.25s, color 0.25s; }
.rail-hide:hover { background: rgb(var(--text-rgb) / 0.06); color: var(--text); }
.rail-hide .ico { width: 18px; height: 18px; }

/* il quadratino in basso a sinistra che riapre il menu */
.rail-open {
  position: fixed; left: 20px; bottom: 20px; z-index: 70; display: grid; place-items: center; width: 48px; height: 48px;
  border: 0; border-radius: 15px; cursor: pointer; color: var(--text);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 16px 34px -14px rgb(0 0 0 / 0.45);
  opacity: 0; transform: translateX(-14px) scale(0.85); pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.65, 0, 0.35, 1), background 0.25s, box-shadow 0.3s;
}
.rail-open .ico { width: 20px; height: 20px; }
.rail-open:hover { box-shadow: inset 0 0 0 1px rgb(var(--text-rgb) / 0.35), 0 18px 38px -14px rgb(0 0 0 / 0.5); transform: translateY(-2px); }
.rail-open:active { transform: scale(0.94); }
.rail-hidden .rail-open { opacity: 1; transform: none; pointer-events: auto; transition: opacity 0.45s ease 0.45s, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.4s, background 0.25s, box-shadow 0.3s; }
.rail-hide:focus-visible, .rail-open:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgb(var(--text-rgb) / 0.45); }

@media (min-width: 881px) {
  .office { transition: grid-template-columns 0.7s cubic-bezier(0.65, 0, 0.35, 1); }
  .office.rail-hidden { grid-template-columns: 0px minmax(0, 1fr); }
  .rail { width: var(--rail); transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.45s ease 0.15s; }
  .rail-hidden .rail { transform: translateX(-100%); opacity: 0; pointer-events: none; transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.4s ease 0.25s; }
  .office.no-anim, .office.no-anim * { transition: none !important; }
}
@media (max-width: 880px) { .rail-open, .rail-hide { display: none; } }
@media (prefers-reduced-motion: reduce) { .office, .rail, .rail-open { transition: none !important; } }

/* ------------------------------------------------------------------ tema nella barra in alto */
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar .theme-btn { gap: 8px; }

/* ------------------------------------------------------------------ transizione del cambio tema (gradient forms) */
.themefx { position: fixed; inset: 0; z-index: 600; overflow: hidden; pointer-events: none; background: transparent; }
.themefx canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; opacity: 0; will-change: opacity; }
.themefx-stage { position: absolute; left: 50%; top: 50%; width: 1080px; height: 1080px; transform-origin: center; }
.themefx-label { position: absolute; color: #fff; opacity: 0; will-change: opacity, transform; -webkit-font-smoothing: antialiased; }
.tfx-index { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.75; }
.tfx-name { display: block; margin-top: 12px; font-family: var(--font-sans); font-weight: 200; font-size: 58px; letter-spacing: -0.035em; line-height: 1; }
.tfx-codes { display: flex; gap: 16px; margin-top: 16px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; opacity: 0.85; }
.tfx-code { display: flex; align-items: center; gap: 7px; }
.tfx-chip { width: 9px; height: 9px; border-radius: 2px; box-shadow: 0 0 0 1px var(--ring, rgb(255 255 255 / 0.4)); }


/* grana della transizione: una tessera ripetuta, spostata con transform (solo la scheda video lavora) */
.themefx-grain { position: absolute; left: 0; top: 0; width: calc(100% + 192px); height: calc(100% + 192px); background-repeat: repeat; background-size: 192px 192px; opacity: 0; will-change: transform, opacity; }
.themefx-stage { will-change: transform; }

/* cambio tema della pagina: dissolvenza tra la foto della pagina vecchia e la pagina nuova, fatta dal browser */
.themefx { view-transition-name: themefx; }
::view-transition-old(themefx) { display: none; }
::view-transition-new(themefx) { animation: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.8s; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }

/* tema: solo l'icona, senza pillola */
.theme-icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; transition: color 0.25s, background 0.25s; }
.theme-icon:hover { color: var(--text); background: rgb(var(--text-rgb) / 0.06); }
.theme-icon:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgb(var(--text-rgb) / 0.4); }
.theme-icon .ico { width: 20px; height: 20px; stroke-width: 1.5; animation: theme-ico-in 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes theme-ico-in { from { opacity: 0; transform: rotate(-60deg) scale(0.6); } }


/* ------------------------------------------------------------------ logo SATE (file del cliente, colore del testo del tema) */
.sate-logo { display: block; height: 100%; width: auto; overflow: visible; }
.brand-logo { display: block; flex: none; height: 22px; color: var(--text); transition: color 0.4s; }
.brand-logo.sm { height: 17px; }
.brand-logo.lg { height: 34px; }
.rail .brand { gap: 14px; }
.brand-sub { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; padding-left: 14px; border-left: 1px solid var(--line); line-height: 1; }
.brand-sub b { font-weight: 500; font-size: 14px; letter-spacing: -0.02em; }
.brand-sub .label { font-size: 10px; }
.login-brand { gap: 18px; }
.login-brand > div { padding-left: 18px; border-left: 1px solid var(--line); }
.login-brand h1 { font-size: 22px; line-height: 1.1; }
.tech-header .brand-logo.sm { margin: 0 4px; }


/* ------------------------------------------------------------------ scelta del tema: Chiaro, Scuro, Blu SATE */
.theme-pick { position: relative; }
.theme-pop { min-width: 236px; right: 0; }
.menu-pop .menu-sep { padding: 10px 11px 4px; font-size: 10px; }
[data-theme-set] .theme-name { flex: 1; }
[data-theme-set] > .ico { width: 16px; height: 16px; opacity: 0; transform: scale(0.6); transition: opacity 0.25s, transform 0.35s var(--ease); }
[data-theme-set][aria-checked="true"] > .ico { opacity: 1; transform: none; }
.theme-swatch { display: inline-flex; flex: none; padding: 3px; border-radius: 8px; background: rgb(var(--text-rgb) / 0.05); box-shadow: inset 0 0 0 1px var(--line); }
.theme-swatch i { width: 12px; height: 18px; }
.theme-swatch i:first-child { border-radius: 5px 0 0 5px; }
.theme-swatch i:last-child { border-radius: 0 5px 5px 0; }

/* la scheda del tecnico si apre cliccando ovunque (freccetta compresa), il contenuto aperto resta normale */
.mini-tech { cursor: pointer; }
.mini-tech .mt-body { cursor: auto; }
.mini-tech:hover .mt-chev { color: var(--text); background: rgb(var(--text-rgb) / 0.1); }
.mini-tech.open:hover .mt-chev { background: var(--text); color: var(--page); }
.mt-chev { padding: 0; border: 0; cursor: pointer; font: inherit; }


/* ------------------------------------------------------------------ Gestionale: righe a blocchi, niente scroll di lato */
.totals-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 18px 24px; }
.totals-bar .tot b { font-size: 22px; white-space: nowrap; }

.gl { }
.gl-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 0.95fr) minmax(0, 1.45fr) minmax(0, 1.3fr) minmax(0, 1.9fr);
  gap: 14px 22px; align-items: center; padding: 16px 22px; border-top: 1px solid var(--line); transition: background 0.2s;
}
.gl-row:not(.gl-head):hover { background: rgb(var(--text-rgb) / 0.025); }
.gl-head { border-top: 0; padding-top: 14px; padding-bottom: 12px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--label); }
.gl-head span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 14px; }
.gl-who b { font-weight: 500; font-size: 15px; letter-spacing: -0.01em; }
.gl-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-sub.mono { font-size: 11.5px; }
.gl-sub a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.gl-sub a:hover { color: var(--text); text-decoration-color: currentColor; }

/* campi modificabili: piccola etichetta sopra, nessun bordo finché non ci passi sopra */
.gl-in { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gl-in > span { flex: none; }
.gl-pair .gl-in > span { width: 54px; }
.gl-in > input, .gl-in > select { flex: 1 1 auto; }
.gl-in > span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); }
.gl-in input, .gl-in select { width: 100%; min-width: 0; height: 32px; padding-left: 10px; font-size: 13.5px; border-radius: 9px; background-color: rgb(var(--text-rgb) / 0.035); border-color: transparent; transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s; }
.gl-in select { padding-right: 28px; background-position: right 9px center; text-overflow: ellipsis; }
.gl-in input:hover, .gl-in select:hover { border-color: var(--line-strong); }
.gl-in input:focus, .gl-in select:focus { background-color: var(--field); }
.gl-in input.euro { text-align: right; font-family: var(--font-mono); padding-right: 10px; }
.gl-in .saved { border-color: rgb(var(--done) / 0.8) !important; box-shadow: 0 0 0 3px rgb(var(--done) / 0.15); }
.gl-in .invalid { border-color: rgb(var(--notdone)) !important; }
.gl-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.gl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; }
.gl-note { grid-column: 1 / -1; }

/* importi: quattro cifre con l'etichetta sopra, gli zeri spenti */
.gl-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.gl-fig { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gl-fig i { font-style: normal; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); }
.gl-fig b { font-family: var(--font-mono); font-weight: 400; font-size: 13.5px; white-space: nowrap; }
.gl-fig.zero b { color: var(--label); }
.gl-empty { padding: 34px; }
.gl-more { padding: 16px; border-top: 1px solid var(--line); }

/* spazio medio: le righe vanno su due livelli (chi/dove sopra, campi e importi sotto) */
@media (max-width: 1399px) { /* in base alla finestra, non allo spazio lasciato dal menu: niente salti aprendolo */
  .gl-head { display: none; }
  .gl-row { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 18px 20px; }
  .gl-row + .gl-row:nth-child(2) { border-top: 0; }
}
@media (max-width: 759px) {
  .gl-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-pair, .gl-figs, .gl-edit { grid-column: 1 / -1; }
  .gl-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 459px) {
  .gl-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ------------------------------------------------------------------ menu che scorre: le tabelle pesanti restano ferme
   alla larghezza finale (vedi freezeHeavy in app.js); quello che sborda a destra durante il movimento non si vede. */
.office-main { overflow-x: clip; }
.rail-frozen { max-width: none; flex: none; contain: layout; will-change: transform; }

/* ------------------------------------------------------------------ Gestionale leggero da ridisegnare (scroll Lenis e menu fluidi)
   - le righe fuori dallo schermo non vengono impaginate né dipinte finché non ci si arriva (content-visibility);
   - il pannello lunghissimo della tabella usa un bordo semplice invece della maschera del filo di luce, che su
     5000 px di altezza costava un ridisegno enorme a ogni fotogramma;
   - pannello su un suo livello della scheda video, così scroll e scorrimento del menu lo spostano senza ridipingerlo. */
.gl-row:not(.gl-head) { content-visibility: auto; contain-intrinsic-size: auto 112px; }
.panel-tall::before { display: none; }
.panel-tall { box-shadow: inset 0 0 0 1px var(--line), 0 24px 48px -32px rgb(var(--text-rgb) / 0.18); transform: translateZ(0); }
.gl-row:not(.gl-head):hover { background: rgb(var(--text-rgb) / 0.025); transition: none; }

/* righe alternate: una sì e una no grigio chiaro (dal colore del testo del tema), per seguire la riga con l'occhio */
.gl-row[data-id]:nth-child(odd) { background: rgb(var(--text-rgb) / 0.035); }
.gl-row[data-id]:nth-child(odd) .gl-in input, .gl-row[data-id]:nth-child(odd) .gl-in select { background-color: var(--field); border-color: var(--line); }
.gl-row[data-id]:hover { background: rgb(var(--text-rgb) / 0.06); }

/* Utenti e impostazioni: sempre in alto a destra, icona come quella del tema */
.topbar-settings { order: 10; }
.topbar-settings:hover { text-decoration: none; }
.topbar-settings.active { color: var(--page); background: var(--text); }
.topbar-settings .ico { animation: none; }

/* ------------------------------------------------------------------ campanella delle notifiche */
.notif { position: relative; }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 5px; right: 4px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px;
  display: grid; place-items: center; font: 500 10px/1 var(--font-mono); color: var(--page); background: rgb(var(--notdone));
  box-shadow: 0 0 0 2px var(--page); animation: notif-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.notif-badge[hidden] { display: none; }
@keyframes notif-pop { from { transform: scale(0.3); opacity: 0; } }
.notif-pop { width: 360px; max-width: calc(100vw - 32px); right: -8px; padding: 6px; }
.notif-list { max-height: min(60vh, 440px); overflow-y: auto; scrollbar-width: none; display: grid; gap: 2px; }
.notif-list::-webkit-scrollbar { display: none; }
.notif-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 11px; border-radius: 11px; color: var(--text); position: relative; transition: background 0.2s; }
.notif-item:hover { background: rgb(var(--text-rgb) / 0.06); text-decoration: none; }
.notif-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgb(var(--c, var(--text-rgb)) / 0.12); color: rgb(var(--c, var(--text-rgb))); }
.notif-ico .ico { width: 16px; height: 16px; }
.notif-item.lvl-warn { --c: var(--late); }
.notif-item.lvl-error { --c: var(--notdone); }
.notif-item.lvl-info { --c: var(--info); }
.notif-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notif-txt b { font-weight: 500; font-size: 13.5px; }
.notif-txt small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.notif-txt time { font-size: 9.5px; margin-top: 2px; }
.notif-item.new::after { content: ""; position: absolute; top: 15px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--notdone)); }
.notif-item.new .notif-txt { padding-right: 14px; }
.notif-empty { display: flex; align-items: center; gap: 10px; padding: 18px 12px; color: var(--muted); font-size: 13.5px; }
.notif-empty .ico { width: 18px; height: 18px; color: rgb(var(--done)); }

/* ------------------------------------------------------------------ griglie a colonne fisse
   Il numero di colonne dipende solo dalla larghezza della finestra, non dallo spazio lasciato dal menu: aprendo e
   chiudendo il menu le schede si allargano e si stringono in modo continuo, senza saltare da una riga all'altra. */
.filters-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.filters-grid:has(.search) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.filters-grid .filter, .filters-grid .filter.search { min-width: 0; }
.filters-grid .filter.search { grid-column: span 2; }
.filters-grid > .btn { justify-self: start; }
.filters-grid input, .filters-grid select { width: 100%; min-width: 0; }
.totals-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mini-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1700px) {
  .filters-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .filters-grid:has(.search) { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}
@media (min-width: 1500px) {
  .totals-bar { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .mini-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1099px) {
  .filters-grid, .filters-grid:has(.search) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 699px) {
  .filters-grid, .filters-grid:has(.search) { grid-template-columns: minmax(0, 1fr); }
  .filters-grid .filter.search { grid-column: auto; }
  .totals-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ Materiale: movimenti a blocchi, niente scroll di lato */
.mv-list { display: grid; }
.mv {
  display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.7fr) minmax(0, 1.2fr) auto; gap: 14px 24px;
  align-items: start; padding: 18px 22px; border-top: 1px solid var(--line);
}
.mv:first-child { border-top: 0; }
.mv:nth-child(even) { background: rgb(var(--text-rgb) / 0.025); }
.mv.hl { background: rgb(var(--accent) / 0.08); }
.mv-when { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.mv-tech { font-size: 14px; color: var(--text); }
.mv-items { display: grid; gap: 6px; min-width: 0; }
.mv-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 10px; font-size: 14px; }
.mv-name { min-width: 0; }
.mv-qty { font-family: var(--font-mono); font-weight: 500; font-size: 13.5px; }
.mv-qty.neg { color: rgb(var(--notdone)); }
.mv-doc { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.mv-lab { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); }
.mv-lab:not(:first-child) { margin-top: 8px; }
.mv-by { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.mv-by .btn { margin-top: 6px; }
@media (max-width: 1199px) {
  .mv { grid-template-columns: minmax(130px, 0.8fr) minmax(0, 2fr); }
  .mv-doc { grid-column: 2; }
  .mv-by { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
  .mv-by .btn { margin-top: 0; }
}
@media (max-width: 640px) {
  .mv { grid-template-columns: minmax(0, 1fr); }
  .mv-doc, .mv-by { grid-column: auto; }
}
/* tabelle del riepilogo e degli articoli: intestazioni e celle vanno a capo, nessuna barra di scorrimento */
.table-fit { table-layout: auto; }
.table-fit th { white-space: normal; }
.table-fit td { overflow-wrap: anywhere; }
.table-wrap:has(> .table-fit) { overflow-x: visible; }

/* ------------------------------------------------------------------ schede (Movimenti / Riepilogo / Articoli): pillola che scivola */
.tabs { position: relative; }
.tabs .tab { position: relative; z-index: 1; transition: color 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.tabs-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: 999px; background: var(--text); opacity: 0;
  transition: left 0.5s cubic-bezier(0.22, 1, 0.36, 1), width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.tabs.ready .tabs-ind { opacity: 1; }
.tabs.ready .tab.active { background: transparent; }
.tabs .tab:not(.active):hover { color: var(--text); }
/* il contenuto: esce sfumando e scendendo appena, rientra salendo */
.mat-view { transition: opacity 0.17s ease, transform 0.17s ease; }
.mat-view.mat-out { opacity: 0; transform: translateY(6px); }
.mat-view.mat-in { animation: mat-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes mat-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .tabs-ind, .mat-view { transition: none; animation: none; } }

/* logo e "Agenda" nel menu: riportano alla Dashboard */
.brand-home { display: flex; align-items: center; gap: 14px; min-width: 0; color: var(--text); border-radius: 10px; }
.brand-home:hover { text-decoration: none; }
.brand-home:focus-visible { outline: none; box-shadow: 0 0 0 2px rgb(var(--text-rgb) / 0.35); }

/* menu che si apre o si chiude: per quei 0,7 s la barra in alto rinuncia alla sfocatura (costosa da ricalcolare a ogni
   fotogramma mentre cambia larghezza) e le schede della Dashboard si impaginano ognuna per conto suo */
.office.rail-moving .topbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--page); }
.mini-tech, .kpi { contain: layout style; }
