:root {
  --navy: #17324d;
  --blue: #244b6b;
  --teal: #2a9d8f;
  --green: #4e9f3d;
  --amber: #f4a261;
  --red: #d1495b;
  --ink: #263238;
  --muted: #607d8b;
  --line: #d9e2ec;
  --fill: #f6f8fa;
  --panel: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--fill);
  font-family: Arial, Helvetica, sans-serif;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 32, 48, 0.88);
}

.login-overlay[hidden] { display: none; }
.login-card { width: min(440px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: 18px; background: #fff; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32); }
.login-card img { width: 180px; max-width: 100%; margin: 0 auto; }
.login-card h1, .login-card p { margin: 0; }
.login-card label { display: grid; gap: 6px; font-weight: 700; }
.login-card input { border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; font: inherit; }
.login-card button { padding: 12px; }
.login-card #login-feedback { min-height: 20px; color: #991b1b; }
.environment-badge { position: fixed; right: 16px; bottom: 16px; z-index: 9000; padding: 8px 12px; border-radius: 999px; background: #7c2d12; color: #fff; font-size: 12px; font-weight: 900; letter-spacing: 0.06em; }
.server-save-status { margin-left: auto; font-size: 12px; }
.server-save-status[data-kind="ok"] { color: #166534; }
.server-save-status[data-kind="error"] { color: #991b1b; }

button,
select,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  color: #fff;
  background: var(--navy);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
}

.brand-block {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-logo {
  width: 58px;
  height: 44px;
  object-fit: contain;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #fff;
}

.brand-block strong,
.brand-block span {
  display: block;
}

.brand-block span {
  margin-top: 2px;
  color: #bfd7ea;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  background: var(--blue);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: var(--teal);
}

.nav-item.locked,
.nav-item:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.sidebar-footer {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-footer span,
.sidebar-footer strong,
.sidebar-footer small {
  display: block;
  font-size: 12px;
}

.sidebar-footer span {
  color: #bfd7ea;
  margin-bottom: 4px;
}

.sidebar-footer small {
  margin-top: 6px;
  color: #bfd7ea;
  line-height: 1.35;
}

.user-switcher {
  margin-bottom: 14px;
  color: #fff;
  font-size: 12px;
}

.user-switcher select {
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  color: var(--navy);
}

.main-panel {
  min-width: 0;
  padding: 34px;
}

.main-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.main-brand-bar img {
  display: block;
  width: 210px;
  height: 58px;
  object-fit: contain;
}

.main-brand-bar strong {
  color: var(--navy);
  font-size: 15px;
  text-align: right;
}

.top-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.top-actions button {
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  color: var(--navy);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.top-actions button:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.55;
}

.context-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.context-strip.hidden {
  display: none;
}

.context-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.context-strip strong {
  color: var(--navy);
}

.auth-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid #b9d9d4;
  background: #edf8f6;
}

.auth-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-strip strong {
  color: var(--navy);
}

.auth-strip.auth-warning {
  border-color: var(--red);
  background: #fff5f6;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.cover-page {
  min-height: calc(100vh - 68px);
  display: none;
  align-items: center;
  justify-content: center;
}

.cover-page.active {
  display: flex;
}

.cover-card {
  width: min(980px, 100%);
  padding: 38px 58px 52px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: center;
}

.cover-logos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 34px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.cover-logos img {
  display: block;
  width: 260px;
  height: 74px;
  object-fit: contain;
  background: #fff;
}

.cover-logos .key-esg-logo {
  width: 320px;
  height: 110px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.cover-card h1,
.cover-card h2,
.cover-card h3 {
  margin: 0;
}

.cover-card h1 {
  color: var(--navy);
  font-size: 42px;
}

.cover-card h2 {
  margin-top: 10px;
  color: var(--navy);
  font-size: 18px;
}

.cover-card h3 {
  margin-top: 26px;
  color: var(--teal);
  font-size: 34px;
}

.cover-rule {
  height: 1px;
  margin: 26px auto 0;
  background: var(--line);
}

.cover-subtitle {
  max-width: 720px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 15px;
}

.cover-actions {
  margin-top: 34px;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.cover-actions button,
.toolbar button,
.primary-link {
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  color: #fff;
  background: var(--navy);
  text-decoration: none;
  cursor: pointer;
}

.cover-actions button:first-child,
.primary-link {
  background: var(--teal);
}

.file-path-note {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.page-header {
  margin-bottom: 22px;
}

.page-header h2 {
  margin: 0;
  color: var(--navy);
  font-size: 28px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel h3 {
  margin: 0 0 16px;
  color: var(--navy);
}

.lead {
  font-size: 16px;
  line-height: 1.55;
}

.lead,
.muted,
.clean-list li,
.map-list em,
.metric-note span,
.report-draft p,
.method-note p {
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.clean-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.map-list {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 14px;
}

.map-list span {
  font-weight: 700;
  color: var(--navy);
}

.map-list em {
  color: var(--muted);
  font-style: normal;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.workflow div {
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--fill);
}

.workflow strong {
  display: block;
  color: var(--teal);
  font-size: 22px;
}

.workflow span {
  display: block;
  margin-top: 5px;
  color: var(--navy);
  font-weight: 700;
}

.attachment-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.attachment-row a {
  padding: 11px 14px;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
}

.manual-sheet {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
}

.manual-index {
  align-self: start;
  position: sticky;
  top: 24px;
}

.manual-index button {
  display: block;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--navy);
  background: transparent;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.manual-index button:hover {
  color: var(--teal);
}

.manual-action {
  margin-top: 10px;
  padding: 10px 14px;
  border: 0;
  color: #fff;
  background: var(--teal);
  font-weight: 800;
  cursor: pointer;
}

.manual-action:hover {
  background: var(--navy);
}

.manual-document {
  display: grid;
  gap: 22px;
}

.manual-document section {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.manual-document section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.manual-document p {
  margin: 0;
  line-height: 1.65;
  text-align: justify;
  text-align-last: left;
}

.manual-workflow {
  margin-top: 18px;
}

.metric-note strong,
.metric-note span {
  display: block;
}

.metric-note strong {
  color: var(--navy);
  font-size: 22px;
}

.metric-note span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}

.save-status {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-weight: 700;
}

select {
  min-width: 240px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
}

input {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.company-lookup {
  width: 100%;
  min-width: 280px;
}

input[readonly] {
  color: var(--muted);
  background: var(--fill);
  font-weight: 800;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.app-table th {
  padding: 12px 14px;
  color: #fff;
  background: var(--navy);
  text-align: left;
  line-height: 1.25;
}

.app-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.45;
}

.app-table tbody tr:nth-child(odd) {
  background: #eaf3f8;
}

.app-table select {
  min-width: 0;
  width: 100%;
  min-height: 44px;
}

#question-table {
  table-layout: fixed;
}

#question-table th:nth-child(1) {
  width: 15%;
}

#question-table th:nth-child(2) {
  width: 46%;
}

#question-table th:nth-child(3) {
  width: 22%;
}

#question-table th:nth-child(4) {
  width: 17%;
}

#question-table td {
  padding: 16px;
  vertical-align: middle;
}

.question-area-cell strong,
.question-area-cell span {
  display: block;
}

.question-area-cell strong {
  color: var(--teal);
  font-size: 18px;
}

.question-area-cell span {
  margin-top: 4px;
  color: var(--navy);
  font-weight: 800;
}

.question-text-cell {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

.question-answer-cell {
  padding-left: 22px !important;
  padding-right: 22px !important;
}

.question-result {
  color: var(--navy);
  font-weight: 800;
}

.app-table.compact th,
.app-table.compact td {
  padding: 8px;
}

.table-select {
  padding: 4px 8px;
  border: 1px solid var(--teal);
  color: var(--navy);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.table-select:hover {
  color: #fff;
  background: var(--teal);
}

.selected-company label {
  margin-bottom: 16px;
}

.risk-status {
  width: 100%;
  margin-top: 12px;
}

.company-entry-panel {
  margin-top: 18px;
}

.test-company-panel {
  margin-top: 18px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.company-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  max-width: 980px;
}

.company-form button {
  min-height: 40px;
  padding: 10px 14px;
  border: 0;
  color: #fff;
  background: var(--teal);
  cursor: pointer;
}

.company-form .save-status {
  grid-column: 1 / -1;
}

.danger-button,
.danger-link {
  border: 1px solid var(--red);
  color: var(--red);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.danger-button {
  min-height: 40px;
  padding: 10px 14px;
  white-space: nowrap;
}

.danger-link {
  padding: 5px 9px;
}

.danger-button:hover,
.danger-link:hover {
  color: #fff;
  background: var(--red);
}

.danger-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  background: #f3f5f8;
  cursor: not-allowed;
}

.detail-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0 18px;
}

.detail-grid div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.risk-pill {
  display: inline-block;
  padding: 4px 9px;
  color: #fff;
  font-weight: 700;
  background: var(--teal);
}

.risk-pill.alto {
  background: var(--red);
}

.risk-pill.medio {
  background: var(--amber);
  color: #4a2f00;
}

.risk-pill.medio-alto {
  background: #b96b21;
}

.risk-pill.basso {
  background: var(--green);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  align-content: start;
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpi-card strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 50px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 22px;
  background: var(--fill);
  border: 1px solid var(--line);
}

.bar-fill {
  height: 100%;
  background: var(--teal);
}

.score-ring {
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
  margin: 6px 0 18px;
  border-radius: 50%;
  background: conic-gradient(var(--teal) var(--score-angle), #e7edf3 0);
}

.score-ring span {
  width: 136px;
  height: 136px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-size: 34px;
  font-weight: 800;
}

.icaap-value {
  margin: 18px 0;
  color: var(--navy);
  font-size: 54px;
  font-weight: 800;
}

.component-list {
  display: grid;
  gap: 12px;
}

.component-list div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--fill);
}

.component-list span {
  color: var(--navy);
  font-weight: 800;
}

.component-list strong {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.report-layout {
  margin: 18px 0;
}

.method-note {
  margin-bottom: 18px;
}

.method-note p {
  margin: 0;
  line-height: 1.6;
}

.method-note p + p {
  margin-top: 12px;
}

.icaap-note {
  margin-top: 18px;
}

.icaap-note p {
  margin: 0 0 12px;
  line-height: 1.6;
  text-align: justify;
  text-align-last: left;
}

.formula-box {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--fill);
}

.formula-box strong {
  color: var(--navy);
}

.formula-box span {
  color: var(--ink);
  font-weight: 700;
}

.formula-values {
  margin-top: 12px;
}

.threshold-table {
  margin: 8px 0 14px;
}

.threshold-table td {
  line-height: 1.45;
}

.report-outline {
  padding-left: 22px;
}

.report-draft {
  display: grid;
  gap: 12px;
  line-height: 1.55;
}

.report-draft p {
  margin: 0;
}

.report-table th:nth-child(1) {
  width: 15%;
}

.report-table th:nth-child(2),
.report-table th:nth-child(3),
.report-table th:nth-child(4),
.report-table th:nth-child(5) {
  width: 21.25%;
}

.report-toolbar {
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.report-toolbar select,
.report-toolbar input {
  min-width: 150px;
}

.board-report {
  display: grid;
  gap: 18px;
}

.report-cover {
  border-left: 6px solid var(--teal);
}

.report-cover h3 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 28px;
}

.board-report .kpi-card strong {
  font-size: 24px;
}

.board-actions-table th:nth-child(1) {
  width: 18%;
}

.board-actions-table th:nth-child(2),
.board-actions-table th:nth-child(3) {
  width: 34%;
}

.board-actions-table th:nth-child(4) {
  width: 14%;
}

.board-report-page .component-list strong {
  max-width: none;
  text-align: left;
  line-height: 1.35;
}

.board-report-page .component-list span {
  max-width: none;
  color: var(--navy);
  font-weight: 800;
}

.recommendation-report .component-list div,
.board-report-page .component-list div {
  grid-template-columns: 180px minmax(0, 1fr);
}

.board-actions-table {
  table-layout: fixed;
}

.board-actions-table td {
  line-height: 1.5;
}

.admin-panel {
  margin-bottom: 18px;
}

.admin-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.admin-form button {
  min-height: 40px;
  padding: 10px 14px;
  border: 0;
  color: #fff;
  background: var(--teal);
  font-weight: 800;
  cursor: pointer;
  justify-self: start;
}

.admin-form .save-status {
  width: 100%;
}

.permission-grid {
  display: grid;
  gap: 10px;
}

.permission-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--fill);
}

.permission-grid strong,
.permission-grid span {
  display: block;
}

.permission-grid strong {
  color: var(--navy);
}

.permission-grid span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.admin-table select {
  width: 100%;
  min-width: 0;
}

.active-user-pill {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 7px;
  color: #fff;
  background: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

button:disabled,
select:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

@media print {
  .sidebar,
  .top-actions,
  .context-strip,
  .auth-strip,
  .report-toolbar {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main-panel {
    padding: 0;
  }

  .page {
    display: none !important;
  }

  .page.active {
    display: block !important;
  }

  body.print-rnf-only .page {
    display: none !important;
  }

  body.print-rnf-only #rendiconto {
    display: block !important;
  }

  body.print-rnf-only #rendiconto .report-toolbar {
    display: none !important;
  }

  body.print-upgrade-only .page {
    display: none !important;
  }

  body.print-upgrade-only #upgrade-raccomandazioni {
    display: block !important;
  }

  body.print-upgrade-only #upgrade-raccomandazioni .report-toolbar {
    display: none !important;
  }

  .panel,
  .kpi-card {
    break-inside: avoid;
    border-color: #9aa8b5;
  }

  body {
    background: #fff;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

	  .grid.two,
	  .grid.three,
	  .kpi-grid,
	  .workflow,
	  .manual-sheet,
	  .company-form,
    .admin-form {
	    grid-template-columns: 1fr;
	  }

	  .manual-index {
	    position: static;
	  }

  .panel-title-row {
    display: grid;
  }

  .main-panel {
    padding: 20px;
  }

  .main-brand-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-brand-bar img {
    width: 190px;
  }

  .main-brand-bar strong {
    text-align: left;
  }

  .cover-card {
    padding: 34px 24px;
  }
}


.revaluation-box {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f6f8fa;
}

.revaluation-box h4 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 15px;
}

.revaluation-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.revaluation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.secondary-action {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--teal);
  color: var(--navy);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.revaluation-alert {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.revaluation-alert.planned {
  border-color: var(--teal);
  color: var(--navy);
  background: #e8f5f2;
}

.revaluation-alert.due,
.revaluation-mini.due {
  border-color: var(--red);
  color: var(--red);
  background: #fff5f6;
}

.revaluation-mini {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
}
