/* Shared dense Excel-style table toolbar, headers and filter menus. */
html body #app-shell .page .excel-source-toolbar-hidden,
html body #app-shell .excel-source-toolbar-hidden,
html body #app-shell .page .excel-page-actions-hidden {
  display: none !important;
}

.excel-table-toolbar {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid #252c38;
  border-radius: 14px;
  background: #141a22;
  color: #f5f7fb;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .14);
}

.excel-table-search {
  display: flex;
  align-items: center;
  width: min(420px, 46vw);
  min-width: 220px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid #303846;
  border-radius: 10px;
  background: #10161e;
}

.excel-table-search:focus-within {
  border-color: #2d8cff;
  box-shadow: 0 0 0 2px rgba(45, 140, 255, .13);
}

.excel-table-search svg,
.excel-value-search svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-right: 8px;
  fill: none;
  stroke: #8e98a8;
  stroke-width: 2;
}

.excel-table-search input,
.excel-value-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: #f6f8fb !important;
  font: inherit;
  box-shadow: none !important;
}

.excel-filter-count,
.excel-row-count {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
  color: #99a5b7;
}

.excel-filter-count {
  padding: 5px 8px;
  border: 1px solid rgba(45, 140, 255, .32);
  border-radius: 999px;
  background: rgba(45, 140, 255, .1);
  color: #74b5ff;
}

.excel-row-count {
  margin-left: auto;
}

.excel-table-actions {
  position: relative;
  flex: none;
}

.excel-table-actions > summary,
.excel-columns-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.excel-table-actions > summary::-webkit-details-marker,
.excel-columns-menu > summary::-webkit-details-marker {
  display: none;
}

.excel-table-actions > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 106px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid #2d8cff;
  border-radius: 10px;
  background: #141a22;
  color: #f7f9fc;
  font-size: 13px;
  font-weight: 700;
}

.excel-table-actions > summary svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform .15s ease;
}

.excel-table-actions[open] > summary svg {
  transform: rotate(180deg);
}

.excel-table-actions-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 45;
  width: 270px;
  max-height: min(620px, calc(100vh - 130px));
  overflow: auto;
  padding: 8px;
  border: 1px solid #303846;
  border-radius: 12px;
  background: #191f29;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .4);
}

.excel-action-group,
.excel-module-actions,
.excel-context-controls {
  display: grid;
  gap: 4px;
}

.excel-module-actions:empty,
.excel-context-controls:empty {
  display: none;
}

.excel-module-actions:not(:empty),
.excel-context-controls:not(:empty) {
  margin-bottom: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid #2a323e;
}

.excel-table-actions-menu button,
.excel-table-actions-menu > .excel-module-actions > *,
.excel-table-actions-menu .action-menu-list > * {
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #e8ecf3;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
}

.excel-table-actions-menu button:hover,
.excel-table-actions-menu > .excel-module-actions > *:hover {
  background: #242c38;
}

.excel-context-controls .filter-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.excel-context-controls .filter-field > label {
  font-size: 10px;
  color: #98a4b5;
}

.excel-context-controls :is(select, input) {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid #343d4c;
  border-radius: 7px;
  background: #111720;
  color: #f5f7fb;
  font-size: 12px;
}

.excel-columns-menu {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #2a323e;
}

.excel-columns-menu > summary {
  padding: 8px 9px;
  border-radius: 7px;
  color: #e8ecf3;
  font-size: 12px;
  font-weight: 700;
}

.excel-columns-menu > summary:hover {
  background: #242c38;
}

.excel-columns-list {
  display: grid;
  max-height: 260px;
  overflow: auto;
  margin: 3px 0;
  padding: 4px;
  border: 1px solid #2b3441;
  border-radius: 8px;
  background: #111720;
}

.excel-column-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 32px;
  padding: 3px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.excel-column-option:last-child {
  border-bottom: 0;
}

.excel-column-option label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 11px;
  color: #dbe1ea;
}

.excel-column-option label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-column-option input {
  accent-color: #2d8cff;
}

.excel-column-move {
  display: inline-flex;
  gap: 2px;
}

.excel-column-move button {
  width: 27px;
  min-height: 26px;
  padding: 0;
  text-align: center;
}

.excel-column-move button:disabled {
  opacity: .28;
}

