/* HARPS finance data tables — layout metrics shared by AP, GL Export, and
   Finance Settings. Scoped to `.v2-data-table` / `.v2-data-table-card` so AR's
   Order table (the reference) is untouched. Visual tokens only; not ADS chrome.

   ads-theme.css paints `html[data-theme="ads"] table thead th` at 13/18 #51585b
   with !important. These rules are more specific so HARPS can match AR's
   12/18 #666d70 header without editing the design system. */

.ap-card.orders-card,
.gl-card.orders-card,
.fs-card.orders-card,
html[data-theme="ads"] .gl-card.orders-card,
html[data-theme="ads"] .ap-card.orders-card,
html[data-theme="ads"] .fs-card.orders-card {
  border-radius: 8px !important;
}

.orders-card .v2-data-table-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.v2-data-table-card {
  background: #ffffff;
  overflow: hidden;
}

.fs-card > .fs-panel {
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

.v2-data-table-card > .tab-bar-row-toolbar {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 60px;
  min-height: 60px;
  padding: 16px 16px 8px 24px;
}

.v2-data-table-card[data-v2-toolbar="search-only"] > .tab-bar-row-toolbar {
  padding-left: 23px;
  justify-content: flex-start;
}

.v2-data-table-card[data-v2-toolbar="search-only"] .tab-actions {
  justify-content: flex-start;
}

.v2-data-table-card .tab-toolbar-search-submit .tab-toolbar-search-icon-clear {
  display: none;
}

.v2-data-table-card .tab-toolbar-search-submit.is-clear-visible .tab-toolbar-search-icon-search {
  display: none;
}

.v2-data-table-card .tab-toolbar-search-submit.is-clear-visible .tab-toolbar-search-icon-clear {
  display: block;
}

.v2-data-table-card .tab-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 auto;
  position: relative;
}

.v2-data-table-card .tab-actions .action-icon-btn.tab-action-pill {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  margin: 0;
  border: 1px solid #4045c2;
  border-radius: 8px !important;
  background: #ffffff;
  color: #4045c2;
}

html[data-theme="ads"] .v2-data-table-card .tab-actions .action-icon-btn.tab-action-pill {
  border-radius: 8px !important;
}

.v2-data-table-card .tab-actions .action-icon-btn.tab-action-pill svg {
  width: 16px;
  height: 16px;
}

.v2-data-table-card .tab-toolbar-search-wrap {
  flex: 0 1 400px;
  width: 400px;
  max-width: 100%;
}

.v2-data-table-card .tab-toolbar-search-field {
  display: flex;
  align-items: center;
  width: 100%;
  height: 36px;
  padding: 8px 12px;
  gap: 8px;
  border: 1px solid #0f121433;
  border-radius: 100px;
  background: #ffffff;
  box-sizing: border-box;
}

.v2-data-table-card .tab-toolbar-search-field .tab-toolbar-search-submit {
  position: static;
  order: -1;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--ar-text-rest, #51585b);
}

.v2-data-table-card .tab-toolbar-search-field .tab-toolbar-search-submit:hover {
  background: none;
}

.v2-data-table-card .tab-toolbar-search-field .tab-toolbar-search-submit svg {
  width: 20px;
  height: 20px;
}

.v2-data-table-card .tab-toolbar-search-field .tab-toolbar-search-submit svg path {
  fill-rule: evenodd;
  clip-rule: evenodd;
}

.v2-data-table-card .tab-toolbar-search-input,
html[data-theme="ads"] .v2-data-table-card .tab-toolbar-search-input {
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font: 400 14px/20px "Open Sans", var(--font-family), sans-serif;
}

.v2-data-table-card .tab-toolbar-search-input::placeholder {
  font: 400 14px/20px "Open Sans", var(--font-family), sans-serif;
}

.v2-data-table-card .v2-table-scroll,
.v2-data-table-card .ap-table-scroll,
.v2-data-table-card .fs-table-scroll,
.v2-data-table-card .gl-table-scroll {
  overflow: auto;
  max-width: 100%;
  padding: 0;
}

table.v2-data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

