.tables-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-block: 16px;
}
.tables-workspace[hidden],
#tables-result[hidden] {
  display: none;
}
.tables-workspace > section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  padding: 14px;
}
.tables-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.tables-bar h2 {
  font-size: 1rem;
}
#tables-view {
  position: relative;
  margin: 10px 0;
  background: var(--paper);
}
#tables-view[data-selecting] {
  touch-action: none;
  cursor: crosshair;
}
#tables-canvas {
  display: block;
  width: 100%;
  height: auto;
}
#tables-marker {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--primary);
  background: #2563eb23;
}
.tables-scroll {
  overflow: auto;
  max-height: 55vh;
  margin-block: 12px;
}
.tables-scroll table {
  border-collapse: collapse;
  width: 100%;
}
.tables-scroll td {
  border: 1px solid var(--line);
  padding: 0;
}
.tables-scroll button {
  display: block;
  text-align: left;
  background: transparent;
  color: var(--ink);
  white-space: pre-wrap;
  width: 100%;
  padding: 7px 10px;
}
.tables-scroll button[aria-pressed='true'] {
  background: #eff6ff;
  outline: 1px solid var(--primary);
}
#tables-adjust {
  margin-block: 10px;
}
.tables-numbers-group {
  border: 0;
  padding: 0;
  margin: 10px 0 0;
}
.tables-numbers-group legend {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0;
  margin-bottom: 6px;
}
.tables-number-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tables-number-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0;
}
.tables-number-pill input[type='checkbox'] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}
.tables-number-pill:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}
.tables-number-pill:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
#tables-export-note {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}
@media (max-width: 760px) {
  .tables-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .tables-number-pill {
    min-height: 44px;
    padding-inline: 12px;
  }
}

#tables-input.is-compact {
  min-height: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
#tables-input.is-compact p {
  margin: 0;
}
#tables-selection {
  width: auto;
  max-width: 100%;
}
#tables-rows button {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#tables-rows button[aria-pressed='true'] {
  box-shadow: inset 0 0 0 1px var(--primary);
}
#tables-rows button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
@media (min-width: 761px) {
  #tables-view {
    max-height: 66vh;
    overflow: auto;
  }
}

.tables-sheet {
  position: relative;
}

.tables-mobile {
  display: none;
}
@media (max-width: 760px) {
  .tables-mobile {
    display: flex;
    gap: 8px;
  }
  .tables-mobile button {
    flex: 1;
  }
  .tables-workspace[data-pane='source'] .tables-result,
  .tables-workspace[data-pane='result'] .tables-source {
    display: none;
  }
}
