:host {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: subgrid;
  grid-template-rows: auto 0fr;
  box-shadow: 0px 1px 1px -1px rgb(var(--smoothly-table-border));
}

:host::slotted(.smoothly-table-cell) {
  grid: subgrid;
  cursor: pointer;
  grid-column: span var(--smoothly-table-cell-span, 1);
  display: flex;
  align-items: center;
  padding-inline: var(--smoothly-table-cell-padding-inline, 1.1rem);
  min-height: var(--smoothly-table-cell-min-height, 2.75rem);
  white-space: nowrap;
}

:host:has(> .smoothly-table-cell:hover) {
  background-color: rgb(var(--smoothly-table-hover-background));
  color: rgb(var(--smoothly-table-hover-foreground));
}

:host[open] {
  background-color: rgb(var(--smoothly-table-expanded-background));
  color: rgb(var(--smoothly-table-expanded-foreground));
  grid-template-rows: auto 1fr;
  box-shadow: 0px 1px 1px -1px rgb(var(--smoothly-table-border)), 0px 0px 1px rgb(var(--smoothly-table-border)) inset;
  grid-template-rows: 0fr 1fr;
}

:host(:not([open])) > div.smoothly-table-detail {
  display: none;
}

:host > div.smoothly-table-detail {
  grid-column: 1/-1;
  cursor: default;
  position: relative;
  overflow: hidden;
  background-color: rgb(var(--smoothly-table-expanded-background));
  color: rgb(var(--smoothly-table-expanded-foreground));
}

:host > .smoothly-table-cell:first-of-type {
  position: relative;
  padding-left: 1.1rem;
}
:host > .smoothly-table-cell:first-of-type::before {
  content: "";
  display: flex;
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  height: 0.4rem;
  width: 0.4rem;
  left: 0.3rem;
  border-bottom: 1px solid rgb(var(--smoothly-table-foreground));
  border-right: 1px solid rgb(var(--smoothly-table-foreground));
  transition: rotate 200ms ease-in-out;
  rotate: -45deg;
  opacity: 0.3;
}

:host:has(> .smoothly-table-cell:hover) > .smoothly-table-cell:first-of-type::before {
  border-bottom: 1px solid rgb(var(--smoothly-table-hover-foreground));
  border-right: 1px solid rgb(var(--smoothly-table-hover-foreground));
  opacity: 1;
}

:host[open] > .smoothly-table-cell:first-of-type::before {
  rotate: 45deg;
}

:host[open] > div.smoothly-table-detail {
  overflow: visible;
  padding-block: var(--smoothly-table-detail-padding-block, 0.5rem);
  padding-inline: var(--smoothly-table-detail-padding-inline, 1.1rem);
}

:host > div.smoothly-table-detail::before {
  content: "";
  position: absolute;
  display: flex;
  box-sizing: border-box;
  top: 0;
  bottom: 0;
  left: -1em;
  width: 1em;
  background-color: rgb(var(--smoothly-table-expanded-background));
  border-left: 0.3em solid rgb(var(--smoothly-table-detail-border, var(--smoothly-table-border)));
  box-shadow: 2px 0px 0px 0px rgb(var(--smoothly-table-expanded-background)), 0px 0px 1px 0px rgb(var(--smoothly-table-border));
}

:host > div.smoothly-table-detail::after {
  content: "";
  position: absolute;
  display: flex;
  top: 0;
  bottom: 0;
  right: -1em;
  width: 1em;
  background-color: rgb(var(--smoothly-table-expanded-background));
  box-shadow: -2px 0px 0px 0px rgb(var(--smoothly-table-expanded-background)), 0px 0px 1px 0px rgb(var(--smoothly-table-border));
}