#editor table {
  border-collapse: collapse;
  max-width: 100%;
  margin: .8em 0;
}

#editor :is(td, th) {
  padding: .32em .5em;
  border: 1px solid #b7c3cf;
  vertical-align: top;
  overflow-wrap: anywhere;
}

#editor th {
  text-align: left;
  font-weight: 700;
}

#editor :is(td, th) > :first-child { margin-block-start: 0; }
#editor :is(td, th) > :last-child { margin-block-end: 0; }

:is(#editor, .header-footer-piece[data-brasa-band]) table[data-brasa-native-table] {
  max-width: none;
  margin-block: 0;
}

:is(#editor, .header-footer-piece[data-brasa-band]) table[data-brasa-native-table] > :is(thead, tbody, tfoot) > tr > :is(td, th) {
  box-sizing: border-box;
  padding: 0 5.4pt;
  border: 0;
  text-align: inherit;
  font-weight: inherit;
}

.table-dialog {
  width: min(30rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
}

.table-dialog-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.table-dialog-checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-block: .75rem;
}

.table-dialog-checkbox > input {
  width: auto;
  margin: 0;
}

.table-dialog-status:empty { display: none; }

.table-draw-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1.6rem));
  justify-content: start;
  gap: .25rem;
  margin-block: .5rem 1rem;
}

.table-sketch {
  position: relative;
  height: 9rem;
  border: 1px dashed var(--line, #bbc7dc);
  border-radius: .3rem;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.table-sketch-outline {
  position: absolute;
  border: 2px solid var(--accent, #2457c5);
  background: color-mix(in srgb, var(--accent, #2457c5) 13%, transparent);
  pointer-events: none;
}

.table-draw-grid > button {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid var(--line, #d7dce5);
  border-radius: 3px;
  padding: 0;
  background: transparent;
}

.table-draw-grid > [data-drawing] {
  background: #e4edff;
  border-color: #6086c9;
}

#insertTableGridSize {
  color: inherit;
  font-weight: 650;
  margin: .1rem .15rem .35rem;
}

#insertTableGrid {
  grid-template-columns: repeat(10, minmax(0, 1.25rem));
  gap: .2rem;
  margin-block: .2rem .55rem;
}

#insertTableGrid > [data-drawing] {
  background: var(--accent, #2457c5);
  border-color: var(--accent, #2457c5);
}

#insertTableGrid > button:focus-visible {
  outline-offset: 2px;
}

.table-preset-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
  gap: .5rem;
}

.table-preset-list > button {
  display: grid;
  gap: .2rem;
  text-align: start;
  padding: .75rem;
}

.table-preset-list span { font-size: .8rem; }