.excel-table-wrap {
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.excel-data-table {
  border-collapse: separate;
  border-spacing: 0;
}

.excel-data-table thead th {
  position: sticky !important;
  top: 0;
  z-index: 9;
  height: 42px !important;
  min-height: 42px;
  padding: 0 12px !important;
  background: #1c212c !important;
  box-shadow: inset 0 -1px 0 #303745;
  cursor: pointer;
}

.excel-data-table thead th:last-child {
  cursor: default;
}

.excel-data-table .table-head-label {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.excel-data-table .table-head-label > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-data-table .sort-indicator {
  position: relative;
  width: 8px;
  height: 12px;
  flex: none;
  opacity: .35;
}

.excel-data-table .sort-indicator::before,
.excel-data-table .sort-indicator::after {
  position: absolute;
  left: 1px;
  width: 0;
  height: 0;
  border-right: 3px solid transparent;
  border-left: 3px solid transparent;
  content: "";
}

.excel-data-table .sort-indicator::before {
  top: 1px;
  border-bottom: 4px solid currentColor;
}

.excel-data-table .sort-indicator::after {
  bottom: 1px;
  border-top: 4px solid currentColor;
}

.excel-data-table .sort-indicator[data-sort="asc"]::after,
.excel-data-table .sort-indicator[data-sort="desc"]::before {
  opacity: .18;
}

.excel-data-table .sort-indicator.active {
  color: #4aa3ff;
  opacity: 1;
}

.excel-filter-trigger {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  margin: 0 0 0 auto !important;
  padding: 4px !important;
  border: 0 !important;
  border-radius: 5px !important;
  background: transparent !important;
  color: #8f98a8 !important;
  box-shadow: none !important;
}

.excel-filter-trigger svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.excel-filter-trigger:hover,
.excel-filter-trigger.active {
  background: rgba(45, 140, 255, .14) !important;
  color: #4aa3ff !important;
}

.excel-column-popover[hidden] {
  display: none !important;
}

.excel-column-popover {
  position: fixed;
  z-index: 10000;
  max-height: calc(100vh - 24px);
  overflow: auto;
  border: 1px solid #343d4b;
  border-radius: 13px;
  background: #191f29;
  color: #eef2f8;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55);
}

.excel-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border-bottom: 1px solid #2c3440;
}

.excel-popover-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.excel-popover-head span {
  color: #8e99aa;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.excel-popover-head strong {
  overflow: hidden;
  color: #f7f9fc;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-popover-head > button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aeb7c5;
  font-size: 21px;
}

.excel-popover-head > button:hover {
  background: #272f3b;
}

.excel-sort-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 9px 11px;
  border-bottom: 1px solid #2c3440;
}

.excel-sort-actions button,
.excel-value-actions button,
.excel-popover-foot button {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid #343d4c;
  border-radius: 7px;
  background: #111720;
  color: #e9edf4;
  font-size: 11px;
  font-weight: 650;
}

.excel-sort-actions button:hover,
.excel-value-actions button:hover,
.excel-popover-foot button:hover {
  border-color: #4b5869;
  background: #232b36;
}

.excel-popover-body {
  padding: 11px;
}

.excel-value-search {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 9px;
  border: 1px solid #343d4c;
  border-radius: 8px;
  background: #10161e;
}

.excel-value-actions {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}

.excel-value-list {
  display: grid;
  max-height: 260px;
  overflow: auto;
  padding: 4px;
  border: 1px solid #2e3744;
  border-radius: 8px;
  background: #111720;
}

.excel-value-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 7px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.excel-value-list label:hover {
  background: #222a35;
}

.excel-value-list label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-value-list input {
  flex: none;
  accent-color: #2d8cff;
}

.excel-value-list p {
  margin: 10px;
  color: #8f99aa;
  font-size: 12px;
}

.excel-number-filter,
.excel-date-inputs {
  display: grid;
  gap: 9px;
}

