
:root {
  color-scheme: dark;
  --bg: #040706;
  --bg-elevated: #080d0c;
  --bg-panel: #0c1110;
  --bg-panel-soft: #101715;
  --bg-strong: #141b18;
  --surface: rgba(11, 17, 16, 0.94);
  --surface-soft: rgba(17, 25, 23, 0.78);
  --surface-muted: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.075);
  --border: rgba(218, 229, 220, 0.12);
  --border-strong: rgba(218, 229, 220, 0.22);
  --text: #f7fbf8;
  --text-muted: #b6c3bd;
  --text-soft: #7f8f88;
  --text-dim: #58635f;
  --cyan: #41d7df;
  --cyan-strong: #1ab8c2;
  --cyan-soft: rgba(65, 215, 223, 0.18);
  --gold: #d6b15f;
  --gold-strong: #f1c85f;
  --gold-soft: rgba(214, 177, 95, 0.18);
  --green: #6ce1a0;
  --green-soft: rgba(108, 225, 160, 0.16);
  --red: #ff7f73;
  --red-soft: rgba(255, 127, 115, 0.16);
  --blue: #73b7ff;
  --blue-soft: rgba(115, 183, 255, 0.16);
  --shadow-soft: 0 24px 90px rgba(0, 0, 0, 0.38);
  --shadow-tight: 0 14px 40px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --container: minmax(0, 1520px);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --focus: 0 0 0 3px rgba(65, 215, 223, 0.28);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2ee;
  --bg-elevated: #f8faf8;
  --bg-panel: #ffffff;
  --bg-panel-soft: #f4f7f5;
  --bg-strong: #e8eee9;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.78);
  --surface-muted: rgba(4, 7, 6, 0.045);
  --surface-hover: rgba(4, 7, 6, 0.075);
  --border: rgba(15, 27, 24, 0.12);
  --border-strong: rgba(15, 27, 24, 0.22);
  --text: #06100d;
  --text-muted: #3f4d48;
  --text-soft: #66756f;
  --text-dim: #88948f;
  --shadow-soft: 0 24px 90px rgba(16, 26, 22, 0.14);
  --shadow-tight: 0 14px 40px rgba(16, 26, 22, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(65, 215, 223, 0.11), transparent 32rem),
    linear-gradient(180deg, var(--bg) 0%, #050807 46%, var(--bg) 100%);
  color: var(--text);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 82%);
}

body::after {
  position: fixed;
  inset: auto 0 0;
  z-index: -1;
  height: 48vh;
  pointer-events: none;
  content: "";
  background: linear-gradient(to top, rgba(0, 0, 0, 0.42), transparent);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
canvas,
svg {
  display: block;
  max-width: 100%;
}

canvas {
  width: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 58%),
    rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: var(--radius-sm);
}

::selection {
  color: #02100f;
  background: var(--cyan);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  color: #02100f;
  background: var(--cyan);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform 180ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 20px;
}

main {
  display: grid;
  gap: 22px;
}

/* ==========================================================================
   Typography
   ========================================================================== */

.eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1rem, 1rem + 0.25rem, 1.25rem);
  font-weight: 800;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 1.35rem + 0.9rem, 2.25rem);
  line-height: 1.08;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.2;
}

h4 {
  margin-bottom: 6px;
  font-size: 0.98rem;
  line-height: 1.25;
}

p {
  color: var(--text-muted);
}

small {
  color: var(--text-soft);
}

/* ==========================================================================
   Top navigation
   ========================================================================== */

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 68px;
  margin-bottom: 22px;
  padding: 10px 12px;
  background: rgba(4, 7, 6, 0.78);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(18px);
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.78);
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  font-weight: 900;
  color: #02100f;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(65, 215, 223, 0.18);
}

.brand-lockup .eyebrow {
  margin-bottom: 2px;
  font-size: 0.66rem;
}

.topnav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  transition:
    color 180ms var(--ease),
    background 180ms var(--ease);
}

