/* Studio Tecnico Caliendo — gestionale (demo White Rabbix) */
:root {
  --brand: #1F3A5F; --brand-600: #284B78; --brand-700: #172D4A; --brand-50: #EEF3F9; --brand-100: #DCE6F2;
  --accent: #B9873A; --accent-50: #FBF4E8;
  --bg: #F4F5F7; --surface: #FFFFFF; --surface-2: #F9FAFB; --border: #E2E5EA; --border-strong: #CDD3DB;
  --text: #18212C; --text-2: #3D4856; --muted: #66727F; --faint: #97A1AC;
  --ok: #2F7D4F; --ok-50: #EAF5EE; --warn: #B7791F; --warn-50: #FDF5E6; --danger: #C0392B; --danger-50: #FCEDEB; --info: #2563EB; --info-50: #EBF2FE;
  --wa: #1A9E54; --wa-50: #E8F6EE; --pec: #0E7490; --pec-50: #E6F4F7; --mail: #5B5BD6; --mail-50: #EEEEFC; --note: #B9873A; --note-50: #FBF4E8;
  --radius: 10px; --radius-sm: 7px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --sidebar: 244px; --topbar: 60px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.hide { display: none !important; }
[v-cloak] { display: none; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--brand-700); color: #DDE5EF; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 16px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .logo { width: 38px; height: 38px; flex: 0 0 auto; }
.brand-name { line-height: 1.1; min-width: 0; }
.brand-name .t1 { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: #9FB2C8; }
.brand-name .t2 { font-size: 16px; font-weight: 700; letter-spacing: .08em; color: #fff; }
.nav { padding: 10px 10px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #8094AB; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8.5px 10px; border-radius: 8px; color: #D3DCE7; font-weight: 500; text-decoration: none; position: relative; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; }
.nav .count.soft { background: rgba(255,255,255,.14); color: #E7EDF4; }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: #8094AB; }
.sidebar-foot b { color: #C5D1DE; font-weight: 600; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar); background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 22px; }
.topbar .title { font-weight: 650; font-size: 16px; min-width: 0; }
.search { position: relative; flex: 0 1 380px; margin-left: auto; }
.search input { width: 100%; height: 38px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px; padding: 0 12px 0 36px; outline: none; }
.search input:focus { border-color: var(--brand-600); background: #fff; box-shadow: 0 0 0 3px var(--brand-100); }
.search .icon { position: absolute; left: 11px; top: 10px; color: var(--faint); }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; padding: 6px; z-index: 40; }
.search-results .sr { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.search-results .sr:hover, .search-results .sr.sel { background: var(--brand-50); }
.iconbtn { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; color: var(--text-2); flex: 0 0 auto; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; }
.content { padding: 22px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

/* ---------- elementi ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: #fff; color: var(--text); font-weight: 560; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .iconbtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-100); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { filter: brightness(1.05); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.danger { color: var(--danger); border-color: #EBC2BD; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--brand-50); }
.btn.sm { height: 31px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 14px 16px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-50); color: var(--ok); border-color: #CBE6D4; }
.badge.warn { background: var(--warn-50); color: var(--warn); border-color: #F0DDB5; }
.badge.danger { background: var(--danger-50); color: var(--danger); border-color: #F2C9C3; }
.badge.info { background: var(--info-50); color: var(--info); border-color: #CADBFB; }
.badge.brand { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.badge.accent { background: var(--accent-50); color: #8E6420; border-color: #EBD6B2; }
.badge.solid { color: #fff; border: 0; }
.badge .icon { width: 13px; height: 13px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: #fff; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.chip:hover { border-color: var(--border-strong); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .n { font-size: 11.5px; opacity: .75; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; flex: 0 0 auto; letter-spacing: .02em; position: relative; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.ext:not(.sm)::after { content: "EST"; position: absolute; bottom: -4px; right: -6px; font-size: 7.5px; background: #fff; color: var(--text-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 2px; font-weight: 800; }
.avatars { display: inline-flex; }
.avatars .avatar { border: 2px solid #fff; margin-left: -7px; }
.avatars .avatar:first-child { margin-left: 0; }
.progress { height: 7px; background: #EDF0F3; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-600); }
.progress.ok > span { background: var(--ok); } .progress.warn > span { background: var(--warn); } .progress.danger > span { background: var(--danger); }
.sem { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.sem.verde { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-50); }
.sem.giallo { background: #E0A526; box-shadow: 0 0 0 3px var(--warn-50); }
.sem.rosso { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-50); }
.sem.blu { background: var(--info); box-shadow: 0 0 0 3px var(--info-50); }
.sem.grigio { background: #A0A8B2; box-shadow: 0 0 0 3px #EEF0F2; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .icon { width: 30px; height: 30px; color: var(--faint); margin-bottom: 6px; }
.kbd { font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--muted); background: #fff; }
.hint { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); font-size: 13.5px; }
.hint.warn { background: var(--warn-50); color: #7A5310; border-color: #F0DDB5; }
.hint.danger { background: var(--danger-50); color: #8C2A1F; border-color: #F2C9C3; }
.hint.ok { background: var(--ok-50); color: #1F5C38; border-color: #CBE6D4; }
.hint .icon { margin-top: 1px; }
.channel { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto; }
.channel.whatsapp { background: var(--wa-50); color: var(--wa); }
.channel.pec { background: var(--pec-50); color: var(--pec); }
.channel.email { background: var(--mail-50); color: var(--mail); }
.channel.quaderno { background: var(--note-50); color: var(--note); }
.channel.portale, .channel.telefono { background: var(--brand-50); color: var(--brand); }
.auto-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ok); background: var(--ok-50); border: 1px solid #CBE6D4; border-radius: 7px; padding: 3px 8px; }
.sugg-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #6A4A12; background: var(--accent-50); border: 1px solid #EBD6B2; border-radius: 7px; padding: 3px 8px; }

/* ---------- form ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea { width: 100%; min-height: 40px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px 11px; background: #fff; outline: none; transition: border-color .12s, box-shadow .12s; font-size: 15px; }
.textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-100); }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366727F' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-2 > *, .grid-3 > *, .triage > *, .kpis > * { min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.toggle { position: relative; width: 40px; height: 23px; flex: 0 0 auto; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; background: #CBD2DA; border-radius: 99px; transition: .15s; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: .15s; }
.toggle input:checked + span { background: var(--ok); }
.toggle input:checked + span::after { transform: translateX(17px); }
.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--brand); }
.seg { display: inline-flex; background: #EBEEF2; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 11px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.split > * { min-width: 0; }
.team-grid > *, .mail > * { min-width: 0; }
.auto-badge, .sugg-badge { white-space: normal; flex-wrap: wrap; }
/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; cursor: pointer; transition: border-color .12s, box-shadow .12s; text-align: left; }
.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .k-val { font-size: 25px; font-weight: 700; margin-top: 3px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi.danger .k-val { color: var(--danger); } .kpi.warn .k-val { color: var(--warn); } .kpi.accent .k-val { color: #8E6420; }

/* ---------- briefing ---------- */
.briefing { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; background: linear-gradient(135deg, var(--brand-700), var(--brand-600)); color: #fff; border-radius: 16px; padding: 20px 22px; margin-bottom: 18px; position: relative; overflow: hidden; }
.briefing::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
.briefing > * { position: relative; z-index: 1; }
.briefing h1 { color: #fff; }
.briefing p { margin: 8px 0 0; color: #D7E1EC; max-width: 760px; }
.briefing p b { color: #fff; }
.briefing .btn.light { background: #fff; color: var(--brand); border-color: #fff; }

/* ---------- team board ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; }
.member { background: #fff; border: 1px solid var(--border); border-radius: 13px; padding: 13px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.member:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.member .m-top { display: flex; gap: 10px; align-items: center; }
.member .m-name { font-weight: 650; }
.member .m-role { font-size: 12px; color: var(--muted); }
.member .m-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.member .m-stats div { background: var(--surface-2); border-radius: 8px; padding: 5px 2px; }
.member .m-stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.member .m-stats span { font-size: 10.5px; color: var(--muted); }
.member .m-stats .bad b { color: var(--danger); }
.member .m-now { font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; align-items: center; min-height: 18px; }
.member.drop-hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); transform: scale(1.01); }
.load-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.load-row .progress { flex: 1; }

/* ---------- liste ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--border); cursor: pointer; min-width: 0; }
.li:last-child { border-bottom: 0; }
.li:hover { background: var(--surface-2); }
.li.unread .li-title { font-weight: 700; }
.li.sel { background: var(--brand-50); }
.li-title { font-weight: 550; }
.li-sub { font-size: 12.5px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .r { text-align: right; }

/* ---------- smistamento ---------- */
.triage { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.triage-item { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; display: flex; flex-direction: column; gap: 9px; transition: opacity .2s, transform .2s, box-shadow .12s; }
.triage-item[draggable="true"] { cursor: grab; }
.triage-item.dragging { opacity: .5; }
.triage-item:hover { box-shadow: var(--shadow); }
.triage-item .t-text { color: var(--text-2); font-size: 13.8px; }
.triage-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sticky-col { position: sticky; top: calc(var(--topbar) + 16px); }
.team-mini { display: flex; flex-direction: column; gap: 8px; }
.team-mini .member { padding: 10px 12px; gap: 7px; }

/* ---------- posta ---------- */
.mail { display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - var(--topbar) - 44px - 70px); min-height: 520px; overflow: hidden; }
.mail-list { border-right: 1px solid var(--border); overflow-y: auto; }
.mail-view { overflow-y: auto; display: flex; flex-direction: column; }
.thread { padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #F6F3EE; flex: 1; }
.bubble { max-width: 78%; padding: 9px 12px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-sm); white-space: pre-wrap; }
.bubble.in { background: #fff; align-self: flex-start; border-top-left-radius: 4px; }
.bubble.out { background: #DCF3E4; align-self: flex-end; border-top-right-radius: 4px; }
.bubble.out.auto { background: #EEF3F9; }
.bubble .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }
.pec-doc { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: #fff; }
.composer textarea { min-height: 42px; height: 42px; resize: none; }

/* ---------- pratica ---------- */
.p-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.p-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 13.5px; margin-top: 8px; }
.p-meta span { display: inline-flex; align-items: center; gap: 6px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; padding: 11px 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .tc { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); padding: 0 6px; border-radius: 99px; }
.tabs .tc.bad { background: var(--danger-50); color: var(--danger); border-color: #F2C9C3; }
.iter { display: flex; flex-direction: column; }
.iter-step { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; position: relative; padding-bottom: 16px; }
.iter-step::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.iter-step:last-child::before { display: none; }
.iter-step.done::before { background: var(--ok); }
.iter-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); z-index: 1; }
.iter-step.done .iter-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.iter-step.current .iter-dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); }
.iter-step.wait .iter-dot { border-color: var(--info); color: var(--info); box-shadow: 0 0 0 4px var(--info-50); }
.iter-step .it-name { font-weight: 600; padding-top: 3px; }
.iter-step.todo .it-name { color: var(--muted); font-weight: 500; }
.phase-bar { display: flex; gap: 3px; }
.phase-bar i { flex: 1; height: 6px; border-radius: 3px; background: #E3E7EC; }
.phase-bar i.on { background: var(--brand-600); }
.phase-bar i.wait { background: var(--info); }
.doc-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.doc-row:last-child { border-bottom: 0; }
.doc-state { width: 24px; height: 24px; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.doc-state.ricevuto { background: var(--ok-50); color: var(--ok); }
.doc-state.mancante { background: var(--danger-50); color: var(--danger); }
.doc-state.richiesto { background: var(--warn-50); color: var(--warn); }
.doc-state.non_serve { background: var(--surface-2); color: var(--faint); }
.money-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.money { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; }
.money .ml { font-size: 12px; color: var(--muted); }
.money .mv { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.money.saldo { background: var(--accent-50); border-color: #EBD6B2; }
.money.saldo .mv { color: #8E6420; }
.money.margine.pos .mv { color: var(--ok); } .money.margine.neg .mv { color: var(--danger); }
.timer { display: inline-flex; align-items: center; gap: 8px; background: var(--danger-50); color: var(--danger); border-radius: 9px; padding: 0 12px; height: 38px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; background: #E6EAEE; cursor: pointer; border: 1px solid var(--border); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .stamp { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: 10.5px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.photo-add { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px; aspect-ratio: 4/3; border: 2px dashed var(--border-strong); border-radius: 10px; color: var(--muted); cursor: pointer; background: #fff; font-weight: 600; font-size: 13px; }
.photo-add:hover { border-color: var(--brand-600); color: var(--brand); }
.feed { display: flex; flex-direction: column; gap: 0; }
.feed-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 8px 0; font-size: 13.5px; }
.feed-item .when { font-size: 11.5px; color: var(--faint); }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.k-col { background: #EBEEF2; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
.k-col-head { display: flex; align-items: center; justify-content: space-between; font-weight: 650; font-size: 13px; padding: 2px 4px 4px; }
.k-card { background: #fff; border-radius: 10px; border: 1px solid var(--border); padding: 10px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 7px; }
.k-card:hover { box-shadow: var(--shadow); }

.map-tiles { filter: saturate(.35) brightness(1.04) contrast(.95); }
/* ---------- calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cal .ch { background: var(--surface-2); text-align: center; font-size: 11.5px; font-weight: 650; color: var(--muted); padding: 7px 0; text-transform: uppercase; letter-spacing: .05em; }
.cal .cd { background: #fff; min-height: 92px; padding: 6px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.cal .cd.out { background: #FAFBFC; color: var(--faint); }
.cal .cd.today .dn { background: var(--brand); color: #fff; border-radius: 6px; padding: 0 6px; }
.cal .dn { font-weight: 700; align-self: flex-start; }
.cal .ev { font-size: 11px; padding: 2px 5px; border-radius: 5px; background: var(--brand-50); color: var(--brand-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal .ev.ente { background: var(--pec-50); color: var(--pec); } .cal .ev.pagamento { background: var(--accent-50); color: #8E6420; } .cal .ev.appuntamento { background: var(--ok-50); color: var(--ok); } .cal .ev.late { background: var(--danger-50); color: var(--danger); }

/* ---------- modali ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 35, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; animation: pop .16s ease-out; }
.modal.wide { max-width: 820px; }
.modal.xwide { max-width: 1000px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; text-align: left; width: 100%; }
.pick:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pick.on { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 2px var(--brand-100); }
.toasts { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1B2533; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; display: flex; gap: 9px; align-items: center; animation: pop .18s; max-width: 92vw; pointer-events: auto; }
.toast .icon { color: #7FD3A1; }
.toast.err .icon { color: #F49B91; }
.fab-feedback { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; align-items: center; gap: 8px; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 0 16px 0 13px; height: 44px; box-shadow: var(--shadow-lg); cursor: pointer; font-weight: 650; }
.fab-feedback:hover { filter: brightness(1.05); }
.drawer-notifs { position: absolute; top: 46px; right: 0; width: 380px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; max-height: 480px; overflow: auto; }

/* ---------- tour ---------- */
.tour { background: #fff; border: 1px solid #EBD6B2; border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; background: linear-gradient(180deg, var(--accent-50), #fff 70%); }
.tour-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.tour-item { display: flex; gap: 9px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--border); cursor: pointer; font-size: 13px; text-align: left; }
.tour-item:hover { border-color: var(--accent); }
.tour-item .tchk { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.tour-item.done { background: var(--ok-50); border-color: #CBE6D4; }
.tour-item.done .tchk { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ---------- guida ---------- */
.guide { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 20px; align-items: start; }
.guide-toc { position: sticky; top: calc(var(--topbar) + 16px); max-height: calc(100vh - var(--topbar) - 32px); overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 6px; }
.guide-toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 13.2px; cursor: pointer; text-decoration: none; line-height: 1.3; }
.guide-toc a:hover { background: var(--surface-2); }
.guide-toc a.on { background: var(--brand-50); color: var(--brand); font-weight: 650; }
.guide-toc-mobile { display: none; }
.guide-body { min-width: 0; max-width: 860px; }
.guide-sec { margin-bottom: 14px; scroll-margin-top: calc(var(--topbar) + 14px); }
.guide-sec h2 { font-size: 18px; margin-bottom: 4px; }
.guide-sec p { margin: 8px 0 0; color: var(--text-2); }
.guide-steps { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: st; }
.guide-steps li { counter-increment: st; position: relative; padding: 5px 0 5px 36px; color: var(--text); }
.guide-steps li::before { content: counter(st); position: absolute; left: 0; top: 4px; width: 25px; height: 25px; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.guide-notes { margin: 12px 0 0; padding-left: 20px; color: var(--text-2); font-size: 13.8px; }
.guide-notes li { margin: 5px 0; }
.guide .hint .sem { vertical-align: middle; margin: 0 2px; }
.print-only { display: none; }
@media (max-width: 1000px) { .guide { grid-template-columns: 1fr; } .guide-toc { display: none; } .guide-toc-mobile { display: block; } }
/* ---------- login ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--brand-700); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 28px 28px; }
.login-art::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 140px 140px; }
.login-art > * { position: relative; z-index: 1; }
.login-art h1 { font-size: 34px; color: #fff; max-width: 480px; letter-spacing: -.02em; }
.login-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; color: #CFDAE6; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-art li .icon { color: var(--accent); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #fff; }
.login-form form { width: 100%; max-width: 360px; }

/* ---------- mobile / tablet ---------- */
.bottom-nav { display: none; }
.mobile-only { display: none !important; }
@media (max-width: 1280px) {
  .kpis:not(.k4) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tour-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  :root { --sidebar: 74px; }
  .brand { justify-content: center; padding: 14px 8px; }
  .sidebar .brand-name, .nav-section, .nav a span.lbl, .sidebar-foot { display: none; }
  .nav a { justify-content: center; padding: 11px 0; }
  .nav .count { position: absolute; top: 3px; right: 6px; font-size: 10px; padding: 0 5px; min-width: 17px; }
  .nav a.active::before { left: -10px; }
  .triage { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
  .topbar { gap: 8px; padding: 0 14px; }
  .topbar .title { flex: 0 1 auto; max-width: 200px; }
  .search { flex: 1 1 140px; }
  .topbar .viewas select { max-width: 150px; }
  .fb-label { display: none; }
  .mail { grid-template-columns: 320px 1fr; }
  .money-grid { grid-template-columns: repeat(2, 1fr); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; }
  .login-art h1 { font-size: 26px; }
}
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 10px 12px; }
  .table.responsive td { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 0; padding: 3px 0; }
  .table.responsive td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 12px; font-weight: 600; }
  .table.responsive td.td-main { display: block; padding-bottom: 6px; }
  .table.responsive td.desktop-only { display: none !important; }
  .table.responsive .r { text-align: right; }
  .table.responsive .mobile-only { display: initial !important; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 8px; height: 56px; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
  .topbar .title { font-size: 15.5px; }
  .topbar .brand-mini { display: flex !important; }
  .search { display: none; }
  .search.open { display: block; position: fixed; top: 8px; left: 8px; right: 8px; z-index: 70; }
  .content { padding: 14px 12px 96px; }
  .page-head { margin-bottom: 12px; }
  h1 { font-size: 20px; }
  .mobile-only { display: initial !important; }
  .desktop-only { display: none !important; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi .k-val { font-size: 21px; }
  .briefing { grid-template-columns: 1fr; padding: 16px; }
  .team-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .split { grid-template-columns: 1fr; }
  .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-row { grid-template-columns: 26px 1fr; }
  .doc-row > :last-child { grid-column: 2; justify-content: flex-start !important; }
  .mail-view { overflow-x: hidden; }
  .mail { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .mail-list { border-right: 0; }
  .mail.viewing .mail-list { display: none; }
  .mail:not(.viewing) .mail-view { display: none; }
  .thread { min-height: 50vh; }
  .p-head { grid-template-columns: 1fr; }
  .money-grid { grid-template-columns: 1fr 1fr; }
  .tour-items { grid-template-columns: 1fr; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255,255,255,.97); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); text-decoration: none; position: relative; padding: 4px 0; background: none; border: 0; }
  .bottom-nav .active { color: var(--brand); }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .bottom-nav .count { position: absolute; top: 0; left: 52%; background: var(--danger); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; font-weight: 700; }
  .fab-feedback { bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; height: 40px; padding: 0 12px; font-size: 13px; }
  .fab-feedback .lbl { display: none; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.wide, .modal.xwide { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; max-height: 92dvh; animation: up .2s ease-out; }
  .modal-foot { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  @keyframes up { from { transform: translateY(40px); opacity: .4; } }
  .cal .cd { min-height: 54px; padding: 3px; }
  .cal .ev { font-size: 0; height: 6px; padding: 0; }
  .li { padding: 11px 12px; }
  .card-head, .card-body { padding-left: 12px; padding-right: 12px; }
  .drawer-notifs { position: fixed; top: 60px; left: 8px; right: 8px; width: auto; }
}
.brand-mini { display: none !important; align-items: center; gap: 8px; }
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .topbar, .bottom-nav, .fab-feedback, .no-print, .toasts, .overlay { display: none !important; }
  .print-only { display: block !important; }
  .guide { display: block; }
  .guide-body { max-width: none; }
  .guide-cover { break-after: page; padding-top: 30mm; }
  .guide-index { columns: 2; font-size: 13px; color: #3D4856; margin-top: 18px; }
  .guide-sec { border: 0; box-shadow: none; border-radius: 0; padding: 0 0 6mm; margin: 0 0 6mm; border-bottom: 1px solid #E2E5EA; break-inside: avoid; }
  .guide-sec h2 { break-after: avoid; }
  .guide-steps li, .guide-notes li, .guide-sec .hint { break-inside: avoid; }
  .app { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
}
