/* Graph Digitizer (Paper Tools, Chunk 3) — tool-specific styles only.
   Site tokens and base components come from /assets/ui.css and
   /ui/paper-tools-ui.css. British spelling in every user facing string. */

/* Round 3: the steps list has no card styling on this page, so give it
   a little air before the first card below it. */
.rg-guide { margin-bottom: var(--s4); }

.gd-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.gd-status {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.gd-error {
  margin-top: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  background: #fdecea;
  color: #7a1f1a;
  font-size: 0.95rem;
}

[data-theme="dark"] .gd-error {
  background: #4a1d1a;
  color: #ffc9c4;
}

.gd-zoom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.gd-zoom-label {
  min-width: 3.5rem;
  text-align: center;
  font-weight: 600;
}

.gd-canvas-wrap {
  position: relative;
  border: 1px solid var(--border, #d8dee6);
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f4f6f8;
  touch-action: none;
}

[data-theme="dark"] .gd-canvas-wrap {
  background: #1b2530;
}

.gd-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

.gd-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #5a6b7d;
  pointer-events: none;
}

/* The display rules above override the hidden attribute's built-in
   display: none, so these elements stayed visible after load. A hidden
   element must stay hidden: the zoom row is hidden until a figure is
   loaded, the empty placeholder until a figure is loaded. */
#gdEmpty[hidden],
#zoomRow[hidden] {
  display: none;
}

.gd-readout {
  margin-top: 0.6rem;
  font-variant-numeric: tabular-nums;
}

.gd-readout-dim {
  color: #5a6b7d;
  font-size: 0.9rem;
}

.gd-tilt {
  font-weight: 600;
}

.gd-cal-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .gd-cal-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.gd-cal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.gd-cal-row .gd-val {
  flex: 1 1 7rem;
  min-width: 6rem;
}

.gd-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  cursor: pointer;
}

.gd-check input {
  width: 1.1rem;
  height: 1.1rem;
}

.gd-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border, #d8dee6);
  margin-bottom: 1rem;
}

.gd-tabs button {
  border: 0;
  background: none;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.gd-tabs button[aria-selected="true"] {
  color: #0f2a44;
  border-bottom-color: #e67e22;
}

[data-theme="dark"] .gd-tabs button[aria-selected="true"] {
  color: #fff;
}

.gd-swatch {
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid #0f2a44;
  border-radius: 0.3rem;
  background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 0.6rem 0.6rem;
  vertical-align: middle;
}

.gd-datasets {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border, #d8dee6);
  padding-top: 0.75rem;
}

.gd-dataset-list {
  list-style: none;
  margin: 0 0 0.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.gd-dataset-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.gd-dataset-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.25);
  flex: none;
}

.gd-dataset-list input[type="text"] {
  flex: 1 1 8rem;
  min-width: 6rem;
}

.gd-table-tools {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* The data table is wider than a phone screen (the editable X and Y
   inputs are 6.5rem each), so it must scroll inside its wrapper instead
   of widening the page. overflow-x: auto alone does not do it: Chrome
   still counts the table in the document's scrollable area (360px page
   measured 460px wide with bars + error column). contain: paint stops
   that leak while the wrapper keeps scrolling internally. */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  contain: paint;
}

@media (min-width: 720px) {
  .gd-table-tools {
    grid-template-columns: 1fr 1fr;
  }
}

.gd-decimals {
  width: 5rem;
  margin-left: 0.5rem;
}

.gd-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.gd-table th,
.gd-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border, #d8dee6);
  text-align: left;
}

.gd-table tbody tr[data-selected="true"] {
  background: rgba(230, 126, 34, 0.15);
}

.gd-table input {
  width: 6.5rem;
  padding: 0.25rem 0.4rem;
}

.gd-table-empty {
  color: #5a6b7d;
}

.gd-export-row {
  margin-top: 1rem;
}

.gd-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.gd-thumb {
  border: 2px solid transparent;
  border-radius: 0.4rem;
  padding: 0.2rem;
  background: none;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
}

.gd-thumb[aria-selected="true"] {
  border-color: #e67e22;
}

.gd-thumb canvas {
  display: block;
  width: 90px;
  height: auto;
  border: 1px solid var(--border, #d8dee6);
  border-radius: 0.3rem;
}

.gd-pharm {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1rem;
  margin: 0.75rem 0;
}

.gd-pharm dt {
  font-weight: 600;
}

.gd-pharm dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.gd-dataset-name {
  flex: 1 1 12rem;
}
