/* =========================================================================
   Orion Pipeline — stile allineato a gruppoorion.com
   Font Satoshi, blu Orion #00205B, verde #0DC54F / #008734, superfici #F2F5FF
   ========================================================================= */

@font-face {
  font-family: 'Satoshi';
  src: url('../fonts/Satoshi-Variable.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('../fonts/Satoshi-VariableItalic.woff2') format('woff2');
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --primary: #00205b;
  --primary-700: #001742;
  --primary-2: #0072ce;
  --green: #0dc54f;
  --green-dark: #008734;
  --muted: #f2f5ff;
  --muted-2: #e8edff;
  --muted-3: #d9e1ff;
  --line: #e3e9ff;
  --line-strong: #bfceff;
  --white: #ffffff;
  --text: var(--primary);
  --text-2: #4d6390;
  --text-3: #7d8db0;
  --danger: #ef404b;
  --danger-bg: #ffe4e6;
  --warning: #faa05a;
  --warning-bg: #fff1e5;

  /* Aree / business unit (palette ufficiale delle aree Orion) */
  --bu-acqua: #0072ce;
  --bu-ambiente: #008734;
  --bu-ingegneria: #d30058;
  --bu-gas: #59cbe8;
  --bu-rs_ps: #bb29bb;
  --bu-attivita_interne: #00205b;

  /* Stati offerta */
  --st-da_inviare: #7d8db0;
  --st-inviata: #0072ce;
  --st-stand_by: #faa05a;
  --st-chiusa_persa: #ef404b;
  --st-chiusa_vinta: #0dc54f;

  /* Grafici */
  --chart-open: #0072ce;
  --chart-won: #0dc54f;

  --r-xs: 8px;
  --r-sm: 16px;
  --r-md: 24px;
  --r-pill: 100px;

  --glass-shadow: 3px 3px 0.5px -3.5px #ffffff inset, 2px 2px 0.5px -2px #262626 inset, -2px -2px 0.5px -2px #26262600 inset,
    0 0 0 1px #ffffff2e inset, 0 0 8px 0 rgb(242 242 242 / 17%) inset, 0 0 2px 0 rgba(0, 0, 0, 0.1), 0 1px 8px 0 rgb(0 0 0 / 10%);
  --card-shadow: 0 1px 2px rgba(0, 32, 91, 0.04), 0 8px 24px -12px rgba(0, 32, 91, 0.12);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  font-family: 'Satoshi', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  background: var(--muted);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body { margin: 0; min-height: 100vh; background: var(--muted); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--primary); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 3.2vw, 44px); }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ------------------------------------------------------------------ */