.topnav a:hover,
.topnav a:focus-visible {
  color: var(--text);
  background: var(--surface-hover);
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* ==========================================================================
   Buttons and form controls
   ========================================================================== */

.button,
.icon-button,
.tool-chip,
.provider-card,
.export-card {
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 180ms var(--ease),
    border-color 180ms var(--ease),
    background 180ms var(--ease),
    color 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.button:hover,
.button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.button-primary {
  color: #02100f;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border-color: rgba(65, 215, 223, 0.35);
  box-shadow: 0 16px 36px rgba(65, 215, 223, 0.16);
}

.button-primary:hover,
.button-primary:focus-visible {
  color: #02100f;
  background: linear-gradient(135deg, #68eef4, #81efb2);
}

.button-quiet {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
}

.button-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  font-size: 1.08rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-color: var(--border);
  border-radius: var(--radius-sm);
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input,
.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-soft);
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.044);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition:
    border-color 180ms var(--ease),
    background 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

textarea {
  min-height: 116px;
  resize: vertical;
}

select {
  color: var(--text);
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-soft) 50%),
    linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

input:focus,
select:focus,
textarea:focus,
.button:focus-visible,
.icon-button:focus-visible,
.tool-chip:focus-visible,
.provider-card:focus-visible,
.export-card:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.control-group {
  min-width: 0;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compact-controls {
  align-items: end;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  align-items: center;
  gap: 28px;
  min-height: 590px;
  padding: 38px;
  overflow: hidden;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.036), transparent 48%),
    linear-gradient(180deg, var(--bg-panel), rgba(6, 10, 9, 0.84));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero-copy {
  max-width: 650px;
}

.hero-copy h2 {
  max-width: 720px;
  margin-bottom: 20px;
  font-size: clamp(2rem, 2rem + 1.35rem, 3.45rem);
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 620px;
  margin-bottom: 26px;
  font-size: 1.08rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-visual {
  position: relative;
  min-width: 0;
}

.hero-visual::before {
  position: absolute;
  inset: 12% 5% 10% auto;
  width: 55%;
  content: "";
  background: linear-gradient(135deg, rgba(65, 215, 223, 0.22), rgba(214, 177, 95, 0.13));
  filter: blur(80px);
}

.screen-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: 16px;
  background: #050908;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.62);
  transform: perspective(1200px) rotateY(-5deg) rotateX(2deg);
  transform-origin: center;
}

.screen-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  margin-bottom: 14px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.screen-toolbar span {
  width: 8px;
  height: 8px;
  background: var(--text-dim);
  border-radius: 50%;
}

.screen-toolbar strong {
  margin-left: auto;
  color: var(--gold);
}

.screen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mini-chart,
.mini-kpis {
  min-height: 190px;
  padding: 12px;
  background: #050807;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
}

.mini-chart {
  position: relative;
  display: flex;
  align-items: end;
  gap: 8px;
  overflow: hidden;
}

.mini-chart::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

.mini-chart svg {
  position: absolute;
  inset: auto 10px 20px;
  width: calc(100% - 20px);
  height: 58%;
  overflow: visible;
}

.mini-chart path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.chart-bar {
  position: relative;
  z-index: 1;
  flex: 1;
  height: var(--h);
  min-height: 10px;
  background: linear-gradient(to top, var(--cyan-strong), var(--cyan));
  border-radius: 4px 4px 0 0;
  opacity: 0.9;
}

.mini-chart.tall .chart-bar {
  max-width: 16px;
}

.mini-chart.bars {
  justify-content: center;
}

.mini-chart.line {
  grid-column: span 2;
  min-height: 160px;
}

.mini-chart.line svg {
  inset: 16px;
  width: calc(100% - 32px);
  height: calc(100% - 32px);
}

.mini-chart .line-a {
  stroke: var(--cyan);
}

.mini-chart .line-b {
  stroke: var(--gold);
}

.mini-chart .line-c {
  stroke: var(--green);
}

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  grid-column: span 2;
  min-height: auto;
}

.mini-kpis article {
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
}

.mini-kpis span {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  color: var(--text-soft);
}

.mini-kpis strong {
  font-size: 1.25rem;
}

/* ==========================================================================
   Status strip
   ========================================================================== */

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.status-card,
.kpi-card,
.chart-panel,
.insight-panel,
.internet-panel,
.data-section,
.exports-section,
.control-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.038), transparent 58%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-tight);
}

.status-card {
  min-height: 104px;
  padding: 18px;
}

.status-card span,
.kpi-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.77rem;
  font-weight: 800;
  color: var(--text-soft);
  text-transform: uppercase;
}

