.baserow-grid .baserow-subtable-heading-row td {
  background: transparent;
  border-bottom: 0;
  padding: 12px 12px 6px;
}

.baserow-subtable-heading {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #d9e6f5;
  border-left: 4px solid #73a8ff;
  border-radius: 12px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 40px;
  padding: 6px 10px 6px 14px;
}

.baserow-subtable-heading:hover {
  border-color: #8bb7f6;
  box-shadow: none;
}

.baserow-subtable-heading.is-ungrouped {
  background: #fbfdff;
  border-left-color: #b8cbe2;
}

.baserow-subtable-title-wrap {
  align-items: baseline;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.baserow-subtable-title-wrap strong {
  color: #172338;
  font-size: 0.94rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.baserow-subtable-title-wrap span {
  color: #7a8ba3;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.baserow-subtable-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.baserow-subtable-actions button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #c9daf0;
  border-radius: 12px;
  color: #3478f6;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.84rem;
  font-weight: 850;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
}

.baserow-subtable-actions button:hover {
  background: #edf4ff;
  border-color: #9fc0f7;
}

.baserow-subtable-actions .baserow-subtable-icon-button {
  border-radius: 10px;
  height: 32px;
  justify-content: center;
  min-height: 32px;
  min-width: 32px;
  padding: 0;
  width: 32px;
}

.baserow-subtable-actions button.is-danger {
  border-color: #f3b3b3;
  color: #b42318;
}

.baserow-subtable-actions button.is-danger:hover {
  background: #fff1f1;
  border-color: #e27b7b;
}

.baserow-due-filter {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d5e1f0;
  border-radius: 12px;
  color: #64748b;
  display: inline-flex;
  font-weight: 850;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
}

.baserow-due-filter span {
  color: #50617a;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.baserow-due-filter select {
  appearance: auto;
  background: transparent;
  border: 0;
  color: #172033;
  cursor: pointer;
  font: inherit;
  min-width: 128px;
  outline: 0;
}

.baserow-th-with-filter {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.baserow-date-filter-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #c9daf0;
  border-radius: 10px;
  color: #6b7d95;
  cursor: pointer;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  margin-left: 2px;
  position: relative;
  width: 30px;
}

.baserow-date-filter-button svg {
  display: block;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.baserow-date-filter-button:hover,
.baserow-date-filter-button.is-active {
  background: #edf4ff;
  border-color: #8fb8ff;
  color: #3478f6;
}

.baserow-date-filter-button select {
  cursor: pointer;
  height: 100%;
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
}

.baserow-fit-columns-button {
  font-size: 0;
  gap: 8px;
  min-height: 38px;
  white-space: nowrap;
}

.baserow-fit-columns-button svg {
  flex: 0 0 auto;
}

.baserow-fit-columns-button::after {
  content: "Spalten";
  font-size: 0.94rem;
  font-weight: 850;
}

@media (min-width: 1180px) {
  .baserow-toolbar-left {
    align-items: center;
    flex-wrap: nowrap !important;
    min-width: 0;
  }

  .baserow-toolbar-left .baserow-search {
    flex: 0 1 clamp(360px, 34vw, 620px) !important;
    max-width: clamp(360px, 34vw, 620px);
    min-width: 300px;
  }

  .baserow-toolbar-left .baserow-search input {
    min-width: 0;
  }

  .baserow-status-filter,
  .baserow-fit-columns-button {
    flex: 0 0 auto;
  }
}

.baserow-grid .baserow-subtable-empty-row td {
  background: #fbfdff;
  border-bottom: 1px dashed #c7d8ee;
  color: #7b8ca4;
  font-weight: 800;
  padding: 18px 24px;
  text-align: center;
}

.theme-dark .baserow-subtable-heading,
body[data-theme="dark"] .baserow-subtable-heading {
  background: rgba(11, 32, 52, 0.92);
  border-color: rgba(67, 105, 147, 0.7);
  border-left-color: #5a9cff;
}

.theme-dark .baserow-subtable-heading.is-ungrouped,
body[data-theme="dark"] .baserow-subtable-heading.is-ungrouped {
  background: rgba(8, 27, 44, 0.9);
  border-left-color: #66839f;
}

.theme-dark .baserow-subtable-title-wrap strong,
body[data-theme="dark"] .baserow-subtable-title-wrap strong {
  color: #edf6ff;
}

.theme-dark .baserow-subtable-title-wrap span,
body[data-theme="dark"] .baserow-subtable-title-wrap span {
  color: #9fb4cc;
}

.theme-dark .baserow-subtable-actions button,
body[data-theme="dark"] .baserow-subtable-actions button {
  background: rgba(9, 30, 49, 0.92);
  border-color: rgba(84, 137, 195, 0.72);
  color: #8fbeff;
}

.theme-dark .baserow-subtable-actions button:hover,
body[data-theme="dark"] .baserow-subtable-actions button:hover {
  background: rgba(23, 63, 100, 0.94);
}

.theme-dark .baserow-subtable-actions button.is-danger,
body[data-theme="dark"] .baserow-subtable-actions button.is-danger {
  border-color: rgba(255, 129, 129, 0.46);
  color: #ff9b9b;
}

.theme-dark .baserow-subtable-actions button.is-danger:hover,
body[data-theme="dark"] .baserow-subtable-actions button.is-danger:hover {
  background: rgba(90, 26, 33, 0.46);
  border-color: rgba(255, 157, 157, 0.72);
}

.theme-dark .baserow-due-filter,
body[data-theme="dark"] .baserow-due-filter {
  background: rgba(9, 30, 49, 0.92);
  border-color: rgba(84, 137, 195, 0.72);
  color: #9fb4cc;
}

.theme-dark .baserow-due-filter span,
body[data-theme="dark"] .baserow-due-filter span {
  color: #9fb4cc;
}

.theme-dark .baserow-due-filter select,
body[data-theme="dark"] .baserow-due-filter select {
  color: #edf6ff;
}

.theme-dark .baserow-date-filter-button,
body[data-theme="dark"] .baserow-date-filter-button {
  background: rgba(9, 30, 49, 0.92);
  border-color: rgba(84, 137, 195, 0.72);
  color: #9fb4cc;
}

.theme-dark .baserow-date-filter-button:hover,
.theme-dark .baserow-date-filter-button.is-active,
body[data-theme="dark"] .baserow-date-filter-button:hover,
body[data-theme="dark"] .baserow-date-filter-button.is-active {
  background: rgba(23, 63, 100, 0.94);
  border-color: rgba(121, 176, 237, 0.9);
  color: #8fbeff;
}

.theme-dark .baserow-subtable-heading:hover,
body[data-theme="dark"] .baserow-subtable-heading:hover {
  border-color: rgba(121, 176, 237, 0.9);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.theme-dark .baserow-grid .baserow-subtable-empty-row td,
body[data-theme="dark"] .baserow-grid .baserow-subtable-empty-row td {
  background: rgba(8, 26, 42, 0.86);
  border-color: rgba(77, 121, 169, 0.64);
  color: #9fb4cc;
}

.baserow-toolbar {
  align-items: center !important;
  gap: 10px !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
}

.baserow-toolbar-left,
.baserow-toolbar-right {
  align-items: center !important;
  gap: 10px !important;
  flex: 0 0 auto !important;
}

.baserow-toolbar-right {
  column-gap: 10px !important;
  margin-left: 0 !important;
  justify-content: flex-start !important;
}

.baserow-toolbar .baserow-fit-columns-button,
.baserow-toolbar-right > button,
.baserow-toolbar-left > button,
.baserow-toolbar .baserow-status-filter {
  height: 42px !important;
  min-height: 42px !important;
  box-sizing: border-box !important;
  align-self: center !important;
}

.baserow-toolbar .baserow-fit-columns-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1 !important;
}

.baserow-toolbar .baserow-search {
  flex: 0 1 clamp(260px, 28vw, 520px) !important;
  max-width: 520px !important;
}

.baserow-archive-dialog {
  max-width: min(920px, calc(100vw - 48px)) !important;
}

.baserow-archive-search {
  margin: 18px 0 14px !important;
}

.baserow-archive-list {
  display: grid;
  gap: 12px;
  max-height: min(58vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.baserow-archive-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(127, 169, 217, 0.35);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(247, 250, 255, 0.9);
}

.baserow-archive-item strong,
.baserow-archive-item span,
.baserow-archive-item small {
  display: block;
}

.baserow-archive-item strong {
  color: #17233a;
  font-weight: 850;
}

.baserow-archive-item span,
.baserow-archive-item small {
  color: #64748b;
  margin-top: 4px;
}

.baserow-archive-item-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.baserow-archive-item-actions .secondary-button,
.baserow-archive-item-actions .primary-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.theme-dark .baserow-archive-item,
body[data-theme="dark"] .baserow-archive-item {
  background: rgba(9, 30, 49, 0.92);
  border-color: rgba(84, 137, 195, 0.55);
}

.theme-dark .baserow-archive-item strong,
body[data-theme="dark"] .baserow-archive-item strong {
  color: #edf6ff;
}

.theme-dark .baserow-archive-item span,
.theme-dark .baserow-archive-item small,
body[data-theme="dark"] .baserow-archive-item span,
body[data-theme="dark"] .baserow-archive-item small {
  color: #9fb4cc;
}

@media (max-width: 1100px) {
  .baserow-archive-item {
    grid-template-columns: 1fr;
  }

  .baserow-archive-item-actions {
    justify-content: flex-start;
  }
}

/* Admin-Untertabellen: Aktionen sichtbar direkt am Titel halten.
   Die Tabelle ist breiter als der Bildschirm; mit space-between lagen
   Umbenennen/Löschen/Hinzufügen weit rechts im horizontalen Scrollbereich. */
.baserow-grid .baserow-subtable-heading {
  box-sizing: border-box !important;
  display: flex !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  width: 100% !important;
  max-width: none !important;
}

.baserow-grid .baserow-subtable-title-wrap {
  flex: 0 1 auto !important;
  min-width: 0 !important;
}

.baserow-grid .baserow-subtable-actions {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  margin-left: 2px !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.baserow-grid .baserow-subtable-actions .baserow-subtable-icon-button {
  height: 34px !important;
  min-height: 34px !important;
  min-width: 34px !important;
  width: 34px !important;
}

@media (max-width: 900px) {
  .baserow-grid .baserow-subtable-heading {
    width: 100% !important;
  }
}
