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

/* === Font display di marca: Brier (locale, fornito dall'handoff Fable) === */
@font-face {
  font-family: 'Brier';
  src: url('fonts/Brier-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Brier';
  src: url('fonts/Brier-Bold.otf') format('opentype');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ============================================================
   Token "Carta da campo" (direzione Fable).
   I nomi di variabile restano quelli storici dell'app (--bg, --accent,
   --danger…) così tutte le pagine continuano a funzionare; cambiano i
   VALORI. In più aggiungiamo i semantici fissi --neg/--pos/--warn/--info
   e il chrome notturno. I 4 valori configurabili da Impostazioni→Stile
   (--accent, --bg, --ink, --line + 3 font) vengono sovrascritti a runtime
   da applyStyle(); i semantici sono FISSI e non passano da lì.
   ============================================================ */
:root {
  /* Surfaces — carta calda (neutri) */
  --bg: #F3F0E9;            /* fondo pagina (paper-1) */
  --surface: #FCFBF8;       /* card e tabelle (paper-0) */
  --surface-sunken: #ECE8DD;/* inset, testate tabella, seg (paper-2) */
  --surface-raised: #FCFBF8;
  --paper-0: #FCFBF8; --paper-1: #F3F0E9; --paper-2: #ECE8DD;
  /* Ink */
  --ink: #1B1C1A;
  --ink-2: #4C4B45;
  --ink-3: #8C887B;
  --ink-4: #A8A496;
  --ink-5: #C7C0B3;
  /* Lines */
  --line: #E4DECF;
  --line-strong: #CFC7B4;
  /* Accent / brand — rosso TED, SOLO logo/CTA/nav attiva/countdown */
  --brand: #E8272A;
  --brand-glow: rgba(232,39,42,.6);
  --brand-glow-soft: rgba(232,39,42,.28);
  --accent: #E8272A;
  --accent-ink: #B81E20;
  --accent-soft: #FBE4E4;
  --accent-contrast: #FFFFFF;
  --red: var(--accent);
  --red-dark: var(--accent-ink);
  --red-soft: var(--accent-soft);

  /* Semantici FISSI (famiglia separata dal brand) */
  --neg:  #A33126;  --neg-bg:  #F6E6E2;   /* costi, errori, da pagare */
  --pos:  #2E6B47;  --pos-bg:  #E3EEE5;   /* incassato, pagata, confermato */
  --warn: #8A6116;  --warn-bg: #F3E8CD;   /* in trattativa, in attesa */
  --info: #46707F;  --info-bg: #E2ECEF;   /* da incassare, previsto, eventi */
  --neutral: #6E6A5E; --neutral-bg: #EAE6DA; /* proposta, non entrato */
  /* alias storici → mappati ai semantici fissi */
  --danger: var(--neg);  --danger-soft: var(--neg-bg);  --danger-ink: var(--neg);
  --success: var(--pos);  --success-soft: var(--pos-bg);
  --warning: var(--warn); --warning-soft: var(--warn-bg);

  /* Chrome scuro (sidebar, top bar mobile, toast, savebar) */
  --night-0: #161817;  --night-1: #0D1522;
  --night-text: #EDEAE1;  --night-muted: #97948A;
  --night-line: rgba(237,234,225,.12);

  /* Fonts — Brier (display), Helvetica Neue (UI), IBM Plex Mono (dati) */
  --font-display: 'Brier', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-sans: var(--font-body);
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font: var(--font-body);
  --f-serif: var(--font-display);
  --f-mono: var(--font-mono);
  /* Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-s: 6px; --r-m: 10px; --r-l: 14px;
  /* Ombre */
  --shadow-s: 0 1px 2px rgba(27,28,26,.05);
  --shadow-m: 0 6px 24px -8px rgba(27,28,26,.14);
  --shadow-modal: 0 24px 80px -16px rgba(13,21,34,.35);
  /* Density compact default */
  --row-py: 9px;
  --row-px: 14px;
  --card-p: 16px;
  --section-gap: 24px;
  /* Compat */
  --black: var(--ink); --white: var(--surface);
  --gray-50: var(--surface-sunken); --gray-100: var(--line);
  --gray-200: var(--line-strong); --gray-400: var(--ink-3); --gray-600: var(--ink-2);
  --ink-70: var(--ink-2); --ink-55: var(--ink-3); --ink-40: var(--ink-4); --ink-20: var(--ink-5); --ink-10: var(--line);
}
/* Impedisce l'overflow orizzontale → su iOS evita che Safari allarghi il
   viewport (deadlock che disattiva le @media mobile). */
html, body { max-width: 100%; overflow-x: hidden; }
body { font-family: var(--font-body); background: var(--bg); color: var(--ink); display: flex; min-height: 100vh; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: "ss01", "cv11"; }
/* === Sidebar notturna (chrome scuro) — direzione "Carta da campo" === */
aside { width: 228px; background: linear-gradient(170deg, var(--night-0) 55%, var(--night-1) 100%); color: var(--night-text); display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px; gap: 0; }
.sidebar-header { padding: 0; flex: none; }
.sidebar-logo-wrap { background: var(--brand); color: #fff; border-radius: var(--r-m); padding: 12px 14px 11px; position: relative; overflow: hidden; box-shadow: 0 6px 20px -8px var(--brand-glow); }
.sidebar-logo-wrap::after { content: ""; position: absolute; right: -12px; bottom: -14px; width: 56px; height: 56px; background: radial-gradient(circle, rgba(255,255,255,.20) 0%, transparent 70%); pointer-events: none; }
.sidebar-logo { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; line-height: 1.05; color: #fff; }
.sidebar-tema { font-family: var(--font-mono); font-weight: 500; font-size: 8.5px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(255,255,255,.82); margin-top: 4px; }
.sidebar-countdown { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 4px 12px; border-bottom: 1px solid var(--night-line); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; }
.sidebar-countdown .sb-date { color: var(--night-muted); text-transform: uppercase; }
.sidebar-countdown .sb-days { color: var(--accent); font-weight: 600; }

#nav { display: flex; flex-direction: column; gap: 14px; padding: 14px 0 0; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-tail { margin-top: auto; padding-top: 10px; }
.nav-group-label { font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--night-muted); padding: 0 8px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 8px; border-radius: var(--r-s); color: rgba(237,234,225,.82); font-family: var(--font-body); font-size: 13px; font-weight: 400; width: 100%; text-align: left; background: transparent; border: none; cursor: pointer; position: relative; transition: background .12s, color .12s; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.09); color: #fff; font-weight: 500; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: var(--accent); border-radius: 0 2px 2px 0; }
.nav-icon { width: 15px; height: 15px; display: flex; align-items: center; justify-content: center; opacity: .85; flex-shrink: 0; }
.nav-icon svg { width: 15px; height: 15px; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; color: var(--night-muted); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.nav-badge-eco { color: var(--accent); font-weight: 600; }

.sidebar-footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--night-line); display: flex; flex-direction: column; gap: 8px; flex: none; }
.sb-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sb-ava { width: 26px; height: 26px; border-radius: 99px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; background: rgba(255,255,255,.10); color: var(--night-text); }
.sb-mail { font-family: var(--font-mono); font-size: 9px; color: var(--night-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-logout { width: 100%; padding: 7px; background: transparent; border: 1px solid var(--night-line); border-radius: var(--r-s); color: var(--night-muted); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; font-family: var(--font-body); text-align: center; transition: background .12s, color .12s; }
.sb-logout:hover { background: rgba(255,255,255,.06); color: var(--night-text); }
main { flex: 1; min-width: 0; background: var(--bg); min-height: 100vh; }

/* Desktop: app-shell scroll model. body non scrolla, scrolla solo main →
   la sidebar (aside, height:100vh) resta fissa. Necessario perché
   `overflow-x:hidden` su html/body (fix iOS) rompe `position:sticky` dei figli.
   Scoped a ≥1024px: sotto, l'aside è nascosto e vale lo scroll-finestra del mobile. */
@media (min-width: 1024px) {
  html, body { height: 100%; overflow: hidden; }
  main { height: 100vh; overflow-y: auto; overflow-x: hidden; }
}
.main-header { background: transparent; border-bottom: 1px solid var(--line); padding: 20px 28px; display: flex; align-items: center; justify-content: space-between; }
.main-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); }
.main-body { padding: 20px 28px 40px; max-width: 1480px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: var(--section-gap); }
.card-title { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.metric { border-right: 1px solid var(--line); padding: 14px 18px; background: transparent; border-radius: 0; border-top: none; border-bottom: none; border-left: none; }
.metric:last-child { border-right: none; }
.metric-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); margin-bottom: 6px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; }
.metric-value { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.metric-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--section-gap); }
.row-item { display: flex; justify-content: space-between; align-items: center; padding: var(--row-py) 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: none; padding-bottom: 0; }
.row-item:first-child { padding-top: 0; }
.item-name { font-size: 13.5px; font-weight: 500; letter-spacing: -0.005em; color: var(--ink); }
.item-sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 3px; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.badge { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.badge-gray  { background: var(--surface-sunken); color: var(--ink-3); border: 1px solid var(--line-strong); }
.badge-blue  { background: oklch(0.95 0.04 250); color: oklch(0.4 0.18 250); }
.badge-red   { background: var(--accent); color: #fff; }
.badge-pronto { background: oklch(0.96 0.05 75); color: oklch(0.4 0.15 65); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; letter-spacing: -0.01em; flex-shrink: 0; font-family: var(--font-mono); }
.avatar-red   { background: var(--accent); color: white; }
.avatar-black { background: var(--ink); color: var(--bg); }
/* Bottone standard — allineato al reference "04 Bottoni e campi" (Carta da campo):
   altezza 34px, padding 0 14px, radius 6px, font 13px/500, gap icona-testo 7px. */
.btn { height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer; font-family: var(--font-body); letter-spacing: normal; text-transform: none; transition: all 0.12s; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn:hover { background: var(--surface-sunken); }
/* btn-sm mantenuto come alias per compatibilità: stessa taglia del bottone standard (uniformità). */
.btn-sm { }
.btn-danger { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: white; }
hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
/* Campi — allineati al reference: radius 6px, font 13px, padding 0 11px.
   input/select altezza fissa 36px; textarea resta a padding (multi-riga). */
input, select, textarea { padding: 8px 11px; border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-family: var(--font-body); width: 100%; transition: border-color 0.12s, box-shadow 0.12s; letter-spacing: -0.005em; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: 36px; padding: 0 11px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); display: block; margin-bottom: 6px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.overlay { position: fixed; inset: 0; background: rgba(22,20,15,0.20); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px) saturate(1.05); -webkit-backdrop-filter: blur(2px) saturate(1.05); }
.modal { background: var(--bg); border-radius: var(--r-lg); padding: 28px 32px; width: 90%; max-width: 520px; max-height: 90vh; overflow-y: auto; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(22,20,15,0.15); }
.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-bottom: 20px; letter-spacing: -0.02em; color: var(--ink); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.modal:not(.modal-side) .modal-footer { background: var(--surface); margin: 20px -32px -28px -32px; padding: 16px 32px; border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }
.overlay.overlay-side { background: rgba(22,20,15,0.20); backdrop-filter: blur(2px) saturate(1.05); -webkit-backdrop-filter: blur(2px) saturate(1.05); align-items: stretch; justify-content: flex-end; }
.modal.modal-side { background: var(--bg); width: 520px; max-width: 100vw; max-height: none; height: 100vh; padding: 0; border-radius: var(--r-lg) 0 0 var(--r-lg); border: 1px solid var(--line); border-right: none; box-shadow: -16px 0 48px rgba(22,20,15,0.10); position: relative; display: flex; flex-direction: column; animation: modalSideIn 240ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.modal-side .modal-body { flex: 1; overflow-y: auto; padding: 36px 40px 24px; }
.modal-side .modal-footer { flex-shrink: 0; margin: 0; padding: 20px 40px; background: var(--surface); border-top: 1px solid var(--line); }
@keyframes modalSideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.modal-close { position: absolute; top: 18px; right: 20px; width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background 0.12s, color 0.12s, border-color 0.12s; padding: 0; z-index: 1; }
.modal-close:hover { background: var(--surface-sunken); color: var(--ink); border-color: var(--line-strong); }
.loading { text-align: center; padding: 60px; color: var(--ink-3); font-family: var(--font-mono); font-size: 12px; }
.empty { padding: 24px 0; color: var(--ink-3); font-family: var(--f-serif); font-style: italic; font-size: 15px; }
#toast { position: fixed; bottom: 28px; right: 28px; background: var(--ink); color: white; padding: 10px 16px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 500; letter-spacing: -0.005em; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; z-index: 200; transform: translateY(10px); box-shadow: 0 10px 30px rgba(22,20,15,0.2); }
#toast.show { opacity: 1; transform: translateY(0); }
.drag-handle { cursor: grab; color: var(--ink-5); font-size: 16px; padding: 0 8px 0 0; user-select: none; flex-shrink: 0; display: inline-flex; align-items: center; }
.drag-handle:hover { color: var(--ink-3); }
.dragging { opacity: 0.4; }
.drag-over { border-top: 2px solid var(--accent) !important; }
.link-preview { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.link-preview a { color: var(--accent); text-decoration: none; }
.link-preview a:hover { text-decoration: underline; }
.note-box { font-family: var(--f-serif); font-size: 14px; color: var(--ink-2); margin-top: 6px; font-style: italic; padding: 8px 12px; background: var(--surface-sunken); border-radius: var(--r-sm); line-height: 1.5; }
.tab-btn { padding: 10px 18px; background: transparent; border: none; border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500; color: var(--ink-3); cursor: pointer; font-family: var(--font-body); margin-bottom: -1px; transition: color 0.12s; letter-spacing: -0.005em; }
.tab-btn.active { border-bottom-color: var(--accent); color: var(--ink); }
.tab-btn .ct { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); margin-left: 5px; font-variant-numeric: tabular-nums; }
.tab-btn.active .ct { color: var(--ink-2); }

/* === Partecipanti — banda capienza (3 zone) === */
.part-cap { display: flex; align-items: stretch; }
.part-cap-l { padding: 18px 24px; flex: none; width: 230px; }
.part-cap-m { flex: 1; padding: 18px 24px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.part-cap-r { width: 210px; flex: none; padding: 18px 24px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.part-cap-num { display: flex; align-items: baseline; gap: 7px; margin: 6px 0 2px; font-family: var(--font-display); font-size: 38px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.part-cap-den { font-family: var(--font-body); font-size: 14px; color: var(--ink-3); font-weight: 400; }
.part-cap-sub { font-size: 11.5px; color: var(--ink-3); }
.part-cap-bar { display: flex; align-items: center; gap: 12px; }
.part-cap-bar .pcl { width: 70px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part-cap-bar .pcn { font-family: var(--font-mono); font-size: 11px; width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.part-cap-extra { font-size: 11px; color: var(--ink-3); }
@media (max-width: 900px) { .part-cap { flex-direction: column; } .part-cap-l, .part-cap-r { width: auto; } .part-cap .eco-head-div { width: auto; height: 1px; } }

/* === Dropdown overflow (native <details>) — riusabile === */
details.dd { position: relative; display: inline-flex; }
details.dd > summary { list-style: none; cursor: pointer; }
details.dd > summary::-webkit-details-marker { display: none; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-m); padding: 4px; min-width: 200px; z-index: 30; }
.dd-menu.dd-left { right: auto; left: 0; }
.dd-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: none; background: none; cursor: pointer; font-size: 12.5px; color: var(--ink-2); border-radius: var(--r-xs); text-align: left; font-family: var(--font-body); white-space: nowrap; }
.dd-item:hover { background: var(--surface-sunken); color: var(--ink); }
.dd-item.danger:hover { background: var(--neg-bg); color: var(--neg); }
.dd-item svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.note-editor { min-height: 260px; max-height: 420px; overflow-y: auto; padding: 14px 16px; font-size: 14px; line-height: 1.7; outline: none; color: var(--ink); font-family: var(--font-body); }
.note-editor a { color: var(--accent); }
.note-editor ul, .note-editor ol { padding-left: 20px; margin: 6px 0; }
.note-editor li { margin-bottom: 2px; }
label:hover .avatar-upload-overlay { opacity: 1 !important; }
/* HERO */
.hero { margin-bottom: 24px; display: grid; grid-template-columns: 1.3fr 2fr; gap: 32px; align-items: end; }
.hero-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: 10px; }
.hero-title { font-family: var(--font-display); font-size: 40px; line-height: 1.05; margin: 0; font-weight: 600; max-width: 22ch; letter-spacing: -0.03em; color: var(--ink); }
.hero-title em { font-family: var(--f-serif); font-style: italic; font-weight: 400; color: var(--ink-2); }
.hero-accent { color: var(--accent); font-weight: 700; font-size: 54px; font-family: var(--font-display); }
.hero-kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-kpis .kpi { border-right: 1px solid var(--line); padding: 14px 18px; }
.hero-kpis .kpi:last-child { border-right: none; }
.kpi-num { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin: 4px 0 6px; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-success { color: var(--success); }
.kpi-warning { color: var(--warning); }
.kpi-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; }
/* DASHBOARD 2-COLUMN LAYOUT */
.dash-grid { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: var(--section-gap); align-items: start; }
.dash-grid .stack { display: flex; flex-direction: column; gap: var(--section-gap); min-width: 0; }
/* BUDGET CARD */
.budget-card .label-mono { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.budget-net { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.budget-net-num { font-family: var(--font-display); font-size: 36px; font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 2px; color: var(--success); font-variant-numeric: tabular-nums; }
.budget-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.budget-sub-num { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.budget-bar { height: 6px; background: var(--success); border-radius: 999px; position: relative; overflow: hidden; margin-top: 4px; }
.budget-bar-fill { position: absolute; top: 0; left: 0; bottom: 0; background: var(--danger); transition: width .4s; }
.budget-bar-labels { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.budget-breakdown { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.budget-line { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; color: var(--ink-2); }
.budget-line span:last-child { color: var(--accent); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ghost-cta { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 9px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); font-size: 12px; color: var(--ink-3); margin-top: 14px; background: transparent; cursor: pointer; font-family: var(--font-body); transition: all 0.12s; }
.ghost-cta:hover { border-color: var(--accent); color: var(--accent); }

/* === Check-in (vista accoglienza, max 760) === */
.ci { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.ci-search-wrap { display: flex; align-items: center; gap: 10px; }
.ci-search-field { position: relative; flex: 1; display: flex; align-items: center; }
.ci-search-field .ic { position: absolute; left: 14px; color: var(--ink-3); display: flex; pointer-events: none; }
.ci-search { width: 100%; height: 46px; padding: 0 14px 0 40px; font-size: 15px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); }
.ci-search::placeholder { color: var(--ink-3); }
.ci-search:focus { border-color: var(--info); box-shadow: 0 0 0 3px rgba(70,112,127,.18); outline: none; }
.ci-list { display: flex; flex-direction: column; gap: 8px; }
.ci-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.ci-row.done { opacity: .6; }
.ci-row .ava { width: 34px; height: 34px; }

/* === Note — griglia di card === */
.note-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 980px) { .note-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .note-grid { grid-template-columns: 1fr; } }
.note-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-height: 96px; box-shadow: var(--shadow-s); transition: border-color .12s; }
.note-tile:hover { border-color: var(--line-strong); }
.note-tile.done { opacity: .6; }
.note-tile-title { font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; line-height: 1.3; }
.note-tile.done .note-tile-title { color: var(--ink-3); }
.note-tile-body { font-size: 12px; color: var(--ink-3); line-height: 1.45; flex: 1; cursor: pointer; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-tile-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.note-tile-date { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-3); flex: 1; letter-spacing: .03em; }
.note-tile .cb { width: 16px; height: 16px; border: 1.5px solid var(--line-strong); border-radius: 4px; flex: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); color: transparent; transition: background .12s, border-color .12s; }
.note-tile .cb:hover { border-color: var(--ink-3); }
.note-tile .cb.done { background: var(--pos); border-color: var(--pos); color: #fff; }
.note-tile .cb svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* callout informativo (riusabile) */
.callout { background: var(--surface-sunken); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-md); padding: 12px 16px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.callout b { color: var(--ink); font-weight: 600; }

/* === Roadmap — gruppi a card con task === */
.rm { display: flex; flex-direction: column; gap: 18px; }
.rm-prog { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: .04em; }
.task { display: flex; align-items: flex-start; gap: 11px; padding: var(--row-py) 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.task .drag { cursor: grab; color: var(--ink-4); display: inline-flex; align-items: center; opacity: 0; transition: opacity .12s; margin-top: 1px; }
.task:hover .drag { opacity: .55; }
.task .drag svg { width: 13px; height: 13px; }
.task .cb { width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 5px; flex: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); color: transparent; margin-top: 1px; transition: background .12s, border-color .12s; }
.task .cb:hover { border-color: var(--ink-3); }
.task .cb.done { background: var(--pos); border-color: var(--pos); color: #fff; }
.task .cb svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.task .t-name { font-size: 13px; color: var(--ink); }
.task .t-name.done { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-4); }
.task .t-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; overflow-wrap: anywhere; }
.task:hover .rowact { opacity: 1; }

/* === Calendario === */
.ag-list { display: flex; flex-direction: column; gap: 18px; }
.ag-group-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: 4px; text-transform: capitalize; }
.ag-row { display: flex; align-items: flex-start; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ag-row:last-child { border-bottom: none; }
.ag-row:hover { background: rgba(27,28,26,.03); }
.ag-row:hover .rowact { opacity: 1; }
.ag-row.past { opacity: .55; }
.ag-date { text-align: center; min-width: 40px; flex: none; padding-top: 1px; }
.ag-day { font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1; }
.ag-day.today { color: var(--accent); }
.ag-dow { font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-top: 2px; }
.ag-cal { display: flex; gap: 18px; align-items: flex-start; }
.ag-grid-wrap { flex: 1; min-width: 0; }
.ag-monthnav { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; }
.ag-monthnav .m { font-family: var(--font-display); font-size: 18px; font-weight: 700; text-transform: capitalize; }
.ag-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.ag-dow-h { font-family: var(--font-mono); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.ag-cell { min-height: 90px; padding: 6px 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.ag-cell:hover { background: var(--surface-sunken); }
.ag-cell.today { background: var(--surface-sunken); }
.ag-cell.blank { cursor: default; background: transparent; }
.ag-daynum { font-family: var(--font-mono); font-size: 11px; display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 99px; color: var(--ink-2); }
.ag-daynum.today { background: var(--accent); color: #fff; font-weight: 600; }
.ag-ev { margin-top: 4px; background: var(--info-bg); border-left: 2px solid var(--info); border-radius: 4px; padding: 3px 6px; font-size: 10.5px; font-weight: 600; color: var(--info); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; line-height: 1.3; }
.ag-ev-more { font-family: var(--font-mono); font-size: 9px; color: var(--ink-3); margin-top: 2px; }
.ag-rail { width: 300px; flex: none; }
.ag-rail-row { display: flex; gap: 11px; padding: 9px 0; border-top: 1px solid var(--line); }
.ag-rail-row:first-of-type { border-top: none; }
@media (max-width: 900px) { .ag-cal { flex-direction: column; } .ag-rail { width: auto; } }

/* === Card "notturna" (Budget in dashboard) — unico momento scuro della pagina === */
.night { position: relative; overflow: hidden; background: linear-gradient(165deg, var(--night-0), var(--night-1)); color: var(--night-text); border: 1px solid var(--night-0); border-radius: var(--r-lg); padding: 18px 18px 16px; }
.night-glow { position: absolute; border-radius: 50%; pointer-events: none; filter: blur(10px); }
.night-glow-red { width: 220px; height: 220px; right: -90px; top: -110px; background: var(--brand-glow-soft); }
.night-glow-cyan { width: 180px; height: 180px; left: -80px; bottom: -100px; background: rgba(144,172,184,.16); }
.night-in { position: relative; }
.night-head { display: flex; justify-content: space-between; align-items: center; }
.night .lbl { color: var(--night-muted); }
.night-link { background: transparent; border: none; cursor: pointer; font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--night-text); opacity: .85; display: inline-flex; align-items: center; gap: 4px; padding: 0; }
.night-link:hover { opacity: 1; }
.night-net { font-family: var(--font-display); font-size: 34px; font-weight: 700; margin: 8px 0 2px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.night-sub { font-size: 11.5px; color: var(--night-muted); font-variant-numeric: tabular-nums; }
.night-legend { display: flex; gap: 12px; font-size: 10px; color: var(--night-muted); flex-wrap: wrap; }
.night-legend .ndot { width: 7px; height: 7px; border-radius: 99px; display: inline-block; margin-right: 5px; vertical-align: 0; }
.night-debts { border-top: 1px solid var(--night-line); margin-top: 14px; padding-top: 12px; }
.night-debts-title { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--night-muted); margin-bottom: 8px; }
.night-breakdown { border-top: 1px solid var(--night-line); margin-top: 14px; padding-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.night-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--night-muted); }
.night-line .num { color: var(--night-text); }
/* NOTE CARD */
.notes-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.note-item { text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); display: flex; flex-direction: column; gap: 6px; transition: all .12s; cursor: pointer; }
.note-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.note-item-head { display: flex; align-items: center; gap: 8px; }
.note-item-title { font-size: 13px; font-weight: 600; color: var(--ink); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.note-item-body { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
/* CARD HEADER with link + label */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.linkbtn { background: transparent; border: none; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-body); font-size: 12px; color: var(--ink-2); font-weight: 500; cursor: pointer; padding: 0; letter-spacing: -0.005em; }
.linkbtn:hover { color: var(--accent); }
.btn-icon { background: transparent; border: none; padding: 5px; border-radius: 6px; color: var(--ink-4); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.12s; flex-shrink: 0; }
.btn-icon:hover { background: var(--surface-sunken); color: var(--ink); }
.btn-icon svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon.btn-icon-danger:hover { background: var(--danger-soft); color: var(--danger); }
/* SEGMENTED CONTROL (tabs con contatori) */
.seg { display: inline-flex; background: var(--surface-sunken); border-radius: var(--r-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg-btn { padding: 5px 10px; border-radius: 6px; font-size: 11.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; background: transparent; border: none; cursor: pointer; font-family: var(--font-body); font-weight: 500; letter-spacing: -0.005em; transition: all 0.12s; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.seg-count { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); background: var(--surface); padding: 1px 5px; border-radius: 4px; }
.seg-btn.active .seg-count { background: var(--surface-sunken); color: var(--ink-3); }
.dash-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.dash-list-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.dash-list-title .sub { display: block; color: var(--ink-4); margin-top: 4px; text-transform: none; letter-spacing: 0.02em; font-size: 11px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } .hero { grid-template-columns: 1fr; gap: 16px; } .hero-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } .hero-kpis .kpi:nth-child(2) { border-right: none; } }
/* === Shell mobile (< 1024px): sidebar → top bar notturna + bottom nav 5 tab === */
#m-topbar, #m-bottomnav, #hamburger, #m-group-tabs { display: none; }
#hamburger span { display: block; width: 16px; height: 2px; background: var(--ink); border-radius: 1px; }

/* Team: affordance touch (assegna/riordino) sostituiscono il drag solo su mobile.
   .team-m visibile solo ≤1023px, .team-d solo su desktop. Niente display inline
   nel markup, altrimenti batterebbe la @media (vedi fix sidebar mobile). */
.team-m { display: none; }

@media (max-width: 1023px) {
  aside { display: none; }
  #sidebar-overlay { display: none !important; }
  main { width: 100%; min-width: 0; }
  /* top bar notturna (logo + countdown), sticky */
  #m-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 12px 16px; background: linear-gradient(170deg, var(--night-0) 30%, var(--night-1)); color: var(--night-text); }
  .m-logo { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; background: var(--brand); padding: 5px 10px; border-radius: 7px; box-shadow: 0 4px 14px -6px var(--brand-glow); }
  .m-countdown { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; line-height: 1.4; text-transform: uppercase; }
  .m-countdown #m-days { color: var(--accent); font-weight: 600; }
  .m-countdown #m-date { color: var(--night-muted); }
  /* header pagina (titolo + azioni), niente hamburger */
  .main-header { padding: 14px 16px; }
  .main-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
  #m-group-tabs:not(:empty) { display: block; padding: 8px 16px 0; overflow-x: auto; }
  #m-group-tabs .seg { display: inline-flex; flex-wrap: nowrap; }
  #m-group-tabs .seg-btn { white-space: nowrap; }
  .main-body { padding: 16px 16px calc(74px + env(safe-area-inset-bottom)); overflow-x: hidden; max-width: 100%; }
  .grid2 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 16px; }
  .hero-title { font-size: 28px; }
  .hero-accent { font-size: 40px; }
  .hero-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero-kpis .kpi:nth-child(2) { border-right: none; }
  /* bottom nav fissa */
  #m-bottomnav { display: flex; flex-direction: row; gap: 0; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding: 0 env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(27,28,26,.04); }
  .m-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; background: none; border: none; cursor: pointer; color: var(--ink-3); padding: 6px 2px; transition: color .12s; }
  .m-tab.active { color: var(--accent); }
  .m-tab-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: block; }
  .m-tab-lbl { font-size: 9.5px; font-weight: 500; letter-spacing: .01em; }
  /* modali laterali → bottom-sheet su mobile (slide dal basso, grab-handle) */
  .overlay.overlay-side { align-items: flex-end; justify-content: center; }
  .modal.modal-side { width: 100%; max-width: 100%; height: auto; max-height: 92vh; border: none; border-radius: 18px 18px 0 0; box-shadow: var(--shadow-modal); animation: sheetUp .24s cubic-bezier(.16,1,.3,1) both; }
  .modal.modal-side::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 2px; flex: none; }
  .modal-side .modal-close { top: 12px; right: 14px; }
  .modal-side .modal-body { padding: 18px 18px 20px; }
  .modal-side .modal-footer { padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); }
  .modal-side .modal-footer .btn { flex: 1; min-height: 44px; }

  /* tabelle → liste: ogni riga diventa un blocco (nome a tutta larghezza,
     metadati/pill/importo/azioni in linea sotto). Niente scroll orizzontale. */
  .tbl, .tbl tbody { display: block; }
  .tbl thead { display: none; }
  .tbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tbl tbody tr:last-child { border-bottom: none; }
  .tbl td { display: inline-flex; align-items: center; border: none !important; padding: 0; }
  .tbl td:first-child { flex: 1 1 100%; min-width: 0; }
  .tbl td.ta-r { margin-left: auto; }
  .tbl .rowact { opacity: 1; }              /* azioni sempre visibili (touch, niente hover) */
  .tbl th.sortable .sort-caret { display: none; }
  /* filtri/toolbar: ricerca a tutta larghezza, segmented a capo */
  .eco-filters .input-wrap, .eco-filters .eco-search { width: 100% !important; flex: 1 1 100%; }
  .spk-pipe { flex-wrap: wrap; }
  .spk-pipe .spk-arrow { display: none; }
  .spk-stage { flex: 1 1 40%; }
  /* Team mobile: mostra affordance touch, nascondi hint drag */
  .team-m { display: flex; }
  .team-d { display: none; }
  .team-assign-btn { width: 100%; justify-content: center; min-height: 44px; }
  .team-reorder { gap: 6px; }
}

/* === Bottom-sheet generico (riusabile) === */
.sheet-overlay { position: fixed; inset: 0; z-index: 120; background: rgba(13,21,34,.42); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); display: flex; align-items: flex-end; animation: sheetFade .15s ease; }
@keyframes sheetFade { from { opacity: 0; } }
.sheet { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-modal); animation: sheetUp .22s cubic-bezier(.16,1,.3,1); max-height: 85vh; overflow-y: auto; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-handle { width: 36px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 4px auto 12px; }
.sheet-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.sheet-list { display: flex; flex-direction: column; gap: 2px; }
.sheet-group-lbl { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); padding: 12px 8px 4px; }
.sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 8px; background: none; border: none; cursor: pointer; font-family: var(--font-body); font-size: 15px; color: var(--ink); text-align: left; border-radius: var(--r-sm); }
.sheet-item:hover, .sheet-item.active { background: var(--surface-sunken); }
.sheet-item.active { color: var(--accent); font-weight: 500; }
.sheet-item-ic { display: inline-flex; width: 20px; color: var(--ink-3); }
.sheet-item-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sheet-logout { margin-top: 8px; border-top: 1px solid var(--line); color: var(--ink-2); justify-content: center; }
/* LOGIN */
#login-screen { position: fixed; inset: 0; width: 100vw; height: 100vh; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 1000; }
.login-card { display: flex; width: 100%; max-width: 1100px; min-height: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 24px 60px rgba(22,20,15,0.08); overflow: hidden; }
.login-left { flex: 0 0 48%; padding: 72px 64px; display: flex; flex-direction: column; justify-content: center; }
.login-right { flex: 1; background: var(--surface-sunken); background-size: cover; background-position: center; background-repeat: no-repeat; position: relative; display: flex; align-items: center; justify-content: center; }
.login-right.has-image .login-right-placeholder { display: none; }
.login-right-placeholder { display: flex; flex-direction: column; align-items: center; gap: 14px; font-family: var(--f-serif); font-style: italic; font-size: 14px; color: var(--ink-4); text-align: center; line-height: 1.45; padding: 24px; }
.login-right-placeholder svg { width: 36px; height: 36px; opacity: 0.5; stroke: currentColor; }
.login-logo { display: flex; align-items: center; gap: 0; margin-bottom: 64px; min-height: 60px; }
.login-logo .ted { font-family: var(--font-display); font-weight: 800; font-size: 52px; letter-spacing: -0.04em; color: var(--accent); line-height: 1; }
.login-logo .x { font-family: var(--font-display); font-weight: 800; font-size: 52px; letter-spacing: -0.04em; color: var(--ink); line-height: 1; }
.login-logo-img { max-width: 200px; max-height: 80px; width: auto; height: auto; object-fit: contain; display: block; }
.login-form { display: flex; flex-direction: column; }
.login-btn { width: 100%; padding: 14px 20px; background: var(--ink); color: var(--bg); border: none; border-radius: var(--r-sm); font-family: var(--font-display); font-weight: 500; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: background 0.15s; margin-top: 6px; }
.login-btn:hover { background: var(--ink-2); }
.login-error { display: none; margin-top: 12px; color: var(--danger); font-family: var(--f-serif); font-style: italic; font-size: 13.5px; line-height: 1.4; }
@media (max-width: 768px) {
  #login-screen { padding: 0; }
  .login-card { flex-direction: column; min-height: 100vh; max-width: 100%; border-radius: 0; border: none; box-shadow: none; }
  .login-right { display: none; }
  .login-left { flex: 1; padding: 48px 28px; }
  .login-logo { margin-bottom: 40px; }
  .login-logo .ted, .login-logo .x { font-size: 44px; }
}
.cal-cell-event { background: var(--accent-soft) !important; position: relative; }
.cal-cell-event::after { content: ''; position: absolute; top: 6px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.dash-grid .stack > .card { margin-bottom: 0; }
.dash-speaker-card { display: flex; flex-direction: column; max-height: 640px; }
.dash-speaker-head { flex-shrink: 0; background: var(--surface); }
.dash-speaker-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }

/* Spese */
.spese-kpis { padding: 22px 20px; margin-bottom: 18px; }
.spese-kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.spese-kpi { display: flex; flex-direction: column; gap: 4px; }
.spese-kpi-num { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.025em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.spese-kpi-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }
.spese-progress { position: relative; height: 8px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; margin: 18px 0 14px; }
.spese-progress-fill { height: 100%; background: var(--success); transition: width .4s; }
.spese-progress-label { position: absolute; right: 0; top: -18px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; }
.spese-overview { display: flex; align-items: center; gap: 28px; }
.spese-overview-left { flex: none; min-width: 150px; }
.spese-overview-right { flex: 1; min-width: 0; }
.spese-dapagare { font-family: var(--font-mono); font-size: 11px; color: var(--danger); letter-spacing: 0.04em; margin-top: 7px; font-variant-numeric: tabular-nums; }
.spese-dapagare-ok { color: var(--success); }
.ricavi-incassato { font-family: var(--font-mono); font-size: 11px; color: var(--success); letter-spacing: 0.04em; margin-top: 7px; font-variant-numeric: tabular-nums; }
.spese-cats-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-sunken); }
.spese-cats-seg { min-width: 6px; border-right: 2px solid var(--bg); background: var(--surface-sunken); cursor: help; transition: filter 0.12s; }
.spese-cats-seg:hover { filter: brightness(1.08); }
.spese-cats-seg:last-child { border-right: none; }
.spese-cats-empty { flex: 1; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.spese-cats-tip { position: fixed; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--r-sm); font-family: var(--font-display); font-weight: 500; font-size: 13px; letter-spacing: -0.005em; pointer-events: none; transform: translate(-50%, calc(-100% - 8px)); opacity: 0; transition: opacity 0.1s; z-index: 9999; white-space: nowrap; }
.spese-cats-tip.is-visible { opacity: 1; transition: opacity 0.15s; }
.spese-cats-tip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }
.spesa-color-picker { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.spesa-color-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; padding: 0; cursor: pointer; transition: transform 0.12s, border-color 0.12s; box-shadow: 0 0 0 1px var(--line) inset; }
.spesa-color-swatch:hover { transform: scale(1.1); }
.spesa-color-swatch.is-selected { border-color: var(--ink); transform: scale(1.1); box-shadow: none; }
.spesa-chip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; flex-shrink: 0; }

