/* ══════════════════════════════════════════
   Gestionale dello studio — base chiara e morbida
   Tutti i colori derivano da un solo accento (--acc), scelto nelle Impostazioni.
   ══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --acc: #6B8F7B;              /* accento: lo cambia la palette scelta */
  --on-acc: #FFFFFF;           /* testo sopra l'accento */

  /* Neutri chiari, leggermente tinti dall'accento */
  --bg: color-mix(in srgb, var(--acc) 4%, #FAF8F5);
  --bg-2: color-mix(in srgb, var(--acc) 6%, #F4F1EC);
  --surface: #FFFFFF;
  --surface-2: color-mix(in srgb, var(--acc) 5%, #F8F6F2);
  --surface-3: color-mix(in srgb, var(--acc) 9%, #F0EDE7);
  --line: color-mix(in srgb, var(--acc) 7%, #EAE6DF);
  --line-2: color-mix(in srgb, var(--acc) 10%, #DCD7CE);
  --text: #26231F;
  --text-2: #5F5A52;
  --muted: #8E887E;

  --acc-text: color-mix(in srgb, var(--acc) 80%, #000);
  --acc-soft: color-mix(in srgb, var(--acc) 12%, transparent);
  --acc-line: color-mix(in srgb, var(--acc) 38%, transparent);
  --acc-hover: color-mix(in srgb, var(--acc) 88%, #000);

  --ok: #3E8A5F;   --warn: #B7791F;   --bad: #C0564A;   --info: #4D72A6;
  --ok-soft: color-mix(in srgb, var(--ok) 12%, transparent);
  --warn-soft: color-mix(in srgb, var(--warn) 13%, transparent);
  --bad-soft: color-mix(in srgb, var(--bad) 11%, transparent);
  --info-soft: color-mix(in srgb, var(--info) 11%, transparent);

  --shadow: 0 1px 2px rgba(40, 34, 25, .04), 0 8px 24px -12px rgba(40, 34, 25, .12);
  --shadow-lg: 0 30px 60px -20px rgba(40, 34, 25, .28);
  --overlay: rgba(38, 35, 31, .32);
  --glass: color-mix(in srgb, var(--bg) 82%, transparent);

  --serif: 'Instrument Serif', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --r: 16px;
  --r-sm: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

/* Modalità scura (scelta nelle Impostazioni o automatica) */
:root[data-scheme="dark"] {
  --bg: color-mix(in srgb, var(--acc) 5%, #121314);
  --bg-2: color-mix(in srgb, var(--acc) 6%, #16171A);
  --surface: color-mix(in srgb, var(--acc) 4%, #1A1B1E);
  --surface-2: color-mix(in srgb, var(--acc) 6%, #212226);
  --surface-3: color-mix(in srgb, var(--acc) 8%, #292A2F);
  --line: color-mix(in srgb, var(--acc) 6%, #2A2B30);
  --line-2: color-mix(in srgb, var(--acc) 9%, #373840);
  --text: #ECE9E3;
  --text-2: #ABA79F;
  --muted: #77746D;
  --acc-text: color-mix(in srgb, var(--acc) 62%, #fff);
  --acc-soft: color-mix(in srgb, var(--acc) 18%, transparent);
  --acc-line: color-mix(in srgb, var(--acc) 45%, transparent);
  --acc-hover: color-mix(in srgb, var(--acc) 85%, #fff);
  --ok: #86B094;   --warn: #D9A95B;   --bad: #D98474;   --info: #93A7C6;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 40px -24px rgba(0,0,0,.8);
  --shadow-lg: 0 40px 80px -20px rgba(0,0,0,.85);
  --overlay: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  background: var(--bg); color: var(--text); min-height: 100vh;
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 520px at 88% -12%, color-mix(in srgb, var(--acc) 10%, transparent), transparent 62%),
    radial-gradient(700px 520px at -10% 112%, color-mix(in srgb, var(--acc) 6%, transparent), transparent 60%);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--acc-soft); }
.hidden { display: none !important; }
/* Contorno di focus: discreto, nel colore dello studio, solo quando si usa la tastiera */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--acc-line); outline-offset: 2px; }
.nav-item:focus-visible, .tab-item:focus-visible { outline-offset: -2px; }
.spacer { flex: 1; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.muted-txt { color: var(--muted); font-size: 12.5px; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--acc-text); font-weight: 500; margin-bottom: 6px; }
.display { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; line-height: 1.05; }
.display em { font-style: italic; color: var(--acc-text); }

.kbd, kbd {
  font-family: var(--sans); font-size: 11px; color: var(--text-2);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; background: var(--surface); white-space: nowrap;
}

/* ─────────── Monogramma / logo ─────────── */
.monogram {
  width: 64px; height: 64px; margin: 0 auto 24px; border-radius: 20px; overflow: hidden;
  display: grid; place-items: center; font-family: var(--serif); font-size: 28px; color: var(--on-acc);
  background: linear-gradient(145deg, var(--acc), var(--acc-hover));
  box-shadow: 0 0 0 6px var(--acc-soft), 0 16px 30px -12px color-mix(in srgb, var(--acc) 60%, transparent);
}
.monogram.sm { width: 38px; height: 38px; margin: 0; border-radius: 12px; font-size: 17px; box-shadow: none; flex-shrink: 0; }
.monogram.logo { background: var(--surface); border: 1px solid var(--line); }
.monogram img { width: 100%; height: 100%; object-fit: contain; padding: 12%; }
.monogram.icona img { object-fit: cover; padding: 0; }

/* ─────────── Accesso ─────────── */
.login { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; overflow: hidden; }
.login-glow { position: absolute; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--acc) 18%, transparent), transparent 65%); filter: blur(20px); animation: breathe 9s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .7; } }
.login-box { position: relative; width: 100%; max-width: 380px; text-align: center; }
.login-box .display { font-size: 50px; margin-bottom: 10px; }
.login-note { color: var(--text-2); margin-bottom: 28px; }
.login-fields { display: flex; flex-direction: column; gap: 10px; }
.login-fields > input, .login-field {
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--glass);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: border-color .2s, box-shadow .2s;
}
.login-fields > input { height: 54px; padding: 0 18px; outline: none; font-size: 16px; }
.login-fields > input:focus, .login-field:focus-within { border-color: var(--acc-line); box-shadow: 0 0 0 4px var(--acc-soft); }
.login-field { display: flex; align-items: center; gap: 6px; padding: 6px; }
.login-field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 10px 12px; font-size: 16px; }
.login-go { width: 42px; height: 42px; border-radius: 10px; background: var(--acc); color: var(--on-acc); display: grid; place-items: center; transition: background .2s; flex-shrink: 0; }
.login-go:hover { background: var(--acc-hover); }
.login-go:disabled { opacity: .5; }
.login-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-error { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 14px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ─────────── Struttura ─────────── */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  padding: 22px 14px; border-right: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; min-width: 0; }
.brand-txt { min-width: 0; }
.brand-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-size: 14px; text-align: left;
  transition: background .2s, color .2s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.nav-item.active .ico { color: var(--acc-text); }
.nav-item .kbd { margin-left: auto; }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: none; place-items: center; background: var(--acc-soft); color: var(--acc-text); }
.nav-badge.on { display: grid; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 16px; border-top: 1px solid var(--line); }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 14px;
  padding: 0 36px; border-bottom: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.crumb .ico { width: 14px; height: 14px; color: var(--muted); }
.crumb-root { color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sync { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync:not(:empty)::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sync.saving { color: var(--acc-text); }
.sync.ok { color: var(--ok); }
.sync.err { color: var(--bad); }
.search-btn {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px 0 12px; min-width: 230px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 13px;
  transition: border-color .2s;
}
.search-btn:hover { border-color: var(--line-2); color: var(--text-2); }
.search-btn .kbd { margin-left: auto; }

.view { width: 100%; max-width: 1280px; margin: 0 auto; padding: 36px 36px 80px; }
.view.enter { animation: enter .4s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

/* ─────────── Bottoni ─────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 10px; font-size: 13.5px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  transition: background .2s, border-color .2s, color .2s, transform .1s;
}
.btn:hover { border-color: var(--acc-line); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.btn.primary:hover { background: var(--acc-hover); border-color: var(--acc-hover); }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.sm .ico { width: 14px; height: 14px; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .ico { width: 16px; height: 16px; }
.only-mobile { display: none; }

/* ─────────── Intestazioni ─────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .display { font-size: 48px; }
.sub { color: var(--text-2); margin-top: 8px; }
.sub b { color: var(--text); font-weight: 600; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ─────────── Card, KPI, chip ─────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 22px; box-shadow: var(--shadow); min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 12.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); }
.card-note { color: var(--text-2); font-size: 13px; margin-bottom: 14px; }
.card-note a, .link { color: var(--acc-text); text-decoration: underline; text-decoration-color: var(--acc-line); text-underline-offset: 2px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; min-width: 0; box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.kpi-value { font-family: var(--serif); font-size: 32px; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
}
.chip .ico { width: 12px; height: 12px; }
.chip.acc { background: var(--acc-soft); color: var(--acc-text); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }

.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty-ico { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc-text); }
.empty-ico .ico { width: 24px; height: 24px; }
.empty h4 { font-family: var(--serif); font-weight: 400; font-size: 26px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 420px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 20px;
  border: 1px solid var(--acc-line); border-radius: var(--r); background: var(--acc-soft); color: var(--text);
}
.banner .ico { color: var(--acc-text); }
.banner span { flex: 1; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.banner.warn .ico { color: var(--warn); }

/* ─────────── Controlli ─────────── */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px; font-size: 13px; color: var(--text-2); transition: background .2s, color .2s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button .ico { width: 16px; height: 16px; }
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; padding: 10px 0 12px; color: var(--muted); font-size: 14px; white-space: nowrap; transition: color .2s; }
.tab:hover { color: var(--text-2); }
.tab.on { color: var(--text); }
.tab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--acc); border-radius: 2px; }

/* ─────────── Righe ─────────── */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.card.flush .row { padding: 12px 18px; }
.row:last-child { border-bottom: 0; }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title b { font-weight: 500; }
.row-title small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.row-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--text-2); }
.row-ico .ico { width: 16px; height: 16px; }
.row-ico.ok { background: var(--ok-soft); color: var(--ok); }
.row-ico.bad { background: var(--bad-soft); color: var(--bad); }
.row-ico.warn { background: var(--warn-soft); color: var(--warn); }
.row-ico.acc { background: var(--acc-soft); color: var(--acc-text); }

/* ─────────── Oggi ─────────── */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 28px; }
.hero > div:first-child { flex: 1; min-width: 0; }
.hero .display { font-size: 58px; }
.hero-sum { color: var(--text-2); font-size: 15px; margin-top: 12px; max-width: 620px; }
.hero-sum b { color: var(--text); font-weight: 600; }
.hero-clock { text-align: right; }
.clock { font-family: var(--serif); font-size: 58px; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-date { color: var(--muted); font-size: 13px; margin-top: 6px; }

.steps { display: flex; flex-direction: column; }
.step { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-dot { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 13px; font-weight: 600; border: 1.5px solid var(--line-2); color: var(--muted); }
.step-dot .ico { width: 15px; height: 15px; stroke-width: 2.4; }
.step.done .step-dot { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.step-main { flex: 1; min-width: 0; }
.step-main b { display: block; font-weight: 500; }
.step.done .step-main b { color: var(--text-2); }
.step-main small { color: var(--muted); font-size: 12.5px; }
.step .chip { flex-shrink: 0; }

/* ─────────── Impostazioni ─────────── */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.settings .card + .card { margin-top: 0; }
.settings .span-all { grid-column: 1 / -1; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-bottom: 18px; }
.theme {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; text-align: left;
  border: 1px solid var(--line); background: var(--surface); transition: border-color .2s, box-shadow .2s;
}
.theme:hover { border-color: var(--line-2); }
.theme.on { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.theme-prev { height: 44px; border-radius: 8px; display: flex; align-items: flex-end; gap: 4px; padding: 7px; background: color-mix(in srgb, var(--t) 8%, #FAF8F5); border: 1px solid color-mix(in srgb, var(--t) 12%, #EAE6DF); }
.theme-prev i { display: block; border-radius: 4px; background: var(--t); }
.theme-prev i:nth-child(1) { width: 38%; height: 100%; }
.theme-prev i:nth-child(2) { width: 22%; height: 60%; opacity: .45; }
.theme-prev i:nth-child(3) { width: 22%; height: 35%; opacity: .25; }
.theme span { font-size: 12.5px; font-weight: 500; }
.theme .ico { position: absolute; top: 8px; right: 8px; width: 16px; height: 16px; padding: 2px; border-radius: 50%; background: var(--acc); color: var(--on-acc); stroke-width: 3; display: none; }
.theme.on .ico { display: block; }
:root[data-scheme="dark"] .theme-prev { background: color-mix(in srgb, var(--t) 10%, #1A1B1E); border-color: color-mix(in srgb, var(--t) 18%, #2A2B30); }
.theme.custom .theme-prev { background: conic-gradient(from 90deg, #C0564A, #B7791F, #3E8A5F, #4D72A6, #8475B8, #C0564A); border: 0; }
.color-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.color-line input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); cursor: pointer; }

.diag { list-style: none; display: flex; flex-direction: column; margin-top: 4px; }
.diag li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.diag li:last-child { border-bottom: 0; }
.diag li span { flex: 1; min-width: 0; }
.diag li small { color: var(--muted); font-size: 12px; text-align: right; }
.diag .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.diag .ok .dot { background: var(--ok); }
.diag .errore .dot { background: var(--bad); }
.diag .avviso .dot { background: var(--warn); }
.diag .errore span { color: var(--bad); }

.dev-list .row-title small { white-space: nowrap; }
.log-list .row { padding: 9px 0; font-size: 13px; }
.log-list time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.app-version { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; }

.install-steps { counter-reset: s; list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 6px 0 4px; }
.install-steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--text-2); }
.install-steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--acc-soft); color: var(--acc-text); }
.install-steps b { color: var(--text); font-weight: 600; }
.install-steps .ico { width: 16px; height: 16px; vertical-align: -3px; color: var(--info); }

/* ─────────── Form ─────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid > .full { grid-column: 1 / -1; }
.form-sec { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--acc-text); font-weight: 600; margin: 8px 0 -2px; }
.form-sec:first-child { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field label i { color: var(--acc-text); font-style: normal; }
.field small { font-size: 11.5px; color: var(--muted); }
.field input:not([type=checkbox]):not([type=radio]):not([type=color]), .field select, .field textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; padding-right: 32px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E887E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--acc-line); box-shadow: 0 0 0 3px var(--acc-soft); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input[type=date], .field input[type=time] { -webkit-appearance: none; appearance: none; min-height: 42px; }
.check-line { display: flex; align-items: center; gap: 10px; min-height: 42px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.check-line input { width: 18px; height: 18px; accent-color: var(--acc); flex-shrink: 0; }

/* ─────────── Modale ─────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s;
}
.modal-overlay.in { opacity: 1; }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.99); transition: transform .3s var(--ease);
}
.modal.wide { max-width: 820px; }
.modal-overlay.in .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 24px 4px; }
.modal-head h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; }
.modal-head p { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.modal-body { padding: 18px 24px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }
.confirm-text { color: var(--text-2); font-size: 14.5px; }

/* ─────────── Ricerca (⌘K) ─────────── */
.palette { position: fixed; inset: 0; z-index: 150; background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette-box { width: 100%; max-width: 600px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); animation: enter .25s var(--ease); }
#palette-input { width: 100%; height: 58px; padding: 0 20px; background: none; border: 0; border-bottom: 1px solid var(--line); outline: none; font-size: 16px; }
#palette-input::placeholder { color: var(--muted); }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.pal-group { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 9px; text-align: left; color: var(--text-2); }
.pal-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item em { font-style: normal; font-size: 12px; color: var(--muted); }
.pal-item .ico { width: 16px; height: 16px; }
.pal-item.on { background: var(--surface-3); color: var(--text); }
.pal-item.on .ico { color: var(--acc-text); }
.pal-empty { padding: 24px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.palette-foot kbd { margin-right: 3px; }

/* ─────────── Avvisi ─────────── */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-radius: 12px;
  background: #26231F; color: #F4F1EC; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: toast-in .3s var(--ease);
}
:root[data-scheme="dark"] .toast { background: #2E2F34; border: 1px solid var(--line-2); }
.toast::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #86B094; flex-shrink: 0; }
.toast.err::before { background: #E08A7B; }
.toast button { color: color-mix(in srgb, var(--acc) 55%, #fff); font-weight: 600; font-size: 13px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ─────────── Pagina di installazione ─────────── */
.install { display: grid; place-items: start center; padding: 48px 16px; }
.install-box { position: relative; z-index: 1; width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.install-box .display { font-size: 40px; margin-bottom: 4px; }
.install-box .sub { margin-bottom: 18px; }
.install-req { list-style: none; display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 13px; margin-bottom: 18px; }
.install-err { border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; font-size: 13.5px; }
.install-ok { font-family: var(--serif); font-size: 26px; color: var(--ok); margin: 10px 0; }
.install-config { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; padding: 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); margin: 10px 0 16px; }

/* ═════════════ Tappa 2: sedute, agenda, pazienti ═════════════ */
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack > .card + .card { margin-top: 0; }
.card-head.pad { padding: 16px 20px 0; margin-bottom: 8px; }
.pad-b { padding: 0 20px 10px; }
.link-more { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 12.5px; }
.link-more:hover { color: var(--acc-text); }
.link-more .ico { width: 14px; height: 14px; }
.el-vuoto { padding: 16px 20px; color: var(--muted); font-size: 13px; }
.el-tit { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin: 22px 0 10px 4px; }
.row.clickable { cursor: pointer; }
.card.flush .row.clickable:hover, .paz-riga:hover { background: var(--surface-2); }

/* avatar */
.avatar { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--acc-soft); color: var(--acc-text); }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; font-family: var(--serif); font-weight: 400; }

/* riga seduta */
.seduta { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s; min-width: 0; }
.seduta:last-child { border-bottom: 0; }
.seduta:hover { background: var(--surface-2); }
.sed-ora { width: 48px; flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sed-ora small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.sed-ora b { display: block; font-weight: 600; font-size: 14px; }
.sed-ora span { font-size: 11.5px; color: var(--muted); }
.sed-bar { width: 3px; align-self: stretch; border-radius: 3px; background: var(--c); flex-shrink: 0; }
.sed-main { flex: 1; min-width: 0; }
.sed-main b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sed-main span { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.sed-main .ico { width: 13px; height: 13px; }
.sed-az { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.seduta.st-disdetta .sed-main b, .seduta.st-disdetta_tardiva .sed-main b { text-decoration: line-through; color: var(--muted); }
.seduta.st-assente .sed-main b { color: var(--muted); }
.seduta.imp .sed-bar { background: repeating-linear-gradient(180deg, var(--c) 0 4px, transparent 4px 7px); }

/* promemoria */
.btn.wa { color: #1F8A4C; border-color: color-mix(in srgb, #25D366 40%, transparent); }
.btn.wa:hover { background: color-mix(in srgb, #25D366 10%, transparent); border-color: #25D366; }
:root[data-scheme="dark"] .btn.wa { color: #5FD18E; }
.prom-riga { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; cursor: pointer; }
.prom-riga:last-child { border-bottom: 0; }
.prom-chi { flex: 1; min-width: 150px; display: flex; gap: 10px; align-items: baseline; }
.prom-chi b { font-variant-numeric: tabular-nums; }
.prom-chi span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prom-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.prom-lab { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.prom-lab .ico { width: 14px; height: 14px; }

/* finestra seduta */
.seg-full { display: flex; width: 100%; }
.seg-full button { flex: 1; justify-content: center; }
.seg-wrap { flex-wrap: wrap; }
.form-grid.inner { grid-template-columns: 1fr 1fr; gap: 12px; }
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.picker:focus-within { border-color: var(--acc-line); box-shadow: 0 0 0 3px var(--acc-soft); }
.pk-chips { display: contents; }
.pk-chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 10px; border-radius: 15px; background: var(--acc-soft); color: var(--acc-text); font-size: 13px; font-weight: 500; }
.pk-chip em { font-style: normal; font-size: 11px; opacity: .75; }
.pk-chip button { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.pk-chip button:hover { background: var(--acc-soft); }
.pk-chip .ico { width: 12px; height: 12px; }
.field .picker input { flex: 1; min-width: 160px; height: 30px !important; border: 0 !important; box-shadow: none !important; padding: 0 4px !important; background: none !important; }
.pk-list { margin-top: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); padding: 4px; max-height: 260px; overflow-y: auto; }
.pk-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; text-align: left; color: var(--text); }
.pk-item:hover { background: var(--surface-3); }
.pk-item .ico { width: 16px; height: 16px; color: var(--muted); }
.pk-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-item em { font-style: normal; font-size: 12px; color: var(--muted); }
.pk-item.nuovo { color: var(--acc-text); }
.pk-item.nuovo .ico { color: var(--acc-text); }
.pk-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.field label .ico { width: 14px; height: 14px; vertical-align: -2px; }
.serie-box { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; }
.serie-box .check-line { min-height: 32px; }
.avviso-sovr { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--text); font-size: 13px; }
.avviso-sovr .ico { color: var(--warn); margin-top: 1px; }
.sez-minore { border: 1px dashed var(--line-2); border-radius: 14px; padding: 14px; }
.sez-minore .form-sec { margin-top: 0; margin-bottom: 12px; }
.gen-riga + .gen-riga { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.sez-minore > small { display: block; margin-top: 10px; }

/* agenda: intestazione */
.ag-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.ag-titolo { font-size: 42px; }
.ag-ctrl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ag-nav { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.ag-nav .icon-btn { width: 30px; height: 30px; }
.ag-nav .btn.sm { border: 0; }

/* striscia dei giorni */
.striscia { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.str-g { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 6px; border-radius: 12px; border: 1px solid transparent; color: var(--text-2); }
.str-g span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.str-g b { font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.1; }
.str-g i { font-style: normal; height: 10px; line-height: 8px; font-size: 14px; color: var(--acc-text); letter-spacing: 1px; }
.str-g.oggi b { color: var(--acc-text); }
.str-g.on { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); color: var(--text); }

/* griglia oraria */
.cal { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.cal-head, .cal-body { display: grid; grid-template-columns: 54px repeat(var(--n), minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--line); }
.cal-dh { display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px; border-left: 1px solid var(--line); color: var(--text-2); }
.cal-dh:hover { background: var(--surface-2); }
.cal-dh span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cal-dh b { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.1; }
.cal-dh.oggi b { color: var(--on-acc); background: var(--acc); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; font-size: 20px; }
.cal-scroll { max-height: calc(100vh - 250px); max-height: calc(100dvh - 250px); overflow-y: auto; overscroll-behavior: contain; }
.cal-body { position: relative; }
.cal-ore { position: relative; }
.cal-ore span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-ore span:first-child { transform: none; }
.cal-col { position: relative; border-left: 1px solid var(--line); cursor: cell;
  background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--h)); }
.cal-col.chiuso, .cal-off { background-color: color-mix(in srgb, var(--surface-3) 55%, transparent); }
.cal-off { position: absolute; left: 0; right: 0; pointer-events: none; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 3; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.ev {
  position: absolute; z-index: 2; margin-left: 2px; padding: 4px 7px; border-radius: 8px; overflow: hidden; text-align: left;
  display: flex; flex-direction: column; gap: 1px; cursor: pointer; font-size: 12px; line-height: 1.25;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  border-left: 3px solid var(--c); color: var(--text); transition: box-shadow .15s, transform .15s;
}
.ev:hover { box-shadow: var(--shadow); z-index: 4; }
.ev b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev small { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.ev.corto { flex-direction: row; align-items: center; gap: 6px; padding-top: 2px; padding-bottom: 2px; }
.ev.corto small { order: -1; }
.ev-ico { position: absolute; right: 5px; bottom: 4px; display: flex; gap: 3px; color: var(--text-2); }
.ev-ico .ico { width: 12px; height: 12px; }
.ev.corto .ev-ico { position: static; margin-left: auto; }
.ev.st-svolta { background: color-mix(in srgb, var(--c) 9%, var(--surface)); }
.ev.st-disdetta, .ev.st-disdetta_tardiva, .ev.st-assente { opacity: .55; }
.ev.st-disdetta b, .ev.st-disdetta_tardiva b { text-decoration: line-through; }
.ev.imp { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 10%, var(--surface)) 0 6px, var(--surface) 6px 12px); }
.ev.drag { opacity: .85; box-shadow: var(--shadow-lg); z-index: 10; cursor: grabbing; }
.cal.uno .ev { font-size: 13px; padding: 6px 10px; }
.cal.uno .ev small { font-size: 12px; }

/* mese */
.mese { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.mese-h, .mese-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mese-h span { padding: 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); }
.mese-g { position: relative; min-height: 104px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 2px; text-align: left; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.mese-g:nth-child(7n) { border-right: 0; }
.mese-g:hover { background: var(--surface-2); }
.mese-g.fuori { background: var(--bg-2); }
.mese-g.fuori .mese-n { color: var(--muted); }
.mese-n { font-size: 13px; font-weight: 500; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.mese-g.oggi .mese-n { background: var(--acc); color: var(--on-acc); }
.mese-g i { font-style: normal; font-size: 11.5px; padding: 1px 5px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 14%, transparent); border-left: 2px solid var(--c); }
.mese-g i em { font-style: normal; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mese-g i.ann { opacity: .5; text-decoration: line-through; }
.mese-g small { font-size: 11px; color: var(--muted); padding-left: 5px; }
.mese-dot { display: none; }

/* elenco */
.el-giorno { margin-bottom: 18px; }
.el-giorno h4 { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0 0 8px 4px; }
.el-giorno.oggi h4 { color: var(--acc-text); }

/* pazienti */
.search-field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; flex: 1; min-width: 200px; max-width: 420px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.search-field:focus-within { border-color: var(--acc-line); box-shadow: 0 0 0 3px var(--acc-soft); }
.search-field .ico { color: var(--muted); width: 16px; height: 16px; }
.search-field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { height: 32px; padding: 0 13px; border-radius: 16px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 12.5px; background: var(--surface); transition: all .2s; white-space: nowrap; }
.chip-btn:hover { color: var(--text); }
.chip-btn.on { border-color: var(--acc); color: var(--acc-text); background: var(--acc-soft); }
.paz-riga { cursor: pointer; }
.paz-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.paz-pross { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); min-width: 110px; justify-content: flex-end; white-space: nowrap; }
.paz-pross .ico { width: 14px; height: 14px; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.back-link:hover { color: var(--acc-text); }
.back-link .ico { width: 16px; height: 16px; }
.paz-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.paz-tit { flex: 1; min-width: 200px; }
.paz-tit .display { font-size: 44px; }
.paz-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.paz-az { display: flex; align-items: center; gap: 8px; }
.icon-btn.tondo { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); }
.icon-btn.tondo .ico { width: 18px; height: 18px; }
.tabs .tab { background: none; }
.info-list { display: flex; flex-direction: column; }
.info-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.info-list > div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); flex-shrink: 0; }
.info-list b { font-weight: 500; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.testo-note { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: 14px; line-height: 1.6; }
.diario { display: flex; flex-direction: column; gap: 14px; }
.diario .card + .card { margin-top: 0; }
.nota { cursor: pointer; }
.nota:hover { border-color: var(--acc-line); }
.nota h3 { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }

/* impostazioni agenda */
.ed-righe { display: flex; flex-direction: column; gap: 10px; }
.ed-riga { display: grid; align-items: end; gap: 10px; }
.ed-riga.sede { grid-template-columns: 1fr 1.6fr 32px; }
.ed-riga.tipo { grid-template-columns: 10px 1.6fr 90px 100px 1fr 32px; }
.ed-riga .icon-btn { margin-bottom: 5px; }
.ed-colore { width: 10px; height: 42px; border-radius: 5px; background: var(--c); align-self: end; }
.orari { display: flex; flex-direction: column; }
.orario { display: grid; grid-template-columns: 150px 110px 14px 110px; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.orario:last-child { border-bottom: 0; }
.orario input[type=time] { height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); -webkit-appearance: none; appearance: none; }
.orario.off input[type=time], .orario.off .muted-txt { opacity: .35; }
.anteprima-msg { margin-top: 14px; padding: 14px 16px; border-radius: 14px 14px 14px 4px; max-width: 520px; white-space: pre-wrap; font-size: 14px;
  background: color-mix(in srgb, #25D366 12%, var(--surface)); border: 1px solid color-mix(in srgb, #25D366 25%, transparent); }

@media (max-width: 960px) {
  .cal-scroll { max-height: none; overflow: visible; }
  .ag-titolo { font-size: 34px; }
  .orario input[type=time] { font-size: 16px; }
}
@media (max-width: 700px) {
  .ag-head { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 12px; }
  .ag-titolo { font-size: 30px; }
  .ag-ctrl { justify-content: space-between; }
  .cal-head, .cal-body { grid-template-columns: 44px repeat(var(--n), minmax(0, 1fr)); }
  .mese-g { min-height: 58px; padding: 4px; align-items: center; }
  .mese-g i, .mese-g small { display: none; }
  .mese-dot { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 10.5px; font-weight: 600; background: var(--acc-soft); color: var(--acc-text); margin-top: 2px; }
  .seduta { padding: 12px 14px; gap: 12px; }
  .sed-az .chip { display: none; }
  .seduta .sed-az .btn span { display: none; }
  .paz-meta .paz-pross, .paz-meta .chip:not(.info) { display: none; }
  .paz-head { gap: 14px; }
  .paz-tit .display { font-size: 34px; }
  .paz-az { width: 100%; }
  .paz-az .btn { margin-left: auto; }
  .ed-riga.sede { grid-template-columns: 1fr 32px; }
  .ed-riga.sede > .field:nth-of-type(2) { grid-column: 1; }
  .ed-riga.tipo { grid-template-columns: 10px 1fr 1fr 32px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .ed-riga.tipo > .field:nth-of-type(1) { grid-column: 2 / 4; }
  .ed-riga.tipo .ed-colore { grid-row: 1 / 3; height: auto; align-self: stretch; }
  .ed-riga.tipo > .icon-btn { grid-column: 4; grid-row: 1; }
  .ed-riga .field label:empty { display: none; }
  .orario { grid-template-columns: 1fr 96px 10px 96px; gap: 6px; }
  .prom-riga { padding: 10px 14px; }
  .chips-row { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .chips-row::-webkit-scrollbar { display: none; }
  .search-field { max-width: none; }
  .form-grid.inner { grid-template-columns: 1fr 1fr; }
}

/* ═════════════ Tappa 3: pagamenti e fatture ═════════════ */
.select { height: 38px; padding: 0 32px 0 12px; border: 1px solid var(--line-2); border-radius: 10px; appearance: none; -webkit-appearance: none; outline: none; color: var(--text);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E887E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; }
.amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; min-width: 76px; text-align: right; }
.card.flush > .row { padding: 12px 20px; }
.inc-riga .btn span, .pag-row .btn span { white-space: nowrap; }
.pag-row { cursor: pointer; }
.pag-row:hover, .fatt-row:hover { background: var(--surface-2); }
.fatt-row { color: inherit; }
.fatt-num { width: 52px; flex-shrink: 0; font-family: var(--serif); font-size: 22px; line-height: 1; }
.fatt-num small { font-family: var(--sans); font-size: 11px; color: var(--muted); }
a.chip { text-decoration: none; }
a.chip:hover { filter: brightness(.96); }

.sed-lista { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.sed-check { min-height: 38px; }
.sed-check span { flex: 1; }
.sed-check em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--text); }
.pag-riga { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.pag-riga span { flex: 1; min-width: 180px; }
.pag-riga > .ico { color: var(--acc-text); }
.num-fatt { height: 42px; display: flex; align-items: center; font-family: var(--serif); font-size: 24px; }
.righe-fatt { display: flex; flex-direction: column; gap: 8px; }
.riga-f { display: grid; grid-template-columns: 1fr 110px 32px; gap: 8px; align-items: center; }
.riga-f input { height: 40px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); outline: none; min-width: 0; }
.riga-f input:focus { border-color: var(--acc-line); box-shadow: 0 0 0 3px var(--acc-soft); }
.riga-f input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
.totali-fatt { display: flex; flex-direction: column; gap: 4px; margin-left: auto; width: 100%; max-width: 360px; }
.totali-fatt > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--text-2); }
.totali-fatt > div b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.totali-fatt .tot { border-top: 1px solid var(--line-2); padding-top: 8px; margin-top: 4px; font-size: 15px; color: var(--text); }
.totali-fatt .tot b { font-weight: 700; }
.totali-fatt .avviso-sovr { margin-top: 8px; }
.prossima-fatt { padding: 10px 14px; border-radius: 10px; background: var(--acc-soft); color: var(--text); font-size: 13px; }
.esempi { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }

.barre { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 180px; align-items: end; margin-top: 8px; }
.barra { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.barra i { display: block; width: 100%; max-width: 30px; min-height: 2px; border-radius: 6px 6px 3px 3px; background: color-mix(in srgb, var(--acc) 45%, transparent); }
.barra.cur i { background: var(--acc); }
.barra span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; }
.barra em { position: absolute; top: -2px; font-style: normal; font-size: 10px; color: var(--text-2); display: none; }
.barra:hover em { display: block; }
.table-view { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.table-view summary { cursor: pointer; width: max-content; }
.table-view table { width: 100%; margin-top: 8px; border-collapse: collapse; color: var(--text-2); }
.table-view td { padding: 5px 2px; border-bottom: 1px solid var(--line); }
.table-view td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* Documento fattura (schermo e stampa) */
.fatt-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.fatt-bar .back-link { margin: 0; }
.doc { max-width: 800px; margin: 0 auto; background: #fff; color: #222; border: 1px solid var(--line); border-radius: 12px; padding: 48px 52px; box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.55; font-family: var(--sans); }
.doc-head { display: flex; justify-content: space-between; gap: 30px; padding-bottom: 24px; border-bottom: 2px solid #222; }
.doc-head h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1; margin-bottom: 4px; }
.doc-head p { color: #555; font-size: 12px; }
.doc-logo { max-height: 56px; max-width: 180px; margin-bottom: 10px; display: block; }
.doc-num { text-align: right; flex-shrink: 0; }
.doc-num span { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #777; }
.doc-num b { display: block; font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; }
.doc-num em { font-style: normal; color: #555; }
.doc-parti { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 0; }
.doc-lab { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #777; margin-bottom: 4px; }
.doc-parti b { font-size: 14px; }
.doc-parti p { color: #444; }
.doc-righe, .doc-tot { width: 100%; border-collapse: collapse; }
.doc-righe th { text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #777; font-weight: 500; padding: 8px 0; border-bottom: 1px solid #ccc; }
.doc-righe td { padding: 10px 0; border-bottom: 1px solid #eee; vertical-align: top; }
.doc-righe th:last-child, .doc-righe td:last-child, .doc-tot td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 20px; }
.doc-tot { width: 320px; margin: 16px 0 0 auto; }
.doc-tot td { padding: 5px 0; color: #444; }
.doc-tot .tot td { border-top: 2px solid #222; padding-top: 10px; font-size: 16px; font-weight: 700; color: #222; }
.doc-pie { margin-top: 28px; padding-top: 16px; border-top: 1px solid #ddd; color: #444; display: flex; flex-direction: column; gap: 6px; }
.doc-calce { white-space: pre-line; font-size: 11.5px; color: #666; }

@media (max-width: 700px) {
  .doc { padding: 24px 18px; border-radius: 10px; font-size: 12.5px; }
  .doc-head { flex-direction: column; gap: 14px; }
  .doc-num { text-align: left; }
  .doc-parti { grid-template-columns: 1fr; gap: 14px; }
  .doc-tot { width: 100%; }
  .riga-f { grid-template-columns: 1fr 90px 32px; }
  .inc-riga .chip { display: none; }
  .inc-riga .btn span { display: none; }
  .inc-riga .btn { width: 36px; padding: 0; }
  .card.flush > .row { padding: 12px 14px; }
  .pag-row .btn span { display: none; }
  .barre { gap: 3px; height: 150px; }
}

@media print {
  @page { size: A4; margin: 16mm 14mm; }
  html, body { background: #fff !important; }
  body::before, .sidebar, .topbar, .tabbar, .no-print, .toasts, #modal-root, .scrim { display: none !important; }
  .shell { display: block; }
  .view { padding: 0 !important; max-width: none; animation: none !important; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
}

/* ═════════════ Tappa 4: notifiche, backup, guide ═════════════ */
.pref-list { display: flex; flex-direction: column; }
.pref { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pref:last-child { border-bottom: 0; }
.pref .check-line { flex: 1; align-items: flex-start; min-height: 0; padding: 6px 0; }
.pref .check-line input { margin-top: 2px; }
.pref .check-line span { display: flex; flex-direction: column; color: var(--text); }
.pref .check-line b { font-weight: 500; }
.pref .check-line small { color: var(--muted); font-size: 12.5px; }
.pref .select { width: 100px; flex-shrink: 0; }
.guida .install-steps li { font-size: 14px; }
.card-note .ico { width: 14px; height: 14px; vertical-align: -2px; color: var(--ok); }
@media (max-width: 700px) { .pref { flex-wrap: wrap; } .pref .select { margin-left: 28px; font-size: 16px; } }

/* ═════════════ Demo ═════════════ */
.login-demo { width: 100%; height: 54px; font-size: 16px; border-radius: 14px; }
@media (max-width: 700px) { .solo-desktop { display: none; } .demo-bar { flex-wrap: nowrap; padding: 6px 12px; justify-content: space-between; } }
.demo-bar { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 8px 16px; font-size: 13px;
  background: var(--acc-soft); border-bottom: 1px solid var(--acc-line); color: var(--text); text-align: center; }

/* ═════════════ Telefono e tablet ═════════════ */
a, button, [data-act], label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.tabbar { display: none; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .3s var(--ease);
    background: var(--bg); padding-top: calc(22px + env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: var(--overlay); }
  .topbar {
    height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
    padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
  }
  .only-mobile { display: inline-grid; }
  .menu-btn { width: 40px; height: 40px; margin-left: -8px; color: var(--text); }
  .menu-btn .ico { width: 22px; height: 22px; }
  .search-btn { min-width: 0; }
  .search-btn span, .search-btn .kbd, .crumb-root, .crumb .ico { display: none; }
  .crumb { font-size: 15px; font-weight: 600; }
  .view { padding: 24px max(16px, env(safe-area-inset-right)) calc(100px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .grid-2, .settings { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: stretch; gap: 16px; }
  .hero-clock { display: none; }
  .hero .display { font-size: 44px; }
  .palette { padding-top: calc(16px + env(safe-area-inset-top)); }
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .toast { max-width: 100%; }

  /* Barra schede in basso */
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px max(6px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
    background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--line);
  }
  .tab-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px; font-size: 10.5px; font-weight: 500; color: var(--muted); border-radius: 10px; }
  .tab-item .ico { width: 23px; height: 23px; }
  .tab-item.active { color: var(--acc-text); }
  .tab-item:active { background: var(--surface-3); }
  .tab-item .nav-badge { position: absolute; top: 1px; left: calc(50% + 5px); margin: 0; min-width: 17px; height: 17px; padding: 0 5px; font-size: 10px; }

  /* 16px nei campi: iOS non fa zoom quando li tocchi */
  .field input:not([type=checkbox]):not([type=radio]):not([type=color]), .field select, .field textarea,
  #palette-input, .login-field input, .login-fields > input { font-size: 16px; }
}

@media (max-width: 600px) {
  .page-head { margin-bottom: 20px; }
  .page-head .display { font-size: 38px; }
  .hero .display { font-size: 40px; }
  #btn-new span { display: none; }
  #btn-new { width: 38px; padding: 0; }
  .card { padding: 16px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 26px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .themes { grid-template-columns: repeat(2, 1fr); }
  .modal-overlay { padding: 0; align-items: end; }
  .modal { max-height: 92vh; max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .modal-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-head { padding-top: 18px; }
  .install-box { padding: 22px 18px; }
  .diag li { flex-wrap: wrap; }
  .diag li small { width: 100%; text-align: left; padding-left: 20px; }
  .login-box .display { font-size: 44px; }
}

@media (hover: none) {
  .row-actions { opacity: 1; }
  .nav-item .kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