.excel-number-filter label,
.excel-date-inputs label {
  display: grid;
  gap: 5px;
  color: #98a4b5;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.excel-number-filter :is(input, select),
.excel-date-inputs input {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid #343d4c;
  border-radius: 8px;
  background: #10161e;
  color: #f4f7fb;
  font-size: 12px;
}

.excel-number-inputs,
.excel-date-inputs {
  grid-template-columns: 1fr 1fr;
}

.excel-calendar-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.excel-calendar {
  min-width: 0;
  padding: 8px;
  border: 1px solid #303946;
  border-radius: 9px;
  background: #111720;
}

.excel-calendar-head {
  display: grid;
  grid-template-columns: 28px 1fr 78px 28px;
  gap: 5px;
  align-items: center;
  margin-bottom: 7px;
}

.excel-calendar-head button,
.excel-calendar-head select {
  min-width: 0;
  height: 29px;
  padding: 0 5px;
  border: 1px solid #343e4c;
  border-radius: 6px;
  background: #1b222d;
  color: #edf1f7;
  font-size: 11px;
}

.excel-calendar-head button {
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

.excel-calendar-weekdays,
.excel-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.excel-calendar-weekdays span {
  padding: 4px 0;
  color: #72aff6;
  text-align: center;
  font-size: 10px;
  font-weight: 750;
}

.excel-calendar-days button {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 25px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #e9edf3;
  font-size: 11px;
}

.excel-calendar-days button:hover {
  background: #283342;
}

.excel-calendar-days button.outside {
  color: #5f6876;
}

.excel-calendar-days button.in-range {
  border-radius: 0;
  background: rgba(45, 140, 255, .13);
  color: #cfe4ff;
}

.excel-calendar-days button.selected {
  border-radius: 5px;
  background: #2d8cff;
  color: #fff;
  font-weight: 750;
}

.excel-popover-foot {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 6px;
  padding: 10px 11px;
  border-top: 1px solid #2c3440;
}

.excel-popover-foot .primary {
  border-color: #2d8cff;
  background: #2d8cff;
  color: #fff;
}

[data-theme="light"] .excel-table-toolbar,
[data-theme="light"] .excel-column-popover,
[data-theme="light"] .excel-table-actions-menu {
  border-color: #d7dee8;
  background: #fff;
  color: #172033;
  box-shadow: 0 14px 36px rgba(28, 39, 57, .14);
}

[data-theme="light"] .excel-table-search,
[data-theme="light"] .excel-value-search,
[data-theme="light"] .excel-calendar,
[data-theme="light"] .excel-value-list,
[data-theme="light"] .excel-columns-list {
  border-color: #d9e0ea;
  background: #f7f9fc;
}

[data-theme="light"] :is(.excel-table-search input, .excel-value-search input, .excel-popover-head strong) {
  color: #172033 !important;
}

[data-theme="light"] .excel-table-actions > summary,
[data-theme="light"] .excel-table-actions-menu button,
[data-theme="light"] .excel-columns-menu > summary,
[data-theme="light"] .excel-column-option label,
[data-theme="light"] .excel-value-list label {
  color: #263247;
}

[data-theme="light"] .excel-data-table thead th {
  background: #edf1f7 !important;
  box-shadow: inset 0 -1px 0 #d6dde8;
}

[data-theme="light"] :is(.excel-number-filter input, .excel-number-filter select, .excel-date-inputs input, .excel-calendar-head button, .excel-calendar-head select, .excel-context-controls input, .excel-context-controls select) {
  border-color: #d5dde8;
  background: #fff;
  color: #1f2a3c;
}

@media (max-width: 900px) {
  .excel-table-toolbar {
    flex-wrap: wrap;
  }

  .excel-table-search {
    width: 100%;
  }

  .excel-row-count {
    margin-left: 0;
  }

  .excel-table-actions {
    margin-left: auto;
  }

  .excel-column-popover.date-filter {
    max-height: calc(100vh - 20px);
  }

  .excel-calendar-pair {
    grid-template-columns: 1fr;
  }
}

@media print {
  .excel-table-toolbar,
  .excel-column-popover {
    display: none !important;
  }
}

/* Keep the global popup independent from module-level input/button sizing. */
html body #excel-column-filter-popover,
html body #excel-column-filter-popover * {
  box-sizing: border-box;
}

html body #excel-column-filter-popover {
  width: min(380px, calc(100vw - 24px)) !important;
  min-width: 0 !important;
  max-width: calc(100vw - 24px) !important;
  max-height: min(680px, calc(100vh - 24px)) !important;
  overflow-x: hidden !important;
}

html body #excel-column-filter-popover.date-filter {
  width: min(720px, calc(100vw - 24px)) !important;
}

html body #excel-column-filter-popover .excel-sort-actions button,
html body #excel-column-filter-popover .excel-value-actions button,
html body #excel-column-filter-popover .excel-popover-foot button {
  width: auto !important;
  min-width: 0 !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 5px 10px !important;
  line-height: 1.15 !important;
}

html body #excel-column-filter-popover .excel-popover-head > button {
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  padding: 0 !important;
}

html body #excel-column-filter-popover .excel-value-search {
  display: grid !important;
  grid-template-columns: 16px minmax(0, 1fr) !important;
  align-items: center !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 10px !important;
  overflow: hidden !important;
}

html body #excel-column-filter-popover .excel-value-search svg {
  width: 16px !important;
  min-width: 16px !important;
  height: 16px !important;
  margin: 0 8px 0 0 !important;
}

html body #excel-column-filter-popover .excel-value-search input[type="search"] {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  padding: 0 0 0 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
}

html body #excel-column-filter-popover .excel-value-list {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  max-height: 260px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

html body #excel-column-filter-popover .excel-value-list label[data-value-row] {
  display: grid !important;
  grid-template-columns: 16px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 9px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: 32px !important;
  height: auto !important;
  margin: 0 !important;
  padding: 5px 7px !important;
  color: #e9edf4 !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

html body #excel-column-filter-popover .excel-value-list input[type="checkbox"] {
  display: block !important;
  appearance: auto !important;
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: initial !important;
  border-radius: 2px !important;
  background: initial !important;
  box-shadow: none !important;
  accent-color: #2d8cff;
}

html body #excel-column-filter-popover .excel-value-list label[data-value-row] > span {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  color: inherit !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body #excel-column-filter-popover :is(.excel-number-filter input, .excel-number-filter select, .excel-date-inputs input) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 0 9px !important;
  font-size: 12px !important;
}

html body #excel-column-filter-popover .excel-calendar-pair {
  width: 100% !important;
  min-width: 0 !important;
}

html body #excel-column-filter-popover .excel-calendar {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

html body #excel-column-filter-popover .excel-calendar-head button,
html body #excel-column-filter-popover .excel-calendar-head select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  margin: 0 !important;
  padding: 0 5px !important;
  font-size: 11px !important;
  line-height: 1 !important;
}

html body #excel-column-filter-popover .excel-calendar-days button {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 11px !important;
  line-height: 1 !important;
  aspect-ratio: auto !important;
}

html[data-theme="light"] body #excel-column-filter-popover .excel-value-list label[data-value-row] {
  color: #263247 !important;
}
