/* Shared data tables, independent of customer branding and PDF/layout tables. */
body table.table,
body table.history-table {
  border: 1px solid #dedfe2;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  background: #fff;
  color: #292d32;
  font-size: 13px;
  line-height: 1.5;
}

body table.table > thead > tr > th,
body table.history-table > thead > tr > th {
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid #d9dce0;
  background: #f3f4f5;
  color: #454b53;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1.5;
}

body table.table > tbody > tr > td,
body table.history-table > tbody > tr > td {
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid #e9eaec;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

body table.table > tbody > tr:last-child > td,
body table.history-table > tbody > tr:last-child > td { border-bottom: 0; }
body table.table > thead > tr:first-child > th:first-child { border-top-left-radius: 7px; }
body table.table > thead > tr:first-child > th:last-child { border-top-right-radius: 7px; }
body table.table.is-striped > tbody > tr:not(.selected):not(.child):nth-child(even),
body table.table.table-striped > tbody > tr:not(.selected):not(.child):nth-child(even) { background-color: #fafafb; }

@media (hover: hover) {
  body table.table > tbody > tr:not(.selected):not(.child):hover,
  body table.history-table > tbody > tr:not(.selected):not(.child):hover { background-color: #f0f2f4; }
}

body table.table > tfoot > tr > :is(th, td) {
  padding: 13px 16px;
  border: 0;
  border-top: 1px solid #d9dce0;
  background: #f3f4f5;
  font-weight: 600;
}
body table.table .b2b-table-amount,
body table.table :is(th, td).dt-type-numeric { text-align: right; white-space: nowrap; }
body table.table :is(td.dt-empty, td.dataTables_empty) { padding: 36px 20px; text-align: center; color: #626972; }
body .table-responsive { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }

/* DataTables 1.x and 2.x share the same controls across both application shells. */
body :is(.dataTables_wrapper, .dt-container) { color: #555c65; font-size: 13px; }
body .dt-container :is(.dt-layout-full, .dt-scroll) { width: 100%; min-width: 0; }
/* Bulma's negative column margins overflow the responsive wrapper on both axes. */
body .table-responsive > .dt-container > .columns { margin: 0; }
body .table-responsive > .dt-container > .columns > .column { min-width: 0; }
body :is(.dataTables_wrapper, .dt-container) :is(.dataTables_filter, .dataTables_length, .dt-search, .dt-length) label { font-weight: 400; }
body :is(.dataTables_wrapper, .dt-container) :is(input[type="search"], select) {
  min-height: 36px;
  border: 1px solid #d3d6db;
  border-radius: 6px;
  background-color: #fff;
  color: #292d32;
  padding: 6px 10px;
  font: inherit;
  box-shadow: none;
}
body :is(.dataTables_wrapper, .dt-container) input[type="search"] { width: 220px; max-width: 100%; }
body :is(.dataTables_wrapper, .dt-container) :is(input[type="search"], select):focus-visible,
body table.table :is(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid #515862;
  outline-offset: 2px;
}
body :is(.dataTables_wrapper, .dt-container) :is(.dataTables_info, .dt-info) { padding-top: 12px; font-size: 12px; }
body :is(.dataTables_wrapper, .dt-container) :is(.pagination-link, .pagination-previous, .pagination-next, .paginate_button, .dt-paging-button) {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid #d3d6db;
  border-radius: 6px;
  background: #fff;
  color: #363b42;
  box-shadow: none;
  font-size: 12px;
}
body :is(.dataTables_wrapper, .dt-container) :is(.pagination-link.is-current, .paginate_button.current, .dt-paging-button.current) {
  background: #202327;
  color: #fff;
  border-color: #202327;
}
body :is(.dataTables_wrapper, .dt-container) :is(.disabled, [disabled], [aria-disabled="true"]) { opacity: 0.5; cursor: default; }
body :is(.dataTables_wrapper, .dt-container) :is(.dt-scroll-head, .dataTables_scrollHead) { border-radius: 8px 8px 0 0; }
body :is(.dataTables_wrapper, .dt-container) :is(.dt-scroll-body, .dataTables_scrollBody) { overscroll-behavior: contain; }
body :is(.dt-scroll-body, .dataTables_scrollBody) table.table { border-top: 0; border-radius: 0 0 8px 8px; }
/* DataTables keeps a hidden measuring header in the scrolling body. */
body :is(.dt-scroll-body, .dataTables_scrollBody) table.table > thead > tr > th { padding-top: 0; padding-bottom: 0; border: 0; }
body :is(.dt-scroll-body, .dataTables_scrollBody) table.table > thead { visibility: hidden; }
body .dt-scroll-body .dt-scroll-sizing { height: 0; overflow: hidden; margin: 0; padding: 0; }
body :is(.dt-scroll-head, .dt-scroll-body) table.table { margin-bottom: 0 !important; }

body .b2b-timetable-page #timetable-main { padding: 0; margin-top: 12px; }
body .b2b-timetable-page .account-header > .column { min-width: 0; }
body .b2b-timetable-page .account-header > .column > .columns { align-items: end !important; }
body .b2b-timetable-page .account-header .label { margin-bottom: 6px; font-size: 12px; color: #555c65; }
body .b2b-timetable-page .account-header .box { padding: 16px !important; box-shadow: none; border: 1px solid #dedfe2; border-radius: 8px; height: 100%; }
body .b2b-timetable-page .account-header .box strong { display: block; color: #626972; font-size: 12px; font-weight: 500; margin-bottom: 6px; }
body .b2b-timetable-page .account-header .box span { font-size: 22px; font-weight: 600; color: #202327; font-variant-numeric: tabular-nums; }
body .b2b-timetable-page #totale-da-pagare { color: #b42332; }
body .b2b-timetable-page #tot-non-scaduto { color: #23734c; }
body .b2b-timetable-page .table-responsive { overflow: visible; }
body .b2b-timetable-page table.table { table-layout: fixed; width: 100%; }
body .b2b-timetable-page table.table > thead { position: sticky; top: 0; z-index: 2; }
body .b2b-timetable-page table.table th:is(.dt-orderable-asc, .dt-orderable-desc) { position: relative; padding-right: 22px; cursor: pointer; }
body .b2b-timetable-page table.table .dt-column-order { position: absolute; right: 6px; top: 50%; width: 10px; height: 20px; transform: translateY(-50%); }
body .b2b-timetable-page table.table .dt-column-order::before,
body .b2b-timetable-page table.table .dt-column-order::after { position: absolute; left: 0; font-size: 8px; line-height: 10px; opacity: 0.3; }
body .b2b-timetable-page table.table .dt-column-order::before { content: "\25B2"; top: 0; }
body .b2b-timetable-page table.table .dt-column-order::after { content: "\25BC"; bottom: 0; }
body .b2b-timetable-page table.table th[aria-sort="ascending"] .dt-column-order::before,
body .b2b-timetable-page table.table th[aria-sort="descending"] .dt-column-order::after { opacity: 1; }
body .b2b-timetable-page table.table :is(th, td) { padding: 12px 8px; white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
body .b2b-timetable-page table.table th { text-align: left; }
body .b2b-timetable-page table.table :is(th, td):nth-child(8),
body .b2b-timetable-page table.table :is(th, td):nth-child(9) { text-align: right; }
body .b2b-timetable-page table.table .red-data { color: #b42332; font-weight: 600; }

@media (max-width: 767px) {
  body table.table > thead > tr > th,
  body table.table > tbody > tr > td { padding: 12px; }
  body :is(.dataTables_wrapper, .dt-container) :is(.dataTables_filter, .dt-search) { text-align: left; }
  body :is(.dataTables_wrapper, .dt-container) input[type="search"] { width: 100%; }
  body :is(.dataTables_wrapper, .dt-container) :is(.dataTables_filter, .dt-search) { width: 100%; }
  body .b2b-timetable-page .account-header .box { padding: 12px !important; }
  body .b2b-timetable-page .account-header .box span { font-size: 20px; }
}

/* Keep all eleven fields readable on smaller screens without nested scrolling. */
@media (max-width: 1023px) {
  body .b2b-timetable-page table.table { display: block; overflow: visible; border: 0; background: transparent; }
  body .b2b-timetable-page table.table colgroup { display: none; }
  body .b2b-timetable-page table.table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body .b2b-timetable-page table.table tbody { display: block; }
  body .b2b-timetable-page table.table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid #dedfe2; border-radius: 8px; margin-bottom: 12px; background: #fff; }
  body .b2b-timetable-page table.table tbody tr td { display: flex; flex-direction: column; gap: 4px; padding: 12px; min-width: 0; text-align: left; border-bottom: 1px solid #e9eaec; }
  body .b2b-timetable-page table.table tbody tr td::before { content: attr(data-label); color: #626972; font-size: 11px; font-weight: 500; }
  body .b2b-timetable-page table.table tbody tr td:nth-last-child(-n+2) { border-bottom: 0; }
  body .b2b-timetable-page table.table tbody tr td[colspan] { grid-column: 1 / -1; }
  body .b2b-timetable-page table.table tbody tr td[colspan]::before { content: none; }
}
