/* AIBIS Data Explorer — interactive Excel -> insights showcase
   Scoped to /showcase/data-explorer/ and the compact card on /products/.
   Uses the production design tokens from /assets/reset-v2/theme.css. */

.dx-page {
  background:
    radial-gradient(1200px 600px at 82% -8%, rgba(70, 200, 240, 0.14), transparent 62%),
    radial-gradient(900px 520px at 8% 0%, rgba(201, 164, 92, 0.08), transparent 60%),
    var(--ink);
}

.dx-hero {
  padding: clamp(56px, 7vw, 92px) 0 clamp(26px, 3vw, 40px);
}

.dx-hero .kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.dx-hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  max-width: 18ch;
}

.dx-hero h1 .accent {
  background: linear-gradient(92deg, var(--cyan), var(--cyan-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dx-hero p.lead {
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.25vw, 1.12rem);
  line-height: 1.7;
}

.dx-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.dx-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(18, 32, 52, 0.55);
  color: var(--silver);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.dx-pill svg { color: var(--cyan); }

/* ---------------------------------------------------------------- app shell */
.dx-shell-wrap { padding-bottom: clamp(56px, 7vw, 96px); }

.dx-shell {
  scroll-margin-top: calc(var(--header, 72px) + 18px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 25, 41, 0.96), rgba(9, 17, 30, 0.98));
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.dx-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 2.4vw, 26px);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 17, 32, 0.72);
}

.dx-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.dx-brand img { width: 30px; height: auto; }

.dx-brand strong {
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}

.dx-brand span {
  font-size: 0.74rem;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dx-topbar-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--faint);
}

.dx-topbar-note svg { color: var(--gold); flex: 0 0 auto; }

.dx-layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) 1fr;
  align-items: start;
}

/* ---------------------------------------------------------------- editor */
.dx-editor {
  padding: clamp(18px, 2.2vw, 28px);
  border-right: 1px solid var(--line);
  background:
    radial-gradient(600px 240px at 0% 0%, rgba(70, 200, 240, 0.07), transparent 65%),
    rgba(11, 20, 36, 0.6);
  min-width: 0;
}

.dx-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.dx-step b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(70, 200, 240, 0.45);
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 600;
}

.dx-step span {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.dx-hint {
  font-size: 0.74rem;
  color: var(--faint);
  margin: 0 0 12px;
}

.dx-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.dx-region {
  border: 1px solid var(--line);
  background: rgba(18, 32, 52, 0.6);
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}

.dx-region:hover { border-color: var(--line-strong); color: var(--text); }

.dx-region[aria-pressed="true"] {
  border-color: rgba(70, 200, 240, 0.6);
  background: rgba(70, 200, 240, 0.12);
  color: var(--cyan-soft);
}

.dx-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.dx-field label,
.dx-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}

.dx-field select {
  width: 100%;
  appearance: none;
  background: var(--surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239caab8' stroke-width='1.6'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 34px 10px 12px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.dx-field select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.dx-products {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.dx-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(18, 32, 52, 0.5);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}

.dx-chip input {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  margin: 0;
  cursor: pointer;
}

.dx-chip input:checked {
  background: var(--cyan);
  border-color: var(--cyan);
}

.dx-chip input:checked::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: #04202a;
}

.dx-chip:has(input:checked) { color: var(--text); border-color: rgba(70, 200, 240, 0.35); }
.dx-chip input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* table */
.dx-tablewrap {
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  max-height: 320px;
  background: rgba(8, 15, 28, 0.6);
}

.dx-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.78rem;
}

.dx-table th,
.dx-table td {
  padding: 8px 9px;
  border-bottom: 1px solid rgba(150, 172, 196, 0.1);
  text-align: right;
  white-space: nowrap;
}

.dx-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0c1729;
  color: var(--faint);
  font-weight: 600;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dx-table th:first-child,
.dx-table td:first-child {
  width: 22%;
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: #0b1626;
}

.dx-table thead th:first-child { z-index: 3; }

.dx-prod {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--silver-soft);
  font-weight: 500;
}

.dx-prod i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--dot, var(--cyan));
  flex: 0 0 auto;
}

.dx-table input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  text-align: right;
  padding: 5px 6px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, background 0.15s;
}

.dx-table input:hover { border-color: var(--line); }

