/* ==========================================================================
   Incanto Studio — CRM
   ========================================================================== */
body.crm {
  min-height: 100vh; padding: 20px;
  background:
    radial-gradient(900px 620px at 100% 100%, rgba(216, 241, 93, .55), transparent 65%),
    radial-gradient(700px 520px at 0% 0%, rgba(232, 245, 190, .7), transparent 60%),
    #eff1ea;
}
.app { max-width: 1640px; margin: 0 auto; background: #fbfbf9; border-radius: 30px; padding: 16px 22px 24px; box-shadow: 0 1px 2px rgba(15, 16, 13, .04), 0 40px 100px -40px rgba(15, 16, 13, .25), inset 0 0 0 1px rgba(255, 255, 255, .8); min-height: calc(100vh - 40px); }

/* ---------- top ---------- */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 4px 0 14px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; font-size: 20px; letter-spacing: -.045em; }
.brand b { color: #8cad00; }
.brand-tag { font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--accent); }
.logo-mark { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 17px; }
.logo-mark i { width: 4.5px; border-radius: 3px; background: currentColor; }
.logo-mark i:nth-child(1) { height: 8px; } .logo-mark i:nth-child(2) { height: 17px; } .logo-mark i:nth-child(3) { height: 12px; }
.tabs { display: flex; gap: 4px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 15px; border-radius: 10px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); background: #f0f0ec; transition: .2s; }
.tabs a:hover { background: #e8e8e3; }
.tabs a.is-on { background: var(--ink); color: #fff; }
.tab-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; }
.tab-count:empty { display: none; }
.top-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.bell { position: relative; }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: #e2683c; box-shadow: 0 0 0 2px #fff; }
.me { display: flex; align-items: center; gap: 9px; padding: 3px 12px 3px 3px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.me b { display: block; font-size: 13px; line-height: 1.2; }
.me span { font-size: 11.5px; color: var(--muted); }

/* ---------- sub ---------- */
.sub { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.omni { position: relative; display: flex; align-items: center; gap: 9px; width: min(420px, 100%); height: 46px; padding: 0 12px 0 15px; border-radius: 14px; background: #f0f0ec; color: var(--muted); }
.omni input { flex: 1; border: 0; background: transparent; outline: none; font-size: 14px; color: var(--ink); }
.omni:focus-within { background: #fff; box-shadow: inset 0 0 0 1px var(--ink); }
.omni kbd { font: 600 11px var(--font); padding: 2px 7px; border-radius: 6px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.omni-res { position: absolute; z-index: 1500; left: 0; right: 0; top: 52px; max-height: 360px; overflow-y: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px; }
.omni-res button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; text-align: left; font-size: 13.5px; color: var(--ink); }
.omni-res button:hover, .omni-res button.is-on { background: var(--surface-2); }
.omni-res img, .omni-res .av { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; }
.omni-res small { display: block; color: var(--muted); font-size: 12px; }
.omni-res .none { padding: 12px; color: var(--muted); font-size: 13px; }
.sub-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.info-chip { display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0 16px; border-radius: 14px; background: #f0f0ec; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.info-chip b { color: var(--ink); font-weight: 550; }

/* ---------- card base ---------- */
.card { background: #fff; border-radius: 22px; box-shadow: inset 0 0 0 1px #ededE8; position: relative; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 0; }
.card-h h3 { font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.card-h-r { display: flex; gap: 6px; }
.round { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: inset 0 0 0 1px var(--line); transition: .2s; color: var(--ink-2); }
.round:hover { box-shadow: inset 0 0 0 1px var(--ink); color: var(--ink); }
.round.sm { width: 32px; height: 32px; }

/* ==========================================================================
   DASHBOARD
   ========================================================================== */
.dash { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, .82fr); grid-template-rows: minmax(300px, auto) minmax(330px, auto); gap: 14px; }
.c-map { grid-row: span 2; overflow: hidden; min-height: 660px; background: #1b1d18; }
.dash-map { position: absolute; inset: 0; border-radius: 22px; }
.dash-map .leaflet-control-attribution { background: rgba(15, 16, 13, .5) !important; color: #ccc; }
.dash-map .leaflet-control-attribution a { color: #ddd; }
.map-actions { position: absolute; z-index: 500; top: 14px; right: 14px; display: flex; gap: 8px; }
.map-actions .round { background: rgba(255, 255, 255, .92); box-shadow: none; backdrop-filter: blur(8px); }
.lot-pop {
  position: absolute; z-index: 500; top: 14px; left: 14px; width: 250px; padding: 12px; border-radius: 18px;
  background: rgba(255, 255, 255, .78); backdrop-filter: blur(14px) saturate(1.3); box-shadow: var(--shadow);
  animation: rise .4s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.lot-pop .lp-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lot-pop h4 { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.lot-pop ul { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 7px; }
.lot-pop li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.lot-pop li .i { color: var(--muted); }
.lot-pop .btn { width: 100%; height: 34px; }
.map-dock {
  position: absolute; z-index: 500; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px;
  padding: 5px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-lg);
}
.map-dock button { width: 46px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); transition: .2s; }
.map-dock button:hover { background: var(--surface-2); }
.map-dock button.is-on { background: var(--accent); color: var(--accent-ink); }
.dock-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.lot-node { position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .35), 0 4px 12px rgba(0, 0, 0, .4); display: grid; place-items: center; cursor: pointer; transition: transform .25s var(--ease); }
.lot-node i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.lot-node:hover { transform: translate(-50%, -50%) scale(1.15); }
.lot-node.is-on { background: var(--accent); box-shadow: 0 0 0 6px rgba(216, 241, 93, .35), 0 4px 12px rgba(0, 0, 0, .4); }
.lot-node .n { position: absolute; top: -9px; right: -11px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

/* chart */
.c-chart { display: flex; flex-direction: column; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 16px 0; }
.kpi small { display: block; font-size: 12px; color: var(--muted); }
.kpi b { font-size: 22px; font-weight: 550; letter-spacing: -.035em; }
.kpi em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--ok); margin-left: 4px; }
.chart { position: relative; flex: 1; min-height: 160px; display: flex; align-items: flex-end; gap: 4px; padding: 26px 16px 0; }
.chart .b { flex: 1; min-width: 3px; border-radius: 3px 3px 0 0; background: repeating-linear-gradient(180deg, #e7e8e2 0 3px, #f2f2ee 3px 5px); position: relative; cursor: pointer; transition: background .2s; }
.chart .b.wk { background: repeating-linear-gradient(180deg, #d8f15d 0 3px, #ebf7b4 3px 5px); }
.chart .b:hover, .chart .b.is-on { background: var(--ink); }
.chart-tip { position: absolute; z-index: 5; transform: translate(-50%, -100%); padding: 8px 10px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); font-size: 11.5px; color: var(--muted); white-space: nowrap; pointer-events: none; margin-top: -10px; }
.chart-tip b { display: block; font-size: 16px; color: var(--ink); letter-spacing: -.02em; }
.chart-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink); pointer-events: none; }
.chart-axis { display: flex; justify-content: space-between; padding: 8px 16px 14px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line); margin: 0 16px; padding-left: 0; padding-right: 0; }

/* feature */
.c-feature { display: flex; flex-direction: column; }
.strip { display: flex; gap: 8px; padding: 14px 0 0 16px; overflow: hidden; align-items: center; height: 136px; }
.strip button { flex: none; width: 64px; height: 92px; border-radius: 14px; overflow: hidden; opacity: .75; transition: width .45s var(--ease), height .45s var(--ease), opacity .3s; }
.strip button.is-on { width: 118px; height: 120px; opacity: 1; }
.strip img { width: 100%; height: 100%; object-fit: cover; }
.feat { padding: 12px 16px 16px; display: grid; gap: 10px; }
.feat h4 { font-size: 14.5px; font-weight: 600; letter-spacing: -.015em; }
.feat p { font-size: 12px; color: var(--muted); }
.feat-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.feat-stats div b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.feat-stats div small { font-size: 11px; color: var(--muted); }
.feat-foot { display: flex; gap: 6px; align-items: center; }

/* upcoming */
.c-upcoming { display: flex; flex-direction: column; min-height: 0; }
.upcoming { padding: 8px 16px 14px; overflow-y: auto; max-height: 360px; }
.up-month { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 10px 0 6px; }
.up-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 14px; background: var(--surface-2); margin-bottom: 6px; cursor: pointer; transition: background .2s; }
.up-row:hover { background: #f0f1ec; }
.up-date { text-align: center; line-height: 1.05; }
.up-date small { font-size: 10.5px; color: var(--muted); }
.up-date b { display: block; font-size: 21px; font-weight: 500; letter-spacing: -.03em; }
.up-date.is-soon b { color: #e2683c; }
.up-t { min-width: 0; }
.up-t b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-t small { display: block; font-size: 11.5px; color: var(--muted); }
.av-stack .av { width: 26px; height: 26px; font-size: 10px; }
.av-more { width: 26px; height: 26px; border-radius: 50%; background: var(--soft); font-size: 10px; font-weight: 600; display: grid; place-items: center; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--ink-2); }
.pill.dark { background: var(--ink); color: #fff; }
.pill.lime { background: var(--accent); color: var(--accent-ink); }
.pill.amber { background: var(--warn-bg); color: var(--warn); }
.pill.green { background: var(--ok-bg); color: var(--ok); }

/* hot leads */
.c-hot { display: flex; flex-direction: column; }
.fan { position: relative; height: 210px; margin: 6px 0 0; }
.fan .fc { position: absolute; left: 50%; top: 14px; width: 128px; height: 170px; border-radius: 18px; overflow: hidden; box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .45); cursor: pointer; transition: transform .45s var(--ease); background: var(--soft); }
.fan .fc img, .fan .fc .ph { width: 100%; height: 100%; object-fit: cover; }
.fan .fc .ph { display: grid; place-items: center; font-size: 34px; font-weight: 600; background: var(--accent-2); color: var(--accent-ink); }
.fan .fc span { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(15, 16, 13, .6); color: #fff; font-size: 11.5px; font-weight: 550; backdrop-filter: blur(6px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fan .fc:nth-child(1) { transform: translateX(-118%) rotate(-9deg) scale(.86); z-index: 1; }
.fan .fc:nth-child(2) { transform: translateX(-50%) translateY(-6px); z-index: 3; }
.fan .fc:nth-child(3) { transform: translateX(18%) rotate(9deg) scale(.86); z-index: 2; }
.fan:hover .fc:nth-child(1) { transform: translateX(-128%) rotate(-12deg) scale(.86); }
.fan:hover .fc:nth-child(3) { transform: translateX(28%) rotate(12deg) scale(.86); }
.hot-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 16px 16px; margin-top: auto; }
.hot-stats div { padding-top: 10px; border-top: 1px solid var(--line); }
.hot-stats .i { color: var(--muted); margin-bottom: 6px; }
.hot-stats small { display: block; font-size: 11px; color: var(--muted); }
.hot-stats b { font-size: 15.5px; font-weight: 600; letter-spacing: -.02em; }

/* ==========================================================================
   VISTE: header
   ========================================================================== */
.view { animation: rise .35s var(--ease); }
.view-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 16px; }
.view-h h1 { font-size: 28px; font-weight: 550; letter-spacing: -.04em; }
.view-h p { font-size: 13.5px; margin-top: 2px; }
.view-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip .n { font-size: 11px; color: var(--faint); font-weight: 600; }
.chip.is-on .n { color: #a6a89f; }

/* ==========================================================================
   KANBAN
   ========================================================================== */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; min-height: calc(100vh - 260px); }
.col { background: #f3f3ef; border-radius: 20px; padding: 10px; display: flex; flex-direction: column; min-height: 400px; transition: background .2s, box-shadow .2s; }
.col.is-over { background: #edf6c8; box-shadow: inset 0 0 0 2px var(--accent); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.col-h b { font-size: 13.5px; font-weight: 600; }
.col-h .cnt { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #fff; font-size: 11.5px; font-weight: 600; display: grid; place-items: center; }
.col-h small { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.col-h .sd { width: 8px; height: 8px; border-radius: 50%; }
.col-body { display: grid; gap: 8px; align-content: start; flex: 1; }
.lc { background: #fff; border-radius: 16px; padding: 12px; box-shadow: 0 1px 2px rgba(15, 16, 13, .05), inset 0 0 0 1px #ececE7; cursor: grab; transition: transform .2s, box-shadow .2s; position: relative; }
.lc:hover { box-shadow: 0 10px 24px -12px rgba(15, 16, 13, .3), inset 0 0 0 1px #e0e0da; }
.lc.dragging { opacity: .45; transform: scale(.98); }
.lc.is-new::before { content: ''; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: #e2683c; box-shadow: 0 0 0 3px rgba(226, 104, 60, .18); }
.lc-h { display: flex; gap: 10px; align-items: center; }
.lc-h b { display: block; font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.lc-h small { display: block; font-size: 11.5px; color: var(--muted); }
.lc-lot { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding: 6px; border-radius: 11px; background: var(--surface-2); }
.lc-lot img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.lc-lot b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-lot small { font-size: 11px; color: var(--muted); }
.lc-lot > div { min-width: 0; }
.lc-f { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.lc-f .tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--soft); font-size: 11px; font-weight: 550; color: var(--ink-2); }
.lc-f .tag.area { background: var(--accent-2); color: var(--accent-ink); }
.lc-f .score { margin-left: auto; font-size: 11.5px; font-weight: 700; }
.score.hi { color: var(--ok); } .score.mid { color: var(--warn); } .score.lo { color: var(--muted); }
.col-empty { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 18px; text-align: center; font-size: 12.5px; color: var(--faint); }

/* ==========================================================================
   TABELLA ASTE
   ========================================================================== */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 22px; box-shadow: inset 0 0 0 1px #ededE8; }
.table { width: 100%; border-collapse: collapse; min-width: 980px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid #f0f0ec; font-size: 13.5px; vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.t-lot { display: flex; align-items: center; gap: 12px; }
.t-lot img { width: 54px; height: 42px; border-radius: 10px; object-fit: cover; }
.t-lot b, .t-two b { display: block; font-weight: 600; }
.t-lot small, .t-two small { display: block; color: var(--muted); font-size: 12px; }
.prog { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.prog .track { flex: 1; height: 6px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.prog .track i { display: block; height: 100%; border-radius: 6px; background: var(--ink); }
.prog.full .track i { background: var(--ok); }
.prog span { font-size: 12px; font-weight: 600; }

/* ==========================================================================
   AGENDA
   ========================================================================== */
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-left: 10px; }
.ev-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.ev-dot.asta { background: var(--ink); } .ev-dot.termine { background: #e9a23b; } .ev-dot.visita { background: #9cc11c; } .ev-dot.richiamo { background: var(--info); }
.agenda { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.cal { padding: 16px; }
.cal-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-h b { font-size: 15px; font-weight: 600; text-transform: capitalize; }
.cal-h div { display: flex; gap: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-grid .dow { font-size: 10.5px; font-weight: 600; color: var(--faint); padding-bottom: 4px; }
.cal-grid button { height: 38px; border-radius: 10px; font-size: 13px; position: relative; display: grid; place-items: center; }
.cal-grid button:hover { background: var(--surface-2); }
.cal-grid button.out { color: var(--line-2); }
.cal-grid button.today { background: var(--ink); color: #fff; }
.cal-grid button.sel { box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-grid .dots { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
.cal-grid .dots i { width: 4px; height: 4px; border-radius: 50%; }
.cal-sum { margin-top: 16px; display: grid; gap: 8px; }
.cal-sum div { display: flex; justify-content: space-between; font-size: 13px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.events { padding: 8px 18px 18px; max-height: calc(100vh - 230px); overflow-y: auto; }
.ev-day { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid #f0f0ec; }
.ev-day:last-child { border-bottom: 0; }
.ev-day.is-sel { background: linear-gradient(90deg, rgba(216, 241, 93, .18), transparent); border-radius: 14px; }
.ev-d small { display: block; font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.ev-d b { font-size: 26px; font-weight: 500; letter-spacing: -.04em; }
.ev-list { display: grid; gap: 6px; }
.ev { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: background .2s; }
.ev:hover { background: #f0f1ec; }
.ev time { font-size: 12.5px; font-weight: 600; width: 44px; flex: none; }
.ev .ev-t { min-width: 0; flex: 1; }
.ev .ev-t b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .ev-t small { font-size: 12px; color: var(--muted); }

/* ==========================================================================
   DRAWER
   ========================================================================== */
.drawer { position: fixed; inset: 0; z-index: 3000; }
.drawer-bg { position: absolute; inset: 0; background: rgba(15, 16, 13, .28); backdrop-filter: blur(3px); animation: fade .3s ease both; }
@keyframes fade { from { opacity: 0; } }
.drawer-panel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(500px, calc(100% - 24px)); background: #fff; border-radius: 26px; box-shadow: var(--shadow-lg); overflow-y: auto; animation: slideIn .45s var(--ease) both; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer.closing .drawer-panel { animation: slideOut .25s ease both; }
.drawer.closing .drawer-bg { animation: fadeOut .25s ease both; }
@keyframes slideOut { to { transform: translateX(30px); opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.d-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); }
.d-head .av { width: 48px; height: 48px; font-size: 16px; }
.d-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
.d-head p { font-size: 12.5px; color: var(--muted); }
.d-head .round { margin-left: auto; flex: none; }
.d-body { padding: 0 18px 24px; display: grid; gap: 18px; }
.d-sec h4 { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.d-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.d-actions a { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 14px; background: var(--surface-2); font-size: 12px; font-weight: 550; transition: .2s; }
.d-actions a:hover { background: var(--ink); color: #fff; }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stages button { height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 550; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: .2s; }
.stages button.is-on { background: var(--ink); color: #fff; box-shadow: none; }
.kv2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kv2 div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.kv2 small { display: block; font-size: 11.5px; color: var(--muted); }
.kv2 b { font-size: 13.5px; font-weight: 600; word-break: break-word; }
.quote { padding: 12px 14px; border-radius: 14px; background: var(--accent-2); color: var(--accent-ink); font-size: 13.5px; line-height: 1.5; }
.d-lot { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); }
.d-lot img { width: 76px; height: 62px; border-radius: 12px; object-fit: cover; }
.d-lot b { display: block; font-size: 13.5px; font-weight: 600; }
.d-lot small { display: block; font-size: 12px; color: var(--muted); }
.d-lot .round { margin-left: auto; flex: none; }
.d-map { height: 200px; border-radius: 16px; overflow: hidden; }
.note-form { display: flex; gap: 8px; }
.note-form textarea { flex: 1; min-height: 44px; height: 44px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); resize: vertical; outline: none; font-size: 13.5px; }
.note-form textarea:focus { border-color: var(--ink); background: #fff; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding: 8px 0; position: relative; font-size: 13px; }
.tl::before { content: ''; position: absolute; left: 6px; top: 22px; bottom: -8px; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl i { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); margin-top: 3px; }
.tl.note i { border-color: var(--ink); background: var(--accent); }
.tl small { display: block; color: var(--muted); font-size: 11.5px; }
.d-foot { display: flex; gap: 8px; justify-content: space-between; padding-top: 6px; }
.danger { color: var(--danger); }
.doc-check { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.doc-check:hover { background: var(--surface-2); }
.doc-check .d-i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.doc-check > div { flex: 1; min-width: 0; }
.doc-check b { display: block; font-size: 13px; font-weight: 600; }
.doc-check small { font-size: 11.5px; color: var(--muted); }
.switch { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.doc-check.on .switch { background: var(--ok); }
.doc-check.on .switch::after { transform: translateX(16px); }
.doc-check:not(.on) .d-i { background: var(--warn-bg); color: var(--warn); }
.d-hero { height: 190px; border-radius: 18px; overflow: hidden; position: relative; }
.d-hero img { width: 100%; height: 100%; object-fit: cover; }
.d-hero .pill { position: absolute; top: 10px; left: 10px; }
.mini-lead { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.mini-lead:hover { background: var(--surface-2); }
.mini-lead > div { flex: 1; min-width: 0; }
.mini-lead b { display: block; font-size: 13px; }
.mini-lead small { font-size: 11.5px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .span-2 { grid-column: span 2; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1280px) {
  .dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .c-map { grid-column: span 2; grid-row: auto; min-height: 480px; }
}
@media (max-width: 900px) {
  body.crm { padding: 8px; }
  .app { padding: 12px; border-radius: 22px; }
  .top { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; scrollbar-width: none; }
  .tabs a { flex: none; }
  .me div { display: none; }
  .me { padding: 3px; }
  .dash { grid-template-columns: 1fr; }
  .c-map { grid-column: auto; }
  .agenda { grid-template-columns: 1fr; }
  .info-chip { height: 38px; font-size: 12.5px; }
  .legend { display: none; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .board { grid-auto-columns: 84%; }
  .form-grid, .kv2 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

/* ==========================================================================
   DA FARE ADESSO
   ========================================================================== */
.c-todo { display: flex; flex-direction: column; }
.todo { padding: 8px 16px 14px; display: grid; align-content: start; }
.todo-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px 2px; border-bottom: 1px solid #f0f0ec; text-align: left; font-size: 14px; color: var(--ink-2); transition: color .2s, padding .25s var(--ease); }
.todo-row:last-child { border-bottom: 0; }
.todo-row b { font-family: var(--serif); font-size: 36px; font-weight: 400; line-height: 1; color: var(--ink); }
.todo-row .i { color: var(--faint); transition: transform .25s var(--ease), color .2s; }
.todo-row:hover { color: var(--ink); padding-left: 6px; }
.todo-row:hover .i { color: var(--ink); transform: translateX(3px); }
.todo-none { padding: 24px 2px; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.2; }

/* ==========================================================================
   CLIENTI: elenco
   ========================================================================== */
.mode { display: flex; padding: 3px; border-radius: 12px; background: #f0f0ec; }
.mode button { height: 28px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); transition: .2s; }
.mode button.is-on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
#clientTable { min-width: 920px; }
#clientTable .t-lot .av { width: 38px; height: 38px; border-radius: 50%; }
#clientTable tr.is-new .t-lot b::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: #e2683c; vertical-align: middle; }
.table tr.is-empty { cursor: default; }
.table tr.is-empty td { padding: 44px 16px; text-align: center; color: var(--muted); }
.pill .sd { width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.pill.sm { height: 18px; padding: 0 7px; font-size: 10.5px; vertical-align: 1px; margin-left: 3px; }
.fit-n { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12.5px; font-weight: 700; }
.fit-todo { color: #c2541f; font-weight: 600; }

/* scheda cliente */
.wish { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wish .input { height: 42px; }
.wish-types, .wish-alert { grid-column: 1 / -1; }
.wish-alert { padding: 9px 10px; background: var(--surface-2); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; font-weight: 500; transition: .2s; }
.seg button.is-on { background: var(--ink); color: #fff; box-shadow: none; }
.fit-lot { display: flex; align-items: center; gap: 10px; padding: 7px; border-radius: 13px; cursor: pointer; transition: background .15s; }
.fit-lot:hover { background: var(--surface-2); }
.fit-lot img { width: 50px; height: 42px; border-radius: 9px; object-fit: cover; flex: none; }
.fit-lot > div { flex: 1; min-width: 0; }
.fit-lot b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fit-lot small { font-size: 11.5px; color: var(--muted); }
.sub-box { padding: 12px; border-radius: 14px; background: var(--surface-2); }
.sub-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sub-row small { display: block; font-size: 11.5px; color: var(--muted); }
.sub-row b { font-size: 14px; font-weight: 600; }
.sub-acts { display: flex; gap: 6px; margin-top: 10px; }
.d-lotbtns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mini-lead small { display: block; }

/* avvisi */
.n-row { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 13px; cursor: pointer; transition: background .15s; }
.n-row:hover { background: var(--surface-2); }
.n-row.is-off { cursor: default; opacity: .72; }
.n-row.is-off:hover { background: none; }
.n-t { flex: 1; min-width: 0; }
.n-t b { display: block; font-size: 13.5px; font-weight: 600; }
.n-t small { display: block; font-size: 11.5px; color: var(--muted); }
.n-t .n-state { color: var(--faint); }
.n-row.on .switch { background: var(--ok); }
.n-row.on .switch::after { transform: translateX(16px); }
.n-call { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); background: #fff; transition: .2s; }
.n-call:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.n-call.is-on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.n-mail { padding: 14px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 10px; font-size: 13.5px; }
.n-sub { padding-bottom: 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.n-sub small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.n-hi em { font-style: normal; padding: 1px 6px; border-radius: 6px; background: var(--accent-2); color: var(--accent-ink); font-size: 12.5px; }
.n-mail .textarea { min-height: 84px; font-size: 13.5px; }
.n-lot { display: flex; gap: 10px; align-items: center; padding: 7px; border-radius: 12px; background: var(--surface-2); }
.n-lot img { width: 76px; height: 58px; border-radius: 9px; object-fit: cover; flex: none; }
.n-lot b { display: block; font-size: 13px; font-weight: 600; }
.n-lot small { display: block; font-size: 11.5px; color: var(--muted); }

/* ==========================================================================
   SCHEDA IMMOBILE
   ========================================================================== */
.ed-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.ed-back:hover { color: var(--ink); }
.ed { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.ed-main { display: grid; gap: 12px; min-width: 0; }
.ed-sec { display: grid; grid-template-columns: 52px minmax(0, 1fr); padding: 22px 24px 24px 14px; }
.ed-n { font-family: var(--serif); font-style: italic; font-size: 34px; line-height: 1; color: #8cad00; text-align: center; }
.ed-b h3 { font-size: 19px; font-weight: 600; letter-spacing: -.025em; }
.ed-b > p { font-size: 13.5px; color: var(--muted); margin: 2px 0 14px; }
.form-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-4 { grid-column: 1 / -1; }
.form-grid.g4 .input, .form-grid.g4 .dd-trigger { height: 44px; }
.ed-pvp { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 13px; margin-bottom: 12px; border-radius: 12px; background: var(--accent-2); color: var(--accent-ink); font-size: 13px; }
.link-btn { font-size: 13px; font-weight: 550; color: inherit; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.ed-find .btn { width: 100%; height: 44px; }
.ed-map { height: 280px; margin-top: 12px; border-radius: 16px; overflow: hidden; cursor: crosshair; }
.ed-calc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-self: end; min-height: 44px; padding: 7px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.ed-calc small { display: block; font-size: 11.5px; color: var(--muted); }
.ed-calc b { font-size: 14px; font-weight: 600; color: var(--ink); }
.form-grid .ed-calc.span-2 { grid-column: span 2; }
.ed-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.ed-ph { position: relative; margin: 0; height: 100px; border-radius: 13px; overflow: hidden; cursor: pointer; background: var(--soft); }
.ed-ph img { width: 100%; height: 100%; object-fit: cover; }
.ed-ph figcaption { position: absolute; left: 7px; bottom: 7px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 20px; }
.ed-ph figcaption:empty { display: none; }
.ed-ph-x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .92); opacity: 0; transition: opacity .15s; }
.ed-ph:hover .ed-ph-x, .ed-ph-x:focus-visible { opacity: 1; }
.ed-ph-add { display: grid; place-content: center; justify-items: center; gap: 4px; height: 100px; border-radius: 13px; border: 1.5px dashed var(--line-2); color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: .2s; }
.ed-ph-add:hover { border-color: var(--ink); color: var(--ink); }
.ed-flags { display: grid; gap: 8px; margin-bottom: 10px; }
.ed-flags:empty { display: none; }
.ed-flag { display: flex; align-items: center; gap: 8px; }
.ed-flag .input { height: 40px; }
.ed-flag-t { flex: none; width: 92px; height: 32px; border-radius: 999px; font-size: 12px; font-weight: 600; transition: .15s; }
.ed-flag-t.ok { background: var(--ok-bg); color: var(--ok); }
.ed-flag-t.warn { background: var(--warn-bg); color: var(--warn); }
.ed-flag-t.info { background: var(--info-bg); color: var(--info); }
.ed-side { position: sticky; top: 14px; display: grid; gap: 12px; }
.ed-pub { padding: 12px; display: grid; gap: 10px; }
.ed-prev > b { display: block; margin-top: 10px; font-size: 15px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.ed-prev > small { font-size: 12.5px; color: var(--muted); }
.ed-prev-img { position: relative; height: 160px; border-radius: 14px; overflow: hidden; background: var(--soft); }
.ed-prev-img img { width: 100%; height: 100%; object-fit: cover; }
.ed-prev-img .pill { position: absolute; top: 8px; left: 8px; }
.ed-prev-img .pill:not(.green):not(.amber):not(.dark) { background: rgba(255, 255, 255, .92); }
.ed-prev-p { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ed-prev-p small { display: block; font-size: 11.5px; color: var(--muted); }
.ed-prev-p b { font-size: 18px; font-weight: 600; letter-spacing: -.03em; }
.ed-pub > .doc-check { background: var(--surface-2); }
.ed-gaps p { padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: #8a5a12; font-size: 12.5px; line-height: 1.5; }
.ed-gaps b { display: block; font-weight: 650; }
.ed-gaps span { display: block; }
.ed-gaps span::before { content: '· '; }
.ed-gaps:empty { display: none; }
.ed-btns { display: grid; gap: 6px; }
.ed-fit { padding: 14px; max-height: 340px; overflow-y: auto; }
.ed-fit h4 { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.ed-fit h4 span { color: #6d8700; }
.ed-fit .muted { font-size: 12.5px; }

/* ==========================================================================
   IMPOSTAZIONI
   ========================================================================== */
.settings { display: grid; gap: 12px; max-width: 900px; }
.set { padding: 22px 24px; }
.set-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.set-h h3 { font-size: 19px; font-weight: 600; letter-spacing: -.025em; }
.set-h p { font-size: 14px; color: var(--muted); margin-top: 3px; max-width: 520px; }
.set-sw { flex: none; width: 240px; background: var(--surface-2); }
.set-kv { display: flex; gap: 40px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.set-kv b { font-family: var(--serif); font-size: 36px; font-weight: 400; line-height: 1; }
.set-kv small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.set-list { margin-top: 10px; }
.set-note { margin-top: 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }

@media (max-width: 1180px) {
  .ed { grid-template-columns: minmax(0, 1fr); }
  .ed-side { position: static; order: -1; }
}
@media (max-width: 640px) {
  .ed-sec { grid-template-columns: 1fr; padding: 18px; }
  .ed-n { text-align: left; margin-bottom: 4px; }
  .form-grid.g4, .wish { grid-template-columns: 1fr 1fr; }
  .form-grid.g4 .span-2 { grid-column: 1 / -1; }
  .set-h { flex-direction: column; gap: 12px; }
  .set-sw { width: 100%; }
}