.spese-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0; margin-bottom: 12px; }
.spese-search { position: relative; flex: 0 0 280px; max-width: 320px; }
.spese-search input { padding-left: 32px; padding-right: 28px; }
.spese-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; display: inline-flex; }
.spese-search-icon svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.spese-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.spese-cat-row { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; min-width: 0; padding-top: 4px; }
.spese-cat-row > .filter-icon { color: var(--ink-3); display: inline-flex; flex-shrink: 0; }
.spese-cat-row > .filter-icon svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.spese-table-card { overflow: hidden; padding: 0; }
.spese-table { display: flex; flex-direction: column; }
.spese-row { display: grid; grid-template-columns: minmax(220px, 2.4fr) 140px 80px 130px 110px 130px 110px; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); transition: background .1s; font-size: 13px; }
.spese-row:first-child { border-top: none; }
.spese-row:hover:not(.spese-row-head):not(.spese-row-detail) { background: var(--surface-sunken); }
.spese-row-head { background: var(--surface-sunken); padding-top: 10px; padding-bottom: 10px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.spese-row-paid .spese-c-name .item-name { color: var(--ink-3); }
.spese-row-paid .spese-c-amount { color: var(--ink-4); text-decoration: line-through; text-decoration-color: var(--ink-5); }
.sort-head { display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; text-align: left; letter-spacing: 0.1em; background: transparent; border: none; padding: 0; cursor: pointer; }
.sort-head:hover { color: var(--ink); }
.sort-head[data-active="true"] { color: var(--ink); }
.sort-head-right { justify-content: flex-end; text-align: right; width: 100%; }
.sort-head svg { width: 10px; height: 10px; stroke: currentColor; stroke-width: 2; fill: none; }

.spese-c-name { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.spese-expand { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-4); border-radius: 4px; flex: none; background: transparent; border: none; cursor: pointer; padding: 0; margin-top: 1px; }
.spese-expand:hover { background: var(--surface); color: var(--ink); }
.spese-expand svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; }
.spese-note-preview { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.spese-cat-tag { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink); padding: 3px 8px; border-radius: 999px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.spese-cat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); flex-shrink: 0; }
.spese-c-date { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.spese-c-vendor { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spese-c-amount { font-family: var(--font-mono); font-weight: 600; text-align: right; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.spese-c-actions { display: flex; justify-content: flex-end; gap: 2px; }

.pay-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--warning-soft); color: oklch(0.5 0.15 65); border: 1px solid transparent; cursor: pointer; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; transition: all .18s; }
.pay-toggle:hover { border-color: var(--warning); }
.pay-toggle-thumb { width: 18px; height: 18px; border-radius: 999px; background: var(--surface); border: 1px solid currentColor; display: inline-flex; align-items: center; justify-content: center; flex: none; transition: all .18s; }
.pay-toggle-thumb svg { width: 10px; height: 10px; stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pay-toggle-on { background: var(--success-soft); color: var(--success); }
.pay-toggle-on .pay-toggle-thumb { background: var(--success); color: #fff; border-color: var(--success); transform: scale(1.05); }

.spese-row-detail { display: block; background: var(--surface-sunken); padding: 14px 20px 16px; border-top: 1px solid var(--line); }
.spese-detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.spese-detail-note { font-family: var(--f-serif); font-size: 13.5px; color: var(--ink-2); margin: 6px 0 0; font-style: italic; line-height: 1.55; }
.spese-att { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--ink-2); }

.spese-foot { padding: 12px 20px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; background: var(--surface-sunken); }
.spese-empty { padding: 60px 20px; text-align: center; color: var(--ink-3); font-family: var(--f-serif); font-style: italic; }

@media (max-width: 1100px) {
  .spese-row { grid-template-columns: minmax(160px, 1.6fr) 120px 70px 100px 110px 110px 90px; gap: 8px; }
  .spese-c-vendor { display: none; }
  .spese-row-head .col-vendor { display: none; }
}
@media (max-width: 820px) {
  .spese-row { grid-template-columns: 1fr auto auto; }
  .spese-row > .spese-c-cat, .spese-row > .spese-c-date, .spese-row > .spese-c-vendor { display: none; }
  .spese-row-head .col-cat, .spese-row-head .col-date, .spese-row-head .col-vendor { display: none; }
}

/* ── Moodboard ── */

.mb-empty-state { padding: 80px 20px; text-align: center; }

.mb-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.mb-filter-chip { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: all 0.12s; }
.mb-filter-chip:hover { border-color: var(--ink-4); }
.mb-filter-chip.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.mb-filter-clear { font-family: var(--font-mono); font-size: 11px; padding: 5px 10px; background: transparent; border: none; color: var(--ink-3); cursor: pointer; text-decoration: underline; margin-left: 4px; }

.mb-grid { column-count: 4; column-gap: 14px; }
@media (max-width: 1280px) { .mb-grid { column-count: 3; } }
@media (max-width: 900px)  { .mb-grid { column-count: 2; } }
@media (max-width: 560px)  { .mb-grid { column-count: 1; } }

.mb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin: 0 0 14px; overflow: hidden; break-inside: avoid; cursor: pointer; position: relative; transition: border-color 0.12s, box-shadow 0.12s; }
.mb-card:hover { border-color: var(--ink-4); box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.mb-card-actions { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity 0.12s; z-index: 2; display: flex; gap: 4px; }
.mb-card:hover .mb-card-actions { opacity: 1; }
.mb-card-actions .btn-icon { background: var(--surface); border: 1px solid var(--line); }

.mb-card-img img { width: 100%; height: auto; display: block; }
.mb-card-fallback { padding: 30px 14px; text-align: center; font-size: 12px; color: var(--ink-4); background: var(--surface-sunken); }

.mb-card-quote .mb-card-body { padding: 18px 16px 14px; }
.mb-quote-text { font-family: var(--f-serif, serif); font-size: 17px; line-height: 1.45; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.mb-quote-text::before { content: "\201C"; font-size: 28px; line-height: 0; vertical-align: -8px; color: var(--ink-4); margin-right: 2px; }
.mb-quote-text::after  { content: "\201D"; font-size: 28px; line-height: 0; vertical-align: -8px; color: var(--ink-4); margin-left: 2px; }
.mb-quote-author { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 8px; letter-spacing: 0.04em; }

.mb-link-thumb { width: 100%; height: auto; display: block; }
.mb-card-link .mb-card-body { padding: 14px 16px; }
.mb-link-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 4px; line-height: 1.3; }
.mb-link-url { font-family: var(--font-mono); font-size: 11px; color: var(--accent); text-decoration: none; word-break: break-all; }
.mb-link-url:hover { text-decoration: underline; }

.mb-card-img .mb-card-body { padding: 10px 12px 12px; }
.mb-card-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.mb-card-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.04em; margin-bottom: 6px; }
.mb-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mb-card-tag { font-family: var(--font-mono); font-size: 10px; padding: 2px 6px; background: var(--surface-sunken); border-radius: 999px; color: var(--ink-3); letter-spacing: 0.04em; }
.mb-card-date { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); margin-top: 8px; letter-spacing: 0.04em; text-transform: uppercase; }

