.eco-data-table {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 10px;
  margin-bottom: 16px;
}

.eco-data-toolbar,
.eco-data-footer,
.eco-data-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.eco-data-toolbar {
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.eco-data-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.eco-data-search {
  min-width: min(320px, 100%);
}

.eco-data-count,
.eco-data-updated,
.eco-data-range {
  color: var(--muted);
  font-size: 13px;
}

.eco-data-frame {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.eco-data-frame table {
  margin: 0;
}

.eco-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

.eco-sort-button::after {
  content: "↕";
  color: var(--muted);
  font-size: 11px;
}

.eco-sort-button[data-direction="asc"]::after {
  content: "↑";
  color: var(--green);
}

.eco-sort-button[data-direction="desc"]::after {
  content: "↓";
  color: var(--green);
}

.eco-sort-priority {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: #e8f3f0;
  color: var(--green);
  font-size: 11px;
}

.eco-column-filter-row input,
.eco-column-filter-row select {
  min-height: 30px;
  width: 100%;
  padding: 5px 7px;
  font-size: 12px;
}

.eco-sticky-header thead th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: #fff;
}

.eco-sticky-first th:first-child,
.eco-sticky-first td:first-child {
  position: sticky;
  left: 0;
  z-index: 7;
  background: #fff;
  white-space: normal;
  min-width: 220px;
}

.eco-sticky-first thead th:first-child {
  z-index: 10;
}

.eco-data-drawer {
  display: none;
  position: fixed;
  inset: auto 18px 18px auto;
  z-index: 60;
  width: min(440px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 36px));
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .18);
}

.eco-data-drawer.open {
  display: block;
}

.eco-column-list,
.eco-filter-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.eco-column-option,
.eco-filter-option {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.eco-column-option {
  grid-template-columns: auto minmax(100px, 1fr) auto auto minmax(120px, auto);
  align-items: center;
}

[data-column-key].is-hidden-column {
  display: none;
}

[data-column-key].is-pinned-left,
[data-column-key].is-pinned-right {
  position: sticky;
  z-index: 7;
  background: #fff;
}

[data-column-key].is-pinned-left {
  left: var(--eco-sticky-offset, 0);
}

[data-column-key].is-pinned-right {
  right: var(--eco-sticky-offset, 0);
}

thead [data-column-key].is-pinned-left,
thead [data-column-key].is-pinned-right {
  z-index: 10;
}

.eco-data-empty,
.eco-data-error,
.eco-data-loading {
  display: none;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.eco-data-table.is-empty .eco-data-empty,
.eco-data-table.is-error .eco-data-error,
.eco-data-table.is-loading .eco-data-loading {
  display: block;
}

.eco-data-table.is-error .eco-data-frame {
  display: none;
}

.eco-mobile-cards {
  display: none;
}

.eco-mobile-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.eco-mobile-card strong {
  font-size: 16px;
}

.eco-mobile-field {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.eco-mobile-value {
  color: var(--ink);
  text-align: right;
}

.eco-mobile-value form,
.eco-mobile-value .toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
}

.eco-mobile-value input:not([type="hidden"]),
.eco-mobile-value select,
.eco-mobile-value textarea,
.eco-mobile-value button,
.eco-mobile-value a {
  max-width: 100%;
}

mark.eco-search-hit {
  padding: 0 .15em;
  border-radius: 3px;
  background: #fff1a6;
}

@media (max-width: 768px) {
  .eco-column-option {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .eco-column-option select {
    grid-column: 1 / -1;
  }
  .eco-data-toolbar {
    align-items: stretch;
  }

  .eco-data-tools,
  .eco-data-search,
  .eco-data-toolbar select,
  .eco-data-toolbar button {
    width: 100%;
  }

  .eco-data-frame {
    display: none;
  }

  .eco-mobile-cards {
    display: grid;
    gap: 10px;
  }

  .eco-data-footer {
    display: grid;
  }
}
