/* Esconde a tabela só para navegadores com JS habilitado, 
   até que o script finalize (data-geometryInitialized="true") */
.js table.cds-table:not([data-geometry-initialized="true"]) {
  visibility: hidden; /* preserva a metragem (sem “pular” layout ao redor) */
}

/* Fade-in suave sem mexer em métricas */
.js table.cds-table[data-geometry-initialized="true"] {
  opacity: 1;
  transition: opacity 120ms ease;

}
.js table.cds-table:not([data-geometry-initialized="true"]) {
  opacity: 0;
}

.cds-table-card {
    width: 100%;
    background-color: var(--cds-color-white);
    padding: 8px;
    border-radius: 8px;
    box-shadow: var(--cds-panel-shadow);
    margin-bottom: 8px;
    overflow: hidden;
}

.cds-table-container {
    display: flex;
    width: 100%;
    overflow: auto;
}

.cds-table-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: 3px;
    overflow: auto;
}

table.cds-table {
    display: block;
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    table-layout: fixed;
    border-spacing: 0;
}

table.cds-table thead tr{
    width: 100%;
    border-radius: 8px;
    z-index: 10;
}

table.cds-table thead th {
    position: sticky;
    top: 0;
    padding: 8px 0;
    background-color: var(--cds-table-header-blue-background);
    cursor: grab;
    z-index: 5;
}

.cds-tab-content table.cds-table thead th {
    top: 0 !important;
}

table.cds-table thead tr th:first-child {
    width: 38px !important;
    max-width: 38px !important;
    min-width: 38px !important;
    padding: 0;
    background-color: var(--cds-table-header-blue-background);
    border-radius: 3px 0 0 0;
}

table.cds-table tbody tr {
    height: 100%;
    border-bottom:1px solid var(--cds-table-columns-divider);
}

/* SOFT DELETED ROWS */
table.cds-table tbody tr.soft-deleted {
    background: repeating-linear-gradient(-45deg, var(--cds-table-row-soft-deleted), var(--cds-table-row-soft-deleted) 10px, var(--cds-color-white) 10px, var(--cds-color-white) 20px) !important;
}

table.cds-table tbody tr.soft-deleted a {
    color: var(--cds-text-disabled);
    text-decoration: line-through !important;
}

table.cds-table tbody tr.soft-deleted .cds-tag-success {
    background-color: var(--cds-color-success-weak) !important;
}

table.cds-table tbody tr.soft-deleted .cds-tag-critical {
    background-color: var(--cds-color-critical-weak) !important;
}

table.cds-table tbody tr.soft-deleted .cds-tag-alert {
    background-color: var(--cds-color-alert-weak) !important;
}

table.cds-table tbody tr td:last-child .cds-cell {
    border-right: none;
}

table.cds-table tbody tr.cds-selected-row {
  background-color: #e6f0ff !important;
}

table.cds-table tbody tr:nth-child(odd) {
    background: #fcfcfd;
}

table.cds-table tbody tr:nth-child(even) {
    background: var(--cds-table-row-even);
}

table.cds-table tbody tr:hover {
    background-color: var(--cds-table-row-hover);
}

table.cds-table tbody td {
    height: 100%;
    padding: 8px 0;
    padding-right: 0;
}

table.cds-table tfoot tr {
    position: sticky;
    height: 100%;
    bottom: 0px;
    background-color: aliceblue;
    z-index: 5;
}

table.cds-table tfoot tr td:first-child {
    border-radius: 0 0 0 3px;
}

table.cds-table tfoot td {
    height: 100%;
    padding: 8px 0;
    padding-right: 0;
}

table.cds-table tfoot tr td:last-child .cds-foot-cell {
    border-right: none;
}

.select-td {
    padding: 0 !important;
}

.cds-fixed-column {
  cursor: default !important;
}

body.cds-column-resizing {
    cursor: col-resize !important;
    user-select: none !important;    
}