.dx-table input:focus-visible {
  outline: none;
  border-color: var(--cyan);
  background: rgba(70, 200, 240, 0.08);
}

.dx-table input[aria-invalid="true"] {
  border-color: #f0776c;
  background: rgba(240, 119, 108, 0.1);
}

.dx-table tbody tr:last-child td { border-bottom: 0; }

.dx-error {
  display: none;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(240, 119, 108, 0.45);
  background: rgba(240, 119, 108, 0.08);
  color: #ffd7d2;
  font-size: 0.76rem;
  line-height: 1.5;
}

.dx-error.is-on { display: flex; }

.dx-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.dx-run {
  flex: 1 1 190px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: linear-gradient(92deg, var(--cyan), #7fe0ff);
  color: #03202a;
  border: 0;
  border-radius: 10px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
  box-shadow: 0 10px 28px -12px rgba(70, 200, 240, 0.7);
}

.dx-run:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -12px rgba(70, 200, 240, 0.85); }
.dx-run:active { transform: translateY(0); }
.dx-run:focus-visible { outline: 2px solid var(--cyan-soft); outline-offset: 3px; }

.dx-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.dx-ghost:hover { color: var(--text); border-color: var(--cyan); }
.dx-ghost:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.dx-stale {
  display: none;
  margin-top: 12px;
  font-size: 0.74rem;
  color: var(--gold);
}

.dx-stale.is-on { display: block; }

/* ---------------------------------------------------------------- results */
.dx-results {
  padding: clamp(18px, 2.2vw, 28px);
  min-width: 0;
  background:
    radial-gradient(700px 300px at 100% 0%, rgba(70, 200, 240, 0.08), transparent 65%),
    rgba(8, 15, 28, 0.35);
}

.dx-results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.dx-results-head h2 {
  margin: 0 0 4px;
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  letter-spacing: -0.02em;
}

.dx-results-sub {
  font-size: 0.76rem;
  color: var(--faint);
}

.dx-empty {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  min-height: 420px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(10, 18, 32, 0.4);
  color: var(--faint);
  font-size: 0.86rem;
  line-height: 1.7;
}

.dx-empty svg { color: rgba(70, 200, 240, 0.55); }

.dx-results-body[hidden] { display: none; }
.dx-empty[hidden] { display: none; }

.dx-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dx-kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, rgba(18, 32, 52, 0.75), rgba(12, 22, 38, 0.75));
  min-width: 0;
}

.dx-kpi-top {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dx-kpi-top svg { color: var(--cyan); flex: 0 0 auto; }

.dx-kpi strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.dx-kpi small {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--faint);
}

.dx-delta { font-weight: 600; }
.dx-delta.up { color: #6fe0a8; }
.dx-delta.down { color: #ff9b90; }
.dx-delta.flat { color: var(--faint); }

.dx-cards {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
}

.dx-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 22, 38, 0.72);
  padding: 16px;
  min-width: 0;
}

.dx-card h3 {
  margin: 0 0 2px;
  font-size: 0.86rem;
  letter-spacing: -0.01em;
}

.dx-card .dx-card-sub {
  font-size: 0.7rem;
  color: var(--faint);
  margin-bottom: 12px;
}

.dx-card--wide { grid-column: 1 / -1; }

.dx-chart { position: relative; }
.dx-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.dx-chart .grid-line { stroke: rgba(150, 172, 196, 0.12); stroke-width: 1; }
.dx-chart .axis-label { fill: var(--faint); font-size: 10px; font-family: var(--sans); }
.dx-chart .value-label { fill: var(--silver); font-size: 10px; font-family: var(--sans); font-weight: 500; }

.dx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--muted);
}

.dx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dx-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--cyan)); }

.dx-legend b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* insights */
.dx-insights {
  grid-column: 1 / -1;
  border: 1px solid rgba(201, 164, 92, 0.28);
  border-radius: 12px;
  background:
    radial-gradient(500px 200px at 100% 0%, rgba(201, 164, 92, 0.08), transparent 60%),
    rgba(12, 22, 38, 0.7);
  padding: 16px;
}

.dx-insights h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  font-size: 0.88rem;
}

.dx-insights h3 svg { color: var(--gold); }

.dx-insights ul { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; padding: 0; list-style: none; }

.dx-insights li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 0.79rem;
  line-height: 1.55;
  color: var(--muted);
}