/* Modale moodboard: tag chips input */
.mb-tag-chips-input { display: flex; flex-wrap: wrap; gap: 4px; min-height: 8px; }
.mb-tag-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px; padding: 3px 4px 3px 8px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); letter-spacing: 0.04em; }
.mb-tag-chip button { background: transparent; border: none; color: var(--ink-4); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }
.mb-tag-chip button:hover { color: var(--accent); }

/* === Conto Economico — design "Carta da campo" (componenti tbl/pill/cat/chip) === */
.eco { display: flex; flex-direction: column; gap: 18px; }
.eco-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-s); overflow: hidden; }

/* etichette mono "coordinate" + numeri */
.lbl { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.lbl-ink { color: var(--ink-2); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }

/* card risultato (testata conto economico) */
.eco-head { display: flex; align-items: stretch; }
.eco-head-main { flex: 1; padding: 20px 24px; min-width: 0; }
.eco-head-num { font-family: var(--font-display); font-size: 44px; font-weight: 700; line-height: 1.1; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.eco-head-num.is-neg { color: var(--neg); }
.eco-head-num.is-pos { color: var(--pos); }
.eco-head-expl { font-size: 12.5px; color: var(--ink-2); }
.eco-head-div { width: 1px; background: var(--line); flex: none; }
.eco-head-bars { width: 440px; flex: none; padding: 20px 24px; display: flex; flex-direction: column; gap: 13px; justify-content: center; }
.eco-bar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.eco-bar-tot { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.eco-bar-leg { font-size: 10.5px; color: var(--ink-3); margin-top: 5px; }
.bar { height: 7px; border-radius: 99px; background: var(--surface-sunken); overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; }
@media (max-width: 900px) { .eco-head { flex-direction: column; } .eco-head-div { width: auto; height: 1px; } .eco-head-bars { width: auto; } }

/* sezione con accordion (titolo + totale + chevron) */
.eco-sec { display: flex; flex-direction: column; }
.eco-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; background: none; border: 0; padding: 0; margin-bottom: 10px; cursor: pointer; text-align: left; }
.eco-sec-head-l { display: flex; align-items: baseline; gap: 10px; }
.eco-sec-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.eco-sec-tot { font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.eco-sec-tot.is-pos { color: var(--pos); } .eco-sec-tot.is-neg { color: var(--neg); }
.eco-sec-note { font-size: 11.5px; color: var(--ink-3); }
.eco-acc-chevron { width: 15px; height: 15px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; flex: none; align-self: center; }
.eco-acc-chevron.is-open { transform: rotate(180deg); }
.eco-acc-body[hidden] { display: none; }

/* tabella (design system) */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 8px 12px; background: var(--surface-sunken); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 6px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s ease; }
.tbl tbody tr:hover { background: rgba(27,28,26,.03); }
.tbl .ta-r, .tbl th.ta-r { text-align: right; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink-2); }
.sort-caret { display: inline-block; font-size: 9px; color: var(--accent); transition: transform .12s; }
.sort-caret.asc { transform: rotate(180deg); }
.tbl .item-name { font-size: 13px; color: var(--ink); }
.tbl .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.tbl .row-done td, .tbl .row-done .item-name { color: var(--ink-3); }
.amount { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.amount.done { color: var(--ink-3); font-weight: 400; }

/* categoria: punto + mono, senza scatola */
.cat { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.cat .cdot { width: 7px; height: 7px; border-radius: 99px; flex: none; }

/* pill di stato */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.pill .pdot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex: none; }
button.pill { border: none; cursor: pointer; font-family: inherit; transition: filter .12s; }
button.pill:hover { filter: brightness(.96); }
.pill-pos { background: var(--pos-bg); color: var(--pos); }
.pill-neg { background: var(--neg-bg); color: var(--neg); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-neutral { background: var(--neutral-bg); color: var(--neutral); }
.pill-outline { background: transparent; border: 1px dashed var(--line-strong); color: var(--ink-3); padding: 0 8px; }

/* icon button + azioni a comparsa */
.icbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--r-xs); border: none; background: transparent; color: var(--ink-3); cursor: pointer; transition: background .12s, color .12s; padding: 0; }
.icbtn:hover { background: rgba(27,28,26,.07); color: var(--ink); }
.icbtn.danger:hover { background: var(--neg-bg); color: var(--neg); }
.icbtn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icbtn input { display: none; }

/* Chip allegato compatto per righe tabella (es. Merch): apre il file + ✕ per eliminarlo */
.att-chip { display: inline-flex; align-items: stretch; margin-top: 5px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--r-xs); overflow: hidden; transition: border-color .12s; }
.att-chip:hover { border-color: var(--line-strong); }
.att-chip-open, .att-chip-x { background: transparent; border: none; cursor: pointer; font-family: var(--font-body); display: inline-flex; align-items: center; transition: color .12s, background .12s; }
.att-chip-open { gap: 5px; padding: 2px 7px 2px 8px; font-size: 11px; color: var(--ink-2); }
.att-chip-open:hover { color: var(--ink); }
.att-chip-x { padding: 0 7px; color: var(--ink-3); border-left: 1px solid var(--line); font-size: 13px; line-height: 1; }
.att-chip-x:hover { color: var(--danger); background: var(--danger-soft); }
.att-chip svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.rowact { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .12s ease; justify-content: flex-end; }
.tbl tbody tr:hover .rowact { opacity: 1; }
.rowact-auto { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-4); letter-spacing: 0.08em; text-transform: uppercase; }