.cds-column-resizer {
    background-color: transparent;
    position: absolute;
    right: 0;
    top: 0;
    width: 10px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
    z-index: 10;
    border-right: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.cds-column-resizer:hover:not(.cds-resizing-active) {
    background-color: rgba(0,0,0,0.05);
    border-right: 2px solid rgba(59, 130, 246, 0.5);
}

.cds-column-resizer.cds-resizing-active {
    background-color: rgba(0,0,0,0.05);
    border-right: 2px solid rgba(59, 130, 246, 0.7);
}

/* Garante que o resizer seja sempre visível e funcional */
.cds-column-resizer:active,
.cds-column-resizer:focus {
    outline: none;
}

/* Melhora a área de clique do resizer */
.cds-column-resizer::before {
    content: '';
    position: absolute;
    left: -2px;
    right: -2px;
    top: 0;
    bottom: 0;
    cursor: col-resize;
}

/* Previne seleção de texto durante redimensionamento */
.cds-table[data-resizing="1"] {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Garante que as colunas mantenham suas larguras durante redimensionamento */
.cds-table[data-resizing="1"] thead th,
.cds-table[data-resizing="1"] tbody td {
    box-sizing: border-box;
}

.cds-header-cell {
    position: relative;
    width: fit-content;
    text-align: center;
    padding: 0 8px;
    text-align: left;
}

.cds-header-cell-flex {
    position: relative;
    display: grid;
    width: fit-content;
    justify-content: flex-start;
    text-align: left;
    padding: 0 8px;
}

.cds-header-cell > span, .cds-header-cell-flex > span {
    position: absolute;
    width: 100%;
    text-align: center;
    left: 0;
    top: -16px;
}

.cds-header-cell a, .cds-header-cell-flex a {
    display: flex;
    font-size: 13px;
    line-height: 15px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--cds-text-offblack);
    margin: auto 0;
    white-space: nowrap;
    overflow: hidden;
}

.cds-header-cell-flex > a {
    margin: auto;
}

.cds-header-cell > span, .cds-header-cell-flex > span {
    position: absolute;
    width: 100%;
    text-align: center;
    left: 0;
    bottom: -16px;
}

.cds-header-cell-select {
    display: flex;
    width: 100%;
    height:38px;
    justify-content: center;
    align-items: center;
    border-right:1px solid var(--cds-table-header-outline);
    padding: 0;
}

table.cds-table thead th:last-child .cds-header-cell {
    border-right: none;
}

.cds-header-content {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.cds-cell {
    display: flex;
    justify-content: left;
    padding: 0 8px;
}

.cds-cell-link {
    width: min-content;
    text-decoration: none;
    cursor: pointer !important;
}

.cds-cell-link:hover {
    color: var(--cds-color-primary);
    text-decoration: underline;
}

.cds-cell-flex {
    display: grid;
    justify-content: flex-start;
    padding: 0 8px;
    height: 28px;
    overflow: hidden;
}

.cds-cell > a, .cds-cell-flex > a, .cds-foot-cell > a, .cds-foot-cell > span {
    display: block;
    font-size: 13px;
    line-height: 15px;
    color: var(--cds-text-offblack);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: auto 0;
    cursor: default;
}

.cds-foot-cell > span {
    display: flex;
    width: 12px;
    justify-content: center;
    color: var(--cds-color-grey);
    font-size: 13px;
    font-weight: 600;
    padding-right: 4px;
}

.cds-foot-cell .cds-icon {
    width: 12px;
    height: 12px;
    fill: var(--cds-color-primary);
}

.cds-cell-left {
    text-align: left;
    justify-content: flex-start;
}

.cds-cell-right {
    display: flex;
    width: 100%;
    text-align: right;
    justify-content: flex-end;
}

.cds-cell-center {
    text-align: center;
    justify-content: center;
}

.cds-cell-select {
    display: flex;
    width: 100%;
    height:44px;
    justify-content: center;
    align-items: center;
    border-right: 1px solid var(--cds-table-select-columns-divider);
}

.cds-header-cell-numearl {
    text-align: right;
    justify-content: flex-end;
}

.cds-cell-numeral {
    text-align: right;
    justify-content: flex-end !important;
}

.cds-cell-numeral a {
    font-weight: 700;
    text-align: right;
    justify-content: flex-end;
}

.cds-td-total {
    background-color: var(--cds-table-header-blue-background);
}

.cds-column-hidden {
    display: none;
}

.cds-foot-cell {
    display: flex;
    justify-content: center;
    padding: 0 8px;
    border-right:1px solid var(--cds-table-columns-divider);
}

/* Table Form Elements */
.cds-table-control {
    font-family: var(--cds-font-family);
    display: block;
    width: 100%;
    height: 28px;
    padding: 8px;
    font-style: normal;
    font-size: 16px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.005em;
    color: var(--cds-text-offblack);
    background-color: var(--cds-form-background);
    background-clip: padding-box;
    border: none;
    border-radius: 3px;
    box-shadow: var(--cds-form-inner-shadow);
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.cds-table-control::placeholder {
    color: var(--cds-text-grey);
}
.cds-table-control:focus {
    background-color: var(--cds-form-selected);
    border: 1px solid var(--cds-form-selected-border);
    outline: 0;
    box-shadow: var(--cds-form-inner-shadow), var(--cds-form-outer-glow);
}
.cds-table-control + .cds-table-control {
    margin-top: 1em;
}

/* Generic disable styles */

input.cds-table-control:disabled {
  cursor: default;
  color: var(--cds-text-grey);
  background-color: var(--cds-color-disabled) !important;
  cursor: default !important;
}

/* TABLE Input Type CHECKBOX */

input[type="checkbox"].cds-table-control {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  grid-template-columns: 16px auto;
  gap: 8px;
  background-color: var(--cds-color-white);
  margin: 0;
  font: inherit;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid var(--cds-table-checkbox-border);
  place-content: center;
  padding: 0;
  cursor: pointer;
}

input[type="checkbox"].cds-table-control.margin-auto {
    margin: auto;
}

input[type="checkbox"].cds-table-control.small {
  width: 16px;
  height: 16px;
  gap: 6px;
}

input[type="checkbox"].cds-table-control.small::before {
  width: 10px;
  height: 10px;
  box-shadow: inset 10px 10px var(--cds-color-primary-medium), var(--cds-form-outer-shadow);
}

input[type="checkbox"].cds-table-control.small:checked {
  box-shadow: inset 10px 10px var(--cds-color-white);
}

input[type="checkbox"].cds-table-control::before {
  content: "";
  width: 12px;
  height: 12px;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  border-radius: 2px;
  box-shadow: inset 20px 20px var(--cds-color-primary-medium), var(--cds-form-outer-shadow);
  margin-left: 6px;
}
input[type="checkbox"].cds-table-control:checked::before {
  transform: scale(1);
}
input[type="checkbox"].cds-table-control:checked {
  border: 2px solid var(--cds-color-primary-medium);
  box-shadow: inset 20px 20px var(--cds-color-white);
}

input[type="date"].cds-table-control {
  cursor: pointer;
}

/* Checkbox - seleção múltipla */

/* Aplica a borda e fundo corretos ao input quando ele está no estado indeterminado. */
input[type="checkbox"].cds-table-control.indeterminate {
  border: 2px solid var(--cds-color-primary-medium);
  box-shadow: inset 20px 20px var(--cds-color-white);
}

/* Cria e exibe o traço horizontal (retângulo) dentro do checkbox. */
input[type="checkbox"].cds-table-control.indeterminate::before {
  content: "";
  width: 12px;
  height: 4px;    
  transform: scale(1); /* Garante que o traço fique visível */
  transition: 120ms transform ease-in-out;
  border-radius: 2px;
  box-shadow: inset 20px 20px var(--cds-color-primary-medium), var(--cds-form-outer-shadow);
  margin-left: 6px; 
}

/* TABLE Input Type SEARCH */

.cds-table-search-input-container {
  position: relative;
  display: flex;
  min-width: 100px;
}

.cds-table-search-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    justify-content: center;
    padding-left: 128px;
}

input[type=search].cds-table-control::-ms-clear {display: none; width : 0; height: 0;}

input[type=search].cds-table-control::-ms-reveal {display: none; width : 0; height: 0;}

input[type=search].cds-table-control::-webkit-search-decoration,
input[type=search].cds-table-control::-webkit-search-cancel-button,
input[type=search].cds-table-control::-webkit-search-results-button,
input[type=search].cds-table-control::-webkit-search-results-decoration {
  display: none;
}

input[type=search].cds-table-control {
    width: 0;
    min-width: 245px;
    border: 1px solid var(--cds-table-header-outline);
    background-color: var(--cds-color-white);
    border-radius: 3px 0 0 3px;
    padding: 2px 23px 2px 30px;
    outline: 0;
    transition: width 0.6s ease-in-out;
}

input[type=search].cds-table-control:focus {
    width: 400px;
    box-shadow: none;
}

.cds-sort-icon {
    width: 10px;
    height: 10px;
    fill: var(--cds-color-neutral);
}

thead th {
    position: relative;
    cursor: pointer;
}

thead th.cds-fixed-column {
    cursor: default;
}

/* Esconde ícone no estado null por padrão */
thead th[data-sort-state="null"] .cds-sort-indicator {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Mostra no hover */
thead th[data-sort-state="null"]:hover .cds-sort-indicator {
    opacity: 1;
}

/* Sempre visível quando ordenado */
thead th[data-sort-state="asc"] .cds-sort-indicator,
thead th[data-sort-state="desc"] .cds-sort-indicator {
    opacity: 1;
}

/* Table drilldown */
.cds-table-row-detail {
    display: table-row;
    visibility: collapse;
}

.cds-table-row-detail.visible {
    visibility: visible;
    
}

.cds-table-row-detail .cds-table-row-detail-container {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 1s ease-in-out;
    overflow: hidden;
}

.cds-table-row-detail.visible .cds-table-row-detail-container {
    grid-template-rows: 1fr;
}

.cds-table-row-detail .cds-table-row-detail-container > * {
    overflow: hidden;
    min-height: 0;
}

/* Table Settings */
.cds-table-settings-container {
    display: flex;
    flex-direction: column;
    z-index: 100;
    background-color: #ffffff;
    border: 1px solid var(--cds-color-grey-light);
    box-shadow: var(--cds-shadow-strong);
    min-width: 360px;
    max-width: 440px;
    border-radius: 6px;
    font-size: 13px;
    overflow: hidden;
}

.cds-table-settings-header-container {
    display: flex;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid var(--cds-color-grey-light);
    padding: 8px 12px;
    cursor: move;
    user-select: none;
    border-radius: 8px;
}

.cds-table-settings-header-container h4 {
    font-weight: 500;
    margin: 0;
    font-size: 13px;
    padding-left: 16px;
}

.cds-table-settings-dialog-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--cds-color-primary-wash);
    border-bottom: 1px solid var(--cds-color-grey-light);
    font-size: 11px;
    color: var(--cds-color-primary-medium);
}

.cds-table-settings-dialog-info .cds-icon {
    width: 14px;
    height: 14px;
    fill: var(--cds-color-primary-medium);
    flex-shrink: 0;
}

.cds-text-align-center {
    text-align: center;
}

.cds-table-settings-col-list-header {
    display: grid;
    grid-template-columns: 28px 1fr 80px 90px;
    align-items: center;
    padding: 8px 16px 6px;
    border-bottom: 1px solid var(--cds-color-disabled);
    background: var(--cds-color-offwhite);
    gap: 0;
}

.cds-table-settings-col-list-header span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cds-color-grey);
}