.dx-insights li svg { color: var(--cyan); flex: 0 0 auto; margin-top: 2px; }
.dx-insights li b { color: var(--text); font-weight: 600; }

.dx-insights .dx-disclaimer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(201, 164, 92, 0.22);
  font-size: 0.68rem;
  color: var(--faint);
}

/* commercial CTA */
.dx-cta {
  margin-top: clamp(28px, 4vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: clamp(20px, 2.6vw, 30px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(600px 220px at 12% 0%, rgba(70, 200, 240, 0.1), transparent 60%),
    linear-gradient(180deg, rgba(16, 29, 47, 0.9), rgba(10, 18, 32, 0.95));
}

.dx-cta h2 {
  margin: 0 0 6px;
  font-size: clamp(1.05rem, 1.8vw, 1.38rem);
  letter-spacing: -0.02em;
}

.dx-cta p { margin: 0; color: var(--muted); font-size: 0.86rem; max-width: 52ch; }

.dx-cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* processing */
.dx-run[data-busy="true"] { opacity: 0.75; pointer-events: none; }
.dx-run[data-busy="true"] svg { animation: dx-spin 0.9s linear infinite; }

@keyframes dx-spin { to { transform: rotate(360deg); } }

.dx-results.is-fresh { animation: dx-in 0.35s var(--ease) both; }

@keyframes dx-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.dx-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- products card */
.dx-promo {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
  border: 1px solid rgba(70, 200, 240, 0.3);
  border-radius: 16px;
  padding: clamp(18px, 2.6vw, 30px);
  background:
    radial-gradient(600px 240px at 100% 0%, rgba(70, 200, 240, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(16, 29, 47, 0.92), rgba(10, 18, 32, 0.96));
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.8);
}

.dx-promo .kicker { margin-bottom: 10px; }
.dx-promo h2 { margin: 0 0 10px; font-size: clamp(1.3rem, 2.4vw, 1.9rem); letter-spacing: -0.025em; }
.dx-promo p { margin: 0 0 18px; color: var(--muted); font-size: 0.9rem; line-height: 1.7; max-width: 56ch; }

.dx-promo-steps {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.dx-promo-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.dx-promo-steps b {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(70, 200, 240, 0.45);
  color: var(--cyan);
  font-size: 0.68rem;
}

.dx-promo-visual {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 15, 28, 0.8);
  padding: 14px;
  overflow: hidden;
}

.dx-promo-visual svg { display: block; width: 100%; height: auto; }

.dx-promo-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .dx-layout { grid-template-columns: 1fr; }
  .dx-editor { border-right: 0; border-bottom: 1px solid var(--line); }
  .dx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dx-cards { grid-template-columns: 1fr; }
  .dx-tablewrap { max-height: none; }
}

@media (max-width: 860px) {
  .dx-promo { grid-template-columns: 1fr; }
  .dx-promo-visual { order: -1; }
  .dx-cta { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .dx-shell {
  scroll-margin-top: calc(var(--header, 72px) + 18px); border-radius: 14px; }
  .dx-topbar { flex-wrap: wrap; }
  .dx-topbar-note { display: none; }
  .dx-filters { grid-template-columns: 1fr; }
  .dx-kpis { grid-template-columns: 1fr 1fr; gap: 9px; }
  .dx-kpi { padding: 11px 11px 10px; }
  .dx-kpi strong { font-size: 1.05rem; }
  .dx-insights ul { grid-template-columns: 1fr; }
  .dx-table { font-size: 0.74rem; }
  .dx-table th, .dx-table td { padding: 7px 6px; }
  .dx-results { padding: 14px; }
  .dx-editor { padding: 14px; }
  .dx-hero { padding-top: 40px; }
  .dx-actions { gap: 8px; }
  .dx-run { flex-basis: 100%; order: -1; }
}

@media (max-width: 380px) {
  .dx-kpis { grid-template-columns: 1fr; }
  .dx-brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dx-results.is-fresh { animation: none; }
  .dx-run, .dx-region, .dx-table input { transition: none; }
}

.dx-promo-section { padding-top: clamp(10px, 2vw, 18px); }
.dx-promo-note { font-size: 0.74rem; color: var(--faint); }
.kicker-line { width: 26px; height: 1px; background: currentColor; opacity: 0.6; display: inline-block; }