/* footer tabella */
.tfoot { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-sunken); border-top: 1px solid var(--line); }

/* avatar (riusato da speaker/team/partecipanti) */
.ava { width: 30px; height: 30px; border-radius: 99px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; letter-spacing: .02em; background: var(--surface-sunken); color: var(--ink-2); border: 1px solid var(--line-strong); overflow: hidden; }
.ava-img { background-size: cover; background-position: center; color: transparent; border: none; }
.ava input { display: none; }

/* Speaker: pipeline + checklist + filtri */
.spk { display: flex; flex-direction: column; gap: 18px; }
.spk-pipe { display: flex; align-items: stretch; gap: 8px; }
.spk-arrow { width: 14px; height: 14px; flex: none; color: var(--line-strong); align-self: center; }
.spk-stage { flex: 1; padding: 11px 14px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--r-md); }
.spk-stage.on { background: var(--pos-bg); border-color: transparent; }
.spk-stage-n { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.spk-stage-t { font-size: 13px; font-weight: 600; }
.spk-stage-sub { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
/* Speaker rifiutati: in fondo, niente sfondo bianco (fondo pagina) + contenuto attenuato */
.tbl tr.spk-rejected { background: var(--bg); }
.tbl tr.spk-rejected td { opacity: .55; }
.spk-cl { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid var(--line-strong); border-radius: var(--r-xs); padding: 2px 8px 2px 4px; cursor: pointer; font-size: 11px; color: var(--ink-2); font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.spk-cl:hover { background: var(--surface-sunken); }
.spk-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* filtri spese */
.eco-filters { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.input-wrap { position: relative; display: inline-flex; align-items: center; }
.input-wrap .affix { position: absolute; color: var(--ink-3); display: flex; align-items: center; }
.input-wrap .affix-l { left: 10px; }
.eco-search { font-family: var(--font-body); font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-xs); height: 32px; padding: 0 11px 0 32px; width: 260px; max-width: 100%; transition: border-color .12s, box-shadow .12s; }
.eco-search::placeholder { color: var(--ink-3); }
.eco-search:focus { border-color: var(--info); box-shadow: 0 0 0 3px rgba(70,112,127,.18); outline: none; }
.eco-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); cursor: pointer; font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--ink-2); transition: all .12s; }
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip .ct { font-family: var(--font-mono); font-size: 10px; opacity: .65; }
.chip.zero { opacity: .38; pointer-events: none; }
.chip .cdot { width: 7px; height: 7px; border-radius: 99px; }
