/* ════════════════════════════════════════════════════
   FAIR CODE - Open Dataset Profiler page
   matches "The Audit Ledger" design system
   ════════════════════════════════════════════════════ */

.profiler-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* ── Top bar ─────────────────────────────────────────── */
.profiler-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 40px;
}
.profiler-back,
.profiler-source {
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  color: var(--muted);
}
.profiler-back:hover,
.profiler-source:hover { color: var(--accent); }
.profiler-topbar-actions { display: flex; align-items: center; gap: 18px; }
.profiler-theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
}
.profiler-theme-toggle:hover { border-color: var(--accent); }

/* ── Hero ────────────────────────────────────────────── */
.profiler-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.profiler-headline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--white);
  margin: 0 0 20px;
}
.profiler-lede {
  font-size: 17px;
  line-height: 1.7;
  max-width: 680px;
  color: var(--text);
  margin: 0 0 18px;
}
.profiler-privacy {
  font-size: 14px;
  color: var(--accent3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent3);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  max-width: 680px;
}
.profiler-privacy .lock { margin-right: 6px; }

/* ── Dropzone ────────────────────────────────────────── */
.dropzone {
  margin: 36px 0 8px;
  border: 2px dashed var(--border2);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--bias-track-bg);
}
.dropzone-inner { padding: 48px 24px; text-align: center; }
.dropzone-icon {
  font-size: 40px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 14px;
}
.dropzone-title { font-size: 18px; color: var(--white); margin: 0 0 6px; }
.dropzone-title .link { color: var(--accent); text-decoration: underline; }
.dropzone-hint { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.dropzone-hint code {
  font-family: var(--mono); font-size: 12px;
  background: var(--bias-track-bg); padding: 1px 5px; border-radius: 4px;
}
.sample-btn {
  display: block;
  margin: 0 auto 20px;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
}
.sample-btn:hover { background: var(--white); }

.profiler-error {
  color: var(--accent);
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 14px;
}

/* ── Results: score card ─────────────────────────────── */
.results { margin-top: 40px; }
.score-card {
  display: flex;
  align-items: center;
  gap: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  flex-wrap: wrap;
}
.score-ring {
  --ring: var(--accent3);
  width: 132px; height: 132px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex: 0 0 auto;
  background:
    radial-gradient(closest-side, var(--surface) 78%, transparent 79%),
    conic-gradient(var(--ring) calc(var(--pct, 0) * 1%), var(--bias-track-bg) 0);
}
.score-num { font-family: var(--serif); font-size: 46px; line-height: 1; color: var(--white); }
.score-grade {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.15em;
  color: var(--ring);
  margin-top: 4px;
}
.score-meta h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 26px; color: var(--white); margin: 0 0 8px;
}
.score-summary { font-size: 15px; line-height: 1.6; margin: 0 0 8px; }
.score-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 0; max-width: 480px; }

