/* Cessione del Quinto – GruppoMoney
   Palette dal sito gruppomoney.it: verde #089e43, arancio #f59120 / #e28f12, inchiostro #0e0e0e */
:root {
  --green: #089e43;
  --green-700: #067a34;
  --green-800: #055c28;
  --green-50: #eaf7ef;
  --green-100: #d3efdd;
  --orange: #f59120;
  --orange-600: #e28f12;
  --orange-700: #b56a06;
  --orange-50: #fff4e6;
  --ink: #0e0e0e;
  --ink-2: #353535;
  --muted: #6b7177;
  --muted-2: #8d9297;
  --line: #e6e8e6;
  --line-2: #eff1ef;
  --bg: #f6f7f4;
  --card: #ffffff;
  --red: #c62828;
  --red-50: #fdecec;
  --amber: #b26a00;
  --amber-50: #fff5e0;
  --blue: #1f5fbf;
  --blue-50: #eaf1fc;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(14, 14, 14, .04), 0 4px 16px rgba(14, 14, 14, .05);
  --shadow-lg: 0 10px 40px rgba(14, 14, 14, .14);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r-pensionato: #7a4fd6; --r-pensionato-bg: #f1ecfc;
  --r-pubblico: #1f7ab8;  --r-pubblico-bg: #e8f3fb;
  --r-statale: #2747a8;   --r-statale-bg: #eaeefb;
  --r-parapubblico: #b56a06; --r-parapubblico-bg: #fff3e1;
  --r-privato: #067a34;   --r-privato-bg: #e6f5ec;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; line-height: 1.2; }
.num, .mono { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar::before {
  content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--green) 0 60%, var(--orange) 60% 100%);
}
.topbar-in {
  max-width: none; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand img { height: 42px; display: block; margin: -4px 0; }
.brand .tool {
  border-left: 1px solid var(--line); padding-left: 14px;
  font-weight: 700; font-size: 14px; color: var(--ink-2); letter-spacing: -.01em;
}
.brand .tool small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; letter-spacing: .02em; }
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 13.5px;
}
.topnav a:hover, .topnav a.active { background: var(--green-50); color: var(--green-800); text-decoration: none; }
.topnav a.nav-new { background: var(--orange); color: #fff; letter-spacing: .03em; }
.topnav a.nav-new:hover { background: var(--orange-600); color: #fff; }
.spacer { flex: 1; }
#newForm.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px rgba(245,145,32,.55); } 100% { box-shadow: var(--shadow); } }

/* ------------------------------------------------------------------ layout */
.wrap { max-width: none; margin: 0; padding: 26px 28px 80px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-h {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px 0;
}
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-b { padding: 16px 20px 20px; }
.section-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.grid { display: grid; gap: 18px; }

/* ------------------------------------------------------------------ buttons & form */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; font-size: 13.5px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap; color: inherit; background: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 2px 8px rgba(8,158,67,.25); }
.btn-primary:hover { background: var(--green-700); }
.btn-accent { background: var(--orange); color: #fff; box-shadow: 0 2px 8px rgba(245,145,32,.28); }
.btn-accent:hover { background: var(--orange-600); }
.btn-ghost { border-color: var(--line); background: #fff; color: var(--ink-2); }
.btn-ghost:hover { border-color: #cfd4cf; background: #fafbfa; }
.btn-danger { color: var(--red); border-color: #f1c9c9; background: #fff; }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 6px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; flex: none; }

label.lbl { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin: 0 0 6px; }
.input, textarea.input, select.input {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  padding: 10px 12px; border-radius: 10px; border: 1px solid #d9ddd9; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 92px; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(8,158,67,.15); }
.input-sm { padding: 6px 9px; font-size: 13px; border-radius: 8px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650;
  background: var(--line-2); color: var(--ink-2);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-50); color: var(--green-800); }
.badge-orange { background: var(--orange-50); color: var(--orange-700); }
.badge-red { background: var(--red-50); color: var(--red); }
.badge-amber { background: var(--amber-50); color: var(--amber); }
.badge-blue { background: var(--blue-50); color: var(--blue); }
.route { font-weight: 700; }
.route-pensionato { background: var(--r-pensionato-bg); color: var(--r-pensionato); }
.route-pubblico { background: var(--r-pubblico-bg); color: var(--r-pubblico); }
.route-statale { background: var(--r-statale-bg); color: var(--r-statale); }
.route-parapubblico { background: var(--r-parapubblico-bg); color: var(--r-parapubblico); }
.route-privato { background: var(--r-privato-bg); color: var(--r-privato); }

/* ------------------------------------------------------------------ home */
.hero {
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 28px; align-items: stretch; margin-bottom: 30px;
}
.hero-text {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(245,145,32,.22), transparent 55%),
    linear-gradient(155deg, #0a8a3c 0%, #067a34 55%, #055c28 100%);
  color: #fff; padding: 34px 34px 30px;
  display: flex; flex-direction: column;
}
.hero-text::after {
  content: ""; position: absolute; right: -60px; bottom: -70px; width: 260px; height: 260px;
  border-radius: 50%; border: 34px solid rgba(255,255,255,.07);
}
.hero-text .kicker {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: #ffd29a;
}
.hero-text h1 { font-size: 34px; font-weight: 800; margin: 10px 0 12px; letter-spacing: -.03em; }
.hero-text p { margin: 0; color: rgba(255,255,255,.86); max-width: 460px; }
.routes-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 26px; position: relative; z-index: 1; }
.routes-list span {
  font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
}
.steps { display: grid; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; position: relative; z-index: 1; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: rgba(255,255,255,.9); }
.steps b {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--orange); color: #fff; font-size: 12px;
}

.dropzone {
  border: 2px dashed #cfd6cf; border-radius: 12px; background: #fbfcfb;
  padding: 26px 20px; text-align: center; cursor: pointer; transition: all .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--green); background: var(--green-50); }
.dropzone .dz-icon {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 10px;
  display: grid; place-items: center; background: var(--green-50); color: var(--green);
}
.dropzone.drag .dz-icon { background: #fff; }
.dropzone strong { display: block; font-size: 15px; }
.dropzone .muted { font-size: 12.5px; }
.filelist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.filelist li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  background: var(--line-2); font-size: 13px;
}
.filelist li .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist li button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; }
.filetype {
  flex: none; width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: #fff; background: var(--muted-2); letter-spacing: .02em;
}
.filetype.pdf { background: #d6453d; }
.filetype.img { background: var(--blue); }

.list-head { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; }
.list-head h2 { font-size: 20px; font-weight: 800; }
.search {
  position: relative; margin-left: auto; width: 320px;
}
.search input { padding-left: 36px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--muted-2); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfcfb;
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; transition: background .1s; }
.tbl tbody tr.click:hover { background: #f7faf8; }
.tbl .r { text-align: right; }
.person { display: flex; align-items: center; gap: 12px; }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: var(--green-800); background: var(--green-100);
}
.person .n { font-weight: 700; }
.person .s { font-size: 12px; color: var(--muted); }
.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty svg { width: 42px; height: 42px; color: #c3cac3; margin-bottom: 8px; }

/* ------------------------------------------------------------------ cessionato */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.phead {
  display: flex; align-items: flex-start; gap: 20px; margin-bottom: 20px;
}
.phead .avatar { width: 58px; height: 58px; font-size: 20px; border-radius: 15px; }
.phead h1 { font-size: 26px; font-weight: 800; }
.phead .meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 6px; color: var(--muted); font-size: 13px; }
.phead .meta .sep { width: 4px; height: 4px; border-radius: 50%; background: #c8cdc8; }
.phead-actions { margin-left: auto; display: flex; gap: 8px; }
.hire {
  margin-left: auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px;
  border-radius: 13px; border: 1.5px solid var(--line); background: #fff; box-shadow: var(--shadow); white-space: nowrap;
}
.hire .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.hire .ic svg { width: 21px; height: 21px; }
.hire .l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hire .d { font-family: var(--mono); font-size: 21px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.hire .s { font-size: 12.5px; font-weight: 650; }
.hire.ok { border-color: #b9e3c8; } .hire.ok .ic { background: var(--green-50); color: var(--green); } .hire.ok .s { color: var(--green-700); }
.hire.warn { border-color: #f2d48f; background: #fffaf0; } .hire.warn .ic { background: var(--amber-50); color: var(--orange-700); } .hire.warn .s { color: var(--orange-700); }
.hire.bad { border-color: #f2b8b8; background: #fff7f7; } .hire.bad .ic { background: var(--red-50); color: var(--red); } .hire.bad .s { color: var(--red); }
.hire.none { border-style: dashed; } .hire.none .ic { background: var(--line-2); color: var(--muted-2); } .hire.none .s { color: var(--muted); }
.phead .hire + .phead-actions { margin-left: 0; }
.pname { flex: 1 1 360px; min-width: 0; }
.phead { flex-wrap: wrap; }
.phead .hire { margin-left: 0; }
.phead-side { display: flex; flex-direction: column; gap: 8px; width: 340px; flex: none; }
.phead-side .hire { width: 100%; }
.phead .phead-actions { margin-left: auto; order: 2; }
.phead .phead-side { order: 3; }
.phead-side .hire { white-space: normal; }
.emp { border-radius: 13px; border: 1.5px solid var(--line); background: #fff; box-shadow: var(--shadow); padding: 10px 14px 10px 12px;
  display: flex; gap: 12px; align-items: flex-start; }
.emp .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--line-2); color: var(--muted); }
.emp .ic svg { width: 21px; height: 21px; }
.emp .l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.emp .n { font-weight: 750; font-size: 14.5px; line-height: 1.25; margin: 1px 0 4px; overflow-wrap: anywhere; }
.emp .facts { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; font-size: 12.5px; }
.emp .facts dt { color: var(--muted); } .emp .facts dd { margin: 0; font-weight: 650; }
.emp .acts { display: flex; gap: 10px; margin-top: 5px; font-size: 12px; }
.emp .acts a { cursor: pointer; }
.emp.inps .ic { background: var(--green-50); color: var(--green); }
.emp .sm { font-size: 12px; color: var(--muted); }
.az-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.az-form .full { grid-column: 1 / -1; }
.layout > section, .layout > aside { min-width: 0; }
.imp-table { table-layout: fixed; }
.imp-table input, .imp-table select { min-width: 0; padding: 6px 7px; font-size: 13px; }
.imp-table input[type=checkbox] { width: auto; padding: 0; vertical-align: -2px; margin-right: 4px; }
.imp-table th { font-size: 10.5px; letter-spacing: .04em; padding: 10px 6px; }
.imp-table td { padding-left: 4px; padding-right: 4px; }
.imp-table tr.imp-main td { border-bottom: 0; padding-bottom: 4px; }
.imp-table tr.imp-sub td { padding-top: 2px; padding-bottom: 14px; }
.imp-table .prog { max-width: 260px; }
.name-edit { border: 1px dashed transparent; border-radius: 8px; padding: 0 4px; margin-left: -5px; }
.name-edit:hover { border-color: var(--line); }
.name-edit:focus { outline: none; border-color: var(--green); background: #fff; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi .k { font-size: 12px; font-weight: 650; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kpi .v { font-family: var(--mono); font-size: 25px; font-weight: 600; letter-spacing: -.03em; margin-top: 4px; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 18px; }
.kpi.hl { background: linear-gradient(160deg, #0a8a3c, #066a2e); color: #fff; border-color: transparent; }
.kpi.hl .k, .kpi.hl .s { color: rgba(255,255,255,.8); }
.meter { height: 7px; border-radius: 99px; background: var(--line-2); margin-top: 10px; position: relative; overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--green); }
.meter.warn i { background: var(--orange); }
.meter.bad i { background: var(--red); }
.meter .mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink-2); opacity: .5; }

.layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
.side { position: sticky; top: 78px; display: grid; gap: 18px; }

.esito {
  display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid; margin-bottom: 18px;
}
.esito .ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.esito .ico svg { width: 20px; height: 20px; }
.esito b { display: block; font-size: 15px; }
.esito.positivo { background: var(--green-50); border-color: var(--green-100); }
.esito.positivo .ico { background: var(--green); color: #fff; }
.esito.bloccante { background: var(--red-50); border-color: #f5cccc; }
.esito.bloccante .ico { background: var(--red); color: #fff; }
.esito.futuro, .esito.da_verificare { background: var(--amber-50); border-color: #f6dfb0; }
.esito.futuro .ico, .esito.da_verificare .ico { background: var(--orange); color: #fff; }
.esito.dati_insufficienti { background: #f3f4f3; border-color: var(--line); }
.esito.dati_insufficienti .ico { background: var(--muted-2); color: #fff; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  font: inherit; font-weight: 650; font-size: 14px; color: var(--muted); background: none; border: 0;
  padding: 10px 14px; cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
  display: inline-flex; gap: 8px; align-items: center;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--green-800); border-bottom-color: var(--green); }
.tab .count { font-size: 11.5px; background: var(--line-2); border-radius: 99px; padding: 1px 7px; color: var(--ink-2); }
.tab.active .count { background: var(--green-100); color: var(--green-800); }

/* operazioni */
.ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.op { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; display: flex; flex-direction: column; }
.op-h { display: flex; align-items: flex-start; gap: 10px; }
.op-h h4 { font-size: 15px; font-weight: 750; flex: 1; }
.op .rata { font-family: var(--mono); font-size: 28px; font-weight: 600; letter-spacing: -.03em; margin: 8px 0 2px; }
.op .rata small { font-family: var(--font); font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.op ul { margin: 8px 0 0; padding: 0 0 0 16px; font-size: 12.8px; color: var(--ink-2); }
.op ul li { margin: 3px 0; }
.op.possibile { border-color: #b9e3c8; box-shadow: inset 4px 0 0 var(--green); }
.op.futuro, .op.da_verificare { box-shadow: inset 4px 0 0 var(--orange); }
.op.non_possibile { background: #fafbfa; box-shadow: inset 4px 0 0 #cfd4cf; }
.op.non_possibile .rata { color: var(--muted-2); }
.dur { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.dur table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dur th { text-align: right; color: var(--muted); font-weight: 600; padding: 3px 4px; font-size: 11.5px; }
.dur th:first-child, .dur td:first-child { text-align: left; }
.dur td { text-align: right; padding: 3px 4px; font-family: var(--mono); font-size: 12px; }
.dur tr.max td { font-weight: 700; color: var(--green-800); }

/* alert */
.alerts { display: grid; gap: 8px; }
.al { display: flex; gap: 11px; padding: 11px 13px; border-radius: 10px; font-size: 13.5px; align-items: flex-start; }
.al svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.al .area { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin-left: auto; padding-left: 10px; white-space: nowrap; }
.al.blocco { background: var(--red-50); color: #8e1b1b; }
.al.attenzione { background: var(--amber-50); color: #7a4a00; }
.al.info { background: var(--blue-50); color: #1c4485; }

/* checklist */
.check { display: grid; gap: 2px; }
.check-i { display: flex; gap: 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.check-i:last-child { border-bottom: 0; }
.ck { flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; }
.ck svg { width: 14px; height: 14px; }
.ck.ok { background: var(--green); color: #fff; }
.ck.mancante { background: var(--red-50); color: var(--red); border: 1.5px solid #f2bcbc; }
.ck.scaduto, .ck.parziale { background: var(--amber-50); color: var(--amber); border: 1.5px solid #f2d48f; }
.ck.facoltativo { background: var(--line-2); color: var(--muted-2); border: 1.5px dashed #cfd4cf; }
.check-i .t { flex: 1; }
.check-i .t small { display: block; color: var(--muted); font-size: 12px; }

/* placeholder criteri */
.todo {
  border: 1.5px dashed #d6dbd6; border-radius: 12px; padding: 16px 18px; background:
    repeating-linear-gradient(-45deg, #fbfcfb 0 10px, #f7f8f6 10px 20px);
  display: flex; gap: 14px; align-items: center;
}
.todo .n { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font-weight: 800; color: var(--orange-700); }
.todo > div > b { display: block; }

/* TFR */
.tfr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.tfr-tbl td, .tfr-tbl th { padding: 7px 12px; }
.tfr-tbl tr.sel td { background: var(--green-50); font-weight: 700; color: var(--green-800); }
@media (max-width: 760px) { .tfr-grid { grid-template-columns: 1fr; } }

/* documenti (sidebar) */
.docs { display: grid; gap: 8px; }
.doc {
  display: flex; gap: 11px; align-items: center; padding: 10px 11px; border: 1px solid var(--line);
  border-radius: 11px; cursor: pointer; background: #fff; transition: border-color .12s, background .12s;
}
.doc:hover { border-color: #b9e3c8; background: #fbfdfb; }
.doc .info { flex: 1; min-width: 0; }
.doc .info .t { font-weight: 700; font-size: 13.5px; }
.doc .info .f { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc .right { text-align: right; font-size: 11.5px; color: var(--muted); }
.spin {
  width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--green-100); border-top-color: var(--green);
  animation: spin .8s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.dropzone.compact { padding: 14px; }
.dropzone.compact .dz-icon { display: none; }
.dropzone.compact strong { font-size: 13.5px; }

/* dati estratti */
.fgroup + .fgroup { margin-top: 22px; }
.ftable { width: 100%; border-collapse: collapse; }
.ftable td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; font-size: 13.5px; }
.ftable td.l { width: 34%; color: var(--ink-2); font-weight: 600; }
.ftable td.v { font-family: var(--mono); font-size: 13px; }
.ftable td.v.empty { color: #b8bdb8; font-family: var(--font); }
.ftable td.src { width: 30%; font-size: 12px; color: var(--muted); }
.ftable td.act { width: 40px; text-align: right; }
.ftable tr:hover td { background: #fafcfa; }
.src-chip { display: inline-flex; gap: 5px; align-items: center; padding: 2px 8px; border-radius: 6px; background: var(--line-2); font-size: 11.5px; cursor: pointer; }
.src-chip.man { background: var(--orange-50); color: var(--orange-700); font-weight: 650; }
.conf { display: inline-block; width: 26px; height: 5px; border-radius: 9px; background: var(--line); vertical-align: middle; position: relative; overflow: hidden; margin-left: 6px; }
.conf i { position: absolute; inset: 0 auto 0 0; background: var(--green); }
.diff { color: var(--orange-700); font-weight: 700; font-size: 11.5px; margin-left: 6px; }

/* impegni */
.imp-table input, .imp-table select { width: 100%; }
.imp-table td { padding: 8px 8px; }
.imp-table th { padding: 10px 8px; }
.rinn { font-size: 12px; }
.prog { height: 6px; border-radius: 9px; background: var(--line-2); position: relative; margin-top: 4px; min-width: 110px; }
.prog i { position: absolute; inset: 0 auto 0 0; border-radius: 9px; background: var(--orange); }
.prog i.ok { background: var(--green); }
.prog .m { position: absolute; left: 40%; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }

/* modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(14,14,14,.45); z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 24px; backdrop-filter: blur(2px);
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: min(1240px, 100%);
  height: min(88vh, 900px); display: flex; flex-direction: column; overflow: hidden;
}
.modal-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 16px; }
.modal-b { flex: 1; display: grid; grid-template-columns: var(--pv-w, 58%) 8px minmax(0, 1fr); min-height: 0; }
.modal-b .pv { background: #eef0ee; min-height: 0; min-width: 0; }
.split { cursor: col-resize; background: var(--line-2); border-left: 1px solid var(--line); border-right: 1px solid var(--line); display: grid; place-items: center; touch-action: none; }
.split span { width: 2px; height: 34px; border-radius: 2px; background: #b9c0b9; box-shadow: 3px 0 0 #b9c0b9; margin-left: -3px; }
.split:hover, .split.drag { background: var(--green-50); }
.split:hover span, .split.drag span { background: var(--green); box-shadow: 3px 0 0 var(--green); }
.modal-b.dragging iframe { pointer-events: none; }
.modal-b.dragging { user-select: none; cursor: col-resize; }
.modal.full { width: 100vw; height: 100vh; border-radius: 0; }
.modal-bg.full { padding: 0; }
.modal.full .modal-b { grid-template-columns: 1fr 0 0; }
.modal.full .split, .modal.full .dt { display: none; }
.pdfv { position: relative; height: 100%; overflow: auto; padding: 14px 14px 60px; }
.pdfv canvas { display: block; margin: 0 auto 12px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 4px 14px rgba(0,0,0,.08); border-radius: 2px; }
.pdfbar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3;
  display: flex; gap: 2px; align-items: center; background: rgba(14,14,14,.82); color: #fff;
  border-radius: 10px; padding: 4px; box-shadow: var(--shadow-lg); font-size: 12.5px;
}
.pdfbar button { border: 0; background: none; color: #fff; font: inherit; font-weight: 700; padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.pdfbar button:hover { background: rgba(255,255,255,.15); }
.pdfbar span { min-width: 64px; text-align: center; font-family: var(--mono); font-size: 12px; }
.pv { position: relative; }
.modal-b .pv iframe, .modal-b .pv img { width: 100%; height: 100%; border: 0; display: block; object-fit: contain; }
.modal-b .dt { overflow: auto; padding: 16px 18px; }
pre.raw {
  white-space: pre-wrap; font-family: var(--mono); font-size: 11.5px; background: #f7f8f6; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; max-height: 340px; overflow: auto; color: var(--ink-2);
}
details summary { cursor: pointer; font-weight: 650; font-size: 13px; color: var(--ink-2); margin: 10px 0; }

/* toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 11px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: tin .2s ease-out; max-width: 380px;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green-700); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* login */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(60% 50% at 85% 10%, rgba(245,145,32,.16), transparent 60%),
    radial-gradient(60% 60% at 10% 90%, rgba(8,158,67,.16), transparent 60%),
    var(--bg);
}
.login-card { width: min(410px, 100%); padding: 34px 32px 28px; }
.login-card img { height: 46px; display: block; margin: 0 auto 20px; }
.login-card h1 { font-size: 21px; text-align: center; font-weight: 800; }
.login-card p { text-align: center; color: var(--muted); margin: 6px 0 22px; font-size: 13.5px; }
.err-box { background: var(--red-50); color: var(--red); border-radius: 9px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }

/* responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .list-head { flex-wrap: wrap; }
  .modal-b { grid-template-columns: 1fr; }
  .split { display: none; }
  .modal-b .pv { height: 45vh; }
  .phead { flex-wrap: wrap; }
  .phead > .avatar { display: none; }
  .phead-actions { margin-left: 0; width: 100%; }
  .hire { margin-left: 0; width: 100%; }
  .phead-side { width: 100%; }
  .phead-actions select { flex: 1; min-width: 0; }
  .topnav a:not(.nav-new) { display: none; }
  .tbl .hide-m { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 18px 16px 60px; }
  .topbar-in { padding: 10px 16px; }
  .brand .tool { display: none; }
  .kpis { grid-template-columns: 1fr; }
  .hero-text { padding: 26px 22px; }
  .hero-text h1 { font-size: 27px; }
}

/* stampa: solo la scheda */
@media print {
  body { background: #fff; font-size: 12px; }
  .topbar, .side, .tabs, .phead-actions, .no-print, .toasts { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .wrap { padding: 0; max-width: none; }
  .card, .kpi, .op { box-shadow: none; break-inside: avoid; }
  .tabpane { display: block !important; }
  .tabpane.print-skip { display: none !important; }
}

/* azioni riga lista cessionati */
.tbl th.acts-h, .tbl td.acts { width: 92px; }
.row-acts { display: inline-flex; gap: 6px; }
.ibtn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; transition: .15s; padding: 0; }
.ibtn svg { width: 17px; height: 17px; }
.ibtn.warn:hover { color: var(--orange-700); border-color: #f2d48f; background: #fffaf0; }
.ibtn.danger:hover { color: var(--red); border-color: #f2b8b8; background: var(--red-50); }
.ibtn:not(.warn):not(.danger):hover { color: var(--green); border-color: #b9e3c8; background: var(--green-50); }
.tbl tr.sosp td { opacity: .8; }
.tbl tr.sosp td.acts { opacity: 1; }
.sosp-card { border-color: #f2d48f; }

.emp .az-cands{display:flex;flex-direction:column;gap:3px;margin-top:6px;max-height:160px;overflow:auto}
.emp .az-cands a{cursor:pointer;font-size:12px;padding:3px 6px;border-radius:6px;background:rgba(8,158,67,.07)}
.emp .az-cands a:hover{background:rgba(8,158,67,.16)}
.emp .az-warn{color:#c0392b;font-weight:600}
.emp .acts a{cursor:pointer}

/* età vicina alla pensione */
.eta-pens{color:var(--red-700,#b42318);font-weight:800}
.dur tr.oltre-p td{background:rgba(180,35,24,.05)}

/* chat della pratica */
.chat{margin:14px 0}
.chat .card-h{gap:10px}
.chat-log{height:340px;overflow:auto;padding:14px 18px;display:flex;flex-direction:column;gap:10px;background:var(--bg-soft,#f7f9f8);border-top:1px solid var(--line,#e6ebe8);border-bottom:1px solid var(--line,#e6ebe8)}
.chat-empty{color:var(--muted,#6b7a72);font-size:13px;line-height:1.5;max-width:900px}
.msg{display:flex;flex-direction:column;max-width:min(860px,88%)}
.msg.user{align-self:flex-end;align-items:flex-end}
.msg .bubble{padding:9px 13px;border-radius:14px;font-size:13.5px;line-height:1.5;background:#fff;border:1px solid var(--line,#e6ebe8);overflow-wrap:anywhere}
.msg.user .bubble{background:#089e43;color:#fff;border-color:#089e43}
.msg .when{font-size:10.5px;color:var(--muted,#6b7a72);margin:2px 6px}
.msg .att{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px;font-size:12px;opacity:.9}
.msg.pending .bubble{color:var(--muted,#6b7a72)}
.chat-files{display:flex;flex-wrap:wrap;gap:6px;padding:0 18px}
.chat-files:not(:empty){padding-top:10px}
.chat-files .chip{font-size:12px;background:rgba(245,145,32,.12);border-radius:20px;padding:3px 10px}
.chat-files .chip a{cursor:pointer;margin-left:4px;font-weight:700}
.chat-in{display:flex;gap:10px;align-items:flex-end;padding:12px 18px}
.chat-in textarea{flex:1;resize:vertical;min-height:46px}
.chat-btns{display:flex;gap:6px}
.chat-btns svg{width:18px;height:18px}
@media (max-width:640px){.chat-log{height:280px}.msg{max-width:96%}.chat-in{flex-direction:column;align-items:stretch}.chat-btns{justify-content:flex-end}}

/* scheda compagnie */
.crit-head{line-height:1.6}
.crit-tbl td{vertical-align:top}
.crit-tbl tr.crit-no td{opacity:.72}
.ck-list{list-style:none;margin:0;padding:0;font-size:12.5px;line-height:1.45}
.ck-list li{display:flex;gap:6px}
.ck-list li span{width:12px;flex:none;font-weight:700}
.ck-ok span{color:#089e43}.ck-no{color:var(--red-700,#b42318)}.ck-verifica span{color:#f59120}.ck-info{color:var(--muted,#6b7a72)}
.crit-raw{cursor:pointer;display:inline-block;margin-top:4px}
.raw-box{margin-top:6px;max-height:360px;overflow:auto;border:1px solid var(--line,#e6ebe8);border-radius:8px}
.raw-tbl{border-collapse:collapse;font-size:12px}
.raw-tbl th{text-align:left;vertical-align:top;padding:6px 8px;width:30%;background:var(--bg-soft,#f7f9f8);font-weight:600}
.raw-tbl td{padding:6px 8px;border-top:1px solid var(--line,#e6ebe8)}
.tabs{overflow-x:auto;scrollbar-width:thin}
.tabs .tab{white-space:nowrap;flex:none}
@media (max-width:640px){.chat .card-h .muted{display:none}}

/* testata: chat a sinistra, azienda + documenti a destra; sotto tutto a piena larghezza */
.top2{display:grid;grid-template-columns:minmax(0,1fr) 400px;gap:20px;align-items:stretch;margin:14px 0 18px}
.top2 .chat{margin:0;display:flex;flex-direction:column;min-height:520px}
.top2 .chat-log{flex:1;height:auto;min-height:300px}
.top-side{display:flex;flex-direction:column;gap:14px;min-width:0}
.top-side .emp{display:flex;gap:12px;align-items:flex-start}
.top-side .docs-card{flex:1;display:flex;flex-direction:column;min-height:0}
.top-side .docs-card .card-b{flex:1;display:flex;flex-direction:column;min-height:0}
.top-side .docs-card .docs{max-height:360px;overflow:auto}
.top2 .chat{max-height:780px}
.full{margin-top:4px}
.bottom2{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;align-items:start}
@media (max-width:1100px){.top2{grid-template-columns:1fr}.top2 .chat{min-height:0;max-height:none}.top2 .chat-log{height:340px;flex:none}.bottom2{grid-template-columns:1fr}}
@media (max-width:640px){.top2 .chat-log{height:280px}}
@media print{.top2{display:block}.top-side .emp{margin-bottom:12px}}
/* censimenti assicurativi */
.cens-head{display:flex;flex-wrap:wrap;gap:16px 40px;align-items:flex-start}
.cens-head .l{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.cens-head .v{font-size:26px;font-weight:650;letter-spacing:-.02em}
.cens-head .s{font-size:12.5px;color:var(--muted);max-width:520px}
.cens-best .v{color:var(--green-700,#067a34)}
.cens-tbl td{vertical-align:top}
.cens-tbl tr.cens-best-row td{background:rgba(8,158,67,.06)}
.tbl-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.cens-tbl .small{font-family:var(--font)}
.cens-tbl .cens-why{color:var(--red-700,#b42318);max-width:220px;margin-top:3px}
.cens-tbl{min-width:820px}
/* barra in alto: briciole + azioni piccole */
.crumbs-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.crumbs-row .crumbs{margin:0}
.top-actions{margin-left:auto;display:flex;gap:6px;align-items:center}
select.input.input-xs,.input.input-xs{height:28px;padding:2px 8px;line-height:1.2;font-size:12px;border-radius:8px;width:auto;max-width:230px}
.btn-xs{height:28px;padding:0 10px;font-size:12px;border-radius:8px;gap:5px}
.btn-xs svg{width:14px;height:14px}
.btn-xs.btn-icon{width:28px;padding:0}
/* giudizio sintetico */
.verdict{flex:1 1 380px;min-width:0;display:flex;gap:14px;align-items:flex-start;border-radius:14px;border:2px solid var(--line);padding:14px 18px;background:#fff;order:2}
.verdict:empty{display:none}
.verdict .v-ic{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;flex:none;color:#fff}
.verdict .v-ic svg{width:24px;height:24px}
.verdict .v-t{font-size:22px;font-weight:850;letter-spacing:.02em;line-height:1.1}
.verdict .v-m{margin:6px 0 0;padding-left:18px;font-size:13px;line-height:1.45}
.verdict .v-m li{margin:1px 0}
.verdict.v-si{background:#ecf9f0;border-color:#5cc581}.verdict.v-si .v-ic{background:#089e43}.verdict.v-si .v-t{color:#067a34}
.verdict.v-verifica{background:#fff8e6;border-color:#f2c14e}.verdict.v-verifica .v-ic{background:#f0a400}.verdict.v-verifica .v-t{color:#9a6200}
.verdict.v-no{background:#fdeeee;border-color:#ec8a8a}.verdict.v-no .v-ic{background:#d93636}.verdict.v-no .v-t{color:#b42318}
@media (max-width:760px){.verdict{flex-basis:100%}.verdict .v-t{font-size:19px}.top-actions{margin-left:0;width:100%}.top-actions select{flex:1;max-width:none}}
@media print{.top-actions{display:none!important}.verdict{-webkit-print-color-adjust:exact;print-color-adjust:exact}}
.rin-col{background:rgba(245,145,32,.05);min-width:150px}
.rin-note{margin:0 18px 4px;padding:8px 12px;border-radius:10px;background:rgba(245,145,32,.08);font-size:12.5px;line-height:1.5}
.rin-up{color:#089e43;font-weight:800;font-size:12px}
.crit-tbl{min-width:860px}
.crit-tbl td.num{white-space:nowrap}