.status-card strong {
  display: block;
  overflow: hidden;
  font-size: 1.28rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Workspace
   ========================================================================== */

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.control-panel {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.panel-heading {
  min-width: 0;
}

.panel-heading h2 {
  font-size: 1.35rem;
}

.split-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.tight-heading {
  margin-bottom: 12px;
}

.heading-actions,
.table-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 20px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(65, 215, 223, 0.12), transparent 48%),
    rgba(255, 255, 255, 0.035);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  transition:
    border-color 180ms var(--ease),
    background 180ms var(--ease),
    transform 180ms var(--ease);
}

.drop-zone.is-dragging {
  background:
    linear-gradient(135deg, rgba(65, 215, 223, 0.18), rgba(108, 225, 160, 0.1)),
    rgba(255, 255, 255, 0.055);
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.drop-zone h3 {
  margin: 8px 0 6px;
  font-size: 1rem;
}

.drop-zone p {
  max-width: 260px;
  margin: 0;
  font-size: 0.86rem;
}

.drop-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #02100f;
  background: var(--cyan);
  border-radius: var(--radius-sm);
}

.tool-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tool-chip {
  min-height: 42px;
  padding: 0 10px;
  font-size: 0.79rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--border);
  border-radius: var(--radius-sm);
}

.tool-chip:hover,
.tool-chip:focus-visible,
.tool-chip.is-active {
  color: var(--text);
  background: rgba(65, 215, 223, 0.12);
  border-color: rgba(65, 215, 223, 0.42);
}

.dashboard-panel {
  min-width: 0;
  padding: 0;
}

.dashboard-panel > .panel-heading {
  padding: 22px 22px 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 22px;
}

.kpi-card {
  min-height: 132px;
  padding: 18px;
  box-shadow: none;
}

.kpi-card strong {
  display: block;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  font-size: clamp(1.7rem, 1.45rem + 0.65rem, 2.35rem);
  line-height: 1;
}

.kpi-card small {
  display: block;
}

.kpi-card::after {
  display: block;
  width: 58px;
  height: 2px;
  margin-top: 14px;
  content: "";
  background: var(--green);
}

.kpi-card.accent-cyan::after {
  background: var(--cyan);
}

.kpi-card.accent-gold::after {
  background: var(--gold);
}

.kpi-card.accent-red::after {
  background: var(--red);
}

/* ==========================================================================
   Charts
   ========================================================================== */

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 22px 22px;
}

.chart-panel {
  min-width: 0;
  padding: 16px;
  box-shadow: none;
}

.chart-panel.wide {
  grid-column: span 2;
}

.chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-heading .eyebrow {
  margin-bottom: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: #02100f;
  background: var(--cyan);
  border-radius: 999px;
  white-space: nowrap;
}

.badge.muted {
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

/* ==========================================================================
   Insight panels
   ========================================================================== */

.insight-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.insight-panel,
.internet-panel,
.data-section,
.exports-section {
  min-width: 0;
  padding: 22px;
}

.narrative {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.narrative p {
  margin-bottom: 0;
}

.narrative .narrative-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.narrative-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.narrative-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.narrative-card span {
  display: block;
  color: var(--text-muted);
}

.profile-table-wrap,
.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.profile-table,
.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.profile-table th,
.profile-table td,
.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.profile-table th,
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--text-soft);
  text-transform: uppercase;
  background: var(--bg-panel);
}

