.pg {
  padding-top: 36px;
  padding-bottom: 70px;
}
.pg h1 {
  font-size: clamp(26px, 3vw, 42px);
  max-width: 800px;
  line-height: 1.15;
}
.pg p {
  color: var(--text-2);
  line-height: 1.55;
}
.pg label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.pg button,
.pg input,
.pg select,
.pg-file {
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--paper);
  color: var(--ink);
}
.pg button {
  cursor: pointer;
  min-height: 44px;
}
.pg button:disabled {
  opacity: 0.45;
  cursor: default;
}
.pg button:focus-visible,
.pg input:focus-visible,
.pg textarea:focus-visible,
.pg select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.pg-toolbar,
.pg-settings,
.pg-actions,
.pg-panel-head {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}
.pg-toolbar {
  margin-top: 24px;
}
.pg-file input {
  max-width: 220px;
  padding: 0;
  border: 0;
}
.pg-settings {
  margin: 24px 0;
  padding: 18px 0;
  border-block: 1px solid var(--line);
}
.pg-settings input {
  width: 110px;
}
.pg-settings p {
  flex-basis: 100%;
  margin: 0;
}
.pg-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 22px;
}
.pg-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  padding: 22px;
  min-width: 0;
}
.pg-panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}
.pg textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 16px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  font:
    14px/1.6 ui-monospace,
    Menlo,
    Consolas,
    monospace;
  tab-size: 4;
  background: var(--paper-3);
  white-space: pre;
  overflow: auto;
}
.pg .pg-primary {
  background: var(--ink);
  color: var(--paper);
}
.pg-actions {
  align-items: center;
}
.pg-actions span {
  font-size: 13px;
  color: var(--text-2);
}
.pg-table {
  overflow: auto;
  max-height: 420px;
}
.pg table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.pg td,
.pg th {
  padding: 9px;
  border: 1px solid var(--line);
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 250px;
}
.pg th {
  background: var(--paper-3);
  position: sticky;
  top: 0;
}
.pg pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 300px;
  overflow: auto;
  font:
    13px/1.6 ui-monospace,
    monospace;
}
.pg-insert {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}
.pg-insert h2,
.pg-insert p {
  flex-basis: 100%;
  margin: 0;
}
.pg-insert label {
  flex: 1;
  min-width: 180px;
}
.pg-insert select,
.pg-insert input {
  width: 100%;
  box-sizing: border-box;
}
.pg summary {
  cursor: pointer;
  padding: 8px 0;
}
.pg h2 {
  font-size: 22px;
  margin-top: 0;
}
@media (max-width: 760px) {
  .pg-columns {
    grid-template-columns: 1fr;
  }
  .pg-panel {
    padding: 16px;
  }
  .pg-toolbar > * {
    max-width: 100%;
  }
  .pg {
    padding-top: 20px;
  }
  .pg textarea {
    font-size: 16px;
  }
  .pg-insert label {
    min-width: 100%;
  }
}

.pg-toolbar label {
  min-width: 0;
  max-width: 100%;
}
.pg-toolbar select {
  max-width: 100%;
  width: 320px;
}
.pg-csv summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
}

.pg-chart {
  margin-top: 24px;
}
.pg-chart canvas {
  width: 100%;
  height: auto;
  max-width: 1000px;
}
.pg-chart [hidden],
.pg [hidden] {
  display: none !important;
}
.pg .pg-chart-check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pg-chart-check input {
  width: 20px;
  height: 20px;
}

.pg-chart-viewport {
  overflow-x: auto;
  max-width: 100%;
}
.pg-chart-viewport canvas {
  min-width: 600px;
}
.pg-chart input[type="text"],
.pg-chart #chartTitle {
  width: min(400px, 100%);
  box-sizing: border-box;
}

.pg :is(button, input:not([type=checkbox]), select), .pg-disclosure > summary { min-height: 44px; }
.pg button, .pg input, .pg select, .pg textarea { border-radius: 6px; }
