/* ==========================================================================
   Comiteg Gestionale — tema
   ========================================================================== */

:root,
[data-bs-theme="light"] {
  --cg-primary: #2563eb;
  --cg-primary-rgb: 37, 99, 235;
  --cg-primary-soft: #eff4ff;
  --cg-bg: #f5f7fb;
  --cg-surface: #ffffff;
  --cg-surface-2: #f8fafc;
  --cg-border: #e6e9f0;
  --cg-text: #0f172a;
  --cg-muted: #64748b;
  --cg-sidebar-bg: #0f172a;
  --cg-sidebar-text: #cbd5e1;
  --cg-sidebar-muted: #64748b;
  --cg-sidebar-active: rgba(255, 255, 255, .08);
  --cg-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --cg-radius: 14px;

  --bs-primary: var(--cg-primary);
  --bs-primary-rgb: var(--cg-primary-rgb);
  --bs-body-bg: var(--cg-bg);
  --bs-body-color: var(--cg-text);
  --bs-border-color: var(--cg-border);
  --bs-secondary-color: var(--cg-muted);
  --bs-link-color: var(--cg-primary);
  --bs-link-color-rgb: var(--cg-primary-rgb);
  --bs-link-hover-color: #1d4ed8;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .925rem;
}

[data-bs-theme="dark"] {
  --cg-primary: #60a5fa;
  --cg-primary-rgb: 96, 165, 250;
  --cg-primary-soft: rgba(96, 165, 250, .12);
  --cg-bg: #0b1120;
  --cg-surface: #111827;
  --cg-surface-2: #0f172a;
  --cg-border: #1f2a3d;
  --cg-text: #e5e7eb;
  --cg-muted: #94a3b8;
  --cg-sidebar-bg: #060b16;
  --cg-sidebar-text: #cbd5e1;
  --cg-sidebar-muted: #475569;
  --cg-sidebar-active: rgba(255, 255, 255, .07);
  --cg-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);

  --bs-primary: var(--cg-primary);
  --bs-primary-rgb: var(--cg-primary-rgb);
  --bs-body-bg: var(--cg-bg);
  --bs-body-color: var(--cg-text);
  --bs-border-color: var(--cg-border);
  --bs-secondary-color: var(--cg-muted);
  --bs-link-color: var(--cg-primary);
  --bs-link-color-rgb: var(--cg-primary-rgb);
  --bs-link-hover-color: #93c5fd;
  --bs-tertiary-bg: #162033;
}

body { background: var(--cg-bg); color: var(--cg-text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.text-muted, .text-body-secondary { color: var(--cg-muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.tabular { font-variant-numeric: tabular-nums; }

/* --- Bottoni ------------------------------------------------------------ */
.btn { --bs-btn-border-radius: 10px; font-weight: 500; }
.btn-sm { --bs-btn-border-radius: 8px; }
.btn-primary {
  --bs-btn-bg: var(--cg-primary); --bs-btn-border-color: var(--cg-primary);
  --bs-btn-hover-bg: #1d4ed8; --bs-btn-hover-border-color: #1d4ed8;
  --bs-btn-active-bg: #1e40af; --bs-btn-active-border-color: #1e40af;
  --bs-btn-disabled-bg: var(--cg-primary); --bs-btn-disabled-border-color: var(--cg-primary);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0b1120; --bs-btn-hover-color: #0b1120; --bs-btn-hover-bg: #93c5fd; --bs-btn-hover-border-color: #93c5fd; --bs-btn-active-color: #0b1120; --bs-btn-disabled-color: #0b1120; }
.btn-outline-primary { --bs-btn-color: var(--cg-primary); --bs-btn-border-color: var(--cg-primary); --bs-btn-hover-bg: var(--cg-primary); --bs-btn-hover-border-color: var(--cg-primary); }
.btn-soft { background: var(--cg-surface-2); border: 1px solid var(--cg-border); color: var(--cg-text); }
.btn-soft:hover { background: var(--cg-primary-soft); border-color: rgba(var(--cg-primary-rgb), .35); color: var(--cg-primary); }
.btn-icon { border: 0; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 10px; color: var(--cg-muted); font-size: 1.15rem; }
.btn-icon:hover { background: var(--cg-surface-2); color: var(--cg-text); }
.btn-icon.disabled { opacity: .3; }
.btn-icon.active { background: var(--cg-primary-soft); color: var(--cg-primary); }

/* --- Layout applicazione ----------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; flex-shrink: 0; background: var(--cg-sidebar-bg); color: var(--cg-sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 1040;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; color: #fff; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.1rem;
  background: linear-gradient(135deg, #3b82f6, #06b6d4); color: #fff; box-shadow: 0 6px 16px rgba(59, 130, 246, .35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.05rem; letter-spacing: -.01em; }
.brand-text small { color: var(--cg-sidebar-muted); font-size: .75rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem; }
.nav-link-item {
  display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px;
  color: var(--cg-sidebar-text); font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav-link-item i { font-size: 1.05rem; opacity: .75; }
.nav-link-item:hover { background: var(--cg-sidebar-active); color: #fff; }
.nav-link-item.active { background: rgba(59, 130, 246, .18); color: #fff; }
.nav-link-item.active i { color: #60a5fa; opacity: 1; }
.sidebar-footer { padding: 1rem; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
  background: color-mix(in srgb, var(--cg-bg) 85%, transparent); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 1030; border-bottom: 1px solid var(--cg-border);
}
.topbar-title { font-weight: 600; color: var(--cg-muted); font-size: .9rem; }
.user-chip { display: flex; align-items: center; gap: .5rem; border-radius: 999px; padding: .25rem .6rem .25rem .25rem; border: 1px solid var(--cg-border); background: var(--cg-surface); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 600;
  background: linear-gradient(135deg, #6366f1, #3b82f6); color: #fff; flex-shrink: 0;
}
/* --- Richieste nella barra in alto ------------------------------------- */
.bell-badge {
  position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--cg-bg); font-variant-numeric: tabular-nums;
}
.bell-badge[hidden] { display: none; }
.bell-menu { width: 340px; max-width: calc(100vw - 32px); overflow: hidden; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--cg-border); }
.bell-list { max-height: 360px; overflow-y: auto; }
.bell-item { display: block; padding: .6rem 1rem; color: var(--cg-text); border-bottom: 1px solid var(--cg-border); min-width: 0; }
.bell-item:hover { background: var(--cg-surface-2); color: var(--cg-text); }
.bell-empty { padding: 1.5rem 1rem; text-align: center; color: var(--cg-muted); font-size: .9rem; }
.bell-empty i { display: block; font-size: 1.6rem; margin-bottom: .35rem; opacity: .6; }
.bell-foot { display: block; padding: .65rem 1rem; text-align: center; font-weight: 500; font-size: .88rem; }
.bell-foot:hover { background: var(--cg-surface-2); }

/* --- Schede (Impostazioni) e selettore a segmenti (Timesheet) ---------- */
.settings-head { margin-bottom: 1.5rem; }
.settings-head .eyebrow { font-size: .78rem; font-weight: 600; color: var(--cg-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5rem; }
.settings-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--cg-border); overflow-x: auto; scrollbar-width: none; }
.settings-tabs a { display: inline-flex; align-items: center; gap: .45rem; padding: .6rem .9rem; color: var(--cg-muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.settings-tabs a:hover { color: var(--cg-text); }
.settings-tabs a.active { color: var(--cg-primary); border-bottom-color: var(--cg-primary); }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--cg-surface-2); border: 1px solid var(--cg-border); }
.segmented a { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .95rem; border-radius: 9px; color: var(--cg-muted); font-weight: 500; font-size: .9rem; }
.segmented a:hover { color: var(--cg-text); }
.segmented a.active { background: var(--cg-surface); color: var(--cg-text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.hours-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.hours-summary .card-body { padding: .9rem 1.1rem; }
@media (max-width: 575.98px) { .hours-summary { gap: .5rem; } .hours-summary .kpi-icon { display: none; } .hours-summary .kpi-value { font-size: 1.2rem; } }

.content { padding: 1.75rem 1.5rem 3rem; max-width: 1400px; width: 100%; margin: 0 auto; }

[data-bs-theme="light"] .theme-icon-light { display: none; }
[data-bs-theme="dark"] .theme-icon-dark { display: none; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 1035; }
  .topbar { padding: 0 1rem; }
  .content { padding: 1.25rem 1rem 2.5rem; }
}

/* --- Intestazione pagina ------------------------------------------------ */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-header .subtitle { color: var(--cg-muted); margin-top: .25rem; }
.breadcrumb-lite { font-size: .8rem; color: var(--cg-muted); margin-bottom: .35rem; }
.breadcrumb-lite a { color: var(--cg-muted); }
.breadcrumb-lite a:hover { color: var(--cg-primary); }

/* --- Card --------------------------------------------------------------- */
.card { --bs-card-bg: var(--cg-surface); --bs-card-border-color: var(--cg-border); --bs-card-border-radius: var(--cg-radius); box-shadow: var(--cg-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--cg-border); padding: 1rem 1.25rem; }
.card-body { padding: 1.25rem; }
.card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.card-subtle { background: var(--cg-surface-2); border: 1px solid var(--cg-border); border-radius: 12px; }

/* KPI */
.kpi { display: flex; gap: 1rem; align-items: center; }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .8rem; color: var(--cg-muted); }
a.card-link-kpi { color: inherit; display: block; transition: transform .15s, box-shadow .15s; }
a.card-link-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, .09); }