.profile-table td,
.data-table td {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.profile-table tbody tr:hover,
.data-table tbody tr:hover {
  background: rgba(65, 215, 223, 0.06);
}

.type-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.type-pill.numeric {
  color: var(--cyan);
}

.type-pill.date {
  color: var(--gold);
}

.type-pill.text {
  color: var(--green);
}

/* ==========================================================================
   Internet search
   ========================================================================== */

.internet-panel {
  scroll-margin-top: 100px;
}

.internet-grid {
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.search-lab {
  display: grid;
  gap: 14px;
}

.advanced-box {
  padding: 14px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.advanced-box summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

.advanced-box p {
  margin: 10px 0 14px;
  font-size: 0.88rem;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.provider-card {
  min-height: 76px;
  padding: 12px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--border);
  border-radius: var(--radius-sm);
}

.provider-card:hover,
.provider-card:focus-visible {
  background: rgba(65, 215, 223, 0.1);
  border-color: rgba(65, 215, 223, 0.42);
  transform: translateY(-1px);
}

.provider-card span,
.provider-card small {
  display: block;
}

.provider-card span {
  margin-bottom: 2px;
  font-weight: 900;
}

.provider-card small {
  color: var(--text-soft);
}

.search-results-panel {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.search-status {
  min-height: 36px;
  margin-bottom: 12px;
  padding: 10px 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.results-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.result-card:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.052);
}

.result-card h4 {
  margin: 4px 0 6px;
}

.result-card p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.result-source {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--gold);
  background: var(--gold-soft);
  border-radius: 999px;
}

.result-card a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 900;
  color: #02100f;
  background: var(--cyan);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Table and exports
   ========================================================================== */

.data-section {
  scroll-margin-top: 100px;
}

.data-section .panel-heading {
  margin-bottom: 16px;
}

.data-table {
  min-width: 980px;
}

.data-table td.numeric-cell {
  color: var(--cyan);
  font-family: var(--font-mono);
}

.data-table td.date-cell {
  color: var(--gold);
  font-family: var(--font-mono);
}

.data-table td.empty-cell {
  color: var(--text-dim);
  font-style: italic;
}

.page-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 8px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.export-card {
  min-height: 136px;
  padding: 18px;
  text-align: left;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(65, 215, 223, 0.09), transparent 46%),
    rgba(255, 255, 255, 0.035);
  border-color: var(--border);
  border-radius: var(--radius);
}

.export-card:hover,
.export-card:focus-visible {
  background:
    linear-gradient(135deg, rgba(65, 215, 223, 0.13), rgba(214, 177, 95, 0.05)),
    rgba(255, 255, 255, 0.052);
  border-color: rgba(65, 215, 223, 0.42);
  transform: translateY(-1px);
}

.export-card strong,
.export-card span {
  display: block;
}

.export-card strong {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.export-card span {
  color: var(--text-muted);
}

/* ==========================================================================
   Toasts and micro states
   ========================================================================== */

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  padding: 13px 14px;
  color: var(--text);
  background: rgba(8, 13, 12, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-tight);
  animation: toast-in 260ms var(--ease) both;
}

html[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.96);
}

.toast strong {
  display: block;
  margin-bottom: 2px;
}

.toast span {
  display: block;
  color: var(--text-muted);
  font-size: 0.88rem;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.is-hidden {
  display: none !important;
}

.is-loading {
  cursor: progress;
}

.empty-state {
  padding: 28px;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */

* {
  scrollbar-color: rgba(65, 215, 223, 0.45) rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

::-webkit-scrollbar-thumb {
  background: rgba(65, 215, 223, 0.45);
  border: 2px solid rgba(4, 7, 6, 0.9);
  border-radius: 999px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topnav {
    display: none;
  }

  .hero-section {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-copy {
    max-width: none;
  }

  .screen-card {
    transform: none;
  }

  .workspace-grid,
  .insight-layout,
  .internet-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    top: 8px;
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .top-actions .button {
    flex: 1 1 auto;
  }

  .hero-section,
  .insight-panel,
  .internet-panel,
  .data-section,
  .exports-section {
    padding: 18px;
  }

  .hero-copy h2 {
    font-size: 2.25rem;
  }

  .status-strip,
  .kpi-grid,
  .chart-grid,
  .export-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-panel > .panel-heading,
  .kpi-grid,
  .chart-grid {
    padding-left: 16px;
    padding-right: 16px;
  }

  .chart-panel.wide {
    grid-column: span 2;
  }

  .provider-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
  }

  .hero-section {
    padding: 16px;
  }

  .hero-copy h2 {
    font-size: 1.9rem;
  }

  .hero-actions,
  .control-row,
  .split-heading,
  .table-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions .button,
  .table-tools .button,
  .compact-controls .button {
    width: 100%;
  }

  .screen-grid,
  .mini-kpis,
  .status-strip,
  .kpi-grid,
  .chart-grid,
  .insight-layout,
  .internet-grid,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .mini-chart.line,
  .mini-kpis,
  .chart-panel.wide {
    grid-column: span 1;
  }

  .screen-card {
    padding: 10px;
  }

  .mini-chart,
  .mini-kpis {
    min-height: 150px;
  }

  .kpi-card {
    min-height: 116px;
  }

  .provider-grid,
  .tool-stack {
    grid-template-columns: 1fr;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .result-card a {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}