@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Neutri */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f6;
  --border: #ececef;
  --border-strong: #e0e0e4;
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --muted-2: #a1a1aa;

  /* Accento brand (usato con parsimonia) */
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-soft: #fff4ed;

  /* Semantici */
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #b45309;
  --amber-soft: #fffbeb;

  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(24,24,27,.05);
  --shadow: 0 1px 3px rgba(24,24,27,.06), 0 4px 12px rgba(24,24,27,.04);
  --shadow-lg: 0 10px 38px rgba(24,24,27,.14);
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ic { flex-shrink: 0; vertical-align: middle; }

/* ---------- Buttons ---------- */
.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 14px; cursor: pointer; line-height: 1; display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-icon { padding: 7px; }
.btn-block { width: 100%; justify-content: center; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a.btn { text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- Login / setup ---------- */
.login-screen { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 36px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.login-sub { color: var(--muted); margin: 6px 0 26px; font-size: 13.5px; }
.login-card label { display: block; font-weight: 600; margin-bottom: 16px; font-size: 13px; color: var(--text-2); }
.login-card input { width: 100%; margin-top: 7px; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font: inherit; background: var(--surface); }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; margin: 14px 0 0; }

/* ---------- Brand mark: la tigre Royaletiger su chip scuro ---------- */
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: #16161a; color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 1px 3px rgba(0,0,0,.25); }
.brand-mark img { width: 78%; height: 78%; object-fit: contain; display: block; }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.02em;
  padding: 6px 8px 20px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; color: var(--muted); text-decoration: none;
  padding: 9px 11px; border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s; }
.nav a .ic { color: var(--muted-2); transition: color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a:hover .ic { color: var(--text-2); }
.nav a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav a.active .ic { color: var(--accent); }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2);
  padding: 18px 11px 7px; font-weight: 700; }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 14px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; }
.user-email { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { overflow-y: auto; padding: 28px 32px; }

/* Barra superiore (solo mobile: navigazione) */
.topbar { display: none; }
.hamburger { background: none; border: none; padding: 5px; cursor: pointer; color: var(--text);
  display: grid; place-items: center; border-radius: 8px; }
.hamburger:hover { background: var(--surface-2); }
.scrim { display: none; }

/* ---------- Page headers ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin: 5px 0 0; font-size: 13.5px; }
.section-title { font-size: 15px; font-weight: 600; margin: 32px 0 14px; letter-spacing: -.01em; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; }
.stat-card .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Il suffisso (/mese, %) va SOTTO la cifra: in linea, con importi veri come
   "5.374,66 €/mese", la card tagliava il valore o spezzava la parola a meta'. */
.stat-card .value small { display: block; font-size: 12px; font-weight: 500;
  color: var(--muted); margin-top: 2px; letter-spacing: 0; }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  width: 250px; min-width: 250px; display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.column.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.column-head { padding: 13px 14px; font-weight: 600; font-size: 13px; display: flex; justify-content: space-between;
  align-items: center; }
.column-head .count { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px;
  padding: 1px 9px; font-size: 11.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.column-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; flex: 1; min-height: 22px; }

.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
  box-shadow: var(--shadow-sm); cursor: grab; border-left: 2.5px solid var(--border-strong); transition: box-shadow .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .4; }
.card .card-title { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; line-height: 1.35; padding-right: 48px; }
.card-nav { position: absolute; top: 7px; right: 7px; display: flex; gap: 3px; }
.card-nav-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 2px; cursor: pointer;
  color: var(--muted); display: grid; place-items: center; line-height: 0; transition: background .12s, border-color .12s, color .12s; }
.card-nav-btn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.card-nav-btn:disabled { opacity: .3; cursor: default; }
.card .card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card.prio-alta { border-left-color: var(--red); }
.card.prio-media { border-left-color: var(--amber); }
.card.prio-bassa { border-left-color: var(--green); }
/* Posta: elenco stile client di posta, raggruppato per giorno */
.mail-day { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted-2); margin: 18px 2px 8px; }
.mail-list .mail-day:first-child { margin-top: 2px; }
.mail-row { display: flex; gap: 10px; align-items: center; padding: 9px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  margin-bottom: 6px; cursor: pointer; transition: border-color .12s; }
.mail-row:hover { border-color: var(--accent); }
.mail-row.mail-out { background: var(--surface-2); }
.mail-dir { flex: none; color: var(--muted-2); display: inline-flex; }
.mail-row:not(.mail-out) .mail-dir { color: var(--accent); }
.mail-main { flex: 1; min-width: 0; }
.mail-top { display: flex; gap: 6px; align-items: center; font-size: 13.5px; min-width: 0; }
.mail-chi { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-out .mail-chi { font-weight: 500; color: var(--text-2); }
.mail-clip { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); flex: none; }
.mail-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-top: 1px; }
.mail-sub .ogg { color: var(--text-2); font-weight: 500; }
.mail-when { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

a.chip-link { text-decoration: none; color: var(--text-2); cursor: pointer; }
a.chip-link:hover { border-color: var(--accent); color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 11.5px; color: var(--text-2); font-weight: 500; }
.chip .ic { color: var(--muted); }
.chip-due { color: var(--amber); border-color: #fde9c8; background: var(--amber-soft); }
.chip-due .ic { color: var(--amber); }
.chip-due.overdue { color: var(--red); border-color: #fbd5d5; background: var(--red-soft); }
.chip-due.overdue .ic { color: var(--red); }
.chip-calls { cursor: pointer; font: inherit; transition: border-color .15s, color .15s; }
.chip-calls:hover { border-color: var(--accent); color: var(--accent-hover); }
.chip-calls:hover .ic { color: var(--accent); }
.chip-calls.over { color: var(--red); border-color: #fbd5d5; background: var(--red-soft); }
.chip-calls.over .ic { color: var(--red); }

/* ---------- Lists / cards ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-wrap { position: relative; flex: 1; display: flex; align-items: center; }
.search-wrap .ic { position: absolute; left: 12px; color: var(--muted-2); pointer-events: none; }
.input { padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit;
  background: var(--surface); width: 100%; }
.search-wrap .input { padding-left: 36px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px,1fr)); gap: 14px; }
.client-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.client-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.client-card h3 { margin: 0 0 2px; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.client-card .sub { color: var(--muted); font-size: 13px; }
.client-card .row { display: flex; gap: 7px; align-items: center; margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.client-card .row .ic { color: var(--muted-2); }
.client-card .note-preview { align-items: flex-start; }
.client-card .note-preview .ic { margin-top: 1px; }
.client-card .note-preview span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.4; }
.cc-head { display: flex; align-items: center; gap: 12px; }
.cc-avatar { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-hover);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.cc-id { flex: 1; min-width: 0; }
.cc-id h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-id .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.type-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; flex-shrink: 0; }
.type-badge .ic { color: var(--muted); }
.cc-body { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.cc-body .row { margin: 0; }
.detail-client { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; flex-shrink: 0; }
.seg-btn { border: none; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 6px 12px; border-radius: 7px; cursor: pointer; transition: background .15s, color .15s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.empty { text-align: center; color: var(--muted); padding: 56px 20px; font-size: 14px; }

/* ---------- Files ---------- */
.file-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.file-row:last-child { border-bottom: none; }
.file-thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2);
  display: grid; place-items: center; flex-shrink: 0; border: 1px solid var(--border); color: var(--muted); }
.file-info { flex: 1; min-width: 0; }
.file-info .nm { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info .mt { font-size: 12px; color: var(--muted); margin-top: 2px; }
.file-actions { display: flex; gap: 4px; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--muted); cursor: pointer; transition: .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dropzone .ic { color: var(--muted-2); }
.dropzone:hover { border-color: var(--muted-2); background: var(--surface-2); }
.dropzone.drag-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }
.dropzone.drag-over .ic { color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(24,24,27,.45); display: grid; place-items: center;
  padding: 24px; z-index: 50; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg); max-height: 90vh; display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal-wide { max-width: 640px; }
.modal-xl { max-width: 780px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px;
  display: grid; place-items: center; transition: .15s; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: var(--text-2); }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font: inherit; background: var(--surface); color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; min-height: 72px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 2px; margin-bottom: 15px; background: var(--surface-2); }
.field-group-title { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.field-group-title .ic { color: var(--muted); }
.check-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 6px 10px; font-size: 12.5px; cursor: pointer; background: var(--surface); user-select: none; }
.check:hover { border-color: var(--muted-2); }
.check input { accent-color: var(--accent); margin: 0; }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }

/* ---- Sotto-pipeline Sito Web ---- */
.column-head-link { cursor: pointer; }
.column-head-link:hover, .column-head-link:hover .sub-caret { color: var(--accent); }
.sub-caret { color: var(--muted-2); margin-left: 2px; }
.chip-sub { background: var(--accent-soft); border-color: #fdd9c0; color: var(--accent-hover); }
.column-advance { background: transparent; border: 1.5px dashed var(--border-strong); }
.column-advance.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.column-advance .column-head { color: var(--muted); }
.advance-hint { color: var(--muted); font-size: 12.5px; text-align: center; padding: 26px 14px; line-height: 1.6; }

/* Tooltip contatto cliente (hover card) */
.card-tip { position: fixed; z-index: 200; display: none; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12.5px; max-width: 280px;
  opacity: 0; transition: opacity .12s; pointer-events: none; }
.card-tip.show { opacity: 1; }
.card-tip strong { display: block; font-size: 13px; margin-bottom: 6px; letter-spacing: -.01em; }
.card-tip .tip-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); margin-top: 4px; }
.card-tip .tip-row .ic { color: var(--muted); flex-shrink: 0; }

/* ---- Team / avatar ---- */
.avatar-mem { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700;
  vertical-align: middle; flex-shrink: 0; }
.card-assignee { margin-left: auto; display: inline-flex; }

/* ---- Notifiche ---- */
.notif-badge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; display: grid;
  place-items: center; line-height: 1; }