.tone-blue   { background: rgba(59, 130, 246, .12); color: #3b82f6; }
.tone-amber  { background: rgba(245, 158, 11, .14); color: #d97706; }
.tone-red    { background: rgba(239, 68, 68, .12);  color: #ef4444; }
.tone-green  { background: rgba(16, 185, 129, .13); color: #059669; }
.tone-violet { background: rgba(139, 92, 246, .13); color: #7c3aed; }
.tone-slate  { background: rgba(100, 116, 139, .13); color: #64748b; }

/* --- Badge / pill -------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.pill-secondary { background: rgba(100, 116, 139, .14); color: #475569; }
.pill-success   { background: rgba(16, 185, 129, .15); color: #047857; }
.pill-primary   { background: rgba(59, 130, 246, .14); color: #1d4ed8; }
.pill-warning   { background: rgba(245, 158, 11, .17); color: #b45309; }
.pill-danger    { background: rgba(239, 68, 68, .14);  color: #b91c1c; }
[data-bs-theme="dark"] .pill-secondary { color: #cbd5e1; }
[data-bs-theme="dark"] .pill-success { color: #6ee7b7; }
[data-bs-theme="dark"] .pill-primary { color: #93c5fd; }
[data-bs-theme="dark"] .pill-warning { color: #fcd34d; }
[data-bs-theme="dark"] .pill-danger { color: #fca5a5; }

/* --- Form --------------------------------------------------------------- */
.form-label { font-size: .8rem; font-weight: 600; color: var(--cg-muted); margin-bottom: .35rem; }
.form-control, .form-select { border-radius: 10px; border-color: var(--cg-border); background-color: var(--cg-surface); padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--cg-primary-rgb), .6); box-shadow: 0 0 0 .2rem rgba(var(--cg-primary-rgb), .15); }
.form-control-sm, .form-select-sm { border-radius: 8px; padding: .35rem .6rem; }
.input-group-text { background: var(--cg-surface-2); border-color: var(--cg-border); border-radius: 10px; }
.required::after { content: " *"; color: #ef4444; }
.form-check-input:checked { background-color: var(--cg-primary); border-color: var(--cg-primary); }

.filter-bar { background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: var(--cg-radius); padding: 1rem; box-shadow: var(--cg-shadow); margin-bottom: 1.25rem; }

/* --- Tabelle ------------------------------------------------------------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--cg-text); margin: 0; }
.table > :not(caption) > * > * { padding: .8rem 1rem; border-color: var(--cg-border); }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cg-muted); font-weight: 600; background: var(--cg-surface-2); white-space: nowrap; }
.table thead th a { color: inherit; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--cg-surface-2); }
.table tbody tr:last-child > * { border-bottom: 0; }
.row-link { cursor: pointer; }
.table-card { overflow: hidden; }
.table-card .table-responsive { border-radius: 0 0 var(--cg-radius) var(--cg-radius); }

tr.row-expired > td:first-child { box-shadow: inset 3px 0 0 #ef4444, inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg))); }  /* la striscia + l'evidenziazione al passaggio del mouse */
tr.row-soon > td:first-child { box-shadow: inset 3px 0 0 #f59e0b, inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg))); }  /* la striscia + l'evidenziazione al passaggio del mouse */
tr.row-inactive { opacity: .6; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--cg-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .75rem; opacity: .5; }

/* --- Lista ordini (dashboard) ------------------------------------------ */
.expiry { font-variant-numeric: tabular-nums; white-space: nowrap; }
.expiry.expired { color: #ef4444; font-weight: 600; }
.expiry.soon { color: #d97706; font-weight: 600; }

/* --- Righe servizi nell'ordine ----------------------------------------- */
.service-row { display: grid; grid-template-columns: 28px 1fr 150px 150px 40px; gap: .6rem; align-items: center; padding: .6rem; border: 1px solid var(--cg-border); border-radius: 12px; background: var(--cg-surface-2); margin-bottom: .5rem; }
.service-row .drag-handle { cursor: grab; color: var(--cg-muted); text-align: center; }
.service-row.dragging { opacity: .5; }
@media (max-width: 767.98px) {
  .service-row { grid-template-columns: 24px 1fr 40px; }
  .service-row .svc-amount, .service-row .svc-optional { grid-column: 2 / 3; }
}
.service-line { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px dashed var(--cg-border); }
.service-line:last-child { border-bottom: 0; }
.service-line.not-bought { opacity: .55; text-decoration: line-through; }

.totals { background: var(--cg-surface-2); border: 1px solid var(--cg-border); border-radius: 12px; padding: 1rem 1.25rem; }
.totals .row-total { display: flex; justify-content: space-between; padding: .2rem 0; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 1px solid var(--cg-border); margin-top: .4rem; padding-top: .6rem; font-weight: 700; font-size: 1.1rem; }

/* --- Timeline / stato ordine ------------------------------------------- */
.steps-track { display: flex; gap: .5rem; }
.steps-track .st { flex: 1; text-align: center; font-size: .75rem; color: var(--cg-muted); }
.steps-track .st .dot { height: 6px; border-radius: 99px; background: var(--cg-border); margin-bottom: .4rem; }
.steps-track .st.done .dot { background: #10b981; }
.steps-track .st.current .dot { background: var(--cg-primary); }
.steps-track .st.done, .steps-track .st.current { color: var(--cg-text); font-weight: 600; }

/* --- Calendario ore ----------------------------------------------------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cg-muted); text-align: center; font-weight: 600; padding-bottom: .25rem; }
.cal-day {
  position: relative; aspect-ratio: 1 / .82; border-radius: 10px; border: 1px solid var(--cg-border); background: var(--cg-surface);
  display: flex; flex-direction: column; justify-content: space-between; padding: .35rem .45rem; color: var(--cg-text); font-size: .85rem; transition: border-color .15s, background .15s;
}
.cal-day:hover { border-color: rgba(var(--cg-primary-rgb), .5); }
.cal-day .num { font-weight: 600; }
.cal-day .hrs { font-size: .7rem; font-weight: 600; align-self: flex-end; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; max-width: 100%; }
.cal-day.weekend { background: var(--cg-surface-2); }
.cal-day.weekend .num { color: var(--cg-muted); }
.cal-day.has-hours .hrs { color: #059669; }
.cal-day.has-hours { background: rgba(16, 185, 129, .08); border-color: rgba(16, 185, 129, .3); }
.cal-day.partial .hrs { color: #d97706; }
.cal-day.partial { background: rgba(245, 158, 11, .07); border-color: rgba(245, 158, 11, .3); }
.cal-day.today::after { content: ""; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--cg-primary); }
.cal-day.selected { border: 2px solid var(--cg-primary); background: var(--cg-primary-soft); }
.cal-day.future, .cal-day.outside { pointer-events: none; opacity: .35; }
.cal-day.blank { visibility: hidden; }
@media (max-width: 575.98px) {
  .cal-grid { gap: 4px; }
  .cal-day { aspect-ratio: 1; padding: .2rem .3rem; font-size: .75rem; }
  .cal-day .hrs { font-size: .6rem; }
}

.entry-card { border: 1px solid var(--cg-border); border-radius: 12px; padding: .9rem 1rem; background: var(--cg-surface); display: flex; gap: 1rem; align-items: flex-start; }
.entry-card + .entry-card { margin-top: .6rem; }
.entry-card.shared { background: var(--cg-surface-2); }
.entry-duration { min-width: 64px; text-align: center; background: var(--cg-primary-soft); color: var(--cg-primary); border-radius: 10px; padding: .45rem .5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: var(--cg-surface-2); border: 1px solid var(--cg-border); color: var(--cg-muted); }

.progress-day { height: 8px; border-radius: 99px; background: var(--cg-surface-2); overflow: hidden; }
.progress-day > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #10b981, #3b82f6); }

/* colleghi (lavoro di gruppo) */
.check-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.check-pills input { display: none; }
.check-pills label { padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--cg-border); cursor: pointer; font-size: .82rem; user-select: none; background: var(--cg-surface); }
.check-pills input:checked + label { background: var(--cg-primary); border-color: var(--cg-primary); color: #fff; }

/* durata: pulsanti rapidi */
.duration-picker { display: flex; flex-wrap: wrap; gap: .35rem; }
.duration-picker button { border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 8px; padding: .25rem .55rem; font-size: .8rem; color: var(--cg-text); }
.duration-picker button.active, .duration-picker button:hover { border-color: var(--cg-primary); color: var(--cg-primary); background: var(--cg-primary-soft); }

/* --- Report ore --------------------------------------------------------- */
.bar-list .item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1rem; padding: .55rem 0; }
.bar-list .item + .item { border-top: 1px dashed var(--cg-border); }
.bar-list .track { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--cg-surface-2); overflow: hidden; }
.bar-list .track > div { height: 100%; border-radius: 99px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }

/* --- Login -------------------------------------------------------------- */
.bare-body { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  background: radial-gradient(1200px 600px at -10% -20%, rgba(59, 130, 246, .55), transparent 60%),
              radial-gradient(800px 500px at 120% 120%, rgba(6, 182, 212, .45), transparent 60%), #0b1120;
  color: #e2e8f0; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art h2 { font-size: 2.2rem; font-weight: 700; letter-spacing: -.03em; color: #fff; }
.login-art .feature { display: flex; gap: .75rem; align-items: flex-start; margin-top: 1rem; color: #cbd5e1; }
.login-art .feature i { color: #60a5fa; font-size: 1.2rem; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--cg-surface); }
.login-form .inner { width: 100%; max-width: 380px; }
@media (max-width: 991.98px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

/* --- Area pubblica (checkout) ----------------------------------------- */
.public-body { background: var(--cg-bg); }
.public-header { background: linear-gradient(90deg, #1e3a8a, #2563eb); padding: .9rem 0; box-shadow: 0 2px 12px rgba(30, 58, 138, .25); }
.public-main { max-width: 860px; padding-top: 2rem; padding-bottom: 3rem; }
.public-footer { padding: 1.5rem 1rem 2.5rem; }
.pay-option { display: flex; gap: 1rem; align-items: center; border: 2px solid var(--cg-border); border-radius: 14px; padding: 1rem 1.25rem; cursor: pointer; background: var(--cg-surface); transition: border-color .15s, background .15s; }
.pay-option:hover { border-color: rgba(var(--cg-primary-rgb), .5); }
.btn-check:checked + .pay-option { border-color: var(--cg-primary); background: var(--cg-primary-soft); }
.pay-option .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.option-card { display: flex; gap: .9rem; align-items: center; border: 1px solid var(--cg-border); border-radius: 12px; padding: .9rem 1rem; background: var(--cg-surface); cursor: pointer; }
.option-card:has(input:checked) { border-color: var(--cg-primary); background: var(--cg-primary-soft); }
.pdf-frame { width: 100%; height: 480px; border: 1px solid var(--cg-border); border-radius: 12px; background: #fff; }

/* --- Toast --------------------------------------------------------------- */
.toast { border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); min-width: 300px; }
.toast-success { background: #ecfdf5; color: #065f46; }
.toast-danger  { background: #fef2f2; color: #991b1b; }
.toast-warning { background: #fffbeb; color: #92400e; }
.toast-info    { background: #eff6ff; color: #1e40af; }

/* --- Varie --------------------------------------------------------------- */
.editor { min-height: 260px; border: 1px solid var(--cg-border); border-radius: 0 0 10px 10px; padding: .9rem; background: var(--cg-surface); overflow: auto; }
.editor:focus { outline: none; border-color: rgba(var(--cg-primary-rgb), .6); }
.editor-toolbar { display: flex; gap: .25rem; padding: .35rem; border: 1px solid var(--cg-border); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--cg-surface-2); }
.editor-toolbar button { border: 0; background: transparent; border-radius: 6px; padding: .25rem .5rem; color: var(--cg-text); }
.editor-toolbar button:hover { background: var(--cg-border); }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; font-size: .9rem; }
.dl-grid dt { color: var(--cg-muted); font-weight: 500; }
.dl-grid dd { margin: 0; word-break: break-word; }
.loading-overlay { position: fixed; inset: 0; display: none; place-items: center; background: rgba(255, 255, 255, .6); z-index: 2000; }
[data-bs-theme="dark"] .loading-overlay { background: rgba(2, 6, 23, .6); }
.loading-overlay.show { display: grid; }
.color-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: -2px; }

/* --- Progetti / kanban ------------------------------------------------- */
.kb-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kb-col { flex: 1 0 280px; min-width: 280px; border-radius: var(--cg-radius); background: var(--kb-bg); border: 1px solid var(--cg-border); display: flex; flex-direction: column; max-height: calc(100vh - 220px); transition: box-shadow .15s, background .15s; }
.kb-col.task-col { flex-basis: 260px; min-width: 240px; }
.kb-col.drag-over { box-shadow: 0 0 0 2px var(--kb-dot) inset; background: var(--kb-head); }
.kb-head { background: var(--kb-head); border-radius: var(--cg-radius) var(--cg-radius) 0 0; padding: .75rem .9rem; }
.kb-head .kb-title { display: flex; align-items: center; gap: .5rem; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--kb-color); }
.kb-head .kb-count { margin-left: auto; font-size: .72rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; background: rgba(255,255,255,.7); color: var(--kb-color); }
.kb-head .kb-sub { font-size: .75rem; color: var(--kb-color); opacity: .85; margin-top: .3rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.kb-head .kb-pill { font-size: .68rem; font-weight: 700; padding: .05rem .45rem; border-radius: 99px; background: rgba(255,255,255,.65); }
.kb-head .kb-details { font-size: .72rem; color: var(--kb-color); margin-top: .4rem; }
.kb-body { padding: .6rem; overflow-y: auto; flex: 1; min-height: 80px; }
.kb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--kb-dot); display: inline-block; flex-shrink: 0; }
.kb-card { position: relative; background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 12px; padding: .75rem .85rem; margin-bottom: .55rem; box-shadow: 0 1px 2px rgba(15,23,42,.05); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kb-card:hover { box-shadow: 0 6px 18px rgba(15,23,42,.1); }
.kb-card[draggable="true"] { cursor: grab; }
.kb-card.dragging { opacity: .25; }
.kb-card.locked { cursor: default; }
.kb-card .kb-card-title { font-weight: 600; line-height: 1.3; }
.kb-card .kb-desc { font-size: .8rem; color: var(--cg-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: .25rem; }
.kb-card .kb-meta { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; font-size: .72rem; color: var(--cg-muted); }
.kb-card .kb-actions { position: absolute; top: .4rem; right: .4rem; display: none; gap: .15rem; background: var(--cg-surface); border-radius: 8px; padding: .1rem; }
.kb-card:hover .kb-actions { display: flex; }
.kb-card .kb-actions button { border: 0; background: transparent; color: var(--cg-muted); width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; }
.kb-card .kb-actions button:hover { background: var(--cg-surface-2); color: var(--cg-text); }
.kb-card .kb-actions button.danger:hover { color: #ef4444; }
.kb-add { width: 100%; border: 1px dashed var(--cg-border); background: transparent; border-radius: 10px; padding: .45rem; font-size: .8rem; color: var(--cg-muted); }
.kb-add:hover { border-color: var(--kb-dot); color: var(--kb-color); background: rgba(255,255,255,.5); }
.mini-avatar { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .6rem; font-weight: 700; color: #fff; border: 2px solid var(--cg-surface); margin-left: -6px; }
.mini-avatar:first-child { margin-left: 0; }
.kb-badge { display: inline-flex; align-items: center; gap: .2rem; font-size: .7rem; padding: .1rem .45rem; border-radius: 6px; background: var(--cg-surface-2); color: var(--cg-muted); }
.kb-badge.blue { background: #eff6ff; color: #3b82f6; }
.chip-filter { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: 99px; background: var(--cg-surface-2); border: 1px solid var(--cg-border); color: var(--cg-muted); font-size: .8rem; font-weight: 500; cursor: pointer; }
.chip-filter.active { background: #0f172a; border-color: #0f172a; color: #fff; }
[data-bs-theme="dark"] .chip-filter.active { background: #e5e7eb; border-color: #e5e7eb; color: #0b1120; }
.kb-tabs { display: none; }
@media (max-width: 767.98px) {
  .kb-board { display: block; }
  .kb-col { display: none; max-height: none; min-width: 0; }
  .kb-col.mobile-active { display: flex; }
  .kb-tabs { display: flex; overflow-x: auto; gap: .25rem; margin-bottom: .75rem; border-bottom: 1px solid var(--cg-border); }
  .kb-tabs button { border: 0; background: transparent; padding: .5rem .75rem; font-size: .8rem; white-space: nowrap; color: var(--cg-muted); border-bottom: 2px solid transparent; display: flex; align-items: center; gap: .35rem; }
  .kb-tabs button.active { color: var(--cg-text); font-weight: 600; border-bottom-color: var(--kb-dot); }
  .kb-card .kb-actions { display: flex; position: static; justify-content: flex-end; margin-top: .4rem; }
}
[data-bs-theme="dark"] .kb-col { --kb-bg: var(--cg-surface-2) !important; }
[data-bs-theme="dark"] .kb-head { background: color-mix(in srgb, var(--kb-dot) 18%, var(--cg-surface)); }
[data-bs-theme="dark"] .kb-head .kb-title, [data-bs-theme="dark"] .kb-head .kb-sub, [data-bs-theme="dark"] .kb-head .kb-details { color: var(--cg-text); }
[data-bs-theme="dark"] .kb-head .kb-count, [data-bs-theme="dark"] .kb-head .kb-pill { background: rgba(0,0,0,.25); color: var(--cg-text); }
.search-pop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: min(420px, 90vw); z-index: 1050; background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.15); max-height: 380px; overflow-y: auto; }
.search-pop .sec { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cg-muted); font-weight: 700; padding: .6rem .9rem .3rem; }
.search-pop a { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .9rem; color: var(--cg-text); }
.search-pop a:hover, .search-pop a.kb-sel { background: var(--cg-surface-2); }
.type-card { border: 2px solid var(--cg-border); border-radius: 12px; padding: .75rem; cursor: pointer; display: flex; gap: .6rem; align-items: flex-start; }
.type-card.selected { border-color: #60a5fa; background: #eff6ff; }
[data-bs-theme="dark"] .type-card.selected { background: rgba(96,165,250,.12); }
.radio-row { display: flex; align-items: center; gap: .6rem; padding: .45rem .7rem; border: 1px solid var(--cg-border); border-radius: 10px; cursor: pointer; margin-bottom: .35rem; }
.radio-row input { display: none; }
.radio-row:has(input:checked) { border-color: var(--row-color, var(--cg-primary)); background: var(--row-bg, var(--cg-primary-soft)); font-weight: 600; }
.drop-zone { border: 2px dashed var(--cg-border); border-radius: 12px; padding: 1rem; text-align: center; color: var(--cg-muted); cursor: pointer; font-size: .85rem; }
.drop-zone.over { border-color: var(--cg-primary); background: var(--cg-primary-soft); color: var(--cg-primary); }
.link-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 99px; background: #eff6ff; color: #1d4ed8; font-size: .8rem; max-width: 260px; }
.link-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-bs-theme="dark"] .link-pill, [data-bs-theme="dark"] .kb-badge.blue { background: rgba(96,165,250,.12); color: #93c5fd; }

/* miniature allegati nel form del task */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .6rem; }
.att-grid:empty { display: none; }
.att-tile { position: relative; border: 1px solid var(--cg-border); border-radius: 10px; padding: .4rem; background: var(--cg-surface); font-size: .72rem; }
.att-thumb { display: grid; place-items: center; height: 84px; border-radius: 7px; background: var(--cg-surface-2); overflow: hidden; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb i { font-size: 2rem; color: var(--cg-muted); }
.att-name { margin-top: .35rem; font-weight: 500; color: var(--cg-text); }
.att-size { color: var(--cg-muted); }
.att-remove { position: absolute; top: .2rem; right: .2rem; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(15,23,42,.65); color: #fff; cursor: pointer; margin: 0; font-size: .7rem; }
.att-remove:hover { background: #ef4444; }
.att-removed { display: none; position: absolute; inset: 0; border-radius: 10px; background: rgba(255,255,255,.75); color: #b91c1c; font-weight: 600; place-items: center; pointer-events: none; }
.att-tile.removed .att-removed { display: grid; }
.att-tile.removed .att-remove { z-index: 1; background: #ef4444; }
[data-bs-theme="dark"] .att-removed { background: rgba(2,6,23,.7); color: #fca5a5; }

/* --- Selettori di date (datepicker.js) ---------------------------------- */
.dp-field { position: relative; }
.dp-field .dp-input { padding-right: 2.4rem; }
.dp-field-icon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; color: var(--cg-muted); }
.dp-field-icon:hover:not(:disabled) { background: var(--cg-surface-2); color: var(--cg-primary); }
.dp-trigger { display: flex; align-items: center; gap: .55rem; text-align: left; cursor: pointer; white-space: nowrap; }
.dp-trigger > .bi:first-child { color: var(--cg-muted); }
.dp-trigger-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.dp-caret { font-size: .7rem; opacity: .5; }
.dp-trigger-plain { width: auto; font-weight: 600; padding: .35rem .8rem; }
.dp-trigger-plain .dp-caret { margin-left: .2rem; }

.dp-pop {
  position: fixed; z-index: 1080; display: flex; background: var(--cg-surface); color: var(--cg-text);
  border: 1px solid var(--cg-border); border-radius: 14px; box-shadow: 0 18px 48px rgba(15, 23, 42, .18); overflow: hidden;
  animation: dp-in .12s ease-out;
}
@keyframes dp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dp-single, .dp-month-pop { flex-direction: column; width: 320px; padding: .75rem; }
.dp-main { padding: .75rem; display: flex; flex-direction: column; min-width: 0; }
.dp-range .dp-main { min-width: 290px; }
.dp-month-pop .dp-main, .dp-single .dp-main { padding: 0; }
.dp-presets { display: flex; flex-direction: column; gap: 2px; padding: .6rem; border-right: 1px solid var(--cg-border); background: var(--cg-surface-2); min-width: 190px; }
.dp-preset { border: 0; background: none; text-align: left; padding: .45rem .7rem; border-radius: 8px; font-size: .88rem; color: var(--cg-text); white-space: nowrap; }
.dp-preset:hover { background: var(--cg-surface); color: var(--cg-primary); }
.dp-preset.active { background: var(--cg-primary); color: #fff; font-weight: 600; }
[data-bs-theme="dark"] .dp-preset.active { color: #0b1120; }
.dp-cals { display: flex; gap: 1.25rem; }
.dp-cal { width: 266px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.dp-title { font-weight: 600; font-size: .93rem; border: 0; background: none; padding: .25rem .5rem; border-radius: 8px; color: var(--cg-text); }
.dp-title.is-link:hover { background: var(--cg-surface-2); color: var(--cg-primary); }
.dp-nav { border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; color: var(--cg-muted); }
.dp-nav:hover:not(:disabled) { background: var(--cg-surface-2); color: var(--cg-text); }
.dp-nav:disabled { opacity: .25; }
.dp-days { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.dp-dow { font-size: .68rem; font-weight: 600; color: var(--cg-muted); text-align: center; padding: .2rem 0 .35rem; text-transform: uppercase; }
.dp-day { position: relative; border: 0; background: none; height: 36px; font-size: .86rem; color: var(--cg-text); border-radius: 9px; font-variant-numeric: tabular-nums; }
.dp-day.is-weekend { color: var(--cg-muted); }
.dp-day:hover:not(:disabled) { background: var(--cg-primary-soft); color: var(--cg-primary); }
.dp-day:disabled { opacity: .25; cursor: default; }
.dp-day.is-today { font-weight: 700; color: var(--cg-primary); }
.dp-day.is-today::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.dp-day.is-in, .dp-month.is-in { background: var(--cg-primary-soft); border-radius: 0; color: var(--cg-text); }
.dp-day.is-sel, .dp-month.is-sel { background: var(--cg-primary); color: #fff; font-weight: 600; }
.dp-day.is-start, .dp-month.is-start { border-radius: 9px 0 0 9px; }
.dp-day.is-end, .dp-month.is-end { border-radius: 0 9px 9px 0; }
[data-bs-theme="dark"] .dp-day.is-sel, [data-bs-theme="dark"] .dp-month.is-sel { color: #0b1120; }
.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 0; padding: .25rem 0; }
.dp-range .dp-months { width: 280px; }
.dp-month { border: 0; background: none; height: 44px; border-radius: 9px; font-size: .9rem; color: var(--cg-text); }
.dp-month:hover:not(:disabled) { background: var(--cg-primary-soft); color: var(--cg-primary); }
.dp-month:disabled { opacity: .25; }
.dp-month.is-today { font-weight: 700; color: var(--cg-primary); }
.dp-day.is-sel.is-today, .dp-month.is-sel.is-today { color: #fff; }
[data-bs-theme="dark"] .dp-day.is-sel.is-today, [data-bs-theme="dark"] .dp-month.is-sel.is-today { color: #0b1120; }
.dp-foot { border-top: 1px solid var(--cg-border); margin-top: .6rem; padding-top: .6rem; display: flex; flex-direction: column; gap: .5rem; }
.dp-foot-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }
.dp-main > .dp-foot-row { border-top: 1px solid var(--cg-border); padding-top: .6rem; }
.dp-hint { font-size: .76rem; color: var(--cg-muted); flex: 1; }
.dp-link { border: 0; background: none; padding: .2rem .1rem; font-size: .85rem; font-weight: 600; color: var(--cg-primary); }
.dp-link:hover { text-decoration: underline; }
.dp-quick { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.dp-quick-label { font-size: .76rem; color: var(--cg-muted); margin-right: .1rem; }
.dp-chip { border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 999px; padding: .2rem .65rem; font-size: .8rem; font-weight: 500; color: var(--cg-text); }
.dp-chip:hover { border-color: var(--cg-primary); color: var(--cg-primary); }
.dp-chip.active { background: var(--cg-primary); border-color: var(--cg-primary); color: #fff; }

/* telefono: il selettore si apre dal basso a tutta larghezza */
.dp-pop.dp-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; border-radius: 18px 18px 0 0; flex-direction: column; max-height: 88vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); animation: dp-up .18s ease-out; }
@keyframes dp-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.dp-sheet .dp-presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--cg-border); min-width: 0; gap: .35rem; }
.dp-sheet .dp-preset { border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 999px; padding: .35rem .8rem; font-size: .84rem; }
.dp-sheet .dp-cal, .dp-sheet .dp-months, .dp-sheet .dp-main { width: auto; min-width: 0; }
.dp-sheet .dp-preset.active { background: var(--cg-primary); border-color: var(--cg-primary); color: #fff; }
[data-bs-theme="dark"] .dp-sheet .dp-preset.active { color: #0b1120; }
.dp-sheet .dp-cal { flex: 1; }
.dp-sheet .dp-day { height: 42px; font-size: .95rem; }
body.dp-open-sheet::after { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 1079; }
.kbd-hint kbd { font-size: .68rem; padding: .05rem .3rem; background: var(--cg-surface-2); color: var(--cg-muted); border: 1px solid var(--cg-border); border-radius: 4px; box-shadow: none; }

/* --- Ordini: riquadri "cosa devo fare", ordinamento, azioni sulla riga -- */
.todo-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.todo-tile {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .8rem; align-items: center;
  padding: .85rem 1rem; border-radius: 14px; background: var(--cg-surface); border: 1px solid var(--cg-border); color: var(--cg-text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.todo-tile:hover { border-color: var(--tile); box-shadow: 0 4px 14px rgba(15, 23, 42, .08); color: var(--cg-text); transform: translateY(-1px); }
.todo-icon { grid-row: span 2; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 1.1rem; background: var(--tile-bg); color: var(--tile); }
.todo-num { font-size: 1.45rem; font-weight: 700; line-height: 1.1; color: var(--tile); }
.todo-label { font-size: .8rem; color: var(--cg-muted); line-height: 1.2; }
.todo-close { position: absolute; top: .55rem; right: .65rem; font-size: .75rem; color: var(--cg-muted); }
.todo-tile.active { border: 2px solid var(--tile); background: var(--tile-bg); padding: calc(.85rem - 1px) calc(1rem - 1px); }
.todo-tile.is-zero .todo-num { color: var(--cg-muted); }
.todo-tile.is-zero .todo-icon { opacity: .5; }
.todo-tile.tone-red   { --tile: #dc2626; --tile-bg: rgba(239, 68, 68, .1); }
.todo-tile.tone-amber { --tile: #d97706; --tile-bg: rgba(245, 158, 11, .12); }
.todo-tile.tone-blue  { --tile: #2563eb; --tile-bg: rgba(59, 130, 246, .1); }
.todo-tile.tone-green { --tile: #059669; --tile-bg: rgba(16, 185, 129, .11); }
[data-bs-theme="dark"] .todo-tile.tone-red   { --tile: #f87171; }
[data-bs-theme="dark"] .todo-tile.tone-amber { --tile: #fbbf24; }
[data-bs-theme="dark"] .todo-tile.tone-blue  { --tile: #60a5fa; }
[data-bs-theme="dark"] .todo-tile.tone-green { --tile: #34d399; }
.todo-tile.tone-red, .todo-tile.tone-amber, .todo-tile.tone-blue, .todo-tile.tone-green { background: var(--cg-surface); color: var(--cg-text); }
.todo-tile.active.tone-red, .todo-tile.active.tone-amber, .todo-tile.active.tone-blue, .todo-tile.active.tone-green { background: var(--tile-bg); }
@media (max-width: 767.98px) { .todo-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; } }

.th-sort { color: inherit; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.th-sort i { font-size: .75rem; opacity: .3; }
.th-sort:hover { color: var(--cg-text); }
.th-sort:hover i, .th-sort.active i { opacity: 1; }
.th-sort.active { color: var(--cg-primary); }
.link-client { color: var(--cg-text); }
.link-client:hover { color: var(--cg-primary); text-decoration: underline; }
.orders-table .actions-col { width: 1%; white-space: nowrap; text-align: right; }
.row-actions { display: flex; flex-direction: column; align-items: stretch; gap: .3rem; min-width: 128px; }
.row-actions .btn, .row-actions form, .row-actions .dropdown { width: 100%; }
.row-actions .btn { text-align: left; white-space: nowrap; }
.row-actions .dropdown-toggle { display: flex; align-items: center; justify-content: space-between; }
.row-actions form { margin: 0; }
.row-actions .btn-soft { background: var(--cg-surface); }
tr:hover .row-actions .btn-soft { border-color: rgba(var(--cg-primary-rgb), .35); }

/* --- Sistema ordini scaduti ---------------------------------------------- */
.cleanup-table td { padding-top: .6rem; padding-bottom: .6rem; }
.cleanup-client td { background: var(--cg-surface-2); border-top: 1px solid var(--cg-border); padding-top: .5rem; padding-bottom: .5rem; }
.cleanup-row { cursor: pointer; }
.cleanup-row:hover td { background: color-mix(in srgb, var(--cg-surface-2) 60%, transparent); }
.cleanup-row.is-selected td { background: var(--cg-primary-soft); }
.bulk-bar {
  position: sticky; bottom: 1rem; z-index: 1020; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border-radius: 14px; background: var(--cg-surface); border: 1px solid var(--cg-border);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar input[name=note] { flex: 1; min-width: 200px; }
.closure-box { border-left: 3px solid var(--closure, var(--cg-border)); }

/* --- Scheda ordine: titolo, prossimo passo, barra di salvataggio -------- */
.min-w-0 { min-width: 0; }
.order-num { font-size: .85rem; font-weight: 500; color: var(--cg-muted); cursor: help; }
.order-meta { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin-top: .35rem; font-size: .88rem; color: var(--cg-muted); }
.order-meta i { margin-right: .35rem; opacity: .7; }
.order-meta .expiry.expired, .order-meta .expiry.soon { font-weight: 600; }
.next-step { --ns: var(--cg-primary); --ns-bg: var(--cg-primary-soft); border-left: 4px solid var(--ns); }
.next-step.ns-danger  { --ns: #ef4444; --ns-bg: rgba(239, 68, 68, .1); }
.next-step.ns-warning { --ns: #f59e0b; --ns-bg: rgba(245, 158, 11, .12); }
.next-step.ns-done    { --ns: #10b981; --ns-bg: rgba(16, 185, 129, .11); }
.next-step.ns-muted   { --ns: #94a3b8; --ns-bg: rgba(148, 163, 184, .14); }
.next-step-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.next-step-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: var(--ns-bg); color: var(--ns); flex-shrink: 0; }
.next-step-title { font-weight: 700; font-size: 1.02rem; }
.next-step-text { color: var(--cg-muted); font-size: .9rem; }
.next-step-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.next-step-actions form { margin: 0; }
@media (max-width: 767.98px) { .next-step-actions { width: 100%; } .next-step-actions > * { flex: 1 1 auto; } .next-step-actions .btn { width: 100%; } }
.save-bar {
  position: sticky; bottom: 1rem; z-index: 1020; display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .7rem 1rem; margin-bottom: 1rem; border-radius: 14px; background: #1e293b; color: #fff; box-shadow: 0 12px 32px rgba(15, 23, 42, .25);
  animation: dp-up .18s ease-out;
}
.save-bar[hidden] { display: none; }
.save-bar .btn-soft { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff; }
[data-bs-theme="dark"] .save-bar { background: #334155; }
.billing-check { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem .65rem; border-radius: 9px; }
.billing-check.ok { background: rgba(16, 185, 129, .1); color: #047857; }
.billing-check.warn { background: rgba(245, 158, 11, .13); color: #92400e; }
[data-bs-theme="dark"] .billing-check.ok { color: #6ee7b7; }
[data-bs-theme="dark"] .billing-check.warn { color: #fcd34d; }

/* --- Allegati: trascina e rilascia ---------------------------------------- */
.drop-zone { transition: border-color .15s, background .15s, color .15s; }
.drop-zone:hover { border-color: rgba(var(--cg-primary-rgb), .5); color: var(--cg-text); }
.drop-zone u { text-decoration-color: rgba(var(--cg-primary-rgb), .5); }
.drop-zone.has-file { padding: .6rem; }
.drop-zone.has-file .bi-cloud-arrow-up { display: none !important; }
body.dz-dragging .drop-zone:not(.over) { border-color: rgba(var(--cg-primary-rgb), .6); background: color-mix(in srgb, var(--cg-primary-soft) 55%, transparent); }
.dz-files { display: flex; flex-direction: column; gap: .35rem; }
.dz-files:not(:empty) { margin-top: .5rem; }
.dz-file { display: flex; align-items: center; gap: .5rem; padding: .35rem .35rem .35rem .7rem; border: 1px solid var(--cg-border); border-radius: 9px; background: var(--cg-surface); font-size: .86rem; }
.dz-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dz-size { color: var(--cg-muted); font-size: .78rem; white-space: nowrap; }
.dz-file .btn-icon { width: 28px; height: 28px; font-size: .8rem; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; }

/* --- Rinnovi automatici --------------------------------------------------- */
.reminder-state { border-left: 4px solid var(--st); }
.reminder-state.state-off  { --st: #94a3b8; }
.reminder-state.state-test { --st: #f59e0b; }
.reminder-state.state-live { --st: #10b981; }
.state-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--st); box-shadow: 0 0 0 5px color-mix(in srgb, var(--st) 22%, transparent); flex-shrink: 0; }
.reminder-timeline { list-style: none; padding: 0; margin: 0; }
.reminder-timeline li { position: relative; display: flex; justify-content: space-between; gap: .75rem; padding: .35rem 0 .35rem 1.2rem; font-size: .88rem; }
.reminder-timeline li::before { content: ""; position: absolute; left: 0; top: .75rem; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--cg-primary)); }
.reminder-timeline li:not(:last-child)::after { content: ""; position: absolute; left: 3.5px; top: 1.25rem; bottom: -.4rem; width: 1px; background: var(--cg-border); }
.reminder-timeline li.tone-danger { --dot: #ef4444; }
.reminder-timeline li.tone-warning { --dot: #f59e0b; }
.reminder-timeline li.tone-primary, .reminder-timeline li.tone-danger, .reminder-timeline li.tone-warning { background: none; color: inherit; }

/* --- Testi email -------------------------------------------------------- */
.tpl-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; }
.tpl-nav-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--cg-muted); padding: .9rem .75rem .35rem; }
.tpl-nav-group:first-child { padding-top: 0; }
.tpl-nav a { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .75rem; border-radius: 9px; color: var(--cg-text); font-size: .9rem; }
.tpl-nav a:hover { background: var(--cg-surface-2); }
.tpl-nav a.active { background: var(--cg-primary-soft); color: var(--cg-primary); font-weight: 600; }
.tpl-editor { min-height: 180px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.55; }
.tpl-editor p { margin: 0 0 .8em; }
.tpl-vars { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.tpl-vars .dp-chip { font-family: ui-monospace, Consolas, monospace; font-size: .76rem; }
.tpl-preview { width: 100%; min-height: 420px; border: 0; display: block; border-radius: 0 0 14px 14px; background: #f3f4f6; }
@media (max-width: 767.98px) { .sender-form { width: 100%; } .sender-form input { flex: 1; width: auto !important; } }
.client-facts { display: grid; grid-template-columns: auto 1fr; gap: .2rem .75rem; }
.client-facts dt { font-weight: 500; color: var(--cg-muted); white-space: nowrap; }
.client-facts dt i { margin-right: .35rem; }
.client-facts dd { margin: 0; min-width: 0; }

/* --- Navigazione: torna a…, contesto cliente, riga ritrovata -------------- */
.back-link { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--cg-muted); margin-bottom: .35rem; }
.back-link:hover { color: var(--cg-primary); }
.back-link strong { font-weight: 600; color: var(--cg-text); }
.back-link:hover strong { color: var(--cg-primary); }
.client-context { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .75rem 1rem; margin-bottom: 1rem; border-radius: 14px; background: var(--cg-primary-soft); border: 1px solid rgba(var(--cg-primary-rgb), .25); }
@keyframes row-flash { 0%, 40% { background: rgba(var(--cg-primary-rgb), .18); } 100% { background: transparent; } }
tr.row-flash > td { animation: row-flash 2.2s ease-out; }
.client-orders { display: flex; flex-direction: column; }
.client-orders a { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 1rem; border-top: 1px solid var(--cg-border); color: var(--cg-text); }
.client-orders a:first-child { border-top: 0; }
.client-orders a:hover { background: var(--cg-surface-2); }
.client-orders a.is-current { background: var(--cg-primary-soft); box-shadow: inset 3px 0 0 var(--cg-primary); }
.btn-back-order { display: inline-flex; align-items: center; max-width: 100%; }
.btn-back-order .text-truncate { max-width: 260px; margin-left: .25rem; }

/* --- Ordini chiusi (fatturati / non rinnovati): meno visibili ------------- */
tr.row-closed > td { opacity: .45; transition: opacity .15s; }
tr.row-closed > td .pill { filter: grayscale(1); }
tr.row-closed:hover > td { opacity: .85; }
.client-orders a.is-closed:not(.is-current) { opacity: .45; }
.client-orders a.is-closed .pill { filter: grayscale(1); }
.client-orders a.is-closed:hover { opacity: .85; }

/* --- Elenco clienti --------------------------------------------------------- */
.client-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.client-chips .dp-chip { padding: .3rem .8rem; font-size: .84rem; }
.client-chips .dp-chip.active { background: var(--cg-primary); border-color: var(--cg-primary); color: #fff; }
.clients-table .avatar { width: 34px; height: 34px; }
.client-sub { display: flex; flex-wrap: wrap; gap: .1rem .9rem; }
.client-sub i { margin-right: .3rem; opacity: .7; }
.orders-count { display: inline-flex; align-items: center; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--cg-border); color: var(--cg-text); }
.orders-count:hover { border-color: var(--cg-primary); color: var(--cg-primary); }
tr.row-calm > td { opacity: .55; }
tr.row-calm:hover > td { opacity: 1; }

/* --- Timesheet: inserimento veloce ------------------------------------------ */
.new-entry { border: 1px solid rgba(var(--cg-primary-rgb), .3); background: color-mix(in srgb, var(--cg-primary-soft) 45%, var(--cg-surface)); border-radius: 14px; padding: 1rem; }
.new-entry.flash { animation: dp-in .25s ease-out; box-shadow: 0 0 0 3px rgba(var(--cg-primary-rgb), .25); }
.repeat-row { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .9rem; }
.repeat-chip { display: inline-flex; gap: .35rem; max-width: 100%; border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 999px; padding: .25rem .7rem; font-size: .8rem; color: var(--cg-text); min-width: 0; }
.repeat-chip .text-truncate { max-width: 200px; color: var(--cg-muted); }
.repeat-chip:hover { border-color: var(--cg-primary); color: var(--cg-primary); }
.combo { position: relative; }
.combo-icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--cg-muted); pointer-events: none; }
.combo .form-control { padding-left: 2.2rem; }
.combo-list { position: absolute; z-index: 1060; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .15); padding: .3rem; }
.combo-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .45rem .7rem; border-radius: 8px; color: var(--cg-text); font-size: .9rem; }
.combo-list button.sel, .combo-list button:hover { background: var(--cg-primary-soft); color: var(--cg-primary); }
.combo-sec { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--cg-muted); padding: .45rem .7rem .2rem; }
.combo-empty { padding: .6rem .7rem; color: var(--cg-muted); font-size: .88rem; }
.activity-pills label { font-size: .85rem; }
.duration-custom { width: auto; }
.duration-custom .form-select { width: 76px; }
.with-colleagues summary { cursor: pointer; font-size: .88rem; color: var(--cg-primary); font-weight: 500; }
.duration-control { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.dur-stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--cg-border); border-radius: 12px; background: var(--cg-surface); overflow: hidden; }
.dur-stepper button { border: 0; background: var(--cg-surface-2); width: 40px; color: var(--cg-text); font-size: 1rem; }
.dur-stepper button:hover { background: var(--cg-primary-soft); color: var(--cg-primary); }
.dur-input { width: 96px; border: 0; text-align: center; font-weight: 700; font-size: 1.1rem; padding: .45rem .25rem; background: transparent; color: var(--cg-text); font-variant-numeric: tabular-nums; }
.dur-input:focus { outline: none; background: var(--cg-primary-soft); }
.dur-input.is-invalid { background: rgba(239, 68, 68, .12); }
.duration-picker .dur-rest { border-style: dashed; }

/* --- Report ore -------------------------------------------------------------- */
.share-bar { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; }
.share-bar span { background: var(--c); min-width: 3px; }
[data-bs-theme="dark"] .share-bar span { background: var(--cd); }
.share-list { display: flex; flex-direction: column; gap: .45rem; }
.share-row { display: grid; grid-template-columns: 10px 1fr auto 3.2rem; gap: .6rem; align-items: center; font-size: .9rem; }
.share-row .dot { width: 10px; height: 10px; border-radius: 3px; }
.share-row .val { font-weight: 600; }
.share-row .pct { color: var(--cg-muted); text-align: right; font-size: .82rem; }

/* --- Progetti (nuova vista) ------------------------------------------------ */
.stage-group { background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 14px; margin-bottom: 1rem; overflow: hidden; }
.stage-group > summary { list-style: none; display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; cursor: pointer; user-select: none; }
.stage-group > summary::-webkit-details-marker { display: none; }
.stage-group > summary > .bi:first-child { font-size: 1.05rem; color: var(--st-color, var(--cg-muted)); }
.stage-group.tone-primary { --st-color: #2563eb; } .stage-group.tone-warning { --st-color: #d97706; } .stage-group.tone-success { --st-color: #059669; }
.stage-group[open] .stage-caret { transform: rotate(180deg); }
.stage-caret { transition: transform .15s; color: var(--cg-muted); }
.stage-count { font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--cg-surface-2); color: var(--cg-muted); }
.proj-list { border-top: 1px solid var(--cg-border); }
.proj-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 2fr) minmax(0, .9fr) minmax(0, .9fr); gap: 1rem; align-items: center; padding: .75rem 1rem; border-top: 1px solid var(--cg-border); cursor: pointer; }
.proj-row:first-child { border-top: 0; }
.proj-row:hover:not(.proj-head) { background: var(--cg-surface-2); }
.proj-row[hidden] { display: none; }
.proj-head { cursor: default; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--cg-muted); padding-top: .5rem; padding-bottom: .5rem; }
.proj-row-simple { grid-template-columns: 1fr auto; }
.proj-name { font-weight: 600; color: var(--cg-text); }
.proj-name:hover { color: var(--cg-primary); }
.tag-internal { font-size: .7rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: rgba(139, 92, 246, .12); color: #6d28d9; }
[data-bs-theme="dark"] .tag-internal { color: #c4b5fd; }
.progress-mini { height: 6px; border-radius: 99px; background: var(--cg-surface-2); overflow: hidden; }
.progress-mini span { display: block; height: 100%; background: var(--cg-primary); border-radius: 99px; }
.due { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; font-weight: 600; padding: .05rem .45rem; border-radius: 6px; white-space: nowrap; }
.due-danger { background: rgba(239, 68, 68, .12); color: #b91c1c; }
.due-warning { background: rgba(245, 158, 11, .15); color: #b45309; }
.due-secondary { background: var(--cg-surface-2); color: var(--cg-muted); }
.avatars { display: flex; }
.avatars .mini-avatar { margin-left: -6px; border: 2px solid var(--cg-surface); }
.avatars .mini-avatar:first-child { margin-left: 0; }
.doc-icons { display: flex; gap: .35rem; align-items: center; }
.doc-icons a { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--cg-border); display: grid; place-items: center; background: var(--cg-surface); }
.doc-icons a:hover { border-color: var(--cg-primary); }
@media (max-width: 991.98px) {
  .proj-head { display: none; }
  .proj-row { grid-template-columns: 1fr auto; row-gap: .5rem; }
  .proj-row > :nth-child(2), .proj-row > :nth-child(3) { grid-column: 1 / -1; }
}

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.person-card.is-empty { opacity: .6; }
.person-card .avatar { width: 36px; height: 36px; }
.person-tasks { display: flex; flex-direction: column; }
.person-task { display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; border-top: 1px solid var(--cg-border); color: var(--cg-text); }
.person-task:first-child { border-top: 0; }
.person-task:hover { background: var(--cg-surface-2); color: var(--cg-text); }

.task-list { display: flex; flex-direction: column; }
.task-item { display: flex; align-items: flex-start; gap: .75rem; padding: .7rem 1rem; border-top: 1px solid var(--cg-border); }
.task-list > .task-item:first-child { border-top: 0; }
.task-item:hover { background: var(--cg-surface-2); }
.task-item [data-open-task] { cursor: pointer; }
.task-item.is-doing { box-shadow: inset 3px 0 0 var(--cg-primary); }
.task-check { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; border-radius: 7px; border: 2px solid var(--cg-border); background: var(--cg-surface); display: grid; place-items: center; color: transparent; font-size: .8rem; padding: 0; }
.task-check:hover:not(.locked) { border-color: #10b981; color: #10b981; }
.task-check.checked { background: #10b981; border-color: #10b981; color: #fff; }
.task-check.locked { color: var(--cg-muted); font-size: .7rem; }
.task-title { font-weight: 500; }
.task-item.is-done .task-title { text-decoration: line-through; color: var(--cg-muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; font-size: .8rem; color: var(--cg-muted); margin-top: .2rem; }
.task-desc { max-width: 100%; }
.task-start { flex-shrink: 0; }
.stage-select { width: auto; font-weight: 600; }
.quick-task { border-color: rgba(var(--cg-primary-rgb), .3); }
.done-group > summary { list-style: none; cursor: pointer; }
.done-group > summary::-webkit-details-marker { display: none; }

.doc-list { display: flex; flex-direction: column; }
.doc-item { display: flex; align-items: center; border-top: 1px solid var(--cg-border); }
.doc-item:first-child { border-top: 0; }
.doc-item form { margin: 0 .4rem 0 0; }
.doc-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: .7rem; padding: .65rem 1rem; color: var(--cg-text); }
.doc-link:hover { background: var(--cg-surface-2); color: var(--cg-text); }
.doc-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--cg-surface-2); display: grid; place-items: center; font-size: 1.05rem; flex-shrink: 0; }
.type-chip { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 10px; padding: .45rem .8rem; font-size: .88rem; color: var(--cg-text); }
.type-chip.active { border-color: var(--cg-primary); background: var(--cg-primary-soft); font-weight: 600; }

/* --- Progetti: bacheca --------------------------------------------------------- */
.board2 .kb-board { gap: .9rem; }
.board2 .kb-col { background: var(--cg-surface-2); border: 1px solid var(--cg-border); border-radius: 14px; flex: 1 0 220px; min-width: 215px; max-height: calc(100vh - 230px); }
.task-board .kb-col { flex-basis: 260px; min-width: 240px; }
.board2 .kb-col.drag-over { box-shadow: 0 0 0 2px var(--st-color, var(--cg-primary)) inset; background: var(--cg-primary-soft); }
.b2-col.tone-primary { --st-color: #2563eb; } .b2-col.tone-warning { --st-color: #d97706; } .b2-col.tone-success { --st-color: #059669; } .b2-col.tone-secondary { --st-color: #64748b; }
.b2-head { display: flex; align-items: center; gap: .5rem; padding: .75rem .9rem .55rem; border-top: 3px solid var(--st-color); border-radius: 14px 14px 0 0; }
.b2-head > .bi { color: var(--st-color); }
.b2-title { font-weight: 700; font-size: .88rem; }
.b2-head .stage-count { margin-left: auto; background: var(--cg-surface); }
.board2 .kb-body { padding: .35rem .6rem .6rem; }
.b2-card { position: relative; border-radius: 12px; padding: .7rem .8rem; margin-bottom: .5rem; }
.b2-card:hover { border-color: rgba(var(--cg-primary-rgb), .45); }
.b2-name { font-weight: 600; line-height: 1.3; padding-right: 1.4rem; }
.b2-task .b2-name { padding-right: 0; }
.b2-sub { display: flex; align-items: center; gap: .45rem; font-size: .78rem; color: var(--cg-muted); margin-top: .2rem; min-width: 0; }
.b2-desc { font-size: .78rem; color: var(--cg-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: .2rem; }
.b2-next { display: flex; align-items: center; gap: .4rem; font-size: .82rem; margin-top: .5rem; min-width: 0; }
.b2-foot { display: flex; align-items: center; gap: .4rem; margin-top: .55rem; min-width: 0; }
.b2-doc { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--cg-border); display: grid; place-items: center; font-size: .78rem; background: var(--cg-surface); }
.b2-doc:hover { border-color: var(--cg-primary); }
.b2-edit { position: absolute; top: .45rem; right: .45rem; border: 0; background: transparent; width: 26px; height: 26px; border-radius: 7px; color: var(--cg-muted); opacity: 0; transition: opacity .12s; }
.b2-card:hover .b2-edit { opacity: 1; }
.b2-edit:hover { background: var(--cg-surface-2); color: var(--cg-text); }
.b2-empty { display: none; border: 1.5px dashed var(--cg-border); border-radius: 10px; padding: 1rem .5rem; text-align: center; font-size: .8rem; color: var(--cg-muted); }
.kb-body:not(:has(.kb-card:not(.d-none))) .b2-empty { display: block; }
.b2-add { border: 0; background: transparent; color: var(--cg-muted); font-size: .84rem; padding: .55rem .9rem .75rem; text-align: left; border-radius: 0 0 14px 14px; }
.b2-add:hover { color: var(--cg-primary); background: var(--cg-primary-soft); }
.b2-task.is-done .b2-name { text-decoration: line-through; color: var(--cg-muted); }
.b2-task [data-open-task] { cursor: pointer; }
.board2 .kb-card[draggable="true"] { cursor: grab; }
@media (hover: none) { .b2-edit { opacity: 1; } }

/* Progetti: ricerca trovata dentro un task */
.search-hit { margin-top: .35rem; font-size: .78rem; color: var(--bs-body-color); background: rgba(var(--bs-warning-rgb), .14); border-radius: 6px; padding: .15rem .45rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-hit[hidden] { display: none; }
.search-hit .bi { color: var(--bs-warning-text-emphasis); margin-right: .15rem; }

/* Progetti: bacheca v3 (pulita) */
.b3-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.b3-search { position: relative; flex: 0 1 300px; }
.b3-search .bi { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--cg-muted); pointer-events: none; }
.b3-search .form-control { padding-left: 2.1rem; }
.b3-toolbar .form-select { width: auto; max-width: 240px; }
.board3 .kb-col { max-height: none; background: transparent; border: 0; border-radius: 0; }
.board3 .kb-body { overflow: visible; padding: .25rem 0 0; min-height: 120px; border-radius: 12px; transition: background .15s; }
.board3 .kb-col.drag-over { box-shadow: none; background: transparent; }
.board3 .kb-col.drag-over .kb-body { background: var(--cg-primary-soft); outline: 2px dashed var(--st-color); outline-offset: -2px; }
.b3-head { padding: 0 .15rem .55rem; border-bottom: 2px solid var(--st-color); margin-bottom: .5rem; }
.b3-head-top { display: flex; align-items: center; gap: .5rem; }
.b3-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-color); flex: none; }
.b3-count { margin-left: auto; font-size: .78rem; font-weight: 600; color: var(--cg-muted); }
.b3-sub { font-size: .76rem; color: var(--cg-muted); margin-left: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b3-card { padding: .7rem .8rem .8rem; margin-bottom: .55rem; overflow: hidden; }
.b3-card:hover { border-color: rgba(var(--cg-primary-rgb), .45); }
.b3-name { font-weight: 600; line-height: 1.3; }
.b3-meta { display: flex; gap: .5rem; font-size: .78rem; color: var(--cg-muted); margin-top: .15rem; min-width: 0; }
.b3-next { display: flex; align-items: center; gap: .45rem; font-size: .82rem; margin-top: .55rem; min-width: 0; }
.b3-next .mini-avatar { width: 20px; height: 20px; font-size: .6rem; border: 0; margin: 0; flex: none; }
.b3-next .due { flex: none; margin-left: auto; }
.b3-nobody { background: var(--cg-surface-2) !important; color: var(--cg-muted) !important; }
.b3-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--cg-surface-2); }
.b3-progress span { display: block; height: 100%; background: var(--st-color, var(--cg-primary)); }
.board3 .b2-empty { border: 0; padding: .75rem 0; text-align: left; }
.board3 .kb-col.drag-over .b2-empty { display: none; }

/* Home admin */
.auto-status { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--cg-muted); border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 999px; padding: .35rem .8rem; text-decoration: none; }
.auto-status:hover { border-color: var(--cg-primary); color: var(--cg-text); }
.auto-status strong { color: var(--cg-text); }
.auto-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.auto-status.is-on .dot { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.auto-status.is-test .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
.auto-status.is-off .dot { background: #ef4444; }
.action-list { display: flex; flex-direction: column; }
.action-item { display: flex; align-items: center; gap: .85rem; padding: .7rem 1.1rem; color: inherit; text-decoration: none; border-top: 1px solid var(--cg-border); transition: background .12s; }
.action-item:first-child { border-top: 0; }
.action-item:hover { background: var(--cg-surface-2); color: inherit; }
.action-item .kpi-icon { width: 38px; height: 38px; font-size: 1.05rem; border-radius: 10px; }
.action-num { font-size: 1.35rem; font-weight: 700; min-width: 2ch; text-align: right; }
.team-week { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; }
.tw-row { display: grid; grid-template-columns: minmax(90px, 1.4fr) repeat(5, minmax(30px, 1fr)) 52px; gap: .35rem; align-items: center; }
.tw-head { font-size: .72rem; color: var(--cg-muted); text-transform: uppercase; letter-spacing: .03em; }
.tw-head span { text-align: center; }
.tw-head .is-today { color: var(--cg-primary); font-weight: 700; }
.tw-cell { height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--cg-surface-2); color: var(--cg-muted); }
.tw-cell.is-full { background: rgba(16, 185, 129, .16); color: #047857; }
.tw-cell.is-part { background: rgba(245, 158, 11, .16); color: #b45309; }
.tw-cell.is-missing { background: rgba(239, 68, 68, .1); color: #dc2626; }
[data-bs-theme="dark"] .tw-cell.is-full { color: #34d399; }
[data-bs-theme="dark"] .tw-cell.is-part { color: #fbbf24; }
[data-bs-theme="dark"] .tw-cell.is-missing { color: #f87171; }
.tw-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.tw-key.is-full { background: rgba(16, 185, 129, .5); } .tw-key.is-part { background: rgba(245, 158, 11, .5); } .tw-key.is-missing { background: rgba(239, 68, 68, .4); }
.load-row { display: grid; grid-template-columns: 90px 1fr 130px; gap: .75rem; align-items: center; padding: .3rem 0; font-size: .88rem; }
.load-bar { height: 8px; border-radius: 4px; background: var(--cg-surface-2); overflow: hidden; }
.load-bar span { display: block; height: 100%; border-radius: 4px; background: var(--cg-primary); }
.stage-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; border-top: 1px solid var(--cg-border); padding-top: .9rem; }
.stage-pill { display: flex; flex-direction: column; align-items: center; padding: .4rem .2rem; border-radius: 10px; color: inherit; text-decoration: none; font-size: .72rem; color: var(--cg-muted); text-align: center; }
.stage-pill strong { font-size: 1.1rem; color: var(--cg-text); }
.stage-pill:hover { background: var(--cg-surface-2); }
@media (max-width: 575.98px) { .tw-row { grid-template-columns: minmax(70px, 1fr) repeat(5, 1fr) 44px; gap: .25rem; } }

/* Menu Esporta */
.export-menu .dropdown-menu { min-width: 300px; padding: .35rem; }
.export-item { display: flex; gap: .7rem; align-items: flex-start; white-space: normal; border-radius: 8px; padding: .55rem .7rem; }
.export-item > .bi { font-size: 1.1rem; color: var(--cg-primary); margin-top: .1rem; }
.export-item strong { display: block; font-weight: 600; font-size: .88rem; }
.export-item small { display: block; color: var(--cg-muted); font-size: .76rem; line-height: 1.3; }

/* Menu laterale riducibile (solo icone) */
.sidebar { transition: width .18s ease; }
.sidebar-footer { display: flex; flex-direction: column; gap: .5rem; }
.sidebar-collapse { align-items: center; gap: .75rem; width: 100%; border: 0; background: transparent; color: var(--cg-sidebar-muted); padding: .55rem .75rem; border-radius: 10px; font-size: .85rem; font-weight: 500; }
.sidebar-collapse:hover { background: var(--cg-sidebar-active); color: #fff; }
.sidebar-collapse .bi { font-size: 1rem; transition: transform .18s; }
@media (min-width: 992px) {
  [data-sidebar="collapsed"] .sidebar { width: 76px; }
  [data-sidebar="collapsed"] .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  [data-sidebar="collapsed"] .brand-text,
  [data-sidebar="collapsed"] .nav-link-item > span:not(.nav-badge),
  [data-sidebar="collapsed"] .sidebar-collapse span,
  [data-sidebar="collapsed"] .env-badge span { display: none; }
  [data-sidebar="collapsed"] .sidebar-nav { padding: .5rem .6rem; }
  [data-sidebar="collapsed"] .nav-link-item { justify-content: center; position: relative; padding: .65rem 0; }
  [data-sidebar="collapsed"] .nav-link-item i { font-size: 1.2rem; }
  [data-sidebar="collapsed"] .nav-badge { position: absolute; top: 3px; right: 6px; margin: 0; min-width: 18px; height: 18px; font-size: .65rem; padding: 0 4px; }
  [data-sidebar="collapsed"] .sidebar-footer { padding: 1rem .6rem; }
  [data-sidebar="collapsed"] .sidebar-collapse { justify-content: center; padding: .55rem 0; }
  [data-sidebar="collapsed"] .sidebar-collapse .bi { transform: rotate(180deg); }
}

/* Home di chi lavora */
.hole-alert { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-radius: 12px; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35); font-size: .9rem; }
.hole-alert > .bi { color: #d97706; font-size: 1.1rem; }
.hole-alert a:not(.btn) { font-weight: 600; }
.work-group + .work-group { border-top: 1px solid var(--cg-border); }
.work-head { display: flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .8rem 1rem .3rem; }
.work-group .task-item { align-items: center; border-top: 0; }
.work-group .task-item.is-done { opacity: .45; }
.work-group .task-item.is-done .fw-semibold { text-decoration: line-through; }
.work-more { display: block; padding: .5rem 1rem .8rem 3.2rem; font-size: .85rem; }
.my-week { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.mw-day { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .5rem .25rem; border-radius: 12px; color: inherit; text-decoration: none; }
.mw-day:hover { background: var(--cg-surface-2); color: inherit; }
.mw-bar { width: 100%; max-width: 34px; height: 64px; border-radius: 8px; background: var(--cg-surface-2); display: flex; align-items: flex-end; overflow: hidden; }
.mw-bar span { display: block; width: 100%; background: var(--cg-primary); border-radius: 8px 8px 0 0; }
.mw-day strong { font-size: .9rem; min-height: 1.2em; }
.mw-day small { font-size: .72rem; color: var(--cg-muted); }
.mw-day.is-today small { color: var(--cg-primary); font-weight: 700; }
.mw-day.is-hole .mw-bar { background: rgba(239, 68, 68, .12); }
.mw-day.is-hole strong { color: #dc2626; }
.mw-day.is-future { opacity: .5; }
.recent-hours { border-top: 1px solid var(--cg-border); padding: .75rem 0 .5rem; }
.rh-row { display: flex; align-items: center; gap: .75rem; padding: .35rem 1rem; font-size: .85rem; }
.home-side-wide { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 1200px) { .home-side-wide { grid-template-columns: 1.4fr 1fr; } }

/* Nuovo task / finestra task */
.quick-task { padding: 0; overflow: visible; }
.qt-main { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem .7rem 1rem; }
.qt-plus { color: var(--cg-primary); font-size: 1.15rem; }
.qt-title { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1rem; font-weight: 500; color: var(--cg-text); padding: .3rem 0; }
.qt-title::placeholder { color: var(--cg-muted); font-weight: 400; }
.qt-options { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; padding: .6rem 1rem .75rem; border-top: 1px solid var(--cg-border); background: var(--cg-surface-2); border-radius: 0 0 var(--cg-radius) var(--cg-radius); }
.qt-opt { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.qt-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--cg-muted); }
.qt-date { width: 140px; }
.qt-more { border: 0; background: transparent; color: var(--cg-primary); font-size: .82rem; font-weight: 500; padding: .25rem 0; margin-left: auto; }
.qt-more:hover { text-decoration: underline; }

.people-pick { display: flex; flex-wrap: wrap; gap: .3rem; }
.pp-item { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem .2rem .2rem; border-radius: 999px; border: 1px solid var(--cg-border); background: var(--cg-surface); cursor: pointer; font-size: .82rem; transition: border-color .12s, background .12s; user-select: none; }
.pp-item input { position: absolute; opacity: 0; pointer-events: none; }
.pp-item .mini-avatar { width: 24px; height: 24px; font-size: .62rem; border: 0; margin: 0; }
.pp-item:hover { border-color: rgba(var(--cg-primary-rgb), .5); }
.pp-item:has(input:checked) { border-color: var(--cg-primary); background: var(--cg-primary-soft); font-weight: 600; box-shadow: 0 0 0 1px var(--cg-primary) inset; }
.pp-item:has(input:focus-visible) { outline: 2px solid var(--cg-primary); outline-offset: 2px; }
.pp-item.is-inactive:not(:has(input:checked)) { display: none; }

.due-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.due-chips button { border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 999px; padding: .28rem .7rem; font-size: .8rem; color: var(--cg-text); }
.due-chips button:hover { border-color: rgba(var(--cg-primary-rgb), .5); }
.due-chips button.active { border-color: var(--cg-primary); background: var(--cg-primary-soft); color: var(--cg-primary); font-weight: 600; }

.task-title-input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 1.35rem; font-weight: 700; color: var(--cg-text); padding: .1rem 0 .6rem; }
.task-title-input::placeholder { color: var(--cg-muted); font-weight: 500; }
.task-props { display: flex; flex-direction: column; gap: .15rem; border-top: 1px solid var(--cg-border); border-bottom: 1px solid var(--cg-border); padding: .5rem 0; }
.tp-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: .75rem; padding: .35rem 0; }
.tp-label { font-size: .84rem; color: var(--cg-muted); display: flex; align-items: center; gap: .45rem; }
.status-pick { display: inline-flex; background: var(--cg-surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.status-pick label { cursor: pointer; }
.status-pick input { position: absolute; opacity: 0; pointer-events: none; }
.status-pick span { display: block; padding: .3rem .8rem; border-radius: 8px; font-size: .84rem; font-weight: 500; color: var(--cg-muted); }
.status-pick label:has(input:checked) span { background: var(--cg-surface); color: var(--cg-text); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.status-pick .sp-todo:has(input:checked) span { color: #b45309; }
.status-pick .sp-doing:has(input:checked) span { color: #1d4ed8; }
.status-pick .sp-done:has(input:checked) span { color: #047857; }
.task-extra summary { cursor: pointer; font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .45rem; list-style: none; }
.task-extra summary::-webkit-details-marker { display: none; }
.task-extra summary::after { content: '\F282'; font-family: bootstrap-icons; margin-left: auto; font-size: .8rem; color: var(--cg-muted); transition: transform .15s; }
.task-extra[open] summary::after { transform: rotate(180deg); }
.task-extra :disabled + * { opacity: .6; }

@media (max-width: 575.98px) {
  .qt-options { gap: .6rem; }
  .qt-opt { width: 100%; }
  .qt-opt .people-pick, .qt-opt .due-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding-bottom: 2px; }
  .qt-more { margin-left: 0; }
  .tp-row { grid-template-columns: 1fr; gap: .35rem; }
  .task-title-input { font-size: 1.2rem; }
  .pp-item, .due-chips button { padding-top: .4rem; padding-bottom: .4rem; }
  .pp-item { padding-left: .25rem; }
}
.stage-pick { display: flex; flex-wrap: wrap; gap: .3rem; }
.stage-pick label { cursor: pointer; }
.stage-pick input { position: absolute; opacity: 0; pointer-events: none; }
.stage-pick span { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 999px; padding: .28rem .7rem; font-size: .8rem; }
.stage-pick span .bi { color: var(--st-color); }
.stage-pick .tone-primary { --st-color: #2563eb; } .stage-pick .tone-warning { --st-color: #d97706; } .stage-pick .tone-success { --st-color: #059669; } .stage-pick .tone-secondary { --st-color: #64748b; }
.stage-pick label:has(input:checked) span { border-color: var(--st-color); box-shadow: 0 0 0 1px var(--st-color) inset; font-weight: 600; }
@media (max-width: 575.98px) { .stage-pick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .stage-pick span { white-space: nowrap; padding: .4rem .75rem; } }
.due-chips button, .pp-item { white-space: nowrap; flex-shrink: 0; }

/* ================= Telefono ================= */
.filter-toggle { display: none; }
@media (max-width: 767.98px) {
  .filter-toggle { display: block; }
  form.filter-bar:not(.is-open) { display: none; }

  /* tabelle → schede */
  .table-responsive:has(> .table-stack) { overflow: visible; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .8rem 1rem; border-bottom: 1px solid var(--cg-border); position: relative; }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack > tbody > tr > td { border: 0 !important; padding: .2rem 0 !important; display: flex; align-items: center; justify-content: space-between; gap: 1rem; text-align: right !important; background: transparent !important; box-shadow: none !important; min-height: 0; }
  .table-stack > tbody > tr > td::before { content: attr(data-label); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--cg-muted); text-align: left; flex-shrink: 0; }
  .table-stack > tbody > tr > td:first-child { display: block; text-align: left !important; padding-bottom: .35rem !important; }
  .table-stack > tbody > tr > td:first-child::before,
  .table-stack > tbody > tr > td[data-label=""]::before { display: none; }
  .table-stack > tbody > tr > td[data-label=""] { justify-content: flex-end; }
  .table-stack > tbody > tr > td:empty { display: none; }
  .table-stack > tbody > tr > td > * { max-width: 100%; }
  .table-stack > tbody > tr > td:first-child .text-truncate { white-space: normal; }
  /* righe colorate (scaduto / in scadenza): la striscia resta a sinistra della scheda */
  .table-stack tr[class*="row-"] { box-shadow: inset 4px 0 0 var(--row-accent, transparent); }
  .table-stack tr.row-expired { --row-accent: #ef4444; }
  .table-stack tr.row-soon { --row-accent: #f59e0b; }
  .table-stack tfoot { display: block; }
}
@media (max-width: 767.98px) { .table-stack > tbody > tr > td.td-empty { display: none; } }
@media (max-width: 767.98px) {
  .table-stack > tbody > tr > td.actions-col { width: 100% !important; padding-top: .6rem !important; }
  .table-stack > tbody > tr > td.actions-col::before { display: none; }
  .table-stack .row-actions { flex-direction: row; width: 100%; }
  .table-stack .row-actions > * { flex: 1; }
}
@media (max-width: 767.98px) {
  .input-group[style*="max-width"], .b3-search, .b3-toolbar .form-select, #projScope { max-width: none !important; flex: 1 1 100% !important; width: 100% !important; }
  .page-header .d-flex > .btn, .page-header .d-flex > .dropdown { flex: 0 0 auto; }
}

/* Pulsante riduci/allarga menu, nella fascia scura in alto a destra */
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding-right: .75rem; min-height: 74px; }
.sidebar-top .sidebar-brand { min-width: 0; }
.sidebar-collapse-btn { width: 32px; height: 32px; place-items: center; flex-shrink: 0; border: 0; border-radius: 8px; background: transparent; color: var(--cg-sidebar-muted); font-size: .95rem; transition: background .15s, color .15s; }
.sidebar-collapse-btn:hover { background: var(--cg-sidebar-active); color: #fff; }
.sidebar-collapse-btn .bi { transition: transform .18s; }
@media (min-width: 992px) {
  /* ridotto: il pulsante prende il posto del logo, alla stessa altezza */
  [data-sidebar="collapsed"] .sidebar-top { justify-content: center; padding: 0; }
  [data-sidebar="collapsed"] .sidebar-top .sidebar-brand { display: none; }
  [data-sidebar="collapsed"] .sidebar-collapse-btn { width: 38px; height: 38px; font-size: 1.05rem; }
  [data-sidebar="collapsed"] .sidebar-collapse-btn .bi { transform: rotate(180deg); }
}

/* ================= Mail ↔ cliente ================= */
.nav-link-warn:not(.active) { color: #b45309; }
.chip-assign, .chip-suggest, .chip-client { cursor: pointer; border: 1px dashed var(--cg-border); background: var(--cg-surface); }
.chip-assign { color: var(--cg-primary); border-color: rgba(var(--cg-primary-rgb), .45); }
.chip-assign:hover { background: var(--cg-primary-soft); }
.chip-suggest { color: #7c3aed; border-color: rgba(124, 58, 237, .4); border-style: solid; background: rgba(124, 58, 237, .06); }
.chip-suggest:hover { background: rgba(124, 58, 237, .12); }
.chip-client { border-style: solid; }
.chip-client:hover { border-color: var(--cg-primary); }
.chip-new { animation: chipIn .5s ease; border-color: #10b981; }
@keyframes chipIn { from { background: rgba(16, 185, 129, .25); } to { background: var(--cg-surface); } }
.thread-row { cursor: pointer; }

.assign-from { display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border-radius: 12px; background: var(--cg-surface-2); }
.suggest-chip { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid rgba(124, 58, 237, .4); background: rgba(124, 58, 237, .06); color: #6d28d9; border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; font-weight: 500; }
.suggest-chip:hover { background: rgba(124, 58, 237, .14); }
[data-bs-theme="dark"] .suggest-chip, [data-bs-theme="dark"] .chip-suggest { color: #c4b5fd; }
.suggest-row { display: flex; align-items: center; gap: .5rem; width: 100%; border: 1px solid var(--cg-border); background: var(--cg-surface); border-radius: 10px; padding: .45rem .7rem; font-size: .88rem; color: var(--cg-text); }
.suggest-row:hover { border-color: #7c3aed; background: rgba(124, 58, 237, .06); }
.suggest-row .bi { color: #7c3aed; }
.suggest-row small { color: var(--cg-muted); font-size: .72rem; white-space: nowrap; }
.remember-opt { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; border-radius: 10px; cursor: pointer; }
.remember-opt:hover { background: var(--cg-surface-2); }
.remember-opt input { margin-top: .3rem; }
.remember-opt strong { display: block; font-size: .88rem; font-weight: 600; }
.remember-opt small { display: block; font-size: .78rem; color: var(--cg-muted); }
.remember-opt:has(input:checked) { background: var(--cg-primary-soft); }

.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { display: flex; align-items: center; gap: .55rem; padding: .35rem 0; border-bottom: 1px solid var(--cg-border); font-size: .88rem; min-width: 0; }
.contact-list li:last-child { border-bottom: 0; }
.contact-list li > .bi { color: var(--cg-muted); }
.contact-list small { color: var(--cg-muted); font-size: .74rem; white-space: nowrap; }
.contact-list form { margin: 0; }

.chat { max-height: 620px; overflow-y: auto; padding: 1rem 1rem .5rem; background: var(--cg-surface-2); display: flex; flex-direction: column; gap: .45rem; }
.chat-day { text-align: center; margin: .5rem 0 .25rem; }
.chat-day span { font-size: .72rem; font-weight: 600; color: var(--cg-muted); background: var(--cg-surface); border: 1px solid var(--cg-border); border-radius: 999px; padding: .15rem .7rem; }
.chat-thread { align-self: center; max-width: 90%; font-size: .78rem; color: var(--cg-muted); display: inline-flex; gap: .35rem; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: .15rem 0; }
.chat-thread:hover { color: var(--cg-primary); }
.chat-msg { display: flex; }
.chat-msg.is-out { justify-content: flex-end; }
.chat-bubble { max-width: min(78%, 560px); padding: .55rem .8rem .6rem; border-radius: 14px; background: var(--cg-surface); border: 1px solid var(--cg-border); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.chat-msg.is-in .chat-bubble { border-top-left-radius: 4px; }
.chat-msg.is-out .chat-bubble { background: #e0edff; border-color: #c7dcff; border-top-right-radius: 4px; }
[data-bs-theme="dark"] .chat-msg.is-out .chat-bubble { background: #1e3a5f; border-color: #28507f; }
.chat-meta { display: flex; justify-content: space-between; gap: 1rem; font-size: .74rem; color: var(--cg-muted); margin-bottom: .2rem; }
.chat-meta strong { color: var(--cg-text); font-weight: 600; }
.chat-text { font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.chat-more { display: inline-block; font-size: .76rem; margin-top: .35rem; }
@media (max-width: 575.98px) { .chat { max-height: 70vh; padding: .75rem .5rem; } .chat-bubble { max-width: 88%; } }

/* ================= Anagrafiche: rapporto e profilo ================= */
.rt-primary { --rt: #2563eb; --rt-bg: rgba(37, 99, 235, .1); }
.rt-warning { --rt: #b45309; --rt-bg: rgba(245, 158, 11, .14); }
.rt-violet { --rt: #7c3aed; --rt-bg: rgba(124, 58, 237, .1); }
.rt-secondary { --rt: #475569; --rt-bg: rgba(100, 116, 139, .12); }
[data-bs-theme="dark"] .rt-primary { --rt: #60a5fa; } [data-bs-theme="dark"] .rt-warning { --rt: #fbbf24; }
[data-bs-theme="dark"] .rt-violet { --rt: #c4b5fd; } [data-bs-theme="dark"] .rt-secondary { --rt: #94a3b8; }

.rel-tabs { display: flex; gap: .35rem; flex-wrap: wrap; border-bottom: 1px solid var(--cg-border); }
.rel-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--cg-muted); font-weight: 500; text-decoration: none; }
.rel-tab:hover { color: var(--cg-text); }
.rel-tab .bi { color: var(--rt); }
.rel-tab.active { color: var(--cg-text); font-weight: 600; border-bottom-color: var(--rt); }
.rel-count { font-size: .75rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: var(--cg-surface-2); color: var(--cg-muted); }
.rel-tab.active .rel-count { background: var(--rt-bg); color: var(--rt); }

.rel-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; background: var(--rt-bg); color: var(--rt); white-space: nowrap; vertical-align: middle; }
h1 .rel-badge { font-size: .78rem; }
.profile-cell { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; font-size: .8rem; }
.prof-item { display: inline-flex; gap: .3rem; align-items: center; color: var(--cg-text); white-space: nowrap; }
.prof-item .bi { color: var(--cg-muted); }
.prof-missing { font-size: .72rem; color: #b45309; border: 1px dashed rgba(245, 158, 11, .6); border-radius: 999px; padding: .05rem .5rem; white-space: nowrap; }
.chip-profile.active { background: rgba(245, 158, 11, .15); border-color: #f59e0b; color: #92400e; }
.profile-filter { width: auto; max-width: 190px; }

.rel-pick { display: flex; flex-wrap: wrap; gap: .4rem; }
.rel-pick label { cursor: pointer; }
.rel-pick input { position: absolute; opacity: 0; pointer-events: none; }
.rel-pick span { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--cg-border); font-size: .85rem; background: var(--cg-surface); }
.rel-pick span .bi { color: var(--rt); }
.rel-pick label:has(input:checked) span { background: var(--rt-bg); border-color: var(--rt); color: var(--rt); font-weight: 600; box-shadow: 0 0 0 1px var(--rt) inset; }
.rel-pick label:has(input:focus-visible) span { outline: 2px solid var(--rt); outline-offset: 2px; }

.client-history { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--cg-border); display: flex; flex-direction: column; gap: .35rem; font-size: .78rem; }
.client-history > div { display: flex; gap: .4rem; }
.client-history .bi { color: var(--cg-muted); margin-top: .1rem; }

tr.row-selected > td { background: var(--cg-primary-soft) !important; }
.bulk-bar { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 1030; display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-radius: 14px; background: var(--cg-surface); border: 1px solid var(--cg-border); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); max-width: calc(100vw - 2rem); }
.bulk-bar[hidden] { display: none; }
.bulk-bar .form-select { width: auto; max-width: 170px; }
@media (max-width: 767.98px) {
  .bulk-bar { flex-wrap: wrap; left: .75rem; right: .75rem; transform: none; bottom: .75rem; }
  .bulk-bar .form-select { flex: 1 1 45%; max-width: none; }
  .profile-filter { max-width: none; flex: 1 1 45%; }
}

.list-edit { display: flex; flex-direction: column; gap: .4rem; }
.list-edit-row { display: flex; align-items: center; gap: .5rem; }
.list-edit-row.is-off input[name=name] { color: var(--cg-muted); text-decoration: line-through; }

/* ================= Asset dei clienti ================= */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
.asset-grid-narrow { grid-template-columns: 1fr; }
.asset-card { border: 1px solid var(--cg-border); border-radius: 12px; padding: .8rem .9rem; background: var(--cg-surface); display: flex; flex-direction: column; gap: .55rem; min-width: 0; }
.asset-card:hover { border-color: rgba(var(--cg-primary-rgb), .35); }
.asset-card.is-retired { opacity: .55; }
.asset-head { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.asset-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--cg-primary-soft); color: var(--cg-primary); font-size: 1.05rem; }
.asset-name { font-weight: 600; line-height: 1.25; }
.asset-sub { font-size: .76rem; color: var(--cg-muted); display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.asset-summary { font-size: .84rem; color: var(--cg-text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.asset-links { display: flex; flex-wrap: wrap; gap: .35rem; }
.asset-links .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta { display: flex; flex-direction: column; gap: .25rem; font-size: .77rem; color: var(--cg-muted); border-top: 1px solid var(--cg-border); padding-top: .5rem; }
.asset-meta > * { display: flex; align-items: center; gap: .35rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta a { color: inherit; }
.asset-meta a:hover { color: var(--cg-primary); }
.asset-group { margin-bottom: 1.5rem; }
.asset-group-head { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; margin-bottom: .6rem; color: var(--cg-text); }
.asset-group-head:hover { color: var(--cg-primary); }
@media (max-width: 575.98px) { .asset-grid { grid-template-columns: 1fr; } }

/* ================= Appunti ================= */
.note-btn { border-radius: 999px; padding: .3rem .8rem; font-weight: 500; }
.note-kinds { display: flex; gap: .4rem; flex-wrap: wrap; }
.note-kinds label { cursor: pointer; }
.note-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.note-kinds span { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--cg-border); font-size: .88rem; background: var(--cg-surface); }
.note-kinds span .bi { color: var(--nk); }
.note-kinds label:has(input:checked) span { border-color: var(--nk); box-shadow: 0 0 0 1px var(--nk) inset; font-weight: 600; background: color-mix(in srgb, var(--nk) 10%, var(--cg-surface)); }
.note-body { font-size: 1rem; resize: vertical; }
.disabled-opt { opacity: .45; pointer-events: none; }

.note-list { display: flex; flex-direction: column; }
.note-list-scroll { max-height: 520px; overflow-y: auto; }
.note-item { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem 1rem; border-top: 1px solid var(--cg-border); }
.note-list > .note-item:first-child { border-top: 0; }
.note-item:hover { background: var(--cg-surface-2); }
.note-item.is-pinned { background: color-mix(in srgb, var(--cg-primary) 5%, var(--cg-surface)); }
.note-item.is-done .note-text strong { text-decoration: line-through; color: var(--cg-muted); }
.note-item.is-done .note-rest { opacity: .6; }
.note-kind { width: 24px; height: 24px; flex-shrink: 0; border-radius: 7px; display: grid; place-items: center; font-size: .82rem; color: var(--nk); background: color-mix(in srgb, var(--nk) 13%, transparent); margin-top: 1px; }
.note-item .task-check { margin-top: 1px; }
.note-main { flex: 1; min-width: 0; }
.note-text { font-size: .9rem; overflow-wrap: anywhere; }
.note-text strong { font-weight: 600; }
.note-rest { color: var(--cg-text); font-size: .86rem; margin-top: .15rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; font-size: .76rem; color: var(--cg-muted); margin-top: .3rem; }
.note-meta > * { display: inline-flex; align-items: center; gap: .25rem; }
.note-client { color: var(--cg-text); font-weight: 500; }
a.note-client:hover { color: var(--cg-primary); }
.note-for { color: #b45309; font-weight: 600; }
.note-for.is-me { color: var(--cg-primary); }
.note-task { color: var(--cg-primary); }
.note-actions > .btn { opacity: .5; }
.note-item:hover .note-actions > .btn, .note-actions.show > .btn { opacity: 1; }
.note-day { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--cg-muted); margin: 0 0 .4rem .2rem; }
@media (hover: none) { .note-actions > .btn { opacity: 1; } }

/* ================= Il punto (riepilogo serale) ================= */
.nav-dot { margin-left: auto; width: 9px; height: 9px; border-radius: 50%; background: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, .25); }
[data-sidebar="collapsed"] .nav-dot { position: absolute; top: 8px; right: 14px; margin: 0; }
.briefing-top { background: var(--cg-primary-soft); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1.1rem; }
.briefing-top ol { padding-left: 1.2rem; font-weight: 600; }
.briefing-top li + li { margin-top: .2rem; }
.md-body { font-size: .95rem; line-height: 1.6; overflow-wrap: anywhere; }
.md-body h2, .md-body h3, .md-body h4 { font-size: 1.02rem; font-weight: 700; margin: 1.2rem 0 .45rem; }
.md-body h2:first-child, .md-body h3:first-child { margin-top: 0; }
.md-body ul, .md-body ol { padding-left: 1.3rem; margin-bottom: .75rem; }
.md-body li { margin-bottom: .25rem; }
.md-body .md-check { list-style: none; margin-left: -1.3rem; }
.md-body .md-check .bi { margin-right: .3rem; }
.md-body .md-check.is-done .bi { color: #10b981; }
.md-body .md-check.is-open .bi { color: #ef4444; }
.md-body p { margin-bottom: .7rem; }
.briefing-list { max-height: 70vh; overflow-y: auto; padding-bottom: .5rem; }
.briefing-month { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--cg-muted); padding: .8rem 1rem .3rem; }
.briefing-day { display: flex; align-items: center; gap: .7rem; padding: .45rem 1rem; color: inherit; text-decoration: none; }
.briefing-day:hover { background: var(--cg-surface-2); color: inherit; }
.briefing-day.active { background: var(--cg-primary-soft); }
.bd-date { display: flex; flex-direction: column; align-items: center; width: 34px; flex-shrink: 0; line-height: 1.1; }
.bd-date strong { font-size: 1.05rem; }
.bd-date small { font-size: .68rem; color: var(--cg-muted); }
.bd-text { font-size: .84rem; flex: 1; min-width: 0; }
.bd-new { width: 8px; height: 8px; border-radius: 50%; background: #8b5cf6; flex-shrink: 0; }
a.briefing-home { display: block; color: inherit; text-decoration: none; transition: box-shadow .15s; }
a.briefing-home:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .08); color: inherit; }
.briefing-home.is-new { border-color: rgba(139, 92, 246, .55); box-shadow: 0 0 0 1px rgba(139, 92, 246, .35) inset; }
.briefing-home .kpi-icon { width: 40px; height: 40px; font-size: 1.1rem; }
.briefing-home-list { padding-left: 1.1rem; font-size: .9rem; }
.briefing-home-list li + li { margin-top: .15rem; }

/* ================= Da fare (lista per priorità) ================= */
.todo-filter { display: flex; flex-wrap: wrap; gap: .35rem; }
.todo-card { overflow: hidden; }
.todo-group { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .7rem 1rem .3rem; background: var(--cg-surface-2); border-top: 1px solid var(--cg-border); }
.todo-card > .todo-group:first-child { border-top: 0; }
.todo-row { display: grid; grid-template-columns: 26px 24px 26px minmax(0, 1fr) 90px 130px; align-items: center; gap: .6rem; padding: .6rem 1rem; border-top: 1px solid var(--cg-border); }
.todo-group + .todo-row { border-top: 0; }
.todo-row:hover { background: var(--cg-surface-2); }
.todo-row.is-done { opacity: .45; }
.todo-row.is-done .todo-title { text-decoration: line-through; }
.todo-n { font-size: .8rem; color: var(--cg-muted); text-align: right; }
.todo-flag { border: 0; background: transparent; color: var(--cg-border); font-size: 1rem; padding: 0; line-height: 1; }
.todo-flag:hover { color: #ef4444; }
.todo-row.is-urgent .todo-flag { color: #ef4444; }
.todo-main { display: flex; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
.todo-main:hover .todo-title { color: var(--cg-primary); }
.todo-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-where { font-size: .78rem; color: var(--cg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-where .bi { margin-right: .25rem; }
.todo-person { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-due { font-size: .8rem; font-weight: 600; text-align: right; white-space: nowrap; }
.todo-due.td-danger { color: #dc2626; } .todo-due.td-warning { color: #d97706; } .todo-due.td-muted { color: var(--cg-muted); font-weight: 400; } .todo-due.td-normal { color: var(--cg-text); }
@media (max-width: 767.98px) {
  .todo-row { grid-template-columns: 22px 24px 22px minmax(0, 1fr); row-gap: .15rem; }
  .todo-person, .todo-due { grid-column: 4; text-align: left; font-size: .76rem; }
  .todo-person { display: none; }
  .todo-title { white-space: normal; }
}