.cds-table-settings-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.cds-table-setting-col-list-container {
    overflow-y: auto;
    max-height: 326px;
    min-height: 80px;
}

.cds-table-setting-col-list-container::-webkit-scrollbar {
    width: 5px;
}

.cds-table-setting-col-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--cds-color-neutral);
}

.cds-table-setting-col-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.cds-table-setting-col-list-container::-webkit-scrollbar-thumb {
    background: var(--cds-color-disabled);
    border-radius: 10px;
}

.cds-table-setting-col-list-row {
    display: grid;
    grid-template-columns: 28px 1fr 80px 90px;
    align-items: center;
    padding: 4px 16px;
    gap: 0;
    border-bottom: 1px solid var(--cds-color-disabled);
    transition: background 0.12s;
    cursor: default;
    user-select: none;
}

.cds-table-setting-col-list-row:last-child {
    border-bottom: none;
}

.cds-table-setting-col-list-row:hover:not(.col-row--disabled) {
    background: var(--cds-color-primary-wash);
}

.cds-table-setting-col-list-row.dragging {
    opacity: 0.45;
    background: var(--cds-color-primary-weak);
}

.cds-table-setting-col-list-row.drag-over {
    background: var(--cds-color-primary-weak);
    border-top: 2px solid var(--cds-color-primary);
}

