/* Gerbaldo Polimeri — Sales Intelligence Assistant
   Design system: dark premium, glass, teal Gerbaldo */

:root {
  --page: #07090b;
  --surface: rgba(255,255,255,0.035);
  --surface-solid: #101416;
  --surface-2: rgba(255,255,255,0.05);
  --surface-3: rgba(255,255,255,0.09);
  --ink: #f4f7f7;
  --ink-2: #b8c2c2;
  --ink-muted: #79878a;
  --grid: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --accent: #00abaa;
  --accent-2: #00d4d3;
  --accent-ink: #4ee0da;
  --accent-soft: rgba(0,171,170,0.12);
  --grad-accent: linear-gradient(120deg, #00abaa, #00d4d3);
  --good: #2ecc71;
  --warning: #f5b82e;
  --serious: #ec835a;
  --critical: #e05252;
  --violet: #9085e9;
  --radius: 16px;
  --radius-s: 11px;
  --font: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --shadow-card: 0 8px 28px rgba(0,0,0,0.35);
  --shadow-pop: 0 20px 70px rgba(0,0,0,0.55);
  --good-ink: #7be3a1;
  --warn-ink: #ffc46b;
  --bad-ink: #ff8f8f;
  --fill-neutral: rgba(255,255,255,0.25);
}

/* ---------- Tema chiaro ---------- */

html.light {
  --page: #eef1f2;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-2: rgba(8,45,47,0.06);
  --surface-3: rgba(8,45,47,0.11);
  --ink: #141a1c;
  --ink-2: #3d4b4d;
  --ink-muted: #6d7d80;
  --grid: rgba(8,45,47,0.08);
  --border: rgba(8,45,47,0.12);
  --border-strong: rgba(8,45,47,0.2);
  --accent-ink: #00807f;
  --accent-soft: rgba(0,171,170,0.1);
  --good-ink: #158a4b;
  --warn-ink: #9a6c00;
  --bad-ink: #c23a3a;
  --fill-neutral: rgba(8,45,47,0.28);
  --shadow-card: 0 8px 24px rgba(25,60,62,0.08);
  --shadow-pop: 0 20px 60px rgba(25,60,62,0.2);
}
html.light .bg-hex { color: rgba(0,90,90,0.045); }
html.light .bg-glow { opacity: .28; }
html.light .sidebar { background: rgba(255,255,255,0.82); }
html.light .chatpanel { background: rgba(252,254,254,0.9); }
html.light .modal { background: #fdfefe; }
html.light .toast { background: #ffffff; box-shadow: 0 12px 40px rgba(20,50,52,0.16), 0 0 24px rgba(0,171,170,0.1); }
html.light .chart-tooltip { background: rgba(255,255,255,0.97); }
html.light .hero { background: linear-gradient(125deg, rgba(0,171,170,0.1), rgba(0,110,160,0.04) 55%, rgba(255,255,255,0.55)); }
html.light.mobile .chatpanel { background: rgba(250,252,252,0.98); }
html.light.mobile .tabbar { background: rgba(255,255,255,0.93); }
html.light ::-webkit-scrollbar-thumb { background: rgba(20,50,52,0.22); background-clip: padding-box; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Sfondo scenografico ---------- */

.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; }
.bg-glow.g1 { width: 640px; height: 640px; top: -240px; left: -160px; background: radial-gradient(circle, rgba(0,171,170,0.32), transparent 65%); animation: drift1 26s ease-in-out infinite alternate; }
.bg-glow.g2 { width: 540px; height: 540px; bottom: -220px; right: 320px; background: radial-gradient(circle, rgba(0,110,160,0.25), transparent 65%); animation: drift2 32s ease-in-out infinite alternate; }
.bg-glow.g3 { width: 420px; height: 420px; top: 30%; left: 46%; background: radial-gradient(circle, rgba(222,220,0,0.05), transparent 60%); }
@keyframes drift1 { to { transform: translate(70px, 50px) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-60px, -40px) scale(1.05); } }
.bg-hex { position: absolute; inset: 0; color: rgba(255,255,255,0.022); }

.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 244px 1fr 404px;
  height: 100vh;
}
.app.chat-closed { grid-template-columns: 244px 1fr 0; }
.app.chat-closed .chatpanel { display: none; }
.app.chat-closed .chat-fab { display: flex; }

/* ---------- Sidebar ---------- */

.sidebar {
  background: rgba(10,13,15,0.72);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 16px 18px;
}

.brand { display: flex; flex-direction: column; gap: 9px; padding: 2px 8px 24px; }
.brand-logo { width: 100%; max-width: 180px; height: auto; display: block; }
.brand-sub {
  font-size: 9.5px; color: var(--accent-ink); font-weight: 700; letter-spacing: 2.2px;
  display: flex; align-items: center; gap: 7px;
}
.brand-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); animation: pulse-dot 2.4s infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-sep {
  font-size: 9px; font-weight: 700; letter-spacing: 1.8px; color: var(--ink-muted);
  padding: 18px 12px 7px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10.5px 13px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background .18s, color .18s, border-color .18s;
}
.nav-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: linear-gradient(120deg, rgba(0,171,170,0.16), rgba(0,212,211,0.06));
  border-color: rgba(0,171,170,0.35);
  color: var(--accent-ink);
  box-shadow: 0 0 22px rgba(0,171,170,0.12), inset 0 0 18px rgba(0,171,170,0.05);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px; background: var(--grad-accent);
  box-shadow: 0 0 10px var(--accent-2);
}
.nav-badge {
  margin-left: auto; background: var(--grad-accent); color: #032;
  font-size: 10.5px; font-weight: 800; border-radius: 20px;
  padding: 1.5px 8px; min-width: 21px; text-align: center;
  font-family: var(--font-display);
}
.nav-badge.critical { background: linear-gradient(120deg, #e05252, #ff7a6e); color: #2a0505; box-shadow: 0 0 12px rgba(224,82,82,0.35); }

.sidebar-footer { margin-top: auto; padding: 14px 4px 0; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 6px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, #1d2b2e, #12191b);
  border: 1px solid var(--border-strong);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; font-family: var(--font-display);
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--ink-muted); }
.demo-tag { margin-top: 11px; font-size: 8.5px; letter-spacing: 1.6px; color: var(--ink-muted); text-align: center; }

/* ---------- Main ---------- */

.main { overflow-y: auto; padding: 30px 34px 70px; }

.view-header { margin-bottom: 24px; }
.view-kicker {
  font-size: 10.5px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block;
}
.view-title { font-family: var(--font-display); font-size: 27px; font-weight: 700; letter-spacing: -.3px; margin-top: 3px; }
.view-sub { color: var(--ink-muted); font-size: 13px; margin-top: 4px; max-width: 720px; }

/* entrance animation */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.view > * { animation: rise .45s cubic-bezier(.2,.7,.3,1) both; }
.view > *:nth-child(2) { animation-delay: .06s; }
.view > *:nth-child(3) { animation-delay: .12s; }
.view > *:nth-child(4) { animation-delay: .18s; }
.view > *:nth-child(5) { animation-delay: .24s; }

.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 16px; }

.section-title { font-family: var(--font-display); font-size: 15.5px; font-weight: 700; margin-bottom: 3px; letter-spacing: .1px; }
.section-sub { font-size: 12px; color: var(--ink-muted); margin-bottom: 15px; }

.ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2.5px; }

/* ---------- Hero assistente ---------- */

.hero {
  position: relative; overflow: hidden;
  display: flex; gap: 18px; align-items: flex-start;
  background: linear-gradient(125deg, rgba(0,171,170,0.13), rgba(0,110,160,0.05) 55%, rgba(255,255,255,0.02));
  border: 1px solid rgba(0,171,170,0.30);
  border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 24px;
  box-shadow: 0 0 44px rgba(0,171,170,0.10), var(--shadow-card);
}
.hero::after {
  content: ''; position: absolute; top: -70px; right: -50px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(0,212,211,0.14), transparent 65%);
  pointer-events: none;
}
.hero-avatar {
  position: relative;
  width: 50px; height: 50px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 32% 28%, #29d3cf, #007a79 70%);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; color: #eafffe;
}
.hero-avatar::before {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 10%, rgba(0,212,211,0.85), transparent 55%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: spin 3.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero-label { font-size: 10.5px; font-weight: 700; letter-spacing: 1.8px; color: var(--accent-ink); text-transform: uppercase; margin-bottom: 6px; }
.hero-text { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); max-width: 780px; }
.hero-text b { color: var(--ink); }
.hero-actions { margin-top: 14px; display: flex; gap: 10px; position: relative; z-index: 1; }

/* ---------- Bottoni ---------- */