/* ── Results actions ─────────────────────────────────── */
.results-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.action-btn {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Flags ───────────────────────────────────────────── */
.flags-block { margin-top: 28px; }
.flags-block h3 { font-family: var(--sans); font-size: 15px; color: var(--white); margin: 0 0 12px; }
.flags-block .count { color: var(--muted); font-weight: 400; }
.flags-block ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.flags-block li {
  font-size: 13.5px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 9px 14px;
  border-radius: 0 5px 5px 0;
  color: var(--text);
}

/* ── Dimension cards ─────────────────────────────────── */
.section-title {
  font-family: var(--serif); font-weight: 400;
  font-size: 24px; color: var(--white);
  margin: 38px 0 6px;
}
.section-note { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.dimensions { display: grid; gap: 16px; }
.dim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
}
.dim-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.dim-name { font-size: 17px; color: var(--white); font-weight: 600; }
.dim-kind {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--border2); border-radius: 4px; padding: 2px 6px; margin-left: 8px;
}
.dim-score { font-family: var(--mono); font-size: 13px; color: var(--accent3); }
.dim-meta { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 12px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 13px; }
.bar-label { flex: 0 0 130px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 16px; background: var(--bias-track-bg); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent3); border-radius: 4px; }
.bar-row.under .bar-fill { background: var(--accent); }
.bar-pct { flex: 0 0 92px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.bar-ci { flex: 0 0 auto; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; opacity: 0.85; }
.bar-small { flex: 0 0 auto; font-size: 11px; color: var(--accent); white-space: nowrap; }
.bar-row.under .bar-label::after {
  content: ' ⚑'; color: var(--accent);
}
.dim-extra-groups { margin-top: 2px; }
.dim-more-btn {
  display: block; margin-top: 8px; padding: 2px 0; border: none; background: none;
  font-size: 12px; font-family: inherit; color: var(--accent3); cursor: pointer; text-decoration: underline;
}
.dim-more-btn:hover { color: var(--accent); }
.dim-more-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Reference baseline (issue #56) ──────────────────── */
.reference-status { font-family: var(--mono); font-size: 12px; color: var(--accent3); align-self: center; }
.dim-reference { margin-top: 12px; border-top: 1px dashed var(--border2); padding-top: 10px; }
.dim-reference-head { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ref-row { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 12.5px; }
.ref-label { flex: 0 0 130px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-vals { flex: 1; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ref-delta { flex: 0 0 84px; text-align: right; font-family: var(--mono); font-size: 12px; }
.ref-delta.under { color: var(--accent); }
.ref-delta.over { color: var(--accent3); }

/* ── Cross-dimension selectors (issue #58) ───────────── */
.cross-controls { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; flex-wrap: wrap; }
.cross-controls label { font-family: var(--mono); font-size: 12px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 8px; }
.cross-select {
  font-family: var(--mono); font-size: 12.5px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border2); border-radius: 6px; padding: 6px 10px; cursor: pointer;
}
.cross-select:hover { border-color: var(--accent); }

/* ── Intersections ───────────────────────────────────── */
.intersections-block { margin-top: 12px; }
.inter-cells { display: flex; flex-wrap: wrap; gap: 8px; }
.inter-cell {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 5px; padding: 7px 11px; color: var(--text);
}
.inter-cell.empty { border-color: var(--accent); color: var(--accent); }

/* ── Proxy-hint detection (issue #738) ───────────────── */
.proxy-hints-block { margin-top: 20px; }
.proxy-hints-btn {
  font-family: var(--mono); font-size: 13px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border2); border-radius: 6px; padding: 8px 16px; cursor: pointer;
}
.proxy-hints-btn:hover { border-color: var(--accent); }
.proxy-hint-list { margin-top: 12px; }
.proxy-hint-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.proxy-hint-row:last-child { border-bottom: none; }
.proxy-hint-pair { color: var(--text); }
.proxy-hint-stats { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── Column mapping (manual override) ────────────────── */
.mapping-block {
  margin-top: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 22px;
}
.mapping-summary {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  cursor: pointer; padding: 14px 0; list-style: none;
}
.mapping-summary::-webkit-details-marker { display: none; }
.mapping-summary::before {
  content: '▸'; color: var(--muted); font-size: 13px; transition: transform 0.15s ease;
}
.mapping-block[open] .mapping-summary::before { transform: rotate(90deg); }
.mapping-hint { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.mapping-list { display: grid; gap: 8px; padding-bottom: 18px; }
.map-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px solid var(--border);
}
.map-col {
  flex: 0 0 auto; min-width: 150px; font-size: 14px; color: var(--white);
  font-family: var(--mono); word-break: break-word;
}
.map-auto {
  flex: 1; font-size: 12px; color: var(--muted); font-family: var(--mono);
}
.map-auto .on { color: var(--accent3); }
.map-select {
  flex: 0 0 auto; font-family: var(--mono); font-size: 12.5px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border2); border-radius: 6px; padding: 6px 10px; cursor: pointer;
}
.map-select:hover { border-color: var(--accent); }
.map-row.overridden .map-select { border-color: var(--accent3); color: var(--accent3); }

/* ── Advanced thresholds (issue #284) ────────────────── */
.threshold-controls {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px; padding-bottom: 18px;
}
.threshold-controls label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.threshold-controls code { color: var(--text); }
.threshold-input {
  font-family: var(--mono); font-size: 12.5px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border2); border-radius: 6px; padding: 6px 10px;
}
.threshold-input:hover { border-color: var(--accent); }
.threshold-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.threshold-input.overridden { border-color: var(--accent3); color: var(--accent3); }

/* ── Compare two datasets: representation drift ──────── */
.compare-block { margin-top: 56px; padding-top: 8px; }
.compare-drops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 8px 0 16px;
}
.mini-drop {
  border: 2px dashed var(--border2);
  border-radius: 10px;
  background: var(--surface);
  padding: 22px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.mini-drop:hover,
.mini-drop:focus-visible,
.mini-drop.dragover { border-color: var(--accent); background: var(--bias-track-bg); }
.mini-drop.loaded { border-style: solid; border-color: var(--accent3); }
.mini-drop-tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
}
.mini-drop-name { font-size: 14px; color: var(--white); word-break: break-word; }
.mini-drop-name .link { color: var(--accent); text-decoration: underline; }
.mini-drop.loaded .mini-drop-tag { color: var(--accent3); }
.compare-actions { margin-bottom: 8px; }

.compare-results { margin-top: 28px; }
.drift-summary {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 24px;
}
.drift-score { text-align: center; min-width: 96px; }
.drift-score .n { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--white); }
.drift-score .l { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
                  text-transform: uppercase; color: var(--muted); display: block; margin-top: 6px; }
