/* App shell styles for the upload, preview, statistics, and correlation views. */
:root {
  --bg: #131418;
  --paper: rgba(29, 31, 39, 0.78);
  --ink: #f3f4f7;
  --muted: #9197a8;
  --line: rgba(86, 74, 104, 0.42);
  --accent: #ae5cff;
  --accent-2: #8d34ea;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(174, 92, 255, 0.18), transparent 22%),
    radial-gradient(circle at 85% 10%, rgba(141, 52, 234, 0.16), transparent 24%),
    linear-gradient(180deg, #131418 0%, #17181d 55%, #131418 100%);
}
.shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
.panel, .viewer {
  background: var(--paper);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  min-height: 0;
}
.panel {
  padding: 28px;
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: linear-gradient(180deg, rgba(31, 33, 41, 0.96), rgba(21, 22, 28, 0.94));
}
.eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 700;
}
h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: -0.05em;
  max-width: 10ch;
  font-family: "Syne", "Inter", sans-serif;
}
.lede {
  margin: 14px 0 24px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.98rem;
  max-width: 44ch;
}
.dropzone {
  border: 1px solid rgba(174, 92, 255, 0.22);
  border-radius: 24px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(34, 28, 44, 0.94), rgba(24, 21, 31, 0.98));
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  cursor: pointer;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(47, 31, 67, 0.98), rgba(28, 23, 39, 0.98));
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px rgba(174, 92, 255, 0.28), 0 18px 36px rgba(0, 0, 0, 0.34);
}
.dropzone-badge {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(174, 92, 255, 0.24), rgba(141, 52, 234, 0.22));
  color: #f6efff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid rgba(174, 92, 255, 0.18);
}
.dropzone-copy { min-width: 0; }
.dropzone strong {
  display: block;
  font-size: 1.12rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #faf8ff;
}
.dropzone span {
  color: var(--muted);
  font-size: 0.92rem;
  display: block;
  line-height: 1.45;
}
.dropzone-hint {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(174, 92, 255, 0.12);
  color: #ead6ff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(174, 92, 255, 0.18);
}
.actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
  justify-content: center;
}
button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}
button:hover { transform: translateY(-1px); }
.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 14px 32px rgba(174, 92, 255, 0.2);
}
.secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-color: rgba(86, 74, 104, 0.64);
}
#clear-button {
  display: inline-flex;
  align-items: center;
  min-width: 200px;
  padding-inline: 30px;
  justify-content: center;
}
.meta, .error {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  display: none;
}
.meta {
  background: rgba(174, 92, 255, 0.08);
  color: #ead6ff;
  border: 1px solid rgba(174, 92, 255, 0.16);
}
.error {
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.14);
}
.filter-card {
  margin-top: 24px;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(174, 92, 255, 0.18);
  background: linear-gradient(180deg, rgba(26, 23, 35, 0.96), rgba(19, 18, 27, 0.96));
  display: grid;
  gap: 18px;
}
.prep-summary-card {
  margin-top: 24px;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(174, 92, 255, 0.18);
  background: linear-gradient(180deg, rgba(26, 23, 35, 0.96), rgba(19, 18, 27, 0.96));
  display: grid;
  gap: 18px;
}
.prep-summary-grid {
  display: grid;
  gap: 10px;
}
.prep-summary-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(110, 96, 136, 0.38);
  background: rgba(255, 255, 255, 0.04);
  color: #e8ebf4;
  font-size: 0.88rem;
  line-height: 1.45;
}
.prep-summary-empty {
  display: none;
  min-height: 96px;
  place-items: center;
  text-align: center;
  color: #a8b0c0;
  font-size: 0.9rem;
  line-height: 1.55;
  border: 1px dashed rgba(110, 96, 136, 0.34);
  border-radius: 18px;
  padding: 20px 18px;
}
.prep-summary-empty.visible {
  display: grid;
}
.filter-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.filter-card-kicker {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.filter-card-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.1;
  color: #f7f3ff;
}
.filter-card-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}
.filter-impact {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(174, 92, 255, 0.12);
  border: 1px solid rgba(174, 92, 255, 0.18);
  color: #eedfff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.filter-rules {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.filter-rule {
  border-radius: 18px;
  border: 1px solid rgba(110, 96, 136, 0.36);
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}
.filter-rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.filter-rule-label {
  color: #f4efff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.filter-rule-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.filter-field {
  display: grid;
  gap: 8px;
}
.filter-field label {
  color: #d7deec;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.filter-field select,
.filter-field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid rgba(110, 96, 136, 0.48);
  background: rgba(18, 20, 28, 0.92);
  color: #e8ebf4;
  font: inherit;
  outline: none;
}
.filter-empty {
  display: none;
  min-height: 108px;
  place-items: center;
  text-align: center;
  color: #a8b0c0;
  font-size: 0.9rem;
  line-height: 1.55;
  border: 1px dashed rgba(110, 96, 136, 0.34);
  border-radius: 18px;
  padding: 20px 18px;
}
.filter-empty.visible {
  display: grid;
}
.filter-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.filter-remove {
  padding: 8px 12px;
  font-size: 0.76rem;
  box-shadow: none;
}
.filter-help {
  margin-top: 12px;
  color: #aeb8cb;
  font-size: 0.82rem;
  line-height: 1.55;
}
.viewer {
  padding: 14px;
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(27, 28, 36, 0.94), rgba(18, 19, 24, 0.98));
}
.viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 12px 2px;
}
.viewer-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 920px;
  padding: 7px;
  border-radius: 999px;
  background: rgba(174, 92, 255, 0.1);
  border: 1px solid rgba(174, 92, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.viewer-tab {
  flex: 1;
  text-align: center;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.02);
  color: #d5d8e1;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.viewer-tab.active {
  background: linear-gradient(135deg, rgba(174, 92, 255, 0.88), rgba(141, 52, 234, 0.92));
  color: #fff;
  border-color: rgba(174, 92, 255, 0.54);
  box-shadow: 0 10px 24px rgba(174, 92, 255, 0.24);
}
.viewer-context {
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-align: right;
}
.viewer-stage {
  position: relative;
  min-height: 0;
}
.viewer-panel {
  height: 100%;
  min-height: 0;
}
.viewer-panel.hidden {
  display: none;
}
iframe {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(86, 74, 104, 0.42);
  border-radius: 22px;
  background: #fff;
}
.stats-stage {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}
.stats-section-title {
  padding: 0 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.stats-control-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 10px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(110, 96, 136, 0.42);
  background: linear-gradient(180deg, rgba(24, 27, 36, 0.96), rgba(17, 19, 27, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.stats-control-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.stats-control-title {
  color: #e8ebf4;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.stats-control-subtitle {
  margin-top: 4px;
  color: #9aa4b8;
  font-size: 0.8rem;
  line-height: 1.4;
}
.stats-control-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.stats-control-action {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(110, 96, 136, 0.42);
  background: rgba(255, 255, 255, 0.04);
  color: #d8ddea;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: none;
}
.stats-control-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.stats-search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stats-search-field span {
  color: #d7deec;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stats-search-field input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(110, 96, 136, 0.48);
  background: rgba(18, 20, 28, 0.92);
  color: #e8ebf4;
  font-size: 0.92rem;
  outline: none;
}
.stats-search-field input::placeholder {
  color: #7f899d;
}
.stats-search-field input:focus {
  border-color: rgba(174, 92, 255, 0.56);
  box-shadow: 0 0 0 3px rgba(174, 92, 255, 0.12);
}
.stats-selector-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}
.stats-selector-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(86, 74, 104, 0.32);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.stats-selector-option.active {
  background: rgba(174, 92, 255, 0.14);
  border-color: rgba(174, 92, 255, 0.28);
  color: #f2e8ff;
}
.stats-selector-option input {
  margin: 0;
  accent-color: #ae5cff;
  flex: 0 0 auto;
}
.stats-selector-option-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-selector-empty {
  grid-column: 1 / -1;
  padding: 18px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(110, 96, 136, 0.48);
  color: #9aa4b8;
  text-align: center;
  font-size: 0.9rem;
}
.stats-download {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(174, 92, 255, 0.34);
  background: rgba(174, 92, 255, 0.14);
  color: #f4e8ff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: none;
}
.stats-download:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: #b0b5c3;
}
.stats-download:hover:disabled {
  transform: none;
}
.stats-copy {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 0 12px;
}
.stats-sheet {
  min-height: 0;
  overflow: auto;
  background: rgba(18, 20, 28, 0.92);
  border: 1px solid rgba(110, 96, 136, 0.42);
  border-radius: 22px;
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}
.stats-sheet.numeric {
  flex: 0 0 auto;
  max-height: 44vh;
}
.stats-sheet.categorical {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  color: #e8ebf4;
}
.stats-table th,
.stats-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}
.stats-table thead th {
  position: sticky;
  top: 0;
  background: rgba(18, 20, 28, 0.98);
  z-index: 1;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #abb4c5;
}
.stats-term-header {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.stats-term-info {
  appearance: none;
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(174, 92, 255, 0.48);
  background: rgba(174, 92, 255, 0.14);
  color: #f6ebff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  display: inline-grid;
  place-items: center;
  cursor: help;
  box-shadow: none;
  position: relative;
  transform: none !important;
}
.stats-term-info:hover,
.stats-term-info:focus-visible {
  background: rgba(174, 92, 255, 0.22);
  border-color: rgba(174, 92, 255, 0.64);
  outline: none;
}
.stats-term-info::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, -4px);
  width: clamp(200px, 28vw, 320px);
  padding: 10px 11px;
  border-radius: 11px;
  border: 1px solid rgba(174, 92, 255, 0.34);
  background: rgba(12, 14, 22, 0.98);
  color: #e8ebf4;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 30;
  white-space: normal;
}
.stats-term-info::before {
  content: "";
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(174, 92, 255, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 31;
}
.stats-term-info:hover::after,
.stats-term-info:focus-visible::after,
.stats-term-info:hover::before,
.stats-term-info:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}
.stats-table tbody tr:hover td,
.stats-table tbody tr:hover th {
  background: rgba(174, 92, 255, 0.06);
}
.stats-table tbody th {
  width: 180px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b9c1d2;
  background: rgba(26, 28, 37, 0.94);
}
.stats-table tbody th.stats-parameter {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: #e8ebf4;
  background: rgba(30, 33, 43, 0.94);
}
.stats-table td {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}
.stats-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  text-align: center;
  color: #a8b0c0;
  font-size: 0.95rem;
  line-height: 1.6;
}
.stats-empty.small {
  min-height: 140px;
}
.transform-stage {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}
.transform-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  flex: 1;
  padding: 0 10px 10px;
}
.transform-sidebar,
.transform-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.transform-main .stats-control-panel,
.transform-sidebar .stats-control-panel {
  flex: 0 0 auto;
}
.transform-apply-button {
  padding-inline: 16px;
}
.transform-impact-grid,
.transform-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.transform-radio-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.transform-radio-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(86, 74, 104, 0.32);
  background: rgba(255, 255, 255, 0.04);
  color: #dce3f1;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.transform-radio-option.active {
  background: rgba(174, 92, 255, 0.14);
  border-color: rgba(174, 92, 255, 0.3);
  color: #f4e8ff;
}
.transform-radio-option input {
  margin: 0;
  accent-color: #ae5cff;
}
.transform-tag-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}
.transform-inline-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.transform-preview-note,
.transform-metric-note {
  color: #9ea8bb;
  font-size: 0.82rem;
  line-height: 1.45;
}
.transform-preview-table {
  min-height: 320px;
}
.correlation-stage {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}
.corr-mode-switch {
  display: flex;
  gap: 6px;
  padding: 7px;
  border-radius: 999px;
  background: rgba(174, 92, 255, 0.1);
  border: 1px solid rgba(174, 92, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  margin: 0 10px;
}
.corr-mode-button {
  flex: 1;
  text-align: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.02);
  color: #d5d8e1;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.corr-mode-button.active {
  background: linear-gradient(135deg, rgba(174, 92, 255, 0.88), rgba(141, 52, 234, 0.92));
  color: #fff;
  border-color: rgba(174, 92, 255, 0.54);
  box-shadow: 0 10px 24px rgba(174, 92, 255, 0.2);
}
.corr-mode-panel.hidden {
  display: none;
}
.corr-mode-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.corr-select-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 10px;
}
.corr-field label {
  display: block;
  margin-bottom: 6px;
  color: #d7deec;
  font-size: 0.79rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.corr-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(110, 96, 136, 0.48);
  background: rgba(18, 20, 28, 0.92);
  color: #e8ebf4;
  font-size: 0.9rem;
  outline: none;
}
.corr-alpha-control {
  margin: 0 10px;
  padding: 11px 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(110, 96, 136, 0.44);
  background: linear-gradient(180deg, rgba(24, 27, 36, 0.96), rgba(17, 19, 27, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.corr-alpha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.corr-alpha-header label {
  margin: 0;
  color: #dce3f1;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.corr-alpha-value {
  color: #f6ecff;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(174, 92, 255, 0.16);
  border: 1px solid rgba(174, 92, 255, 0.34);
}
.corr-alpha-control input[type="range"] {
  width: 100%;
  appearance: none;
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(110, 96, 136, 0.5);
  background: linear-gradient(
    90deg,
    rgba(174, 92, 255, 0.94) 0%,
    rgba(141, 52, 234, 0.94) var(--alpha-progress, 74%),
    rgba(73, 79, 94, 0.58) var(--alpha-progress, 74%),
    rgba(73, 79, 94, 0.58) 100%
  );
  cursor: pointer;
  outline: none;
}
.corr-alpha-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #faf6ff;
  border: 2px solid rgba(174, 92, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(174, 92, 255, 0.22);
}
.corr-alpha-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #faf6ff;
  border: 2px solid rgba(174, 92, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(174, 92, 255, 0.22);
}
.corr-fit-row {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.corr-fit-row label {
  color: #dce3f1;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.corr-fit-row select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(110, 96, 136, 0.48);
  background: rgba(18, 20, 28, 0.92);
  color: #e8ebf4;
  font-size: 0.9rem;
  outline: none;
}
.corr-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 9px;
  padding: 0 10px;
}
.corr-metric-card {
  position: relative;
  overflow: visible;
  background: linear-gradient(180deg, rgba(24, 27, 36, 0.96), rgba(17, 19, 27, 0.92));
  border: 1px solid rgba(110, 96, 136, 0.42);
  border-radius: 14px;
  padding: 10px 11px 11px;
  min-height: 78px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  z-index: 0;
}
.corr-metric-card:hover,
.corr-metric-card:focus-within {
  z-index: 8;
}
.corr-metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(174, 92, 255, 0.48);
}
.corr-metric-card.corr-metric-card--positive {
  border-color: rgba(56, 189, 121, 0.4);
}
.corr-metric-card.corr-metric-card--positive::before {
  background: rgba(56, 189, 121, 0.82);
}
.corr-metric-card.corr-metric-card--negative {
  border-color: rgba(248, 113, 113, 0.4);
}
.corr-metric-card.corr-metric-card--negative::before {
  background: rgba(248, 113, 113, 0.82);
}
.corr-metric-badge {
  position: absolute;
  top: 9px;
  right: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(174, 92, 255, 0.14);
  border: 1px solid rgba(174, 92, 255, 0.28);
  color: #e7d4ff;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.corr-metric-label {
  color: #aeb8cb;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 700;
  padding-right: 34px;
}
.corr-metric-label-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.corr-metric-value {
  color: #f6f8fc;
  font-size: 1.04rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.corr-plot,
.corr-heatmap,
.corr-focus-plot {
  min-height: 320px;
  border: 1px solid rgba(110, 96, 136, 0.42);
  border-radius: 20px;
  background: rgba(18, 20, 28, 0.92);
  margin: 0 10px;
  overflow: hidden;
}
.corr-plot {
  width: min(calc(100% - 20px), 88vh, 1200px);
  aspect-ratio: 1 / 1;
  min-height: 0;
  height: auto;
  margin: 0 auto;
}
.corr-heatmap {
  height: 42vh;
}
.corr-focus-plot {
  width: min(calc(100% - 20px), 88vh, 1200px);
  aspect-ratio: 1 / 1;
  min-height: 0;
  height: auto;
  margin: 0 auto;
}
.corr-plot-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 10px;
}
.corr-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  margin-top: 2px;
}
.corr-toggle-title {
  color: #d7deec;
  font-size: 0.79rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.corr-toggle-actions {
  display: flex;
  gap: 6px;
}
.corr-matrix-note {
  color: #aab3c5;
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 0 12px;
}
.corr-small-button {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(110, 96, 136, 0.5);
  background: rgba(255, 255, 255, 0.05);
  color: #dbe2f0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: none;
}
.corr-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 10px;
}
.corr-toggle {
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid rgba(110, 96, 136, 0.42);
  background: rgba(255, 255, 255, 0.05);
  color: #dbe2f0;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: none;
}
.corr-toggle.active {
  background: rgba(174, 92, 255, 0.16);
  border-color: rgba(174, 92, 255, 0.34);
  color: #f4e8ff;
}
.corr-open-pair {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(174, 92, 255, 0.38);
  background: rgba(174, 92, 255, 0.14);
  color: #f3e8ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: none;
}
.corr-focus-title {
  color: #aab3c5;
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 0 12px;
}
.corr-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: #a8b0c0;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.6;
  padding: 18px;
}
.dist-stage {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}
.dist-layout {
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  flex: 1;
  padding: 0 10px 10px;
}
.dist-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}
.dist-sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(110, 96, 136, 0.38);
  background: linear-gradient(180deg, rgba(24, 27, 36, 0.96), rgba(17, 19, 27, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.dist-control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dist-control-group + .dist-control-group {
  padding-top: 16px;
  border-top: 1px solid rgba(110, 96, 136, 0.24);
}
.dist-control-group-hist {
  gap: 14px;
}
.dist-group-label {
  color: #f1e8ff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.dist-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.dist-control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.dist-field {
  display: grid;
  gap: 8px;
}
.dist-field label {
  display: block;
  color: #d7deec;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dist-field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(110, 96, 136, 0.48);
  background: rgba(18, 20, 28, 0.92);
  color: #e8ebf4;
  font-size: 0.9rem;
  outline: none;
}
.dist-field select:focus {
  border-color: rgba(174, 92, 255, 0.56);
  box-shadow: 0 0 0 3px rgba(174, 92, 255, 0.12);
}
.dist-field-slider {
  padding: 13px 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(174, 92, 255, 0.22);
  background: linear-gradient(180deg, rgba(37, 24, 54, 0.72), rgba(21, 18, 30, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.dist-field-slider.hidden {
  display: none;
}
.dist-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.dist-slider-header label {
  margin: 0;
  color: #dce3f1;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.dist-slider-value {
  color: #f4e8ff;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dist-field-slider input[type="range"] {
  width: 100%;
  accent-color: #ae5cff;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}
.dist-field-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(174, 92, 255, 0.92), rgba(141, 52, 234, 0.72));
}
.dist-field-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: #faf6ff;
  border: 2px solid rgba(174, 92, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(174, 92, 255, 0.22);
}
.dist-field-slider input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(174, 92, 255, 0.92), rgba(141, 52, 234, 0.72));
}
.dist-field-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #faf6ff;
  border: 2px solid rgba(174, 92, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(174, 92, 255, 0.22);
}
.dist-note {
  color: #aab3c5;
  font-size: 0.88rem;
  line-height: 1.6;
  padding: 0 4px;
}
.dist-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dist-summary-grid .corr-metric-card {
  min-height: 84px;
  padding: 11px 12px 12px;
}
.dist-summary-grid .corr-metric-label {
  margin-bottom: 10px;
}
.dist-plot {
  border: 1px solid rgba(110, 96, 136, 0.42);
  border-radius: 20px;
  background: rgba(18, 20, 28, 0.92);
  overflow: hidden;
}
.dist-plot-main {
  min-height: 54vh;
}
.dist-plot-secondary {
  min-height: 34vh;
}
.dist-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dist-plot-main + .dist-section-header {
  margin-top: 14px;
}
.dist-section-title {
  color: #e8ebf4;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dist-secondary-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.dist-secondary-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.dist-secondary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dist-secondary-title {
  color: #aab3c5;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 2px;
}
.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
  border: 1px solid rgba(86, 74, 104, 0.42);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20, 22, 30, 0.95), rgba(16, 18, 26, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  color: #e8ebf4;
  z-index: 2;
}
.empty-state.hidden { display: none; }
.empty-state-inner { max-width: 360px; }
.empty-state-kicker {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.empty-state-title {
  margin: 0 0 10px;
  font-family: "Syne", "Inter", sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}
.empty-state-copy {
  margin: 0;
  color: #a4aec0;
  line-height: 1.6;
  font-size: 0.98rem;
}
.loading-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
  border: 1px solid rgba(86, 74, 104, 0.42);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20, 22, 30, 0.96), rgba(16, 18, 26, 0.99));
  color: #e8ebf4;
  z-index: 3;
  backdrop-filter: blur(4px);
}
.loading-state.hidden {
  display: none;
}
.loading-state-inner {
  display: grid;
  gap: 12px;
  justify-items: center;
}
.loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(174, 92, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.95s linear infinite;
}
.loading-title {
  margin: 0;
  font-family: "Syne", "Inter", sans-serif;
  font-size: clamp(1.25rem, 2.5vw, 1.8rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.loading-copy {
  margin: 0;
  color: #a4aec0;
  font-size: 0.95rem;
  line-height: 1.5;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
input[type="file"] { display: none; }
@media (max-width: 980px) {
  body { overflow: auto; }
  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 12px;
  }
  .panel {
    height: auto;
    overflow: visible;
  }
  .viewer {
    height: auto;
    min-height: 65vh;
  }
  .viewer-header {
    flex-direction: column;
    align-items: stretch;
  }
  .viewer-tabs {
    max-width: none;
  }
  iframe {
    min-height: 65vh;
    height: 65vh;
  }
  .stats-sheet.numeric {
    min-height: 65vh;
  }
  .stats-sheet.categorical {
    min-height: 0;
  }
  .stats-control-header {
    flex-direction: column;
    align-items: stretch;
  }
  .stats-control-actions {
    justify-content: stretch;
  }
  .stats-control-actions > * {
    width: 100%;
  }
  .stats-selector-list {
    grid-template-columns: 1fr;
    max-height: 260px;
  }
  .transform-layout {
    grid-template-columns: 1fr;
  }
  .transform-impact-grid,
  .transform-preview-grid,
  .transform-radio-row,
  .transform-tag-selector {
    grid-template-columns: 1fr;
  }
  .filter-card-header,
  .filter-rule-header,
  .filter-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-rule-grid {
    grid-template-columns: 1fr;
  }
  .corr-select-row {
    grid-template-columns: 1fr;
  }
  .dist-layout {
    grid-template-columns: 1fr;
  }
  .dist-control-grid {
    grid-template-columns: 1fr;
  }
  .dist-secondary-grid {
    grid-template-columns: 1fr;
  }
  .dist-summary-grid {
    grid-template-columns: 1fr;
  }
  .corr-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .corr-plot,
  .corr-heatmap,
  .corr-focus-plot,
  .dist-plot-main,
  .dist-plot-secondary {
    min-height: 65vh;
    height: 65vh;
  }
  .corr-plot {
    width: min(calc(100% - 20px), 88vh, 820px);
    aspect-ratio: 1 / 1;
    min-height: 0;
    height: auto;
  }
  .corr-focus-plot {
    width: min(calc(100% - 20px), 88vh, 820px);
    aspect-ratio: 1 / 1;
    min-height: 0;
    height: auto;
  }
  .dropzone {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .dropzone strong { white-space: normal; }
}