.notif-panel { position: fixed; bottom: 62px; left: 12px; width: 300px; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 220; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.notif-head button { background: none; border: none; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--accent-soft); }
.notif-time { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

/* ---- Discussione (chat commenti) ---- */
.msg-list { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; padding: 4px; }
.msg { display: flex; gap: 10px; max-width: 82%; }
.msg-b { min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 7px 11px; }
.msg.msg-compact { margin-top: -2px; }
.msg.msg-compact .msg-b { border-radius: 12px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .msg-b { background: var(--accent-soft); border-color: #fdd9c0; border-radius: 12px 4px 12px 12px; }
.msg-avatar-sp { width: 30px; flex-shrink: 0; }
.msg-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.msg-h strong { font-size: 12.5px; }
.msg.mine .msg-h { flex-direction: row-reverse; }
.msg-time { color: var(--muted); font-size: 11px; }
.msg-text { font-size: 13.5px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.msg-day { text-align: center; margin: 12px 0 6px; }
.msg-day span { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 20px; padding: 3px 12px; text-transform: capitalize; }
.msg-att-img { display: block; margin-top: 6px; max-width: 220px; }
.msg-att-img img { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; }
.msg-att-file { display: inline-flex; align-items: center; gap: 7px; margin-top: 6px; padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px;
  color: var(--text-2); text-decoration: none; }
.msg-att-file:hover { border-color: var(--accent); color: var(--accent-hover); }
.msg-receipt { align-self: flex-end; font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin: 2px 6px 0; }
.msg-receipt .ic { color: var(--green); }
.mention { color: var(--accent-hover); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.composer { border-top: 1px solid var(--border); padding-top: 14px; }
.msg-att-preview { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 7px 11px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
.msg-att-preview span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mchip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 3px 9px;
  font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; }
.mchip:hover { border-color: var(--accent); color: var(--accent-hover); }
.composer-row { display: flex; gap: 8px; align-items: flex-start; }
.composer-row textarea { flex: 1; min-height: 42px; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font: inherit; resize: vertical; background: var(--surface); }
.composer-row textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- Bozza online (panoramica progetto) ---- */
.draft-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 16px; margin: 16px 0 0;
  background: var(--surface-2); }
.draft-info { display: flex; align-items: center; gap: 11px; min-width: 0; }
.draft-info .ic { color: var(--accent); flex-shrink: 0; }
.draft-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.draft-url { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.draft-empty { color: var(--muted); font-size: 13px; justify-content: flex-start; }
.draft-empty .ic { color: var(--muted-2); }
.draft-frame { margin-top: 10px; }
.draft-frame iframe { width: 100%; height: 380px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; }
.draft-frame-note { font-size: 11.5px; color: var(--muted); margin: 6px 0 0; }

/* ---- Compiti (assegnazione lavoro) ---- */
.task-section-h { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 4px; }
.task-section-h span { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 0 8px; font-size: 11px; }
.task-section-h.done-h { color: var(--muted-2); }
.task-assignee { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  flex-shrink: 0; }
.task-composer { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.task-composer #t-title { flex: 1 1 220px; }
.task-composer #t-assignee { flex: 0 1 150px; }
.task-composer #t-due { flex: 0 1 140px; }
.task-list { display: flex; flex-direction: column; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-row input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.task-title { flex: 1; font-size: 13.5px; min-width: 0; }
.task-row.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ---- Materiali (cartelle progetto) ---- */
.folder-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 7px 11px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.fchip .ic { color: var(--muted); }
.fchip:hover { border-color: var(--muted-2); }
.fchip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }
.fchip.active .ic { color: var(--accent); }
.fcount { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 0 7px; font-size: 11px; font-variant-numeric: tabular-nums; }
.fchip.active .fcount { background: var(--surface); }
.fcount.zero { color: var(--red); border-color: #fbd5d5; }

/* ---- Feedback cliente ---- */
.fb-composer { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
  background: var(--surface-2); margin-bottom: 18px; }
.fb-composer textarea { width: 100%; min-height: 60px; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font: inherit; resize: vertical; background: var(--surface); }
.fb-composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fb-composer-row { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.fb-composer-row .input { flex: 0 1 160px; }
.fb-list { display: flex; flex-direction: column; gap: 10px; }
.fb-item { display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.fb-item.done { opacity: .7; background: var(--surface-2); }
.fb-item { border-left: 3px solid var(--accent); }
.fb-item.done { border-left-color: var(--green); }
.fb-ch { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center;
  justify-content: center; background: var(--accent-soft); color: var(--accent-hover); margin-top: 1px; }
.fb-item.done .fb-ch { background: var(--green-soft); color: var(--green); }
.fb-body { flex: 1; min-width: 0; }
.fb-text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; font-weight: 500; }
.fb-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; text-transform: capitalize; }
.fb-meta .ic { color: var(--green); }
.fb-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.fb-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.fb-from { color: var(--text-2); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.fb-from .ic { color: var(--muted-2); }
.fb-item.urgent { border-left-color: var(--red); }
.fb-item.urgent .fb-ch { background: var(--red-soft); color: var(--red); }
.fb-urgent { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--red); background: var(--red-soft); border: 1px solid #fbd5d5; border-radius: 20px; padding: 2px 9px; white-space: nowrap; }
.fb-urg-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.fb-urg-chk input { accent-color: var(--red); }
.fb-filters { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

/* Selettore cliente intelligente (cerca/crea per nome, numero, email) */
.cp-selected { display: flex; align-items: center; gap: 10px; }
.cp-search { position: relative; }
.cp-results { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.cp-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left;
  border: 1px solid transparent; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 11px;
  font: inherit; cursor: pointer; }
.cp-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.cp-item strong { font-size: 13px; }
.cp-item span { font-size: 11.5px; color: var(--muted); }
.cp-item.cp-new { flex-direction: row; align-items: center; gap: 7px; color: var(--accent-hover); font-weight: 600; font-size: 12.5px; }

/* Messaggi raggruppati (stesso autore) */
.msg-compact { margin-top: -9px; }
.msg-compact .msg-b { padding-left: 40px; }

/* Autocomplete menzioni */
.mention-pop { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 60; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px;
  min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.mention-opt { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: none; background: none;
  font: inherit; font-size: 13px; border-radius: 7px; cursor: pointer; color: var(--text-2); text-align: left; }
.mention-opt:hover, .mention-opt.active { background: var(--accent-soft); color: var(--accent-hover); }

/* Badge sul tab */
.tab-badge { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px;
  background: var(--accent); color: #fff; border-radius: 10px; font-size: 10.5px; font-weight: 700;
  vertical-align: 1px; margin-left: 3px; }

/* Editing inline compito */
.task-edit { gap: 8px; flex-wrap: wrap; padding: 10px 0; }
.task-edit [data-e-title] { flex: 2 1 180px; }
.task-edit [data-e-assignee] { flex: 1 1 130px; }
.task-edit [data-e-due] { flex: 0 1 140px; }
.task-assignee.unset { font-size: 11.5px; color: var(--muted-2); font-style: italic; }
.task-row:not(.task-edit):not(.done) { cursor: pointer; }
.task-row:not(.task-edit):hover { background: var(--surface-2); border-radius: 8px; }

/* Barra fasi (panoramica) */
.phase-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.phase-dots { display: flex; gap: 5px; }
.phase-dot { width: 22px; height: 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.phase-dot.done { background: var(--accent); border-color: var(--accent); opacity: .45; }
.phase-dot.cur { background: var(--accent); border-color: var(--accent); }
.phase-progress-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* Link caricamento cliente (materiali) */
.mat-client-link { display: flex; align-items: center; gap: 9px; margin-top: 10px; padding: 9px 13px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--muted); }
.mat-client-link .ic { color: var(--muted-2); flex-shrink: 0; }
.mat-client-link span { flex: 1; }

/* ---- Ricerca globale (⌘K) ---- */
.nav-search { display: flex; align-items: center; gap: 11px; width: 100%; border: 1px solid var(--border);
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 11px; margin-bottom: 10px;
  font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; transition: border-color .15s; }
.nav-search:hover { border-color: var(--muted-2); color: var(--text); }
.nav-search .ic { color: var(--muted-2); }
.nav-search kbd, .spal-input kbd { margin-left: auto; font-family: inherit; font-size: 10.5px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; }
.spal-overlay { position: fixed; inset: 0; background: rgba(24,24,27,.45); z-index: 300;
  display: flex; justify-content: center; padding: 12vh 20px 20px; }
.spal { width: 100%; max-width: 560px; background: var(--surface); border-radius: 14px;
  box-shadow: var(--shadow-lg); height: fit-content; overflow: hidden; }
.spal-input { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.spal-input .ic { color: var(--muted); flex-shrink: 0; }
.spal-input input { flex: 1; border: none; outline: none; font: inherit; font-size: 15px; background: none; color: var(--text); }
.spal-results { max-height: 46vh; overflow-y: auto; padding: 6px; }
.spal-hint { color: var(--muted); font-size: 13px; text-align: center; padding: 26px 16px; }
.spal-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; border: none;
  background: none; font: inherit; padding: 10px 12px; border-radius: 9px; cursor: pointer; color: var(--text); }
.spal-row .ic { color: var(--muted); flex-shrink: 0; }
.spal-row.active { background: var(--accent-soft); }
.spal-row.active .ic { color: var(--accent); }
.spal-label { font-weight: 600; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spal-sub { margin-left: auto; color: var(--muted); font-size: 12px; flex-shrink: 0; }

/* ---- Sezioni file (documenti vs materiali progetti) ---- */
.files-sec-h { display: flex; align-items: center; gap: 10px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 4px; }
.files-sec-h:first-child { margin-top: 4px; }

/* ---- Badge nel menu ---- */
.nav-badge { margin-left: auto; display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; background: var(--accent); color: #fff; border-radius: 10px; font-size: 10.5px; font-weight: 700; }

/* ---- Pagina Compiti (globale) ---- */
.task-group-h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 0 8px; }
.task-group-h span { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 0 8px; font-size: 11px; }
.task-group-h.late { color: var(--red); }
.task-group-h.today { color: var(--amber); }
.task-list.card-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2px 14px; }
.chip-proj { cursor: pointer; font: inherit; font-size: 11.5px; transition: border-color .15s, color .15s; }
.chip-proj:hover { border-color: var(--accent); color: var(--accent-hover); }
.t-detail-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; line-height: 1.4; }
.t-detail-title.done { color: var(--muted); text-decoration: line-through; }

/* ---- Presenza "chi sta lavorando" (stile Slack) ---- */
.pres-strip { display: flex; align-items: center; gap: 9px; margin-top: 10px; min-height: 26px; }
.pres-avatars { display: flex; }
.pres-avatars .avatar-mem { margin-right: -6px; border: 2px solid var(--surface); }
.pres-dot { position: relative; }
.pres-dot::after { content: ""; position: absolute; bottom: -1px; right: -1px; width: 8px; height: 8px;
  background: var(--green); border: 2px solid var(--surface); border-radius: 50%;
  animation: pres-pulse 1.6s ease-in-out infinite; }
@keyframes pres-pulse { 50% { transform: scale(1.35); } }
.pres-label { font-size: 12.5px; color: var(--green); font-weight: 600; }
.pres-label.pres-none { color: var(--muted-2); font-weight: 500; }

/* ---- Cliente 360° (pagina/scheda progetto) ---- */
.c360 { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.c360-sec { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.c360-sec summary { display: flex; align-items: center; gap: 9px; padding: 11px 14px; cursor: pointer;
  font-weight: 600; font-size: 13px; color: var(--text-2); list-style: none; user-select: none; }
.c360-sec summary::-webkit-details-marker { display: none; }
.c360-sec summary::after { content: "›"; margin-left: auto; color: var(--muted-2); font-size: 16px;
  transition: transform .15s; }
.c360-sec[open] summary::after { transform: rotate(90deg); }
.c360-sec summary .ic { color: var(--muted); }
.c360-sec[open] summary { border-bottom: 1px solid var(--border); }
.c360-body { padding: 12px 14px; background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.c360-empty { color: var(--muted); font-size: 12.5px; padding: 4px 0; }

/* ---- Pagina progetto ---- */
.proj-page { max-width: 900px; }

/* ---- Registro Progetti (trasversale) ---- */
.reg-filters { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.type-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.type-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 20px; padding: 5px 12px; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.type-pill:hover { border-color: var(--muted-2); }
.type-pill.active { background: var(--text); color: #fff; border-color: var(--text); }
.type-pill .tp-n { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.chip-type { font-weight: 600; }
.chip-type.type-website { color: var(--accent-hover); border-color: #fdd9c0; background: var(--accent-soft); }
.chip-type.type-ads { color: #1d4ed8; border-color: #c7d7fe; background: #eef2ff; }
.chip-type.type-blog { color: var(--green); border-color: #c9f0d4; background: var(--green-soft); }
.chip-type.type-social { color: #a21caf; border-color: #f3d1f7; background: #fdf0fe; }
.chip-type.type-mail { color: #0e7490; border-color: #c6ecf3; background: #effafc; }
.chip-type.type-app { color: #6d28d9; border-color: #e0d5fb; background: #f5f1fe; }
.chip-channel { color: var(--muted); background: var(--surface-2); font-size: 11px; }
.chip-renew { color: #1d4ed8; background: #eef2ff; border-color: #c7d7fe; }
.chip-renew.overdue { color: var(--red); background: var(--red-soft); border-color: #fbd5d5; font-weight: 600; }

/* ---- Il mio lavoro (home collaboratore) ---- */
.mw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .mw-grid { grid-template-columns: 1fr; } }
.mw-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mw-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; }
.mw-box-h { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 13.5px; margin-bottom: 10px; }
.mw-box-h .ic { color: var(--accent); }
.mw-ev, .mw-att, .mw-proj { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 6px; min-width: 0; }
.mw-att.clickable, .mw-proj.clickable, .mw-ev.clickable { cursor: pointer; transition: background .12s; }
.mw-att.clickable:hover, .mw-proj.clickable:hover, .mw-ev.clickable:hover { background: var(--accent-soft); }
.mw-ev-title { flex: 1; font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mw-type-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 10px 0 6px; display: flex; align-items: center; gap: 7px; }
.mw-type-h .count, .task-group-h .count { background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 0 7px; font-size: 10.5px; color: var(--muted); }
.mw-task { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--surface); }
.mw-task input { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.mw-task-title { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mw-more { font-size: 12px; color: var(--accent-hover); text-decoration: none; font-weight: 600; }
.mw-more:hover { text-decoration: underline; }

/* Carico del team (dashboard) */
.teamload { display: flex; flex-direction: column; gap: 6px; margin-bottom: 26px; }
.teamload-row { display: flex; align-items: center; gap: 12px; padding: 9px 13px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); }
.teamload-name { flex: 1; font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teamload-row .chip.hot { color: var(--red); background: var(--red-soft); border-color: #fbd5d5; font-weight: 600; }

/* Stati compito (chip + board kanban) */
.st-chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; border: 1px solid; }
.st-chip.s-todo { color: var(--muted); background: var(--surface-2); border-color: var(--border); }
.st-chip.s-doing { color: #1d4ed8; background: #eef2ff; border-color: #c7d7fe; }
.st-chip.s-review { color: var(--amber); background: var(--amber-soft); border-color: #fde9c8; }
.st-chip.s-done { color: var(--green); background: var(--green-soft); border-color: #c9f0d4; }
.tboard { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .tboard { grid-template-columns: 1fr 1fr; } }
.tcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.tcol.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.tcol-h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; padding: 4px 6px 10px;
  text-transform: uppercase; letter-spacing: .03em; }
.tcol-h .count { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 0 7px; font-size: 11px; }
.tcol-h.s-doing { color: #1d4ed8; } .tcol-h.s-review { color: var(--amber); } .tcol-h.s-done { color: var(--green); } .tcol-h.s-todo { color: var(--muted); }
.tcol-body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.tcol-empty { color: var(--muted-2); font-size: 12px; text-align: center; padding: 14px 0; }
.tb-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 11px; cursor: grab; box-shadow: var(--shadow-sm); }
.tb-card:hover { border-color: var(--muted-2); }
.tb-card.dragging { opacity: .5; }
.tb-title { font-size: 13px; font-weight: 500; margin-bottom: 7px; }
.tb-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tb-meta .chip-proj { font-size: 10.5px; }

/* Chip reparto (colore per reparto via --rep) */
.rep-chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  color: var(--rep); background: color-mix(in srgb, var(--rep) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--rep) 30%, transparent); white-space: nowrap; }

/* Palette brand nella presa dati */
.pal-swatches { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 6px; }
.pal-dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block;
  border: 1px solid rgba(0,0,0,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }

/* Ciclo mensile (servizi ricorrenti) */
.cycle-box { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; background: var(--surface-2); }
.cycle-head { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13px;
  color: var(--text-2); margin-bottom: 9px; }
.cycle-head .ic { color: var(--accent); }
.cycle-head strong { font-variant-numeric: tabular-nums; }
.cycle-bar { height: 8px; background: var(--border); border-radius: 6px; overflow: hidden; }
.cycle-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s; }
.cycle-fill.full { background: var(--green); }
.cycle-prevs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 9px; }
.cycle-prev { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.cycle-prev.ok { color: var(--green); }

/* Affare vinto: scelta dei servizi venduti */
.sold-types { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.sold-type { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; cursor: pointer; transition: border-color .12s, background .12s; }
.sold-type:hover { border-color: var(--muted-2); }
.sold-type:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sold-type input { accent-color: var(--accent); }

/* ---- Progetti del cliente (tab nella scheda cliente) ---- */
.cli-proj-list { display: flex; flex-direction: column; gap: 6px; }
.cli-proj-h { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 4px; }
.cli-proj-h:first-child { margin-top: 2px; }
.cli-proj-h .count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px;
  padding: 0 8px; font-size: 11px; color: var(--muted); }
.cli-proj-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color .12s; }
.cli-proj-row:hover { border-color: var(--accent); }
.cli-proj-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.5px; font-weight: 500; }
.tab-count { background: var(--accent); color: #fff; border-radius: 20px; padding: 0 7px; font-size: 11px;
  font-weight: 700; margin-left: 2px; }

/* ---- Stati cliente (elenco Clienti) ---- */
.st-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border);
  white-space: nowrap; }
.st-badge.st-active  { color: var(--green); background: var(--green-soft); border-color: #c9f0d4; }
.st-badge.st-deal    { color: var(--amber); background: var(--amber-soft); border-color: #fde9c8; }
.st-badge.st-dormant { color: var(--muted); background: var(--surface-2); border-color: var(--border); }
.st-badge.st-none    { color: var(--muted-2); background: var(--surface-2); border-color: var(--border); }
.st-badge.st-late    { color: var(--red); background: #FCEBEB; border-color: #F7C1C1; }
.cc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.cc-meta .chip { font-size: 11.5px; }
.chip-rec { color: #1d4ed8; background: #eef2ff; border-color: #c7d7fe; font-weight: 600; }
.cc-last { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px;
  color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cc-last .ic { color: var(--muted-2); }
.cli-segments { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.cli-segments .seg-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.seg-chip { border: 1px dashed var(--border-strong); background: var(--surface); border-radius: 20px;
  padding: 5px 12px; font: inherit; font-size: 12.5px; color: var(--text-2); cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.seg-chip:hover { border-color: var(--accent); color: var(--accent-hover); }
.seg-chip.active { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }

/* ---- Accessi multipli (credentials) ---- */
.cred-cards { display: flex; flex-direction: column; gap: 10px; }
.cred-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 13px;
  background: var(--surface); }
.cred-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.cred-card-head strong { font-size: 13px; }
.cred-card .info-row { font-size: 12.5px; }

/* ---- Sotto-pipeline incorporata (dentro Progetti) ---- */
.sub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sub-title { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.sub-head .count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px;
  padding: 1px 9px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---- Pagina Richieste ---- */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-row { display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px; background: var(--surface); }
.req-row.done { opacity: .6; background: var(--surface-2); }
.req-row > .chip { flex-shrink: 0; margin-top: 1px; }
.req-body { flex: 1; min-width: 0; }
.req-text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; font-weight: 500; }
.req-meta { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; align-items: center;
  gap: 5px; flex-wrap: wrap; }
.req-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---- Inbox Messaggi ---- */
.conv-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.conv-row { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s; }
.conv-row:last-child { border-bottom: none; }
.conv-row:hover { background: var(--surface-2); }
.conv-main { flex: 1; min-width: 0; }
.conv-title { font-weight: 600; font-size: 14px; }
.conv-preview { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.conv-row.unread .conv-title { font-weight: 700; }
.conv-row.unread .conv-preview { color: var(--text-2); font-weight: 500; }
.conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.conv-time { font-size: 11.5px; color: var(--muted); }
.notif-item.clickable { cursor: pointer; }
.notif-item.clickable:hover { background: var(--surface-2); }

/* Preventivi & contratti */
.quote-list { display: flex; flex-direction: column; gap: 9px; }
.quote-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px; background: var(--surface); flex-wrap: wrap; }
.q-main { flex: 1; min-width: 160px; }
.q-title { font-weight: 600; font-size: 13.5px; }
.q-num { color: var(--muted); font-weight: 600; margin-right: 8px; font-variant-numeric: tabular-nums; }
.q-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.q-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-status { flex: 0 0 auto; width: auto; padding: 6px 28px 6px 10px; font-size: 12.5px; font-weight: 600; }
.q-status.s-accettato { color: var(--green); border-color: #c9f0d4; background: var(--green-soft); }
.q-status.s-inviato { color: var(--amber); border-color: #fde9c8; background: var(--amber-soft); }
.q-status.s-rifiutato { color: var(--red); border-color: #fbd5d5; background: var(--red-soft); }
.q-status.s-bozza { color: var(--muted); }

/* ---- Vista Progetti (tabella) ---- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ptable th { text-align: left; padding: 11px 14px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.ptable th[data-sort] { cursor: pointer; }
.ptable th[data-sort]:hover { color: var(--text); }
.ptable th.sort-asc::after { content: " ↑"; color: var(--accent); }
.ptable th.sort-desc::after { content: " ↓"; color: var(--accent); }
.ptable td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.ptable tbody tr { cursor: pointer; transition: background .12s; }
.ptable tbody tr:hover { background: var(--surface-2); }
.ptable tbody tr:last-child td { border-bottom: none; }
.pt-title { font-weight: 600; white-space: normal; }
.pt-late { color: var(--red); font-weight: 600; }
.pt-warn { color: var(--amber); font-weight: 600; }
.sla-note { font-size: 10.5px; font-weight: 700; color: var(--red); background: var(--red-soft);
  border: 1px solid #fbd5d5; border-radius: 5px; padding: 1px 6px; margin-left: 4px; }

/* ---- Dashboard: da gestire ora ---- */
.stat-card.alert { text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
.stat-card.alert:hover { border-color: var(--muted-2); }
.stat-card.alert.hot .value { color: var(--red); }
.urgent-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin-top: 14px; overflow: hidden; }
.urgent-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; }
.urgent-row:last-child { border-bottom: none; }
.urgent-row.clickable { cursor: pointer; }
.urgent-row.clickable:hover { background: var(--surface-2); }
.u-kind { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border-radius: 5px; padding: 2px 8px; flex-shrink: 0; }
.u-kind.u-late { color: var(--red); background: var(--red-soft); border: 1px solid #fbd5d5; }
.u-kind.u-sla { color: var(--amber); background: var(--amber-soft); border: 1px solid #fde9c8; }
.u-kind.u-task { color: var(--accent-hover); background: var(--accent-soft); border: 1px solid #fdd9c0; }
.u-kind.u-bill { color: var(--green); background: var(--green-soft); border: 1px solid #c9f0d4; }
.u-kind.u-wait { color: var(--amber); background: var(--amber-soft); border: 1px solid #fde9c8; }
.chip-wait { color: var(--amber); background: var(--amber-soft); border-color: #fde9c8; font-weight: 600; }
#qa-wait.wait-on { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }

/* Colli di bottiglia per fase (registro) */
.stage-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 16px; }
.stage-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 8px; padding: 6px 11px; font: inherit; font-size: 12px;
  font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color .12s, background .12s; }
.stage-pill b { font-variant-numeric: tabular-nums; font-weight: 700; }
.stage-pill:hover { border-color: var(--muted-2); }
.stage-pill.hot b { color: var(--red); }
.stage-pill.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }

/* ---- Progetti: filtri rapidi d'azione + pannello numeri a scomparsa ---- */
.qf-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.qf { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 20px; padding: 6px 13px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: border-color .12s, background .12s; }
.qf b { font-variant-numeric: tabular-nums; }
.qf:hover { border-color: var(--muted-2); }
.qf.zero { opacity: .5; }
.qf-late b { color: var(--red); }        .qf-late.active { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.qf-sla b { color: var(--amber); }        .qf-sla.active { border-color: var(--amber); background: var(--amber-soft); }
.qf-wait b { color: #f59e0b; }            .qf-wait.active { border-color: var(--amber); background: var(--amber-soft); }
.qf-renew b { color: #1d4ed8; }           .qf-renew.active { border-color: #1d4ed8; background: #eef2ff; color: #1d4ed8; }
.qf-none b { color: var(--muted); }       .qf-none.active { border-color: var(--muted-2); background: var(--surface-2); }
.stats-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 10px; margin-bottom: 16px; }
.active-ghost { border-color: var(--accent) !important; color: var(--accent-hover) !important; }

/* ---- Progetti: KPI cliccabili (legacy, non più usato) ---- */
.pkpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.pkpi { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
  font: inherit; text-align: left; transition: border-color .12s, box-shadow .12s; }
.pkpi[disabled] { cursor: default; }
.pkpi:not([disabled]):hover { border-color: var(--muted-2); }
.pkpi.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pkpi-v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pkpi-l { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.pkpi.k-late .pkpi-v { color: var(--red); }
.pkpi.k-sla .pkpi-v { color: var(--amber); }
.pkpi.k-wait .pkpi-v { color: var(--amber); }
.pkpi.k-renew .pkpi-v { color: #1d4ed8; }
.pkpi.k-none .pkpi-v { color: var(--muted); }

/* indicatore di salute per riga */
.pt-health { width: 26px; text-align: center; }
.hdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.hdot.h-ok { background: var(--green); }
.hdot.h-late { background: var(--red); }
.hdot.h-sla { background: var(--amber); }
.hdot.h-wait { background: #f59e0b; box-shadow: 0 0 0 3px var(--amber-soft); }
.hdot.h-renew { background: #1d4ed8; }

.reg-count { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.linkbtn { border: none; background: none; color: var(--accent-hover); font: inherit; font-size: 12.5px;
  cursor: pointer; padding: 0; text-decoration: underline; }
.reg-cap { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }
.ptable th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.ptable th.sortable:hover { color: var(--text); }
.ptable th.sort-asc::after { content: " ↑"; color: var(--accent); }
.ptable th.sort-desc::after { content: " ↓"; color: var(--accent); }
.u-label { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-meta { color: var(--muted); font-size: 12.5px; margin-left: auto; flex-shrink: 0; }
.ta-r { text-align: right; }
.chk-late { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--surface); white-space: nowrap; }
.chk-late input { accent-color: var(--accent); }

/* ---------- Info & credenziali (dettaglio cliente) ---------- */
.info-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 18px; }
.info-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.info-row .info-label { color: var(--muted); min-width: 92px; font-weight: 500; flex-shrink: 0; }
.info-row a { color: var(--accent); text-decoration: none; word-break: break-all; }
.info-row a:hover { text-decoration: underline; }
.info-row .info-val { color: var(--text-2); word-break: break-all; }
.info-row .grow { flex: 1; }
.cred-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; background: var(--surface-2); }
.cred-title { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.cred-title .ic { color: var(--muted); }
.cred-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.cred-row:last-child { margin-bottom: 0; }
.cred-row .cred-label { color: var(--muted); min-width: 84px; font-size: 12.5px; flex-shrink: 0; }
.cred-input { flex: 1; min-width: 0; border: 1px solid var(--border-strong); border-radius: 7px; padding: 7px 10px;
  font: inherit; font-size: 13px; background: var(--surface); color: var(--text); }
.cred-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Tabs (dettaglio cliente) ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 18px; }
.tab { background: none; border: none; padding: 9px 13px; font: inherit; font-weight: 600; font-size: 13px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Timeline attività ---------- */
.note-composer { display: flex; gap: 8px; margin-bottom: 20px; align-items: flex-start; }
.note-composer textarea { flex: 1; min-height: 40px; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font: inherit; resize: vertical; background: var(--surface); }
.note-composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: -2px;
  width: 2px; background: var(--border); }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--muted); flex-shrink: 0; z-index: 1; }
.tl-dot.note { color: var(--accent); border-color: #fdd9c0; background: var(--accent-soft); }
.tl-dot.create { color: var(--green); }
.tl-body { flex: 1; padding-top: 4px; min-width: 0; }
.tl-text { font-size: 13.5px; color: var(--text); }
.tl-text .stage { display: inline-flex; align-items: center; gap: 4px; }
.tl-text .stage-chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px;
  padding: 0 6px; font-size: 12px; font-weight: 500; }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tl-note-text { white-space: pre-wrap; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { background: var(--text); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px); transition: .25s; font-weight: 500; font-size: 13.5px; max-width: 320px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.cal-head h2 { margin: 0 12px 0 4px; font-size: 17px; font-weight: 600; text-transform: capitalize; min-width: 180px; letter-spacing: -.01em; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: var(--surface); padding: 9px; text-align: center; font-weight: 600; font-size: 11.5px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { background: var(--surface); min-height: 100px; padding: 7px; cursor: pointer; transition: background .12s; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.other { background: #fcfcfd; }
.cal-cell.other .dnum { color: var(--muted-2); }
.cal-cell .dnum { font-size: 12.5px; font-weight: 600; display: inline-block; width: 22px; height: 22px;
  line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-cell.today { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.today:hover { background: var(--accent-soft); }
.cal-cell.today .dnum { background: var(--accent); color: #fff; border-radius: 50%; }
.cal-ev { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); border-radius: 5px;
  padding: 2px 6px; font-size: 11px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cal-ev.t-scadenza { background: var(--red-soft); border-color: #fbd5d5; color: var(--red); }
.cal-ev.t-consegna { background: var(--green-soft); border-color: #c9f0d4; color: var(--green); }
.cal-ev.t-call { background: var(--accent-soft); border-color: #fdd9c0; color: var(--accent-hover); }

/* Calendario: scadenze automatiche + legenda */
.cal-ev.cal-proj { background: var(--accent-soft); border-color: #fdd9c0; color: var(--accent-hover);
  border-left: 3px solid var(--accent); }
.cal-ev.cal-task { background: var(--green-soft); border-color: #c9f0d4; color: var(--green);
  border-left: 3px solid var(--green); }
.cal-more { font-size: 10.5px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.cal-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-legend .lg-ev { background: var(--surface-2); border: 1px solid var(--border-strong); }
.cal-legend .lg-proj { background: var(--accent); }
.cal-legend .lg-task { background: var(--green); }
.cal-ev .avatar-mem { flex-shrink: 0; }
.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* Vista Giorno (ore, per fissare appuntamenti) */
.day-hint { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.day-hint .ic { color: var(--accent); }
.day-allday { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.day-allday .cal-ev { margin-top: 0; cursor: pointer; }
.day-grid { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.day-hour { display: grid; grid-template-columns: 62px 1fr; border-top: 1px solid var(--border); min-height: 50px; }
.day-hour:first-child { border-top: none; }
.day-hour-label { font-size: 12px; color: var(--muted); padding: 7px 10px 0 0; text-align: right; font-variant-numeric: tabular-nums; }
.day-hour-slot { padding: 5px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 5px;
  border-left: 1px solid var(--border); transition: background .12s; }
.day-hour-slot:hover { background: var(--accent-soft); }
.day-ev { display: flex; align-items: center; gap: 9px; background: var(--accent-soft); border: 1px solid #fdd9c0;
  border-left: 3px solid var(--accent); border-radius: 7px; padding: 6px 10px; font-size: 12.5px; }
.day-ev-time { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent-hover); flex-shrink: 0; }
.day-ev-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.day-ev.t-scadenza { background: var(--red-soft); border-color: #fbd5d5; border-left-color: var(--red); }
.day-ev.t-scadenza .day-ev-time { color: var(--red); }
.day-ev.t-consegna { background: var(--green-soft); border-color: #c9f0d4; border-left-color: var(--green); }
.day-ev.t-consegna .day-ev-time { color: var(--green); }

/* Agenda (lista cronologica prossimi 14 giorni) */
.agenda { display: flex; flex-direction: column; gap: 4px; }
.agenda-day { display: grid; grid-template-columns: 140px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.agenda-day:first-child { border-top: none; }
.agenda-date { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: capitalize; padding-top: 6px; }
.agenda-date.is-today { color: var(--accent); }
.agenda-items { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.agenda-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color .15s; }
.agenda-item:hover { border-color: var(--muted-2); }
.agenda-item.cal-proj { border-left: 3px solid var(--accent); }
.agenda-item.cal-task { border-left: 3px solid var(--green); }
.agenda-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--text-2); min-width: 42px; }
.agenda-title { flex: 1; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-sub { font-size: 12px; color: var(--muted); flex-shrink: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Appuntamenti nella pagina progetto */
.appt-box { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface-2); }
.appt-head { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.appt-head .ic { color: var(--muted); }
.appt-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.appt-row:first-of-type { border-top: none; }
.appt-title { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-when { font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* La tua giornata (dashboard) */
.today-box { margin: 22px 0 6px; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.today-head { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.today-head .ic { color: var(--accent); }
.today-date { font-weight: 500; font-size: 12.5px; color: var(--muted); text-transform: capitalize; }
.today-list { display: flex; flex-direction: column; gap: 6px; }
.today-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.today-row.clickable { cursor: pointer; transition: background .15s; }
.today-row.clickable:hover { background: var(--accent-soft); }
.today-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--text-2); min-width: 42px; }
.today-label { flex: 1; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }

.loading { text-align: center; color: var(--muted); padding: 48px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 258px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; margin: -20px -16px 18px; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(24,24,27,.45); z-index: 50; }
  .content { padding: 20px 16px; }
}

/* ---- Carico di lavoro (pagina Compiti) ---- */
.load-panel { display: flex; flex-direction: column; gap: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 16px; }
.load-row { display: grid; grid-template-columns: 190px 1fr auto; align-items: center; gap: 12px;
  padding: 6px 8px; border: none; background: none; border-radius: var(--radius-sm);
  cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.load-row:hover { background: var(--surface-2); }
.load-row.active { background: var(--accent-soft); }
.load-who { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.load-none { display: inline-flex; align-items: center; gap: 6px; color: var(--amber); }
.load-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.load-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; min-width: 2px; }
.load-nums { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.load-nums b { color: var(--text); font-size: 13px; }
.ln-late { color: var(--red); font-weight: 600; }
.ln-rev { color: var(--amber); font-weight: 600; }
@media (max-width: 720px) {
  .load-row { grid-template-columns: 130px 1fr; }
  .load-nums { grid-column: 1 / -1; padding-left: 2px; }
}

/* ---- Compiti aperti nella pagina cliente ---- */
.cli-req-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px;
  margin: 18px 0 8px; color: var(--text-2); }
.cli-req-h .count { color: var(--muted); font-weight: 600; }

/* ---- Richieste: contatore scope mensile ---- */
.chip-scope { background: var(--surface-2); color: var(--muted); }
.chip-scope.over { background: var(--red-soft); color: var(--red); font-weight: 700; }

/* ---- Chat interna del team ---- */
.chat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); overflow: hidden;
  height: calc(100vh - 168px); min-height: 460px; }
.chat-side { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px; }
.chat-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted-2); margin: 14px 8px 6px; }
.chat-side .chat-sec:first-child { margin-top: 4px; }
.chat-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; border: none;
  background: none; border-radius: var(--radius-sm); cursor: pointer; font: inherit; text-align: left; color: var(--text); }
.chat-row:hover { background: var(--surface-2); }
.chat-row.active { background: var(--accent-soft); }
.chat-row.unread .chat-row-title { font-weight: 700; }
.chat-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent));
  flex: 0 0 auto; margin: 0 8px; }
.chat-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-row-title { font-size: 13.5px; line-height: 1.25; }
.chat-row-prev { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14.5px; }
.chat-head .sub { font-weight: 500; font-size: 12px; color: var(--muted); }
.chat-back { display: none; }
#chat-list { flex: 1; max-height: none; margin-bottom: 0; padding: 16px; }
.chat-foot { border-top: 1px solid var(--border); padding: 10px 12px; }
@media (max-width: 860px) {
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 148px); }
  .chat-main { display: none; }
  .chat-layout.show-conv .chat-side { display: none; }
  .chat-layout.show-conv .chat-main { display: flex; }
  .chat-back { display: inline-flex; }
}

/* ---- Centro di controllo Ads ---- */
.adc-list { display: flex; flex-direction: column; gap: 8px; }
.adc-row { display: grid; grid-template-columns: minmax(200px, 1.4fr) repeat(3, minmax(110px, 1fr)) auto;
  gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; cursor: pointer; }
.adc-row:hover { border-color: var(--border-strong); }
.adc-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.adc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.adc-flag { color: var(--amber); font-weight: 700; font-size: 11px; }
.adc-cell { display: flex; flex-direction: column; gap: 1px; }
.adc-lab { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); }
.adc-val { font-size: 13px; font-weight: 600; }
.adc-cell.ok .adc-val { color: var(--green); }
.adc-cell.bad .adc-val { color: var(--red); }
.adc-cell.warn .adc-val { color: var(--amber); }
.adc-actions { display: flex; gap: 6px; }
@media (max-width: 900px) {
  .adc-row { grid-template-columns: 1fr 1fr; }
  .adc-main { grid-column: 1 / -1; }
  .adc-actions { grid-column: 1 / -1; }
}

/* ---- Incassi ---- */
.pay-list { display: flex; flex-direction: column; gap: 8px; }
.pay-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) auto auto auto; gap: 14px;
  align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 16px; cursor: pointer; }
.pay-row:hover { border-color: var(--border-strong); }
.pay-row.late { border-left: 3px solid var(--red); }
.pay-row.soft { opacity: .75; cursor: default; }
.pay-row.off { opacity: .55; }
.pay-title { font-weight: 600; font-size: 13.5px; }
.pay-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.pay-due { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pay-amount { font-weight: 700; font-size: 14px; white-space: nowrap; text-align: right; min-width: 84px; }
.pay-amount small { color: var(--muted); font-weight: 500; }
.pt-late { color: var(--red); font-weight: 600; }
@media (max-width: 760px) {
  .pay-row { grid-template-columns: 1fr auto; }
  .pay-due { grid-column: 1; }
}

/* ---- Report ---- */
.rep-h { font-size: 15px; font-weight: 700; margin: 26px 0 10px; }
.rep-h:first-of-type { margin-top: 4px; }

/* ---- Badge piattaforma ads: verde Google, blu Meta, ambra = storico da dividere ---- */
.chip-channel.ch-g { background: #e6f4ea; color: #188038; font-weight: 700; }
.chip-channel.ch-m { background: #e7f0fe; color: #0866ff; font-weight: 700; }
.chip-channel.ch-b { background: var(--amber-soft); color: var(--amber); font-weight: 700; }
.sold-channels { display: flex; align-items: center; gap: 14px; margin: -4px 0 8px 30px; }
.sold-ch-hint { font-size: 11.5px; color: var(--muted-2); }

/* ---- Commessa: progetti fratelli nel workspace ---- */
.sib-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.sib-warn { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
  color: var(--amber); background: var(--amber-soft); border-radius: var(--radius-sm); padding: 7px 10px; }
.sib-row { display: grid; grid-template-columns: auto auto minmax(80px, auto) 1fr auto auto; gap: 10px;
  align-items: center; padding: 6px 8px; border: none; background: none; border-radius: var(--radius-sm);
  cursor: pointer; font: inherit; color: var(--text); text-align: left; }
.sib-row:hover { background: var(--surface-2); }
.sib-stage { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sib-bar { min-width: 60px; }
.sib-flag { font-size: 11px; font-weight: 700; color: var(--amber); white-space: nowrap; }
.sib-flag.ahead { color: var(--green); }
@media (max-width: 720px) { .sib-row { grid-template-columns: auto auto 1fr; } .sib-bar { grid-column: 1 / -1; } }

/* ---- Cronologia v2 ---- */
.tl-day { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; }
.tl-day::before, .tl-day::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.tl-day span { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--muted-2);
  white-space: nowrap; text-transform: capitalize; }
.tl-dot.move { background: var(--accent-soft); color: var(--accent); }
.stage-chip.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tl-meta .avatar-mem { vertical-align: -3px; }

/* ---- Progetti: colonna sito + pannello WHM ----
   I due pannelli vanno distinti a colpo d'occhio: s13616 e' lo storico
   (Angelo Roych, quasi tutto Divi), s15256 e' dove va il nuovo (HTML). */
.pt-dom { font-size: 13px; color: var(--text-2); }
.chip-pan { font-variant-numeric: tabular-nums; font-weight: 600; }
.chip-pan.pan-s13616 { color: var(--amber); border-color: #f4e3c0; background: var(--amber-soft); }
.chip-pan.pan-s15256 { color: var(--green); border-color: #cdeccf; background: var(--green-soft); }

/* ---- Servizi: modifica in linea (stato e azione sul dominio) ----
   Select compatti dentro la riga: con 300 righe aprire un modale
   per ogni modifica rende la pagina inutilizzabile. */
.sel-stato, .sel-azione { height: 28px; padding: 0 22px 0 8px; font-size: 12.5px;
  min-width: 132px; width: auto; border-radius: var(--radius-sm); background-position: right 6px center; }
.sel-stato { color: var(--text-2); }
.pay-row.late .sel-stato { border-color: #f3c7c7; }
.sel-nota { font-size: 11px; color: var(--muted-2); margin-top: 3px; max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Board "tutte le fasi" (come Bitrix): colonne piu' strette,
   con la macro-fase sotto il titolo per non perdere l'orientamento ---- */
.column.column-sub { width: 210px; min-width: 210px; }
.column.column-sub .column-head span:first-child { font-size: 12.5px; line-height: 1.25; }
.column-macro { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted-2); padding: 0 12px 6px; border-bottom: 1px solid var(--border); }
/* Vista piatta: le sotto-fasi senza card si stringono a linguetta verticale.
   Restano bersagli del drag: trascinandoci sopra una card si riaprono da sole. */
.column.column-vuota { width: 46px; min-width: 46px; }
.column.column-vuota .column-head { writing-mode: vertical-rl; padding: 14px 8px;
  gap: 8px; justify-content: flex-start; color: var(--muted); }
.column.column-vuota .column-head span:first-child { white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-height: 220px; }
.column.column-vuota .column-head .count,
.column.column-vuota .column-macro { display: none; }
.column.column-vuota .column-body { min-height: 40px; }
.column.column-vuota.drag-over { width: 210px; min-width: 210px; }
.column.column-vuota.drag-over .column-head { writing-mode: horizontal-tb; }

/* --- Registro progetti: righe a due piani, fase con avanzamento --- */
.ptable td { padding: 12px 14px; }
.pt-sub { display: flex; gap: 6px; align-items: center; margin-top: 4px; white-space: nowrap; }
.pt-sub .pt-dom { font-size: 12px; color: var(--muted); font-weight: 400; }
.pt-sub .chip { font-size: 10.5px; padding: 1px 7px; }
.pt-cli a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted-2); }
.pt-cli a:hover { color: var(--accent-hover); border-bottom-color: var(--accent); }
.pt-fase { min-width: 190px; }
.fase-line { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.fase-name { font-weight: 600; font-size: 12.5px; }
.fase-step { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fase-bar { height: 4px; max-width: 170px; border-radius: 2px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.fase-bar i { display: block; height: 100%; border-radius: 2px; background: var(--green); }
.fase-bar.fb-late i { background: var(--red); }
.fase-bar.fb-wait i { background: var(--amber); }
.pt-noresp { font-size: 11px; color: var(--red); border: 1px dashed #f7c1c1; border-radius: 999px;
  padding: 2px 9px; background: var(--red-soft); white-space: nowrap; }
.pt-canone { color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.pt-canone-ins { color: var(--red); }

/* --- Posta v2: non lette, lettore, composer --- */
.mail-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: transparent; }
.mail-dot.on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mail-row.mail-unread .mail-chi { font-weight: 700; }
.mail-row.mail-unread .mail-sub .ogg { font-weight: 600; color: var(--text); }
.mail-row.mail-unread { background: #fffdfa; }
.mail-row.mail-unread:hover { background: var(--accent-soft); }

.mail-reader .mr-head { display: flex; gap: 12px; align-items: flex-start; }
.mail-reader .mr-who { min-width: 0; flex: 1; }
.mail-reader .mr-da { font-size: 14.5px; }
.mail-reader .mr-addr { color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.mail-reader .mr-a { color: var(--muted); font-size: 12.5px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-reader .mr-quando { text-align: right; font-size: 12px; color: var(--muted); line-height: 2; flex-shrink: 0; }
.mail-reader .mr-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.mail-reader .mr-corpo { border-top: 1px solid var(--border); padding-top: 14px;
  white-space: pre-wrap; font-size: 13.5px; line-height: 1.65; max-height: 52vh; overflow: auto;
  overflow-wrap: break-word; }
.mail-reader .mr-corpo a { color: var(--accent-hover); }
.mail-quote { border-left: 3px solid var(--border); margin: 6px 0; padding: 2px 0 2px 12px;
  color: var(--muted); }
.mail-prev { margin-top: 10px; }
.mail-prev summary { cursor: pointer; color: var(--muted); font-size: 12.5px;
  padding: 6px 10px; background: var(--surface-2); border-radius: 8px; display: inline-block; }
.mail-prev[open] summary { margin-bottom: 8px; }
.mail-prev > *:not(summary) { color: var(--muted); }

.mail-composer .field { margin-bottom: 10px; }
.mail-composer label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }

/* --- Posta v3: split view stile client --- */
.mail-split { display: grid; grid-template-columns: minmax(330px, 400px) 1fr; gap: 14px;
  align-items: start; }
@media (max-width: 980px) { .mail-split { grid-template-columns: 1fr; } }
.mail-colL { min-width: 0; }
.mail-strumenti { display: flex; gap: 6px; margin-bottom: 8px; }
.mail-strumenti .input { font-size: 13px; }
.mail-lista { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  max-height: calc(100vh - 320px); overflow-y: auto; padding: 4px; }
.mail-lista .mail-day { position: sticky; top: 0; background: var(--surface); z-index: 1;
  padding: 8px 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }
.mrow { display: flex; gap: 10px; padding: 10px; border-radius: 10px; cursor: pointer;
  transition: background .1s; }
.mrow:hover { background: var(--surface-2); }
.mrow-sel { background: var(--accent-soft) !important; }
.mrow-ava { width: 34px; height: 34px; border-radius: 50%; color: #fff; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
  margin-top: 2px; }
.mrow-main { min-width: 0; flex: 1; }
.mrow-top { display: flex; align-items: baseline; gap: 8px; }
.mrow-chi { font-weight: 500; font-size: 13.5px; flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.mrow-ora { font-size: 11.5px; color: var(--muted); flex-shrink: 0; display: inline-flex;
  align-items: center; gap: 5px; }
.mail-pallino { width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  display: inline-block; }
.mrow-ogg { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-top: 1px; }
.mrow-ant { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-top: 2px; display: flex; gap: 5px; align-items: center; }
.mrow-ant .chip { font-size: 10px; padding: 0 6px; flex-shrink: 0; }
.mrow-unread .mrow-chi { font-weight: 800; }
.mrow-unread .mrow-ogg { font-weight: 600; color: var(--text); }
.mail-colR { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  min-height: 420px; max-height: calc(100vh - 260px); overflow-y: auto; padding: 16px 20px;
  position: sticky; top: 12px; }
.mail-vuoto { height: 100%; min-height: 380px; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; color: var(--muted-2); }
.mr-azioni { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.mr-oggetto { font-size: 18px; margin: 12px 0 8px; line-height: 1.35; }
.mr-allegati { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.mr-file { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 10px; padding: 7px 11px; font-size: 12.5px;
  cursor: pointer; transition: border-color .12s, background .12s; max-width: 100%; }
.mr-file:hover { border-color: var(--accent); background: var(--accent-soft); }
.mr-file-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.mr-file .mr-giu { color: var(--accent-hover); transform: rotate(180deg); }
.mr-file small { color: var(--muted); }
.mail-intro { font-size: 11.5px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.mail-fresh { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ============================================================
   RESTYLING 2026 — livello di rifinitura moderno.
   Override consapevoli sopra il sistema esistente: profondita'
   morbida, stati attivi col brand, micro-interazioni. Niente
   cambi strutturali: solo qualita' visiva.
   ============================================================ */

:root {
  --bg: #f6f6f7;
  --shadow-sm: 0 1px 2px rgba(24,24,27,.04);
  --shadow: 0 1px 2px rgba(24,24,27,.04), 0 8px 24px rgba(24,24,27,.06);
  --shadow-lg: 0 24px 60px rgba(24,24,27,.18);
}

/* --- Sidebar: gerarchia piu' netta, voce attiva col brand --- */
.sidebar { box-shadow: inset -1px 0 0 rgba(24,24,27,.02); }
.brand { font-size: 16.5px; }
.nav a { border-radius: 9px; padding: 8.5px 11px; }
.nav a.active { background: var(--accent-soft); color: var(--accent-hover); box-shadow: inset 0 0 0 1px #fde4d2; }
.nav a.active .ic { color: var(--accent); }
.nav-badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 10.5px;
  font-weight: 700; padding: 0 5px; }

/* --- Bottoni: profondita' e focus visibile --- */
.btn { border-radius: 9px; }
.btn-primary { background: linear-gradient(180deg, #f4691f, var(--accent)); border-color: var(--accent-hover);
  box-shadow: 0 1px 2px rgba(194,65,12,.35), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primary:hover { background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  box-shadow: 0 2px 6px rgba(194,65,12,.4), inset 0 1px 0 rgba(255,255,255,.14); }
.btn-primary:active { transform: translateY(.5px); }
.btn-ghost:hover { border-color: var(--muted-2); box-shadow: var(--shadow-sm); }
.btn:focus-visible, .input:focus-visible, .seg-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Carte e pannelli: bordo tenue + ombra soffice + hover --- */
.stat-card { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, border-color .18s, transform .18s; }
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card .label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { margin-top: 9px; font-size: 27px; }
.stat-card.hot { background: linear-gradient(180deg, #fff, #fffbf9); border-color: #f7d8c4; }
.table-wrap, .mail-lista, .mail-colR, .column { box-shadow: var(--shadow-sm); }
.table-wrap { border-radius: var(--radius-lg); }
.ptable thead th { background: var(--surface); position: sticky; top: 0; z-index: 2;
  box-shadow: inset 0 -1px 0 var(--border); }
.ptable tbody tr:hover { background: #fbf7f4; }

/* --- Kanban: colonne leggere, card con lift --- */
.column { background: #f1f1f3; }
.card { box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--border-strong); }

/* --- Chips: pillole vere --- */
.chip { border-radius: 999px; }

/* --- Input e segmenti --- */
.input { border-radius: 9px; transition: border-color .15s, box-shadow .15s; }
.seg { border-radius: 11px; }
.seg-btn { border-radius: 8px; }

/* --- Modali: blur dietro, piu' aria --- */
.modal-overlay { background: rgba(24,24,27,.4); backdrop-filter: blur(3px); }
.modal { border-radius: 16px; box-shadow: var(--shadow-lg); }

/* --- Titoli pagina --- */
.page-head h1 { font-size: 23px; letter-spacing: -.025em; }

/* --- Scrollbar sottili ovunque --- */
* { scrollbar-width: thin; scrollbar-color: #d4d4d8 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 999px;
  border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b9b9bf; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* --- Posta: rifiniture della split view --- */
.mail-lista { border-radius: var(--radius-lg); }
.mail-colR { border-radius: var(--radius-lg); }
.mrow { border-radius: 11px; }

/* --- Toast piu' morbidi (se presenti) --- */
.toast { border-radius: 12px; box-shadow: var(--shadow-lg); }
.mr-frame { width: 100%; border: 0; display: block; min-height: 180px; }
.seg-chip-warn { color: var(--red); border-color: #f7c1c1; background: var(--red-soft); }
.seg-chip-warn.active { background: var(--red); color: #fff; border-color: var(--red); }
.cc-rotta { margin: 8px 0 2px; font-size: 12px; color: var(--red); background: var(--red-soft);
  border: 1px dashed #f7c1c1; border-radius: 8px; padding: 5px 9px; display: flex; gap: 6px; align-items: center; }
