/* =========================================================================
   Orion Reporting — prospetti con i colori dei fogli "P&L / BS / CF ETIOS"
   Verde #398271, grigio #D9D9D9 / #EAEAED, testo #2E2E38, blu cassa #328BC8
   ========================================================================= */

@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 {
  --green: #398271;
  --green-700: #2c6658;
  --green-900: #1d463c;
  --green-50: #eef6f3;
  --green-100: #d7eae4;
  --grey: #d9d9d9;
  --grey-head: #bfbfbf;
  --light: #eaeaed;
  --blue: #328bc8;
  --text: #2e2e38;
  --text-2: #5b5b6b;
  --text-3: #8b8b99;
  --line: #e4e6ea;
  --line-soft: #f0f1f3;
  --bg: #f6f7f8;
  --white: #fff;
  --danger: #c8323c;
  --danger-bg: #fdecee;
  --warning: #b86e00;
  --warning-bg: #fff4e0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 4px 14px rgba(20, 30, 40, .05);
  --font: 'Satoshi', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --num: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-700); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.hidden { display: none !important; }

/* ---- Barra superiore ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  height: 58px; padding: 0 24px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { height: 26px; }
.brand span { font-weight: 700; font-size: 15px; color: var(--green); padding-left: 10px; border-left: 1px solid var(--line); }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a {
  padding: 8px 12px; border-radius: 8px; text-decoration: none;
  color: var(--text-2); font-weight: 600; white-space: nowrap;
}
.nav a:hover { background: var(--green-50); color: var(--green-700); }
.nav a.active { background: var(--green); color: var(--white); }
.user { display: flex; align-items: center; gap: 10px; color: var(--text-2); white-space: nowrap; }
.user b { color: var(--text); font-weight: 600; }

main { padding: 20px 24px 60px; max-width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head p { margin: 2px 0 0; color: var(--text-2); }

/* ---- Pulsanti e controlli ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--white); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text);
}
.btn:hover { border-color: var(--green); color: var(--green-700); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--white); }
.btn.primary:hover { background: var(--green-700); color: var(--white); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field > span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
select, input[type=text], input[type=search], input[type=password], input[type=number], input[type=date] {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--white);
}
select:focus, input:focus { outline: 2px solid var(--green-100); border-color: var(--green); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--white); height: 34px; }
.seg button { border: 0; background: transparent; padding: 0 12px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--green); color: var(--white); }

.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; color: var(--text-2); height: 34px; }
.check input { accent-color: var(--green); width: 16px; height: 16px; }

/* Selettore società */
.companies { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.companies button {
  border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 14px;
  cursor: pointer; font-weight: 600; color: var(--text-2);
}
.companies button small { color: var(--text-3); font-weight: 500; margin-left: 4px; }
.companies button:hover { border-color: var(--green); }
.companies button.on { background: var(--green-900); border-color: var(--green-900); color: var(--white); }
.companies button.on small { color: #cfe5de; }
.companies .sep { width: 1px; background: var(--line); margin: 0 4px; }

/* ---- Card / KPI ---- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 14px 16px; border-left: 4px solid var(--green); }
.kpi .k-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.kpi .k-value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.kpi.alt { border-left-color: var(--blue); }
.kpi.grey { border-left-color: var(--grey-head); }
.pos { color: var(--green-700); }
.neg { color: var(--danger); }

.notice { padding: 10px 14px; border-radius: 8px; background: var(--warning-bg); color: #6d4300; margin-bottom: 14px; font-size: 13px; }
.notice.info { background: var(--green-50); color: var(--green-900); }
.empty { padding: 40px; text-align: center; color: var(--text-3); }

/* ---- Prospetti stile ETIOS ---- */
.stmt { margin-bottom: 22px; }
.stmt-scroll { overflow: auto; max-height: calc(100vh - 140px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
table.fin {
  border-collapse: separate; border-spacing: 0;
  font-family: var(--num); font-size: 12.5px; color: var(--text);
  min-width: 100%;
}
table.fin th, table.fin td { padding: 4px 9px; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
table.fin td.n, table.fin th.n { text-align: right; font-variant-numeric: tabular-nums; min-width: 74px; }
table.fin td.p, table.fin th.p { text-align: right; font-variant-numeric: tabular-nums; min-width: 44px; color: var(--green); font-style: italic; font-size: 11.5px; }
table.fin .lbl { text-align: left; position: sticky; left: 0; z-index: 2; background: var(--white); min-width: 290px; max-width: 340px; border-right: 1px solid var(--line); }
table.fin thead th { position: sticky; z-index: 3; }
table.fin thead tr.h1 th { top: 0; background: var(--grey-head); color: var(--text); font-weight: 700; border-top: 3px solid var(--green-900); }
table.fin thead tr.h2 th { top: 28px; background: var(--green); color: var(--white); font-weight: 700; border-bottom: 1px solid var(--green-900); font-size: 11.5px; }
table.fin thead th.lbl { z-index: 4; }
table.fin thead tr.h1 th.lbl { background: var(--green); color: var(--white); font-size: 13px; }
table.fin thead tr.h2 th.lbl { background: var(--white); color: var(--text-3); font-weight: 500; }
table.fin th.gap, table.fin td.gap { min-width: 10px; padding: 0; background: var(--white) !important; border-bottom-color: transparent; }
table.fin thead th.fc { background: #6b6b78; }
table.fin thead tr.h2 th.fc { background: var(--green-900); }
table.fin thead th.op { background: var(--light); }
table.fin td.fc { background: #f7f9f8; }
table.fin td.dl { background: #fbfbfb; }
.src { font-weight: 500; opacity: .85; font-size: 10.5px; letter-spacing: .02em; }

table.fin tr.r-green td { background: var(--green) !important; color: var(--white); font-weight: 700; border-top: 1px solid var(--green-900); border-bottom: 1px solid var(--green-900); }
table.fin tr.r-green td.p { color: #d9efe8; }
table.fin tr.r-grey td { background: var(--grey) !important; font-weight: 700; border-top: 1px solid #b8b8b8; border-bottom: 1px solid #b8b8b8; }
table.fin tr.r-light td { background: var(--light) !important; font-weight: 700; border-top: 1px solid #cfcfd6; }
table.fin tr.r-bold td, table.fin tr.r-sub td { font-weight: 700; }
table.fin tr.r-pct td { font-style: italic; color: var(--green); font-size: 11.5px; }
table.fin tr.r-italic td { font-style: italic; color: var(--text-2); }
table.fin tr.r-blue td { background: var(--blue) !important; color: var(--white); font-weight: 700; }
table.fin tr.r-blue td.p { color: #dceefa; }
table.fin tr.r-check td { color: var(--text-3); font-size: 11.5px; border-bottom: 2px solid var(--line); }
table.fin tr.r-check td.bad { color: var(--danger); font-weight: 700; }
table.fin tr.ind-1 td.lbl { padding-left: 22px; }
table.fin tr.ind-2 td.lbl { padding-left: 36px; }
table.fin tbody tr:hover td { background: var(--green-50); }
table.fin tbody tr.r-green:hover td, table.fin tbody tr.r-blue:hover td { filter: brightness(1.05); }
.na { color: var(--text-3); }

/* ---- Tabelle dati ---- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th { position: sticky; top: 0; background: var(--green); color: var(--white); text-align: left; padding: 8px 10px; font-weight: 700; white-space: nowrap; z-index: 1; }
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { background: var(--green-700); }
table.data td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.tot td { font-weight: 700; background: var(--grey); border-top: 1px solid #b8b8b8; }
table.data tbody tr:hover td { background: var(--green-50); }
table.data td.wrap { max-width: 380px; white-space: normal; }
table.data td .clip { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; color: var(--text-2); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-bottom: 18px; }
.section-title { font-size: 15px; font-weight: 700; margin: 6px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 4px; height: 16px; background: var(--green); border-radius: 2px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--green-700); border-bottom-color: var(--green); }

.bar { height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--green); }

/* ---- Import ---- */
.import-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.import-card h3 { font-size: 15px; margin-bottom: 4px; }
.import-card p { margin: 0 0 10px; color: var(--text-2); font-size: 13px; }
.import-card .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.import-card input[type=file] { max-width: 100%; font-size: 13px; }
.result { margin-top: 10px; font-size: 13px; white-space: pre-wrap; }
.result.ok { color: var(--green-700); }
.result.err { color: var(--danger); }
code { background: var(--line-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---- Form modale ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 30, 30, .35); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { width: min(560px, 100%); padding: 20px 22px; }
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, var(--green-900), var(--green) 70%); }
.login-card { width: min(380px, 100%); padding: 30px 28px; }
.login-card img { height: 34px; display: block; margin: 0 auto 8px; }
.login-card h1 { text-align: center; font-size: 18px; color: var(--green); margin-bottom: 20px; }
.login-card label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.login-card input { width: 100%; margin-top: 4px; height: 40px; color: #000; }
.login-card .btn { width: 100%; justify-content: center; height: 40px; margin-top: 6px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 6px; }

/* ---- Toast ---- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--white); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; }
.toast.err { background: var(--danger); }

.loading { padding: 40px; text-align: center; color: var(--text-3); }

@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .brand span { display: none; }
  .user b { display: none; }
  main { padding: 14px 12px 40px; }
  table.fin .lbl { min-width: 190px; }
}

@media print {
  .topbar, .toolbar, .companies, .btn { display: none !important; }
  main { padding: 0; }
  .stmt-scroll { max-height: none; overflow: visible; box-shadow: none; }
  table.fin thead th { position: static; }
  table.fin .lbl { position: static; }
  body { background: #fff; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =========================================================================
   v1.1 — navigazione per schede, dettaglio voci, copertura forecast
   ========================================================================= */
.small { font-size: 12px; }
.mono { font-family: var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; }
kbd { display: inline-block; padding: 0 5px; margin: 0 1px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--white); font-size: 11px; font-family: var(--num); }

/* Schede società */
.ent-rail { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.ent {
  flex: 0 0 auto; width: 150px; scroll-snap-align: start; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 9px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.ent:hover { transform: translateY(-2px); border-color: var(--green); box-shadow: 0 6px 18px rgba(29, 70, 60, .14); }
.ent.cons { width: 180px; border-color: var(--green-100); background: linear-gradient(160deg, var(--white), var(--green-50)); }
.ent.on { background: var(--green-900); border-color: var(--green-900); color: var(--white); box-shadow: 0 8px 22px rgba(29, 70, 60, .35); }
.ent.off { opacity: .55; }
.ent-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.ent-top b { font-size: 13px; letter-spacing: .03em; }
.ent-top span { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent.on .ent-top span { color: #bfe0d6; }
.ent-val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ent-sub { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.ent.on .ent-sub { color: #cfe7df; }
.ent-sub i { font-style: normal; font-weight: 700; }
.ent-sub i.up { color: var(--green-700); }
.ent-sub i.down { color: var(--danger); }
.ent.on .ent-sub i.up { color: #9ff0cf; }
.ent.on .ent-sub i.down { color: #ffb3b8; }
.ent-hint { font-size: 11.5px; margin: -2px 0 14px; }

/* Titolo e tab dei prospetti */
.rep-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.rep-title h1 { font-size: 24px; font-weight: 700; }
.rep-title p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.stmt-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.stmt-tabs button {
  border: 0; background: transparent; cursor: pointer; padding: 9px 18px; border-radius: 9px;
  font-weight: 700; font-size: 14px; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; transition: background .12s;
}
.stmt-tabs button small { font-size: 10px; font-weight: 700; width: 17px; height: 17px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--line-soft); color: var(--text-3); }
.stmt-tabs button:hover { background: var(--green-50); color: var(--green-700); }
.stmt-tabs button.on { background: var(--green); color: var(--white); }
.stmt-tabs button.on small { background: rgba(255, 255, 255, .25); color: var(--white); }
.toolbar.compact { gap: 8px 12px; padding: 10px 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.drill-hint { font-size: 11.5px; margin: -6px 0 6px; }

/* Righe cliccabili */
table.fin tr.drill td[data-c], table.fin tr.drill td.lbl { cursor: pointer; }
table.fin tr.drill td[data-c]:hover { outline: 2px solid var(--green); outline-offset: -2px; background: var(--green-50) !important; color: var(--text); }
table.fin tr.drill td.lbl:hover { text-decoration: underline; }

/* Pannello laterale del dettaglio */
.drawer-bg { position: fixed; inset: 0; background: rgba(20, 30, 30, .28); z-index: 55; display: flex; justify-content: flex-end; animation: fade .15s ease; }
.drawer {
  width: min(980px, 100%); height: 100%; background: var(--bg); box-shadow: -10px 0 30px rgba(0, 0, 0, .18);
  padding: 18px 22px; overflow: auto; animation: slide .18s ease;
}
@keyframes slide { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h2 { font-size: 20px; }
.drawer-head p { margin: 3px 0 0; font-size: 12.5px; }
.drawer-kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 6px; }
.drawer-kpi div { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; border-left: 4px solid var(--green); }
.drawer-kpi span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-3); }
.drawer-kpi b { font-size: 18px; font-variant-numeric: tabular-nums; }
.compo { font-size: 12px; color: var(--text-2); margin: 6px 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.compo span { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.drawer-table { max-height: calc(100vh - 290px); }
.drawer-table table.data td { font-size: 12.5px; }
tr.grp td { background: var(--green-50) !important; font-weight: 700; color: var(--green-900); border-top: 1px solid var(--green-100); }
.tag { display: inline-block; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 700; background: var(--line-soft); color: var(--text-2); white-space: nowrap; }
.tag.t-bdv { background: var(--green-50); color: var(--green-700); }
.tag.t-extracontabile { background: var(--warning-bg); color: var(--warning); }
.tag.t-riclassifica { background: #e9f2fb; color: #1f6aa5; }
.tag.t-elisione { background: var(--danger-bg); color: var(--danger); }
.tag.t-storico { background: var(--light); color: var(--text-2); }

/* Copertura forecast */
.cov-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cov { display: inline-block; min-width: 46px; text-align: center; padding: 1px 6px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.cov.ok { background: var(--green-50); color: var(--green-700); }
.cov.mid { background: var(--warning-bg); color: var(--warning); }
.cov.low { background: var(--danger-bg); color: var(--danger); }
.covbar { position: relative; display: flex; height: 14px; background: var(--line-soft); border-radius: 4px; overflow: visible; }
.covbar i, .legend i { display: block; height: 100%; }
.covbar i:first-child { border-radius: 4px 0 0 4px; }
.s-act { background: var(--green-900); }
.s-bk { background: var(--green); }
.s-pp { background: #9fd2c3; }
.covbar .s-fc { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--danger); border-radius: 2px; }
.legend { margin-left: 8px; display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 12px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.legend .s-fc-l { display: inline-block; width: 3px; height: 12px; background: var(--danger); margin-left: 6px; }
.cov-table td.covbar-cell { min-width: 220px; vertical-align: middle; }
table.data tr.hl td { background: var(--green-50); }

@media (max-width: 760px) {
  .ent { width: 132px; }
  .stmt-tabs button { padding: 8px 10px; font-size: 13px; }
  .drawer { padding: 14px; }
  .drawer-kpi b { font-size: 15px; }
}

/* v1.2 — vista ETIOS e pulsanti società */
.rep-bar { margin-bottom: 14px; }
.ent-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.ent-btns button {
  border: 1px solid var(--line); background: var(--white); border-radius: 8px; padding: 7px 14px; cursor: pointer;
  font-weight: 700; font-size: 13px; color: var(--text-2); letter-spacing: .02em; transition: all .12s ease;
}
.ent-btns button:hover { border-color: var(--green); color: var(--green-700); transform: translateY(-1px); }
.ent-btns button.cons { padding: 7px 18px; }
.ent-btns button.on { background: var(--green); border-color: var(--green); color: var(--white); box-shadow: 0 4px 12px rgba(57, 130, 113, .3); }
table.fin.etios td.n, table.fin.etios th.n { min-width: 86px; }
table.fin.etios thead tr.h1 th.dh, table.fin.etios thead tr.h2 th.dh { background: var(--grey-head); color: var(--text); }
table.fin.etios thead tr.h2 th.dh { background: var(--light); border-bottom-color: var(--grey-head); }
table.fin.etios td.cur { font-weight: 600; }
table.fin.etios td.up { color: var(--green-700); }
table.fin.etios td.dn { color: var(--danger); }
table.fin.etios tr.r-green td.up, table.fin.etios tr.r-green td.dn { color: var(--white); }
table.fin.etios tr.r-green td.dl { background: var(--green-700) !important; }
.drill-hint { margin: 8px 0 0; }
.stmt-scroll { max-height: calc(100vh - 250px); }

/* v1.3 — selettore perimetro / società */
.rep-bar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin-bottom: 16px; }
.perim { display: inline-flex; gap: 4px; padding: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.perim button, .soc-btn {
  border: 0; background: transparent; cursor: pointer; border-radius: 9px; padding: 7px 16px; text-align: left;
  display: flex; flex-direction: column; line-height: 1.2; color: var(--text-2); transition: background .12s;
}
.perim button b, .soc-btn b { font-size: 14.5px; color: var(--text); }
.perim button small, .soc-btn small { font-size: 11px; color: var(--text-3); }
.perim button:hover { background: var(--green-50); }
.perim button.on { background: var(--green-900); }
.perim button.on b { color: var(--white); }
.perim button.on small { color: #bfe0d6; }
.soc-pick { position: relative; display: flex; }
.soc-btn { position: relative; padding-right: 36px; min-width: 230px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.soc-btn:hover { border-color: var(--green); }
.soc-btn .caret { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.soc-pick.on .soc-btn { background: var(--green-900); border-color: var(--green-900); }
.soc-pick.on .soc-btn b { color: var(--white); }
.soc-pick.on .soc-btn small, .soc-pick.on .soc-btn .caret { color: #bfe0d6; }
.soc-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: 420px; max-width: 90vw;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(20, 30, 40, .16);
}
.soc-menu[hidden] { display: none; }
.soc-menu button { border: 0; background: transparent; cursor: pointer; text-align: left; padding: 8px 10px; border-radius: 8px; display: flex; flex-direction: column; }
.soc-menu button b { font-size: 13px; }
.soc-menu button span { font-size: 12px; color: var(--text-3); }
.soc-menu button em { font-size: 10.5px; font-style: normal; color: var(--warning); }
.soc-menu button:hover { background: var(--green-50); }
.soc-menu button.on { background: var(--green); color: var(--white); }
.soc-menu button.on span { color: #d7eae4; }

/* =========================================================================
   v1.4 — prospetto ETIOS: leggibilità
   ========================================================================= */
.stmt-scroll { border-radius: 14px; border-color: #dfe3e6; box-shadow: 0 1px 2px rgba(20, 30, 40, .05), 0 8px 24px rgba(20, 30, 40, .06); }
table.fin.etios {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13.5px; color: #1d2125;
  font-variant-numeric: tabular-nums lining-nums; font-feature-settings: 'tnum' 1, 'lnum' 1;
}
table.fin.etios th, table.fin.etios td { padding: 7px 14px; border-bottom: 1px solid #edf0f2; }
table.fin.etios td.n, table.fin.etios th.n { min-width: 92px; letter-spacing: .01em; }

/* Intestazione */
table.fin.etios thead th { position: sticky; z-index: 3; border-bottom: 0; }
table.fin.etios thead tr.h1 th { top: 0; height: 34px; border-top: 0; }
table.fin.etios thead tr.h2 th { top: 34px; height: 36px; }
table.fin.etios thead th.lbl {
  background: var(--green-900); color: #fff; vertical-align: middle; z-index: 5; min-width: 320px;
  border-right: 1px solid rgba(255, 255, 255, .12);
}
table.fin.etios .t-ent { display: block; font-size: 15px; font-weight: 700; letter-spacing: .01em; }
table.fin.etios .t-sec { display: block; font-size: 11.5px; font-weight: 500; color: #a9d3c7; text-transform: uppercase; letter-spacing: .08em; margin-top: 1px; }
table.fin.etios thead th.grp {
  background: var(--green-900); color: #fff; text-align: center; font-size: 12px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; border-bottom: 2px solid #5ea896;
}
table.fin.etios thead tr.h2 th { background: var(--green); color: #fff; font-size: 12.5px; font-weight: 700; vertical-align: bottom; line-height: 1.15; }
table.fin.etios thead tr.h2 th small { display: block; font-size: 10.5px; font-weight: 500; color: #cfe7df; letter-spacing: .04em; }
table.fin.etios thead tr.h2 th.v-cy { background: #2f7363; }
table.fin.etios thead tr.h2 th.v-d, table.fin.etios thead tr.h2 th.v-dp { background: #5f9d8e; font-size: 13px; }
table.fin.etios th.gap, table.fin.etios td.gap { min-width: 14px; width: 14px; padding: 0; background: var(--bg) !important; border: 0 !important; }
table.fin.etios thead th.gap { background: var(--bg) !important; }

/* Celle */
table.fin.etios td.lbl { min-width: 320px; font-size: 13.5px; color: #2b3036; border-right: 1px solid #e3e7ea; }
table.fin.etios td.v-py { color: #4d5560; }
table.fin.etios td.v-cy { background: #f3f8f6; font-weight: 600; color: #121619; }
table.fin.etios td.v-d { font-weight: 600; }
table.fin.etios td.v-dp { min-width: 74px; }
table.fin.etios td.up { color: #1b7a52; }
table.fin.etios td.dn { color: #c4323b; }
table.fin.etios .pill { display: inline-block; min-width: 52px; text-align: right; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #5b6470; background: #f1f3f5; }
table.fin.etios .pill.up { color: #1b7a52; background: #e3f4ec; }
table.fin.etios .pill.dn { color: #c4323b; background: #fbe7e9; }

/* Righe semplici: zebra leggera per seguire la riga */
table.fin.etios tbody tr.r-plain:nth-child(even) td:not(.v-cy):not(.gap),
table.fin.etios tbody tr.r-italic:nth-child(even) td:not(.v-cy):not(.gap) { background: #fbfcfc; }

/* Subtotali e totali */
table.fin.etios tr.r-bold td, table.fin.etios tr.r-sub td { font-weight: 700; color: #121619; }
table.fin.etios tr.r-grey td { background: #e9ecee !important; font-weight: 700; color: #121619; border-top: 1px solid #cdd3d7; border-bottom: 1px solid #cdd3d7; }
table.fin.etios tr.r-grey td.v-cy { background: #dde3e1 !important; }
table.fin.etios tr.r-light td { background: #f1f3f4 !important; font-weight: 700; color: #121619; border-top: 1px solid #dadfe2; }
table.fin.etios tr.r-light td.v-cy { background: #e6ecea !important; }
table.fin.etios tr.r-green td { background: var(--green) !important; color: #fff; font-weight: 700; font-size: 14px; border-top: 0; border-bottom: 1px solid #2c6658; height: 38px; }
table.fin.etios tr.r-green td.lbl { background: var(--green) !important; }
table.fin.etios tr.r-green td.v-cy { background: #2f7363 !important; }
table.fin.etios tr.r-green td.v-py { color: #e3f2ed; }
table.fin.etios tr.r-green td.up, table.fin.etios tr.r-green td.dn { color: #fff; }
table.fin.etios tr.r-green .pill { background: rgba(255, 255, 255, .18); color: #fff; }
table.fin.etios tr.r-green .pill.dn { background: rgba(255, 120, 130, .35); }
table.fin.etios tr.r-green .pill.up { background: rgba(140, 240, 190, .3); }
table.fin.etios tr.r-pct td { font-style: italic; font-size: 12px; color: #3e7d6e; padding-top: 3px; padding-bottom: 5px; }
table.fin.etios tr.r-pct td.lbl { color: #3e7d6e; padding-left: 26px; }
table.fin.etios tr.r-pct td.v-cy { font-weight: 600; }
table.fin.etios tr.r-italic td { font-style: italic; color: #5b6470; font-size: 13px; }
table.fin.etios tr.r-blue td { background: var(--blue) !important; color: #fff; font-weight: 700; }
table.fin.etios tr.r-check td { font-size: 11.5px; color: #9aa3ad; border-bottom: 0; }
table.fin.etios .chk-bad { color: var(--danger); font-weight: 700; }
table.fin.etios tr.ind-1 td.lbl { padding-left: 30px; }
table.fin.etios tr.ind-2 td.lbl { padding-left: 46px; }

/* Hover e clic */
table.fin.etios tbody tr:hover td:not(.gap) { background: #e8f3ef !important; }
table.fin.etios tbody tr.r-green:hover td:not(.gap) { background: #2c6658 !important; }
table.fin.etios tr.drill td[data-m]:hover { outline: 2px solid var(--green); outline-offset: -2px; cursor: pointer; }

@media (max-width: 760px) {
  table.fin.etios { font-size: 12.5px; }
  table.fin.etios td.lbl, table.fin.etios thead th.lbl { min-width: 200px; }
  table.fin.etios th, table.fin.etios td { padding: 6px 9px; }
}

/* v1.4 — vista mensile più leggibile */
table.fin:not(.etios) { font-size: 13px; font-feature-settings: 'tnum' 1, 'lnum' 1; color: #1d2125; }
table.fin:not(.etios) th, table.fin:not(.etios) td { padding: 6px 11px; }
table.fin:not(.etios) tbody tr:nth-child(even):not([class*='r-green']):not([class*='r-grey']):not([class*='r-light']) td:not(.lbl) { background: #fbfcfc; }
table.fin:not(.etios) tr.r-green td { height: 34px; }

/* v1.5 — meno colori: niente bordo al passaggio, niente righe alternate, Δ neutri */
table.fin tr.drill td[data-c]:hover, table.fin.etios tr.drill td[data-m]:hover { outline: none !important; }
table.fin tr.drill td[data-c]:hover { background: inherit; }
table.fin.etios tbody tr.r-plain:nth-child(even) td:not(.v-cy):not(.gap),
table.fin.etios tbody tr.r-italic:nth-child(even) td:not(.v-cy):not(.gap),
table.fin:not(.etios) tbody tr:nth-child(even):not([class*='r-green']):not([class*='r-grey']):not([class*='r-light']) td:not(.lbl) { background: #fff; }
table.fin.etios tbody tr:hover td:not(.gap), table.fin tbody tr:hover td { background: #f5f6f7 !important; }
table.fin.etios tbody tr.r-green:hover td:not(.gap), table.fin tbody tr.r-green:hover td { background: var(--green) !important; }
table.fin.etios tbody tr.r-grey:hover td { background: #e9ecee !important; }
table.fin.etios td.v-cy { background: #fff; }
table.fin.etios tr.r-grey td.v-cy { background: #e9ecee !important; }
table.fin.etios tr.r-light td.v-cy { background: #f1f3f4 !important; }
table.fin.etios tr.r-green td.v-cy { background: var(--green) !important; }
table.fin.etios td.up, table.fin.etios td.dn { color: inherit; }
table.fin.etios .pill, table.fin.etios .pill.up, table.fin.etios .pill.dn { background: none !important; color: inherit; padding: 0; min-width: 0; font-weight: 500; font-size: 13px; }
table.fin.etios tr.r-green .pill { color: #fff; }
table.fin.etios tr.r-pct td, table.fin.etios tr.r-pct td.lbl { color: #5b6470; }
table.fin.etios thead tr.h2 th.v-cy, table.fin.etios thead tr.h2 th.v-d, table.fin.etios thead tr.h2 th.v-dp { background: var(--green); }
table.fin.etios thead th.grp { border-bottom: 1px solid rgba(255, 255, 255, .25); }
table.fin.etios td.v-py { color: inherit; }

/* v1.6 — scritture extracontabili */
.rett-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.rett-side { background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100vh - 170px); position: sticky; top: 74px; }
.rett-filters { display: grid; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.rett-filters select, .rett-filters input { width: 100%; }
.rett-list { overflow: auto; flex: 1; }
.rett-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--text); }
.rett-item:hover { background: #f5f6f7; }
.rett-item.on { background: var(--green-50); box-shadow: inset 3px 0 0 var(--green); }
.ri-top { display: flex; justify-content: space-between; gap: 10px; }
.ri-top b { font-size: 13.5px; }
.ri-top span { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ri-sub { font-size: 12px; color: var(--text-3); }
.ri-sub em { color: var(--danger); font-style: normal; }
.rett-foot { padding: 8px 14px; border-top: 1px solid var(--line); }
.rett-main { background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.rett-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.rett-head h2 { font-size: 20px; }
.rett-actions { display: flex; gap: 6px; }
.rett-form { display: grid; grid-template-columns: 200px 100px 1fr 170px 130px; gap: 10px 12px; margin-bottom: 14px; }
.rett-form .full { grid-column: 1 / -1; }
.rett-form input, .rett-form select { width: 100%; }
.rett-gridbar { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 8px; }
.rett-gridbar p { margin: 0 0 6px; max-width: 640px; }
.rett-grid { margin-bottom: 12px; }
.rett-grid table.data th { background: var(--green); }
.rett-grid td { padding: 4px 6px; vertical-align: middle; }
.rett-grid td.c-voce { min-width: 250px; }
.rett-grid td.c-voce select { width: 100%; height: 30px; }
.rett-grid td.c-desc input { width: 100%; min-width: 180px; height: 30px; }
.rett-grid .nat { display: block; font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.rett-grid .nat-altro { color: var(--warning); }
.rett-grid td.c-val { position: relative; min-width: 104px; padding: 4px 3px; }
.rett-grid .rg-val { width: 100%; height: 30px; text-align: right; font-variant-numeric: tabular-nums; padding: 0 20px 0 6px; border-color: transparent; background: #f7f8f9; border-radius: 6px; }
.rett-grid .rg-val:focus { background: #fff; border-color: var(--green); }
.rett-grid .rg-val:disabled { background: transparent; padding-right: 6px; color: var(--text); }
.rett-grid .rg-prop { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 2px; opacity: 0; }
.rett-grid td.c-val:hover .rg-prop, .rett-grid td.c-val:focus-within .rg-prop { opacity: 1; }
.rett-grid .rg-prop:hover { color: var(--green-700); }
.rett-grid tr.rg-tot td { background: #f6f7f8; font-weight: 600; font-size: 12.5px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.rett-grid tr.rg-tot:first-of-type td { border-top: 2px solid var(--line); }
.rett-grid tr.rg-k td { background: #eef2f1; }
.rett-grid tr.rg-q .ok { color: var(--green-700); }
.rett-grid tr.rg-q .ko { color: var(--danger); }
.rett-grid tbody tr:hover td { background: inherit; }
@media (max-width: 1100px) {
  .rett-layout { grid-template-columns: 1fr; }
  .rett-side { position: static; max-height: 360px; }
  .rett-form { grid-template-columns: 1fr 1fr; }
}

/* v1.6 — griglia importi più leggibile */
.rett-grid table.data { width: max-content; min-width: 100%; }
.rett-grid td.c-val { min-width: 124px; }
.rett-grid .rg-val { font-family: var(--num); font-size: 12.5px; letter-spacing: .01em; }
.rett-grid td.c-voce, .rett-grid th.c-voce { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 230px; max-width: 230px; }
.rett-grid td.c-desc, .rett-grid th.c-desc { position: sticky; left: 230px; z-index: 2; background: #fff; min-width: 190px; max-width: 190px; box-shadow: 1px 0 0 var(--line); }
.rett-grid th.c-voce, .rett-grid th.c-desc { background: var(--green); z-index: 3; }
.rett-grid tr.rg-tot td:first-child { position: sticky; left: 0; z-index: 2; background: inherit; }
.rett-grid tr.rg-tot td { font-family: var(--num); }
.rett-grid td.c-voce select { font-size: 12.5px; }
.rett-grid td.c-desc input { min-width: 0; font-size: 12.5px; }
.rett-grid .rg-val { width: 116px; }
.rett-grid td.c-val { min-width: 0; width: 122px; }
/* fine v1.6 */

/* v1.7 — chiusure e libro giornale */
.ch-table td { vertical-align: middle; }
.ch-table th small { font-weight: 500; opacity: .85; }
.ch-badge { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--green-50); color: var(--green-700); font-weight: 700; font-size: 12px; }
.drawer tr.lg-row { cursor: pointer; }
.drawer tr.lg-row td:first-child::after { content: ' ▸'; color: var(--text-3); }
.drawer tr.lg-row.open td:first-child::after { content: ' ▾'; }
.drawer tr.lg-detail > td { background: #fafbfb; padding: 8px 10px 12px 26px; }
.lg-box .lg-table { margin-top: 6px; font-size: 12px; }
.lg-box .lg-table th { background: #e9ecee; color: var(--text); position: static; padding: 5px 8px; }
.lg-box .lg-table td { padding: 4px 8px; }
.tag.t-libro { background: var(--green-50); color: var(--green-700); }
.tag.t-chiuso { background: #eef0f2; color: var(--text-2); }

.ch-badge.ch-ey { background: #eef0f2; color: var(--text-2); }

/* v1.8 — scritture extracontabili come foglio Excel */
.ex-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 12px 14px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.ex-bar .ex-save { display: flex; align-items: center; gap: 8px; }
.ex-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.ex-tools .ex-hint { margin-left: auto; }
.ex-grid { max-height: calc(100vh - 330px); }
.ex-grid table.data th { background: var(--green); }
.ex-grid td { padding: 2px 4px; vertical-align: middle; border-bottom: 1px solid #edf0f2; }
.ex-grid td input, .ex-grid td select { width: 100%; height: 30px; border: 1px solid transparent; background: transparent; border-radius: 5px; padding: 0 6px; font-size: 13px; }
.ex-grid td input:hover, .ex-grid td select:hover { border-color: var(--line); }
.ex-grid td input:focus, .ex-grid td select:focus { border-color: var(--green); background: #fff; outline: none; }
.ex-grid td.c-chk, .ex-grid th.c-chk { width: 34px; text-align: center; }
.ex-grid td.c-az { width: 92px; }
.ex-grid td.c-acct { width: 120px; }
.ex-grid td.c-nome { min-width: 260px; }
.ex-grid td.c-cl { min-width: 240px; position: relative; }
.ex-grid td.c-cl input { padding-right: 92px; }
.ex-grid td.c-cl .nat { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 10.5px; color: var(--text-3); pointer-events: none; }
.ex-grid td.c-cl .nat-altro { color: var(--warning); }
.ex-grid td.c-val { width: 150px; }
.ex-grid td.c-val input.num { text-align: right; font-family: var(--num); font-variant-numeric: tabular-nums; }
.ex-grid td.c-comm { min-width: 200px; }
.ex-grid tbody tr:hover td { background: #f7f8f9; }
.ex-grid tbody tr.sel td { background: var(--green-50); }
.ex-from { padding: 12px 14px; margin-bottom: 12px; border-color: var(--green-100); }
.ex-from-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ex-from-grid { max-height: 320px; }
.ex-from-grid table.data th { background: #e9ecee; color: var(--text); }
.ex-grid td.c-chk input, .ex-grid th.c-chk input, .ex-from-grid input[type=checkbox] { width: 15px; height: 15px; padding: 0; accent-color: var(--green); }
.ex-grid td input, .ex-grid td select { height: 28px; }
.ex-grid td { height: 32px; }

/* =========================================================================
   v1.9 — Review commerciale
   ========================================================================= */
.comm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.comm-tabs button { border: 0; background: transparent; cursor: pointer; padding: 10px 16px; font-weight: 700; font-size: 14px; color: var(--text-2); border-bottom: 3px solid transparent; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.comm-tabs button small { font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: var(--line-soft); color: var(--text-3); }
.comm-tabs button.on { color: var(--green-900); border-bottom-color: var(--green); }
.comm-tabs button.on small { background: var(--green); color: #fff; }
.comm-filters { margin-bottom: 12px; }
.comm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.comm-main { padding: 20px 22px; }
.comm-main-plain { min-width: 0; }
.comm-h { font-size: 20px; color: var(--green-900); margin-bottom: 14px; }
.comm-h3 { font-size: 14px; font-weight: 700; color: var(--text); margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.card-pad > .comm-h3:first-child { margin-top: 0; }
.comm-notes { padding: 16px 18px; position: sticky; top: 74px; background: #fbfcfc; }
.comm-notes h3 { font-size: 14px; color: var(--green-900); padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.comm-notes ul { margin: 0 0 10px; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.comm-notes li { margin-bottom: 9px; }
.comm-grid .kpis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.comm-grid .kpi .k-value { font-size: 20px; }

.c-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); margin: 4px 0 8px; }
.c-legend span { display: inline-flex; align-items: center; gap: 5px; }
.c-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.c-legend i.hatch, .s-gap { background: repeating-linear-gradient(135deg, #f3c4c7 0 3px, #fff 3px 6px); box-shadow: inset 0 0 0 1px #e08a90; }
.c-svg { width: 100%; height: auto; display: block; font-family: var(--num); }
.c-svg text { font-size: 11px; fill: var(--text-2); }

/* Card di copertura */
.cov-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.cov-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.cc-y { font-weight: 700; font-size: 14px; }
.cc-y small { font-weight: 500; color: var(--text-3); }
.cc-big { display: flex; gap: 22px; margin: 6px 0 2px; }
.cc-big b { display: block; font-size: 28px; line-height: 1.1; color: var(--green-900); font-variant-numeric: tabular-nums; }
.cc-big b.neg { color: var(--danger); }
.cc-big span { font-size: 11px; color: var(--text-2); font-weight: 600; }
.c-covbar { display: flex; height: 12px; background: var(--line-soft); border-radius: 4px; overflow: hidden; margin: 8px 0 6px; gap: 2px; }
.c-covbar i { display: block; height: 100%; }
.cc-leg { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 11.5px; color: var(--text-2); }
.cc-leg i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* Waterfall */
.wf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.wf-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 4px; position: relative; }
.wf-y { position: absolute; top: 8px; left: 10px; background: var(--green-900); color: #fff; font-weight: 700; font-size: 12px; padding: 1px 8px; border-radius: 5px; }
.wf-cons { fill: #1d463c; }
.wf-bk { fill: #398271; }
.wf-pp { fill: #9fd2c3; }
.wf-gap { fill: url(#hatch); fill: #f6d3d5; stroke: #e08a90; stroke-dasharray: 3 2; }
.wf-target { fill: #2e2e38; }
.wf-link { stroke: #b8bec5; stroke-dasharray: 2 2; }
.wf-base { stroke: #9aa3ad; }
.c-svg .wf-val { font-size: 12px; font-weight: 700; fill: var(--text); text-anchor: middle; }
.c-svg .wf-val.neg { fill: var(--danger); }
.c-svg .wf-val.pos { fill: var(--green-700); }
.c-svg .wf-lab { font-size: 11px; text-anchor: middle; fill: var(--text-2); }
.c-svg .wf-lab.muted { fill: var(--text-3); font-size: 10px; }
.wf-bubble rect { fill: #fff; stroke: var(--green-900); stroke-width: 1.5; }
.c-svg .wf-bubble text { font-size: 12px; font-weight: 700; text-anchor: middle; fill: var(--green-900); }
.c-svg .st-tot { font-size: 12px; font-weight: 700; text-anchor: middle; fill: var(--text); }
.c-svg .st-in { font-size: 10px; text-anchor: middle; fill: var(--text); }
.c-svg .st-in.light { fill: #fff; }

/* Copertura per società */
table.cov-soc { width: 100%; border-collapse: collapse; font-size: 13px; }
table.cov-soc th { text-align: left; font-size: 12px; color: var(--text-2); padding: 4px 8px; border-bottom: 1px solid var(--text-3); }
table.cov-soc td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); }
table.cov-soc tr.tot td { border-top: 1px solid var(--text-3); font-weight: 700; }
.cs-cell { display: grid; grid-template-columns: 1fr 48px; align-items: center; gap: 8px; }
.cs-cell .c-covbar { margin: 0; height: 11px; }
.cs-cell b { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.cs-cell b.neg { color: var(--danger); }

/* Donut */
.c-donut { display: grid; grid-template-columns: 240px 1fr; align-items: center; gap: 10px; }
.c-svg.dn { max-width: 260px; }
.c-svg .dn-c { font-size: 26px; font-weight: 700; text-anchor: middle; fill: var(--green-900); }
.c-svg .dn-s { font-size: 11px; text-anchor: middle; fill: var(--text-3); }
.dn-leg { display: grid; grid-template-columns: 12px 1fr auto 42px; gap: 6px; align-items: center; font-size: 12.5px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.dn-leg i { width: 11px; height: 11px; border-radius: 2px; }
.dn-leg b { font-variant-numeric: tabular-nums; }
.dn-leg em { font-style: normal; color: var(--text-3); text-align: right; font-size: 11.5px; }

/* Barre orizzontali */
.hb-row { display: grid; grid-template-columns: 170px 1fr 92px; align-items: center; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.hb-l { text-align: right; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-bars { position: relative; height: 14px; }
.hb-bars i { position: absolute; left: 0; top: 0; height: 100%; border-radius: 0 3px 3px 0; }
.hb-b1 { background: #398271; }
.hb-b2 { background: #d7eae4; }
.hb-v { font-variant-numeric: tabular-nums; font-weight: 600; }
.hb-v em { font-style: normal; font-weight: 500; color: var(--text-3); }

/* Tabelle top 10 */
table.top-t td { vertical-align: middle; }
table.top-t td.tb { width: 34%; position: relative; }
table.top-t td.tb i { display: inline-block; height: 12px; background: #398271; border-radius: 0 3px 3px 0; vertical-align: middle; }
table.top-t td.tb span { margin-left: 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
table.top-t td.tb2 { width: 34%; }
table.top-t td.tb2 div { display: flex; align-items: center; gap: 8px; height: 15px; }
table.top-t td.tb2 i { display: inline-block; height: 10px; border-radius: 0 3px 3px 0; }
table.top-t td.tb2 i.w { background: #398271; }
table.top-t td.tb2 i.n { background: #d7eae4; }
table.top-t td.tb2 span { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 600; }
.clip2 { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob { display: inline-block; padding: 0 6px; border-radius: 5px; background: var(--green-50); color: var(--green-900); font-weight: 700; font-size: 11.5px; }
.st-tab td { font-size: 12.5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }

/* Funnel */
.funnel { display: grid; grid-template-columns: 110px repeat(4, 1fr); gap: 0; margin-top: 6px; }
.fn-stage { background: linear-gradient(180deg, var(--c), var(--c)); color: #fff; padding: 12px 10px; text-align: center; border-right: 2px solid #fff; clip-path: polygon(0 0, 100% 8%, 100% 92%, 0 100%); min-height: 70px; display: flex; flex-direction: column; justify-content: center; }
.fn-stage:nth-child(2), .fn-stage:nth-child(3) { color: var(--green-900); }
.fn-stage b { font-size: 13px; }
.fn-stage small { opacity: .85; }
.fn-rowl { display: flex; align-items: center; font-weight: 700; font-size: 12.5px; padding: 8px; background: var(--line-soft); border-bottom: 2px solid #fff; }
.fn-cell { padding: 8px 10px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.fn-n { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border: 1px solid var(--text-3); border-radius: 10px; margin-bottom: 4px; }
.fn-bars { display: flex; justify-content: center; align-items: flex-end; gap: 10px; height: 92px; }
.fn-bars div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 44px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fn-bars i { display: block; width: 36px; border-radius: 3px 3px 0 0; order: 2; }
.fn-bars span { order: 1; }
.fn-w { background: #398271; }
.fn-np { background: #d7eae4; }
.fn-top { padding: 6px 8px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fn-top table { width: 100%; font-size: 11.5px; border-collapse: collapse; }
.fn-top th { text-align: left; color: var(--text-3); font-weight: 600; border-bottom: 1px solid var(--line); }
.fn-top td { padding: 2px 0; border-bottom: 1px solid var(--line-soft); }
.fn-head { }

/* Target */
.tgt-t .tg-in { width: 110px; text-align: right; height: 30px; font-family: var(--num); }

@media (max-width: 1200px) {
  .comm-grid { grid-template-columns: 1fr; }
  .comm-notes { position: static; }
  .cov-cards, .wf-grid { grid-template-columns: 1fr; }
}

.comm-main-plain .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
table.top-t td.tb { white-space: nowrap; }
@media (max-width: 900px) { .comm-main-plain .grid-2 { grid-template-columns: 1fr; } }

/* v1.9 — extracontabili più semplici da compilare e consultare */
.ex-bar { align-items: center; }
.ex-bar select, .ex-bar input[type=search] { height: 34px; }
.ex-bar input[type=search] { flex: 1; min-width: 200px; }
.ex-month { display: inline-flex; align-items: center; gap: 4px; }
.ex-month select { font-weight: 700; min-width: 150px; }
.ex-bar .ex-save { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
#ex-state { color: var(--warning); font-weight: 600; }
.ex-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.ex-kpis > div { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.ex-kpis span { display: block; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.ex-kpis b { font-size: 16px; font-variant-numeric: tabular-nums; }
.ex-kpis b small { font-size: 12px; font-weight: 500; color: var(--text-3); }
.ex-kpis .warn b { color: var(--danger); font-size: 13px; }
.ex-carry { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 10px; border-radius: 10px; background: var(--green-50); border: 1px solid var(--green-100); }
.ex-carry > div { flex: 1; min-width: 280px; font-size: 13px; }
.ex-carry .muted { display: block; font-size: 12px; }
.ex-tools .ex-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.ex-grid tr.ex-grp td { background: #f4f6f7 !important; border-top: 1px solid #dfe3e6; padding: 6px 10px; }
.ex-grid tr.ex-grp div { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.ex-grid tr.ex-grp b { font-size: 13.5px; }
.ex-grid tr.ex-grp span { color: var(--text-2); }
.ex-grid tr.ex-grp em { font-style: normal; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ex-grid tr.ex-grp em.ok { color: var(--green-700); }
.ex-grid tr.ex-grp em.ko { color: var(--danger); font-weight: 700; }
.ex-grid tr.ex-grp .ex-addaz { margin-left: auto; padding: 2px 10px; }
.ex-grid td.c-prev, .ex-grid th.c-prev { color: var(--text-3); font-size: 12px; font-family: var(--num); white-space: nowrap; padding: 2px 10px; }
.ex-grid th.c-prev { color: #fff; }
.ex-grid td.c-act { white-space: nowrap; width: 1%; }
.ex-ic { border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-3); border-radius: 5px; padding: 2px 6px; font-size: 12px; }
.ex-ic:hover { border-color: var(--line); color: var(--green-700); background: #fff; }
.ex-grid tr.err td { background: var(--danger-bg) !important; }
.ex-grid td.c-az { width: 84px; }
.ex-grid td.c-nome { min-width: 220px; }
.ex-grid td.c-cl { min-width: 230px; }
@media (max-width: 1100px) { .ex-kpis { grid-template-columns: repeat(2, 1fr); } }

.ex-grid table.data td { vertical-align: middle; }