html:not([data-theme="wireframe"]) table.v2-data-table thead th,
html[data-theme="ads"] table.v2-data-table thead th,
html[data-theme="ads"] table.v2-data-table.gl-table thead th,
html[data-theme="ads"] table.v2-data-table.ap-table thead th,
html[data-theme="ads"] table.v2-data-table.fs-table thead th,
html:not([data-theme="wireframe"]) table.v2-data-table thead th .sort-label,
html:not([data-theme="wireframe"]) table.v2-data-table thead th .sort-trigger,
html:not([data-theme="wireframe"]) table.v2-data-table thead th .th-label {
  box-sizing: border-box;
  height: 32px;
  max-height: 32px;
  padding: 0 8px;
  background: #ffffff;
  border-bottom: 1px solid #d4dee3 !important;
  color: #666d70 !important;
  font-family: "Open Sans", var(--font-family), sans-serif !important;
  font-size: 12px !important;
  font-style: normal !important;
  font-weight: 600 !important;
  line-height: 18px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  text-align: left;
}

html:not([data-theme="wireframe"]) table.v2-data-table thead th .sort-label,
html:not([data-theme="wireframe"]) table.v2-data-table thead th .sort-trigger,
html:not([data-theme="wireframe"]) table.v2-data-table thead th .th-label {
  height: auto;
  max-height: none;
  padding: 0;
  border-bottom: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

html[data-theme="ads"] table.v2-data-table tbody td,
html[data-theme="ads"] table.v2-data-table.gl-table tbody td,
html[data-theme="ads"] table.v2-data-table.ap-table tbody td,
html[data-theme="ads"] table.v2-data-table.fs-table tbody td,
table.v2-data-table tbody td {
  box-sizing: border-box;
  height: 56px;
  max-height: 56px;
  padding: 8px 8px;
  background: #ffffff;
  border-bottom: 1px solid #d4dee3 !important;
  color: #1e2528 !important;
  font: 400 14px/20px "Open Sans", var(--font-family), sans-serif;
  vertical-align: middle !important;
  white-space: nowrap;
}

table.v2-data-table.gl-table {
  table-layout: auto;
  min-width: 1080px;
}

html[data-theme="ads"] table.v2-data-table thead th:first-child,
html[data-theme="ads"] table.v2-data-table tbody td:first-child,
html[data-theme="ads"] table.v2-data-table tfoot td:first-child,
table.v2-data-table thead th:first-child,
table.v2-data-table tbody td:first-child,
table.v2-data-table tfoot td:first-child {
  padding-left: 23px !important;
}

html[data-theme="ads"] table.v2-data-table thead th:last-child,
html[data-theme="ads"] table.v2-data-table tbody td:last-child,
table.v2-data-table thead th:last-child,
table.v2-data-table tbody td:last-child {
  padding-right: 8px !important;
}

html[data-theme="ads"] table.v2-data-table tbody tr:hover,
html[data-theme="ads"] table.v2-data-table.gl-table tbody tr:hover,
html[data-theme="ads"] table.v2-data-table.ap-table tbody tr:hover,
html[data-theme="ads"] table.v2-data-table.fs-table tbody tr:hover {
  background: #0f12140d;
}

html[data-theme="ads"] table.v2-data-table tbody tr:hover td,
table.v2-data-table tbody tr:hover td,
table.v2-data-table.ap-table--rich tbody tr:hover td,
table.v2-data-table.fs-table tbody tr:hover td,
table.v2-data-table.gl-table tbody tr:hover td {
  background: #0f12140d;
}

table.v2-data-table .v2-num,
table.v2-data-table th.ap-th-num,
table.v2-data-table td.ap-cell-num,
table.v2-data-table th.gl-num,
table.v2-data-table td.gl-num,
#glRevenueTable.v2-data-table th:nth-child(2),
#glRevenueTable.v2-data-table td:nth-child(2),
#glRevenueTable.v2-data-table th:nth-child(3),
#glRevenueTable.v2-data-table td:nth-child(3),
#glAdjustmentsTable.v2-data-table th:nth-child(2),
#glAdjustmentsTable.v2-data-table td:nth-child(2),
#glAdjustmentsTable.v2-data-table th:nth-child(3),
#glAdjustmentsTable.v2-data-table td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.v2-data-table th.ap-th-num .sort-label,
table.v2-data-table th.v2-num .sort-label,
table.v2-data-table th.gl-num .sort-trigger,
#glRevenueTable.v2-data-table th:nth-child(2) .sort-trigger,
#glRevenueTable.v2-data-table th:nth-child(3) .sort-trigger,
#glAdjustmentsTable.v2-data-table th:nth-child(2) .sort-trigger,
#glAdjustmentsTable.v2-data-table th:nth-child(3) .sort-trigger {
  justify-content: flex-end;
  width: 100%;
}

table.v2-data-table thead th:first-child,
table.v2-data-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #ffffff;
  box-shadow: none;
  overflow: visible;
  border-right: 0;
}

table.v2-data-table.ap-table--rich th:first-child,
table.v2-data-table.ap-table--rich td:first-child {
  box-shadow: none;
}

