/* Catalog color tools: a drawer over the page, never a second PDF render. */
.reader-colors {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(340px, 92%);
  z-index: 9;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 15px;
  background: var(--paper);
  color: var(--ink);
  border-left: 1px solid var(--line);
  box-shadow: -7px 0 24px #0003;
  font-size: 12px;
}
.reader-colors[hidden],
.color-draft[hidden],
.color-pick-banner[hidden] {
  display: none !important;
}
.reader-colors-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.reader-colors-heading h3 {
  font: 400 27px/1.2 var(--font-editorial, Georgia, serif);
  margin: 0;
}
.reader-colors-heading > button {
  font-size: 25px;
  min-height: 36px;
  min-width: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
}
.reader-colors p {
  font-size: 11px;
  line-height: 1.6;
  margin: 10px 0;
}
.reader-colors .color-catalog-title {
  font-size: 11px;
  color: var(--muted);
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}
.reader-colors button,
.reader-colors select,
.reader-colors input,
.reader-colors textarea {
  font: inherit;
  max-width: 100%;
  color: var(--ink);
}
.reader-colors button {
  cursor: pointer;
  min-height: 32px;
  background: var(--white);
  border: 1px solid var(--line);
  padding: 5px 9px;
  border-radius: 3px;
}
.reader-colors .primary {
  background: var(--green);
  color: var(--paper);
  border-color: var(--green);
}
.reader-colors label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.reader-colors input,
.reader-colors textarea,
.reader-colors select {
  display: block;
  width: 100%;
  margin-top: 5px;
  min-height: 36px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px;
  box-sizing: border-box;
}
.reader-colors button:focus-visible,
.reader-colors input:focus-visible,
.reader-colors select:focus-visible,
.reader-colors textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.color-pick-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.color-pick-actions > button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 39px;
  white-space: nowrap;
}
.color-pick-actions svg {
  width: 18px;
  height: 18px;
}
.color-pick-actions label {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.color-source-note,
.color-storage-note {
  color: var(--muted);
}
.color-storage-note {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.color-draft {
  padding: 12px 0 15px;
  margin: 15px 0;
  border-block: 1px solid var(--line);
}
.color-preview {
  display: flex;
  gap: 10px;
  align-items: center;
}
.color-preview-chip {
  width: 58px;
  height: 64px;
  flex-shrink: 0;
  border: 1px solid #8888;
  border-radius: 3px;
}
.color-preview > div {
  min-width: 0;
  flex: 1;
}
.color-preview strong {
  font: 600 14px/1.7 var(--font, sans-serif);
  display: block;
}
.color-preview small {
  display: block;
  font-size: 10px;
  line-height: 1.6;
}
.color-preview button {
  font-size: 10px;
}
.color-draft-source {
  color: var(--muted);
}
.color-save-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.reader-colors .color-save-actions button {
  min-height: 38px;
}
.reader-colors h4 {
  font-size: 12px;
  font-weight: 600;
  margin: 15px 0 9px;
}
.color-reference {
  border-top: 1px solid var(--line);
  margin-top: 15px;
}
.color-reference-controls {
  display: grid;
  gap: 6px;
}
.color-reference-controls select {
  margin-top: 0;
  font-size: 11px;
}
.color-matches {
  display: grid;
  gap: 5px;
}
.color-matches button {
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 8px;
  text-align: left;
  align-items: center;
}
.color-matches button > span {
  width: 28px;
  height: 30px;
  grid-row: span 2;
  border: 1px solid #8888;
  border-radius: 2px;
}
.color-matches strong {
  font-size: 11px;
}
.color-matches small {
  font-size: 10px;
  color: var(--muted);
}
.color-matches button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--lime);
}
.color-online-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0;
}
.color-online-links a {
  font-size: 11px;
}
.reader-colors a {
  color: var(--green);
}
.reader-colors details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
  font-size: 11px;
  line-height: 1.6;
}
.reader-colors summary {
  cursor: pointer;
  color: var(--green);
}
.reader-colors code {
  font-size: 10px;
}
.color-saved-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.color-saved-heading h4 {
  margin: 10px 0;
}
.color-saved-heading button {
  font-size: 10px;
}
.color-count {
  color: var(--muted);
  font-weight: 400;
}
.color-saved-list {
  display: grid;
  gap: 9px;
}
.catalog-swatch {
  display: flex;
  gap: 11px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 3px;
  overflow-wrap: anywhere;
}
.catalog-swatch.removed {
  opacity: 0.6;
}
.catalog-swatch-chip {
  width: 45px;
  min-height: 68px;
  flex-shrink: 0;
  border: 1px solid #8888;
  border-radius: 2px;
}
.catalog-swatch-body {
  flex: 1;
  min-width: 0;
}
.catalog-swatch strong,
.catalog-swatch code,
.catalog-swatch small {
  display: block;
}
.catalog-swatch strong {
  font-size: 12px;
  line-height: 1.5;
}
.catalog-swatch code {
  margin: 4px 0;
}
.catalog-swatch small {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
}
.catalog-swatch .swatch-reference {
  font-size: 10px;
  line-height: 1.6;
}
.color-swatch-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 7px;
}
.color-swatch-actions button {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 10px;
  min-height: 28px;
  color: var(--green);
}
.color-empty {
  border: 1px dashed var(--line);
  padding: 15px;
  color: var(--muted);
}
.color-export {
  padding-top: 13px;
  margin-top: 13px;
  border-top: 1px solid var(--line);
}
.color-export > button {
  width: 100%;
}
.color-pick-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: calc(100% - 20px);
  width: max-content;
  padding: 7px 9px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 3px 15px #0003;
  font-size: 11px;
  pointer-events: none;
}
.color-hover-chip {
  width: 24px;
  height: 24px;
  border: 1px solid #8888;
  border-radius: 2px;
  flex-shrink: 0;
}
.color-pick-banner button {
  pointer-events: auto;
  min-width: 30px;
  min-height: 30px;
  font-size: 20px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.reader-pane.color-picking .reader-stage,
.reader-pane.color-picking .textLayer,
.reader-pane.color-picking .textLayer span {
  cursor: crosshair !important;
  user-select: none !important;
}
.reader-pane.color-picking .reader-turn-zones {
  display: none !important;
}
.reader-pane .reader-controls .reader-colors-toggle {
  order: 0;
}
.pdf-color-pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
}
.pdf-color-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px solid white;
  box-shadow:
    0 0 0 1px #222a,
    0 1px 6px #0006;
  border-radius: 50%;
  width: 17px;
  height: 17px;
  padding: 0;
  pointer-events: auto;
  cursor: pointer;
}
.reader-pane.color-picking .pdf-color-pins {
  display: none;
}
.pdf-color-pin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
@container reader (max-width:700px) {
  .reader-colors {
    padding: 12px;
    width: min(340px, 94%);
  }
  .reader-colors input,
  .reader-colors textarea,
  .reader-colors select {
    font-size: 16px;
    min-height: 40px;
  }
  .reader-colors button {
    min-height: 38px;
  }
  .color-swatch-actions button {
    min-height: 32px;
  }
  .color-pick-actions {
    flex-wrap: wrap;
  }
  .color-pick-actions label {
    flex-basis: 120px;
  }
  .color-reference-controls select {
    font-size: 14px;
  }
  .color-pick-banner {
    font-size: 10px;
    top: 5px;
  }
  .reader-pane .reader-controls .reader-colors-toggle {
    min-width: 36px;
    min-height: 36px;
  }
}
@media print {
  .reader-colors,
  .color-pick-banner {
    display: none !important;
  }
}
