/* CRM + Marketing */
.xtool { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.xtool input[type="search"] { flex: 1 1 240px; min-width: 0; }
.xtool select { flex: 0 1 auto; }
.xtool input[type="search"] { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.xtool input[type="search"]:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; }
a.btn, a.btn:hover { text-decoration: none; }
.xsp { flex: 1 1 auto; }
.xfile { cursor: pointer; }
.xempty { padding: 28px 8px; text-align: center; }

.xb { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.xb.s-da-contattare, .xb.s-da-discutere { background: color-mix(in srgb, var(--ink-3) 16%, transparent); color: var(--ink-2); }
.xb.s-contattato, .xb.s-approvata { background: color-mix(in srgb, var(--fb) 14%, transparent); color: color-mix(in srgb, var(--fb) 80%, var(--ink)); }
.xb.s-ha-risposto, .xb.s-in-corso { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.xb.s-in-trattativa { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.xb.s-cliente, .xb.s-fatta { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.xb.s-non-interessato, .xb.s-scartata { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.xb.p-alta { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); }
.xb.p-media { background: var(--surface-2); color: var(--ink-2); }
.xb.p-bassa { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.xb.ch { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }

.xtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.xtable th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.xtable td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.xtable td a { color: inherit; text-decoration: none; }
.xtable tbody tr { cursor: pointer; }
.xtable tbody tr:hover, .xtable tbody tr:focus-visible { background: var(--surface-2); outline: none; }
.xtable .muted { font-size: 12px; margin-top: 2px; }
.xlate { color: var(--bad); font-weight: 600; }

.xboard { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.xboard.xideas { grid-template-columns: repeat(5, minmax(210px, 1fr)); }
.xcol { background: var(--surface-2); border-radius: 12px; padding: 8px; min-height: 140px; transition: box-shadow .15s; }
.xcol.xover { box-shadow: inset 0 0 0 2px var(--accent); }
.xcolh { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.xcolb { display: flex; flex-direction: column; gap: 8px; }
.xcard { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: inherit; text-decoration: none; font-size: 13px; line-height: 1.35; }
.xcard:hover { border-color: var(--ink-3); }
.xcard[draggable="true"] { cursor: grab; }
.xcard.xdragging { opacity: .45; }
.xcard .muted { font-size: 12px; }
.xmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.xdrop { text-align: center; padding: 14px 0; font-size: 12px; }

.xdetail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.xdetail.xone { grid-template-columns: minmax(0, 760px); }
.xdetail form.card .filters { margin-top: 14px; }
.xacts h3 { margin-bottom: 10px; }
.xactform { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.xactform textarea { width: 100%; resize: vertical; }
.xrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.xrow > select, .xrow > input { flex: 1 1 120px; }
.xinline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); flex: 1 1 auto; }
.xlog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.xlog li { border-left: 2px solid var(--line); padding: 2px 0 2px 12px; }
.xlog p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.xlogh { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.xx { margin-left: auto; border: 0; background: none; color: var(--ink-3); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }
.xx:hover, .xx.xarmed { color: var(--bad); }
.btn.xarmed { background: var(--bad); color: #fff; border-color: var(--bad); }
#xcom { margin: 14px 0 0; }

@media (max-width: 900px) {
  .xdetail { grid-template-columns: minmax(0, 1fr); }
  .xboard, .xboard.xideas { grid-template-columns: repeat(6, minmax(200px, 78vw)); scroll-snap-type: x mandatory; }
  .xcol { scroll-snap-align: start; }
}