table.v2-data-table thead th:first-child {
  z-index: 3;
}

table.v2-data-table tbody tr:hover td:first-child,
table.v2-data-table.ap-table--rich tbody tr:hover td:first-child {
  background: #f4f5f6;
}

.v2-table-scroll[data-frozen="true"] table.v2-data-table td:first-child::after,
.v2-table-scroll[data-frozen="true"] table.v2-data-table th:first-child::after,
.ap-table-scroll[data-frozen="true"] table.v2-data-table td:first-child::after,
.ap-table-scroll[data-frozen="true"] table.v2-data-table th:first-child::after,
.fs-table-scroll[data-frozen="true"] table.v2-data-table td:first-child::after,
.fs-table-scroll[data-frozen="true"] table.v2-data-table th:first-child::after {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  bottom: 0;
  width: 8px;
  background: linear-gradient(90deg, rgba(15, 18, 20, 0.12), rgba(15, 18, 20, 0));
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 150ms ease;
}

.v2-table-scroll[data-frozen="true"][data-frozen-shadow="true"] table.v2-data-table td:first-child::after,
.v2-table-scroll[data-frozen="true"][data-frozen-shadow="true"] table.v2-data-table th:first-child::after,
.ap-table-scroll[data-frozen="true"][data-frozen-shadow="true"] table.v2-data-table td:first-child::after,
.ap-table-scroll[data-frozen="true"][data-frozen-shadow="true"] table.v2-data-table th:first-child::after,
.fs-table-scroll[data-frozen="true"][data-frozen-shadow="true"] table.v2-data-table td:first-child::after,
.fs-table-scroll[data-frozen="true"][data-frozen-shadow="true"] table.v2-data-table th:first-child::after {
  opacity: 1;
}

.v2-data-table-card > .card-footer {
  height: 52px;
  min-height: 52px;
  padding: 0 15px;
  margin: 0;
  border-top: 1px solid #d4dee3;
  background: #ffffff;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 5;
  flex-shrink: 0;
}

.v2-data-table-card .pagination-bar {
  width: 100%;
  height: 52px;
  min-height: 52px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  box-sizing: border-box;
}

.v2-data-table-card .pagination-bar > .pg-section:first-child { justify-self: start; }
.v2-data-table-card .pagination-bar > .pg-center { justify-self: center; }
.v2-data-table-card .pagination-bar > .pg-section:last-child { justify-self: end; }

.v2-data-table-card .pagination-bar .pg-section,
.v2-data-table-card .pagination-bar .pg-center,
.v2-data-table-card .pagination-bar .pg-numbers {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.v2-data-table-card .pagination-bar .pg-section { gap: 4px; }
.v2-data-table-card .pagination-bar .pg-center { gap: 12px; }
.v2-data-table-card .pagination-bar .pg-numbers { gap: 4px; }

.v2-data-table-card .pg-nav-btn,
.v2-data-table-card .pg-num,
html[data-theme="ads"] .v2-data-table-card .pagination-bar .pg-nav-btn,
html[data-theme="ads"] .v2-data-table-card .pagination-bar .pg-num {
  min-width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 8px !important;
  box-sizing: border-box;
}

.v2-data-table-card .pagination-bar .pg-num {
  width: auto;
}

html[data-theme="ads"] table.v2-data-table thead th.ap-th-num,
html[data-theme="ads"] table.v2-data-table thead th.gl-num,
html[data-theme="ads"] table.v2-data-table thead th.ap-th-num .sort-label,
html[data-theme="ads"] table.v2-data-table thead th.gl-num .sort-label {
  text-align: right !important;
  justify-content: flex-end;
}

.v2-col-menu {
  position: absolute;
  z-index: 40;
  min-width: 220px;
  margin-top: 4px;
  padding: 8px 0;
  background: #ffffff;
  border: 1px solid #0f121433;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(15, 18, 20, 0.3);
}

.v2-col-menu[hidden] { display: none; }

.v2-col-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font: 400 14px/20px "Open Sans", var(--font-family), sans-serif;
  color: #1e2528;
  cursor: pointer;
}

.v2-col-menu label:hover {
  background: #0f12140d;
}

table.v2-data-table.gl-table tbody tr:last-child td {
  border-bottom: 1px solid #d4dee3 !important;
}

table.v2-data-table .sort-trigger,
#apCpSettingsTable.v2-data-table th .sort-label,
#apStatusTable.v2-data-table th .sort-label {
  white-space: nowrap !important;
  max-width: none;
}