.btn {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 17px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
  transition: transform .15s, box-shadow .15s, filter .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--grad-accent); color: #01302f;
  box-shadow: 0 4px 18px rgba(0,171,170,0.35);
}
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 6px 24px rgba(0,171,170,0.5); }
.btn.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--border-strong); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: 6px 13px; font-size: 12px; border-radius: 9px; }
.btn.wa { background: linear-gradient(120deg, #1faf55, #29d472); color: #06280f; box-shadow: 0 4px 18px rgba(31,175,85,0.3); }
.btn.wa:hover { filter: brightness(1.08); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- KPI ---------- */

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 24px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px 19px 15px;
  box-shadow: var(--shadow-card);
  transition: transform .2s, border-color .2s;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-label { font-size: 10.5px; color: var(--ink-muted); font-weight: 700; letter-spacing: 1.2px; }
.kpi-ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-ink);
}
.kpi-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.kpi-ico.warn { background: rgba(245,184,46,0.12); color: var(--warning); }
.kpi-value { font-family: var(--font-display); font-size: 27px; font-weight: 700; margin-top: 7px; letter-spacing: -.4px; }
.kpi-delta { font-size: 12px; margin-top: 2px; font-weight: 600; }
.kpi-delta.up { color: var(--good); }
.kpi-delta.warn { color: var(--serious); }
.kpi-delta.neutral { color: var(--ink-muted); font-weight: 500; }
.kpi-bar { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.kpi-bar > div { height: 100%; border-radius: 4px; background: var(--grad-accent); box-shadow: 0 0 8px rgba(0,212,211,0.5); transition: width 1s cubic-bezier(.2,.7,.3,1); }
.kpi-target { font-size: 11px; color: var(--ink-muted); margin-top: 5px; }

/* ---------- Layout dashboard ---------- */

.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 17px; align-items: start; }

/* ---------- Priority feed ---------- */

.prio-list { display: flex; flex-direction: column; gap: 11px; }
.prio {
  position: relative;
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 13px; padding: 14px 16px 14px 18px; cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
  overflow: hidden;
}
.prio::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.prio.alta::before { background: linear-gradient(180deg, #e05252, #a33); box-shadow: 0 0 10px rgba(224,82,82,0.6); }
.prio.media::before { background: linear-gradient(180deg, #f5b82e, #c8901a); }
.prio.bassa::before { background: linear-gradient(180deg, #2ecc71, #1d9251); }
.prio:hover { border-color: rgba(0,171,170,0.45); background: var(--surface-3); transform: translateX(3px); box-shadow: 0 6px 22px rgba(0,0,0,0.35); }
.prio-rank {
  width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13.5px; font-weight: 700; margin-top: 1px;
  font-family: var(--font-display);
  background: var(--surface-2); border: 1px solid var(--border);
}
.prio.alta .prio-rank { color: var(--bad-ink); }
.prio.media .prio-rank { color: var(--warning); }
.prio.bassa .prio-rank { color: var(--good); }
.prio-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prio-why { color: var(--ink-2); font-size: 12.5px; margin-top: 4px; }
.prio-action { color: var(--accent-ink); font-size: 12.5px; margin-top: 6px; font-weight: 600; }

.chip {
  font-size: 10.5px; font-weight: 700; padding: 2.5px 10px; border-radius: 20px;
  letter-spacing: .4px; display: inline-flex; align-items: center; gap: 5px;
}
.chip .ico { width: 12px; height: 12px; }
.chip.canale { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border-strong); }
.chip.livello-alta { background: rgba(224,82,82,0.14); color: var(--bad-ink); border: 1px solid rgba(224,82,82,0.3); }
.chip.livello-media { background: rgba(245,184,46,0.11); color: var(--warning); border: 1px solid rgba(245,184,46,0.28); }
.chip.livello-bassa { background: rgba(46,204,113,0.10); color: var(--good); border: 1px solid rgba(46,204,113,0.26); }

/* ---------- Grafico ---------- */

.chart-card { margin-bottom: 17px; }
.chart-wrap { position: relative; }
.chart-tooltip {
  position: absolute; pointer-events: none; display: none;
  background: rgba(16,22,24,0.95); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 7px 11px; font-size: 12px;
  box-shadow: var(--shadow-pop); white-space: nowrap; z-index: 5;
  backdrop-filter: blur(8px);
}
.tt-label { color: var(--ink-muted); font-size: 10.5px; }
.tt-value { font-weight: 700; font-family: var(--font-display); }
.tt-target { font-size: 11px; color: var(--ink-muted); }
.chart-legend { display: flex; gap: 16px; font-size: 11px; color: var(--ink-muted); margin-top: 8px; }
.chart-legend .sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: 3px; margin-right: 5px; }

@keyframes drawline { from { stroke-dashoffset: var(--len, 900); } to { stroke-dashoffset: 0; } }
.anim-line { stroke-dasharray: var(--len, 900); animation: drawline 1.4s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.anim-area { animation: fadein 1.1s .5s both; }

/* ---------- Mini list ---------- */

.mini-list { display: flex; flex-direction: column; gap: 9px; }
.mini-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 11px 13px; background: var(--surface-2); border-radius: 11px;
  border: 1px solid var(--border); cursor: pointer;
  transition: border-color .16s, transform .16s;
}
.mini-item:hover { border-color: rgba(0,171,170,0.45); transform: translateX(3px); }
.mini-item .t { font-size: 12.5px; font-weight: 600; }
.mini-item .s { font-size: 11.5px; color: var(--ink-muted); }

/* ---------- Tabella clienti ---------- */

table.clients { width: 100%; border-collapse: collapse; }
table.clients th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--ink-muted); font-weight: 700; padding: 11px 15px;
  border-bottom: 1px solid var(--grid);
}
table.clients td { padding: 13px 15px; border-bottom: 1px solid var(--grid); font-size: 13px; }
table.clients tr:last-child td { border-bottom: none; }
table.clients tr.row { cursor: pointer; transition: background .13s; }
table.clients tr.row:hover { background: rgba(0,171,170,0.05); }
.cl-cell { display: flex; align-items: center; gap: 12px; }
.cl-avatar {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; font-family: var(--font-display);
  border: 1px solid var(--border-strong);
}
.cl-name { font-weight: 700; }
.cl-sub { font-size: 11.5px; color: var(--ink-muted); }
td.num { font-variant-numeric: tabular-nums; text-align: right; font-family: var(--font-display); font-weight: 600; }

.cl-toolbar { margin-bottom: 14px; }
.cl-search {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px;
  padding: 10px 14px; max-width: 360px;
}
.cl-search svg { width: 15px; height: 15px; fill: none; stroke: var(--ink-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.cl-search input {
  border: none; background: none; outline: none; color: var(--ink);
  font-family: inherit; font-size: 13px; width: 100%;
}
.cl-search input::placeholder { color: var(--ink-muted); }

.spark { display: block; }

/* ---------- Scheda cliente ---------- */

.back-link {
  background: none; border: none; color: var(--accent-ink); font-family: inherit;
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; margin-bottom: 16px;
  display: inline-flex; align-items: center; gap: 6px;
}
.back-link:hover { text-decoration: underline; }
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 17px; align-items: start; }

.client-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.client-title { display: flex; align-items: center; gap: 15px; }
.client-avatar-lg {
  width: 54px; height: 54px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; font-family: var(--font-display);
  border: 1px solid var(--border-strong);
}
.client-meta { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }
.client-stats { display: grid; grid-template-columns: repeat(4, auto); gap: 30px; margin: 16px 0 6px; }
.cstat-label { font-size: 10px; color: var(--ink-muted); font-weight: 700; letter-spacing: 1px; }
.cstat-value { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-top: 2px; }
.cstat-value.bad { color: var(--bad-ink); }
.quick-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.insight-card {
  position: relative; overflow: hidden;
  background: linear-gradient(125deg, rgba(0,171,170,0.13), rgba(0,110,160,0.04));
  border: 1px solid rgba(0,171,170,0.3);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 0 34px rgba(0,171,170,0.08);
}
.insight-kicker { font-size: 10px; font-weight: 700; letter-spacing: 1.6px; color: var(--accent-ink); text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.insight-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.7; margin-top: 9px; }
.insight-actions { margin-top: 13px; display: flex; gap: 9px; flex-wrap: wrap; }

/* Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(180deg, rgba(0,171,170,0.4), var(--grid)); border-radius: 2px;
}
.tl-item { position: relative; padding-bottom: 17px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -26px; top: 4px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--surface-solid); border: 2px solid var(--grid);
}
.tl-dot::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; }
.tl-dot.erp { border-color: var(--accent); } .tl-dot.erp::after { background: var(--accent); }
.tl-dot.email { border-color: var(--warning); } .tl-dot.email::after { background: var(--warning); }
.tl-dot.whatsapp { border-color: #29d472; } .tl-dot.whatsapp::after { background: #29d472; }
.tl-dot.tecnica { border-color: var(--critical); } .tl-dot.tecnica::after { background: var(--critical); }
.tl-dot.nota { border-color: var(--ink-muted); } .tl-dot.nota::after { background: var(--ink-muted); }
.tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-title { font-size: 13px; font-weight: 700; }
.tl-when { font-size: 11px; color: var(--ink-muted); }
.tl-text { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.tl-src {
  font-size: 9px; font-weight: 800; letter-spacing: .8px; padding: 1.5px 7px;
  border-radius: 5px; text-transform: uppercase;
}
.tl-src.erp { background: rgba(0,171,170,0.14); color: var(--accent-ink); }
.tl-src.email { background: rgba(245,184,46,0.12); color: var(--warning); }
.tl-src.whatsapp { background: rgba(41,212,114,0.12); color: #4fdd8b; }
.tl-src.tecnica { background: rgba(224,82,82,0.14); color: var(--bad-ink); }
.tl-src.nota { background: var(--surface-2); color: var(--ink-muted); }
.tl-item.nuovo .tl-title::after {
  content: 'ADESSO'; font-size: 8.5px; font-weight: 800; letter-spacing: 1px;
  background: var(--grad-accent); color: #01302f; border-radius: 4px; padding: 1.5px 6px; margin-left: 8px;
  vertical-align: 2px;
}

.prod-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.prod-tag {
  font-size: 11.5px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 3.5px 10px; color: var(--ink-2);
}

/* ---------- Richieste tecniche ---------- */

.sla-list { display: flex; flex-direction: column; gap: 13px; }
.sla {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  background: var(--surface); backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.sla::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3.5px; }
.sla.critico::before { background: linear-gradient(180deg, #ff6b6b, #c0392b); box-shadow: 0 0 12px rgba(224,82,82,0.6); }
.sla.attenzione::before { background: linear-gradient(180deg, #f5b82e, #c8901a); }
.sla.ok::before { background: linear-gradient(180deg, #2ecc71, #1d9251); }
.sla.critico { border-color: rgba(224,82,82,0.3); }
.sla-led { width: 14px; height: 14px; border-radius: 50%; margin: 0 6px; }
.sla.critico .sla-led { background: #ff6b6b; box-shadow: 0 0 14px rgba(255,107,107,0.8); animation: pulse-dot 1.4s infinite; }
.sla.attenzione .sla-led { background: var(--warning); box-shadow: 0 0 10px rgba(245,184,46,0.6); }
.sla.ok .sla-led { background: var(--good); box-shadow: 0 0 8px rgba(46,204,113,0.5); }
.sla-id { font-size: 10.5px; color: var(--ink-muted); font-weight: 700; letter-spacing: .8px; font-family: var(--font-display); }
.sla-obj { font-weight: 700; font-size: 14.5px; margin-top: 2px; }
.sla-meta { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }
.sla-note { font-size: 12.5px; margin-top: 7px; color: var(--ink-2); }
.sla-note strong { color: var(--bad-ink); }
.sla-days { text-align: right; }
.sla-days .n { font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.sla-days .l { font-size: 10.5px; color: var(--ink-muted); }
.sla.critico .n { color: var(--bad-ink); }
.sla.attenzione .n { color: var(--warning); }
.sla.ok .n { color: var(--good); }
.sla-bar { height: 6px; border-radius: 4px; background: var(--surface-3); margin-top: 9px; overflow: hidden; }
.sla-bar > div { height: 100%; border-radius: 4px; transition: width 1s cubic-bezier(.2,.7,.3,1); }
.sla.critico .sla-bar > div { background: linear-gradient(90deg, #e05252, #ff8f6b); box-shadow: 0 0 10px rgba(224,82,82,0.6); }
.sla.attenzione .sla-bar > div { background: linear-gradient(90deg, #c8901a, #f5b82e); }
.sla.ok .sla-bar > div { background: linear-gradient(90deg, #1d9251, #2ecc71); }

/* ---------- Opportunità ---------- */

.opp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.opp {
  background: var(--surface); backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 19px 21px; cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.opp:hover { border-color: rgba(0,171,170,0.45); transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0,0,0,0.45); }
.opp-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.opp-type {
  font-size: 9.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase;
  padding: 3.5px 10px; border-radius: 6px;
}
.opp-type.cross-selling { background: rgba(46,204,113,0.12); color: #4fdd8b; border: 1px solid rgba(46,204,113,0.3); }
.opp-type.riattivazione { background: rgba(236,131,90,0.12); color: var(--serious); border: 1px solid rgba(236,131,90,0.3); }
.opp-type.sviluppo { background: rgba(0,171,170,0.12); color: var(--accent-ink); border: 1px solid rgba(0,171,170,0.3); }
.opp-type.contratto { background: rgba(144,133,233,0.12); color: #a89ef0; border: 1px solid rgba(144,133,233,0.3); }
.opp-value { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.3px; }
.opp-title { font-weight: 700; font-size: 14.5px; }
.opp-client { font-size: 12px; color: var(--accent-ink); font-weight: 600; margin-top: 2px; }
.opp-why { font-size: 12.5px; color: var(--ink-2); margin-top: 9px; line-height: 1.6; }
.opp-prob { font-size: 11.5px; margin-top: 11px; color: var(--ink-muted); }
.opp-prob b.alta { color: var(--good); }
.opp-prob b.media { color: var(--warning); }

/* ---------- Distributori ---------- */

.dist-list { display: flex; flex-direction: column; gap: 15px; }
.dist {
  position: relative; overflow: hidden;
  background: var(--surface); backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  display: grid; grid-template-columns: 1fr auto; gap: 18px;
  box-shadow: var(--shadow-card);
}
.dist::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3.5px; }
.dist.critico::before { background: linear-gradient(180deg, #ff6b6b, #c0392b); box-shadow: 0 0 12px rgba(224,82,82,0.5); }
.dist.opportunita::before { background: var(--grad-accent); box-shadow: 0 0 12px rgba(0,212,211,0.4); }
.dist.ok::before { background: linear-gradient(180deg, #2ecc71, #1d9251); }
.dist-name { font-weight: 700; font-size: 15.5px; font-family: var(--font-display); }
.dist-zone { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.dist-signal { font-weight: 700; font-size: 13.5px; margin-top: 11px; }
.dist.critico .dist-signal { color: var(--bad-ink); }
.dist.opportunita .dist-signal { color: var(--accent-ink); }
.dist.ok .dist-signal { color: var(--good); }
.dist-why { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; max-width: 660px; }
.dist-action { font-size: 12.5px; color: var(--accent-ink); font-weight: 600; margin-top: 9px; }
.dist-fatt { text-align: right; }
.dist-fatt .n { font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.dist-fatt .l { font-size: 10.5px; color: var(--ink-muted); }

/* ---------- Direzione: team ---------- */

.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 17px; }
.tm {
  position: relative; overflow: hidden;
  background: var(--surface); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 19px 20px; box-shadow: var(--shadow-card);
  transition: transform .18s, border-color .18s;
}
.tm:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.tm.top { border-color: rgba(0,171,170,0.35); box-shadow: 0 0 30px rgba(0,171,170,0.09), var(--shadow-card); }
.tm.rischio { border-color: rgba(224,82,82,0.32); }
.tm-head { display: flex; align-items: center; gap: 12px; }
.tm-avatar {
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; font-family: var(--font-display);
  border: 1px solid var(--border-strong);
}
.tm-name { font-weight: 700; font-size: 14.5px; }
.tm-zone { font-size: 11.5px; color: var(--ink-muted); }
.tm-badge {
  margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: 1px;
  padding: 3px 9px; border-radius: 6px;
}
.tm-badge.top { background: rgba(0,212,211,0.13); color: var(--accent-ink); border: 1px solid rgba(0,212,211,0.35); }
.tm-badge.ok { background: rgba(46,204,113,0.1); color: var(--good); border: 1px solid rgba(46,204,113,0.25); }
.tm-badge.rischio { background: rgba(224,82,82,0.13); color: var(--bad-ink); border: 1px solid rgba(224,82,82,0.32); }
.tm-gauge { display: flex; align-items: center; gap: 16px; margin: 15px 0 4px; }
.ring { position: relative; width: 74px; height: 74px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: rgba(255,255,255,0.08); }
.ring .val { stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.7,.3,1); }
.ring .pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
}
.tm-nums { font-size: 12px; color: var(--ink-2); line-height: 1.9; }
.tm-nums b { font-family: var(--font-display); font-size: 13px; color: var(--ink); }
.tm-acts { display: flex; gap: 14px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--grid); }
.tm-act { text-align: center; flex: 1; }
.tm-act .n { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.tm-act .l { font-size: 9.5px; color: var(--ink-muted); letter-spacing: .6px; text-transform: uppercase; }
.tm-ai {
  margin-top: 12px; font-size: 12px; color: var(--ink-2); line-height: 1.6;
  background: rgba(0,171,170,0.06); border: 1px solid rgba(0,171,170,0.18);
  border-radius: 9px; padding: 9px 11px;
}
.tm-ai .ai-k { color: var(--accent-ink); font-weight: 700; }

/* Pipeline */
.pipe-row { display: flex; flex-direction: column; gap: 10px; }
.pipe { display: grid; grid-template-columns: 120px 1fr auto; gap: 13px; align-items: center; }
.pipe-label { font-size: 12px; color: var(--ink-2); font-weight: 600; text-align: right; }
.pipe-bar { height: 26px; border-radius: 8px; background: var(--surface-2); overflow: hidden; position: relative; }
.pipe-bar > div {
  height: 100%; border-radius: 8px;
  background: linear-gradient(90deg, rgba(0,171,170,0.75), rgba(0,212,211,0.9));
  box-shadow: 0 0 14px rgba(0,212,211,0.3);
  display: flex; align-items: center; padding-left: 10px;
  font-size: 11px; font-weight: 700; color: #01302f; font-family: var(--font-display);
  min-width: 34px;
  transition: width 1s cubic-bezier(.2,.7,.3,1);
}
.pipe-val { font-family: var(--font-display); font-size: 13px; font-weight: 700; min-width: 66px; text-align: right; }

/* ---------- Chat ---------- */

.chatpanel {
  background: rgba(10,13,15,0.78);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh;
}
.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0,171,170,0.06), transparent);
}
.chat-title { display: flex; align-items: center; gap: 12px; }
.ai-dot {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #29d3cf, #007a79 72%);
  display: flex; align-items: center; justify-content: center;
}
.ai-dot::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 12%, rgba(0,212,211,0.8), transparent 55%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  animation: spin 4s linear infinite;
}
.ai-core { color: #eafffe; font-size: 16px; }
.ai-status {
  position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%; background: #2ecc71;
  border: 2px solid #0c0f11; box-shadow: 0 0 8px rgba(46,204,113,0.8);
}
.chat-name { font-weight: 700; font-size: 13.5px; font-family: var(--font-display); }
.chat-status { font-size: 10.5px; }
.chat-status .st { display: none; }
.chat-status .st-idle { display: inline; color: var(--good); }
body.tts-on .chat-status .st-idle, body.mic-on .chat-status .st-idle { display: none; }
body.tts-on .chat-status .st-talk { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); }
body.mic-on .chat-status .st-talk { display: none; }
body.mic-on .chat-status .st-listen { display: inline-flex; align-items: center; gap: 6px; color: #ff9d9d; }

.viz { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.viz i { width: 2.5px; border-radius: 2px; background: currentColor; animation: viz 0.9s ease-in-out infinite; }
.viz i:nth-child(1) { height: 40%; animation-delay: 0s; }
.viz i:nth-child(2) { height: 90%; animation-delay: .15s; }
.viz i:nth-child(3) { height: 60%; animation-delay: .3s; }
.viz i:nth-child(4) { height: 100%; animation-delay: .45s; }
.viz i:nth-child(5) { height: 50%; animation-delay: .6s; }
@keyframes viz { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

body.tts-on .ai-dot { box-shadow: 0 0 22px rgba(0,212,211,0.55); }

.chat-actions { display: flex; gap: 7px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-2);
  width: 31px; height: 31px; border-radius: 9px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
}
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.icon-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 12px rgba(0,171,170,0.25); }
.icon-btn .wave { opacity: .25; transition: opacity .2s; }
.icon-btn.on .wave { opacity: 1; }

.chat-messages { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 15px; }

.msg { display: flex; gap: 10px; max-width: 100%; animation: rise .3s cubic-bezier(.2,.7,.3,1) both; }
.msg .avatar {
  width: 29px; height: 29px; border-radius: 50%; flex-shrink: 0; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.msg.ai .avatar { background: radial-gradient(circle at 32% 28%, #29d3cf, #007a79 72%); color: #eafffe; }
.msg.user { flex-direction: row-reverse; }
.msg.user .avatar { background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--ink-2); font-weight: 700; font-size: 10.5px; }
.bubble {
  padding: 11px 14px; border-radius: 14px; font-size: 13px; line-height: 1.65;
  white-space: pre-wrap;
}
.msg.ai .bubble {
  background: var(--surface-2); border: 1px solid var(--border);
  border-top-left-radius: 5px; color: var(--ink-2);
}
.msg.user .bubble {
  background: linear-gradient(120deg, #00807f, #00abaa); color: #eafffe;
  border-top-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(0,171,170,0.25);
}
.bubble b, .bubble strong { color: var(--ink); }
.msg.ai .bubble .b-link { color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }

.chat-suggestions { padding: 0 16px 10px; display: flex; flex-wrap: wrap; gap: 7px; }
.sugg {
  font-size: 11.5px; padding: 6px 12px; border-radius: 20px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-2);
  font-family: inherit; transition: border-color .15s, color .15s, background .15s;
}
.sugg:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }

.chat-input { display: flex; gap: 8px; padding: 13px 14px 15px; border-top: 1px solid var(--border); }
.chat-input input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 10px 15px; color: var(--ink);
  font-family: inherit; font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.chat-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,171,170,0.15); }
.send-btn, .mic-btn {
  width: 42px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: filter .15s, border-color .15s;
}
.send-btn { background: var(--grad-accent); border: none; color: #01302f; box-shadow: 0 4px 14px rgba(0,171,170,0.35); }
.send-btn:hover { filter: brightness(1.1); }
.send-btn svg, .mic-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mic-btn { background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-2); }
.mic-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.mic-btn.listening {
  background: rgba(224,82,82,0.16); border-color: var(--critical); color: #ff9d9d;
  animation: mic-pulse 1.2s infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,82,82,0.45); }
  50% { box-shadow: 0 0 0 8px rgba(224,82,82,0); }
}

.chat-fab {
  display: none; position: fixed; bottom: 26px; right: 26px;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 32% 28%, #29d3cf, #007a79 75%);
  color: #eafffe; font-size: 22px; align-items: center; justify-content: center;
  box-shadow: 0 8px 30px rgba(0,171,170,0.5); z-index: 50;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2,4,5,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(5px);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: rgba(16,21,23,0.97); border: 1px solid var(--border-strong); border-radius: 18px;
  width: min(700px, 92vw); max-height: 87vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-pop);
  animation: rise .3s cubic-bezier(.2,.7,.3,1) both;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 19px 24px 15px; border-bottom: 1px solid var(--border);
}
.modal-kicker { font-size: 10px; font-weight: 700; letter-spacing: 1.6px; color: var(--accent-ink); text-transform: uppercase; }
.modal-title { font-family: var(--font-display); font-size: 16.5px; font-weight: 700; margin-top: 4px; }
.modal-body {
  padding: 19px 24px; overflow-y: auto; font-family: inherit;
  font-size: 13px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap;
  outline: none;
}
.modal-note {
  margin: 0 24px 15px; padding: 11px 15px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid rgba(0,171,170,0.28);
  font-size: 12px; color: #9be2df;
}
.modal-note::before { content: '✦ Come è stata costruita: '; font-weight: 700; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 20px; }
.modal-footer .spacer { flex: 1; }

.gen-line { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; padding: 4px 0; }
.gen-line .ok { color: var(--good); }

/* ---------- Toast ---------- */

.toasts {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 10px; z-index: 200; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 11px;
  background: rgba(14,20,21,0.97); border: 1px solid rgba(0,171,170,0.4);
  border-radius: 13px; padding: 12px 18px;
  font-size: 13px; color: var(--ink);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 24px rgba(0,171,170,0.15);
  animation: toast-in .35s cubic-bezier(.2,.7,.3,1) both;
}
.toast.out { animation: toast-out .3s ease both; }
.toast .t-ico {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-accent); color: #01302f;
}
.toast .t-ico svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.toast .t-ico.wa { background: linear-gradient(120deg, #1faf55, #29d472); color: #06280f; }
.toast .t-sub { font-size: 11px; color: var(--ink-muted); }
@keyframes toast-in { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(.97); } }

/* ---------- AI Score ---------- */

.chip.score {
  background: rgba(0,171,170,0.10); color: var(--accent-ink);
  border: 1px solid rgba(0,171,170,0.3);
  font-family: var(--font-display);
}
.score-num { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.score-num.hi { color: var(--bad-ink); }
.score-num.mid { color: var(--warning); }
.score-num.lo { color: var(--good); }
.score-cell { display: flex; align-items: center; gap: 8px; }
.score-mini { width: 42px; height: 5px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.score-mini > div { height: 100%; border-radius: 4px; }
.score-mini .hi { background: linear-gradient(90deg, #e05252, #ff8f6b); }
.score-mini .mid { background: linear-gradient(90deg, #c8901a, #f5b82e); }
.score-mini .lo { background: linear-gradient(90deg, #1d9251, #2ecc71); }

.score-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.score-head .desc { font-size: 12px; color: var(--ink-muted); line-height: 1.5; }
.fx { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 5.5px 0; border-bottom: 1px solid var(--grid); }
.fx:last-child { border-bottom: none; }
.fx-t { font-size: 12px; color: var(--ink-2); }
.fx-v { display: flex; align-items: center; gap: 7px; }
.fx-bar { width: 52px; height: 5px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.fx-bar > div { height: 100%; border-radius: 4px; }
.fx.pos .fx-bar > div { background: var(--grad-accent); }
.fx.neg .fx-bar > div { background: var(--fill-neutral); }
.fx-n { font-family: var(--font-display); font-size: 12px; font-weight: 700; min-width: 30px; text-align: right; }
.fx.pos .fx-n { color: var(--accent-ink); }
.fx.neg .fx-n { color: var(--ink-muted); }

.chan { display: grid; grid-template-columns: 20px minmax(78px, auto) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.chan-l { white-space: nowrap; }
.chan .ico { color: var(--ink-muted); }
.chan.best .ico { color: var(--accent-ink); }
.chan-l { font-size: 12px; color: var(--ink-2); }
.chan.best .chan-l { color: var(--ink); font-weight: 600; }
.chan-bar { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.chan-bar > div { height: 100%; border-radius: 4px; background: var(--fill-neutral); transition: width .9s cubic-bezier(.2,.7,.3,1); }
.chan.best .chan-bar > div { background: var(--grad-accent); box-shadow: 0 0 8px rgba(0,212,211,0.4); }
.chan-n { font-family: var(--font-display); font-size: 12px; font-weight: 700; min-width: 34px; text-align: right; color: var(--ink-2); }
.chan-best-tag {
  font-size: 8.5px; font-weight: 800; letter-spacing: .8px; color: #01302f;
  background: var(--grad-accent); border-radius: 4px; padding: 1.5px 6px; margin-left: 6px;
}

.sla-esc { font-size: 12px; color: var(--serious); margin-top: 6px; font-weight: 600; }

/* ---------- KPI cliccabili ---------- */

.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: rgba(0,171,170,0.45); box-shadow: 0 0 24px rgba(0,171,170,0.10), var(--shadow-card); }
.kpi-link { font-size: 11px; color: var(--accent-ink); font-weight: 600; margin-top: 8px; opacity: 0; transition: opacity .15s; }
.kpi.clickable:hover .kpi-link { opacity: 1; }

/* ---------- Modal elenco (drill-down) ---------- */

.list-body { padding: 10px 16px 16px; overflow-y: auto; }
.lrow {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 12px 10px; border-bottom: 1px solid var(--grid);
}
.lrow:last-child { border-bottom: none; }
.lrow-t { font-weight: 700; font-size: 13.5px; }
.lrow-t .lnum { color: var(--accent-ink); font-family: var(--font-display); }
.lrow-s { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.lrow-right { text-align: right; }
.lrow-val { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.lrow-docs { display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; }
.doc-link {
  font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 6px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--ink-2);
  font-family: inherit; display: inline-flex; align-items: center; gap: 4px;
  transition: border-color .15s, color .15s;
}
.doc-link:hover { border-color: var(--accent); color: var(--accent-ink); }
.stato-pill { font-size: 9.5px; font-weight: 800; letter-spacing: .6px; padding: 2.5px 8px; border-radius: 5px; text-transform: uppercase; }
.stato-pill.consegnato { background: rgba(46,204,113,0.1); color: var(--good); }
.stato-pill.in-consegna { background: rgba(0,171,170,0.12); color: var(--accent-ink); }
.stato-pill.in-lavorazione { background: rgba(245,184,46,0.11); color: var(--warning); }

/* ---------- Documento (anteprima PDF) ---------- */

.doc-backdrop {
  position: fixed; inset: 0; background: rgba(2,4,5,0.78);
  display: flex; flex-direction: column; align-items: center;
  z-index: 120; backdrop-filter: blur(6px); overflow-y: auto; padding: 24px 16px 40px;
}
.doc-backdrop[hidden] { display: none; }
.doc-shell { width: min(760px, 94vw); }
.doc-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px 12px;
}
.doc-tb-title { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink-2); }
.doc-sheet {
  background: #fff; color: #1c2325; border-radius: 6px;
  padding: 46px 52px; min-height: 900px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.65);
  font-size: 13px; line-height: 1.6;
  animation: rise .3s cubic-bezier(.2,.7,.3,1) both;
}
.doc-sheet .doc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 34px; }
.doc-sheet .doc-logo { width: 190px; }
.doc-sheet .doc-mitt { text-align: right; font-size: 11px; color: #5a6668; line-height: 1.55; }
.doc-sheet h1 { font-family: var(--font-display); font-size: 19px; letter-spacing: .2px; margin-bottom: 4px; color: #12181a; }
.doc-sheet .doc-sub { font-size: 12px; color: #5a6668; margin-bottom: 24px; }
.doc-sheet .doc-dest {
  border: 1px solid #dfe3e3; border-radius: 8px; padding: 12px 16px; margin-bottom: 24px;
  font-size: 12.5px; width: 300px;
}
.doc-sheet .doc-dest .dl { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: #8a9496; }
.doc-sheet table { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: 12.5px; }
.doc-sheet th { text-align: left; font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; color: #5a6668; border-bottom: 2px solid #12181a; padding: 7px 8px; }
.doc-sheet td { padding: 9px 8px; border-bottom: 1px solid #e6eaea; }
.doc-sheet td.r, .doc-sheet th.r { text-align: right; font-variant-numeric: tabular-nums; }
.doc-sheet .tot td { font-weight: 700; border-bottom: none; border-top: 2px solid #12181a; }
.doc-sheet .doc-cond { font-size: 11.5px; color: #5a6668; margin-top: 22px; line-height: 1.7; }
.doc-sheet .doc-foot { margin-top: 40px; padding-top: 14px; border-top: 1px solid #dfe3e3; font-size: 10px; color: #8a9496; text-align: center; }
.doc-sheet .rep-sec { margin-bottom: 20px; }
.doc-sheet .rep-sec h3 { font-family: var(--font-display); font-size: 13.5px; color: #0d7a79; margin-bottom: 5px; letter-spacing: .3px; }
.doc-sheet .rep-ai {
  background: #eef7f7; border: 1px solid #bfe0df; border-radius: 8px;
  padding: 10px 14px; font-size: 11px; color: #35625f; margin-top: 26px;
}

/* Rapporto — elementi grafici */
.doc-sheet { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-band {
  background: linear-gradient(120deg, #0a5c5b, #0d8a88 55%, #14a5a3);
  border-radius: 14px; color: #fff; padding: 26px 30px;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  margin-bottom: 10px;
}
.doc-band .k { font-size: 10px; letter-spacing: 2.6px; font-weight: 700; opacity: .8; }
.doc-band .t1 { font-family: var(--font-display); font-size: 27px; font-weight: 700; margin-top: 3px; }
.doc-band .sub { font-size: 11.5px; opacity: .85; margin-top: 4px; }
.doc-band .heroes { display: flex; gap: 26px; text-align: right; flex-shrink: 0; }
.doc-band .hv { font-family: var(--font-display); font-size: 25px; font-weight: 700; }
.doc-band .hl { font-size: 9px; letter-spacing: 1.4px; font-weight: 700; opacity: .8; }
.doc-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 4px; }
.dtile {
  border: 1px solid #e2e8e8; border-top: 3.5px solid #0d8a88; border-radius: 10px;
  padding: 11px 14px 10px; background: #fbfdfd;
}
.dtile.good { border-top-color: #17a54d; }
.dtile.warn { border-top-color: #e8a200; }
.dtile.bad { border-top-color: #d03b3b; }
.dtile .l { font-size: 8.5px; letter-spacing: 1.3px; font-weight: 700; color: #8a9496; }
.dtile .v { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: #12181a; margin-top: 2px; }
.dtile .d { font-size: 10.5px; margin-top: 1px; color: #5a6668; }
.dtile .d.up { color: #0a7d3d; font-weight: 600; }
.dtile .d.dn { color: #c0392b; font-weight: 600; }
.sec-h { display: flex; align-items: center; gap: 10px; margin: 24px 0 11px; }
.sec-h .n {
  width: 23px; height: 23px; border-radius: 7px; background: #0d8a88; color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
}
.sec-h .t { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: #12181a; white-space: nowrap; }
.sec-h::after { content: ''; flex: 1; height: 1px; background: #e2e8e8; }
.doc-sheet table.pro th { background: #0d8a88; color: #fff; border-bottom: none; font-size: 9.5px; padding: 8px 10px; }
.doc-sheet table.pro th:first-child { border-radius: 7px 0 0 0; }
.doc-sheet table.pro th:last-child { border-radius: 0 7px 0 0; }
.doc-sheet table.pro tbody tr:nth-child(even) { background: #f2f8f8; }
.doc-sheet table.pro td { border-bottom: 1px solid #e8eeee; }
.pill { display: inline-block; font-size: 9.5px; font-weight: 700; padding: 3px 10px; border-radius: 12px; white-space: nowrap; }
.pill.ok { background: #dcf3e3; color: #0a7d3d; }
.pill.warn { background: #fdf1d4; color: #9a6b00; }
.pill.bad { background: #fbdfdb; color: #b03028; }
.doc-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.doc-note {
  background: #eef7f7; border-left: 4px solid #0d8a88; border-radius: 0 8px 8px 0;
  padding: 10px 14px; font-size: 11px; color: #35625f; margin-top: 12px;
}
.doc-chart-t { font-size: 10px; letter-spacing: 1.2px; font-weight: 700; color: #8a9496; margin-bottom: 6px; }

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body > *:not(.doc-backdrop) { display: none !important; }
  .bg, .toasts { display: none !important; }
  .doc-backdrop { position: static; padding: 0; background: none; backdrop-filter: none; overflow: visible; display: block !important; }
  .doc-toolbar { display: none; }
  .doc-shell { width: 100%; }
  .doc-sheet { box-shadow: none; border-radius: 0; padding: 0; min-height: 0; }
  body { overflow: visible; background: #fff; }
}

/* ---------- Registra attività ---------- */

.act-card { margin-bottom: 16px; }
.act-types { display: flex; gap: 7px; margin-bottom: 11px; flex-wrap: wrap; }
.act-type {
  font-size: 11.5px; font-weight: 600; padding: 5px 13px; border-radius: 20px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-2);
  font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .15s, color .15s, background .15s;
}
.act-type .ico { width: 12px; height: 12px; }
.act-type.sel { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.act-row { display: flex; gap: 8px; }
.act-row input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 11px; padding: 9px 14px; color: var(--ink);
  font-family: inherit; font-size: 13px; outline: none;
}
.act-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,171,170,0.15); }
.act-mic {
  width: 38px; border-radius: 11px; cursor: pointer; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.act-mic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.act-mic:hover { border-color: var(--accent); color: var(--accent-ink); }
.act-mic.listening { background: rgba(224,82,82,0.16); border-color: var(--critical); color: #ff9d9d; animation: mic-pulse 1.2s infinite; }

/* ---------- Agenda ---------- */

.ag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; align-items: start; }
.ag-day-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--ink-2); letter-spacing: .3px; }
.ag-list { display: flex; flex-direction: column; gap: 10px; }
.ag-item {
  display: grid; grid-template-columns: 56px 1fr; gap: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 13px; padding: 13px 15px;
  transition: border-color .16s, transform .16s;
}
.ag-item:hover { border-color: rgba(0,171,170,0.4); }
.ag-item.ai { border-left: 3px solid var(--accent); }
.ag-time { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--accent-ink); }
.ag-time .dur { display: block; font-size: 10px; color: var(--ink-muted); font-weight: 500; }
.ag-t { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-s { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }
.ag-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.chip.ai-tag { background: rgba(0,171,170,0.10); color: var(--accent-ink); border: 1px solid rgba(0,171,170,0.3); }
.chip.meet-code { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border-strong); font-family: var(--font-display); }

.ag-new { margin-bottom: 18px; }
.ag-form { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.ag-form #ag-titolo { flex: 1 1 240px; min-width: 200px; }
.ag-form #ag-cliente { flex: 0 1 210px; }
.ag-form button { white-space: nowrap; flex-shrink: 0; }
.ag-form input, .ag-form select {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 11px; padding: 9px 13px; color: var(--ink);
  font-family: inherit; font-size: 13px; outline: none;
}
.ag-form input:focus, .ag-form select:focus { border-color: var(--accent); }
.ag-form select option { background: #14191b; }
.ag-form input[type="time"] { width: 108px; }

/* ---------- Task list ---------- */

.task-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.task-progress .bar { flex: 1; height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.task-progress .bar > div { height: 100%; border-radius: 6px; background: var(--grad-accent); box-shadow: 0 0 10px rgba(0,212,211,0.5); transition: width .5s cubic-bezier(.2,.7,.3,1); }
.task-progress .n { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--accent-ink); white-space: nowrap; }

.task-add { display: flex; gap: 9px; margin-top: 14px; }
.task-add input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 11px; padding: 10px 15px; color: var(--ink);
  font-family: inherit; font-size: 13px; outline: none;
}
.task-add input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,171,170,0.15); }
.task-add select {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 11px; padding: 9px 12px; color: var(--ink); font-family: inherit; font-size: 13px; outline: none;
}
.task-add select option { background: #14191b; }

.task-group-h {
  font-size: 10.5px; font-weight: 800; letter-spacing: 1.6px; color: var(--ink-muted);
  margin: 20px 0 10px; display: flex; align-items: center; gap: 9px;
}
.task-group-h.late { color: var(--bad-ink); }
.task-group-h::after { content: ''; flex: 1; height: 1px; background: var(--grid); }

.task {
  display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 15px; margin-bottom: 8px;
  transition: border-color .16s, opacity .3s, background .16s;
}
.task:hover { border-color: rgba(0,171,170,0.4); }
.task.late { border-left: 3px solid var(--critical); }
.task.fatto { opacity: .45; }
.task.fatto .task-t { text-decoration: line-through; }
.task-check {
  width: 24px; height: 24px; border-radius: 8px; cursor: pointer; flex-shrink: 0;
  background: var(--surface-2); border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, border-color .18s, transform .12s;
}
.task-check:hover { border-color: var(--accent); transform: scale(1.08); }
.task-check svg { width: 14px; height: 14px; fill: none; stroke: #01302f; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity .15s; }
.task.fatto .task-check { background: var(--grad-accent); border-color: transparent; box-shadow: 0 0 12px rgba(0,212,211,0.4); }
.task.fatto .task-check svg { opacity: 1; }
.task-t { font-size: 13.5px; font-weight: 600; }
.task-meta { display: flex; gap: 7px; margin-top: 5px; flex-wrap: wrap; align-items: center; }
.task-meta .cliente-tag {
  font-size: 11px; color: var(--accent-ink); font-weight: 600; cursor: pointer;
  background: rgba(0,171,170,0.08); border: 1px solid rgba(0,171,170,0.25);
  border-radius: 6px; padding: 2px 9px;
}
.task-meta .cliente-tag:hover { background: rgba(0,171,170,0.16); }
.task-due { font-size: 11px; color: var(--ink-muted); }
.task.late .task-due { color: var(--bad-ink); font-weight: 700; }
.prio-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prio-dot.alta { background: #ff6b6b; box-shadow: 0 0 8px rgba(255,107,107,0.7); }
.prio-dot.media { background: var(--warning); }
.prio-dot.bassa { background: var(--good); }

/* Spunta priorità in dashboard */
.prio > div:nth-child(2) { flex: 1; }
.prio-check {
  width: 26px; height: 26px; border-radius: 9px; cursor: pointer; flex-shrink: 0;
  background: var(--surface-2); border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center; align-self: center;
  transition: background .18s, border-color .18s, transform .12s;
}
.prio-check:hover { border-color: var(--accent); transform: scale(1.1); }
.prio-check svg { width: 14px; height: 14px; fill: none; stroke: #01302f; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.prio.gestita { opacity: .45; }
.prio.gestita .prio-name { text-decoration: line-through; }
.prio.gestita .prio-check { background: var(--grad-accent); border-color: transparent; box-shadow: 0 0 12px rgba(0,212,211,0.4); }
.prio.gestita .prio-check svg { opacity: 1; }

/* ---------- KPI e obiettivi per cliente ---------- */

.ckpi-card { margin-bottom: 18px; }
.ckpi-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.pace-pill {
  font-size: 10px; font-weight: 700; letter-spacing: 1.4px; padding: 5px 12px;
  border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.pace-pill.good { color: var(--good-ink); background: rgba(46,204,113,0.12); border: 1px solid rgba(46,204,113,0.32); }
.pace-pill.ok { color: var(--accent-ink); background: rgba(0,171,170,0.12); border: 1px solid rgba(0,212,211,0.3); }
.pace-pill.warn { color: var(--warn-ink); background: rgba(245,184,46,0.12); border: 1px solid rgba(245,184,46,0.32); }
.ckpi-grid { display: grid; grid-template-columns: 1.9fr 1fr 1fr 1fr 1fr; gap: 12px; margin-top: 14px; }
.ckpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 12px 14px; min-width: 0;
}
.ckpi-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: 1.2px; color: var(--ink-muted);
  display: flex; align-items: center; gap: 6px;
}
.ckpi-value { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-top: 6px; letter-spacing: -0.01em; }
.ckpi-of { font-size: 13px; color: var(--ink-muted); font-weight: 600; }
.ckpi-sub { font-size: 11.5px; color: var(--ink-muted); margin-top: 5px; line-height: 1.45; }
.ckpi-sub b { color: var(--ink-2); }
.ckpi-sub.good { color: var(--good-ink); }
.ckpi-sub.warn { color: var(--warn-ink); }
.ckpi-bar { position: relative; height: 7px; border-radius: 4px; background: var(--surface-3); margin-top: 10px; }
.ckpi-bar .fill { height: 100%; border-radius: 4px; background: var(--grad-accent); transition: width .6s ease; }
.ckpi-bar .fill.good { background: linear-gradient(120deg, #27ae60, #2ecc71); }
.ckpi-bar .fill.warn { background: linear-gradient(120deg, #e8a020, #f5b82e); }
.ckpi-bar .pace { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed rgba(255,255,255,0.5); }
.ckpi-editbtn {
  background: none; border: none; cursor: pointer; padding: 1px; line-height: 0;
  color: var(--ink-muted); transition: color .15s;
}
.ckpi-editbtn:hover { color: var(--accent-ink); }
.ckpi-editbtn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ckpi-editrow { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.ckpi-editrow[hidden] { display: none; }
.ckpi-editrow input {
  width: 84px; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 9px; color: var(--ink); font: 600 14px var(--font-display); padding: 6px 9px; outline: none;
}
.ckpi-editrow input:focus { border-color: var(--accent); }
.ckpi-unit { font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.ckpi-ai {
  margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--accent-ink); line-height: 1.6;
  display: flex; gap: 8px; align-items: flex-start;
}
.ckpi-ai svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vs-ob { font-weight: 700; }
.vs-ob.good { color: var(--good-ink); }
.vs-ob.ok { color: var(--accent-ink); }
.vs-ob.warn { color: var(--warn-ink); }

/* ---------- Dettaglio timeline (email / WhatsApp / nota / ordine) ---------- */

.tl-item.tl-click { cursor: pointer; border-radius: 10px; transition: background .15s; }
.tl-item.tl-click:hover { background: rgba(0,171,170,0.07); }
.tl-item.tl-click:hover .tl-title { color: var(--accent-ink); }
.tld-env {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px 14px; margin-bottom: 12px;
}
.tld-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.tld-row:last-child { border-bottom: none; }
.tld-row span { width: 72px; flex-shrink: 0; color: var(--ink-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; padding-top: 1px; }
.tld-row b { color: var(--ink-2); font-weight: 600; min-width: 0; }
.tld-body {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; font-size: 13px; color: var(--ink-2); line-height: 1.7; white-space: pre-line;
}
.tld-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.wa-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.wa-head svg { width: 15px; height: 15px; fill: none; stroke: #4fd07a; stroke-width: 2; }
.wa-verif { font-size: 10px; color: #4fd07a; margin-left: auto; }
.wa-thread {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.wa-bub {
  max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 12.5px;
  color: var(--ink-2); line-height: 1.55;
}
.wa-bub.in { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.wa-bub.out { align-self: flex-end; background: rgba(0,171,170,0.14); border: 1px solid rgba(0,212,211,0.25); border-bottom-right-radius: 4px; }
.wa-time { display: block; font-size: 9.5px; color: var(--ink-muted); margin-top: 4px; text-align: right; }

/* ---------- Agenda: viste settimana e mese ---------- */

.ag-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.seg {
  display: inline-flex; gap: 2px; padding: 3px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.seg button {
  border: none; background: none; cursor: pointer;
  color: var(--ink-muted); font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 7px 15px; border-radius: 9px; transition: color .15s;
}
.seg button:hover { color: var(--ink-2); }
.seg button.active { background: var(--grad-accent); color: #01302f; }

.wk-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; margin-top: 6px; }
.wk-day {
  min-height: 200px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 9px; cursor: pointer; transition: border-color .15s;
}
.wk-day:hover { border-color: rgba(0,171,170,0.45); }
.wk-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.wk-day.dim { opacity: .55; }
.wk-dh { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--ink-muted); margin-bottom: 8px; }
.wk-day.today .wk-dh { color: var(--accent-ink); }
.wk-ev {
  position: relative; font-size: 10.5px; line-height: 1.45; color: var(--ink-2);
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 7px; padding: 5px 7px; margin-bottom: 6px; overflow: hidden;
}
.wk-ev b { color: var(--ink); font-family: var(--font-display); }
.wk-ev svg { width: 10px; height: 10px; vertical-align: -1px; fill: none; stroke: currentColor; stroke-width: 2; }
.wk-ev.int { background: var(--surface-2); border-left-color: var(--ink-muted); }
.wk-ai { position: absolute; top: 3px; right: 5px; font-size: 9px; color: var(--accent-ink); }
.wk-empty { font-size: 11px; color: var(--ink-muted); opacity: .5; padding: 4px 2px; }

.cal-nav { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.cal-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; min-width: 140px; text-align: center; }
.cal-nav .icon-btn[disabled] { opacity: .3; cursor: default; }
.cal-legend { margin-left: auto; font-size: 11px; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; }
.cal-legend svg { width: 12px; height: 12px; fill: none; stroke: var(--accent-ink); stroke-width: 2; }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; padding: 0 2px 7px; font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--ink-muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; }
.cal-cell {
  min-height: 96px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 9px; cursor: pointer; transition: border-color .15s; overflow: hidden;
}
.cal-cell:hover { border-color: rgba(0,171,170,0.45); }
.cal-cell.out { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.we { opacity: .55; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); opacity: 1; }
.cal-num { font-family: var(--font-display); font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.cal-cell.today .cal-num { color: var(--accent-ink); }
.cal-oggi { font-size: 8px; letter-spacing: 1.2px; background: var(--grad-accent); color: #01302f; border-radius: 999px; padding: 1px 7px; font-weight: 800; }
.cal-ev {
  font-size: 9.5px; color: var(--ink-2); background: var(--accent-soft);
  border-radius: 6px; padding: 2.5px 6px; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev.int { background: var(--surface-2); }
.cal-more { font-size: 9.5px; font-weight: 700; color: var(--accent-ink); }

@media (max-width: 1500px) { .wk-grid { grid-template-columns: repeat(7, 1fr); } .wk-ev { font-size: 10px; } }

/* ---------- Toggle tema ---------- */

.theme-toggle {
  margin-left: auto; width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--ink-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--accent-ink); border-color: var(--accent); }
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .ico-moon { display: none; }
html.light .theme-toggle .ico-moon { display: block; }
html.light .theme-toggle .ico-sun { display: none; }

/* ---------- Modalità mobile (companion) ---------- */

.tabbar { display: none; }

html.mobile .app { display: block; height: 100vh; }
html.mobile .bg-glow { display: none; }
html.mobile .sidebar { display: none; }
html.mobile .main { height: calc(100vh - 62px); overflow-y: auto; padding: 16px 14px 100px; }
html.mobile .chatpanel {
  position: fixed; inset: 0; z-index: 130;
  background: rgba(9,12,14,0.98); backdrop-filter: blur(20px);
  display: flex; flex-direction: column; border-left: none;
}
html.mobile .app.chat-closed .chatpanel { display: none; }
html.mobile .chat-fab { display: flex; bottom: 80px; right: 14px; width: 50px; height: 50px; }
html.mobile .modal { width: calc(100vw - 22px) !important; max-height: 86vh; overflow-y: auto; }
html.mobile .doc-shell { width: 100vw; max-width: 100vw; }
html.mobile .toasts { left: 12px; right: 12px; bottom: 74px; }

html.mobile .tabbar {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 62px; z-index: 110;
  background: rgba(10,13,15,0.94); backdrop-filter: blur(18px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; background: none; border: none; cursor: pointer; position: relative;
  color: var(--ink-muted); font-family: inherit; font-size: 9.5px; font-weight: 600; letter-spacing: 0.4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.tab-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-item.active { color: var(--accent-ink); }
.tab-badge {
  position: absolute; top: 7px; left: calc(50% + 6px);
  background: var(--grad-accent); color: #01302f; font-size: 8.5px; font-weight: 800;
  border-radius: 999px; padding: 1px 5px;
}

/* Viste companion */
.m-view { max-width: 560px; margin: 0 auto; }
.m-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.m-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.m-brief {
  background: linear-gradient(135deg, rgba(0,171,170,0.13), rgba(0,171,170,0.04));
  border: 1px solid rgba(0,212,211,0.22); border-radius: 16px; padding: 14px; margin-bottom: 12px;
}
.m-brief-t { font-size: 13px; color: var(--ink-2); line-height: 1.6; margin-bottom: 11px; }
.m-brief-t b { color: var(--ink); }
.m-spark { color: var(--accent-ink); }
.m-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; }
.m-chip b { font-family: var(--font-display); font-size: 18px; display: block; }
.m-chip span { font-size: 10.5px; color: var(--ink-muted); }
.m-sec { font-size: 10px; font-weight: 700; letter-spacing: 1.6px; color: var(--ink-muted); margin: 18px 2px 9px; }
.m-sec .pace-pill { letter-spacing: 0.8px; }
.m-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 13px 14px; margin-bottom: 10px; }
.m-prio-head { display: flex; gap: 10px; align-items: flex-start; }
.m-prio-info { flex: 1; min-width: 0; }
.m-prio-name { font-size: 14px; font-weight: 600; }
.m-prio-why { font-size: 11.5px; color: var(--ink-muted); line-height: 1.5; margin-top: 3px; }
.m-prio-why svg { width: 11px; height: 11px; vertical-align: -1px; fill: none; stroke: currentColor; stroke-width: 2; }
.m-actions { display: flex; gap: 8px; margin-top: 11px; }
.m-actions-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.m-act {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--ink-2);
  border-radius: 12px; padding: 10px 6px; font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.m-act svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.m-act.primary { background: var(--grad-accent); color: #01302f; border: none; }
.m-ag { display: flex; align-items: center; gap: 12px; }
.m-ag .m-act { flex: 0 0 auto; padding: 9px 12px; }
.m-ag-ora { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--accent-ink); flex-shrink: 0; }
.m-ag-main { flex: 1; min-width: 0; }
.m-ag-t { font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.m-ag-s { font-size: 10.5px; color: var(--accent-ink); margin-top: 2px; }
.m-cli { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.m-cli-info { flex: 1; min-width: 0; }
.m-cli-sub { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }
.m-cli-head { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.m-cli-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 4px; }
.m-sugg-t { font-size: 12.5px; color: var(--accent-ink); font-weight: 600; line-height: 1.55; }
.m-tl { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.m-tl .tl-dot { position: relative; left: auto; top: auto; margin-top: 3px; flex-shrink: 0; }
.m-tl-t { font-size: 12.5px; font-weight: 600; }
.m-tl-when { font-size: 10px; color: var(--ink-muted); font-weight: 500; margin-left: 4px; }
.m-task { display: flex; gap: 11px; align-items: center; cursor: pointer; }
.m-task .task-check svg { width: 14px; height: 14px; fill: none; stroke: #01302f; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.m-task.fatto .task-check { background: var(--grad-accent); border-color: transparent; }
.m-task.fatto .task-check svg { opacity: 1; }

/* nomotion: per test e screenshot */
html.nomotion *, html.nomotion *::before, html.nomotion *::after {
  animation: none !important; transition: none !important;
}

/* ---------- Scrollbar ---------- */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   Vista: Campioni — sistema "Impianto"
   Vedi .claude/skills/design-system/SKILL.md per il razionale completo.
   Token scoped a .view-campioni: il resto dell'app resta nel vecchio
   linguaggio "dark glass teal" finché non si decide un rollout completo.
   ========================================================================== */

.view-campioni, .cmp-scope {
  --imp-bg: #1c1f22;
  --imp-panel: #24282c;
  --imp-panel-2: #2a2e32;
  --imp-panel-3: #32373c;
  --imp-border: rgba(255,255,255,0.08);
  --imp-border-strong: rgba(255,255,255,0.18);
  --imp-ink: #f1f3f4;
  --imp-ink-2: #b7bec2;
  --imp-ink-muted: #7c848a;
  --imp-brand-ink: #4ed4d3;
  --imp-ok: #3fb950;      --imp-ok-ink: #8fe3a6;
  --imp-warn: #d9a21b;    --imp-warn-ink: #f0c464;
  --imp-crit: #e5484d;    --imp-crit-ink: #ff8b8f;
  --imp-neutral: rgba(255,255,255,0.22);
  --imp-font: 'Archivo', system-ui, -apple-system, "Segoe UI", sans-serif;
  --imp-font-num: 'Archivo Expanded', var(--imp-font);
}
.view-campioni {
  margin: -30px -34px -70px;
  padding: 30px 34px 70px;
  background: var(--imp-bg);
  min-height: 100%;
  font-family: var(--imp-font);
  color: var(--imp-ink);
}
/* Valori chiari ricalibrati per contrasto AA contro pannelli bianchi (vedi SKILL.md) */
html.light .view-campioni, html.light .cmp-scope {
  --imp-bg: #eef0f1;
  --imp-panel: #ffffff;
  --imp-panel-2: #f5f6f7;
  --imp-panel-3: #e9ebec;
  --imp-border: rgba(15,23,26,0.10);
  --imp-border-strong: rgba(15,23,26,0.22);
  --imp-ink: #15181a;
  --imp-ink-2: #3e464a;
  --imp-ink-muted: #6c7478;
  --imp-brand-ink: #006d6c;
  --imp-ok: #147a3d;      --imp-ok-ink: #147a3d;
  --imp-warn: #8a6100;    --imp-warn-ink: #8a6100;
  --imp-crit: #c4383d;    --imp-crit-ink: #c4383d;
  --imp-neutral: rgba(15,23,26,0.24);
}

.view-campioni .view-kicker { color: var(--imp-brand-ink); font-family: var(--imp-font); }
.view-campioni .view-title { font-family: var(--imp-font-num); color: var(--imp-ink); font-weight: 700; }
.view-campioni .view-sub { color: var(--imp-ink-muted); }

/* Flex invece di grid a 6 colonne fisse: la larghezza reale del pannello centrale
   varia molto (chat aperta/chiusa, 1360px vs 1920px) — le colonne si dispongono
   quante ce ne stanno e vanno a capo, invece di uscire dal viewport senza scroll. */
.cmp-board {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}
.cmp-col {
  background: var(--imp-panel);
  border: 1px solid var(--imp-border);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  flex: 1 1 210px;
  min-width: 210px;
  max-width: 280px;
}
.cmp-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cmp-col-title { font-size: 12.5px; font-weight: 700; letter-spacing: .2px; color: var(--imp-ink); line-height: 1.3; }
.cmp-col-count {
  font-family: var(--imp-font-num); font-weight: 600; font-size: 13px;
  background: var(--imp-panel-3); color: var(--imp-ink-2);
  border-radius: 6px; min-width: 22px; text-align: center; padding: 1px 6px; flex-shrink: 0;
}
.cmp-col-meta { font-size: 10.5px; color: var(--imp-ink-muted); letter-spacing: .3px; margin-top: -4px; }
.cmp-col-body { display: flex; flex-direction: column; gap: 10px; }
.cmp-empty {
  font-size: 12px; color: var(--imp-ink-muted); text-align: center;
  padding: 18px 8px; border: 1px dashed var(--imp-border-strong); border-radius: 10px;
}

.cmp-card {
  background: var(--imp-panel-2); border: 1px solid var(--imp-border);
  border-radius: 10px; padding: 12px 13px; cursor: pointer;
  transition: border-color 150ms cubic-bezier(.2,0,0,1), transform 150ms cubic-bezier(.2,0,0,1);
}
.cmp-card:hover, .cmp-card:focus-visible {
  border-color: var(--imp-border-strong); transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  outline: none;
}
.cmp-card.critico { border-color: rgba(229,72,77,0.5); }
.cmp-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cmp-client { font-size: 12.5px; font-weight: 700; line-height: 1.35; }
.cmp-prospect {
  display: inline-block; margin-left: 6px; font-size: 9px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--imp-ink-muted); border: 1px solid var(--imp-border-strong);
  border-radius: 6px; padding: 1px 5px; vertical-align: 1px;
}
.cmp-value { font-family: var(--imp-font-num); font-weight: 600; font-size: 12.5px; color: var(--imp-ink-2); white-space: nowrap; }
.cmp-product { font-size: 12px; color: var(--imp-ink-2); margin-top: 5px; line-height: 1.4; }
.cmp-stato {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  margin-top: 9px; font-family: var(--imp-font-num);
}
.cmp-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--imp-neutral); }
.cmp-stato.ok { color: var(--imp-ok-ink); }
.cmp-stato.ok .cmp-dot { background: var(--imp-ok); }
.cmp-stato.attenzione { color: var(--imp-warn-ink); }
.cmp-stato.attenzione .cmp-dot { background: var(--imp-warn); }
.cmp-stato.critico { color: var(--imp-crit-ink); }
.cmp-stato.critico .cmp-dot { background: var(--imp-crit); }
.cmp-stato.concluso { color: var(--imp-ink-muted); }
.cmp-stato.concluso .cmp-dot { background: var(--imp-ink-muted); }
.cmp-next {
  font-size: 11.5px; color: var(--imp-ink); line-height: 1.5; margin-top: 9px;
  padding-top: 9px; border-top: 1px solid var(--imp-border);
}
.cmp-next span { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--imp-ink-muted); margin-bottom: 3px; }

/* Dettaglio campione, dentro il modale elenco esistente (#list-modal) */
.cmp-detail { display: flex; flex-direction: column; gap: 13px; padding: 2px 2px 4px; color: var(--imp-ink); }
.cmp-detail-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; font-size: 12.5px; }
.cmp-detail-label { color: var(--imp-ink-muted); font-weight: 600; letter-spacing: .2px; font-family: var(--imp-font); }
.cmp-detail-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 2px 4px; border-top: 1px solid var(--imp-border); margin-top: 4px; }
.cmp-esito-form { display: flex; gap: 8px; align-items: center; }
.cmp-esito-form select {
  background: var(--imp-panel-3); border: 1px solid var(--imp-border-strong); border-radius: 6px;
  color: var(--imp-ink); font-family: var(--imp-font); font-size: 12.5px; padding: 7px 10px; outline: none;
}

@media (max-width: 1360px) {
  .app { grid-template-columns: 210px 1fr 350px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .detail-grid, .opp-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  .ckpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ckpi.wide { grid-column: 1 / -1; }
}

/* ---------- Multilingua: traduzione messaggi in entrata e bozze in uscita ---------- */

.tl-lang {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid rgba(0,171,170,0.35);
}
.lang-note { color: var(--accent-ink); }

.tld-langbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  font-size: 12px; color: var(--ink-2);
}
.tld-langbar.tr { background: var(--accent-soft); border-color: rgba(0,171,170,0.45); color: var(--accent-ink); }
.tld-langinfo { font-weight: 600; }

.tr-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 6px 14px; transition: border-color .15s, color .15s, background .15s;
}
.tr-toggle:hover { border-color: var(--accent); color: var(--accent-ink); }
.tr-toggle.on { background: var(--accent-soft); border-color: rgba(0,171,170,0.55); color: var(--accent-ink); }
.tr-knob { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0.75; }

.modal-langbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 24px 0;
}
.mlb-label { font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; color: var(--accent-ink); }
.lang-pill {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600;
  transition: border-color .15s, color .15s, background .15s;
}
.lang-pill:hover { border-color: var(--accent); color: var(--accent-ink); }
.lang-pill.sel { background: var(--accent-soft); border-color: rgba(0,171,170,0.55); color: var(--accent-ink); }
.lp-hint { font-size: 10px; font-weight: 500; color: var(--ink-muted); }
.lang-pill.sel .lp-hint { color: var(--accent-ink); opacity: 0.75; }
.mlb-note { font-size: 11px; color: var(--ink-muted); margin-left: auto; }

/* ---------- Gate di accesso (prototipo pubblicato con password condivisa) ---------- */

.gate {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: #0a0e10; transition: opacity .35s;
}
.gate[hidden] { display: none; }
.gate.out { opacity: 0; pointer-events: none; }
.gate-card {
  width: min(400px, 90vw); text-align: center; padding: 42px 36px;
  border-radius: 20px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.09);
}
.gate-logo { width: 190px; margin-bottom: 18px; }
.gate-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: 2.2px; color: #4ed4d3; margin-bottom: 6px; }
.gate-sub { font-size: 12.5px; color: #8a9699; margin-bottom: 22px; }
#gate-form { display: flex; gap: 9px; }
#gate-pass {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.14); border-radius: 11px;
  padding: 11px 15px; color: #e9eef0; font: inherit; font-size: 13.5px; outline: none;
}
#gate-pass:focus { border-color: #00abaa; }
.gate-err { margin-top: 12px; font-size: 12px; color: #ff8f8f; }
.gate-card.shake { animation: gate-shake .4s; }
@keyframes gate-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