.drift-arrow { font-family: var(--mono); font-size: 22px; color: var(--muted); }
.drift-delta { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.drift-delta.up { color: var(--accent3); }
.drift-delta.down { color: var(--accent); }
.drift-delta.flat { color: var(--muted); }

.drift-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 22px; margin-top: 16px;
}
.drift-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.drift-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; border-radius: 4px; padding: 3px 8px; margin-left: 8px;
}
.drift-badge.none { color: var(--accent3); border: 1px solid var(--accent3); }
.drift-badge.moderate { color: var(--warn); border: 1px solid var(--warn); }
.drift-badge.significant { color: var(--accent); border: 1px solid var(--accent); }
.drift-badge.skipped { color: var(--muted); border: 1px solid var(--muted); }
.drift-metrics { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.drift-row {
  display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px;
}
.drift-row-label {
  flex: 0 0 130px; color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.drift-bars { flex: 1; height: 16px; background: var(--bias-track-bg); border-radius: 4px;
  position: relative; overflow: hidden; }
.drift-bars .a { position: absolute; top: 0; left: 0; height: 100%; background: var(--border2); }
.drift-bars .b { position: absolute; top: 0; left: 0; height: 100%; background: var(--accent3);
  opacity: 0.72; }
.drift-row-delta { flex: 0 0 128px; text-align: right; font-family: var(--mono);
  font-size: 12px; color: var(--muted); white-space: nowrap; }
.drift-row-delta .up { color: var(--accent3); }
.drift-row-delta .down { color: var(--accent); }
.drift-row.gone .drift-row-label { color: var(--accent); }
.drift-row.gone .drift-row-label::after { content: ' ⚑'; }
.drift-row.new .drift-row-label { color: var(--accent3); }
.drift-only { font-size: 13px; color: var(--muted); margin-top: 14px; }

@media (max-width: 560px) {
  .compare-drops { grid-template-columns: 1fr; }
  .drift-row-label { flex-basis: 92px; }
}

/* ── Footer ──────────────────────────────────────────── */
.profiler-foot {
  margin-top: 56px; padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13.5px; line-height: 1.7; color: var(--muted);
}
.profiler-foot code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface); padding: 1px 5px; border-radius: 4px;
}

@media (max-width: 560px) {
  .score-card { flex-direction: column; text-align: center; }
  .bar-label { flex-basis: 92px; }
}

/* ── Held-out rows (issues #801-#803) ── */
.heldout-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 8px 0; font-size: 13px; }
.heldout-remove { background: none; border: 1px solid var(--border2); border-radius: 4px; color: var(--muted);
  cursor: pointer; padding: 2px 8px; }
.heldout-remove:hover { border-color: var(--accent); color: var(--accent); }
.proxy-heldout .proxy-hints-btn { margin: 4px 0 10px; }

/* Extra column-name keywords (--keywords, #856): a wide JSON textarea in the thresholds grid. */
.keywords-label { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; }
.keywords-input { width: 100%; min-height: 3em; font-family: var(--mono); resize: vertical; }
.keywords-input[aria-invalid="true"] { border-color: var(--accent); }
.keywords-restored { grid-column: 1 / -1; margin: 0; font-size: 0.85em; color: var(--muted); }
.keywords-restored .action-btn { padding: 2px 8px; margin-left: 6px; }
.keywords-error { color: var(--accent); font-size: 0.85em; }

/* Text-encoding picker next to the dropzones (#857). */
.encoding-picker { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 0 12px;
  font-family: var(--mono); font-size: 12px; color: var(--muted); }