.cds-table-setting-col-list-row.drag-over-top {
    border-top: 2px solid var(--cds-color-primary);
    background: var(--cds-color-primary-wash);
}

.cds-table-setting-col-list-row.drag-over-bottom {
    border-bottom: 2px solid var(--cds-color-primary);
    background: var(--cds-color-primary-wash);
}

.cds-table-setting-col-list-row.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cds-table-settings-col-list-row-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--cds-color-disabled);
    transition: color 0.12s;
    height: 32px;
}

.cds-table-settings-col-list-row-drag-handle .cds-icon {
    width: 16px;
    height: 16px;
    fill: var(--cds-color-primary-weak);
    pointer-events: none;
}

.cds-table-setting-col-list-row:hover:not(.col-row--disabled) .cds-table-settings-col-list-row-drag-handle .cds-icon {
    fill: var(--cds-color-primary-medium);
}

.cds-table-settings-col-list-row-drag-handle:hover .cds-icon {
    width: 18px;
    height: 18px;
}

.cds-table-setting-col-list-row.disabled .cds-table-settings-col-list-row-drag-handle {
    cursor: not-allowed;
}

.cds-table-settings-col-name {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px 0 0;
    min-width: 0;
}

.cds-table-settings-col-name span {
    font-size: 13px;
    color: var(--cds-text-black);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cds-table-settings-col-show {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
}

.cds-switch-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
}