/* Bottoni (pill come sul sito)                                        */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 60px; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: background-color .2s var(--ease), box-shadow .4s ease-in-out, color .2s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--green); color: var(--primary); box-shadow: var(--glass-shadow); }
.btn-primary:hover { background: #2fd567; box-shadow: -3px -3px 0.5px -3.5px #fff inset, 2px 2px 0.5px -2px #262626 inset, 0 0 0 1px #ffffff2e inset, 0 1px 8px 0 rgb(0 0 0 / 14%); }
.btn-dark { background: var(--primary); color: #fff; box-shadow: var(--glass-shadow); }
.btn-dark:hover { background: #0a2d70; }
.btn-ghost { background: var(--white); color: var(--primary); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-ghost:hover { background: var(--muted-2); }
.btn-danger { background: var(--white); color: var(--danger); box-shadow: inset 0 0 0 1px #f7b5ba; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------------ */
/* Login                                                              */
/* ------------------------------------------------------------------ */
.login {
  position: relative; min-height: 100vh; overflow: hidden;
  background: radial-gradient(1200px 700px at 85% 110%, rgba(13, 197, 79, .28), transparent 60%),
              radial-gradient(900px 600px at -10% -10%, rgba(0, 114, 206, .35), transparent 60%),
              var(--primary);
  color: #fff; display: grid; grid-template-rows: auto 1fr auto;
}
.login-flash { position: absolute; width: min(70vw, 900px); right: -18vw; bottom: -22vw; pointer-events: none; opacity: .9; }
.login-flash path { fill: var(--green); }
.login-flash.two { width: min(40vw, 520px); left: -14vw; top: -14vw; right: auto; bottom: auto; transform: rotate(160deg); opacity: .18; }
.login-flash.two path { fill: var(--primary-2); }
.login-top { position: relative; z-index: 2; padding: 32px clamp(16px, 5vw, 64px); display: flex; align-items: center; justify-content: space-between; }
.login-top img { height: 34px; }
.login-top span { font-size: 14px; opacity: .7; }
.login-main { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 0 16px 48px; width: 100%; }
.login-title { color: #fff; font-size: clamp(36px, 5vw, 64px); line-height: 1.05; letter-spacing: -0.03em; text-align: center; }
.login-title em { font-style: italic; font-weight: 500; color: var(--green); }
.glass {
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--glass-shadow); border-radius: var(--r-md);
}
.login-card { padding: clamp(24px, 3vw, 40px); width: min(600px, 100%); }
.login-card h2 { color: #fff; font-size: 26px; }
.login-card .sub { margin-top: 6px; color: rgba(255, 255, 255, .7); font-size: 15px; }
.company-grid { margin-top: 24px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.company-tile {
  position: relative; overflow: hidden; height: 72px; border-radius: var(--r-sm); cursor: pointer;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2); color: #fff;
  font-size: 18px; font-weight: 700; letter-spacing: .06em;
  transition: background .25s var(--ease), border-color .25s, transform .25s var(--ease);
}
.company-tile:hover { background: rgba(255, 255, 255, .16); transform: translateY(-2px); }
.company-tile.selected { background: var(--green); border-color: var(--green); color: var(--primary); }
.company-tile svg { position: absolute; width: 70px; right: -26px; bottom: -30px; opacity: 0; transition: opacity .25s; }
.company-tile svg path { fill: var(--green-dark); }
.company-tile.selected svg { opacity: .6; }
.login-form { margin-top: 24px; display: grid; gap: 14px; }
.login-form .field label { color: rgba(255, 255, 255, .8); }
.login-form .input { background: rgba(255, 255, 255, .95); border-color: transparent; color: #000; caret-color: #000; }
.login-form .btn { margin-top: 8px; height: 52px; font-size: 17px; }
.login-chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); font-weight: 700; letter-spacing: .05em; }
.login-chip button { background: rgba(255, 255, 255, .15); border: 0; color: #fff; border-radius: var(--r-pill); padding: 4px 12px; font-size: 13px; font-weight: 600; cursor: pointer; letter-spacing: 0; }
.login-chip button:hover { background: rgba(255, 255, 255, .28); }
.login-error { background: var(--danger-bg); color: #b4232d; border-radius: var(--r-xs); padding: 10px 14px; font-size: 14px; font-weight: 600; }
.login-foot { position: relative; z-index: 2; padding: 20px clamp(16px, 5vw, 64px); font-size: 13px; color: rgba(255, 255, 255, .55); }


@media (max-width: 520px) {
  .company-grid { grid-template-columns: repeat(3, 1fr); }
  .company-tile { height: 60px; font-size: 16px; }
}

/* ------------------------------------------------------------------ */
/* Shell applicazione                                                 */
/* ------------------------------------------------------------------ */
.topbar-wrap { position: sticky; top: 0; z-index: 50; padding: 16px 24px 0; background: linear-gradient(var(--muted) 70%, transparent); }
.topbar {
  max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 24px;
  padding: 8px 8px 8px 24px; border-radius: var(--r-pill);
  background: var(--primary); color: #fff; box-shadow: var(--glass-shadow), 0 12px 32px -16px rgba(0, 32, 91, .5);
}
.topbar .logo { display: flex; align-items: center; gap: 12px; }
.topbar .logo img { height: 26px; transform: translateY(-3px); }
.topbar .logo .crm-tag { font-size: 12px; font-weight: 700; letter-spacing: .14em; padding: 3px 10px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .12); }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { position: relative; padding: 10px 16px; border-radius: var(--r-pill); font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, .78); transition: background .2s, color .2s; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.active { color: #fff; }
.nav a.active::after { content: ''; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--green); right: 6px; top: 10px; }
.topbar .spacer { flex: 1; }
.company-badge { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, .7); }
.company-badge strong { color: #fff; font-size: 14px; letter-spacing: .08em; padding: 4px 12px; border-radius: var(--r-pill); border: 1px solid rgba(255, 255, 255, .3); }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .1); border: 0; color: #fff; padding: 4px 14px 4px 4px; border-radius: var(--r-pill); cursor: pointer; box-shadow: var(--glass-shadow); }
.user-btn:hover { background: rgba(255, 255, 255, .18); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: var(--primary); font-weight: 800; font-size: 13px; flex: none; }
.user-btn .name { font-size: 14px; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; color: var(--primary); border-radius: var(--r-sm); box-shadow: 0 20px 48px -12px rgba(0, 32, 91, .35); padding: 8px; border: 1px solid var(--line); }
.dropdown .info { padding: 10px 12px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown .info strong { display: block; color: var(--primary); font-size: 15px; }
.dropdown button { width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: var(--r-xs); cursor: pointer; font-weight: 600; font-size: 14px; }
.dropdown button:hover { background: var(--muted); }
.menu-toggle { display: none; }

main.page { max-width: 1440px; margin: 0 auto; padding: 32px 24px 80px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green-dark); margin-bottom: 8px; }
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.breadcrumb { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text-2); margin-bottom: 10px; }
.breadcrumb a:hover { color: var(--primary); text-decoration: underline; }

@media (max-width: 1100px) {
  .company-badge span { display: none; }
  .user-btn .name { display: none; }
  .user-btn { padding: 4px; }
}
@media (max-width: 860px) {
  .topbar-wrap { padding: 12px 12px 0; }
  .topbar { padding-left: 18px; gap: 12px; flex-wrap: wrap; border-radius: 28px; }
  .menu-toggle { display: inline-grid; place-items: center; background: rgba(255, 255, 255, .1); border: 0; color: #fff; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; }
  .nav { order: 10; width: 100%; margin: 0; flex-direction: column; padding: 4px 8px 8px; display: none; }
  .nav.open { display: flex; }
  .nav a.active::after { right: auto; left: 4px; top: 50%; transform: translateY(-50%); }
  .company-badge { display: none; }
  main.page { padding: 20px 16px 64px; }
}

/* ------------------------------------------------------------------ */
/* Card                                                               */
/* ------------------------------------------------------------------ */
.card { background: var(--white); border-radius: var(--r-md); box-shadow: var(--card-shadow); border: 1px solid rgba(217, 225, 255, .6); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.card-head h3 { font-size: 17px; }
.card-head .hint { font-size: 13px; color: var(--text-3); }
.card-body { padding: 16px 24px 24px; }

.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.grid > *, .card { min-width: 0; }

/* KPI */
.kpi { position: relative; overflow: hidden; padding: 22px 24px; }
.kpi .label { font-size: 14px; color: var(--text-2); font-weight: 600; }
.kpi .label, .kpi .value, .kpi .foot { position: relative; z-index: 1; }
.kpi .value { overflow-wrap: anywhere; margin-top: 10px; font-size: clamp(22px, 2.1vw, 32px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .foot { margin-top: 8px; font-size: 13px; color: var(--text-3); }
.kpi.feature { background: var(--primary); color: #fff; border: 0; }
.kpi.feature .label, .kpi.feature .foot { color: rgba(255, 255, 255, .72); }
.kpi.feature .value { color: #fff; }
.kpi.feature .flash { position: absolute; width: 180px; right: -60px; bottom: -80px; opacity: .9; }
.kpi.feature .flash path { fill: var(--green); }

/* ------------------------------------------------------------------ */
/* Badge, pill, indicatori                                            */
/* ------------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--muted); color: var(--primary); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.badge.st-da_inviare { background: #eef1f8; } .badge.st-da_inviare .dot { background: var(--st-da_inviare); }
.badge.st-inviata { background: #e3f0fb; } .badge.st-inviata .dot { background: var(--st-inviata); }
.badge.st-stand_by { background: var(--warning-bg); } .badge.st-stand_by .dot { background: var(--st-stand_by); }
.badge.st-chiusa_persa { background: var(--danger-bg); } .badge.st-chiusa_persa .dot { background: var(--st-chiusa_persa); }
.badge.st-chiusa_vinta { background: #dcf8e6; } .badge.st-chiusa_vinta .dot { background: var(--st-chiusa_vinta); }

.bu { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.bu::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--bu-color, var(--primary)); flex: none; }
.bu-acqua { --bu-color: var(--bu-acqua); }
.bu-ambiente { --bu-color: var(--bu-ambiente); }
.bu-ingegneria { --bu-color: var(--bu-ingegneria); }
.bu-gas { --bu-color: var(--bu-gas); }
.bu-rs_ps { --bu-color: var(--bu-rs_ps); }
.bu-attivita_interne { --bu-color: var(--bu-attivita_interne); }

.prob { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.prob .bars { display: inline-flex; gap: 2px; align-items: flex-end; }
.prob .bars i { width: 4px; border-radius: 2px; background: var(--muted-3); }
.prob .bars i:nth-child(1) { height: 6px; } .prob .bars i:nth-child(2) { height: 9px; } .prob .bars i:nth-child(3) { height: 12px; } .prob .bars i:nth-child(4) { height: 15px; }
.prob .bars i.on { background: var(--green-dark); }

.money { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.muted-text { color: var(--text-3); }
.small { font-size: 13px; }

/* ------------------------------------------------------------------ */
/* Toolbar, filtri                                                    */
/* ------------------------------------------------------------------ */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search input { width: 100%; height: 44px; padding: 0 16px 0 44px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: #fff; }
.search input:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(0, 114, 206, .15); }
.select-pill { height: 44px; padding: 0 38px 0 16px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2300205B' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center; appearance: none; font-size: 14px; font-weight: 600; cursor: pointer; max-width: 220px; }
.select-pill.active { border-color: var(--primary); background-color: var(--muted-2); }
.select-pill:focus { outline: none; border-color: var(--primary-2); }
.segmented { display: inline-flex; padding: 4px; border-radius: var(--r-pill); background: #fff; border: 1px solid var(--line-strong); }
.segmented button { border: 0; background: transparent; height: 34px; padding: 0 16px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.segmented button svg { width: 16px; height: 16px; }
.segmented button.on { background: var(--primary); color: #fff; }
.toolbar .grow { flex: 1; }
.link-btn { background: none; border: 0; color: var(--primary-2); font-weight: 600; cursor: pointer; font-size: 14px; padding: 6px 8px; }
.link-btn:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ */
/* Tabelle (list view)                                                */
/* ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbfcff; position: sticky; top: 0; }
table.data th:first-child { border-top-left-radius: var(--r-md); }
table.data th:last-child { border-top-right-radius: var(--r-md); }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--primary); }
table.data th .arrow { opacity: .35; margin-left: 4px; }
table.data th.sorted .arrow { opacity: 1; color: var(--green-dark); }
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { cursor: pointer; transition: background .15s; }
table.data tbody tr:hover { background: #f8faff; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; }
table.data .primary-cell { font-weight: 700; color: var(--primary); }
table.data .primary-cell small { display: block; font-weight: 500; color: var(--text-3); font-size: 13px; margin-top: 2px; }
table.data tfoot td { padding: 14px 16px; border-top: 1px solid var(--line); font-weight: 700; background: #fbfcff; }
table.data tfoot td:first-child { border-bottom-left-radius: var(--r-md); }
table.data tfoot td:last-child { border-bottom-right-radius: var(--r-md); }

.empty { padding: 56px 24px; text-align: center; color: var(--text-2); }
.empty svg { width: 80px; height: 80px; margin-bottom: 12px; }
.empty svg path { fill: var(--muted-3); }
.empty h3 { margin-bottom: 6px; }
.empty .btn { margin-top: 18px; }

/* ------------------------------------------------------------------ */
/* Kanban pipeline                                                    */
/* ------------------------------------------------------------------ */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: rgba(255, 255, 255, .55); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; min-height: 300px; display: flex; flex-direction: column; gap: 10px; transition: background .2s, border-color .2s; }
.kcol.drop { background: var(--muted-2); border-color: var(--primary-2); border-style: dashed; }
.kcol-head { padding: 6px 8px 10px; border-bottom: 3px solid var(--kcol, var(--primary)); }
.kcol-head .t { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 15px; }
.kcol-head .t span.n { font-size: 12px; background: var(--muted-2); padding: 2px 9px; border-radius: var(--r-pill); }
.kcol-head .sum { margin-top: 4px; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 700; }
.kcard { background: #fff; border-radius: var(--r-sm); padding: 14px; border: 1px solid var(--line); cursor: grab; box-shadow: 0 1px 2px rgba(0, 32, 91, .04); transition: box-shadow .2s, transform .2s; }
.kcard:hover { box-shadow: 0 10px 24px -12px rgba(0, 32, 91, .3); transform: translateY(-1px); }
.kcard.dragging { opacity: .5; }
.kcard .t { font-weight: 700; font-size: 15px; line-height: 1.3; }
.kcard .acc { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.kcard { min-width: 0; overflow-wrap: anywhere; }
.kcard .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-top: 12px; gap: 6px 8px; }
.kcol-head .t { gap: 8px; }
.kcard .bu { font-size: 12px; }

/* ------------------------------------------------------------------ */
/* Record page                                                        */
/* ------------------------------------------------------------------ */
.record-head { position: relative; overflow: hidden; padding: 28px; }
.record-head .flash { position: absolute; right: -90px; top: -120px; width: 300px; opacity: .08; pointer-events: none; }
.record-head .flash path { fill: var(--primary); }
.record-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.record-title .type { font-size: 13px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.record-title .type .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--green); }
.record-title .type .ico svg { width: 16px; height: 16px; color: var(--primary); }
.record-title > div:first-child { min-width: 0; flex: 1 1 320px; }
.record-title h1 { font-size: clamp(22px, 2.6vw, 34px); margin-top: 6px; overflow-wrap: anywhere; }
.highlights { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.highlights > div { padding-right: 16px; min-width: 0; }
.highlights > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.highlights .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; }
.highlights .v { margin-top: 4px; font-weight: 700; overflow-wrap: anywhere; }
.highlights .v.money { white-space: normal; }
.highlights .v a { color: var(--primary-2); }
.highlights .v a:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 0; }
  .highlights > div + div { border-left: 0; padding-left: 0; }
}

/* Path (stile Salesforce, forme Orion) */
.path { display: flex; gap: 6px; margin-top: 20px; }
.path .step { flex: 1; position: relative; height: 44px; border: 0; background: var(--muted); color: var(--text-2); font-weight: 700; font-size: 14px; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%); padding: 0 20px; transition: background .2s, color .2s; display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.path .step:first-child { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); border-radius: 22px 0 0 22px; }
.path .step:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 14px 50%); border-radius: 0 22px 22px 0; }
.path .step:hover { background: var(--muted-3); color: var(--primary); }
.path .step.done { background: #c9f2d7; color: var(--green-dark); }
.path .step.current { background: var(--primary); color: #fff; }
.path .step.won { background: var(--green); color: var(--primary); }
.path .step.lost { background: var(--danger); color: #fff; }
.path .step svg { width: 16px; height: 16px; }
@media (max-width: 700px) { .path { flex-wrap: wrap; } .path .step { flex: 1 1 45%; clip-path: none !important; border-radius: var(--r-pill) !important; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; }
.tabs button { background: none; border: 0; padding: 16px 12px; font-weight: 700; font-size: 15px; color: var(--text-3); cursor: pointer; position: relative; }
.tabs button.on { color: var(--primary); }
.tabs button.on::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--green); }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.fields .f { padding: 14px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.fields .f.full { grid-column: 1 / -1; }
.fields .f .k { font-size: 13px; color: var(--text-3); font-weight: 600; }
.fields .f .v { margin-top: 4px; font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
@media (max-width: 700px) { .fields { grid-template-columns: 1fr; } }

.split-list { display: grid; gap: 10px; }
.split-row { display: grid; grid-template-columns: 48px minmax(40px, 1fr) auto; gap: 12px; align-items: center; font-size: 14px; }
.split-row .y { font-weight: 700; }
.split-row .track { height: 10px; background: var(--muted); border-radius: 5px; overflow: hidden; }
.split-row .track i { display: block; height: 100%; background: var(--primary-2); border-radius: 5px; }
.split-total { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-weight: 800; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ''; position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.timeline li::after { content: ''; position: absolute; left: 4.5px; top: 20px; bottom: 0; width: 1px; background: var(--line-strong); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: 12px; color: var(--text-3); font-weight: 600; }
.timeline .what { font-size: 14px; margin-top: 2px; }
.timeline .what s { color: var(--text-3); }

/* ------------------------------------------------------------------ */
/* Form & modale                                                      */
/* ------------------------------------------------------------------ */
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.field label .req { color: var(--danger); margin-left: 2px; }
.input, .field select, .field textarea {
  width: 100%; height: 48px; padding: 0 16px; border-radius: var(--r-xs); border: 1px solid var(--line-strong);
  background: #fff; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.field textarea { height: auto; min-height: 110px; padding: 12px 16px; resize: vertical; line-height: 1.45; }
.field select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2300205B' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center; padding-right: 40px; cursor: pointer; }
.input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(0, 114, 206, .15); }
.field .help { font-size: 13px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-section { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--green-dark); padding-top: 6px; }

.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label > span { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); font-size: 14px; font-weight: 600; color: var(--text-2); background: #fff; transition: all .15s; }
.choice label > span:hover { border-color: var(--primary); color: var(--primary); }
.choice input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.choice .bu::before { margin-right: 0; }
.choice input:checked + span.bu::before { box-shadow: 0 0 0 2px #fff; }

.amounts { border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.amounts-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--muted); gap: 12px; flex-wrap: wrap; }
.amounts-head .segmented { background: #fff; }
.amounts-rows { padding: 12px 16px; display: grid; gap: 10px; }
.amount-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) 40px; gap: 10px; align-items: center; }
.amount-row .input { height: 44px; }
.amount-row .euro { position: relative; }
.amount-row .euro::before { content: '€'; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 700; }
.amount-row .euro .input { padding-left: 32px; text-align: right; font-variant-numeric: tabular-nums; }
.amount-row .rm { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center; }
.amount-row .rm:hover { background: var(--danger-bg); color: var(--danger); }
.amount-row .rm svg { width: 18px; height: 18px; }
.amounts-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); font-weight: 800; gap: 12px; flex-wrap: wrap; }
.amounts-foot .money { font-size: clamp(16px, 4vw, 20px); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0, 23, 66, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; animation: fade .2s ease; }
.modal { width: min(820px, 100%); background: #fff; border-radius: var(--r-md); box-shadow: 0 40px 80px -20px rgba(0, 23, 66, .5); animation: rise .25s var(--ease); }
.modal.sm { width: min(520px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 22px; }
.modal-body { padding: 24px 28px; display: grid; gap: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 28px; border-top: 1px solid var(--line); background: #fbfcff; border-radius: 0 0 var(--r-md) var(--r-md); }
.modal .error-box { background: var(--danger-bg); color: #b4232d; border-radius: var(--r-xs); padding: 10px 14px; font-size: 14px; font-weight: 600; }
.close-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--muted); cursor: pointer; display: grid; place-items: center; color: var(--primary); }
.close-x:hover { background: var(--muted-3); }
.close-x svg { width: 18px; height: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* Account picker con ricerca */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-xs); box-shadow: 0 16px 32px -12px rgba(0, 32, 91, .3); max-height: 260px; overflow-y: auto; padding: 6px; }
.combo-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-size: 15px; font-weight: 600; }
.combo-list button small { display: block; font-weight: 500; color: var(--text-3); font-size: 13px; }
.combo-list button:hover, .combo-list button.hl { background: var(--muted); }
.combo-list .new { color: var(--green-dark); border-top: 1px solid var(--line); border-radius: 0; margin-top: 4px; }

/* ------------------------------------------------------------------ */
/* Grafici                                                            */
/* ------------------------------------------------------------------ */
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { font-size: 12px; fill: var(--text-3); font-weight: 600; }
.chart .grid line { stroke: var(--line); }
.chart .val { font-size: 12px; fill: var(--text-2); font-weight: 700; }
.chart rect.hit { fill: transparent; cursor: pointer; }
.chart rect.hit:hover { fill: rgba(0, 32, 91, .04); }
.tooltip { position: fixed; z-index: 200; pointer-events: none; background: var(--primary); color: #fff; padding: 10px 12px; border-radius: 10px; font-size: 13px; box-shadow: 0 12px 28px -10px rgba(0, 23, 66, .5); min-width: 160px; }
.tooltip .tt-title { font-weight: 800; margin-bottom: 6px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.tooltip .tt-row span { display: inline-flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .8); }
.tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; }

.hbar-list { display: grid; gap: 16px; }
.hbar .top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; font-size: 14px; }
.hbar .top .money { font-size: 14px; }
.hbar .bars { margin-top: 8px; display: flex; gap: 2px; height: 12px; border-radius: 6px; background: var(--muted); overflow: hidden; }
.hbar .bars i { display: block; height: 100%; }
.hbar .bars i:first-child { border-radius: 6px 0 0 6px; }
.hbar .bars i:last-child { border-radius: 0 6px 6px 0; }
.hbar .bars i:only-child { border-radius: 6px; }
.hbar .sub { margin-top: 6px; font-size: 12px; color: var(--text-3); font-weight: 600; display: flex; flex-wrap: wrap; gap: 2px 14px; }

.status-list { display: grid; gap: 4px; }
.status-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: var(--r-xs); cursor: pointer; }
.status-row:hover { background: var(--muted); }
.status-row .badge { justify-self: start; }
.status-row .n { font-size: 13px; color: var(--text-3); font-weight: 600; }

.mini-list { display: grid; }
.mini-list a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.mini-list a:last-child { border-bottom: 0; }
.mini-list a:hover .t { color: var(--primary-2); }
.mini-list a > div:first-child { min-width: 0; }
.mini-list .t { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.mini-list .s { font-size: 13px; color: var(--text-3); }
.mini-list .r { text-align: right; flex: none; }

/* Toast */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: 8px; }
.toast { background: var(--primary); color: #fff; padding: 12px 20px; border-radius: var(--r-pill); font-weight: 600; font-size: 14px; box-shadow: var(--glass-shadow), 0 16px 32px -12px rgba(0, 23, 66, .5); display: flex; align-items: center; gap: 10px; animation: rise .25s var(--ease); }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.toast.err::before { background: var(--danger); }

.loading { padding: 80px; display: grid; place-items: center; }
.spinner { width: 40px; height: 40px; animation: spin 1.2s linear infinite; }
.spinner path { fill: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }
.choice input:checked + span .prob .bars i { background: rgba(255, 255, 255, .3); }
.choice input:checked + span .prob .bars i.on { background: var(--green); }
.field select:disabled { background-color: var(--muted); color: var(--text-3); cursor: not-allowed; }