.cds-table-settings-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid var(--cds-color-disabled);
    background: var(--cds-color-white);
}

/* Table simple */
table.cds-table-simple {
    width: 100%;
    border-spacing: 0;
}

table.cds-table-simple.critical thead {
    background-color: var(--cds-color-critical-wash);
}

table.cds-table-simple.critical tbody tr:hover {
    background-color: var(--cds-color-critical-wash);
}

table.cds-table-simple thead th {
    padding: 7px 14px;
    text-align: left;
    font-weight: 500;
    color: var(--cds-text-grey);
    font-size: 12px;
    border-bottom: 1px solid var(--cds-color-disabled);
}

table.cds-table-simple.critical thead th {
    border-bottom: 1px solid var(--cds-color-critical-weak);
}

table.cds-table-simple tbody td {
    padding: 7px 14px;
    border-bottom: 1px solid var(--cds-color-disabled);
    color: var(--cds-text-dark);
    font-size: 13px;
}

table.cds-table-simple tbody td.num {
    font-weight: 600;
}

table.cds-table-simple tbody td.error {
    color: var(--cds-color-critical-strong);
}

table.cds-table-simple.critical tbody td {
    border-bottom: 1px solid var(--cds-color-critical-weak);
}

table.cds-table-simple tbody tr:last-child td {
    border: none !important;
}
    
